1 /***************************************************************************
2 * Copyright (C) 2006 by Tobias Koenig <tokoe@kde.org> *
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
;
19 class QTextListFormat
;
20 class QTextTableFormat
;
24 class StyleInformation
;
26 class FontFormatProperty
31 void apply( QTextFormat
*format
) const;
33 void setFamily( const QString
&name
);
39 class ParagraphFormatProperty
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;
68 WritingMode mWritingMode
;
69 Qt::Alignment mAlignment
;
71 QColor mBackgroundColor
;
75 class 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
);
91 const StyleInformation
*mStyleInformation
;
98 QColor mBackgroundColor
;
101 class PageFormatProperty
112 enum PrintOrientation
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;
136 PageUsage mPageUsage
;
137 double mBottomMargin
;
143 PrintOrientation mPrintOrientation
;
146 class ListFormatProperty
155 ListFormatProperty();
156 ListFormatProperty( Type type
);
158 void apply( QTextListFormat
*format
, int level
) const;
160 void addItem( int level
, double indent
= 0 );
164 QVector
<double> mIndents
;
167 class TableColumnFormatProperty
170 TableColumnFormatProperty();
172 void apply( QTextTableFormat
*format
) const;
174 void setWidth( double width
);
181 class TableCellFormatProperty
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
);
193 QColor mBackgroundColor
;
195 Qt::Alignment mAlignment
;
199 class StyleFormatProperty
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
);
224 QString mParentStyleName
;
226 QString mMasterPageName
;
227 ParagraphFormatProperty mParagraphFormat
;
228 TextFormatProperty mTextFormat
;
229 TableColumnFormatProperty mTableColumnFormat
;
230 TableCellFormatProperty mTableCellFormat
;
231 const StyleInformation
*mStyleInformation
;