Go to the documentation of this file.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
00026
00027
00028
00029 #ifndef __FILL_H__
00030 #define __FILL_H__
00031
00032 #include <cstddef>
00033
00034 #include <vector>
00035
00036 #include <libwpd/libwpd.h>
00037
00038 #include "ColorReference.h"
00039
00040 namespace libmspub
00041 {
00042 class MSPUBCollector;
00043 class Fill
00044 {
00045 protected:
00046 const MSPUBCollector *m_owner;
00047 public:
00048 Fill(const MSPUBCollector *owner);
00049 virtual WPXPropertyListVector getProperties(WPXPropertyList *out) const = 0;
00050 virtual ~Fill() { }
00051 private:
00052 Fill(const Fill &) : m_owner(NULL) { }
00053 Fill &operator=(const Fill &);
00054 };
00055
00056 class ImgFill : public Fill
00057 {
00058 protected:
00059 unsigned m_imgIndex;
00060 private:
00061 bool m_isTexture;
00062 protected:
00063 int m_rotation;
00064 public:
00065 ImgFill(unsigned imgIndex, const MSPUBCollector *owner, bool isTexture, int rotation);
00066 virtual WPXPropertyListVector getProperties(WPXPropertyList *out) const;
00067 private:
00068 ImgFill(const ImgFill &) : Fill(NULL), m_imgIndex(0), m_isTexture(false), m_rotation(0) { }
00069 ImgFill &operator=(const ImgFill &);
00070 };
00071
00072 class PatternFill : public ImgFill
00073 {
00074 ColorReference m_fg;
00075 ColorReference m_bg;
00076 public:
00077 PatternFill(unsigned imgIndex, const MSPUBCollector *owner, ColorReference fg, ColorReference bg);
00078 WPXPropertyListVector getProperties(WPXPropertyList *out) const;
00079 private:
00080 PatternFill(const PatternFill &) : ImgFill(0, NULL, true, 0), m_fg(0x08000000), m_bg(0x08000000) { }
00081 PatternFill &operator=(const ImgFill &);
00082 };
00083
00084 class SolidFill : public Fill
00085 {
00086 ColorReference m_color;
00087 double m_opacity;
00088 public:
00089 SolidFill(ColorReference color, double opacity, const MSPUBCollector *owner);
00090 WPXPropertyListVector getProperties(WPXPropertyList *out) const;
00091 private:
00092 SolidFill(const SolidFill &) : Fill(NULL), m_color(0x08000000), m_opacity(1) { }
00093 SolidFill &operator=(const SolidFill &);
00094 };
00095
00096 class GradientFill : public Fill
00097 {
00098 struct StopInfo
00099 {
00100 ColorReference m_colorReference;
00101 unsigned m_offsetPercent;
00102 double m_opacity;
00103 StopInfo(ColorReference colorReference, unsigned offsetPercent, double opacity) : m_colorReference(colorReference), m_offsetPercent(offsetPercent), m_opacity(opacity) { }
00104 };
00105 std::vector<StopInfo> m_stops;
00106 double m_angle;
00107 int m_type;
00108 double m_fillLeftVal;
00109 double m_fillTopVal;
00110 double m_fillRightVal;
00111 double m_fillBottomVal;
00112 public:
00113 GradientFill(const MSPUBCollector *owner, double angle = 0, int type = 7);
00114 void setFillCenter(double left, double top, double right, double bottom);
00115 void addColor(ColorReference c, unsigned offsetPercent, double opacity);
00116 void addColorReverse(ColorReference c, unsigned offsetPercent, double opacity);
00117 void completeComplexFill();
00118 WPXPropertyListVector getProperties(WPXPropertyList *out) const;
00119 private:
00120 GradientFill(const GradientFill &) : Fill(NULL), m_stops(), m_angle(0), m_type(7), m_fillLeftVal(0.0), m_fillTopVal(0.0), m_fillRightVal(0.0), m_fillBottomVal(0.0) { }
00121 GradientFill &operator=(const GradientFill &);
00122 };
00123 }
00124
00125 #endif
00126