lib Library API Documentation

koPageLayoutDia.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00017    Boston, MA 02111-1307, USA.
00018 */
00019 
00020 // Description: Page Layout Dialog (header)
00021 
00022 #ifndef __KOPGLAYOUTDIA_H__
00023 #define __KOPGLAYOUTDIA_H__
00024 
00025 #include <qgroupbox.h>
00026 #include <koGlobal.h>
00027 #include <koUnit.h>
00028 #include <kdialogbase.h>
00029 #include <koPageLayout.h>
00030 
00031 class QButtonGroup;
00032 class QWidget;
00033 class QGridLayout;
00034 class QLabel;
00035 class QComboBox;
00036 class QLineEdit;
00037 class QSpinBox;
00038 class QRadioButton;
00039 class QCheckBox;
00040 class KDoubleNumInput;
00041 
00042 enum { FORMAT_AND_BORDERS = 1, HEADER_AND_FOOTER = 2, COLUMNS = 4, DISABLE_BORDERS = 8,
00043        KW_HEADER_AND_FOOTER = 16, DISABLE_UNIT = 32 };
00044 
00049 class KoPagePreview : public QGroupBox
00050 {
00051     Q_OBJECT
00052 
00053 public:
00054 
00058     KoPagePreview( QWidget*, const char*, const KoPageLayout & );
00062     ~KoPagePreview();
00063 
00067     void setPageLayout( const KoPageLayout& );
00068     void setPageColumns( const KoColumns& );
00069 
00070 protected:
00071 
00072     // paint page
00073     void drawContents( QPainter* );
00074 
00075     double pgWidth;
00076     double pgHeight;
00077     double pgX;
00078     double pgY;
00079     double pgW;
00080     double pgH;
00081     int columns;
00082 };
00083 
00084 
00085 class KoPageLayoutDiaPrivate;
00086 
00090 class KOFFICEUI_EXPORT KoPageLayoutDia : public KDialogBase
00091 {
00092     Q_OBJECT
00093 
00094 public:
00095 
00106     KoPageLayoutDia( QWidget* parent, const char* name,
00107              const KoPageLayout& layout,
00108              const KoHeadFoot& headfoot,
00109              int tabs, KoUnit::Unit unit, bool modal=true );
00110 
00123     KoPageLayoutDia( QWidget* parent, const char* name,
00124              const KoPageLayout& layout,
00125              const KoHeadFoot& headfoot,
00126              const KoColumns& columns,
00127              const KoKWHeaderFooter& kwheadfoot,
00128              int tabs, KoUnit::Unit unit );
00129 
00133     ~KoPageLayoutDia();
00134 
00139     static bool pageLayout( KoPageLayout&, KoHeadFoot&, int tabs, KoUnit::Unit& unit, QWidget* parent = 0 );
00140 
00145     static bool pageLayout( KoPageLayout&, KoHeadFoot&, KoColumns&, KoKWHeaderFooter&, int tabs, KoUnit::Unit& unit, QWidget* parent = 0 );
00150     static KDE_DEPRECATED KoPageLayout standardLayout();
00151 
00155     const KoPageLayout& layout() const { return m_layout; }
00156 
00160     KoHeadFoot headFoot() const;
00161 
00165     KoUnit::Unit unit() const { return m_unit; }
00166 
00167 private:
00168     const KoColumns& columns();
00169     const KoKWHeaderFooter& getKWHeaderFooter();
00170 
00171     // setup tabs
00172     void setupTab1();
00173     void setValuesTab1();
00174     void setValuesTab1Helper();
00175     void setupTab2( const KoHeadFoot& hf );
00176     void setupTab3();
00177     void setupTab4();
00178 
00179     // update preview
00180     void updatePreview( const KoPageLayout& );
00181 
00182     // dialog objects
00183     QComboBox *cpgFormat;
00184     QComboBox *cpgUnit;
00185     QRadioButton *rbPortrait;
00186     QRadioButton *rbLandscape;
00187     KDoubleNumInput *epgWidth;
00188     KDoubleNumInput *epgHeight;
00189     KDoubleNumInput *ebrLeft;
00190     KDoubleNumInput *ebrRight;
00191     KDoubleNumInput *ebrTop;
00192     KDoubleNumInput *ebrBottom;
00193     KoPagePreview *pgPreview;
00194     KoPagePreview *pgPreview2;
00195     QLineEdit *eHeadLeft;
00196     QLineEdit *eHeadMid;
00197     QLineEdit *eHeadRight;
00198     QLineEdit *eFootLeft;
00199     QLineEdit *eFootMid;
00200     QLineEdit *eFootRight;
00201     QSpinBox *nColumns;
00202     KDoubleNumInput *nCSpacing;
00203 
00204     KDoubleNumInput *nHSpacing;
00205     KDoubleNumInput *nFSpacing;
00206     KDoubleNumInput *nFNSpacing;
00207     QCheckBox *rhFirst;
00208     QCheckBox *rhEvenOdd;
00209     QCheckBox *rfFirst;
00210     QCheckBox *rfEvenOdd;
00211 
00212     // layout
00213     KoPageLayout m_layout;
00214     KoColumns m_cl;
00215     KoKWHeaderFooter kwhf;
00216 
00217     KoUnit::Unit m_unit;
00218 
00219     bool retPressed;
00220     bool enableBorders;
00221     int flags;
00222 
00223 public slots:
00224 
00225     // linedits
00226     void widthChanged();
00227     void heightChanged();
00228     void leftChanged();
00229     void rightChanged();
00230     void topChanged();
00231     void bottomChanged();
00232 
00233 protected slots:
00234     virtual void slotOk();
00235 
00236 private slots:
00237     // combos and radios
00238     void unitChanged( int );
00239     void formatChanged( int );
00240     void orientationChanged();
00241 
00242     void rPressed() {retPressed = true;}
00243 
00244     // spinboxes
00245     void nColChanged( int );
00246     void nSpaceChanged( double );
00247 
00248 private:
00249     void changed(KDoubleNumInput *line, double &pt);
00250 
00251     KoPageLayoutDiaPrivate *d;
00252 };
00253 
00254 #endif
KDE Logo
This file is part of the documentation for lib Library Version 1.4.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Mon Feb 13 09:40:02 2006 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003