home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / KoPageLayoutDia.h < prev    next >
Encoding:
C/C++ Source or Header  |  2007-05-30  |  5.4 KB  |  201 lines

  1. /* This file is part of the KDE project
  2.    Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.org>
  3.  
  4.    This library is free software; you can redistribute it and/or
  5.    modify it under the terms of the GNU Library General Public
  6.    License as published by the Free Software Foundation; either
  7.    version 2 of the License, or (at your option) any later version.
  8.  
  9.    This library is distributed in the hope that it will be useful,
  10.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12.    Library General Public License for more details.
  13.  
  14.    You should have received a copy of the GNU Library General Public License
  15.    along with this library; see the file COPYING.LIB.  If not, write to
  16.    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  17.  * Boston, MA 02110-1301, USA.
  18. */
  19.  
  20. // Description: Page Layout Dialog (header)
  21.  
  22. #ifndef __KOPGLAYOUTDIA_H__
  23. #define __KOPGLAYOUTDIA_H__
  24.  
  25. #include <qgroupbox.h>
  26. #include <KoGlobal.h>
  27. #include <KoUnit.h>
  28. #include <kdialogbase.h>
  29. #include <KoPageLayout.h>
  30.  
  31. class QButtonGroup;
  32. class QComboBox;
  33. class QLineEdit;
  34. class QCheckBox;
  35. class KoUnitDoubleSpinBox;
  36. class KoPageLayoutColumns;
  37. class KoPageLayoutSize;
  38. class KoPageLayoutHeader;
  39.  
  40. enum { FORMAT_AND_BORDERS = 1, HEADER_AND_FOOTER = 2, COLUMNS = 4, DISABLE_BORDERS = 8,
  41.        KW_HEADER_AND_FOOTER = 16, DISABLE_UNIT = 32 };
  42.  
  43. /**
  44.  *  KoPagePreview.
  45.  *  Internal to KoPageLayoutDia.
  46.  */
  47. class KoPagePreview : public QGroupBox
  48. {
  49.     Q_OBJECT
  50.  
  51. public:
  52.  
  53.     /**
  54.      *  constructor
  55.      */
  56.     KoPagePreview( QWidget*, const char*, const KoPageLayout & );
  57.     /**
  58.      *  destructor
  59.      */
  60.     ~KoPagePreview();
  61.  
  62.     /**
  63.      *  set page layout
  64.      */
  65.     void setPageLayout( const KoPageLayout& );
  66.     void setPageColumns( const KoColumns& );
  67.  
  68. protected:
  69.  
  70.     // paint page
  71.     void drawContents( QPainter* );
  72.  
  73.     double m_pageHeight, m_pageWidth, m_textFrameX, m_textFrameY, m_textFrameWidth, m_textFrameHeight;
  74.     int columns;
  75. };
  76.  
  77. class KoPageLayoutDiaPrivate;
  78.  
  79. /**
  80.  *  With this dialog the user can specify the layout of the paper during printing.
  81.  */
  82. class KOFFICEUI_EXPORT KoPageLayoutDia : public KDialogBase
  83. {
  84.     Q_OBJECT
  85.  
  86. public:
  87.  
  88.     /**
  89.      *  Constructor.
  90.      *
  91.      *  @param parent   The parent of the dialog.
  92.      *  @param name     The name of the dialog.
  93.      *  @param layout   The layout.
  94.      *  @param headfoot The header and the footer.
  95.      *  @param flags     a variable with all features this dialog should show.
  96.      *  @param unit     The unit to use for displaying the values to the user.
  97.      *  @param modal    Whether the dialog is modal or not.
  98.      */
  99.     KoPageLayoutDia( QWidget* parent, const char* name,
  100.              const KoPageLayout& layout,
  101.              const KoHeadFoot& headfoot,
  102.              int flags, KoUnit::Unit unit, bool modal=true );
  103.  
  104.     /**
  105.      *  Constructor.
  106.      *
  107.      *  @param parent     The parent of the dialog.
  108.      *  @param name       The name of the dialog.
  109.      *  @param layout     The layout.
  110.      *  @param headfoot   The header and the footer.
  111.      *  @param columns    The number of columns on the page.
  112.      *  @param kwheadfoot The KWord header and footer.
  113.      *  @param tabs       The number of tabs.
  114.      *  @param unit       The unit to use for displaying the values to the user
  115.      */
  116.     KoPageLayoutDia( QWidget* parent, const char* name,
  117.              const KoPageLayout& layout,
  118.              const KoHeadFoot& headfoot,
  119.              const KoColumns& columns,
  120.              const KoKWHeaderFooter& kwheadfoot,
  121.              int tabs, KoUnit::Unit unit );
  122.  
  123.     /**
  124.      *  Destructor.
  125.      */
  126.     ~KoPageLayoutDia();
  127.  
  128.     /**
  129.      *  Show page layout dialog.
  130.      *  See constructor for documentation on the parameters
  131.      */
  132.     static bool pageLayout( KoPageLayout&, KoHeadFoot&, int tabs, KoUnit::Unit& unit, QWidget* parent = 0 );
  133.  
  134.     /**
  135.      *  Show page layout dialog.
  136.      *  See constructor for documentation on the parameters
  137.      */
  138.     static bool pageLayout( KoPageLayout&, KoHeadFoot&, KoColumns&, KoKWHeaderFooter&, int tabs, KoUnit::Unit& unit, QWidget* parent = 0 );
  139.     /**
  140.      *  Retrieves a standard page layout.
  141.      *  Deprecated: better use KoPageLayout::standardLayout()
  142.      */
  143.     static KDE_DEPRECATED KoPageLayout standardLayout();
  144.  
  145.     /**
  146.      *  Returns the layout
  147.      */
  148.     const KoPageLayout& layout() const { return m_layout; }
  149.  
  150.     /**
  151.      *  Returns the header and footer information
  152.      */
  153.     KoHeadFoot headFoot() const;
  154.  
  155.     /**
  156.      *  Returns the unit
  157.      */
  158.     KoUnit::Unit unit() const { return m_unit; }
  159.  
  160. private:
  161.     const KoColumns& columns() { return m_column; }
  162.     const KoKWHeaderFooter& headerFooter();
  163.  
  164.     // setup tabs
  165.     void setupTab1( bool enableBorders );
  166.     void setupTab2( const KoHeadFoot& hf );
  167.     void setupTab3();
  168.     void setupTab4( const KoKWHeaderFooter kwhf );
  169.  
  170.     // dialog objects
  171.     QLineEdit *eHeadLeft;
  172.     QLineEdit *eHeadMid;
  173.     QLineEdit *eHeadRight;
  174.     QLineEdit *eFootLeft;
  175.     QLineEdit *eFootMid;
  176.     QLineEdit *eFootRight;
  177.  
  178.     // layout
  179.     KoPageLayout m_layout;
  180.     KoColumns m_column;
  181.  
  182.     KoUnit::Unit m_unit;
  183.  
  184.     int flags;
  185.  
  186. protected slots:
  187.     virtual void slotOk();
  188.  
  189. private slots:
  190.     void sizeUpdated(KoPageLayout &layout);
  191.     void columnsUpdated(KoColumns &columns);
  192.  
  193. private:
  194.     KoPageLayoutSize *m_pageSizeTab;
  195.     KoPageLayoutColumns *m_columnsTab;
  196.     KoPageLayoutHeader *m_headerTab;
  197.     KoPageLayoutDiaPrivate *d;
  198. };
  199.  
  200. #endif
  201.