diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
commit | f008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch) | |
tree | 8e9244c4d4957c36be81e15b566b4aa5ea26c982 /kword/KWTableStyleManager.cpp | |
parent | 1210f27b660efb7b37ff43ec68763e85a403471f (diff) | |
download | koffice-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 'kword/KWTableStyleManager.cpp')
-rw-r--r-- | kword/KWTableStyleManager.cpp | 170 |
1 files changed, 85 insertions, 85 deletions
diff --git a/kword/KWTableStyleManager.cpp b/kword/KWTableStyleManager.cpp index 7a2a6494..d2a0c1ea 100644 --- a/kword/KWTableStyleManager.cpp +++ b/kword/KWTableStyleManager.cpp @@ -34,26 +34,26 @@ #include <kiconloader.h> #include <kdebug.h> -#include <qpushbutton.h> -#include <qlabel.h> -#include <qgroupbox.h> -#include <qpainter.h> -#include <qlineedit.h> -#include <qlayout.h> -#include <qcombobox.h> -#include <qframe.h> +#include <tqpushbutton.h> +#include <tqlabel.h> +#include <tqgroupbox.h> +#include <tqpainter.h> +#include <tqlineedit.h> +#include <tqlayout.h> +#include <tqcombobox.h> +#include <tqframe.h> /******************************************************************/ /* Class: KWTableStylePreview */ /******************************************************************/ -KWTableStylePreview::KWTableStylePreview( const QString& title, const QString& text, QWidget* parent, const char* name ) - : QGroupBox( title, parent, name ) +KWTableStylePreview::KWTableStylePreview( const TQString& title, const TQString& text, TQWidget* tqparent, const char* name ) + : TQGroupBox( title, tqparent, name ) { m_zoomHandler = new KoTextZoomHandler; - QFont font = KoGlobal::defaultFont(); - m_textdoc = new KoTextDocument( m_zoomHandler, new KoTextFormatCollection( font, QColor(),KGlobal::locale()->language(), false ) ); + TQFont font = KoGlobal::defaultFont(); + m_textdoc = new KoTextDocument( m_zoomHandler, new KoTextFormatCollection( font, TQColor(),KGlobal::locale()->language(), false ) ); KoTextParag * parag = m_textdoc->firstParag(); parag->insert( 0, text ); } @@ -65,12 +65,12 @@ KWTableStylePreview::~KWTableStylePreview() } #undef ptToPx -#define ptToPx qRound +#define ptToPx tqRound -void KWTableStylePreview::drawContents( QPainter *p ) +void KWTableStylePreview::drawContents( TQPainter *p ) { p->save(); - QRect r = contentsRect(); + TQRect r = contentsRect(); int wid = ( r.width() - 40 ); int hei = ( r.height() - 40 ); @@ -78,7 +78,7 @@ void KWTableStylePreview::drawContents( QPainter *p ) // 1: create document background = white - p->fillRect( QRect( 10, 20, r.width()-20, r.height() - 20 ), QColor("white") ); + p->fillRect( TQRect( 10, 20, r.width()-20, r.height() - 20 ), TQColor("white") ); // 2: create borders (KWFrameStyle) @@ -105,8 +105,8 @@ void KWTableStylePreview::drawContents( QPainter *p ) // 3: create background whithin "frame" - QRect fr( QPoint(20 + int(ceil(tableStyle->frameStyle()->leftBorder().width()/2)), 30 + int(ceil(tableStyle->frameStyle()->topBorder().width()/2))), - QPoint(20 + wid - int(floor(tableStyle->frameStyle()->rightBorder().width()/2)+1), 30 + hei - int(floor(tableStyle->frameStyle()->bottomBorder().width()/2)+1)) ); + TQRect fr( TQPoint(20 + int(ceil(tableStyle->frameStyle()->leftBorder().width()/2)), 30 + int(ceil(tableStyle->frameStyle()->topBorder().width()/2))), + TQPoint(20 + wid - int(floor(tableStyle->frameStyle()->rightBorder().width()/2)+1), 30 + hei - int(floor(tableStyle->frameStyle()->bottomBorder().width()/2)+1)) ); p->fillRect( fr, tableStyle->frameStyle()->backgroundColor() ); @@ -118,20 +118,20 @@ void KWTableStylePreview::drawContents( QPainter *p ) { // For centering to work, and to even get word wrapping when the thing is too big :) m_textdoc->setWidth( widthLU ); - parag->invalidate(0); + parag->tqinvalidate(0); } parag->format(); - QRect textRect = parag->pixelRect( m_zoomHandler ); + TQRect textRect = parag->pixelRect( m_zoomHandler ); - // Center vertically, but not horizontally, to keep the parag alignment working, - textRect.moveTopLeft( QPoint( fr.x(), fr.y() + ( fr.height() - textRect.height() ) / 2 ) ); + // Center vertically, but not horizontally, to keep the parag tqalignment working, + textRect.moveTopLeft( TQPoint( fr.x(), fr.y() + ( fr.height() - textRect.height() ) / 2 ) ); p->setClipRect( textRect.intersect( fr ) ); p->translate( textRect.x(), textRect.y() ); - QColorGroup cg = QApplication::palette().active(); - cg.setBrush( QColorGroup::Base, tableStyle->frameStyle()->backgroundColor() ); + TQColorGroup cg = TQApplication::tqpalette().active(); + cg.setBrush( TQColorGroup::Base, tableStyle->frameStyle()->backgroundColor() ); m_textdoc->drawWYSIWYG( p, 1, 0, textRect.width() - 1, textRect.height(), cg, m_zoomHandler ); @@ -145,7 +145,7 @@ void KWTableStylePreview::setTableStyle( KWTableStyle *_tableStyle ) KoTextParag * parag = m_textdoc->firstParag(); parag->applyStyle( tableStyle->paragraphStyle() ); - repaint(true); + tqrepaint(true); } /******************************************************************/ @@ -182,7 +182,7 @@ void KWTableStyleListItem::apply() // Proof reader comment: stylist sounds like a hair dresser -KWTableStyleManager::KWTableStyleManager( QWidget *_parent, KWDocument *_doc ) +KWTableStyleManager::KWTableStyleManager( TQWidget *_parent, KWDocument *_doc ) : KDialogBase( _parent, "Tablestylist", true, i18n("Table Style Manager"), KDialogBase::Ok | KDialogBase::Cancel | KDialogBase::Apply | KDialogBase::User1 ) @@ -199,9 +199,9 @@ KWTableStyleManager::KWTableStyleManager( QWidget *_parent, KWDocument *_doc ) m_stylesList->setCurrentItem( 0 ); noSignals=false; switchStyle(); - setInitialSize( QSize( 450, 450 ) ); + setInitialSize( TQSize( 450, 450 ) ); setButtonText( KDialogBase::User1, i18n("Import From File...") ); - connect(this, SIGNAL(user1Clicked()), this, SLOT(importFromFile())); + connect(this, TQT_SIGNAL(user1Clicked()), this, TQT_SLOT(importFromFile())); } @@ -213,18 +213,18 @@ KWTableStyleManager::~KWTableStyleManager() void KWTableStyleManager::setupWidget() { - QFrame * frame1 = makeMainWidget(); - QGridLayout *frame1Layout = new QGridLayout( frame1, 0, 0, // auto + TQFrame * frame1 = makeMainWidget(); + TQGridLayout *frame1Layout = new TQGridLayout( frame1, 0, 0, // auto 0, KDialog::spacingHint() ); KWTableStyleCollection* collection = m_doc->tableStyleCollection(); numTableStyles = collection->count(); - m_stylesList = new QListBox( frame1, "stylesList" ); + m_stylesList = new TQListBox( frame1, "stylesList" ); m_stylesList->insertStringList( collection->displayNameList() ); - const QValueList<KoUserStyle*> styleList = collection->styleList(); + const TQValueList<KoUserStyle*> styleList = collection->styleList(); Q_ASSERT( !styleList.isEmpty() ); - for ( QValueList<KoUserStyle *>::const_iterator it = styleList.begin(), end = styleList.end(); + for ( TQValueList<KoUserStyle *>::const_iterator it = styleList.begin(), end = styleList.end(); it != end ; ++it ) { KWTableStyle* style = static_cast<KWTableStyle *>( *it ); @@ -237,88 +237,88 @@ void KWTableStyleManager::setupWidget() frame1Layout->addMultiCellWidget( m_stylesList, 0, 0, 0, 1 ); - m_moveUpButton = new QPushButton( frame1, "moveUpButton" ); + m_moveUpButton = new TQPushButton( frame1, "moveUpButton" ); m_moveUpButton->setIconSet( SmallIconSet( "up" ) ); - connect( m_moveUpButton, SIGNAL( clicked() ), this, SLOT( moveUpStyle() ) ); + connect( m_moveUpButton, TQT_SIGNAL( clicked() ), this, TQT_SLOT( moveUpStyle() ) ); frame1Layout->addWidget( m_moveUpButton, 1, 1 ); - m_moveDownButton = new QPushButton( frame1, "moveDownButton" ); + m_moveDownButton = new TQPushButton( frame1, "moveDownButton" ); m_moveDownButton->setIconSet( SmallIconSet( "down" ) ); - connect( m_moveDownButton, SIGNAL( clicked() ), this, SLOT( moveDownStyle() ) ); + connect( m_moveDownButton, TQT_SIGNAL( clicked() ), this, TQT_SLOT( moveDownStyle() ) ); frame1Layout->addWidget( m_moveDownButton, 1, 0 ); - m_deleteButton = new QPushButton( frame1, "deleteButton" ); + m_deleteButton = new TQPushButton( frame1, "deleteButton" ); m_deleteButton->setText( i18n( "&Delete" ) ); - connect( m_deleteButton, SIGNAL( clicked() ), this, SLOT( deleteStyle() ) ); + connect( m_deleteButton, TQT_SIGNAL( clicked() ), this, TQT_SLOT( deleteStyle() ) ); frame1Layout->addWidget( m_deleteButton, 2, 1 ); - m_newButton = new QPushButton( frame1, "newButton" ); + m_newButton = new TQPushButton( frame1, "newButton" ); m_newButton->setText( i18n( "New" ) ); - connect( m_newButton, SIGNAL( clicked() ), this, SLOT( addStyle() ) ); + connect( m_newButton, TQT_SIGNAL( clicked() ), this, TQT_SLOT( addStyle() ) ); frame1Layout->addWidget( m_newButton, 2, 0 ); - main = new QWidget( frame1 ); + main = new TQWidget( frame1 ); setupMain(); frame1Layout->addMultiCellWidget( main, 0, 2, 2, 2 ); - connect( m_stylesList, SIGNAL( selectionChanged() ), this, SLOT( switchStyle() ) ); + connect( m_stylesList, TQT_SIGNAL( selectionChanged() ), this, TQT_SLOT( switchStyle() ) ); } void KWTableStyleManager::setupMain() { - QGridLayout *mainLayout = new QGridLayout( main ); + TQGridLayout *mainLayout = new TQGridLayout( main ); mainLayout->setSpacing( KDialog::spacingHint() ); preview = new KWTableStylePreview( i18n("Preview"), i18n("Tablestyles preview"), main ); - preview->resize(preview->sizeHint()); + preview->resize(preview->tqsizeHint()); mainLayout->addMultiCellWidget( preview, 1, 1, 0, 1 ); - m_nameString = new QLineEdit( main ); - m_nameString->resize(m_nameString->sizeHint() ); - connect( m_nameString, SIGNAL( textChanged( const QString &) ), this, SLOT( renameStyle(const QString &) ) ); + m_nameString = new TQLineEdit( main ); + m_nameString->resize(m_nameString->tqsizeHint() ); + connect( m_nameString, TQT_SIGNAL( textChanged( const TQString &) ), this, TQT_SLOT( renameStyle(const TQString &) ) ); mainLayout->addWidget( m_nameString, 0, 1 ); - QLabel *nameLabel = new QLabel( main ); + TQLabel *nameLabel = new TQLabel( main ); nameLabel->setText( i18n( "Name:" ) ); - nameLabel->resize(nameLabel->sizeHint()); - nameLabel->setAlignment( AlignRight | AlignVCenter ); + nameLabel->resize(nameLabel->tqsizeHint()); + nameLabel->tqsetAlignment( AlignRight | AlignVCenter ); mainLayout->addWidget( nameLabel, 0, 0 ); - QGroupBox *adjustBox = new QGroupBox( 0, Qt::Vertical, i18n("Adjust"), main); - adjustBox->layout()->setSpacing(KDialog::spacingHint()); - adjustBox->layout()->setMargin(KDialog::marginHint()); - QGridLayout *adjustLayout = new QGridLayout( adjustBox->layout() ); + TQGroupBox *adjustBox = new TQGroupBox( 0, Qt::Vertical, i18n("Adjust"), main); + adjustBox->tqlayout()->setSpacing(KDialog::spacingHint()); + adjustBox->tqlayout()->setMargin(KDialog::marginHint()); + TQGridLayout *adjustLayout = new TQGridLayout( adjustBox->tqlayout() ); - QLabel *frameStyleLabel = new QLabel( adjustBox ); + TQLabel *frameStyleLabel = new TQLabel( adjustBox ); frameStyleLabel->setText( i18n( "Framestyle:" ) ); - frameStyleLabel->setAlignment( AlignRight | AlignVCenter ); + frameStyleLabel->tqsetAlignment( AlignRight | AlignVCenter ); - QLabel *styleLabel = new QLabel( adjustBox ); + TQLabel *styleLabel = new TQLabel( adjustBox ); styleLabel->setText( i18n( "Textstyle:" ) ); - styleLabel->setAlignment( AlignRight | AlignVCenter ); + styleLabel->tqsetAlignment( AlignRight | AlignVCenter ); - m_frameStyle = new QComboBox( adjustBox ); - m_style = new QComboBox( adjustBox ); + m_frameStyle = new TQComboBox( adjustBox ); + m_style = new TQComboBox( adjustBox ); updateAllStyleCombos(); - connect( m_frameStyle, SIGNAL( activated(int) ), this, SLOT( selectFrameStyle(int) ) ); - connect( m_style, SIGNAL( activated(int) ), this, SLOT( selectStyle(int) ) ); + connect( m_frameStyle, TQT_SIGNAL( activated(int) ), this, TQT_SLOT( selectFrameStyle(int) ) ); + connect( m_style, TQT_SIGNAL( activated(int) ), this, TQT_SLOT( selectStyle(int) ) ); - m_changeFrameStyleButton = new QPushButton( adjustBox ); + m_changeFrameStyleButton = new TQPushButton( adjustBox ); m_changeFrameStyleButton->setText( i18n( "Change..." ) ); - connect( m_changeFrameStyleButton, SIGNAL( clicked() ), this, SLOT( changeFrameStyle() ) ); + connect( m_changeFrameStyleButton, TQT_SIGNAL( clicked() ), this, TQT_SLOT( changeFrameStyle() ) ); - m_changeStyleButton = new QPushButton( adjustBox ); + m_changeStyleButton = new TQPushButton( adjustBox ); m_changeStyleButton->setText( i18n( "Change..." ) ); - connect( m_changeStyleButton, SIGNAL( clicked() ), this, SLOT( changeStyle() ) ); + connect( m_changeStyleButton, TQT_SIGNAL( clicked() ), this, TQT_SLOT( changeStyle() ) ); adjustLayout->addWidget( frameStyleLabel, 0, 0 ); adjustLayout->addWidget( styleLabel, 1, 0 ); @@ -412,7 +412,7 @@ void KWTableStyleManager::addStyle() save(); KWTableStyleCollection* collection = m_doc->tableStyleCollection(); - QString str = i18n( "New Tablestyle Template (%1)" ).arg(numTableStyles++); + TQString str = i18n( "New Tablestyle Template (%1)" ).tqarg(numTableStyles++); if ( m_currentTableStyle ) { m_currentTableStyle = new KWTableStyle( *m_currentTableStyle ); @@ -442,7 +442,7 @@ void KWTableStyleManager::addStyle() void KWTableStyleManager::importFromFile() { - QStringList lst; + TQStringList lst; for (unsigned int i = 0; i<m_stylesList->count();i++) { lst << m_stylesList->text(i ); @@ -450,16 +450,16 @@ void KWTableStyleManager::importFromFile() KWImportFrameTableStyleDia dia( m_doc, lst, KWImportFrameTableStyleDia::TableStyle, this, 0 ); if ( dia.listOfTableStyleImported().count() > 0 && dia.exec() ) { - QPtrList<KWTableStyle> list = dia.listOfTableStyleImported(); + TQPtrList<KWTableStyle> list = dia.listOfTableStyleImported(); addStyles( list); } } -void KWTableStyleManager::addStyles(const QPtrList<KWTableStyle> &listStyle ) +void KWTableStyleManager::addStyles(const TQPtrList<KWTableStyle> &listStyle ) { save(); - QPtrListIterator<KWTableStyle> style( listStyle ); + TQPtrListIterator<KWTableStyle> style( listStyle ); for ( ; style.current() ; ++style ) { noSignals=true; @@ -499,9 +499,9 @@ void KWTableStyleManager::moveUpStyle() if ( m_currentTableStyle ) save(); - const QString currentStyleName = m_currentTableStyle->name(); - const QString currentStyleDisplayName = m_stylesList->currentText(); - int pos2 = m_styleOrder.findIndex( currentStyleName ); + const TQString currentStyleName = m_currentTableStyle->name(); + const TQString currentStyleDisplayName = m_stylesList->currentText(); + int pos2 = m_styleOrder.tqfindIndex( currentStyleName ); if ( pos2 != -1 ) { m_styleOrder.remove( m_styleOrder.at(pos2) ); @@ -527,9 +527,9 @@ void KWTableStyleManager::moveDownStyle() if ( m_currentTableStyle ) save(); - const QString currentStyleName = m_currentTableStyle->name(); - const QString currentStyleDisplayName = m_stylesList->currentText(); - int pos2 = m_styleOrder.findIndex( currentStyleName ); + const TQString currentStyleName = m_currentTableStyle->name(); + const TQString currentStyleDisplayName = m_stylesList->currentText(); + int pos2 = m_styleOrder.tqfindIndex( currentStyleName ); if ( pos2 != -1 ) { m_styleOrder.remove( m_styleOrder.at(pos2) ); @@ -582,7 +582,7 @@ void KWTableStyleManager::apply() { noSignals=false; } -void KWTableStyleManager::renameStyle(const QString &theText) { +void KWTableStyleManager::renameStyle(const TQString &theText) { if(noSignals) return; noSignals=true; @@ -657,8 +657,8 @@ void KWTableStyleManager::updateAllStyleCombos() { unsigned int oldSindex = 0; unsigned int oldFSindex = 0; - QString oldS = ""; - QString oldFS = ""; + TQString oldS = ""; + TQString oldFS = ""; if (m_style->currentItem()>=0) { oldSindex = m_style->currentItem(); @@ -677,12 +677,12 @@ void KWTableStyleManager::updateAllStyleCombos() // - 1. Count is the same, but the user has delete the same number as he added // - 2. Old name is not in new list, old index is wrong index in new list if ( ( static_cast<unsigned int>(m_style->count())!=m_doc->styleCollection()->styleList().count() ) && - ( m_style->listBox()->findItem( oldS ) ) ) { - oldSindex = m_style->listBox()->index( m_style->listBox()->findItem( oldS ) ); + ( m_style->listBox()->tqfindItem( oldS ) ) ) { + oldSindex = m_style->listBox()->index( m_style->listBox()->tqfindItem( oldS ) ); } if ( ( m_frameStyle->count() != m_doc->frameStyleCollection()->count() ) && - ( m_frameStyle->listBox()->findItem( oldFS ) ) ) { - oldFSindex = m_frameStyle->listBox()->index( m_frameStyle->listBox()->findItem( oldFS ) ); + ( m_frameStyle->listBox()->tqfindItem( oldFS ) ) ) { + oldFSindex = m_frameStyle->listBox()->index( m_frameStyle->listBox()->tqfindItem( oldFS ) ); } // Update the comboboxes |