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