1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
|
/* This file is part of the KDE project
Copyright (C) 2003 Norbert Andres <nandres@web.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef OPENCALCSTYLEEXPORT_H
#define OPENCALCSTYLEEXPORT_H
#include "kspread_format.h"
#include <tqcolor.h>
#include <tqfont.h>
#include <tqptrlist.h>
#include <tqstring.h>
namespace KSpread
{
class Cell;
}
class TQDomDocument;
class TQDomElement;
typedef enum T1 { Boolean, Date, Number, Percentage, Time } NumberType;
class Style
{
public:
enum breakBefore { none, automatic, page };
Style() : breakB( none ), size( 0.0 ) {}
TQString name;
uint breakB;
double size;
};
class SheetStyle
{
public:
SheetStyle() : visible( true ) {}
void copyData( SheetStyle const & ts ) { visible = ts.visible; }
static bool isEqual( SheetStyle const * const t1, SheetStyle const & t2 );
TQString name;
bool visible;
};
class NumberStyle
{
public:
NumberStyle() {}
void copyData( NumberStyle const & ts ) { type = ts.type; }
static bool isEqual( NumberStyle const * const t1, NumberStyle const & t2 );
TQString name;
NumberType type;
TQString pattern;
};
class CellStyle
{
public:
CellStyle();
void copyData( CellStyle const & ts );
static bool isEqual( CellStyle const * const t1, CellStyle const & t2 );
// all except the number style
static void loadData( CellStyle & cs, KSpread::Cell const * const cell );
TQString name;
TQFont font;
TQString numberStyle;
TQColor color;
TQColor bgColor;
double indent;
bool wrap;
bool vertical;
int angle;
bool print;
TQPen left;
TQPen right;
TQPen top;
TQPen bottom;
bool hideAll;
bool hideFormula;
bool notProtected;
KSpread::Format::Align alignX;
KSpread::Format::AlignY alignY;
};
class ColumnStyle : public Style
{
public:
ColumnStyle() : Style() {}
void copyData( ColumnStyle const & cs );
static bool isEqual( ColumnStyle const * const c1, ColumnStyle const & c2 );
};
class RowStyle : public Style
{
public:
RowStyle() : Style() {}
void copyData( RowStyle const & cs );
static bool isEqual( RowStyle const * const c1, RowStyle const & c2 );
};
class OpenCalcStyles
{
public:
OpenCalcStyles();
~OpenCalcStyles();
void writeStyles ( TQDomDocument & doc, TQDomElement & autoStyles );
void writeFontDecl( TQDomDocument & doc, TQDomElement & content );
void addFont( TQFont const & font, bool def = false );
TQString cellStyle( CellStyle const & cs );
TQString columnStyle( ColumnStyle const & cs );
TQString numberStyle( NumberStyle const & ns );
TQString rowStyle( RowStyle const & rs );
TQString sheetStyle( SheetStyle const & ts );
private:
TQPtrList<CellStyle> m_cellStyles;
TQPtrList<ColumnStyle> m_columnStyles;
TQPtrList<NumberStyle> m_numberStyles;
TQPtrList<RowStyle> m_rowStyles;
TQPtrList<SheetStyle> m_sheetStyles;
TQPtrList<TQFont> m_fontList;
TQFont m_defaultFont;
void addCellStyles( TQDomDocument & doc, TQDomElement & autoStyles );
void addColumnStyles( TQDomDocument & doc, TQDomElement & autoStyles );
void addNumberStyles( TQDomDocument & doc, TQDomElement & autoStyles );
void addRowStyles( TQDomDocument & doc, TQDomElement & autoStyles );
void addSheetStyles( TQDomDocument & doc, TQDomElement & autoStyles );
};
#endif
|