kspread

KSpread::Style Class Reference

#include <kspread_style.h>

Inheritance diagram for KSpread::Style:

KSpread::CustomStyle List of all members.

Detailed Description

The Style class represents a cell style.

Built-in and custom styles, the ones shown in the StyleManager dialog, are CustomStyles. Pure Styles have no name, for instance, and are only used as AUTO styles.

Definition at line 45 of file kspread_style.h.


Public Types

enum  StyleType { BUILTIN, CUSTOM, AUTO, TENTATIVE }
enum  FontFlags { FBold = 0x01, FUnderline = 0x02, FItalic = 0x04, FStrike = 0x08 }
enum  Properties {
  PDontPrintText = 0x01, PCustomFormat = 0x02, PNotProtected = 0x04, PHideAll = 0x08,
  PHideFormula = 0x10, PMultiRow = 0x20, PVerticalText = 0x40
}
enum  FlagsSet {
  SAlignX = 0x01, SAlignY = 0x02, SPrefix = 0x08, SPostfix = 0x10,
  SLeftBorder = 0x20, SRightBorder = 0x40, STopBorder = 0x80, SBottomBorder = 0x100,
  SFallDiagonal = 0x200, SGoUpDiagonal = 0x400, SBackgroundBrush = 0x800, SFont = 0x1000,
  STextPen = 0x2000, SBackgroundColor = 0x4000, SFloatFormat = 0x8000, SFloatColor = 0x10000,
  SMultiRow = 0x20000, SVerticalText = 0x40000, SPrecision = 0x80000, SFormatType = 0x100000,
  SAngle = 0x200000, SIndent = 0x800000, SDontPrintText = 0x1000000, SCustomFormat = 0x2000000,
  SNotProtected = 0x4000000, SHideAll = 0x8000000, SHideFormula = 0x10000000, SFontSize = 0x20000000,
  SFontFlag = 0x40000000, SFontFamily = 0x80000000
}

Public Member Functions

 Style ()
 Style (Style *style)
virtual ~Style ()
bool operator== (const Style &style) const
StyleType type () const
void saveXML (QDomDocument &doc, QDomElement &format) const
bool loadXML (QDomElement &format)
virtual QString saveOasis (KoGenStyle &style, KoGenStyles &mainStyles)
void loadOasisStyle (KoOasisStyles &oasisStyles, const QDomElement &element)
bool release ()
void addRef ()
int usage () const
bool hasProperty (Properties p) const
bool hasFeature (FlagsSet f, bool withoutParent) const
uint features () const
uint bottomPenValue () const
uint rightPenValue () const
uint leftPenValue () const
uint topPenValue () const
QPen const & pen () const
QColor const & bgColor () const
QPen const & rightBorderPen () const
QPen const & bottomBorderPen () const
QPen const & leftBorderPen () const
QPen const & topBorderPen () const
QPen const & fallDiagonalPen () const
QPen const & goUpDiagonalPen () const
QBrush const & backGroundBrush () const
QString const & strFormat () const
QString const & prefix () const
QString const & postfix () const
QString const & fontFamily () const
Format::Align alignX () const
Format::AlignY alignY () const
Format::FloatFormat floatFormat () const
Format::FloatColor floatColor () const
FormatType formatType () const
Format::Currency const & currency () const
QFont font () const
uint fontFlags () const
int fontSize () const
int precision () const
int rotateAngle () const
double indent () const
StylesetAlignX (Format::Align alignX)
StylesetAlignY (Format::AlignY alignY)
StylesetFont (QFont const &f)
StylesetFontFamily (QString const &fam)
StylesetFontFlags (uint flags)
StylesetFontSize (int size)
StylesetPen (QPen const &pen)
StylesetBgColor (QColor const &color)
StylesetRightBorderPen (QPen const &pen)
StylesetBottomBorderPen (QPen const &pen)
StylesetLeftBorderPen (QPen const &pen)
StylesetTopBorderPen (QPen const &pen)
StylesetFallDiagonalPen (QPen const &pen)
StylesetGoUpDiagonalPen (QPen const &pen)
StylesetRotateAngle (int angle)
StylesetIndent (double indent)
StylesetBackGroundBrush (QBrush const &brush)
StylesetFloatFormat (Format::FloatFormat format)
StylesetFloatColor (Format::FloatColor color)
StylesetFormatType (FormatType format)
StylesetStrFormat (QString const &strFormat)
StylesetPrecision (int precision)
StylesetPrefix (QString const &prefix)
StylesetPostfix (QString const &postfix)
StylesetCurrency (Format::Currency const &currency)
StylesetProperty (Properties p)
StyleclearProperty (Properties p)
CustomStyleparent () const
QString const & parentName () const
void setParent (CustomStyle *parent)

