filters

stylefactory.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2003 Percy Leonhardt
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018 */
00019 
00020 
00021 #ifndef STYLEFACTORY_H
00022 #define STYLEFACTORY_H
00023 
00024 #include <qptrlist.h>
00025 #include <qstring.h>
00026 
00027 #include <qdom.h>
00028 
00029 class StyleFactory;
00030 
00031 class StrokeDashStyle
00032 {
00033 public:
00034     StrokeDashStyle( int style );
00035     ~StrokeDashStyle() {};
00036 
00037     void toXML( QDomDocument & doc, QDomElement & e ) const;
00038     QString name() const { return m_name; };
00039 
00040 private:
00041     StrokeDashStyle() {};
00042 
00043     QString m_name, m_style, m_dots1, m_dots2, m_dots1_length, m_dots2_length,
00044         m_distance;
00045 };
00046 
00047 class GradientStyle
00048 {
00049 public:
00050     GradientStyle( QDomElement & gradient, int index );
00051     ~GradientStyle() {};
00052 
00053     void toXML( QDomDocument & doc, QDomElement & e ) const;
00054     QString name() const { return m_name; };
00055 
00056 private:
00057     GradientStyle() {};
00058 
00059     QString m_name, m_style, m_cx, m_cy, m_start_color, m_end_color,
00060         m_start_intensity, m_end_intensity, m_angle, m_border;
00061 };
00062 
00063 class MarkerStyle
00064 {
00065 public:
00066     MarkerStyle( int style );
00067     ~MarkerStyle() {};
00068 
00069     void toXML( QDomDocument & doc, QDomElement & e ) const;
00070     QString name() const { return m_name; };
00071 
00072 private:
00073     MarkerStyle() {};
00074 
00075     QString m_name, m_viewBox, m_d;
00076 };
00077 
00078 class HatchStyle
00079 {
00080 public:
00081     HatchStyle( int style, QString & color );
00082     ~HatchStyle() {};
00083 
00084     void toXML( QDomDocument & doc, QDomElement & e ) const;
00085     QString name() const { return m_name; };
00086 
00087 private:
00088     HatchStyle() {};
00089 
00090     QString m_name, m_style, m_color, m_distance, m_rotation;
00091 };
00092 
00093 class FillImageStyle
00094 {
00095 public:
00096     FillImageStyle( QString & name );
00097     ~FillImageStyle() {};
00098 
00099     void toXML( QDomDocument & doc, QDomElement & e ) const;
00100 
00101 private:
00102     FillImageStyle() {};
00103 
00104     QString m_name, m_href, m_type, m_show, m_actuate;
00105 };
00106 
00107 class PageMasterStyle
00108 {
00109 public:
00110     PageMasterStyle( QDomElement & e, const uint index );
00111     ~PageMasterStyle() {};
00112 
00113     void toXML( QDomDocument & doc, QDomElement & e ) const;
00114     bool operator==( const PageMasterStyle & pageMasterStyle ) const;
00115     QString name() const { return m_name; };
00116     QString style() const { return m_style; };
00117 
00118 private:
00119     PageMasterStyle() {};
00120 
00121     QString m_name, m_page_width, m_page_height, m_orientation, m_style;
00122     QString m_margin_top, m_margin_bottom, m_margin_left, m_margin_right;
00123 };
00124 
00125 class PageStyle
00126 {
00127 public:
00128     PageStyle( StyleFactory * styleFactory, QDomElement & e, const uint index );
00129     ~PageStyle() {};
00130 
00131     void toXML( QDomDocument & doc, QDomElement & e ) const;
00132     bool operator==( const PageStyle & pageStyle ) const;
00133     QString name() const { return m_name; };
00134 
00135 private:
00136     PageStyle() {};
00137 
00138     QString m_name, m_bg_visible, m_bg_objects_visible, m_fill, m_fill_color,
00139         m_fill_image_name, m_fill_image_width, m_fill_image_height,
00140         m_fill_image_ref_point, m_fill_gradient_name, m_repeat, m_page_effect,
00141         m_page_duration;
00142 };
00143 
00144 class TextStyle
00145 {
00146 public:
00147     TextStyle( QDomElement & e, const uint index );
00148     ~TextStyle() {};
00149 
00150     void toXML( QDomDocument & doc, QDomElement & e ) const;
00151     bool operator==( const TextStyle & textStyle ) const;
00152     QString name() const { return m_name; };
00153 
00154 private:
00155     TextStyle() {};
00156 
00157     QString m_name, m_font_size, m_font_family, m_font_family_generic,
00158         m_color, m_font_pitch, m_font_style, m_font_weight, m_text_shadow,
00159         m_text_underline, m_text_underline_color, m_text_crossing_out;
00160 };
00161 
00162 class GraphicStyle
00163 {
00164 public:
00165     GraphicStyle( StyleFactory * styleFactory, QDomElement & e, const uint index );
00166     GraphicStyle( const char * name,
00167                   const char * stroke, const char * stroke_color,
00168                   const char * stroke_width, const char * shadow,
00169                   const char * shadow_offset_x, const char * shadow_offset_y,
00170                   const char * shadow_color, const char * margin_left,
00171                   const char * margin_right, const char * margin_top,
00172                   const char * margin_bottom, const char * color,
00173                   const char * text_outline, const char * text_crossing_out,
00174                   const char * font_family, const char * font_size,
00175                   const char * font_style, const char * text_shadow,
00176                   const char * text_underline, const char * font_weight,
00177                   const char * line_height, const char * text_align,
00178                   const char * fill, const char * fill_color,
00179                   const char * enable_numbering );
00180     ~GraphicStyle() {};
00181 
00182     void toXML( QDomDocument & doc, QDomElement & e ) const;
00183     bool operator==( const GraphicStyle & graphicStyle ) const;
00184     QString name() const { return m_name; };
00185 
00186 private:
00187     GraphicStyle() {};
00188 
00189     QString m_name, m_stroke, m_stroke_color, m_stroke_width, m_shadow,
00190         m_shadow_offset_x, m_shadow_offset_y, m_shadow_color, m_margin_left,
00191         m_margin_right, m_margin_top, m_margin_bottom, m_color, m_text_outline,
00192         m_text_crossing_out, m_font_family, m_font_size, m_font_style,
00193         m_text_shadow, m_text_underline, m_font_weight, m_line_height,
00194         m_text_align, m_fill, m_fill_color, m_enable_numbering, m_stroke_dash,
00195         m_fill_hatch_name, m_marker_start, m_marker_start_width,
00196         m_marker_end, m_marker_end_width, m_fill_gradient_name, m_transparency, m_textAlignment,
00197     m_textMarginLeft, m_textMarginBottom, m_textMarginTop, m_textMarginRight;
00198 };
00199 
00200 class ParagraphStyle
00201 {
00202 public:
00203     ParagraphStyle( QDomElement & e, const uint index );
00204     ~ParagraphStyle() {};
00205 
00206     void toXML( QDomDocument & doc, QDomElement & e ) const;
00207     bool operator==( const ParagraphStyle & paragraphStyle ) const;
00208     QString name() const { return m_name; };
00209 
00210 private:
00211     ParagraphStyle() {};
00212     QString parseBorder( QDomElement e );
00213 
00214     QString m_name, m_margin_left, m_margin_right, m_text_indent, m_text_align,
00215         m_enable_numbering,  m_text_shadow,  m_margin_top, m_margin_bottom,
00216         m_border_left, m_border_right, m_border_top, m_border_bottom,
00217         m_line_height, m_line_height_at_least, m_line_spacing;
00218 };
00219 
00220 class ListStyle
00221 {
00222 public:
00223     ListStyle( QDomElement & e, const uint index );
00224     ~ListStyle() {};
00225 
00226     void toXML( QDomDocument & doc, QDomElement & e ) const;
00227     bool operator==( const ListStyle & listStyle ) const;
00228     QString name() const { return m_name; };
00229 
00230 private:
00231     ListStyle() {};
00232 
00233     typedef enum {
00234         LLS_NUMBER,
00235         LLS_BULLET
00236     } list_level_style_t;
00237 
00238     float m_min_label_width;
00239     list_level_style_t m_listLevelStyle;
00240     QString m_name, m_num_suffix, m_num_format, m_bullet_char, m_color,
00241         m_font_size, m_font_family;
00242 };
00243 
00244 class StyleFactory
00245 {
00246 public:
00247     StyleFactory();
00248     ~StyleFactory();
00249 
00250     void addOfficeStyles( QDomDocument & doc, QDomElement & styles );
00251     void addOfficeMaster( QDomDocument & doc, QDomElement & master );
00252     void addOfficeAutomatic( QDomDocument & doc, QDomElement & automatic );
00253     void addAutomaticStyles( QDomDocument & doc, QDomElement & autoStyles );
00254 
00255     QString createStrokeDashStyle( int style );
00256     QString createGradientStyle( QDomElement & gradient );
00257     QString createMarkerStyle( int style );
00258     QString createHatchStyle( int style, QString & color );
00259     QString createListStyle( QDomElement & e );
00260     QString createPageStyle( QDomElement & e );
00261     QString createTextStyle( QDomElement & e );
00262     QString createGraphicStyle( QDomElement & e );
00263     QString createParagraphStyle( QDomElement & e );
00264     QString createPageMasterStyle( QDomElement & e );
00265 
00266     static QString toCM( const QString & point );
00267 
00268 private:
00269     QPtrList<StrokeDashStyle>   m_strokeDashStyles;
00270     QPtrList<GradientStyle>     m_gradientStyles;
00271     QPtrList<HatchStyle>        m_hatchStyles;
00272     QPtrList<MarkerStyle>       m_markerStyles;
00273     QPtrList<FillImageStyle>    m_fillImageStyles;
00274     QPtrList<ListStyle>         m_listStyles;
00275     QPtrList<PageStyle>         m_pageStyles;
00276     QPtrList<TextStyle>         m_textStyles;
00277     QPtrList<GraphicStyle>      m_graphicStyles;
00278     QPtrList<ParagraphStyle>    m_paragraphStyles;
00279     QPtrList<PageMasterStyle>   m_pageMasterStyles;
00280 };
00281 
00282 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys