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 public:
00063 ImgFill(unsigned imgIndex, const MSPUBCollector *owner, bool isTexture);
00064 WPXPropertyListVector getProperties(WPXPropertyList *out) const;
00065 private:
00066 ImgFill(const ImgFill &) : Fill(NULL), m_imgIndex(0), m_isTexture(false) { }
00067 ImgFill &operator=(const ImgFill &);
00068 };
00069
00070 class PatternFill : public ImgFill
00071 {
00072 ColorReference m_fg;
00073 ColorReference m_bg;
00074 public:
00075 PatternFill(unsigned imgIndex, const MSPUBCollector *owner, ColorReference fg, ColorReference bg);
00076 WPXPropertyListVector getProperties(WPXPropertyList *out) const;
00077 private:
00078 PatternFill(const PatternFill &) : ImgFill(0, NULL, true), m_fg(0x08000000), m_bg(0x08000000) { }
00079 PatternFill &operator=(const ImgFill &);
00080 };
00081
00082 class SolidFill : public Fill
00083 {
00084 ColorReference m_color;
00085 double m_opacity;
00086 public:
00087 SolidFill(ColorReference color, double opacity, const MSPUBCollector *owner);
00088 WPXPropertyListVector getProperties(WPXPropertyList *out) const;
00089 private:
00090 SolidFill(const SolidFill &) : Fill(NULL), m_color(0x08000000), m_opacity(1) { }
00091 SolidFill &operator=(const SolidFill &);
00092 };
00093
00094 class GradientFill : public Fill
00095 {
00096 struct StopInfo
00097 {
00098 ColorReference m_colorReference;
00099 unsigned m_offsetPercent;
00100 double m_opacity;
00101 StopInfo(ColorReference colorReference, unsigned offsetPercent, double opacity) : m_colorReference(colorReference), m_offsetPercent(offsetPercent), m_opacity(opacity) { }
00102 };
00103 std::vector<StopInfo> m_stops;
00104 double m_angle;
00105 public:
00106 GradientFill(const MSPUBCollector *owner, double angle = 0);
00107 void addColor(ColorReference c, unsigned offsetPercent, double opacity);
00108 WPXPropertyListVector getProperties(WPXPropertyList *out) const;
00109 private:
00110 GradientFill(const GradientFill &) : Fill(NULL), m_stops(), m_angle(0) { }
00111 GradientFill &operator=(const GradientFill &);
00112 };
00113 }
00114
00115 #endif
00116