Static Public Member Functions

static FormatType formatType (const QString &_format)
static QString saveOasisStyleNumeric (KoGenStyle &style, KoGenStyles &mainStyles, FormatType _style, const QString &_prefix, const QString &_postfix, int _precision, const QString &symbol)
static QString saveOasisStyleNumericDate (KoGenStyles &mainStyles, FormatType _style)
static QString saveOasisStyleNumericFraction (KoGenStyles &mainStyles, FormatType _style, const QString &_prefix, const QString _suffix)
static QString saveOasisStyleNumericTime (KoGenStyles &mainStyles, FormatType _style)
static QString saveOasisStyleNumericCustom (KoGenStyles &mainStyles, FormatType _style)
static QString saveOasisStyleNumericScientific (KoGenStyles &mainStyles, FormatType _style, const QString &_prefix, const QString _suffix, int _precision)
static QString saveOasisStyleNumericPercentage (KoGenStyles &mainStyles, FormatType _style, int _precision)
static QString saveOasisStyleNumericMoney (KoGenStyles &mainStyles, FormatType _style, int _precision)
static QString saveOasisStyleNumericText (KoGenStyles &mainStyles, FormatType _style, int _precision)
static QString saveOasisStyleNumericNumber (KoGenStyles &mainStyles, FormatType _style, int _precision)
static QString saveOasisBackgroundStyle (KoGenStyles &mainStyles, const QBrush &brush)
static QString colorName (const QColor &color)

Protected Member Functions

void saveOasisStyle (KoGenStyle &style, KoGenStyles &mainStyles)
bool featureSet (FlagsSet f) const

Protected Attributes

CustomStylem_parent
QString m_parentName
StyleType m_type
uint m_usageCount
uint m_featuresSet
Format::Align m_alignX
Format::AlignY m_alignY
Format::FloatFormat m_floatFormat
Format::FloatColor m_floatColor
FormatType m_formatType
QString m_fontFamily
uint m_fontFlags
int m_fontSize
QPen m_textPen
QColor m_bgColor
QPen m_rightBorderPen
QPen m_bottomBorderPen
QPen m_leftBorderPen
QPen m_topBorderPen
QPen m_fallDiagonalPen
QPen m_goUpDiagonalPen
QBrush m_backGroundBrush
int m_rotateAngle
double m_indent
QString m_strFormat
int m_precision
QString m_prefix
QString m_postfix
Format::Currency m_currency
uint m_properties
uint m_bottomPenValue
uint m_rightPenValue
uint m_leftPenValue
uint m_topPenValue

Member Enumeration Documentation

enum KSpread::Style::FlagsSet
 

See also:
Format::Properties

Definition at line 79 of file kspread_style.h.

enum KSpread::Style::Properties
 

See also:
Format::FormatFlags

Definition at line 66 of file kspread_style.h.

enum KSpread::Style::StyleType
 

The style type.

Enumerator:
BUILTIN  built-in style (the default style)
CUSTOM  custom style (defined in the StyleManager dialog)
AUTO  automatically generated on cell format changes
TENTATIVE 

Definition at line 49 of file kspread_style.h.


Constructor & Destructor Documentation

Style::Style  ) 
 

Constructor.

Creates an empty automatic style.

Definition at line 50 of file kspread_style.cc.

Style::Style Style style  ) 
 

Constructor.

Creates an automatic style. If style is a custom or built-in style (e.g. the default style), style becomes the parent style. In this case, features are NOT SET.

Parameters:
style The style which features are copied.

Definition at line 89 of file kspread_style.cc.

Style::~Style  )  [virtual]
 

Destructor.

Definition at line 122 of file kspread_style.cc.


Member Function Documentation

void Style::addRef  ) 
 

Marks this style as used.

The internal reference counter is incremented.

Definition at line 1805 of file kspread_style.cc.

QString Style::colorName const QColor &  color  )  [static]
 

Returns the name of a colour.

This is the same as returned by QColor::name, but an internal cache is used to reduce the overhead when asking for the name of the same colour.

Definition at line 2644 of file kspread_style.cc.

bool Style::operator== const Style style  )  const
 

Returns true if both styles have the same properties.

