filters

textformat.h

00001 
00002 /*
00003 ** Header file for inclusion with kword_xml2latex.c
00004 **
00005 ** Copyright (C) 2000 Robert JACOLIN
00006 **
00007 ** This library is free software; you can redistribute it and/or
00008 ** modify it under the terms of the GNU Library General Public
00009 ** License as published by the Free Software Foundation; either
00010 ** version 2 of the License, or (at your option) any later version.
00011 **
00012 ** This library is distributed in the hope that it will be useful,
00013 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015 ** Library General Public License for more details.
00016 **
00017 ** To receive a copy of the GNU Library General Public License, write to the
00018 ** Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019  * Boston, MA 02110-1301, USA.
00020 **
00021 */
00022 
00023 #ifndef __KWORD_TEXTFORMAT_H__
00024 #define __KWORD_TEXTFORMAT_H__
00025 
00026 #include <qstring.h>
00027 #include <qcolor.h>
00028 #include "format.h"
00029 
00030 enum _EAlign
00031 {
00032     EA_NONE,
00033     EA_SUB,
00034     EA_SUPER
00035 };
00036 
00037 typedef enum _EAlign EAlign;
00038 
00039 enum _ETypeUnderline
00040 {
00041     UNDERLINE_NONE,
00042     UNDERLINE_SIMPLE,
00043     UNDERLINE_DOUBLE,
00044     UNDERLINE_WAVE
00045 };
00046 
00047 typedef enum _ETypeUnderline ETypeUnderline;
00048 
00049 enum _ETypeLinespacing
00050 {
00051     LINESPACING_NONE,
00052     LINESPACING_ONEANDHALF,
00053     LINESPACING_DOUBLE,
00054     LINESPACING_CUSTOM,
00055     LINESPACING_ATLEAST,
00056     LINESPACING_MULTIPLE
00057 };
00058 
00059 typedef enum _ETypeLinespacing ETypeLinespacing;
00060 
00061 /***********************************************************************/
00062 /* Class: TextFormat                                                   */
00063 /***********************************************************************/
00064 
00069 class TextFormat: public Format
00070 {
00071     QString      _police;
00072     unsigned int _size;             /* Size of the police   */
00073     unsigned int _weight;           /* bold                 */
00074     bool         _italic;
00075     ETypeUnderline _underline;
00076     bool         _strikeout;
00077     EAlign       _vertalign;
00078     QColor*      _textcolor;
00079     QColor*      _backcolor;
00080     ETypeLinespacing _linespacingType;
00081     int              _spacingValue;
00082 
00083     public:
00090         TextFormat(): _weight(0), _italic(false),
00091                 _strikeout(0)
00092         {
00093             _textcolor = 0;
00094             _backcolor = 0;
00095             _size = Config::instance()->getDefaultFontSize();
00096             setPos(0);
00097             setLength(0);
00098             setUnderlined("0");
00099         }
00100 
00101         /* 
00102          * Destructor
00103          *
00104          * The destructor must remove the list of little zones.
00105          *
00106          */
00107         virtual ~TextFormat() {}
00108 
00109         /* ==== Getters ==== */
00110         unsigned int getSize      () const { return _size;      }
00111         unsigned int getWeight    () const { return _weight;    }
00112         EAlign       getAlign     () const { return _vertalign; }
00113         int          getColorBlue () const;
00114         int          getColorGreen() const;
00115         int          getColorRed  () const;
00116         ETypeUnderline getUnderlineType() const { return _underline; }
00117 
00118         int          getBkColorBlue () const;
00119         int          getBkColorGreen() const;
00120         int          getBkColorRed  () const;
00121         
00122         bool         isItalic     () const { return (_italic    == true); }
00123         bool         isUnderlined () const { return (_underline != UNDERLINE_NONE); }
00124         bool         isStrikeout  () const { return (_strikeout == true); }
00125         bool         isColor      () const { return (_textcolor != 0);    }
00126         bool         isBkColored  () const { return (_backcolor != 0);    }
00127 
00128         /* ==== Setters ==== */
00129         void setSize       (const unsigned int t)  { _size      = t; }
00130         void setWeight     (const unsigned int w)  { _weight    = w; }
00131         void setItalic     (bool i)                { _italic    = i; }
00132         void setUnderlined (ETypeUnderline u)      { _underline = u; }
00133         void setUnderlined (QString u)
00134         {
00135             if(u == "double")
00136                 _underline = UNDERLINE_DOUBLE;
00137             else if(u == "wave")
00138                 _underline = UNDERLINE_WAVE;
00139             else if (u == "1")
00140                 _underline = UNDERLINE_SIMPLE;
00141             else
00142                 _underline = UNDERLINE_NONE;
00143         }
00144         void setStrikeout  (bool s)                { _strikeout = s; }
00145         void setPolice     (QString p)             { _police    = p; }
00146         void setAlign      (const int a)           { _vertalign = (EAlign) a; }
00147         void setColor      (const int, const int, const int);
00148         void setBkColor    (const int, const int, const int);
00149 
00150         /* ==== Helpfull functions ==== */
00151         void analyseFormat    (const QDomNode);
00152         void analyseParam     (const QDomNode);
00153         void analyseFont      (const QDomNode);
00154         void analyseItalic    (const QDomNode);
00155         void analyseUnderlined(const QDomNode);
00156         void analyseStrikeout (const QDomNode);
00157         void analyseWeight    (const QDomNode);
00158         void analyseAlign     (const QDomNode);
00159         void analyseColor     (const QDomNode);
00160         void analyseSize      (const QDomNode);
00161         void analyseBackgroundColor(const QDomNode);
00162 };
00163 
00164 #endif /* __KWORD_TEXTFORMAT_H__ */
KDE Home | KDE Accessibility Home | Description of Access Keys