KoPageLayout.h
1/* This file is part of the KDE project
2 Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 Copyright 2002, 2003 David Faure <faure@kde.org>
4 Copyright 2003 Nicolas GOUTTE <goutte@kde.org>
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20*/
21
22#ifndef KOPAGELAYOUT_H
23#define KOPAGELAYOUT_H
24
25#include <KoGenStyles.h>
26#include <tqstringlist.h>
27#include <koffice_export.h>
28class TQDomElement;
29
39enum KoFormat {
40 PG_DIN_A3 = 0,
41 PG_DIN_A4 = 1,
42 PG_DIN_A5 = 2,
43 PG_US_LETTER = 3,
44 PG_US_LEGAL = 4,
45 PG_SCREEN = 5,
46 PG_CUSTOM = 6,
47 PG_DIN_B5 = 7,
48 PG_US_EXECUTIVE = 8,
49 PG_DIN_A0 = 9,
50 PG_DIN_A1 = 10,
51 PG_DIN_A2 = 11,
52 PG_DIN_A6 = 12,
53 PG_DIN_A7 = 13,
54 PG_DIN_A8 = 14,
55 PG_DIN_A9 = 15,
56 PG_DIN_B0 = 16,
57 PG_DIN_B1 = 17,
58 PG_DIN_B10 = 18,
59 PG_DIN_B2 = 19,
60 PG_DIN_B3 = 20,
61 PG_DIN_B4 = 21,
62 PG_DIN_B6 = 22,
63 PG_ISO_C5 = 23,
64 PG_US_COMM10 = 24,
65 PG_ISO_DL = 25,
66 PG_US_FOLIO = 26,
67 PG_US_LEDGER = 27,
68 PG_US_TABLOID = 28,
69 // update the number below and the static arrays if you add more values to the enum
70 PG_LAST_FORMAT = PG_US_TABLOID // used by koPageLayout.cpp
71};
72
76enum KoOrientation {
77 PG_PORTRAIT = 0,
78 PG_LANDSCAPE = 1
79};
80
81namespace KoPageFormat
82{
93 KOFFICECORE_EXPORT int /*KPrinter::PageSize*/ printerPageSize( KoFormat format );
94
99 KOFFICECORE_EXPORT double width( KoFormat format, KoOrientation orientation );
100
105 KOFFICECORE_EXPORT double height( KoFormat format, KoOrientation orientation );
106
111 KOFFICECORE_EXPORT TQString formatString( KoFormat format );
112
117 KOFFICECORE_EXPORT KoFormat formatFromString( const TQString & string );
118
122 KOFFICECORE_EXPORT KoFormat defaultFormat();
123
128 KOFFICECORE_EXPORT TQString name( KoFormat format );
129
133 KOFFICECORE_EXPORT TQStringList allFormats();
134
139 KOFFICECORE_EXPORT KoFormat guessFormat( double width, double height );
140}
141
142
149enum KoHFType {
150 HF_SAME = 0,
151 HF_FIRST_EO_DIFF = 1,
152 HF_FIRST_DIFF = 2,
153 HF_EO_DIFF = 3
154};
155
161{
163 KoFormat format;
165 KoOrientation orientation;
166
168 double ptWidth;
170 double ptHeight;
172 double ptLeft;
174 double ptRight;
176 double ptTop;
178 double ptBottom;
179 double ptPageEdge;
180 double ptBindingSide;
181
182 bool operator==( const KoPageLayout& l ) const {
183 return ( ptWidth == l.ptWidth &&
184 ptHeight == l.ptHeight &&
185 ptLeft == l.ptLeft &&
186 ptRight == l.ptRight &&
187 ptTop == l.ptTop &&
188 ptBottom == l.ptBottom &&
189 ptPageEdge == l.ptPageEdge &&
190 ptBindingSide == l.ptBindingSide);
191 }
192 bool operator!=( const KoPageLayout& l ) const {
193 return !( (*this) == l );
194 }
195
199 KOFFICECORE_EXPORT KoGenStyle saveOasis() const;
200
204 KOFFICECORE_EXPORT void loadOasis(const TQDomElement &style);
205
211 static KOFFICECORE_EXPORT KoPageLayout standardLayout();
212};
213
216{
217 TQString headLeft;
218 TQString headMid;
219 TQString headRight;
220 TQString footLeft;
221 TQString footMid;
222 TQString footRight;
223};
224
227{
228 int columns;
229 double ptColumnSpacing;
230 bool operator==( const KoColumns& rhs ) const {
231 return columns == rhs.columns &&
232 TQABS(ptColumnSpacing - rhs.ptColumnSpacing) <= 1E-10;
233 }
234 bool operator!=( const KoColumns& rhs ) const {
235 return columns != rhs.columns ||
236 TQABS(ptColumnSpacing - rhs.ptColumnSpacing) > 1E-10;
237 }
238};
239
242{
243 KoHFType header;
244 KoHFType footer;
245 double ptHeaderBodySpacing;
246 double ptFooterBodySpacing;
247 double ptFootNoteBodySpacing;
248 bool operator==( const KoKWHeaderFooter& rhs ) const {
249 return header == rhs.header && footer == rhs.footer &&
250 TQABS(ptHeaderBodySpacing - rhs.ptHeaderBodySpacing) <= 1E-10 &&
251 TQABS(ptFooterBodySpacing - rhs.ptFooterBodySpacing) <= 1E-10 &&
252 TQABS(ptFootNoteBodySpacing - rhs.ptFootNoteBodySpacing) <= 1E-10;
253 }
254 bool operator!=( const KoKWHeaderFooter& rhs ) const {
255 return !( *this == rhs );
256 }
257};
258
259#endif /* KOPAGELAYOUT_H */
260
A generic style, i.e.
const char * name(StdAction id)
structure for columns
structure for header-footer
structure for KWord header-footer
This structure defines the page layout, including its size in pt, its format (e.g.
KoFormat format
Page format.
double ptRight
Right margin in pt.
double ptHeight
Page height in pt.
KOFFICECORE_EXPORT void loadOasis(const TQDomElement &style)
Load this page layout from OASIS.
KoOrientation orientation
Page orientation.
double ptLeft
Left margin in pt.
double ptBottom
Bottom margin in pt.
double ptWidth
Page width in pt.
static KOFFICECORE_EXPORT KoPageLayout standardLayout()
KOFFICECORE_EXPORT KoGenStyle saveOasis() const
Save this page layout to OASIS.
double ptTop
Top margin in pt.