20#ifndef __kspread_style__
21#define __kspread_style__
28#include "kspread_format.h"
68 PDontPrintText = 0x01,
89 SBottomBorder = 0x100,
90 SFallDiagonal = 0x200,
91 SGoUpDiagonal = 0x400,
92 SBackgroundBrush = 0x800,
95 SBackgroundColor = 0x4000,
96 SFloatFormat = 0x8000,
97 SFloatColor = 0x10000,
99 SVerticalText = 0x40000,
100 SPrecision = 0x80000,
101 SFormatType = 0x100000,
105 SDontPrintText = 0x1000000,
106 SCustomFormat = 0x2000000,
107 SNotProtected = 0x4000000,
108 SHideAll = 0x8000000,
109 SHideFormula = 0x10000000,
110 SFontSize = 0x20000000,
111 SFontFlag = 0x40000000,
112 SFontFamily = 0x80000000
136 inline bool operator!=( const Style& other ) const { return ! operator==( other ); }
138 static FormatType dateType( const TQString &_format );
139 static FormatType timeType( const TQString &_format );
140 static FormatType fractionType( const TQString &_format );
146 static TQString saveOasisStyleNumeric( KoGenStyle &style, KoGenStyles &mainStyles, FormatType _style,
147 const TQString &_prefix, const TQString &_postfix, int _precision, const TQString& symbol );
148 static TQString saveOasisStyleNumericDate( KoGenStyles &mainStyles, FormatType _style,
149 const TQString &_prefix, const TQString &_suffix );
150 static TQString saveOasisStyleNumericFraction( KoGenStyles &mainStyles, FormatType _style,
151 const TQString &_prefix, const TQString _suffix );
152 static TQString saveOasisStyleNumericTime( KoGenStyles& mainStyles, FormatType _style,
153 const TQString &_prefix, const TQString &_suffix );
154 static TQString saveOasisStyleNumericCustom( KoGenStyles&mainStyles, FormatType _style,
155 const TQString &_prefix, const TQString &_suffix );
156 static TQString saveOasisStyleNumericScientific( KoGenStyles&mainStyles, FormatType _style,
157 const TQString &_prefix, const TQString _suffix, int _precision );
158 static TQString saveOasisStyleNumericPercentage( KoGenStyles&mainStyles, FormatType _style, int _precision,
159 const TQString &_prefix, const TQString &_suffix );
160 static TQString saveOasisStyleNumericMoney( KoGenStyles&mainStyles, FormatType _style,
161 const TQString& symbol, int _precision,
162 const TQString &_prefix, const TQString &_suffix );
163 static TQString saveOasisStyleNumericText( KoGenStyles&mainStyles, FormatType _style, int _precision,
164 const TQString &_prefix, const TQString &_suffix );
165 static TQString saveOasisStyleNumericNumber( KoGenStyles&mainStyles, FormatType _style, int _precision,
166 const TQString &_prefix, const TQString &_suffix );
169 StyleType type() const { return m_type; }
171 void saveXML( TQDomDocument & doc, TQDomElement & format ) const;
172 bool loadXML( TQDomElement & format );
179 virtual TQString saveOasis( KoGenStyle& style, KoGenStyles& mainStyles);
180 void loadOasisStyle( KoOasisStyles& oasisStyles, const TQDomElement & element );
181 static TQString saveOasisBackgroundStyle( KoGenStyles &mainStyles, const TQBrush &brush );
195 int usage() const { return m_usageCount; }
198 bool hasFeature( FlagsSet f, bool withoutParent ) const;
200 uint features() const { return m_featuresSet; }
202 uint bottomPenValue() const { return m_bottomPenValue; }
203 uint rightPenValue() const { return m_rightPenValue; }
204 uint leftPenValue() const { return m_leftPenValue; }
205 uint topPenValue() const { return m_topPenValue; }
207 TQPen const & pen() const;
208 TQColor const & bgColor() const;
209 TQPen const & rightBorderPen() const;
210 TQPen const & bottomBorderPen() const;
211 TQPen const & leftBorderPen() const;
212 TQPen const & topBorderPen() const;
213 TQPen const & fallDiagonalPen() const;
214 TQPen const & goUpDiagonalPen() const;
215 TQBrush const & backGroundBrush() const;
216 TQString const & strFormat() const;
217 TQString const & prefix() const;
218 TQString const & postfix() const;
219 TQString const & fontFamily() const;
221 Format::Align alignX() const;
222 Format::AlignY alignY() const;
223 Format::FloatFormat floatFormat() const;
224 Format::FloatColor floatColor() const;
225 FormatType formatType() const;
227 Format::Currency const & currency() const;
230 uint fontFlags() const;
231 int fontSize() const;
232 int precision() const;
233 int rotateAngle() const;
234 double indent() const;
236 Style * setAlignX( Format::Align alignX );
237 Style * setAlignY( Format::AlignY alignY );
238 Style * setFont( TQFont const & f );
239 Style * setFontFamily( TQString const & fam );
240 Style * setFontFlags( uint flags );
241 Style * setFontSize( int size );
242 Style * setPen( TQPen const & pen );
243 Style * setBgColor( TQColor const & color );
244 Style * setRightBorderPen( TQPen const & pen );
245 Style * setBottomBorderPen( TQPen const & pen );
246 Style * setLeftBorderPen( TQPen const & pen );
247 Style * setTopBorderPen( TQPen const & pen );
248 Style * setFallDiagonalPen( TQPen const & pen );
249 Style * setGoUpDiagonalPen( TQPen const & pen );
250 Style * setRotateAngle( int angle );
251 Style * setIndent( double indent );
252 Style * setBackGroundBrush( TQBrush const & brush );
253 Style * setFloatFormat( Format::FloatFormat format );
254 Style * setFloatColor( Format::FloatColor color );
255 Style * setFormatType( FormatType format );
256 Style * setStrFormat( TQString const & strFormat );
257 Style * setPrecision( int precision );
258 Style * setPrefix( TQString const & prefix );
259 Style * setPostfix( TQString const & postfix );
260 Style * setCurrency( Format::Currency const & currency );
264 CustomStyle * parent() const;
265 TQString const & parentName() const { return m_parentName; }
266 void setParent( CustomStyle * parent );
272 static TQString colorName( const TQColor& color );
279 void saveOasisStyle( KoGenStyle &style, KoGenStyles &mainStyles );
281 void loadOasisDataStyle( KoOasisStyles& oasisStyles, const TQDomElement& styleStack );
282 void loadOasisParagraphProperties( KoOasisStyles& oasisStyles, const KoStyleStack& styleStack );
283 void loadOasisTableCellProperties( KoOasisStyles& oasisStyles, const KoStyleStack& styleStack );
284 void loadOasisTextProperties( KoOasisStyles& oasisStyles, const KoStyleStack& styleStack );
286 CustomStyle * m_parent;
287 TQString m_parentName;
301 Format::FloatFormat m_floatFormat;
307 FormatType m_formatType;
394 uint m_bottomPenValue;
395 uint m_rightPenValue;
399 bool featureSet( FlagsSet f ) const { return ( !m_parent || ( m_featuresSet & (uint) f ) ); }
418 TQString const & name() const { return m_name; }
420 void save( TQDomDocument & doc, TQDomElement & styles );
426 virtual TQString saveOasis( KoGenStyle& style, KoGenStyles &mainStyles );
434 void loadOasis( KoOasisStyles& oasisStyles, const TQDomElement & style, const TQString & name );
436 bool loadXML( TQDomElement const & style, TQString const & name );
438 void setType( StyleType type ) { m_type = type; }
440 void setName( TQString const & name );
441 void refreshParentName();
442 bool definesAll() const;
444 void changeAlignX( Format::Align alignX );
445 void changeAlignY( Format::AlignY alignY );
446 void changeFont( TQFont const & f );
447 void changeFontFamily( TQString const & fam );
448 void changeFontSize( int size );
449 void changeFontFlags( uint flags );
450 void changePen( TQPen const & pen );
451 void changeTextColor( TQColor const & color );
452 void changeBgColor( TQColor const & color );
453 void changeRightBorderPen( TQPen const & pen );
454 void changeBottomBorderPen( TQPen const & pen );
455 void changeLeftBorderPen( TQPen const & pen );
456 void changeTopBorderPen( TQPen const & pen );
457 void changeFallBorderPen( TQPen const & pen );
458 void changeGoUpBorderPen( TQPen const & pen );
459 void changeRotateAngle( int angle );
460 void changeIndent( double indent );
461 void changeBackGroundBrush( TQBrush const & brush );
462 void changeFloatFormat( Format::FloatFormat format );
463 void changeFloatColor( Format::FloatColor color );
464 void changeFormatType( FormatType format );
465 void changeStrFormat( TQString const & strFormat );
466 void changePrecision( int precision );
467 void changePrefix( TQString const & prefix );
468 void changePostfix( TQString const & postfix );
469 void changeCurrency( Format::Currency const & currency );
475 inline bool operator!=( const CustomStyle& other ) const { return !operator==( other ); }
478 friend class StyleManager;
Built-in or custom style defined in StyleManager dialog.
void loadOasis(KoOasisStyles &oasisStyles, const TQDomElement &style, const TQString &name) Loads the style properties from style .
virtual TQString saveOasis(KoGenStyle &style, KoGenStyles &mainStyles)
The Style class represents a cell style.
TQBrush m_backGroundBrush The brush used to draw the background.
TQPen m_fallDiagonalPen The pen used to draw the diagonal.
TQString m_postfix The postfix of a numeric value ( for example "DM" ) May be empty.
TQString m_strFormat Format of the content, e.g.
double m_indent Give indent.
TQPen m_bottomBorderPen The pen used to draw the bottom border.
uint m_properties Stores information like: DonPrint, DontShowFormula, Protected...
TQString m_fontFamily The font used to draw the text.
void addRef() Marks this style as used.
bool operator==(const Style &style) const Returns true if both styles have the same properties.
bool release() Releases this style.
TQPen m_topBorderPen The pen used to draw the top border.
virtual TQString saveOasis(KoGenStyle &style, KoGenStyles &mainStyles) Saves an OASIS automatic style.
TQPen m_rightBorderPen The pen used to draw the right border.
Format::FloatColor m_floatColor The color format of a floating point value.
Format::Currency m_currency Currency information: about which currency from which country.
Format::AlignY m_alignY Aligment of the text at top middle or bottom.
TQPen m_textPen The pen used to draw the text.
virtual ~Style() Destructor.
@ BUILTIN built-in style (the default style)
@ AUTO automatically generated on cell format changes
@ CUSTOM custom style (defined in the StyleManager dialog)
Format::Align m_alignX Alignment of the text.
TQString m_prefix The prefix of a numeric value ( for example "$" ) May be empty.
static TQString colorName(const TQColor &color) Returns the name of a colour.
void saveOasisStyle(KoGenStyle &style, KoGenStyles &mainStyles) Helper function for saveOasis Does the real work by determining the used attributes.
int m_precision The precision of the floating point representation If precision is -1, this means that no precision i...
static TQString saveOasisStyleNumeric(KoGenStyle &style, KoGenStyles &mainStyles, FormatType _style, const TQString &_prefix, const TQString &_postfix, int _precision, const TQString &symbol)
TQColor m_bgColor The background color.
TQPen m_goUpDiagonalPen The pen used to draw the the diagonal which go up.
TQPen m_leftBorderPen The pen used to draw the left border.
|