lib Library API Documentation

koPageLayout.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
00003    Copyright 2002, 2003 David Faure <faure@kde.org>
00004    Copyright 2003 Nicolas GOUTTE <goutte@kde.org>
00005 
00006    This library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Library General Public
00008    License as published by the Free Software Foundation; either
00009    version 2 of the License, or (at your option) any later version.
00010 
00011    This library is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    Library General Public License for more details.
00015 
00016    You should have received a copy of the GNU Library General Public License
00017    along with this library; see the file COPYING.LIB.  If not, write to
00018    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00019    Boston, MA 02111-1307, USA.
00020 */
00021 
00022 #ifndef KOPAGELAYOUT_H
00023 #define KOPAGELAYOUT_H
00024 
00025 #include <koGenStyles.h>
00026 #include <qstringlist.h>
00027 #include <koffice_export.h>
00028 class QDomElement;
00029 
00039 enum KoFormat {
00040     PG_DIN_A3 = 0,
00041     PG_DIN_A4 = 1,
00042     PG_DIN_A5 = 2,
00043     PG_US_LETTER = 3,
00044     PG_US_LEGAL = 4,
00045     PG_SCREEN = 5,
00046     PG_CUSTOM = 6,
00047     PG_DIN_B5 = 7,
00048     PG_US_EXECUTIVE = 8,
00049     PG_DIN_A0 = 9,
00050     PG_DIN_A1 = 10,
00051     PG_DIN_A2 = 11,
00052     PG_DIN_A6 = 12,
00053     PG_DIN_A7 = 13,
00054     PG_DIN_A8 = 14,
00055     PG_DIN_A9 = 15,
00056     PG_DIN_B0 = 16,
00057     PG_DIN_B1 = 17,
00058     PG_DIN_B10 = 18,
00059     PG_DIN_B2 = 19,
00060     PG_DIN_B3 = 20,
00061     PG_DIN_B4 = 21,
00062     PG_DIN_B6 = 22,
00063     PG_ISO_C5 = 23,
00064     PG_US_COMM10 = 24,
00065     PG_ISO_DL = 25,
00066     PG_US_FOLIO = 26,
00067     PG_US_LEDGER = 27,
00068     PG_US_TABLOID = 28,
00069     // update the number below and the static arrays if you add more values to the enum
00070     PG_LAST_FORMAT = PG_US_TABLOID // used by koPageLayout.cpp
00071 };
00072 
00076 enum KoOrientation {
00077     PG_PORTRAIT = 0,
00078     PG_LANDSCAPE = 1
00079 };
00080 
00081 namespace KoPageFormat
00082 {
00093     KOFFICECORE_EXPORT int /*KPrinter::PageSize*/ printerPageSize( KoFormat format );
00094 
00099     KOFFICECORE_EXPORT double width( KoFormat format, KoOrientation orientation );
00100 
00105     KOFFICECORE_EXPORT double height( KoFormat format, KoOrientation orientation );
00106 
00111     KOFFICECORE_EXPORT QString formatString( KoFormat format );
00112 
00117     KOFFICECORE_EXPORT KoFormat formatFromString( const QString & string );
00118 
00122     KOFFICECORE_EXPORT KoFormat defaultFormat();
00123 
00128     KOFFICECORE_EXPORT QString name( KoFormat format );
00129 
00133     KOFFICECORE_EXPORT QStringList allFormats();
00134 
00139     KOFFICECORE_EXPORT KoFormat guessFormat( double width, double height );
00140 }
00141 
00142 
00149 enum KoHFType {
00150     HF_SAME = 0,            
00151     HF_FIRST_EO_DIFF = 1,   
00152     HF_FIRST_DIFF = 2,      
00153     HF_EO_DIFF = 3          
00154 };
00155 
00160 struct KoPageLayout
00161 {
00163     KoFormat format;
00165     KoOrientation orientation;
00166 
00168     double ptWidth;
00170     double ptHeight;
00172     double ptLeft;
00174     double ptRight;
00176     double ptTop;
00178     double ptBottom;
00179 
00180     bool operator==( const KoPageLayout& l ) const {
00181        return ( ptWidth == l.ptWidth &&
00182                 ptHeight == l.ptHeight &&
00183                 ptLeft == l.ptLeft &&
00184                 ptRight == l.ptRight &&
00185                 ptTop == l.ptTop &&
00186                 ptBottom == l.ptBottom );
00187     }
00188     bool operator!=( const KoPageLayout& l ) const {
00189         return !( (*this) == l );
00190     }
00191 
00195     KOFFICECORE_EXPORT KoGenStyle saveOasis() const;
00196 
00200     KOFFICECORE_EXPORT void loadOasis(const QDomElement &style);
00201 
00207     static KOFFICECORE_EXPORT KoPageLayout standardLayout();
00208 };
00209 
00211 struct KoHeadFoot
00212 {
00213     QString headLeft;
00214     QString headMid;
00215     QString headRight;
00216     QString footLeft;
00217     QString footMid;
00218     QString footRight;
00219 };
00220 
00222 struct KoColumns
00223 {
00224     int columns;
00225     double ptColumnSpacing;
00226     bool operator==( const KoColumns& rhs ) const {
00227         return columns == rhs.columns &&
00228                QABS(ptColumnSpacing - rhs.ptColumnSpacing) <= 1E-10;
00229     }
00230     bool operator!=( const KoColumns& rhs ) const {
00231         return columns != rhs.columns ||
00232                QABS(ptColumnSpacing - rhs.ptColumnSpacing) > 1E-10;
00233     }
00234 };
00235 
00237 struct KoKWHeaderFooter
00238 {
00239     KoHFType header;
00240     KoHFType footer;
00241     double ptHeaderBodySpacing;
00242     double ptFooterBodySpacing;
00243     double ptFootNoteBodySpacing;
00244     bool operator==( const KoKWHeaderFooter& rhs ) const {
00245         return header == rhs.header && footer == rhs.footer &&
00246                QABS(ptHeaderBodySpacing - rhs.ptHeaderBodySpacing) <= 1E-10 &&
00247                QABS(ptFooterBodySpacing - rhs.ptFooterBodySpacing) <= 1E-10 &&
00248                QABS(ptFootNoteBodySpacing - rhs.ptFootNoteBodySpacing) <= 1E-10;
00249     }
00250     bool operator!=( const KoKWHeaderFooter& rhs ) const {
00251         return !( *this == rhs );
00252     }
00253 };
00254 
00255 #endif /* KOPAGELAYOUT_H */
00256 
KDE Logo
This file is part of the documentation for lib Library Version 1.4.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Mon Feb 13 09:40:02 2006 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003