summaryrefslogtreecommitdiffstats
path: root/kexi/3rdparty/kolibs/koPageLayoutDia.h
blob: 1ed23ec5163a60bb26a89636874ea0baa0828864 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
/* This file is part of the KDE project
   Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.org>

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public License
   along with this library; see the file COPYING.LIB.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
*/

// Description: Page Layout Dialog (header)

#ifndef __KOPGLAYOUTDIA_H__
#define __KOPGLAYOUTDIA_H__

#include <tqgroupbox.h>
#include <KoGlobal.h>
#include <KoUnit.h>
#include <kdialogbase.h>
#include <KoPageLayout.h>

class TQButtonGroup;
class TQComboBox;
class TQLineEdit;
class TQCheckBox;
class KoUnitDoubleSpinBox;
class KoPageLayoutColumns;
class KoPageLayoutSize;
class KoPageLayoutHeader;

enum { FORMAT_AND_BORDERS = 1, HEADER_AND_FOOTER = 2, COLUMNS = 4, DISABLE_BORDERS = 8,
       KW_HEADER_AND_FOOTER = 16, DISABLE_UNIT = 32 };

/**
 *  KoPagePreview.
 *  Internal to KoPageLayoutDia.
 */
class KoPagePreview : public TQGroupBox
{
    Q_OBJECT
  TQ_OBJECT

public:

    /**
     *  constructor
     */
    KoPagePreview( TQWidget*, const char*, const KoPageLayout & );
    /**
     *  destructor
     */
    ~KoPagePreview();

    /**
     *  set page layout
     */
    void setPageLayout( const KoPageLayout& );
    void setPageColumns( const KoColumns& );

protected:

    // paint page
    void drawContents( TQPainter* );

    double m_pageHeight, m_pageWidth, m_textFrameX, m_textFrameY, m_textFrameWidth, m_textFrameHeight;
    int columns;
};

class KoPageLayoutDiaPrivate;

/**
 *  With this dialog the user can specify the layout of the paper during printing.
 */
class KOFFICEUI_EXPORT KoPageLayoutDia : public KDialogBase
{
    Q_OBJECT
  TQ_OBJECT

public:

    /**
     *  Constructor.
     *
     *  @param parent   The parent of the dialog.
     *  @param name     The name of the dialog.
     *  @param layout   The layout.
     *  @param headfoot The header and the footer.
     *  @param flags     a variable with all features this dialog should show.
     *  @param unit     The unit to use for displaying the values to the user.
     *  @param modal    Whether the dialog is modal or not.
     */
    KoPageLayoutDia( TQWidget* parent, const char* name,
             const KoPageLayout& layout,
             const KoHeadFoot& headfoot,
             int flags, KoUnit::Unit unit, bool modal=true );

    /**
     *  Constructor.
     *
     *  @param parent     The parent of the dialog.
     *  @param name       The name of the dialog.
     *  @param layout     The layout.
     *  @param headfoot   The header and the footer.
     *  @param columns    The number of columns on the page.
     *  @param kwheadfoot The KWord header and footer.
     *  @param tabs       The number of tabs.
     *  @param unit       The unit to use for displaying the values to the user
     */
    KoPageLayoutDia( TQWidget* parent, const char* name,
             const KoPageLayout& layout,
             const KoHeadFoot& headfoot,
             const KoColumns& columns,
             const KoKWHeaderFooter& kwheadfoot,
             int tabs, KoUnit::Unit unit );

    /**
     *  Destructor.
     */
    ~KoPageLayoutDia();

    /**
     *  Show page layout dialog.
     *  See constructor for documentation on the parameters
     */
    static bool pageLayout( KoPageLayout&, KoHeadFoot&, int tabs, KoUnit::Unit& unit, TQWidget* parent = 0 );

    /**
     *  Show page layout dialog.
     *  See constructor for documentation on the parameters
     */
    static bool pageLayout( KoPageLayout&, KoHeadFoot&, KoColumns&, KoKWHeaderFooter&, int tabs, KoUnit::Unit& unit, TQWidget* parent = 0 );
    /**
     *  Retrieves a standard page layout.
     *  Deprecated: better use KoPageLayout::standardLayout()
     */
    static KDE_DEPRECATED KoPageLayout standardLayout();

    /**
     *  Returns the layout
     */
    const KoPageLayout& layout() const { return m_layout; }

    /**
     *  Returns the header and footer information
     */
    KoHeadFoot headFoot() const;

    /**
     *  Returns the unit
     */
    KoUnit::Unit unit() const { return m_unit; }

private:
    const KoColumns& columns() { return m_column; }
    const KoKWHeaderFooter& headerFooter();

    // setup tabs
    void setupTab1( bool enableBorders );
    void setupTab2( const KoHeadFoot& hf );
    void setupTab3();
    void setupTab4( const KoKWHeaderFooter kwhf );

    // dialog objects
    TQLineEdit *eHeadLeft;
    TQLineEdit *eHeadMid;
    TQLineEdit *eHeadRight;
    TQLineEdit *eFootLeft;
    TQLineEdit *eFootMid;
    TQLineEdit *eFootRight;

    // layout
    KoPageLayout m_layout;
    KoColumns m_column;

    KoUnit::Unit m_unit;

    int flags;

protected slots:
    virtual void slotOk();

private slots:
    void sizeUpdated(KoPageLayout &layout);
    void columnsUpdated(KoColumns &columns);

private:
    KoPageLayoutSize *m_pageSizeTab;
    KoPageLayoutColumns *m_columnsTab;
    KoPageLayoutHeader *m_headerTab;
    KoPageLayoutDiaPrivate *d;
};

#endif