summaryrefslogtreecommitdiffstats
path: root/kspread/kspread_editors.cc
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
commitf008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch)
tree8e9244c4d4957c36be81e15b566b4aa5ea26c982 /kspread/kspread_editors.cc
parent1210f27b660efb7b37ff43ec68763e85a403471f (diff)
downloadkoffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz
koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip
TQt4 port koffice
This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kspread/kspread_editors.cc')
-rw-r--r--kspread/kspread_editors.cc372
1 files changed, 186 insertions, 186 deletions
diff --git a/kspread/kspread_editors.cc b/kspread/kspread_editors.cc
index 49a592a0..24df68ed 100644
--- a/kspread/kspread_editors.cc
+++ b/kspread/kspread_editors.cc
@@ -31,21 +31,21 @@
#include <klistbox.h>
-#include <qapplication.h>
-#include <qlistbox.h>
-#include <qtimer.h>
-#include <qlabel.h>
-#include <qvbox.h>
-#include <qvaluelist.h>
-#include <private/qrichtext_p.h>
+#include <tqapplication.h>
+#include <tqlistbox.h>
+#include <tqtimer.h>
+#include <tqlabel.h>
+#include <tqvbox.h>
+#include <tqvaluelist.h>
+#include <private/tqrichtext_p.h>
//#include <klineedit.h>
#include <ktextedit.h>
-#include <qapplication.h>
-#include <qbutton.h>
-#include <qfont.h>
-#include <qfontmetrics.h>
-#include <qregexp.h>
+#include <tqapplication.h>
+#include <tqbutton.h>
+#include <tqfont.h>
+#include <tqfontmetrics.h>
+#include <tqregexp.h>
#include <kdebug.h>
using namespace KSpread;
@@ -80,8 +80,8 @@ public:
};
-FormulaEditorHighlighter::FormulaEditorHighlighter(QTextEdit* textEdit, Canvas* canvas)
- : QSyntaxHighlighter(textEdit)
+FormulaEditorHighlighter::FormulaEditorHighlighter(TQTextEdit* textEdit, Canvas* canvas)
+ : TQSyntaxHighlighter(textEdit)
{
d = new Private();
d->canvas = canvas;
@@ -97,10 +97,10 @@ const Tokens& FormulaEditorHighlighter::formulaTokens() const
return d->tokens;
}
-int FormulaEditorHighlighter::highlightParagraph(const QString& text, int /* endStateOfLastPara */)
+int FormulaEditorHighlighter::highlightParagraph(const TQString& text, int /* endStateOfLastPara */)
{
// reset syntax highlighting
- setFormat(0, text.length(), Qt::black);
+ setFormat(0, text.length(), TQt::black);
// save the old ones to identify range changes
Tokens oldTokens = d->tokens;
@@ -110,14 +110,14 @@ int FormulaEditorHighlighter::highlightParagraph(const QString& text, int /* end
Formula f;
d->tokens = f.scan(text);
- QFont editorFont = textEdit()->currentFont();
- QFont font;
+ TQFont editorFont = textEdit()->currentFont();
+ TQFont font;
uint oldRangeCount = d->rangeCount;
d->rangeCount = 0;
- QValueList<QColor> colors = d->canvas->choice()->colors();
- QValueList<Range> alreadyFoundRanges;
+ TQValueList<TQColor> colors = d->canvas->choice()->colors();
+ TQValueList<Range> alreadyFoundRanges;
for (uint i = 0; i < d->tokens.count(); ++i)
{
@@ -137,21 +137,21 @@ int FormulaEditorHighlighter::highlightParagraph(const QString& text, int /* end
Range newRange( token.text() );
- if (!alreadyFoundRanges.contains(newRange))
+ if (!alreadyFoundRanges.tqcontains(newRange))
{
alreadyFoundRanges.append(newRange);
d->rangeCount++;
}
- setFormat(token.pos() + 1, token.text().length(), colors[ alreadyFoundRanges.findIndex(newRange) % colors.size()] );
+ setFormat(token.pos() + 1, token.text().length(), colors[ alreadyFoundRanges.tqfindIndex(newRange) % colors.size()] );
}
break;
case Token::Boolean: // True, False (also i18n-ized)
-/* font = QFont(editorFont);
+/* font = TQFont(editorFont);
font.setBold(true);
setFormat(token.pos() + 1, token.text().length(), font);*/
break;
case Token::Identifier: // function name or named area*/
-/* font = QFont(editorFont);
+/* font = TQFont(editorFont);
font.setBold(true);
setFormat(token.pos() + 1, token.text().length(), font);*/
break;
@@ -195,7 +195,7 @@ void FormulaEditorHighlighter::handleBrace( uint index )
int opType = token.asOperator();
bool highlightBrace=false;
- //Check where the cursor is in relation to this left or right parenthesis token.
+ //Check where the cursor is in relation to this left or right tqparenthesis token.
//Only one pair of braces should be highlighted at a time, and if the cursor
//is between two braces, the inner-most pair should be highlighted.
@@ -229,7 +229,7 @@ void FormulaEditorHighlighter::handleBrace( uint index )
if (highlightBrace)
{
- QFont font = QFont( textEdit()->currentFont() );
+ TQFont font = TQFont( textEdit()->currentFont() );
font.setBold(true);
setFormat(token.pos() + 1, token.text().length(), font);
@@ -303,38 +303,38 @@ class FunctionCompletion::Private
{
public:
CellEditor* editor;
- QVBox *completionPopup;
+ TQVBox *completionPopup;
KListBox *completionListBox;
- QLabel* hintLabel;
+ TQLabel* hintLabel;
};
FunctionCompletion::FunctionCompletion( CellEditor* editor ):
-QObject( editor )
+TQObject( editor )
{
d = new Private;
d->editor = editor;
d->hintLabel = 0;
- d->completionPopup = new QVBox( editor->topLevelWidget(), 0, WType_Popup );
- d->completionPopup->setFrameStyle( QFrame::Box | QFrame::Plain );
+ d->completionPopup = new TQVBox( editor->tqtopLevelWidget(), 0, WType_Popup );
+ d->completionPopup->setFrameStyle( TQFrame::Box | TQFrame::Plain );
d->completionPopup->setLineWidth( 1 );
d->completionPopup->installEventFilter( this );
- d->completionPopup->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum);
+ d->completionPopup->tqsetSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Minimum);
d->completionListBox = new KListBox( d->completionPopup );
d->completionPopup->setFocusProxy( d->completionListBox );
- d->completionListBox->setFrameStyle( QFrame::NoFrame );
+ d->completionListBox->setFrameStyle( TQFrame::NoFrame );
d->completionListBox->setVariableWidth( true );
d->completionListBox->installEventFilter( this );
- connect( d->completionListBox, SIGNAL(selected(const QString&)), this,
- SLOT(itemSelected(const QString&)) );
- connect( d->completionListBox, SIGNAL(highlighted(const QString&)), this,
- SLOT(itemSelected(const QString&)) );
-
- d->hintLabel = new QLabel( 0, "autocalc", Qt::WStyle_StaysOnTop |
- Qt::WStyle_Customize | Qt::WStyle_NoBorder | Qt::WStyle_Tool | Qt::WX11BypassWM );
- d->hintLabel->setFrameStyle( QFrame::Plain | QFrame::Box );
- d->hintLabel->setPalette( QToolTip::palette() );
+ connect( d->completionListBox, TQT_SIGNAL(selected(const TQString&)), this,
+ TQT_SLOT(itemSelected(const TQString&)) );
+ connect( d->completionListBox, TQT_SIGNAL(highlighted(const TQString&)), this,
+ TQT_SLOT(itemSelected(const TQString&)) );
+
+ d->hintLabel = new TQLabel( 0, "autocalc", TQt::WStyle_StaysOnTop |
+ TQt::WStyle_Customize | TQt::WStyle_NoBorder | TQt::WStyle_Tool | TQt::WX11BypassWM );
+ d->hintLabel->setFrameStyle( TQFrame::Plain | TQFrame::Box );
+ d->hintLabel->setPalette( TQToolTip::palette() );
d->hintLabel->hide();
}
@@ -344,7 +344,7 @@ FunctionCompletion::~FunctionCompletion()
delete d;
}
-void FunctionCompletion::itemSelected( const QString& item )
+void FunctionCompletion::itemSelected( const TQString& item )
{
KSpread::FunctionDescription* desc;
desc = KSpread::FunctionRepository::self()->functionInfo(item);
@@ -354,7 +354,7 @@ void FunctionCompletion::itemSelected( const QString& item )
return;
}
- QString helpText = desc->helpText()[0];
+ TQString helpText = desc->helpText()[0];
if( helpText.isEmpty() )
{
d->hintLabel->hide();
@@ -366,23 +366,23 @@ void FunctionCompletion::itemSelected( const QString& item )
d->hintLabel->adjustSize();
// reposition nicely
- QPoint pos = d->editor->mapToGlobal( QPoint( d->editor->width(), 0 ) );
+ TQPoint pos = d->editor->mapToGlobal( TQPoint( d->editor->width(), 0 ) );
pos.setY( pos.y() - d->hintLabel->height() - 1 );
d->hintLabel->move( pos );
d->hintLabel->show();
d->hintLabel->raise();
// do not show it forever
- //QTimer::singleShot( 5000, d->hintLabel, SLOT( hide()) );
+ //TQTimer::singleShot( 5000, d->hintLabel, TQT_SLOT( hide()) );
}
-bool FunctionCompletion::eventFilter( QObject *obj, QEvent *ev )
+bool FunctionCompletion::eventFilter( TQObject *obj, TQEvent *ev )
{
- if ( obj == d->completionPopup || obj == d->completionListBox )
+ if ( TQT_BASE_OBJECT(obj) == TQT_BASE_OBJECT(d->completionPopup) || TQT_BASE_OBJECT(obj) == TQT_BASE_OBJECT(d->completionListBox) )
{
- if ( ev->type() == QEvent::KeyPress )
+ if ( ev->type() == TQEvent::KeyPress )
{
- QKeyEvent *ke = (QKeyEvent*)ev;
+ TQKeyEvent *ke = (TQKeyEvent*)ev;
if ( ke->key() == Key_Enter || ke->key() == Key_Return )
{
doneCompletion();
@@ -397,11 +397,11 @@ bool FunctionCompletion::eventFilter( QObject *obj, QEvent *ev )
d->hintLabel->hide();
d->completionPopup->close();
d->editor->setFocus();
- QApplication::sendEvent( d->editor, ev );
+ TQApplication::sendEvent( d->editor, ev );
return true;
}
- if ( ev->type() == QEvent::MouseButtonDblClick )
+ if ( ev->type() == TQEvent::MouseButtonDblClick )
{
doneCompletion();
return true;
@@ -419,29 +419,29 @@ void FunctionCompletion::doneCompletion()
emit selectedCompletion( d->completionListBox->currentText() );
}
-void FunctionCompletion::showCompletion( const QStringList &choices )
+void FunctionCompletion::showCompletion( const TQStringList &choices )
{
if( !choices.count() ) return;
d->completionListBox->clear();
for( unsigned i = 0; i < choices.count(); i++ )
- new QListBoxText( (QListBox*)d->completionListBox, choices[i] );
+ new TQListBoxText( (TQListBox*)d->completionListBox, choices[i] );
d->completionListBox->setCurrentItem( 0 );
// size of the pop-up
d->completionPopup->setMaximumHeight( 100 );
- d->completionPopup->resize( d->completionListBox->sizeHint() +
- QSize( d->completionListBox->verticalScrollBar()->width() + 4,
+ d->completionPopup->resize( d->completionListBox->tqsizeHint() +
+ TQSize( d->completionListBox->verticalScrollBar()->width() + 4,
d->completionListBox->horizontalScrollBar()->height() + 4 ) );
int h = d->completionListBox->height();
int w = d->completionListBox->width();
- QPoint pos = d->editor->globalCursorPosition();
+ TQPoint pos = d->editor->globalCursorPosition();
// if popup is partially invisible, move to other position
// FIXME check it if it works in Xinerama multihead
- int screen_num = QApplication::desktop()->screenNumber( d->completionPopup );
- QRect screen = QApplication::desktop()->screenGeometry( screen_num );
+ int screen_num = TQApplication::desktop()->screenNumber( d->completionPopup );
+ TQRect screen = TQApplication::desktop()->screenGeometry( screen_num );
if( pos.y() + h > screen.y()+screen.height() )
pos.setY( pos.y() - h - d->editor->height() );
if( pos.x() + w > screen.x()+screen.width() )
@@ -468,9 +468,9 @@ public:
KTextEdit* textEdit;
FormulaEditorHighlighter* highlighter;
FunctionCompletion* functionCompletion;
- QTimer* functionCompletionTimer;
+ TQTimer* functionCompletionTimer;
- QPoint globalCursorPos;
+ TQPoint globalCursorPos;
bool captureAllKeyEvents : 1;
bool checkChoice : 1;
@@ -487,13 +487,13 @@ public:
CellEditor::CellEditor( Cell* _cell, Canvas* _parent, bool captureAllKeyEvents, const char* _name )
- : QWidget( _parent, _name )
+ : TQWidget( _parent, _name )
{
d = new Private();
d->cell = _cell;
d->canvas = _parent;
d->textEdit = new KTextEdit(this);
- d->globalCursorPos = QPoint();
+ d->globalCursorPos = TQPoint();
d->captureAllKeyEvents = captureAllKeyEvents;
d->checkChoice = true;
d->updateChoice = true;
@@ -505,28 +505,28 @@ CellEditor::CellEditor( Cell* _cell, Canvas* _parent, bool captureAllKeyEvents,
d->currentToken = 0;
d->rangeCount = 0;
-//TODO - Get rid of QTextEdit margins, this doesn't seem easily possible in Qt 3.3, so a job for Qt 4 porting.
+//TODO - Get rid of TQTextEdit margins, this doesn't seem easily possible in TQt 3.3, so a job for TQt 4 porting.
- d->textEdit->setHScrollBarMode(QScrollView::AlwaysOff);
- d->textEdit->setVScrollBarMode(QScrollView::AlwaysOff);
- d->textEdit->setFrameStyle(QFrame::NoFrame);
+ d->textEdit->setHScrollBarMode(TQScrollView::AlwaysOff);
+ d->textEdit->setVScrollBarMode(TQScrollView::AlwaysOff);
+ d->textEdit->setFrameStyle(TQFrame::NoFrame);
d->textEdit->setLineWidth(0);
d->textEdit->installEventFilter( this );
d->highlighter = new FormulaEditorHighlighter(d->textEdit, _parent);
d->functionCompletion = new FunctionCompletion( this );
- d->functionCompletionTimer = new QTimer( this );
- connect( d->functionCompletion, SIGNAL( selectedCompletion( const QString& ) ),
- SLOT( functionAutoComplete( const QString& ) ) );
- connect( d->textEdit, SIGNAL( textChanged() ), SLOT( checkFunctionAutoComplete() ) );
- connect( d->functionCompletionTimer, SIGNAL( timeout() ),
- SLOT( triggerFunctionAutoComplete() ) );
+ d->functionCompletionTimer = new TQTimer( this );
+ connect( d->functionCompletion, TQT_SIGNAL( selectedCompletion( const TQString& ) ),
+ TQT_SLOT( functionAutoComplete( const TQString& ) ) );
+ connect( d->textEdit, TQT_SIGNAL( textChanged() ), TQT_SLOT( checkFunctionAutoComplete() ) );
+ connect( d->functionCompletionTimer, TQT_SIGNAL( timeout() ),
+ TQT_SLOT( triggerFunctionAutoComplete() ) );
if (!cell()->format()->multiRow(cell()->column(),cell()->row()))
- d->textEdit->setWordWrap(QTextEdit::NoWrap);
+ d->textEdit->setWordWrap(TQTextEdit::NoWrap);
else
- d->textEdit->setWrapPolicy(QTextEdit::AtWordOrDocumentBoundary);
+ d->textEdit->setWrapPolicy(TQTextEdit::AtWordOrDocumentBoundary);
//TODO - Custom KTextEdit class which supports text completion
/*
@@ -536,24 +536,24 @@ CellEditor::CellEditor( Cell* _cell, Canvas* _parent, bool captureAllKeyEvents,
*/
setFocusProxy( d->textEdit );
- connect( d->textEdit, SIGNAL( cursorPositionChanged(int,int) ), this, SLOT (slotCursorPositionChanged(int,int)));
- connect( d->textEdit, SIGNAL( cursorPositionChanged(QTextCursor*) ), this, SLOT (slotTextCursorChanged(QTextCursor*)));
- connect( d->textEdit, SIGNAL( textChanged() ), this, SLOT( slotTextChanged() ) );
+ connect( d->textEdit, TQT_SIGNAL( cursorPositionChanged(int,int) ), this, TQT_SLOT (slotCursorPositionChanged(int,int)));
+ connect( d->textEdit, TQT_SIGNAL( cursorPositionChanged(TQTextCursor*) ), this, TQT_SLOT (slotTextCursorChanged(TQTextCursor*)));
+ connect( d->textEdit, TQT_SIGNAL( textChanged() ), this, TQT_SLOT( slotTextChanged() ) );
-// connect( d->textEdit, SIGNAL(completionModeChanged( KGlobalSettings::Completion )),this,SLOT (slotCompletionModeChanged(KGlobalSettings::Completion)));
+// connect( d->textEdit, TQT_SIGNAL(completionModeChanged( KGlobalSettings::Completion )),this,TQT_SLOT (slotCompletionModeChanged(KGlobalSettings::Completion)));
// A choose should always start at the edited cell
// canvas()->setChooseMarkerRow( canvas()->markerRow() );
// canvas()->setChooseMarkerColumn( canvas()->markerColumn() );
// set font size according to zoom factor
- QFont font( _cell->format()->font() );
+ TQFont font( _cell->format()->font() );
font.setPointSizeFloat( 0.01 * _parent->doc()->zoom() * font.pointSizeFloat() );
d->textEdit->setFont( font );
if (d->fontLength == 0)
{
- QFontMetrics fm( d->textEdit->font() );
+ TQFontMetrics fm( d->textEdit->font() );
d->fontLength = fm.width('x');
}
}
@@ -578,7 +578,7 @@ Canvas* CellEditor::canvas() const
return d->canvas;
}
-QPoint CellEditor::globalCursorPosition() const
+TQPoint CellEditor::globalCursorPosition() const
{
return d->globalCursorPos;
}
@@ -594,7 +594,7 @@ void CellEditor::triggerFunctionAutoComplete()
// tokenize the expression (don't worry, this is very fast)
int para = 0, curPos = 0;
d->textEdit->getCursorPosition( &para, &curPos );
- QString subtext = d->textEdit->text().left( curPos );
+ TQString subtext = d->textEdit->text().left( curPos );
KSpread::Formula f;
KSpread::Tokens tokens = f.scan( subtext );
@@ -605,14 +605,14 @@ void CellEditor::triggerFunctionAutoComplete()
// last token must be an identifier
if( !lastToken.isIdentifier() ) return;
- QString id = lastToken.text();
+ TQString id = lastToken.text();
if( id.length() < 1 ) return;
// find matches in function names
- QStringList fnames = KSpread::FunctionRepository::self()->functionNames();
- QStringList choices;
+ TQStringList fnames = KSpread::FunctionRepository::self()->functionNames();
+ TQStringList choices;
for( unsigned i=0; i<fnames.count(); i++ )
- if( fnames[i].startsWith( id, false ) )
+ if( fnames[i].tqstartsWith( id, false ) )
choices.append( fnames[i] );
choices.sort();
@@ -628,13 +628,13 @@ void CellEditor::triggerFunctionAutoComplete()
d->functionCompletion->showCompletion( choices );
}
-void CellEditor::functionAutoComplete( const QString& item )
+void CellEditor::functionAutoComplete( const TQString& item )
{
if( item.isEmpty() ) return;
int para = 0, curPos = 0;
d->textEdit->getCursorPosition( &para, &curPos );
- QString subtext = text().left( curPos );
+ TQString subtext = text().left( curPos );
KSpread::Formula f;
KSpread::Tokens tokens = f.scan( subtext );
@@ -743,8 +743,8 @@ void CellEditor::slotCursorPositionChanged(int /* para */, int pos)
{
d->highlighter->resetRangeChanged();
- disconnect( d->canvas->choice(), SIGNAL(changed(const Region&)),
- d->canvas->view(), SLOT(slotScrollChoice(const Region&)) );
+ disconnect( d->canvas->choice(), TQT_SIGNAL(changed(const Region&)),
+ d->canvas->view(), TQT_SLOT(slotScrollChoice(const Region&)) );
d->canvas->doc()->emitBeginOperation();
setUpdateChoice(false);
@@ -757,7 +757,7 @@ void CellEditor::slotCursorPositionChanged(int /* para */, int pos)
//A list of regions which have already been highlighted on the spreadsheet.
//This is so that we don't end up highlighting the same region twice in two different
//colours.
- QValueList<Region> alreadyUsedRegions;
+ TQValueList<Region> alreadyUsedRegions;
for (uint i = 0; i < tokens.count(); ++i)
{
@@ -768,9 +768,9 @@ void CellEditor::slotCursorPositionChanged(int /* para */, int pos)
Region region(d->canvas->view(), token.text());
it = region.constBegin();
- if (!alreadyUsedRegions.contains(region))
+ if (!alreadyUsedRegions.tqcontains(region))
{
- QRect r=(*it)->rect();
+ TQRect r=(*it)->rect();
if (d->canvas->choice()->isEmpty())
d->canvas->choice()->initialize((*it)->rect(), (*it)->sheet());
@@ -783,22 +783,22 @@ void CellEditor::slotCursorPositionChanged(int /* para */, int pos)
}
setUpdateChoice(true);
d->canvas->doc()->emitEndOperation(*d->canvas->choice());
- connect( d->canvas->choice(), SIGNAL(changed(const Region&)),
- d->canvas->view(), SLOT(slotScrollChoice(const Region&)) );
+ connect( d->canvas->choice(), TQT_SIGNAL(changed(const Region&)),
+ d->canvas->view(), TQT_SLOT(slotScrollChoice(const Region&)) );
}
}
}
-void CellEditor::slotTextCursorChanged(QTextCursor* cursor)
+void CellEditor::slotTextCursorChanged(TQTextCursor* cursor)
{
- QTextStringChar *chr = cursor->paragraph()->at( cursor->index() );
+ TQTextStringChar *chr = cursor->paragraph()->at( cursor->index() );
int h = cursor->paragraph()->lineHeightOfChar( cursor->index() );
int x = cursor->paragraph()->rect().x() + chr->x;
int y, dummy;
cursor->paragraph()->lineHeightOfChar( cursor->index(), &dummy, &y );
y += cursor->paragraph()->rect().y();
- d->globalCursorPos = d->textEdit->mapToGlobal( d->textEdit-> contentsToViewport( QPoint( x, y + h ) ) );
+ d->globalCursorPos = d->textEdit->mapToGlobal( d->textEdit-> contentsToViewport( TQPoint( x, y + h ) ) );
}
void CellEditor::cut()
@@ -816,19 +816,19 @@ void CellEditor::copy()
d->textEdit->copy();
}
-void CellEditor::setEditorFont(QFont const & font, bool updateSize)
+void CellEditor::setEditorFont(TQFont const & font, bool updateSize)
{
- QFont tmpFont( font );
+ TQFont tmpFont( font );
tmpFont.setPointSizeFloat( 0.01 * canvas()->doc()->zoom() * tmpFont.pointSizeFloat() );
d->textEdit->setFont( tmpFont );
if (updateSize)
{
- QFontMetrics fm( d->textEdit->font() );
+ TQFontMetrics fm( d->textEdit->font() );
d->fontLength = fm.width('x');
int mw = fm.width( d->textEdit->text() ) + d->fontLength;
- // don't make it smaller: then we would have to repaint the obscured cells
+ // don't make it smaller: then we would have to tqrepaint the obscured cells
if (mw < width())
mw = width();
@@ -850,13 +850,13 @@ void CellEditor::slotTextChanged()
// kdDebug() << k_funcinfo << endl;
//FIXME - text() may return richtext?
- QString t = text();
+ TQString t = text();
if (t.length() > d->length)
{
d->length = t.length();
- QFontMetrics fm(d->textEdit->font());
+ TQFontMetrics fm(d->textEdit->font());
// - requiredWidth = width of text plus some spacer characters
int requiredWidth = fm.width(t) + (2*fm.width('x'));
@@ -864,7 +864,7 @@ void CellEditor::slotTextChanged()
//allow the text to fit if the new text is too wide
//For multi-row (word-wrap enabled) cells, the text editor must expand vertically to
//allow for new rows of text & the width of the text editor is not affected
- if (d->textEdit->wordWrap() == QTextEdit::NoWrap)
+ if (d->textEdit->wordWrap() == TQTextEdit::NoWrap)
{
if (requiredWidth > width())
{
@@ -892,7 +892,7 @@ void CellEditor::slotTextChanged()
d->length = t.length();
// Too slow for long texts
- // QFontMetrics fm( d->textEdit->font() );
+ // TQFontMetrics fm( d->textEdit->font() );
// int mw = fm.width( t ) + fm.width('x');
int mw = d->fontLength * d->length;
@@ -911,7 +911,7 @@ void CellEditor::slotTextChanged()
{
if ( (t.length() == 1) && t[0].isDigit() )
{
- QString tmp = t + " %";
+ TQString tmp = t + " %";
d->textEdit->setText(tmp);
d->textEdit->setCursorPosition(0,1);
return;
@@ -938,7 +938,7 @@ bool CellEditor::checkChoice()
d->length_namecell = 0;
d->currentToken = 0;
- QString text = d->textEdit->text();
+ TQString text = d->textEdit->text();
if ( text[0] != '=' )
{
canvas()->setChooseMode(false);
@@ -1019,7 +1019,7 @@ void CellEditor::updateChoice()
{
}
- QString name_cell = choice->activeSubRegionName();
+ TQString name_cell = choice->activeSubRegionName();
Tokens tokens = d->highlighter->formulaTokens();
uint start = 1;
@@ -1043,8 +1043,8 @@ void CellEditor::updateChoice()
d->length_text = text().length();
//kdDebug(36001) << "updateChooseMarker2 len=" << d->length_namecell << endl;
- QString oldText = text();
- QString newText = oldText.left(start) + name_cell + oldText.right(d->length_text - start - length);
+ TQString oldText = text();
+ TQString newText = oldText.left(start) + name_cell + oldText.right(d->length_text - start - length);
setCheckChoice( false );
setText( newText );
@@ -1058,27 +1058,27 @@ void CellEditor::updateChoice()
d->updatingChoice = false;
}
-void CellEditor::resizeEvent( QResizeEvent* )
+void CellEditor::resizeEvent( TQResizeEvent* )
{
d->textEdit->setGeometry( 0, 0, width(), height() );
}
-void CellEditor::handleKeyPressEvent( QKeyEvent * _ev )
+void CellEditor::handleKeyPressEvent( TQKeyEvent * _ev )
{
- if (_ev->key() == Qt::Key_F4)
+ if (_ev->key() == TQt::Key_F4)
{
if (d->textEdit == 0)
{
- QApplication::sendEvent( d->textEdit, _ev );
+ TQApplication::sendEvent( d->textEdit, _ev );
return;
}
- QRegExp exp("(\\$?)([a-zA-Z]+)(\\$?)([0-9]+)$");
+ TQRegExp exp("(\\$?)([a-zA-Z]+)(\\$?)([0-9]+)$");
int para,cur;
d->textEdit->getCursorPosition(&para,&cur);
// int cur = d->textEdit->cursorPosition();
- QString tmp, tmp2;
+ TQString tmp, tmp2;
int n = -1;
// this is ugly, and sort of hack
@@ -1095,7 +1095,7 @@ void CellEditor::handleKeyPressEvent( QKeyEvent * _ev )
if (n == -1) return;
- QString newPart;
+ TQString newPart;
if ((exp.cap(1) == "$") && (exp.cap(3) == "$"))
newPart = "$" + exp.cap(2) + exp.cap(4);
else if ((exp.cap(1) != "$") && (exp.cap(3) != "$"))
@@ -1105,7 +1105,7 @@ void CellEditor::handleKeyPressEvent( QKeyEvent * _ev )
else if ((exp.cap(1) != "$") && (exp.cap(3) == "$"))
newPart = exp.cap(2) + exp.cap(4);
- QString newString = tmp.left(n);
+ TQString newString = tmp.left(n);
newString += newPart;
cur = newString.length() - i;
newString += tmp2;
@@ -1119,21 +1119,21 @@ void CellEditor::handleKeyPressEvent( QKeyEvent * _ev )
}
// Send the key event to the KLineEdit
- QApplication::sendEvent( d->textEdit, _ev );
+ TQApplication::sendEvent( d->textEdit, _ev );
}
-void CellEditor::handleIMEvent( QIMEvent * _ev )
+void CellEditor::handleIMEvent( TQIMEvent * _ev )
{
// send the IM event to the KLineEdit
- QApplication::sendEvent( d->textEdit, _ev );
+ TQApplication::sendEvent( d->textEdit, _ev );
}
-QString CellEditor::text() const
+TQString CellEditor::text() const
{
return d->textEdit->text();
}
-void CellEditor::setText(QString text)
+void CellEditor::setText(TQString text)
{
d->textEdit->setText(text);
//Usability : It is usually more convenient if the cursor is positioned at the end of the text so it can
@@ -1144,7 +1144,7 @@ void CellEditor::setText(QString text)
if (d->fontLength == 0)
{
- QFontMetrics fm( d->textEdit->font() );
+ TQFontMetrics fm( d->textEdit->font() );
d->fontLength = fm.width('x');
}
}
@@ -1163,21 +1163,21 @@ void CellEditor::setCursorPosition( int pos )
canvas()->view()->editWidget()->setCursorPosition( pos );
}
-bool CellEditor::eventFilter( QObject* o, QEvent* e )
+bool CellEditor::eventFilter( TQObject* o, TQEvent* e )
{
// Only interested in KTextEdit
- if ( o != d->textEdit )
+ if ( TQT_BASE_OBJECT(o) != TQT_BASE_OBJECT(d->textEdit) )
return false;
- if ( e->type() == QEvent::FocusOut )
+ if ( e->type() == TQEvent::FocusOut )
{
canvas()->setLastEditorWithFocus( Canvas::CellEditor );
return false;
}
- if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease )
+ if ( e->type() == TQEvent::KeyPress || e->type() == TQEvent::KeyRelease )
{
- QKeyEvent* k = (QKeyEvent*)e;
- if (!(k->state() & Qt::ShiftButton) || canvas()->chooseMode())
+ TQKeyEvent* k = (TQKeyEvent*)e;
+ if (!(k->state() & TQt::ShiftButton) || canvas()->chooseMode())
{
//If the user presses the return key to finish editing this cell, choose mode must be turned off first
//otherwise it will merely select a different cell
@@ -1195,17 +1195,17 @@ bool CellEditor::eventFilter( QObject* o, QEvent* e )
k->key() == Key_Return || k->key() == Key_Enter)
{
// Send directly to canvas
- QApplication::sendEvent( parent(), e );
+ TQApplication::sendEvent( tqparent(), e );
return true;
}
}
- else if ( k->state() & Qt::ShiftButton && ( k->key() == Key_Return || k->key() == Key_Enter ) )
+ else if ( k->state() & TQt::ShiftButton && ( k->key() == Key_Return || k->key() == Key_Enter ) )
{
// enable content wrapping
d->cell->format()->setMultiRow( true );
}
// End choosing. May be restarted by CellEditor::slotTextChanged
- if ( e->type() == QEvent::KeyPress && !k->text().isEmpty() )
+ if ( e->type() == TQEvent::KeyPress && !k->text().isEmpty() )
{
canvas()->setChooseMode(false);
}
@@ -1213,10 +1213,10 @@ bool CellEditor::eventFilter( QObject* o, QEvent* e )
// editor leaves editing mode ... otherwise editing is annoying
// left/right arrows still work with the F2-editor.
- // Forward left & right arrows to parent, unless this editor has been set to capture arrow key events
+ // Forward left & right arrows to tqparent, unless this editor has been set to capture arrow key events
// Changed to this behaviour for consistancy with OO Calc & MS Office.
- if ( ((k->key() == Qt::Key_Left) || (k->key() == Qt::Key_Right)) && (!d->captureAllKeyEvents)) {
- QApplication::sendEvent (parent(), e);
+ if ( ((k->key() == TQt::Key_Left) || (k->key() == TQt::Key_Right)) && (!d->captureAllKeyEvents)) {
+ TQApplication::sendEvent (tqparent(), e);
return true;
}
}
@@ -1255,7 +1255,7 @@ void CellEditor::setCursorToRange(uint pos)
*
****************************************************************************/
-ComboboxLocationEditWidget::ComboboxLocationEditWidget( QWidget * _parent,
+ComboboxLocationEditWidget::ComboboxLocationEditWidget( TQWidget * _parent,
View * _view )
: KComboBox( _parent, "ComboboxLocationEditWidget" )
{
@@ -1263,21 +1263,21 @@ ComboboxLocationEditWidget::ComboboxLocationEditWidget( QWidget * _parent,
setLineEdit( m_locationWidget );
insertItem( "" );
- QValueList<Reference>::Iterator it;
- QValueList<Reference> area = _view->doc()->listArea();
+ TQValueList<Reference>::Iterator it;
+ TQValueList<Reference> area = _view->doc()->listArea();
for ( it = area.begin(); it != area.end(); ++it )
slotAddAreaName( (*it).ref_name);
- connect( this, SIGNAL( activated ( const QString & ) ), m_locationWidget, SLOT( slotActivateItem() ) );
+ connect( this, TQT_SIGNAL( activated ( const TQString & ) ), m_locationWidget, TQT_SLOT( slotActivateItem() ) );
}
-void ComboboxLocationEditWidget::slotAddAreaName( const QString &_name)
+void ComboboxLocationEditWidget::slotAddAreaName( const TQString &_name)
{
insertItem( _name );
m_locationWidget->addCompletionItem( _name );
}
-void ComboboxLocationEditWidget::slotRemoveAreaName( const QString &_name )
+void ComboboxLocationEditWidget::slotRemoveAreaName( const TQString &_name )
{
for ( int i = 0; i<count(); i++ )
{
@@ -1298,7 +1298,7 @@ void ComboboxLocationEditWidget::slotRemoveAreaName( const QString &_name )
*
****************************************************************************/
-LocationEditWidget::LocationEditWidget( QWidget * _parent,
+LocationEditWidget::LocationEditWidget( TQWidget * _parent,
View * _view )
: KLineEdit( _parent, "LocationEditWidget" ),
m_pView(_view)
@@ -1307,10 +1307,10 @@ LocationEditWidget::LocationEditWidget( QWidget * _parent,
setCompletionMode(KGlobalSettings::CompletionAuto );
}
-void LocationEditWidget::addCompletionItem( const QString &_item )
+void LocationEditWidget::addCompletionItem( const TQString &_item )
{
kdDebug()<<" LocationEditWidget::addCompletionItem add :"<<_item<<endl;
- if ( completionList.items().contains( _item) == 0 )
+ if ( completionList.items().tqcontains( _item) == 0 )
{
completionList.addItem( _item );
kdDebug()<<" _utem :"<<_item<<endl;
@@ -1318,7 +1318,7 @@ void LocationEditWidget::addCompletionItem( const QString &_item )
}
}
-void LocationEditWidget::removeCompletionItem( const QString &_item )
+void LocationEditWidget::removeCompletionItem( const TQString &_item )
{
completionList.removeItem( _item );
}
@@ -1330,15 +1330,15 @@ void LocationEditWidget::slotActivateItem()
bool LocationEditWidget::activateItem()
{
- QString ltext = text();
- QString tmp = ltext.lower();
- QValueList<Reference>::Iterator it;
- QValueList<Reference> area = m_pView->doc()->listArea();
+ TQString ltext = text();
+ TQString tmp = ltext.lower();
+ TQValueList<Reference>::Iterator it;
+ TQValueList<Reference> area = m_pView->doc()->listArea();
for ( it = area.begin(); it != area.end(); ++it )
{
if ((*it).ref_name == tmp)
{
- QString tmp = (*it).sheet_name;
+ TQString tmp = (*it).sheet_name;
tmp += "!";
tmp += util_rangeName((*it).rect);
m_pView->selectionInfo()->initialize( Region(m_pView,tmp) );
@@ -1348,14 +1348,14 @@ bool LocationEditWidget::activateItem()
// Set the cell component to uppercase:
// Sheet1!a1 -> Sheet1!A2
- int pos = ltext.find('!');
+ int pos = ltext.tqfind('!');
if ( pos !=- 1 )
tmp = ltext.left(pos)+ltext.mid(pos).upper();
else
tmp = ltext.upper();
// Selection entered in location widget
- if ( ltext.contains( ':' ) )
+ if ( ltext.tqcontains( ':' ) )
m_pView->selectionInfo()->initialize( Region(m_pView,tmp) );
// Location entered in location widget
else
@@ -1372,7 +1372,7 @@ bool LocationEditWidget::activateItem()
}
if ( !region.isValid() && validName)
{
- QRect rect( m_pView->selectionInfo()->selection() );
+ TQRect rect( m_pView->selectionInfo()->selection() );
Sheet * t = m_pView->activeSheet();
// set area name on current selection/cell
@@ -1391,14 +1391,14 @@ bool LocationEditWidget::activateItem()
}
-void LocationEditWidget::keyPressEvent( QKeyEvent * _ev )
+void LocationEditWidget::keyPressEvent( TQKeyEvent * _ev )
{
// Do not handle special keys and accelerators. This is
- // done by QLineEdit.
- if ( _ev->state() & ( Qt::AltButton | Qt::ControlButton ) )
+ // done by TQLineEdit.
+ if ( _ev->state() & ( TQt::AltButton | TQt::ControlButton ) )
{
- QLineEdit::keyPressEvent( _ev );
- // Never allow that keys are passed on to the parent.
+ TQLineEdit::keyPressEvent( _ev );
+ // Never allow that keys are passed on to the tqparent.
_ev->accept();
return;
@@ -1420,20 +1420,20 @@ void LocationEditWidget::keyPressEvent( QKeyEvent * _ev )
// #### Torben says: This is duplicated code. Bad.
if ( m_pView->selectionInfo()->isSingular() ) {
setText( Cell::columnName( m_pView->canvasWidget()->markerColumn() )
- + QString::number( m_pView->canvasWidget()->markerRow() ) );
+ + TQString::number( m_pView->canvasWidget()->markerRow() ) );
} else {
setText( Cell::columnName( m_pView->selectionInfo()->lastRange().left() )
- + QString::number( m_pView->selectionInfo()->lastRange().top() )
+ + TQString::number( m_pView->selectionInfo()->lastRange().top() )
+ ":"
+ Cell::columnName( m_pView->selectionInfo()->lastRange().right() )
- + QString::number( m_pView->selectionInfo()->lastRange().bottom() ) );
+ + TQString::number( m_pView->selectionInfo()->lastRange().bottom() ) );
}
m_pView->canvasWidget()->setFocus();
_ev->accept();
break;
default:
- QLineEdit::keyPressEvent( _ev );
- // Never allow that keys are passed on to the parent.
+ TQLineEdit::keyPressEvent( _ev );
+ // Never allow that keys are passed on to the tqparent.
_ev->accept();
}
}
@@ -1448,14 +1448,14 @@ void LocationEditWidget::keyPressEvent( QKeyEvent * _ev )
*
****************************************************************/
-EditWidget::EditWidget( QWidget *_parent, Canvas *_canvas,
- QButton *cancelButton, QButton *okButton )
- : QLineEdit( _parent, "EditWidget" )
+EditWidget::EditWidget( TQWidget *_parent, Canvas *_canvas,
+ TQButton *cancelButton, TQButton *okButton )
+ : TQLineEdit( _parent, "EditWidget" )
{
m_pCanvas = _canvas;
Q_ASSERT(m_pCanvas != NULL);
// Those buttons are created by the caller, so that they are inserted
- // properly in the layout - but they are then managed here.
+ // properly in the tqlayout - but they are then managed here.
m_pCancelButton = cancelButton;
m_pOkButton = okButton;
isArray = false;
@@ -1465,10 +1465,10 @@ EditWidget::EditWidget( QWidget *_parent, Canvas *_canvas,
if ( !m_pCanvas->doc()->isReadWrite() || !m_pCanvas->activeSheet() )
setEnabled( false );
- QObject::connect( m_pCancelButton, SIGNAL( clicked() ),
- this, SLOT( slotAbortEdit() ) );
- QObject::connect( m_pOkButton, SIGNAL( clicked() ),
- this, SLOT( slotDoneEdit() ) );
+ TQObject::connect( m_pCancelButton, TQT_SIGNAL( clicked() ),
+ this, TQT_SLOT( slotAbortEdit() ) );
+ TQObject::connect( m_pOkButton, TQT_SIGNAL( clicked() ),
+ this, TQT_SLOT( slotDoneEdit() ) );
setEditMode( false ); // disable buttons
}
@@ -1502,16 +1502,16 @@ void EditWidget::slotDoneEdit()
// will take care of the buttons
}
-void EditWidget::keyPressEvent ( QKeyEvent* _ev )
+void EditWidget::keyPressEvent ( TQKeyEvent* _ev )
{
// Dont handle special keys and accelerators, except Enter ones
- if (( ( _ev->state() & ( Qt::AltButton | Qt::ControlButton ) )
- || ( _ev->state() & Qt::ShiftButton )
+ if (( ( _ev->state() & ( TQt::AltButton | TQt::ControlButton ) )
+ || ( _ev->state() & TQt::ShiftButton )
|| ( _ev->key() == Key_Shift )
|| ( _ev->key() == Key_Control ) )
&& (_ev->key() != Key_Return) && (_ev->key() != Key_Enter))
{
- QLineEdit::keyPressEvent( _ev );
+ TQLineEdit::keyPressEvent( _ev );
_ev->accept();
return;
}
@@ -1537,9 +1537,9 @@ void EditWidget::keyPressEvent ( QKeyEvent* _ev )
// in this widget, since only up and down would work anyway.
// This is why we call slotDoneEdit now, instead of sending
// to the canvas.
- //QApplication::sendEvent( m_pCanvas, _ev );
- isArray = (_ev->state() & Qt::AltButton) &&
- (_ev->state() & Qt::ControlButton);
+ //TQApplication::sendEvent( m_pCanvas, _ev );
+ isArray = (_ev->state() & TQt::AltButton) &&
+ (_ev->state() & TQt::ControlButton);
slotDoneEdit();
m_pCanvas->view()->updateEditWidget();
_ev->accept();
@@ -1551,7 +1551,7 @@ void EditWidget::keyPressEvent ( QKeyEvent* _ev )
break;
default:
- QLineEdit::keyPressEvent( _ev );
+ TQLineEdit::keyPressEvent( _ev );
setFocus();
cellEditor->setCheckChoice( false );
@@ -1567,21 +1567,21 @@ void EditWidget::setEditMode( bool mode )
m_pOkButton->setEnabled(mode);
}
-void EditWidget::focusOutEvent( QFocusEvent* ev )
+void EditWidget::focusOutEvent( TQFocusEvent* ev )
{
//kdDebug(36001) << "EditWidget lost focus" << endl;
// See comment about setLastEditorWithFocus
m_pCanvas->setLastEditorWithFocus( Canvas::EditWidget );
- QLineEdit::focusOutEvent( ev );
+ TQLineEdit::focusOutEvent( ev );
}
-void EditWidget::setText( const QString& t )
+void EditWidget::setText( const TQString& t )
{
if ( t == text() ) // Why this? (David)
return;
- QLineEdit::setText( t );
+ TQLineEdit::setText( t );
}