lib

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., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, 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 QComboBox;
00033 class QLineEdit;
00034 class QCheckBox;
00035 class KoUnitDoubleSpinBox;
00036 class KoPageLayoutColumns;
00037 class KoPageLayoutSize;
00038 class KoPageLayoutHeader;
00039 
00040 enum { FORMAT_AND_BORDERS = 1, HEADER_AND_FOOTER = 2, COLUMNS = 4, DISABLE_BORDERS = 8,
00041        KW_HEADER_AND_FOOTER = 16, DISABLE_UNIT = 32 };
00042 
00047 class KoPagePreview : public QGroupBox
00048 {
00049     Q_OBJECT
00050 
00051 public:
00052 
00056     KoPagePreview( QWidget*, const char*, const KoPageLayout & );
00060     ~KoPagePreview();
00061 
00065     void setPageLayout( const KoPageLayout& );
00066     void setPageColumns( const KoColumns& );
00067 
00068 protected:
00069 
00070     // paint page
00071     void drawContents( QPainter* );
00072 
00073     double m_pageHeight, m_pageWidth, m_textFrameX, m_textFrameY, m_textFrameWidth, m_textFrameHeight;
00074     int columns;
00075 };
00076 
00077 class KoPageLayoutDiaPrivate;
00078 
00082 class KOFFICEUI_EXPORT KoPageLayoutDia : public KDialogBase
00083 {
00084     Q_OBJECT
00085 
00086 public:
00087 
00099     KoPageLayoutDia( QWidget* parent, const char* name,
00100              const KoPageLayout& layout,
00101              const KoHeadFoot& headfoot,
00102              int flags, KoUnit::Unit unit, bool modal=true );
00103 
00116     KoPageLayoutDia( QWidget* parent, const char* name,
00117              const KoPageLayout& layout,
00118              const KoHeadFoot& headfoot,
00119              const KoColumns& columns,
00120              const KoKWHeaderFooter& kwheadfoot,
00121              int tabs, KoUnit::Unit unit );
00122 
00126     ~KoPageLayoutDia();
00127 
00132     static bool pageLayout( KoPageLayout&, KoHeadFoot&, int tabs, KoUnit::Unit& unit, QWidget* parent = 0 );
00133 
00138     static bool pageLayout( KoPageLayout&, KoHeadFoot&, KoColumns&, KoKWHeaderFooter&, int tabs, KoUnit::Unit& unit, QWidget* parent = 0 );
00143     static KDE_DEPRECATED KoPageLayout standardLayout();
00144 
00148     const KoPageLayout& layout() const { return m_layout; }
00149 
00153     KoHeadFoot headFoot() const;
00154 
00158     KoUnit::Unit unit() const { return m_unit; }
00159 
00160 private:
00161     const KoColumns& columns() { return m_column; }
00162     const KoKWHeaderFooter& headerFooter();
00163 
00164     // setup tabs
00165     void setupTab1( bool enableBorders );
00166     void setupTab2( const KoHeadFoot& hf );
00167     void setupTab3();
00168     void setupTab4( const KoKWHeaderFooter kwhf );
00169 
00170     // dialog objects
00171     QLineEdit *eHeadLeft;
00172     QLineEdit *eHeadMid;
00173     QLineEdit *eHeadRight;
00174     QLineEdit *eFootLeft;
00175     QLineEdit *eFootMid;
00176     QLineEdit *eFootRight;
00177 
00178     // layout
00179     KoPageLayout m_layout;
00180     KoColumns m_column;
00181 
00182     KoUnit::Unit m_unit;
00183 
00184     int flags;
00185 
00186 protected slots:
00187     virtual void slotOk();
00188 
00189 private slots:
00190     void sizeUpdated(KoPageLayout &layout);
00191     void columnsUpdated(KoColumns &columns);
00192 
00193 private:
00194     KoPageLayoutSize *m_pageSizeTab;
00195     KoPageLayoutColumns *m_columnsTab;
00196     KoPageLayoutHeader *m_headerTab;
00197     KoPageLayoutDiaPrivate *d;
00198 };
00199 
00200 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys