VSDStyles.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /*
00003  * This file is part of the libvisio project.
00004  *
00005  * This Source Code Form is subject to the terms of the Mozilla Public
00006  * License, v. 2.0. If a copy of the MPL was not distributed with this
00007  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
00008  */
00009 
00010 #ifndef __VSDSTYLES_H__
00011 #define __VSDSTYLES_H__
00012 
00013 #include <map>
00014 #include <vector>
00015 #include <boost/optional.hpp>
00016 #include "VSDTypes.h"
00017 
00018 namespace libvisio
00019 {
00020 
00021 struct VSDOptionalThemeReference
00022 {
00023   VSDOptionalThemeReference() :
00024     qsLineColour(), qsFillColour(), qsShadowColour(), qsFontColour() {}
00025   VSDOptionalThemeReference(const boost::optional<long> &lineColour, const boost::optional<long> &fillColour,
00026                             const boost::optional<long> &shadowColour, const boost::optional<long> &fontColour) :
00027     qsLineColour(lineColour), qsFillColour(fillColour), qsShadowColour(shadowColour), qsFontColour(fontColour) {}
00028   VSDOptionalThemeReference(const VSDOptionalThemeReference &themeRef) :
00029     qsLineColour(themeRef.qsLineColour), qsFillColour(themeRef.qsFillColour),
00030     qsShadowColour(themeRef.qsShadowColour), qsFontColour(themeRef.qsFontColour) {}
00031   ~VSDOptionalThemeReference() {}
00032   void override(const VSDOptionalThemeReference &themeRef)
00033   {
00034     ASSIGN_OPTIONAL(themeRef.qsLineColour, qsLineColour);
00035     ASSIGN_OPTIONAL(themeRef.qsFillColour, qsFillColour);
00036     ASSIGN_OPTIONAL(themeRef.qsShadowColour, qsShadowColour);
00037     ASSIGN_OPTIONAL(themeRef.qsFontColour, qsFontColour);
00038   }
00039 
00040   boost::optional<long> qsLineColour;
00041   boost::optional<long> qsFillColour;
00042   boost::optional<long> qsShadowColour;
00043   boost::optional<long> qsFontColour;
00044 };
00045 
00046 struct VSDThemeReference
00047 {
00048   VSDThemeReference() :
00049     qsLineColour(-1), qsFillColour(-1), qsShadowColour(-1), qsFontColour(-1) {}
00050   VSDThemeReference(long lineColour, long fillColour, long shadowColour, long fontColour) :
00051     qsLineColour(lineColour), qsFillColour(fillColour), qsShadowColour(shadowColour), qsFontColour(fontColour) {}
00052   VSDThemeReference(const VSDThemeReference &themeRef) :
00053     qsLineColour(themeRef.qsLineColour), qsFillColour(themeRef.qsFillColour),
00054     qsShadowColour(themeRef.qsShadowColour), qsFontColour(themeRef.qsFontColour) {}
00055   ~VSDThemeReference() {}
00056   void override(const VSDOptionalThemeReference &themeRef)
00057   {
00058     ASSIGN_OPTIONAL(themeRef.qsLineColour, qsLineColour);
00059     ASSIGN_OPTIONAL(themeRef.qsFillColour, qsFillColour);
00060     ASSIGN_OPTIONAL(themeRef.qsShadowColour, qsShadowColour);
00061     ASSIGN_OPTIONAL(themeRef.qsFontColour, qsFontColour);
00062   }
00063 
00064   long qsLineColour;
00065   long qsFillColour;
00066   long qsShadowColour;
00067   long qsFontColour;
00068 };
00069 
00070 struct VSDOptionalLineStyle
00071 {
00072   VSDOptionalLineStyle() :
00073     width(), colour(), pattern(), startMarker(), endMarker(), cap() {}
00074   VSDOptionalLineStyle(const boost::optional<double> &w, const boost::optional<Colour> &col,
00075                        const boost::optional<unsigned char> &p, const boost::optional<unsigned char> &sm,
00076                        const boost::optional<unsigned char> &em, const boost::optional<unsigned char> &c) :
00077     width(w), colour(col), pattern(p), startMarker(sm), endMarker(em), cap(c) {}
00078   VSDOptionalLineStyle(const VSDOptionalLineStyle &style) :
00079     width(style.width), colour(style.colour), pattern(style.pattern), startMarker(style.startMarker),
00080     endMarker(style.endMarker), cap(style.cap) {}
00081   ~VSDOptionalLineStyle() {}
00082   void override(const VSDOptionalLineStyle &style)
00083   {
00084     ASSIGN_OPTIONAL(style.width, width);
00085     ASSIGN_OPTIONAL(style.colour, colour);
00086     ASSIGN_OPTIONAL(style.pattern, pattern);
00087     ASSIGN_OPTIONAL(style.startMarker, startMarker);
00088     ASSIGN_OPTIONAL(style.endMarker, endMarker);
00089     ASSIGN_OPTIONAL(style.cap, cap);
00090   }
00091 
00092   boost::optional<double> width;
00093   boost::optional<Colour> colour;
00094   boost::optional<unsigned char> pattern;
00095   boost::optional<unsigned char> startMarker;
00096   boost::optional<unsigned char> endMarker;
00097   boost::optional<unsigned char> cap;
00098 };
00099 
00100 struct VSDLineStyle
00101 {
00102   VSDLineStyle() :
00103     width(0.01), colour(), pattern(1), startMarker(0), endMarker(0), cap(0) {}
00104   VSDLineStyle(double w, Colour col, unsigned char p, unsigned char sm,
00105                unsigned char em, unsigned char c) :
00106     width(w), colour(col), pattern(p), startMarker(sm), endMarker(em), cap(c) {}
00107   VSDLineStyle(const VSDLineStyle &style) :
00108     width(style.width), colour(style.colour), pattern(style.pattern), startMarker(style.startMarker),
00109     endMarker(style.endMarker), cap(style.cap) {}
00110   ~VSDLineStyle() {}
00111   void override(const VSDOptionalLineStyle &style)
00112   {
00113     ASSIGN_OPTIONAL(style.width, width);
00114     ASSIGN_OPTIONAL(style.colour, colour);
00115     ASSIGN_OPTIONAL(style.pattern, pattern);
00116     ASSIGN_OPTIONAL(style.startMarker, startMarker);
00117     ASSIGN_OPTIONAL(style.endMarker, endMarker);
00118     ASSIGN_OPTIONAL(style.cap, cap);
00119   }
00120 
00121   double width;
00122   Colour colour;
00123   unsigned char pattern;
00124   unsigned char startMarker;
00125   unsigned char endMarker;
00126   unsigned char cap;
00127 };
00128 
00129 struct VSDOptionalFillStyle
00130 {
00131   VSDOptionalFillStyle() :
00132     fgColour(), bgColour(), pattern(), fgTransparency(), bgTransparency(), shadowFgColour(),
00133     shadowPattern(), shadowOffsetX(), shadowOffsetY() {}
00134   VSDOptionalFillStyle(const boost::optional<Colour> &fgc, const boost::optional<Colour> &bgc,
00135                        const boost::optional<unsigned char> &p, const boost::optional<double> &fga,
00136                        const boost::optional<double> &bga, const boost::optional<Colour> &sfgc,
00137                        const boost::optional<unsigned char> &shp, const boost::optional<double> &shX,
00138                        const boost::optional<double> &shY) :
00139     fgColour(fgc), bgColour(bgc), pattern(p), fgTransparency(fga), bgTransparency(bga),
00140     shadowFgColour(sfgc), shadowPattern(shp), shadowOffsetX(shX), shadowOffsetY(shY) {}
00141   VSDOptionalFillStyle(const VSDOptionalFillStyle &style) :
00142     fgColour(style.fgColour), bgColour(style.bgColour), pattern(style.pattern), fgTransparency(style.fgTransparency),
00143     bgTransparency(style.bgTransparency), shadowFgColour(style.shadowFgColour), shadowPattern(style.shadowPattern),
00144     shadowOffsetX(style.shadowOffsetX), shadowOffsetY(style.shadowOffsetY) {}
00145   ~VSDOptionalFillStyle() {}
00146   void override(const VSDOptionalFillStyle &style)
00147   {
00148     ASSIGN_OPTIONAL(style.fgColour, fgColour);
00149     ASSIGN_OPTIONAL(style.bgColour, bgColour);
00150     ASSIGN_OPTIONAL(style.pattern, pattern);
00151     ASSIGN_OPTIONAL(style.fgTransparency, fgTransparency);
00152     ASSIGN_OPTIONAL(style.bgTransparency, bgTransparency);
00153     ASSIGN_OPTIONAL(style.shadowFgColour, shadowFgColour);
00154     ASSIGN_OPTIONAL(style.shadowPattern, shadowPattern);
00155     ASSIGN_OPTIONAL(style.shadowOffsetX, shadowOffsetX);
00156     ASSIGN_OPTIONAL(style.shadowOffsetY, shadowOffsetY);
00157   }
00158 
00159   boost::optional<Colour> fgColour;
00160   boost::optional<Colour> bgColour;
00161   boost::optional<unsigned char> pattern;
00162   boost::optional<double> fgTransparency;
00163   boost::optional<double> bgTransparency;
00164   boost::optional<Colour> shadowFgColour;
00165   boost::optional<unsigned char> shadowPattern;
00166   boost::optional<double> shadowOffsetX;
00167   boost::optional<double> shadowOffsetY;
00168 };
00169 
00170 struct VSDFillStyle
00171 {
00172   VSDFillStyle()
00173     : fgColour(), bgColour(0xff, 0xff, 0xff, 0), pattern(0), fgTransparency(0), bgTransparency(0), shadowFgColour(),
00174       shadowPattern(0), shadowOffsetX(0), shadowOffsetY(0) {}
00175   VSDFillStyle(const Colour &fgc, const Colour &bgc, unsigned char p, double fga, double bga, const Colour &sfgc,
00176                unsigned char shp, double shX, double shY)
00177     : fgColour(fgc), bgColour(bgc), pattern(p), fgTransparency(fga), bgTransparency(bga),
00178       shadowFgColour(sfgc), shadowPattern(shp), shadowOffsetX(shX), shadowOffsetY(shY) {}
00179   VSDFillStyle(const VSDFillStyle &style) :
00180     fgColour(style.fgColour), bgColour(style.bgColour), pattern(style.pattern), fgTransparency(style.fgTransparency),
00181     bgTransparency(style.bgTransparency), shadowFgColour(style.shadowFgColour), shadowPattern(style.shadowPattern),
00182     shadowOffsetX(style.shadowOffsetX), shadowOffsetY(style.shadowOffsetY) {}
00183   ~VSDFillStyle() {}
00184   void override(const VSDOptionalFillStyle &style)
00185   {
00186     ASSIGN_OPTIONAL(style.fgColour, fgColour);
00187     ASSIGN_OPTIONAL(style.bgColour, bgColour);
00188     ASSIGN_OPTIONAL(style.pattern, pattern);
00189     ASSIGN_OPTIONAL(style.fgTransparency, fgTransparency);
00190     ASSIGN_OPTIONAL(style.bgTransparency, bgTransparency);
00191     ASSIGN_OPTIONAL(style.shadowFgColour, shadowFgColour);
00192     ASSIGN_OPTIONAL(style.shadowPattern, shadowPattern);
00193     ASSIGN_OPTIONAL(style.shadowOffsetX, shadowOffsetX);
00194     ASSIGN_OPTIONAL(style.shadowOffsetY, shadowOffsetY);
00195   }
00196 
00197   Colour fgColour;
00198   Colour bgColour;
00199   unsigned char pattern;
00200   double fgTransparency;
00201   double bgTransparency;
00202   Colour shadowFgColour;
00203   unsigned char shadowPattern;
00204   double shadowOffsetX;
00205   double shadowOffsetY;
00206 };
00207 
00208 struct VSDOptionalCharStyle
00209 {
00210   VSDOptionalCharStyle()
00211     : charCount(0), font(), colour(), size(), bold(), italic(), underline(), doubleunderline(), strikeout(),
00212       doublestrikeout(), allcaps(), initcaps(), smallcaps(), superscript(), subscript() {}
00213   VSDOptionalCharStyle(unsigned cc, const boost::optional<VSDName> &ft,
00214                        const boost::optional<Colour> &c, const boost::optional<double> &s, const boost::optional<bool> &b,
00215                        const boost::optional<bool> &i, const boost::optional<bool> &u, const boost::optional<bool> &du,
00216                        const boost::optional<bool> &so, const boost::optional<bool> &dso, const boost::optional<bool> &ac,
00217                        const boost::optional<bool> &ic, const boost::optional<bool> &sc, const boost::optional<bool> &super,
00218                        const boost::optional<bool> &sub) :
00219     charCount(cc), font(ft), colour(c), size(s), bold(b), italic(i), underline(u), doubleunderline(du),
00220     strikeout(so), doublestrikeout(dso), allcaps(ac), initcaps(ic), smallcaps(sc), superscript(super),
00221     subscript(sub) {}
00222   VSDOptionalCharStyle(const VSDOptionalCharStyle &style) :
00223     charCount(style.charCount), font(style.font), colour(style.colour), size(style.size), bold(style.bold),
00224     italic(style.italic), underline(style.underline), doubleunderline(style.doubleunderline), strikeout(style.strikeout),
00225     doublestrikeout(style.doublestrikeout), allcaps(style.allcaps), initcaps(style.initcaps), smallcaps(style.smallcaps),
00226     superscript(style.superscript), subscript(style.subscript) {}
00227   ~VSDOptionalCharStyle() {}
00228   void override(const VSDOptionalCharStyle &style)
00229   {
00230     ASSIGN_OPTIONAL(style.font, font);
00231     ASSIGN_OPTIONAL(style.colour, colour);
00232     ASSIGN_OPTIONAL(style.size, size);
00233     ASSIGN_OPTIONAL(style.bold, bold);
00234     ASSIGN_OPTIONAL(style.italic, italic);
00235     ASSIGN_OPTIONAL(style.underline, underline);
00236     ASSIGN_OPTIONAL(style.doubleunderline, doubleunderline);
00237     ASSIGN_OPTIONAL(style.strikeout, strikeout);
00238     ASSIGN_OPTIONAL(style.doublestrikeout, doublestrikeout);
00239     ASSIGN_OPTIONAL(style.allcaps, allcaps);
00240     ASSIGN_OPTIONAL(style.initcaps, initcaps);
00241     ASSIGN_OPTIONAL(style.smallcaps, smallcaps);
00242     ASSIGN_OPTIONAL(style.superscript, superscript);
00243     ASSIGN_OPTIONAL(style.subscript, subscript);
00244   }
00245 
00246   unsigned charCount;
00247   boost::optional<VSDName> font;
00248   boost::optional<Colour> colour;
00249   boost::optional<double> size;
00250   boost::optional<bool> bold;
00251   boost::optional<bool> italic;
00252   boost::optional<bool> underline;
00253   boost::optional<bool> doubleunderline;
00254   boost::optional<bool> strikeout;
00255   boost::optional<bool> doublestrikeout;
00256   boost::optional<bool> allcaps;
00257   boost::optional<bool> initcaps;
00258   boost::optional<bool> smallcaps;
00259   boost::optional<bool> superscript;
00260   boost::optional<bool> subscript;
00261 };
00262 
00263 struct VSDCharStyle
00264 {
00265   VSDCharStyle()
00266     : charCount(0), font(), colour(), size(12.0/72.0), bold(false), italic(false), underline(false),
00267       doubleunderline(false), strikeout(false), doublestrikeout(false), allcaps(false), initcaps(false),
00268       smallcaps(false), superscript(false), subscript(false) {}
00269   VSDCharStyle(unsigned cc, const VSDName &ft, const Colour &c, double s, bool b, bool i, bool u, bool du,
00270                bool so, bool dso, bool ac, bool ic, bool sc, bool super, bool sub) :
00271     charCount(cc), font(ft), colour(c), size(s), bold(b), italic(i), underline(u), doubleunderline(du),
00272     strikeout(so), doublestrikeout(dso), allcaps(ac), initcaps(ic), smallcaps(sc), superscript(super),
00273     subscript(sub) {}
00274   VSDCharStyle(const VSDCharStyle &style) :
00275     charCount(style.charCount), font(style.font), colour(style.colour), size(style.size), bold(style.bold),
00276     italic(style.italic), underline(style.underline), doubleunderline(style.doubleunderline), strikeout(style.strikeout),
00277     doublestrikeout(style.doublestrikeout), allcaps(style.allcaps), initcaps(style.initcaps), smallcaps(style.smallcaps),
00278     superscript(style.superscript), subscript(style.subscript) {}
00279   ~VSDCharStyle() {}
00280   void override(const VSDOptionalCharStyle &style)
00281   {
00282     ASSIGN_OPTIONAL(style.font, font);
00283     ASSIGN_OPTIONAL(style.colour, colour);
00284     ASSIGN_OPTIONAL(style.size, size);
00285     ASSIGN_OPTIONAL(style.bold, bold);
00286     ASSIGN_OPTIONAL(style.italic, italic);
00287     ASSIGN_OPTIONAL(style.underline, underline);
00288     ASSIGN_OPTIONAL(style.doubleunderline, doubleunderline);
00289     ASSIGN_OPTIONAL(style.strikeout, strikeout);
00290     ASSIGN_OPTIONAL(style.doublestrikeout, doublestrikeout);
00291     ASSIGN_OPTIONAL(style.allcaps, allcaps);
00292     ASSIGN_OPTIONAL(style.initcaps, initcaps);
00293     ASSIGN_OPTIONAL(style.smallcaps, smallcaps);
00294     ASSIGN_OPTIONAL(style.superscript, superscript);
00295     ASSIGN_OPTIONAL(style.subscript, subscript);
00296   }
00297 
00298   unsigned charCount;
00299   VSDName font;
00300   Colour colour;
00301   double size;
00302   bool bold;
00303   bool italic;
00304   bool underline;
00305   bool doubleunderline;
00306   bool strikeout;
00307   bool doublestrikeout;
00308   bool allcaps;
00309   bool initcaps;
00310   bool smallcaps;
00311   bool superscript;
00312   bool subscript;
00313 };
00314 
00315 struct VSDOptionalParaStyle
00316 {
00317   VSDOptionalParaStyle() :
00318     charCount(0), indFirst(), indLeft(), indRight(), spLine(), spBefore(), spAfter(), align(), flags() {}
00319   VSDOptionalParaStyle(unsigned cc, const boost::optional<double> &ifst, const boost::optional<double> &il,
00320                        const boost::optional<double> &ir, const boost::optional<double> &sl, const boost::optional<double> &sb,
00321                        const boost::optional<double> &sa, const boost::optional<unsigned char> &a, const boost::optional<unsigned> &f) :
00322     charCount(cc), indFirst(ifst), indLeft(il), indRight(ir), spLine(sl), spBefore(sb), spAfter(sa), align(a), flags(f) {}
00323   VSDOptionalParaStyle(const VSDOptionalParaStyle &style) :
00324     charCount(style.charCount), indFirst(style.indFirst), indLeft(style.indLeft), indRight(style.indRight), spLine(style.spLine),
00325     spBefore(style.spBefore), spAfter(style.spAfter), align(style.align), flags(style.flags) {}
00326   ~VSDOptionalParaStyle() {}
00327   void override(const VSDOptionalParaStyle &style)
00328   {
00329     ASSIGN_OPTIONAL(style.indFirst, indFirst);
00330     ASSIGN_OPTIONAL(style.indLeft, indLeft);
00331     ASSIGN_OPTIONAL(style.indRight,indRight);
00332     ASSIGN_OPTIONAL(style.spLine, spLine);
00333     ASSIGN_OPTIONAL(style.spBefore, spBefore);
00334     ASSIGN_OPTIONAL(style.spAfter, spAfter);
00335     ASSIGN_OPTIONAL(style.align, align);
00336     ASSIGN_OPTIONAL(style.flags, flags);
00337   }
00338 
00339   unsigned charCount;
00340   boost::optional<double> indFirst;
00341   boost::optional<double> indLeft;
00342   boost::optional<double> indRight;
00343   boost::optional<double> spLine;
00344   boost::optional<double> spBefore;
00345   boost::optional<double> spAfter;
00346   boost::optional<unsigned char> align;
00347   boost::optional<unsigned> flags;
00348 };
00349 
00350 struct VSDParaStyle
00351 {
00352   VSDParaStyle() :
00353     charCount(0), indFirst(0.0), indLeft(0.0), indRight(0.0), spLine(-1.2), spBefore(0.0), spAfter(0.0), align(1), flags(0) {}
00354   VSDParaStyle(unsigned cc, double ifst, double il, double ir, double sl, double sb,
00355                double sa, unsigned char a, unsigned f) :
00356     charCount(cc), indFirst(ifst), indLeft(il), indRight(ir), spLine(sl), spBefore(sb), spAfter(sa), align(a), flags(f) {}
00357   VSDParaStyle(const VSDParaStyle &style) :
00358     charCount(style.charCount), indFirst(style.indFirst), indLeft(style.indLeft), indRight(style.indRight), spLine(style.spLine),
00359     spBefore(style.spBefore), spAfter(style.spAfter), align(style.align), flags(style.flags) {}
00360   ~VSDParaStyle() {}
00361   void override(const VSDOptionalParaStyle &style)
00362   {
00363     ASSIGN_OPTIONAL(style.indFirst, indFirst);
00364     ASSIGN_OPTIONAL(style.indLeft, indLeft);
00365     ASSIGN_OPTIONAL(style.indRight,indRight);
00366     ASSIGN_OPTIONAL(style.spLine, spLine);
00367     ASSIGN_OPTIONAL(style.spBefore, spBefore);
00368     ASSIGN_OPTIONAL(style.spAfter, spAfter);
00369     ASSIGN_OPTIONAL(style.align, align);
00370     ASSIGN_OPTIONAL(style.flags, flags);
00371   }
00372 
00373   unsigned charCount;
00374   double indFirst;
00375   double indLeft;
00376   double indRight;
00377   double spLine;
00378   double spBefore;
00379   double spAfter;
00380   unsigned char align;
00381   unsigned flags;
00382 };
00383 
00384 struct VSDOptionalTextBlockStyle
00385 {
00386   VSDOptionalTextBlockStyle() :
00387     leftMargin(), rightMargin(), topMargin(), bottomMargin(), verticalAlign(), isTextBkgndFilled(),
00388     textBkgndColour(), defaultTabStop(), textDirection() {}
00389   VSDOptionalTextBlockStyle(const boost::optional<double> &lm, const boost::optional<double> &rm,
00390                             const boost::optional<double> &tm, const boost::optional<double> &bm,
00391                             const boost::optional<unsigned char> &va, const boost::optional<bool> &isBgFilled,
00392                             const boost::optional<Colour> &bgClr, const boost::optional<double> &defTab,
00393                             const boost::optional<unsigned char> &td) :
00394     leftMargin(lm), rightMargin(rm), topMargin(tm), bottomMargin(bm), verticalAlign(va),
00395     isTextBkgndFilled(isBgFilled), textBkgndColour(bgClr), defaultTabStop(defTab), textDirection(td) {}
00396   VSDOptionalTextBlockStyle(const VSDOptionalTextBlockStyle &style) :
00397     leftMargin(style.leftMargin), rightMargin(style.rightMargin), topMargin(style.topMargin),
00398     bottomMargin(style.bottomMargin), verticalAlign(style.verticalAlign), isTextBkgndFilled(style.isTextBkgndFilled),
00399     textBkgndColour(style.textBkgndColour), defaultTabStop(style.defaultTabStop), textDirection(style.textDirection) {}
00400   ~VSDOptionalTextBlockStyle() {}
00401   void override(const VSDOptionalTextBlockStyle &style)
00402   {
00403     ASSIGN_OPTIONAL(style.leftMargin, leftMargin);
00404     ASSIGN_OPTIONAL(style.rightMargin, rightMargin);
00405     ASSIGN_OPTIONAL(style.topMargin, topMargin);
00406     ASSIGN_OPTIONAL(style.bottomMargin, bottomMargin);
00407     ASSIGN_OPTIONAL(style.verticalAlign, verticalAlign);
00408     ASSIGN_OPTIONAL(style.isTextBkgndFilled, isTextBkgndFilled);
00409     ASSIGN_OPTIONAL(style.textBkgndColour, textBkgndColour);
00410     ASSIGN_OPTIONAL(style.defaultTabStop, defaultTabStop);
00411     ASSIGN_OPTIONAL(style.textDirection, textDirection);
00412   }
00413 
00414   boost::optional<double> leftMargin;
00415   boost::optional<double> rightMargin;
00416   boost::optional<double> topMargin;
00417   boost::optional<double> bottomMargin;
00418   boost::optional<unsigned char> verticalAlign;
00419   boost::optional<bool> isTextBkgndFilled;
00420   boost::optional<Colour> textBkgndColour;
00421   boost::optional<double> defaultTabStop;
00422   boost::optional<unsigned char> textDirection;
00423 };
00424 
00425 struct VSDTextBlockStyle
00426 {
00427   VSDTextBlockStyle() :
00428     leftMargin(0.0), rightMargin(0.0), topMargin(0.0), bottomMargin(0.0), verticalAlign(1),
00429     isTextBkgndFilled(false), textBkgndColour(0xff,0xff,0xff,0), defaultTabStop(0.5), textDirection(0) {}
00430   VSDTextBlockStyle(double lm, double rm, double tm, double bm, unsigned char va,
00431                     bool isBgFilled, Colour bgClr, double defTab, unsigned char td) :
00432     leftMargin(lm), rightMargin(rm), topMargin(tm), bottomMargin(bm), verticalAlign(va),
00433     isTextBkgndFilled(isBgFilled), textBkgndColour(bgClr), defaultTabStop(defTab), textDirection(td) {}
00434   VSDTextBlockStyle(const VSDTextBlockStyle &style) :
00435     leftMargin(style.leftMargin), rightMargin(style.rightMargin), topMargin(style.topMargin),
00436     bottomMargin(style.bottomMargin), verticalAlign(style.verticalAlign), isTextBkgndFilled(style.isTextBkgndFilled),
00437     textBkgndColour(style.textBkgndColour), defaultTabStop(style.defaultTabStop), textDirection(style.textDirection) {}
00438   ~VSDTextBlockStyle() {}
00439   void override(const VSDOptionalTextBlockStyle &style)
00440   {
00441     ASSIGN_OPTIONAL(style.leftMargin, leftMargin);
00442     ASSIGN_OPTIONAL(style.rightMargin, rightMargin);
00443     ASSIGN_OPTIONAL(style.topMargin, topMargin);
00444     ASSIGN_OPTIONAL(style.bottomMargin, bottomMargin);
00445     ASSIGN_OPTIONAL(style.verticalAlign, verticalAlign);
00446     ASSIGN_OPTIONAL(style.isTextBkgndFilled, isTextBkgndFilled);
00447     ASSIGN_OPTIONAL(style.textBkgndColour, textBkgndColour);
00448     ASSIGN_OPTIONAL(style.defaultTabStop, defaultTabStop);
00449     ASSIGN_OPTIONAL(style.textDirection, textDirection);
00450   }
00451 
00452   double leftMargin;
00453   double rightMargin;
00454   double topMargin;
00455   double bottomMargin;
00456   unsigned char verticalAlign;
00457   bool isTextBkgndFilled;
00458   Colour textBkgndColour;
00459   double defaultTabStop;
00460   unsigned char textDirection;
00461 };
00462 
00463 class VSDStyles
00464 {
00465 public:
00466   VSDStyles();
00467   VSDStyles(const VSDStyles &styles);
00468   ~VSDStyles();
00469   VSDStyles &operator=(const VSDStyles &styles);
00470   void addLineStyle(unsigned lineStyleIndex, const VSDOptionalLineStyle &lineStyle);
00471   void addFillStyle(unsigned fillStyleIndex, const VSDOptionalFillStyle &fillStyle);
00472   void addTextBlockStyle(unsigned textStyleIndex, const VSDOptionalTextBlockStyle &textBlockStyle);
00473   void addCharStyle(unsigned textStyleIndex, const VSDOptionalCharStyle &charStyle);
00474   void addParaStyle(unsigned textStyleIndex, const VSDOptionalParaStyle &paraStyle);
00475   void addStyleThemeReference(unsigned styleIndex, const VSDOptionalThemeReference &themeRef);
00476 
00477   void addLineStyleMaster(unsigned lineStyleIndex, unsigned lineStyleMaster);
00478   void addFillStyleMaster(unsigned fillStyleIndex, unsigned fillStyleMaster);
00479   void addTextStyleMaster(unsigned textStyleIndex, unsigned textStyleMaster);
00480 
00481   VSDOptionalLineStyle getOptionalLineStyle(unsigned lineStyleIndex) const;
00482   VSDFillStyle getFillStyle(unsigned fillStyleIndex) const;
00483   VSDOptionalFillStyle getOptionalFillStyle(unsigned fillStyleIndex) const;
00484   VSDOptionalTextBlockStyle getOptionalTextBlockStyle(unsigned textStyleIndex) const;
00485   VSDOptionalCharStyle getOptionalCharStyle(unsigned textStyleIndex) const;
00486   VSDOptionalParaStyle getOptionalParaStyle(unsigned textStyleIndex) const;
00487   VSDOptionalThemeReference getOptionalThemeReference(unsigned styleIndex) const;
00488 
00489 private:
00490   std::map<unsigned, VSDOptionalLineStyle> m_lineStyles;
00491   std::map<unsigned, VSDOptionalFillStyle> m_fillStyles;
00492   std::map<unsigned, VSDOptionalTextBlockStyle> m_textBlockStyles;
00493   std::map<unsigned, VSDOptionalCharStyle> m_charStyles;
00494   std::map<unsigned, VSDOptionalParaStyle> m_paraStyles;
00495   std::map<unsigned, VSDOptionalThemeReference> m_themeRefs;
00496   std::map<unsigned, unsigned> m_lineStyleMasters;
00497   std::map<unsigned, unsigned> m_fillStyleMasters;
00498   std::map<unsigned, unsigned> m_textStyleMasters;
00499 };
00500 
00501 
00502 } // namespace libvisio
00503 
00504 #endif // __VSDSTYLES_H__
00505 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */