~ubuntu-branches/ubuntu/breezy/koffice/breezy

« back to all changes in this revision

Viewing changes to filters/kpresenter/ooimpress/stylefactory.h

  • Committer: Bazaar Package Importer
  • Author(s): Ben Burton
  • Date: 2004-05-09 11:33:00 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040509113300-vfrdadqsvjfuhn3b
Tags: 1:1.3.1-1
* New upstream bugfix release.
* Built against newer imagemagick (closes: #246623).
* Made koffice-libs/kformula recommend/depend on latex-xft-fonts, which
  provides mathematical fonts that the formula editor can use.  Also
  patched the kformula part to make these fonts the default.
* Changed kword menu hint from "WordProcessors" to "Word processors"
  (closes: #246209).
* Spellchecker configuration is now fixed (closes: #221256, #227568).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* This file is part of the KDE project
 
2
   Copyright (C) 2003 Percy Leonhardt
 
3
 
 
4
   This library is free software; you can redistribute it and/or
 
5
   modify it under the terms of the GNU Library General Public
 
6
   License as published by the Free Software Foundation; either
 
7
   version 2 of the License, or (at your option) any later version.
 
8
 
 
9
   This library is distributed in the hope that it will be useful,
 
10
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
12
   Library General Public License for more details.
 
13
 
 
14
   You should have received a copy of the GNU Library General Public License
 
15
   along with this library; see the file COPYING.LIB.  If not, write to
 
16
   the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
17
   Boston, MA 02111-1307, USA.
 
18
*/
 
19
 
 
20
 
 
21
#ifndef STYLEFACTORY_H
 
22
#define STYLEFACTORY_H
 
23
 
 
24
#include <qptrlist.h>
 
25
#include <qstring.h>
 
26
 
 
27
#include <qdom.h>
 
28
 
 
29
class StyleFactory;
 
30
 
 
31
class StrokeDashStyle
 
32
{
 
33
public:
 
34
    StrokeDashStyle( int style );
 
35
    ~StrokeDashStyle() {};
 
36
 
 
37
    void toXML( QDomDocument & doc, QDomElement & e ) const;
 
38
    QString name() const { return m_name; };
 
39
 
 
40
private:
 
41
    StrokeDashStyle() {};
 
42
 
 
43
    QString m_name, m_style, m_dots1, m_dots2, m_dots1_length, m_dots2_length,
 
44
        m_distance;
 
45
};
 
46
 
 
47
class GradientStyle
 
48
{
 
49
public:
 
50
    GradientStyle( QDomElement & gradient, int index );
 
51
    ~GradientStyle() {};
 
52
 
 
53
    void toXML( QDomDocument & doc, QDomElement & e ) const;
 
54
    QString name() const { return m_name; };
 
55
 
 
56
private:
 
57
    GradientStyle() {};
 
58
 
 
59
    QString m_name, m_style, m_cx, m_cy, m_start_color, m_end_color,
 
60
        m_start_intensity, m_end_intensity, m_angle, m_border;
 
61
};
 
62
 
 
63
class MarkerStyle
 
64
{
 
65
public:
 
66
    MarkerStyle( int style );
 
67
    ~MarkerStyle() {};
 
68
 
 
69
    void toXML( QDomDocument & doc, QDomElement & e ) const;
 
70
    QString name() const { return m_name; };
 
71
 
 
72
private:
 
73
    MarkerStyle() {};
 
74
 
 
75
    QString m_name, m_viewBox, m_d;
 
76
};
 
77
 
 
78
class HatchStyle
 
79
{
 
80
public:
 
81
    HatchStyle( int style, QString & color );
 
82
    ~HatchStyle() {};
 
83
 
 
84
    void toXML( QDomDocument & doc, QDomElement & e ) const;
 
85
    QString name() const { return m_name; };
 
86
 
 
87
private:
 
88
    HatchStyle() {};
 
89
 
 
90
    QString m_name, m_style, m_color, m_distance, m_rotation;
 
91
};
 
92
 
 
93
class FillImageStyle
 
94
{
 
95
public:
 
96
    FillImageStyle( QString & name );
 
97
    ~FillImageStyle() {};
 
98
 
 
99
    void toXML( QDomDocument & doc, QDomElement & e ) const;
 
100
 
 
101
private:
 
102
    FillImageStyle() {};
 
103
 
 
104
    QString m_name, m_href, m_type, m_show, m_actuate;
 
105
};
 
106
 
 
107
class PageMasterStyle
 
108
{
 
109
public:
 
110
    PageMasterStyle( QDomElement & e, const uint index );
 
111
    ~PageMasterStyle() {};
 
112
 
 
113
    void toXML( QDomDocument & doc, QDomElement & e ) const;
 
114
    bool operator==( const PageMasterStyle & pageMasterStyle ) const;
 
115
    QString name() const { return m_name; };
 
116
    QString style() const { return m_style; };
 
117
 
 
118
private:
 
119
    PageMasterStyle() {};
 
120
 
 
121
    QString m_name, m_page_width, m_page_height, m_orientation, m_style;
 
122
    QString m_margin_top, m_margin_bottom, m_margin_left, m_margin_right;
 
123
};
 
124
 
 
125
class PageStyle
 
126
{
 
127
public:
 
128
    PageStyle( StyleFactory * styleFactory, QDomElement & e, const uint index );
 
129
    ~PageStyle() {};
 
130
 
 
131
    void toXML( QDomDocument & doc, QDomElement & e ) const;
 
132
    bool operator==( const PageStyle & pageStyle ) const;
 
133
    QString name() const { return m_name; };
 
134
 
 
135
private:
 
136
    PageStyle() {};
 
137
 
 
138
    QString m_name, m_bg_visible, m_bg_objects_visible, m_fill, m_fill_color,
 
139
        m_fill_image_name, m_fill_image_width, m_fill_image_height,
 
140
        m_fill_image_ref_point, m_fill_gradient_name, m_repeat;
 
141
};
 
142
 
 
143
class TextStyle
 
144
{
 
145
public:
 
146
    TextStyle( QDomElement & e, const uint index );
 
147
    ~TextStyle() {};
 
148
 
 
149
    void toXML( QDomDocument & doc, QDomElement & e ) const;
 
150
    bool operator==( const TextStyle & textStyle ) const;
 
151
    QString name() const { return m_name; };
 
152
 
 
153
private:
 
154
    TextStyle() {};
 
155
 
 
156
    QString m_name, m_font_size, m_font_family, m_font_family_generic,
 
157
        m_color, m_font_pitch, m_font_style, m_font_weight, m_text_shadow,
 
158
        m_text_underline, m_text_underline_color, m_text_crossing_out;
 
159
};
 
160
 
 
161
class GraphicStyle
 
162
{
 
163
public:
 
164
    GraphicStyle( StyleFactory * styleFactory, QDomElement & e, const uint index );
 
165
    GraphicStyle( const char * name,
 
166
                  const char * stroke, const char * stroke_color,
 
167
                  const char * stroke_width, const char * shadow,
 
168
                  const char * shadow_offset_x, const char * shadow_offset_y,
 
169
                  const char * shadow_color, const char * margin_left,
 
170
                  const char * margin_right, const char * margin_top,
 
171
                  const char * margin_bottom, const char * color,
 
172
                  const char * text_outline, const char * text_crossing_out,
 
173
                  const char * font_family, const char * font_size,
 
174
                  const char * font_style, const char * text_shadow,
 
175
                  const char * text_underline, const char * font_weight,
 
176
                  const char * line_height, const char * text_align,
 
177
                  const char * fill, const char * fill_color,
 
178
                  const char * enable_numbering );
 
179
    ~GraphicStyle() {};
 
180
 
 
181
    void toXML( QDomDocument & doc, QDomElement & e ) const;
 
182
    bool operator==( const GraphicStyle & graphicStyle ) const;
 
183
    QString name() const { return m_name; };
 
184
 
 
185
private:
 
186
    GraphicStyle() {};
 
187
 
 
188
    QString m_name, m_stroke, m_stroke_color, m_stroke_width, m_shadow,
 
189
        m_shadow_offset_x, m_shadow_offset_y, m_shadow_color, m_margin_left,
 
190
        m_margin_right, m_margin_top, m_margin_bottom, m_color, m_text_outline,
 
191
        m_text_crossing_out, m_font_family, m_font_size, m_font_style,
 
192
        m_text_shadow, m_text_underline, m_font_weight, m_line_height,
 
193
        m_text_align, m_fill, m_fill_color, m_enable_numbering, m_stroke_dash,
 
194
        m_fill_hatch_name, m_marker_start, m_marker_start_width,
 
195
        m_marker_end, m_marker_end_width, m_fill_gradient_name;
 
196
};
 
197
 
 
198
class ParagraphStyle
 
199
{
 
200
public:
 
201
    ParagraphStyle( QDomElement & e, const uint index );
 
202
    ~ParagraphStyle() {};
 
203
 
 
204
    void toXML( QDomDocument & doc, QDomElement & e ) const;
 
205
    bool operator==( const ParagraphStyle & paragraphStyle ) const;
 
206
    QString name() const { return m_name; };
 
207
 
 
208
private:
 
209
    ParagraphStyle() {};
 
210
    QString parseBorder( QDomElement e );
 
211
 
 
212
    QString m_name, m_margin_left, m_margin_right, m_text_indent, m_text_align,
 
213
        m_enable_numbering,  m_text_shadow,  m_margin_top, m_margin_bottom,
 
214
        m_border_left, m_border_right, m_border_top, m_border_bottom,
 
215
        m_line_height, m_line_height_at_least, m_line_spacing;
 
216
};
 
217
 
 
218
class ListStyle
 
219
{
 
220
public:
 
221
    ListStyle( QDomElement & e, const uint index );
 
222
    ~ListStyle() {};
 
223
 
 
224
    void toXML( QDomDocument & doc, QDomElement & e ) const;
 
225
    bool operator==( const ListStyle & listStyle ) const;
 
226
    QString name() const { return m_name; };
 
227
 
 
228
private:
 
229
    ListStyle() {};
 
230
 
 
231
    typedef enum {
 
232
        LLS_NUMBER,
 
233
        LLS_BULLET
 
234
    } list_level_style_t;
 
235
 
 
236
    float m_min_label_width;
 
237
    list_level_style_t m_listLevelStyle;
 
238
    QString m_name, m_num_suffix, m_num_format, m_bullet_char, m_color,
 
239
        m_font_size, m_font_family;
 
240
};
 
241
 
 
242
class StyleFactory
 
243
{
 
244
public:
 
245
    StyleFactory();
 
246
    ~StyleFactory();
 
247
 
 
248
    void addOfficeStyles( QDomDocument & doc, QDomElement & styles );
 
249
    void addOfficeMaster( QDomDocument & doc, QDomElement & master );
 
250
    void addOfficeAutomatic( QDomDocument & doc, QDomElement & automatic );
 
251
    void addAutomaticStyles( QDomDocument & doc, QDomElement & autoStyles );
 
252
 
 
253
    QString createStrokeDashStyle( int style );
 
254
    QString createGradientStyle( QDomElement & gradient );
 
255
    QString createMarkerStyle( int style );
 
256
    QString createHatchStyle( int style, QString & color );
 
257
    QString createListStyle( QDomElement & e );
 
258
    QString createPageStyle( QDomElement & e );
 
259
    QString createTextStyle( QDomElement & e );
 
260
    QString createGraphicStyle( QDomElement & e );
 
261
    QString createParagraphStyle( QDomElement & e );
 
262
    QString createPageMasterStyle( QDomElement & e );
 
263
 
 
264
    static QString toCM( const QString & point );
 
265
 
 
266
private:
 
267
    QPtrList<StrokeDashStyle>   m_strokeDashStyles;
 
268
    QPtrList<GradientStyle>     m_gradientStyles;
 
269
    QPtrList<HatchStyle>        m_hatchStyles;
 
270
    QPtrList<MarkerStyle>       m_markerStyles;
 
271
    QPtrList<FillImageStyle>    m_fillImageStyles;
 
272
    QPtrList<ListStyle>         m_listStyles;
 
273
    QPtrList<PageStyle>         m_pageStyles;
 
274
    QPtrList<TextStyle>         m_textStyles;
 
275
    QPtrList<GraphicStyle>      m_graphicStyles;
 
276
    QPtrList<ParagraphStyle>    m_paragraphStyles;
 
277
    QPtrList<PageMasterStyle>   m_pageMasterStyles;
 
278
};
 
279
 
 
280
#endif