F:/KPlato/koffice/libs/kotext/KoParagLayout.h

Aller à la documentation de ce fichier.
00001 /* This file is part of the KDE project
00002    Copyright (C) 2001 David Faure <faure@kde.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef koparaglayout_h
00021 #define koparaglayout_h
00022 
00023 #include <KoTabulator.h>
00024 #include <qdom.h>
00025 //Added by qt3to4:
00026 #include <QByteArray>
00027 #include "KoBorder.h"
00028 #include <koffice_export.h>
00029 class KoSavingContext;
00030 class KoGenStyle;
00031 class KoParagCounter;
00032 class KoParagStyle;
00033 class KoOasisContext;
00034 class QColor;
00035 
00041 class KOTEXT_EXPORT KoParagLayout
00042 {
00043 public:
00044     KoParagLayout();
00045     KoParagLayout( const KoParagLayout &layout ) { operator=( layout ); }
00046 
00047     ~KoParagLayout();
00048 
00051     enum { Alignment = 1,
00052            BulletNumber = 2, // TODO: we can use Counter now :)
00053            Margins = 4,
00054            LineSpacing = 8,
00055            Borders = 16,
00056            Tabulator = 32,
00057            PageBreaking = 64,
00058            BackgroundColor = 128,
00059            /* Style is maybe missing */
00060            All = Alignment | BulletNumber | Margins | LineSpacing |
00061                  Borders | Tabulator | PageBreaking | BackgroundColor
00062     } Flags;
00063 
00065     enum {
00066         BreakBetweenLines = 0, // default
00067         KeepLinesTogether = 1,
00068         HardFrameBreakBefore = 2,      // incompatible with KeepWithPrevious
00069         HardFrameBreakAfter = 4,       // incompatible with KeepWithNext
00070         KeepWithPrevious = 8,          // incompatible with HardFrameBreakBefore
00071         KeepWithNext = 16              // incompatible with HardFrameBreakAfter
00072     };
00073 
00074     // This class is used as a struct, which explains the public vars :)
00076     double margins[5];
00088     enum SpacingType { LS_SINGLE = 0, LS_ONEANDHALF = -1, LS_DOUBLE = -2,
00089                        LS_CUSTOM = -3, LS_AT_LEAST = -4, LS_MULTIPLE = -5, LS_FIXED = -6 };
00090     SpacingType lineSpacingType;
00091     double lineSpacingValue() const { return lineSpacing;}
00092     void setLineSpacingValue(double _value) { lineSpacing = _value;}
00093 
00094     static QString* shadowCssCompat; // used for compat with koffice-1.2 when loading
00095 
00096     bool joinBorder:1;
00097     bool unused:7;          // for future use
00098     char pageBreaking;    // Page breaking flags
00099     char direction;       // QChar::Direction
00101     char alignment; // Qt::AlignmentFlag
00102     KoBorder leftBorder, rightBorder, topBorder, bottomBorder;
00103 
00105 
00111     QColor backgroundColor;
00112 
00114     KoParagCounter* counter;
00115 
00116     KoParagStyle* style;
00117 
00118     bool hasBorder() const { return topBorder.penWidth() > 0
00119                                  || bottomBorder.penWidth() > 0
00120                                  || leftBorder.penWidth() > 0
00121                                  || rightBorder.penWidth() > 0; }
00122 
00123     void setTabList( const KoTabulatorList & tabList ) { m_tabList = tabList; }
00124     const KoTabulatorList& tabList() const { return m_tabList; }
00125 
00127 
00132     void operator=( const KoParagLayout & );
00133 
00135     int compare( const KoParagLayout & layout ) const;
00136 
00140     void saveParagLayout( QDomElement & parentElem, int alignment ) const;
00141 
00145     static void loadParagLayout( KoParagLayout& layout, const QDomElement& parentElem, int docVersion = 2 );
00146 
00148     static void loadOasisParagLayout( KoParagLayout& layout, KoOasisContext& context );
00154     void saveOasis( KoGenStyle& gs, KoSavingContext& context, bool savingStyle ) const;
00155 
00157     static Qt::AlignmentFlag loadOasisAlignment( const QByteArray& str );
00159     static QByteArray saveOasisAlignment( Qt::AlignmentFlag alignment );
00160 
00161 private:
00162     static int getAttribute(const QDomElement &element, const char *attributeName, int defaultValue) {
00163         QString value = element.attribute( attributeName );
00164         return value.isNull() ? defaultValue : value.toInt();
00165     }
00166 
00167     static double getAttribute(const QDomElement &element, const char *attributeName, double defaultValue) {
00168         QString value = element.attribute( attributeName );
00169         return value.isNull() ? defaultValue : value.toDouble();
00170     }
00171 
00172 private:
00173     KoTabulatorList m_tabList;
00174     double lineSpacing;
00175     class Private;
00176     Private *d;
00177 
00179     void initialise();
00180 };
00181 
00182 #endif

Généré le Wed Nov 22 23:41:08 2006 pour KPlato par  doxygen 1.5.1-p1