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 /kexi/3rdparty/kolibs/koPageLayoutDia.cc | |
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 'kexi/3rdparty/kolibs/koPageLayoutDia.cc')
-rw-r--r-- | kexi/3rdparty/kolibs/koPageLayoutDia.cc | 194 |
1 files changed, 97 insertions, 97 deletions
diff --git a/kexi/3rdparty/kolibs/koPageLayoutDia.cc b/kexi/3rdparty/kolibs/koPageLayoutDia.cc index 5fe8832e..991a2ced 100644 --- a/kexi/3rdparty/kolibs/koPageLayoutDia.cc +++ b/kexi/3rdparty/kolibs/koPageLayoutDia.cc @@ -33,26 +33,26 @@ #include <kiconloader.h> #include <kmessagebox.h> -#include <qlabel.h> -#include <qlayout.h> -#include <qpainter.h> -#include <qlineedit.h> -#include <qbuttongroup.h> -#include <qradiobutton.h> -#include <qcheckbox.h> -#include <qhbox.h> -#include <qvgroupbox.h> -#include <qhbuttongroup.h> +#include <tqlabel.h> +#include <tqlayout.h> +#include <tqpainter.h> +#include <tqlineedit.h> +#include <tqbuttongroup.h> +#include <tqradiobutton.h> +#include <tqcheckbox.h> +#include <tqhbox.h> +#include <tqvgroupbox.h> +#include <tqhbuttongroup.h> /******************************************************************/ /* class KoPagePreview */ /******************************************************************/ /*===================== constrcutor ==============================*/ -KoPagePreview::KoPagePreview( QWidget* parent, const char *name, const KoPageLayout& layout ) - : QGroupBox( i18n( "Page Preview" ), parent, name ) +KoPagePreview::KoPagePreview( TQWidget* tqparent, const char *name, const KoPageLayout& tqlayout ) + : TQGroupBox( i18n( "Page Preview" ), tqparent, name ) { - setPageLayout( layout ); + setPageLayout( tqlayout ); columns = 1; setMinimumSize( 150, 150 ); } @@ -62,47 +62,47 @@ KoPagePreview::~KoPagePreview() { } -/*=================== set layout =================================*/ -void KoPagePreview::setPageLayout( const KoPageLayout &layout ) +/*=================== set tqlayout =================================*/ +void KoPagePreview::setPageLayout( const KoPageLayout &tqlayout ) { // resolution[XY] is in pixel per pt double resolutionX = POINT_TO_INCH( static_cast<double>(KoGlobal::dpiX()) ); double resolutionY = POINT_TO_INCH( static_cast<double>(KoGlobal::dpiY()) ); - m_pageWidth = layout.ptWidth * resolutionX; - m_pageHeight = layout.ptHeight * resolutionY; + m_pageWidth = tqlayout.ptWidth * resolutionX; + m_pageHeight = tqlayout.ptHeight * resolutionY; double zh = 110.0 / m_pageHeight; double zw = 110.0 / m_pageWidth; - double z = QMIN( zw, zh ); + double z = TQMIN( zw, zh ); m_pageWidth *= z; m_pageHeight *= z; - m_textFrameX = layout.ptLeft * resolutionX * z; - m_textFrameY = layout.ptTop * resolutionY * z; - m_textFrameWidth = m_pageWidth - ( layout.ptLeft + layout.ptRight ) * resolutionX * z; - m_textFrameHeight = m_pageHeight - ( layout.ptTop + layout.ptBottom ) * resolutionY * z; + m_textFrameX = tqlayout.ptLeft * resolutionX * z; + m_textFrameY = tqlayout.ptTop * resolutionY * z; + m_textFrameWidth = m_pageWidth - ( tqlayout.ptLeft + tqlayout.ptRight ) * resolutionX * z; + m_textFrameHeight = m_pageHeight - ( tqlayout.ptTop + tqlayout.ptBottom ) * resolutionY * z; - repaint( true ); + tqrepaint( true ); } -/*=================== set layout =================================*/ +/*=================== set tqlayout =================================*/ void KoPagePreview::setPageColumns( const KoColumns &_columns ) { columns = _columns.columns; - repaint( true ); + tqrepaint( true ); } /*======================== draw contents =========================*/ -void KoPagePreview::drawContents( QPainter *painter ) +void KoPagePreview::drawContents( TQPainter *painter ) { double cw = m_textFrameWidth; if(columns!=1) cw/=static_cast<double>(columns); painter->setBrush( white ); - painter->setPen( QPen( black ) ); + painter->setPen( TQPen( black ) ); int x=static_cast<int>( ( width() - m_pageWidth ) * 0.5 ); int y=static_cast<int>( ( height() - m_pageHeight ) * 0.5 ); @@ -111,7 +111,7 @@ void KoPagePreview::drawContents( QPainter *painter ) //painter->drawRect( x + 1, y + 1, w, h); painter->drawRect( x, y, w, h ); - painter->setBrush( QBrush( black, HorPattern ) ); + painter->setBrush( TQBrush( black, HorPattern ) ); if ( m_textFrameWidth == m_pageWidth || m_textFrameHeight == m_pageHeight ) painter->setPen( NoPen ); else @@ -128,16 +128,16 @@ void KoPagePreview::drawContents( QPainter *painter ) /******************************************************************/ /*==================== constructor ===============================*/ -KoPageLayoutDia::KoPageLayoutDia( QWidget* parent, const char* name, - const KoPageLayout& layout, +KoPageLayoutDia::KoPageLayoutDia( TQWidget* tqparent, const char* name, + const KoPageLayout& tqlayout, const KoHeadFoot& hf, int tabs, KoUnit::Unit unit, bool modal ) : KDialogBase( KDialogBase::Tabbed, i18n("Page Layout"), KDialogBase::Ok | KDialogBase::Cancel, - KDialogBase::Ok, parent, name, modal) + KDialogBase::Ok, tqparent, name, modal) { flags = tabs; - m_layout = layout; + m_layout = tqlayout; m_unit = unit; m_pageSizeTab = 0; m_columnsTab = 0; @@ -148,23 +148,23 @@ KoPageLayoutDia::KoPageLayoutDia( QWidget* parent, const char* name, if ( tabs & FORMAT_AND_BORDERS ) setupTab1( true ); if ( tabs & HEADER_AND_FOOTER ) setupTab2( hf ); - setFocusPolicy( QWidget::StrongFocus ); + setFocusPolicy( TQ_StrongFocus ); setFocus(); } /*==================== constructor ===============================*/ -KoPageLayoutDia::KoPageLayoutDia( QWidget* parent, const char* name, - const KoPageLayout& layout, +KoPageLayoutDia::KoPageLayoutDia( TQWidget* tqparent, const char* name, + const KoPageLayout& tqlayout, const KoHeadFoot& hf, const KoColumns& columns, const KoKWHeaderFooter& kwhf, int tabs, KoUnit::Unit unit ) : KDialogBase( KDialogBase::Tabbed, i18n("Page Layout"), KDialogBase::Ok | KDialogBase::Cancel, - KDialogBase::Ok, parent, name, true) + KDialogBase::Ok, tqparent, name, true) { flags = tabs; - m_layout = layout; + m_layout = tqlayout; m_column = columns; m_unit = unit; m_pageSizeTab = 0; @@ -176,7 +176,7 @@ KoPageLayoutDia::KoPageLayoutDia( QWidget* parent, const char* name, if ( tabs & COLUMNS ) setupTab3(); if ( tabs & KW_HEADER_AND_FOOTER ) setupTab4(kwhf); - setFocusPolicy( QWidget::StrongFocus ); + setFocusPolicy( TQ_StrongFocus ); setFocus(); } @@ -186,14 +186,14 @@ KoPageLayoutDia::~KoPageLayoutDia() } /*======================= show dialog ============================*/ -bool KoPageLayoutDia::pageLayout( KoPageLayout& layout, KoHeadFoot& hf, int tabs, KoUnit::Unit& unit, QWidget* parent ) +bool KoPageLayoutDia::pageLayout( KoPageLayout& tqlayout, KoHeadFoot& hf, int tabs, KoUnit::Unit& unit, TQWidget* tqparent ) { bool res = false; - KoPageLayoutDia *dlg = new KoPageLayoutDia( parent, "PageLayout", layout, hf, tabs, unit ); + KoPageLayoutDia *dlg = new KoPageLayoutDia( tqparent, "PageLayout", tqlayout, hf, tabs, unit ); - if ( dlg->exec() == QDialog::Accepted ) { + if ( dlg->exec() == TQDialog::Accepted ) { res = true; - if ( tabs & FORMAT_AND_BORDERS ) layout = dlg->layout(); + if ( tabs & FORMAT_AND_BORDERS ) tqlayout = dlg->tqlayout(); if ( tabs & HEADER_AND_FOOTER ) hf = dlg->headFoot(); unit = dlg->unit(); } @@ -204,15 +204,15 @@ bool KoPageLayoutDia::pageLayout( KoPageLayout& layout, KoHeadFoot& hf, int tabs } /*======================= show dialog ============================*/ -bool KoPageLayoutDia::pageLayout( KoPageLayout& layout, KoHeadFoot& hf, KoColumns& columns, - KoKWHeaderFooter &_kwhf, int tabs, KoUnit::Unit& unit, QWidget* parent ) +bool KoPageLayoutDia::pageLayout( KoPageLayout& tqlayout, KoHeadFoot& hf, KoColumns& columns, + KoKWHeaderFooter &_kwhf, int tabs, KoUnit::Unit& unit, TQWidget* tqparent ) { bool res = false; - KoPageLayoutDia *dlg = new KoPageLayoutDia( parent, "PageLayout", layout, hf, columns, _kwhf, tabs, unit ); + KoPageLayoutDia *dlg = new KoPageLayoutDia( tqparent, "PageLayout", tqlayout, hf, columns, _kwhf, tabs, unit ); - if ( dlg->exec() == QDialog::Accepted ) { + if ( dlg->exec() == TQDialog::Accepted ) { res = true; - if ( tabs & FORMAT_AND_BORDERS ) layout = dlg->layout(); + if ( tabs & FORMAT_AND_BORDERS ) tqlayout = dlg->tqlayout(); if ( tabs & HEADER_AND_FOOTER ) hf = dlg->headFoot(); if ( tabs & COLUMNS ) columns = dlg->columns(); if ( tabs & KW_HEADER_AND_FOOTER ) _kwhf = dlg->headerFooter(); @@ -224,7 +224,7 @@ bool KoPageLayoutDia::pageLayout( KoPageLayout& layout, KoHeadFoot& hf, KoColumn return res; } -/*===================== get a standard page layout ===============*/ +/*===================== get a standard page tqlayout ===============*/ KoPageLayout KoPageLayoutDia::standardLayout() { return KoPageLayout::standardLayout(); @@ -252,121 +252,121 @@ const KoKWHeaderFooter& KoPageLayoutDia::headerFooter() /*================ setup page size & margins tab ==================*/ void KoPageLayoutDia::setupTab1( bool enableBorders ) { - QWidget *tab1 = addPage(i18n( "Page Size && &Margins" )); - QHBoxLayout *lay = new QHBoxLayout(tab1); + TQWidget *tab1 = addPage(i18n( "Page Size && &Margins" )); + TQHBoxLayout *lay = new TQHBoxLayout(tab1); m_pageSizeTab = new KoPageLayoutSize(tab1, m_layout, m_unit, m_column, !(flags & DISABLE_UNIT), enableBorders ); lay->addWidget(m_pageSizeTab); m_pageSizeTab->show(); - connect (m_pageSizeTab, SIGNAL( propertyChange(KoPageLayout&)), - this, SLOT (sizeUpdated( KoPageLayout&))); + connect (m_pageSizeTab, TQT_SIGNAL( propertyChange(KoPageLayout&)), + this, TQT_SLOT (sizeUpdated( KoPageLayout&))); } -void KoPageLayoutDia::sizeUpdated(KoPageLayout &layout) { - m_layout.ptWidth = layout.ptWidth; - m_layout.ptHeight = layout.ptHeight; - m_layout.ptLeft = layout.ptLeft; - m_layout.ptRight = layout.ptRight; - m_layout.ptTop = layout.ptTop; - m_layout.ptBottom = layout.ptBottom; - m_layout.format = layout.format; - m_layout.orientation = layout.orientation; +void KoPageLayoutDia::sizeUpdated(KoPageLayout &tqlayout) { + m_layout.ptWidth = tqlayout.ptWidth; + m_layout.ptHeight = tqlayout.ptHeight; + m_layout.ptLeft = tqlayout.ptLeft; + m_layout.ptRight = tqlayout.ptRight; + m_layout.ptTop = tqlayout.ptTop; + m_layout.ptBottom = tqlayout.ptBottom; + m_layout.format = tqlayout.format; + m_layout.orientation = tqlayout.orientation; if(m_columnsTab) - m_columnsTab->setLayout(layout); + m_columnsTab->setLayout(tqlayout); } /*================ setup header and footer tab ===================*/ void KoPageLayoutDia::setupTab2( const KoHeadFoot& hf ) { - QWidget *tab2 = addPage(i18n( "H&eader && Footer" )); - QGridLayout *grid2 = new QGridLayout( tab2, 7, 2, 0, KDialog::spacingHint() ); + TQWidget *tab2 = addPage(i18n( "H&eader && Footer" )); + TQGridLayout *grid2 = new TQGridLayout( tab2, 7, 2, 0, KDialog::spacingHint() ); // ------------- header --------------- - QGroupBox *gHead = new QGroupBox( 0, Qt::Vertical, i18n( "Head Line" ), tab2 ); - gHead->layout()->setSpacing(KDialog::spacingHint()); - gHead->layout()->setMargin(KDialog::marginHint()); - QGridLayout *headGrid = new QGridLayout( gHead->layout(), 2, 3 ); + TQGroupBox *gHead = new TQGroupBox( 0, Qt::Vertical, i18n( "Head Line" ), tab2 ); + gHead->tqlayout()->setSpacing(KDialog::spacingHint()); + gHead->tqlayout()->setMargin(KDialog::marginHint()); + TQGridLayout *headGrid = new TQGridLayout( gHead->tqlayout(), 2, 3 ); - QLabel *lHeadLeft = new QLabel( i18n( "Left:" ), gHead ); + TQLabel *lHeadLeft = new TQLabel( i18n( "Left:" ), gHead ); headGrid->addWidget( lHeadLeft, 0, 0 ); - eHeadLeft = new QLineEdit( gHead ); + eHeadLeft = new TQLineEdit( gHead ); headGrid->addWidget( eHeadLeft, 1, 0 ); eHeadLeft->setText( hf.headLeft ); - QLabel *lHeadMid = new QLabel( i18n( "Mid:" ), gHead ); + TQLabel *lHeadMid = new TQLabel( i18n( "Mid:" ), gHead ); headGrid->addWidget( lHeadMid, 0, 1 ); - eHeadMid = new QLineEdit( gHead ); + eHeadMid = new TQLineEdit( gHead ); headGrid->addWidget( eHeadMid, 1, 1 ); eHeadMid->setText( hf.headMid ); - QLabel *lHeadRight = new QLabel( i18n( "Right:" ), gHead ); + TQLabel *lHeadRight = new TQLabel( i18n( "Right:" ), gHead ); headGrid->addWidget( lHeadRight, 0, 2 ); - eHeadRight = new QLineEdit( gHead ); + eHeadRight = new TQLineEdit( gHead ); headGrid->addWidget( eHeadRight, 1, 2 ); eHeadRight->setText( hf.headRight ); grid2->addMultiCellWidget( gHead, 0, 1, 0, 1 ); // ------------- footer --------------- - QGroupBox *gFoot = new QGroupBox( 0, Qt::Vertical, i18n( "Foot Line" ), tab2 ); - gFoot->layout()->setSpacing(KDialog::spacingHint()); - gFoot->layout()->setMargin(KDialog::marginHint()); - QGridLayout *footGrid = new QGridLayout( gFoot->layout(), 2, 3 ); + TQGroupBox *gFoot = new TQGroupBox( 0, Qt::Vertical, i18n( "Foot Line" ), tab2 ); + gFoot->tqlayout()->setSpacing(KDialog::spacingHint()); + gFoot->tqlayout()->setMargin(KDialog::marginHint()); + TQGridLayout *footGrid = new TQGridLayout( gFoot->tqlayout(), 2, 3 ); - QLabel *lFootLeft = new QLabel( i18n( "Left:" ), gFoot ); + TQLabel *lFootLeft = new TQLabel( i18n( "Left:" ), gFoot ); footGrid->addWidget( lFootLeft, 0, 0 ); - eFootLeft = new QLineEdit( gFoot ); + eFootLeft = new TQLineEdit( gFoot ); footGrid->addWidget( eFootLeft, 1, 0 ); eFootLeft->setText( hf.footLeft ); - QLabel *lFootMid = new QLabel( i18n( "Mid:" ), gFoot ); + TQLabel *lFootMid = new TQLabel( i18n( "Mid:" ), gFoot ); footGrid->addWidget( lFootMid, 0, 1 ); - eFootMid = new QLineEdit( gFoot ); + eFootMid = new TQLineEdit( gFoot ); footGrid->addWidget( eFootMid, 1, 1 ); eFootMid->setText( hf.footMid ); - QLabel *lFootRight = new QLabel( i18n( "Right:" ), gFoot ); + TQLabel *lFootRight = new TQLabel( i18n( "Right:" ), gFoot ); footGrid->addWidget( lFootRight, 0, 2 ); - eFootRight = new QLineEdit( gFoot ); + eFootRight = new TQLineEdit( gFoot ); footGrid->addWidget( eFootRight, 1, 2 ); eFootRight->setText( hf.footRight ); grid2->addMultiCellWidget( gFoot, 2, 3, 0, 1 ); - QLabel *lMacros2 = new QLabel( i18n( "You can insert several tags in the text:" ), tab2 ); + TQLabel *lMacros2 = new TQLabel( i18n( "You can insert several tags in the text:" ), tab2 ); grid2->addMultiCellWidget( lMacros2, 4, 4, 0, 1 ); - QLabel *lMacros3 = new QLabel( i18n("<qt><ul><li><sheet> The sheet name</li>" + TQLabel *lMacros3 = new TQLabel( i18n("<qt><ul><li><sheet> The sheet name</li>" "<li><page> The current page</li>" "<li><pages> The total number of pages</li>" "<li><name> The filename or URL</li>" "<li><file> The filename with complete path or the URL</li></ul></qt>"), tab2 ); - grid2->addMultiCellWidget( lMacros3, 5, 6, 0, 0, Qt::AlignTop ); + grid2->addMultiCellWidget( lMacros3, 5, 6, 0, 0, TQt::AlignTop ); - QLabel *lMacros4 = new QLabel( i18n("<qt><ul><li><time> The current time</li>" + TQLabel *lMacros4 = new TQLabel( i18n("<qt><ul><li><time> The current time</li>" "<li><date> The current date</li>" "<li><author> Your full name</li>" "<li><org> Your organization</li>" "<li><email> Your email address</li></ul></qt>"), tab2 ); - grid2->addMultiCellWidget( lMacros4, 5, 6, 1, 1, Qt::AlignTop ); + grid2->addMultiCellWidget( lMacros4, 5, 6, 1, 1, TQt::AlignTop ); } /*================================================================*/ void KoPageLayoutDia::setupTab3() { - QWidget *tab3 = addPage(i18n( "Col&umns" )); - QHBoxLayout *lay = new QHBoxLayout(tab3); + TQWidget *tab3 = addPage(i18n( "Col&umns" )); + TQHBoxLayout *lay = new TQHBoxLayout(tab3); m_columnsTab = new KoPageLayoutColumns(tab3, m_column, m_unit, m_layout); - m_columnsTab->layout()->setMargin(0); + m_columnsTab->tqlayout()->setMargin(0); lay->addWidget(m_columnsTab); m_columnsTab->show(); - connect (m_columnsTab, SIGNAL( propertyChange(KoColumns&)), - this, SLOT (columnsUpdated( KoColumns&))); + connect (m_columnsTab, TQT_SIGNAL( propertyChange(KoColumns&)), + this, TQT_SLOT (columnsUpdated( KoColumns&))); } void KoPageLayoutDia::columnsUpdated(KoColumns &columns) { @@ -379,10 +379,10 @@ void KoPageLayoutDia::columnsUpdated(KoColumns &columns) { /*================================================================*/ void KoPageLayoutDia::setupTab4(const KoKWHeaderFooter kwhf ) { - QWidget *tab4 = addPage(i18n( "H&eader && Footer" )); - QHBoxLayout *lay = new QHBoxLayout(tab4); + TQWidget *tab4 = addPage(i18n( "H&eader && Footer" )); + TQHBoxLayout *lay = new TQHBoxLayout(tab4); m_headerTab = new KoPageLayoutHeader(tab4, m_unit, kwhf); - m_headerTab->layout()->setMargin(0); + m_headerTab->tqlayout()->setMargin(0); lay->addWidget(m_headerTab); m_headerTab->show(); |