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 
00027 #include <koGlobal.h>
00028 #include <koUnit.h>
00029 #include <kdialogbase.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 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);
00140 
00145     static bool pageLayout( KoPageLayout&, KoHeadFoot&, KoColumns&, KoKWHeaderFooter&, int tabs, KoUnit::Unit& unit );
00146 
00150     static KoPageLayout standardLayout();
00151 
00155     KoPageLayout getLayout() { return layout; } // BIC: make const
00156 
00160     KoHeadFoot getHeadFoot(); // BIC: make const
00161 
00165     KoUnit::Unit unit() const { return m_unit; }
00166 
00167 protected:
00168     KoColumns getColumns();
00169     KoKWHeaderFooter getKWHeaderFooter();
00170 
00171     // setup tabs
00172     void setupTab1();
00173     void setValuesTab1();
00174     void setValuesTab1Helper();
00175     void setupTab2();
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 *rhSame_unused; // BIC: remove
00208     QCheckBox *rhFirst;
00209     QCheckBox *rhEvenOdd;
00210     QCheckBox *rfSame_unused; // BIC: remove
00211     QCheckBox *rfFirst;
00212     QCheckBox *rfEvenOdd;
00213 
00214     // layout
00215     KoPageLayout layout;
00216     KoHeadFoot hf;
00217     KoColumns cl;
00218     KoKWHeaderFooter kwhf;
00219 
00220     KoUnit::Unit m_unit;
00221 
00222     bool retPressed;
00223     bool enableBorders;
00224     int flags;
00225 
00226 public slots:
00227 
00228     // linedits
00229     void widthChanged();
00230     void heightChanged();
00231     void leftChanged();
00232     void rightChanged();
00233     void topChanged();
00234     void bottomChanged();
00235 
00236 protected slots:
00237     virtual void slotOk();
00238 
00239 private slots:
00240     // combos and radios
00241     void unitChanged( int );
00242     void formatChanged( int );
00243     void orientationChanged();
00244 
00245     void rPressed() {retPressed = true;}
00246 
00247     // spinboxes
00248     void nColChanged( int );
00249     void nSpaceChanged( double );
00250 
00251 private:
00252     void changed(KDoubleNumInput *line, double &pt);
00253 
00254     KoPageLayoutDiaPrivate *d;
00255 };
00256 
00257 #endif
KDE Logo
This file is part of the documentation for lib Library Version 1.3.5.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sun Mar 20 14:25:25 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003