00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef GCCV_TEXT_TAG_H
00026 #define GCCV_TEXT_TAG_H
00027
00028 #include "structs.h"
00029 #include <gcu/macros.h>
00030 #include <goffice/utils/go-color.h>
00031 #include <pango/pango.h>
00032 #include <list>
00033 #include <string>
00034
00036 namespace gccv {
00037
00038
00039 typedef enum
00040 {
00041 Invalid,
00042 Family,
00043 Size,
00044 Style,
00045 Weight,
00046 Variant,
00047 Stretch,
00048 Underline,
00049 Strikethrough,
00050 Foreground,
00051 Background,
00052 Rise,
00053 Position,
00054 MaxTag
00055 } Tag;
00056
00057 typedef enum
00058 {
00059 TagPriorityFirst,
00060 TagPriorityLast,
00061 } TagPriority;
00062
00063 class TextTag
00064 {
00065 public:
00066 TextTag (Tag tag, TagPriority priority = TagPriorityFirst);
00067 virtual ~TextTag ();
00068
00069 virtual void Filter (PangoAttrList *l, unsigned start, unsigned end) = 0;
00070 virtual bool operator== (TextTag const& tag) = 0;
00071 virtual TextTag *Duplicate () const = 0;
00072
00073 private:
00074
00075 GCU_RO_PROP (Tag, Tag)
00076 GCU_RO_PROP (TagPriority, Priority)
00077 GCU_PROP (unsigned, StartIndex)
00078 GCU_PROP (unsigned, EndIndex)
00079 };
00080
00081 class FamilyTextTag: public TextTag
00082 {
00083 public:
00084 FamilyTextTag (std::string const &family);
00085 FamilyTextTag (char const *family);
00086 virtual ~FamilyTextTag ();
00087
00088 void Filter (PangoAttrList *l, unsigned start, unsigned end);
00089 bool operator== (TextTag const& tag);
00090 TextTag *Duplicate () const;
00091
00092 private:
00093 std::string m_Family;
00094 };
00095
00096 class SizeTextTag: public TextTag
00097 {
00098 public:
00099 SizeTextTag (double size);
00100 virtual ~SizeTextTag ();
00101
00102 void Filter (PangoAttrList *l, unsigned start, unsigned end);
00103 bool operator== (TextTag const& tag);
00104 TextTag *Duplicate () const;
00105
00106 private:
00107 double m_Size;
00108 };
00109
00110 class StyleTextTag: public TextTag
00111 {
00112 public:
00113 StyleTextTag (PangoStyle style);
00114 virtual ~StyleTextTag ();
00115
00116 void Filter (PangoAttrList *l, unsigned start, unsigned end);
00117 bool operator== (TextTag const& tag);
00118 TextTag *Duplicate () const;
00119
00120 private:
00121 PangoStyle m_Style;
00122 };
00123
00124 class WeightTextTag: public TextTag
00125 {
00126 public:
00127 WeightTextTag (PangoWeight weight);
00128 virtual ~WeightTextTag ();
00129
00130 void Filter (PangoAttrList *l, unsigned start, unsigned end);
00131 bool operator== (TextTag const& tag);
00132 TextTag *Duplicate () const;
00133
00134 private:
00135 PangoWeight m_Weight;
00136 };
00137
00138 class VariantTextTag: public TextTag
00139 {
00140 public:
00141 VariantTextTag (PangoVariant variant);
00142 virtual ~VariantTextTag ();
00143
00144 void Filter (PangoAttrList *l, unsigned start, unsigned end);
00145 bool operator== (TextTag const& tag);
00146 TextTag *Duplicate () const;
00147
00148 private:
00149 PangoVariant m_Variant;
00150 };
00151
00152 class StretchTextTag: public TextTag
00153 {
00154 public:
00155 StretchTextTag (PangoStretch stretch);
00156 virtual ~StretchTextTag ();
00157
00158 void Filter (PangoAttrList *l, unsigned start, unsigned end);
00159 bool operator== (TextTag const& tag);
00160 TextTag *Duplicate () const;
00161
00162 private:
00163 PangoStretch m_Stretch;
00164 };
00165
00166 class UnderlineTextTag: public TextTag
00167 {
00168 public:
00169 UnderlineTextTag (PangoUnderline underline);
00170 virtual ~UnderlineTextTag ();
00171
00172 void Filter (PangoAttrList *l, unsigned start, unsigned end);
00173 bool operator== (TextTag const& tag);
00174 TextTag *Duplicate () const;
00175
00176 private:
00177 PangoUnderline m_Underline;
00178 };
00179
00180 class StrikethroughTextTag: public TextTag
00181 {
00182 public:
00183 StrikethroughTextTag (bool strikethrough);
00184 virtual ~StrikethroughTextTag ();
00185
00186 void Filter (PangoAttrList *l, unsigned start, unsigned end);
00187 bool operator== (TextTag const& tag);
00188 TextTag *Duplicate () const;
00189
00190 private:
00191 bool m_Strikethrough;
00192 };
00193
00194 class ForegroundTextTag: public TextTag
00195 {
00196 public:
00197 ForegroundTextTag (GOColor m_Color);
00198 virtual ~ForegroundTextTag ();
00199
00200 void Filter (PangoAttrList *l, unsigned start, unsigned end);
00201 bool operator== (TextTag const& tag);
00202 TextTag *Duplicate () const;
00203
00204 private:
00205 GOColor m_Color;
00206 };
00207
00208 class BackgroundTextTag: public TextTag
00209 {
00210 public:
00211 BackgroundTextTag (GOColor m_Color);
00212 virtual ~BackgroundTextTag ();
00213
00214 void Filter (PangoAttrList *l, unsigned start, unsigned end);
00215 bool operator== (TextTag const& tag);
00216 TextTag *Duplicate () const;
00217
00218 private:
00219 GOColor m_Color;
00220 };
00221
00222 class RiseTextTag: public TextTag
00223 {
00224 public:
00225 RiseTextTag (double size);
00226 virtual ~RiseTextTag ();
00227
00228 void Filter (PangoAttrList *l, unsigned start, unsigned end);
00229 bool operator== (TextTag const& tag);
00230 TextTag *Duplicate () const;
00231
00232 private:
00233 double m_Rise;
00234 };
00235
00236 class PositionTextTag: public TextTag
00237 {
00238 public:
00239 PositionTextTag (TextPosition position, double size, bool stacked = false);
00240 virtual ~PositionTextTag ();
00241
00242 void Filter (PangoAttrList *l, unsigned start, unsigned end);
00243 bool operator== (TextTag const& tag);
00244 TextTag *Duplicate () const;
00245
00246 private:
00247 TextPosition m_Position;
00248 double m_Size;
00249 bool m_Stacked;
00250 };
00251
00252 class TextTagList:public std::list <TextTag *>
00253 {
00254 public:
00255 TextTagList ();
00256 ~TextTagList ();
00257 };
00258
00259 }
00260
00261 #endif // GCCV_TEXT_TAG_H