SVN_SILENT made messages (.desktop file)
[kdegraphics.git] / okular / generators / ooo / formatproperty.h
blob039ce8c61150483c9a269987bea7eb7e687d1dd3
1 /***************************************************************************
2 * Copyright (C) 2006 by Tobias Koenig <tokoe@kde.org> *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 ***************************************************************************/
10 #ifndef OOO_FORMATPROPERTY_H
11 #define OOO_FORMATPROPERTY_H
13 #include <QtCore/QVector>
14 #include <QtGui/QColor>
16 class QTextBlockFormat;
17 class QTextCharFormat;
18 class QTextFormat;
19 class QTextListFormat;
20 class QTextTableFormat;
22 namespace OOO {
24 class StyleInformation;
26 class FontFormatProperty
28 public:
29 FontFormatProperty();
31 void apply( QTextFormat *format ) const;
33 void setFamily( const QString &name );
35 private:
36 QString mFamily;
39 class ParagraphFormatProperty
41 public:
42 enum WritingMode
44 LRTB,
45 RLTB,
46 TBRL,
47 TBLR,
48 LR,
49 RL,
50 TB,
51 PAGE
54 ParagraphFormatProperty();
56 void apply( QTextFormat *format ) const;
58 void setPageNumber( int number );
59 void setWritingMode( WritingMode mode );
60 void setTextAlignment( Qt::Alignment alignment );
61 void setBackgroundColor( const QColor &color );
62 void setLeftMargin( const qreal margin );
64 bool writingModeIsRightToLeft() const;
66 private:
67 int mPageNumber;
68 WritingMode mWritingMode;
69 Qt::Alignment mAlignment;
70 bool mHasAlignment;
71 QColor mBackgroundColor;
72 qreal mLeftMargin;
75 class TextFormatProperty
77 public:
78 TextFormatProperty();
79 TextFormatProperty( const StyleInformation *information );
81 void apply( QTextCharFormat *format ) const;
83 void setFontSize( int size );
84 void setFontName( const QString &name );
85 void setFontWeight( int weight );
86 void setTextPosition( int position );
87 void setColor( const QColor &color );
88 void setBackgroundColor( const QColor &color );
90 private:
91 const StyleInformation *mStyleInformation;
92 int mFontSize;
93 bool mHasFontSize;
94 int mFontWeight;
95 QString mFontName;
96 int mTextPosition;
97 QColor mColor;
98 QColor mBackgroundColor;
101 class PageFormatProperty
103 public:
104 enum PageUsage
106 All,
107 Left,
108 Right,
109 Mirrored
112 enum PrintOrientation
114 Portrait,
115 Landscape
118 PageFormatProperty();
120 void apply( QTextFormat *format ) const;
122 void setPageUsage( PageUsage usage );
123 void setBottomMargin( double margin );
124 void setLeftMargin( double margin );
125 void setTopMargin( double margin );
126 void setRightMargin( double margin );
127 void setHeight( double height );
128 void setWidth( double width );
129 void setPrintOrientation( PrintOrientation orientation );
131 double width() const;
132 double height() const;
133 double margin() const;
135 private:
136 PageUsage mPageUsage;
137 double mBottomMargin;
138 double mLeftMargin;
139 double mTopMargin;
140 double mRightMargin;
141 double mHeight;
142 double mWidth;
143 PrintOrientation mPrintOrientation;
146 class ListFormatProperty
148 public:
149 enum Type
151 Number,
152 Bullet
155 ListFormatProperty();
156 ListFormatProperty( Type type );
158 void apply( QTextListFormat *format, int level ) const;
160 void addItem( int level, double indent = 0 );
162 private:
163 Type mType;
164 QVector<double> mIndents;
167 class TableColumnFormatProperty
169 public:
170 TableColumnFormatProperty();
172 void apply( QTextTableFormat *format ) const;
174 void setWidth( double width );
176 private:
177 double mWidth;
178 bool isValid;
181 class TableCellFormatProperty
183 public:
184 TableCellFormatProperty();
186 void apply( QTextBlockFormat *format ) const;
188 void setBackgroundColor( const QColor &color );
189 void setPadding( double padding );
190 void setAlignment( Qt::Alignment alignment );
192 private:
193 QColor mBackgroundColor;
194 double mPadding;
195 Qt::Alignment mAlignment;
196 bool mHasAlignment;
199 class StyleFormatProperty
201 public:
202 StyleFormatProperty();
203 StyleFormatProperty( const StyleInformation *information );
205 void applyBlock( QTextBlockFormat *format ) const;
206 void applyText( QTextCharFormat *format ) const;
207 void applyTableColumn( QTextTableFormat *format ) const;
208 void applyTableCell( QTextBlockFormat *format ) const;
210 void setParentStyleName( const QString &parentStyleName );
211 QString parentStyleName() const;
213 void setFamily( const QString &family );
214 void setDefaultStyle( bool defaultStyle );
216 void setMasterPageName( const QString &masterPageName );
218 void setParagraphFormat( const ParagraphFormatProperty &format );
219 void setTextFormat( const TextFormatProperty &format );
220 void setTableColumnFormat( const TableColumnFormatProperty &format );
221 void setTableCellFormat( const TableCellFormatProperty &format );
223 private:
224 QString mParentStyleName;
225 QString mFamily;
226 QString mMasterPageName;
227 ParagraphFormatProperty mParagraphFormat;
228 TextFormatProperty mTextFormat;
229 TableColumnFormatProperty mTableColumnFormat;
230 TableCellFormatProperty mTableCellFormat;
231 const StyleInformation *mStyleInformation;
232 bool mDefaultStyle;
237 #endif