lib
KoParagLayout.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef koparaglayout_h
00021 #define koparaglayout_h
00022
00023 #include <KoRuler.h>
00024 #include <qdom.h>
00025 #include "KoBorder.h"
00026 #include <koffice_export.h>
00027 class KoSavingContext;
00028 class KoGenStyle;
00029 class KoParagCounter;
00030 class KoParagStyle;
00031 class KoOasisContext;
00032 class QColor;
00033
00039 class KOTEXT_EXPORT KoParagLayout
00040 {
00041 public:
00042 KoParagLayout();
00043 KoParagLayout( const KoParagLayout &layout ) { operator=( layout ); }
00044
00045 ~KoParagLayout();
00046
00049 enum { Alignment = 1,
00050 BulletNumber = 2,
00051 Margins = 4,
00052 LineSpacing = 8,
00053 Borders = 16,
00054 Tabulator = 32,
00055 PageBreaking = 64,
00056 BackgroundColor = 128,
00057
00058 All = Alignment | BulletNumber | Margins | LineSpacing |
00059 Borders | Tabulator | PageBreaking | BackgroundColor
00060 } Flags;
00061
00063 enum {
00064 BreakBetweenLines = 0,
00065 KeepLinesTogether = 1,
00066 HardFrameBreakBefore = 2,
00067 HardFrameBreakAfter = 4,
00068 KeepWithPrevious = 8,
00069 KeepWithNext = 16
00070 };
00071
00072
00074 double margins[5];
00086 enum SpacingType { LS_SINGLE = 0, LS_ONEANDHALF = -1, LS_DOUBLE = -2,
00087 LS_CUSTOM = -3, LS_AT_LEAST = -4, LS_MULTIPLE = -5, LS_FIXED = -6 };
00088 SpacingType lineSpacingType;
00089 double lineSpacingValue() const { return lineSpacing;}
00090 void setLineSpacingValue(double _value) { lineSpacing = _value;}
00091
00092 static QString* shadowCssCompat;
00093
00094 bool joinBorder:1;
00095 bool unused:7;
00096 char pageBreaking;
00097 char direction;
00099 char alignment;
00100 KoBorder leftBorder, rightBorder, topBorder, bottomBorder;
00101
00103
00109 QColor backgroundColor;
00110
00112 KoParagCounter* counter;
00113
00114 KoParagStyle* style;
00115
00116 bool hasBorder() const { return topBorder.penWidth() > 0
00117 || bottomBorder.penWidth() > 0
00118 || leftBorder.penWidth() > 0
00119 || rightBorder.penWidth() > 0; }
00120
00121 void setTabList( const KoTabulatorList & tabList ) { m_tabList = tabList; }
00122 const KoTabulatorList& tabList() const { return m_tabList; }
00123
00125
00130 void operator=( const KoParagLayout & );
00131
00133 int compare( const KoParagLayout & layout ) const;
00134
00138 void saveParagLayout( QDomElement & parentElem, int alignment ) const;
00139
00143 static void loadParagLayout( KoParagLayout& layout, const QDomElement& parentElem, int docVersion = 2 );
00144
00146 static void loadOasisParagLayout( KoParagLayout& layout, KoOasisContext& context );
00152 void saveOasis( KoGenStyle& gs, KoSavingContext& context, bool savingStyle ) const;
00153
00155 static Qt::AlignmentFlags loadOasisAlignment( const QCString& str );
00157 static QCString saveOasisAlignment( Qt::AlignmentFlags alignment );
00158
00159 private:
00160 static int getAttribute(const QDomElement &element, const char *attributeName, int defaultValue) {
00161 QString value = element.attribute( attributeName );
00162 return value.isNull() ? defaultValue : value.toInt();
00163 }
00164
00165 static double getAttribute(const QDomElement &element, const char *attributeName, double defaultValue) {
00166 QString value = element.attribute( attributeName );
00167 return value.isNull() ? defaultValue : value.toDouble();
00168 }
00169
00170 private:
00171 KoTabulatorList m_tabList;
00172 double lineSpacing;
00173 class Private;
00174 Private *d;
00175
00177 void initialise();
00178 };
00179
00180 #endif
|