Definition at line 126 of file kspread_style.cc.

bool Style::release  ) 
 

Releases this style.

The internal reference counter is decremented.

Returns:
true, if this style is not used anymore and should be deleted.

Definition at line 1792 of file kspread_style.cc.

QString Style::saveOasis KoGenStyle &  style,
KoGenStyles &  mainStyles
[virtual]
 

Saves an OASIS automatic style.

Reimplemented by CustomStyle for OASIS user styles.

Returns:
always QString::null

Reimplemented in KSpread::CustomStyle.

Definition at line 1094 of file kspread_style.cc.

void Style::saveOasisStyle KoGenStyle &  style,
KoGenStyles &  mainStyles
[protected]
 

Helper function for saveOasis Does the real work by determining the used attributes.

Definition at line 1105 of file kspread_style.cc.

QString Style::saveOasisStyleNumeric KoGenStyle &  style,
KoGenStyles &  mainStyles,
FormatType  _style,
const QString &  _prefix,
const QString &  _postfix,
int  _precision,
const QString &  symbol
[static]
 

Returns:
the name of the data style (number, currency, percentage, date, boolean, text)

Definition at line 711 of file kspread_style.cc.

int KSpread::Style::usage  )  const [inline]
 

Returns:
the number of references to this style.

Definition at line 181 of file kspread_style.h.


Member Data Documentation

Format::Align KSpread::Style::m_alignX [protected]
 

Alignment of the text.

Definition at line 276 of file kspread_style.h.

Format::AlignY KSpread::Style::m_alignY [protected]
 

Aligment of the text at top middle or bottom.

Definition at line 280 of file kspread_style.h.

QBrush KSpread::Style::m_backGroundBrush [protected]
 

The brush used to draw the background.

Definition at line 338 of file kspread_style.h.

QColor KSpread::Style::m_bgColor [protected]
 

The background color.

Definition at line 304 of file kspread_style.h.

QPen KSpread::Style::m_bottomBorderPen [protected]
 

The pen used to draw the bottom border.

Definition at line 314 of file kspread_style.h.

Format::Currency KSpread::Style::m_currency [protected]
 

Currency information: about which currency from which country.

Definition at line 368 of file kspread_style.h.

QPen KSpread::Style::m_fallDiagonalPen [protected]
 

The pen used to draw the diagonal.

Definition at line 329 of file kspread_style.h.

Format::FloatColor KSpread::Style::m_floatColor [protected]
 

The color format of a floating point value.

Definition at line 286 of file kspread_style.h.

QString KSpread::Style::m_fontFamily [protected]
 

The font used to draw the text.

Definition at line 293 of file kspread_style.h.

QPen KSpread::Style::m_goUpDiagonalPen [protected]
 

The pen used to draw the the diagonal which go up.

Definition at line 333 of file kspread_style.h.

double KSpread::Style::m_indent [protected]
 

Give indent.

Definition at line 344 of file kspread_style.h.

QPen KSpread::Style::m_leftBorderPen [protected]
 

The pen used to draw the left border.

Definition at line 319 of file kspread_style.h.

QString KSpread::Style::m_postfix [protected]
 

The postfix of a numeric value ( for example "DM" ) May be empty.

Definition at line 363 of file kspread_style.h.

int KSpread::Style::m_precision [protected]
 

The precision of the floating point representation If precision is -1, this means that no precision is specified.

Definition at line 353 of file kspread_style.h.

QString KSpread::Style::m_prefix [protected]
 

The prefix of a numeric value ( for example "$" ) May be empty.

Definition at line 358 of file kspread_style.h.

uint KSpread::Style::m_properties [protected]
 

Stores information like: DonPrint, DontShowFormula, Protected.

..

Definition at line 373 of file kspread_style.h.

QPen KSpread::Style::m_rightBorderPen [protected]
 

The pen used to draw the right border.

Definition at line 309 of file kspread_style.h.

QString KSpread::Style::m_strFormat [protected]
 

Format of the content, e.g.

#.##0.00, dd/mmm/yyyy,...

Definition at line 348 of file kspread_style.h.

QPen KSpread::Style::m_textPen [protected]
 

The pen used to draw the text.

Definition at line 300 of file kspread_style.h.

QPen KSpread::Style::m_topBorderPen [protected]
 

The pen used to draw the top border.

Definition at line 324 of file kspread_style.h.


The documentation for this class was generated from the following files:
KDE Home | KDE Accessibility Home | Description of Access Keys