- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

Fill.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /*
3 * This file is part of the libmspub project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
9
10 #ifndef __FILL_H__
11 #define __FILL_H__
12
13 #include <cstddef>
14
15 #include <vector>
16
17 #include <librevenge/librevenge.h>
18
19 #include "ColorReference.h"
20
21 namespace libmspub
22 {
23 class MSPUBCollector;
24 class Fill
25 {
26 protected:
27 const MSPUBCollector *m_owner;
28 public:
29 Fill(const MSPUBCollector *owner);
30 virtual void getProperties(librevenge::RVNGPropertyList *out) const = 0;
31 virtual ~Fill() { }
32 private:
33 Fill(const Fill &) : m_owner(NULL) { }
34 Fill &operator=(const Fill &);
35 };
36
37 class ImgFill : public Fill
38 {
39 protected:
40 unsigned m_imgIndex;
41 private:
42 bool m_isTexture;
43 protected:
44 int m_rotation;
45 public:
46 ImgFill(unsigned imgIndex, const MSPUBCollector *owner, bool isTexture, int rotation);
47 virtual void getProperties(librevenge::RVNGPropertyList *out) const;
48 private:
49 ImgFill(const ImgFill &) : Fill(NULL), m_imgIndex(0), m_isTexture(false), m_rotation(0) { }
50 ImgFill &operator=(const ImgFill &);
51 };
52
53 class PatternFill : public ImgFill
54 {
55 ColorReference m_fg;
56 ColorReference m_bg;
57 public:
58 PatternFill(unsigned imgIndex, const MSPUBCollector *owner, ColorReference fg, ColorReference bg);
59 void getProperties(librevenge::RVNGPropertyList *out) const;
60 private:
61 PatternFill(const PatternFill &) : ImgFill(0, NULL, true, 0), m_fg(0x08000000), m_bg(0x08000000) { }
62 PatternFill &operator=(const ImgFill &);
63 };
64
65 class SolidFill : public Fill
66 {
67 ColorReference m_color;
68 double m_opacity;
69 public:
70 SolidFill(ColorReference color, double opacity, const MSPUBCollector *owner);
71 void getProperties(librevenge::RVNGPropertyList *out) const;
72 private:
73 SolidFill(const SolidFill &) : Fill(NULL), m_color(0x08000000), m_opacity(1) { }
74 SolidFill &operator=(const SolidFill &);
75 };
76
77 class GradientFill : public Fill
78 {
79 struct StopInfo
80 {
81 ColorReference m_colorReference;
82 unsigned m_offsetPercent;
83 double m_opacity;
84 StopInfo(ColorReference colorReference, unsigned offsetPercent, double opacity) : m_colorReference(colorReference), m_offsetPercent(offsetPercent), m_opacity(opacity) { }
85 };
86 std::vector<StopInfo> m_stops;
87 double m_angle;
88 int m_type;
89 double m_fillLeftVal;
90 double m_fillTopVal;
91 double m_fillRightVal;
92 double m_fillBottomVal;
93 public:
94 GradientFill(const MSPUBCollector *owner, double angle = 0, int type = 7);
95 void setFillCenter(double left, double top, double right, double bottom);
96 void addColor(ColorReference c, unsigned offsetPercent, double opacity);
97 void addColorReverse(ColorReference c, unsigned offsetPercent, double opacity);
98 void completeComplexFill();
99 void getProperties(librevenge::RVNGPropertyList *out) const;
100 private:
101 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) { }
102 GradientFill &operator=(const GradientFill &);
103 };
104 }
105
106 #endif /* __FILL_H__ */
107 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libmspub::Fill::m_owner
const MSPUBCollector * m_owner
Definition: Fill.h:27
libmspub::ImgFill::ImgFill
ImgFill(const ImgFill &)
Definition: Fill.h:49
libmspub::GradientFill::m_stops
std::vector< StopInfo > m_stops
Definition: Fill.h:86
libmspub::SolidFill::SolidFill
SolidFill(const SolidFill &)
Definition: Fill.h:73
libmspub::PatternFill::getProperties
void getProperties(librevenge::RVNGPropertyList *out) const
Definition: Fill.cpp:52
libmspub::GradientFill::StopInfo::m_opacity
double m_opacity
Definition: Fill.h:83
libmspub::SolidFill::m_color
ColorReference m_color
Definition: Fill.h:67
libmspub::GradientFill::m_fillRightVal
double m_fillRightVal
Definition: Fill.h:91
ColorReference.h
libmspub::ImgFill::operator=
ImgFill & operator=(const ImgFill &)
libmspub::GradientFill::m_fillBottomVal
double m_fillBottomVal
Definition: Fill.h:92
libmspub::Fill
Definition: Fill.h:24
libmspub::GradientFill::m_type
int m_type
Definition: Fill.h:88
libmspub::GradientFill::StopInfo::StopInfo
StopInfo(ColorReference colorReference, unsigned offsetPercent, double opacity)
Definition: Fill.h:84
libmspub::PatternFill::operator=
PatternFill & operator=(const ImgFill &)
libmspub::GradientFill::operator=
GradientFill & operator=(const GradientFill &)
libmspub::GradientFill::m_angle
double m_angle
Definition: Fill.h:87
libmspub::ImgFill::getProperties
virtual void getProperties(librevenge::RVNGPropertyList *out) const
Definition: Fill.cpp:26
libmspub::ImgFill
Definition: Fill.h:37
libmspub::ImgFill::m_isTexture
bool m_isTexture
Definition: Fill.h:42
libmspub::PatternFill::PatternFill
PatternFill(const PatternFill &)
Definition: Fill.h:61
libmspub::PatternFill::m_fg
ColorReference m_fg
Definition: Fill.h:55
libmspub::PatternFill
Definition: Fill.h:53
libmspub::ColorReference
Definition: ColorReference.h:17
libmspub::GradientFill::addColorReverse
void addColorReverse(ColorReference c, unsigned offsetPercent, double opacity)
Definition: Fill.cpp:116
libmspub::GradientFill::StopInfo::m_colorReference
ColorReference m_colorReference
Definition: Fill.h:81
libmspub::Fill::~Fill
virtual ~Fill()
Definition: Fill.h:31
libmspub::GradientFill
Definition: Fill.h:77
libmspub::SolidFill::operator=
SolidFill & operator=(const SolidFill &)
libmspub::ImgFill::m_rotation
int m_rotation
Definition: Fill.h:44
libmspub::ImgFill::ImgFill
ImgFill(unsigned imgIndex, const MSPUBCollector *owner, bool isTexture, int rotation)
Definition: Fill.cpp:22
libmspub::GradientFill::addColor
void addColor(ColorReference c, unsigned offsetPercent, double opacity)
Definition: Fill.cpp:111
libmspub::GradientFill::StopInfo::m_offsetPercent
unsigned m_offsetPercent
Definition: Fill.h:82
libmspub::ImgFill::m_imgIndex
unsigned m_imgIndex
Definition: Fill.h:40
libmspub::PatternFill::m_bg
ColorReference m_bg
Definition: Fill.h:56
libmspub::GradientFill::m_fillLeftVal
double m_fillLeftVal
Definition: Fill.h:89
libmspub::Fill::Fill
Fill(const MSPUBCollector *owner)
Definition: Fill.cpp:18
libmspub::GradientFill::GradientFill
GradientFill(const MSPUBCollector *owner, double angle=0, int type=7)
Definition: Fill.cpp:99
libmspub::Fill::operator=
Fill & operator=(const Fill &)
libmspub::GradientFill::completeComplexFill
void completeComplexFill()
Definition: Fill.cpp:121
libmspub::SolidFill::SolidFill
SolidFill(ColorReference color, double opacity, const MSPUBCollector *owner)
Definition: Fill.cpp:84
libmspub::GradientFill::setFillCenter
void setFillCenter(double left, double top, double right, double bottom)
Definition: Fill.cpp:103
libmspub::MSPUBCollector
Definition: MSPUBCollector.h:46
libmspub::GradientFill::GradientFill
GradientFill(const GradientFill &)
Definition: Fill.h:101
libmspub::SolidFill
Definition: Fill.h:65
libmspub::GradientFill::m_fillTopVal
double m_fillTopVal
Definition: Fill.h:90
libmspub::SolidFill::getProperties
void getProperties(librevenge::RVNGPropertyList *out) const
Definition: Fill.cpp:88
libmspub::Fill::Fill
Fill(const Fill &)
Definition: Fill.h:33
libmspub::PatternFill::PatternFill
PatternFill(unsigned imgIndex, const MSPUBCollector *owner, ColorReference fg, ColorReference bg)
Definition: Fill.cpp:48
libmspub::Fill::getProperties
virtual void getProperties(librevenge::RVNGPropertyList *out) const =0
libmspub::GradientFill::getProperties
void getProperties(librevenge::RVNGPropertyList *out) const
Definition: Fill.cpp:131
libmspub::SolidFill::m_opacity
double m_opacity
Definition: Fill.h:68
libmspub::GradientFill::StopInfo
Definition: Fill.h:79