00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef KOPAGELAYOUT_H
00023 #define KOPAGELAYOUT_H
00024
00025 #include <KoGenStyles.h>
00026 #include <QStringList>
00027 #include <koffice_export.h>
00028 #include <KoXmlReader.h>
00029
00030 class QDomElement;
00031
00041 enum KoFormat {
00042 PG_DIN_A3 = 0,
00043 PG_DIN_A4 = 1,
00044 PG_DIN_A5 = 2,
00045 PG_US_LETTER = 3,
00046 PG_US_LEGAL = 4,
00047 PG_SCREEN = 5,
00048 PG_CUSTOM = 6,
00049 PG_DIN_B5 = 7,
00050 PG_US_EXECUTIVE = 8,
00051 PG_DIN_A0 = 9,
00052 PG_DIN_A1 = 10,
00053 PG_DIN_A2 = 11,
00054 PG_DIN_A6 = 12,
00055 PG_DIN_A7 = 13,
00056 PG_DIN_A8 = 14,
00057 PG_DIN_A9 = 15,
00058 PG_DIN_B0 = 16,
00059 PG_DIN_B1 = 17,
00060 PG_DIN_B10 = 18,
00061 PG_DIN_B2 = 19,
00062 PG_DIN_B3 = 20,
00063 PG_DIN_B4 = 21,
00064 PG_DIN_B6 = 22,
00065 PG_ISO_C5 = 23,
00066 PG_US_COMM10 = 24,
00067 PG_ISO_DL = 25,
00068 PG_US_FOLIO = 26,
00069 PG_US_LEDGER = 27,
00070 PG_US_TABLOID = 28,
00071
00072 PG_LAST_FORMAT = PG_US_TABLOID
00073 };
00074
00078 enum KoOrientation {
00079 PG_PORTRAIT = 0,
00080 PG_LANDSCAPE = 1
00081 };
00082
00083 namespace KoPageFormat
00084 {
00095 KOFFICECORE_EXPORT int printerPageSize( KoFormat format );
00096
00101 KOFFICECORE_EXPORT double width( KoFormat format, KoOrientation orientation );
00102
00107 KOFFICECORE_EXPORT double height( KoFormat format, KoOrientation orientation );
00108
00113 KOFFICECORE_EXPORT QString formatString( KoFormat format );
00114
00119 KOFFICECORE_EXPORT KoFormat formatFromString( const QString & string );
00120
00124 KOFFICECORE_EXPORT KoFormat defaultFormat();
00125
00130 KOFFICECORE_EXPORT QString name( KoFormat format );
00131
00135 KOFFICECORE_EXPORT QStringList allFormats();
00136
00141 KOFFICECORE_EXPORT KoFormat guessFormat( double width, double height );
00142 }
00143
00144
00151 enum KoHFType {
00152 HF_SAME = 0,
00153 HF_FIRST_EO_DIFF = 1,
00154 HF_FIRST_DIFF = 2,
00155 HF_EO_DIFF = 3
00156 };
00157
00162 struct KoPageLayout
00163 {
00165 KoFormat format;
00167 KoOrientation orientation;
00168
00170 double ptWidth;
00172 double ptHeight;
00174 double ptLeft;
00176 double ptRight;
00178 double ptTop;
00180 double ptBottom;
00182 double ptPageEdge;
00184 double ptBindingSide;
00185
00186 bool operator==( const KoPageLayout& l ) const {
00187 return ( ptWidth == l.ptWidth &&
00188 ptHeight == l.ptHeight &&
00189 ptLeft == l.ptLeft &&
00190 ptRight == l.ptRight &&
00191 ptTop == l.ptTop &&
00192 ptBottom == l.ptBottom &&
00193 ptPageEdge == l.ptPageEdge &&
00194 ptBindingSide == l.ptBindingSide);
00195 }
00196 bool operator!=( const KoPageLayout& l ) const {
00197 return !( (*this) == l );
00198 }
00199
00203 KOFFICECORE_EXPORT KoGenStyle saveOasis() const;
00204
00208 KOFFICECORE_EXPORT void loadOasis(const KoXmlElement &style);
00209
00215 static KOFFICECORE_EXPORT KoPageLayout standardLayout();
00216 };
00217
00219 struct KoHeadFoot
00220 {
00221 QString headLeft;
00222 QString headMid;
00223 QString headRight;
00224 QString footLeft;
00225 QString footMid;
00226 QString footRight;
00227 };
00228
00230 struct KoColumns
00231 {
00232 int columns;
00233 double ptColumnSpacing;
00234 bool operator==( const KoColumns& rhs ) const {
00235 return columns == rhs.columns &&
00236 qAbs(ptColumnSpacing - rhs.ptColumnSpacing) <= 1E-10;
00237 }
00238 bool operator!=( const KoColumns& rhs ) const {
00239 return columns != rhs.columns ||
00240 qAbs(ptColumnSpacing - rhs.ptColumnSpacing) > 1E-10;
00241 }
00242 };
00243
00245 struct KoKWHeaderFooter
00246 {
00247 KoHFType header;
00248 KoHFType footer;
00249 double ptHeaderBodySpacing;
00250 double ptFooterBodySpacing;
00251 double ptFootNoteBodySpacing;
00252 bool operator==( const KoKWHeaderFooter& rhs ) const {
00253 return header == rhs.header && footer == rhs.footer &&
00254 qAbs(ptHeaderBodySpacing - rhs.ptHeaderBodySpacing) <= 1E-10 &&
00255 qAbs(ptFooterBodySpacing - rhs.ptFooterBodySpacing) <= 1E-10 &&
00256 qAbs(ptFootNoteBodySpacing - rhs.ptFootNoteBodySpacing) <= 1E-10;
00257 }
00258 bool operator!=( const KoKWHeaderFooter& rhs ) const {
00259 return !( *this == rhs );
00260 }
00261 };
00262
00263 #endif
00264