filters
opencalcstyleexport.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef OPENCALCSTYLEEXPORT_H
00022 #define OPENCALCSTYLEEXPORT_H
00023
00024 #include "kspread_format.h"
00025
00026 #include <qcolor.h>
00027 #include <qfont.h>
00028 #include <qptrlist.h>
00029 #include <qstring.h>
00030
00031 namespace KSpread
00032 {
00033 class Cell;
00034 }
00035
00036 class QDomDocument;
00037 class QDomElement;
00038
00039 typedef enum T1 { Boolean, Date, Number, Percentage, Time } NumberType;
00040
00041 class Style
00042 {
00043 public:
00044 enum breakBefore { none, automatic, page };
00045
00046 Style() : breakB( none ), size( 0.0 ) {}
00047
00048 QString name;
00049 uint breakB;
00050 double size;
00051 };
00052
00053 class SheetStyle
00054 {
00055 public:
00056 SheetStyle() : visible( true ) {}
00057
00058 void copyData( SheetStyle const & ts ) { visible = ts.visible; }
00059 static bool isEqual( SheetStyle const * const t1, SheetStyle const & t2 );
00060
00061 QString name;
00062 bool visible;
00063 };
00064
00065 class NumberStyle
00066 {
00067 public:
00068 NumberStyle() {}
00069
00070 void copyData( NumberStyle const & ts ) { type = ts.type; }
00071 static bool isEqual( NumberStyle const * const t1, NumberStyle const & t2 );
00072
00073 QString name;
00074
00075 NumberType type;
00076 QString pattern;
00077 };
00078
00079 class CellStyle
00080 {
00081 public:
00082 CellStyle();
00083
00084 void copyData( CellStyle const & ts );
00085 static bool isEqual( CellStyle const * const t1, CellStyle const & t2 );
00086
00087
00088 static void loadData( CellStyle & cs, KSpread::Cell const * const cell );
00089
00090 QString name;
00091
00092 QFont font;
00093 QString numberStyle;
00094 QColor color;
00095 QColor bgColor;
00096 double indent;
00097 bool wrap;
00098 bool vertical;
00099 int angle;
00100 bool print;
00101 QPen left;
00102 QPen right;
00103 QPen top;
00104 QPen bottom;
00105 bool hideAll;
00106 bool hideFormula;
00107 bool notProtected;
00108
00109 KSpread::Format::Align alignX;
00110 KSpread::Format::AlignY alignY;
00111 };
00112
00113 class ColumnStyle : public Style
00114 {
00115 public:
00116 ColumnStyle() : Style() {}
00117
00118 void copyData( ColumnStyle const & cs );
00119 static bool isEqual( ColumnStyle const * const c1, ColumnStyle const & c2 );
00120 };
00121
00122 class RowStyle : public Style
00123 {
00124 public:
00125 RowStyle() : Style() {}
00126
00127 void copyData( RowStyle const & cs );
00128 static bool isEqual( RowStyle const * const c1, RowStyle const & c2 );
00129 };
00130
00131 class OpenCalcStyles
00132 {
00133 public:
00134 OpenCalcStyles();
00135 ~OpenCalcStyles();
00136
00137 void writeStyles ( QDomDocument & doc, QDomElement & autoStyles );
00138 void writeFontDecl( QDomDocument & doc, QDomElement & content );
00139
00140 void addFont( QFont const & font, bool def = false );
00141
00142 QString cellStyle( CellStyle const & cs );
00143 QString columnStyle( ColumnStyle const & cs );
00144 QString numberStyle( NumberStyle const & ns );
00145 QString rowStyle( RowStyle const & rs );
00146 QString sheetStyle( SheetStyle const & ts );
00147
00148 private:
00149 QPtrList<CellStyle> m_cellStyles;
00150 QPtrList<ColumnStyle> m_columnStyles;
00151 QPtrList<NumberStyle> m_numberStyles;
00152 QPtrList<RowStyle> m_rowStyles;
00153 QPtrList<SheetStyle> m_sheetStyles;
00154 QPtrList<QFont> m_fontList;
00155
00156 QFont m_defaultFont;
00157
00158 void addCellStyles( QDomDocument & doc, QDomElement & autoStyles );
00159 void addColumnStyles( QDomDocument & doc, QDomElement & autoStyles );
00160 void addNumberStyles( QDomDocument & doc, QDomElement & autoStyles );
00161 void addRowStyles( QDomDocument & doc, QDomElement & autoStyles );
00162 void addSheetStyles( QDomDocument & doc, QDomElement & autoStyles );
00163 };
00164
00165
00166
00167 #endif
|