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 INCLUDED_FILL_H
11 #define INCLUDED_FILL_H
12 
13 #include <cstddef>
14 #include <vector>
15 
16 #include <librevenge/librevenge.h>
17 
18 #include "ColorReference.h"
19 
20 namespace libmspub
21 {
22 class MSPUBCollector;
23 class Fill
24 {
25 protected:
27 public:
28  Fill(const MSPUBCollector *owner);
29  virtual void getProperties(librevenge::RVNGPropertyList *out) const = 0;
30  virtual ~Fill() { }
31 private:
32  Fill(const Fill &) : m_owner(nullptr) { }
33  Fill &operator=(const Fill &);
34 };
35 
36 class ImgFill : public Fill
37 {
38 protected:
39  unsigned m_imgIndex;
40 private:
42 protected:
44 public:
45  ImgFill(unsigned imgIndex, const MSPUBCollector *owner, bool isTexture, int rotation);
46  void getProperties(librevenge::RVNGPropertyList *out) const override;
47 private:
48  ImgFill(const ImgFill &) : Fill(nullptr), m_imgIndex(0), m_isTexture(false), m_rotation(0) { }
49  ImgFill &operator=(const ImgFill &);
50 };
51 
52 class PatternFill : public ImgFill
53 {
56 public:
57  PatternFill(unsigned imgIndex, const MSPUBCollector *owner, ColorReference fg, ColorReference bg);
58  void getProperties(librevenge::RVNGPropertyList *out) const override;
59 private:
60  PatternFill(const PatternFill &) : ImgFill(0, nullptr, true, 0), m_fg(0x08000000), m_bg(0x08000000) { }
61  PatternFill &operator=(const ImgFill &);
62 };
63 
64 class SolidFill : public Fill
65 {
67  double m_opacity;
68 public:
69  SolidFill(ColorReference color, double opacity, const MSPUBCollector *owner);
70  void getProperties(librevenge::RVNGPropertyList *out) const override;
71 private:
72  SolidFill(const SolidFill &) : Fill(nullptr), m_color(0x08000000), m_opacity(1) { }
73  SolidFill &operator=(const SolidFill &);
74 };
75 
76 class GradientFill : public Fill
77 {
78  struct StopInfo
79  {
81  unsigned m_offsetPercent;
82  double m_opacity;
83  StopInfo(ColorReference colorReference, unsigned offsetPercent, double opacity) : m_colorReference(colorReference), m_offsetPercent(offsetPercent), m_opacity(opacity) { }
84  };
85  std::vector<StopInfo> m_stops;
86  double m_angle;
87  int m_type;
88  double m_fillLeftVal;
89  double m_fillTopVal;
92 public:
93  GradientFill(const MSPUBCollector *owner, double angle = 0, int type = 7);
94  void setFillCenter(double left, double top, double right, double bottom);
95  void addColor(ColorReference c, unsigned offsetPercent, double opacity);
96  void addColorReverse(ColorReference c, unsigned offsetPercent, double opacity);
97  void completeComplexFill();
98  void getProperties(librevenge::RVNGPropertyList *out) const override;
99 private:
100  GradientFill(const GradientFill &) : Fill(nullptr), 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 };
103 }
104 
105 #endif /* INCLUDED_FILL_H */
106 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
const MSPUBCollector * m_owner
Definition: Fill.h:26
ImgFill(const ImgFill &)
Definition: Fill.h:48
std::vector< StopInfo > m_stops
Definition: Fill.h:85
SolidFill(const SolidFill &)
Definition: Fill.h:72
double m_opacity
Definition: Fill.h:82
ColorReference m_color
Definition: Fill.h:66
double m_fillRightVal
Definition: Fill.h:90
double m_fillBottomVal
Definition: Fill.h:91
Definition: Fill.h:23
int m_type
Definition: Fill.h:87
StopInfo(ColorReference colorReference, unsigned offsetPercent, double opacity)
Definition: Fill.h:83
double m_angle
Definition: Fill.h:86
Definition: Fill.h:36
bool m_isTexture
Definition: Fill.h:41
PatternFill(const PatternFill &)
Definition: Fill.h:60
ColorReference m_fg
Definition: Fill.h:54
Definition: Fill.h:52
Definition: ColorReference.h:17
ColorReference m_colorReference
Definition: Fill.h:80
virtual ~Fill()
Definition: Fill.h:30
Definition: Fill.h:76
int m_rotation
Definition: Fill.h:43
unsigned m_offsetPercent
Definition: Fill.h:81
unsigned m_imgIndex
Definition: Fill.h:39
ColorReference m_bg
Definition: Fill.h:55
double m_fillLeftVal
Definition: Fill.h:88
Fill(const MSPUBCollector *owner)
Definition: Fill.cpp:19
Definition: Arrow.h:13
Fill & operator=(const Fill &)
Definition: MSPUBCollector.h:43
GradientFill(const GradientFill &)
Definition: Fill.h:100
Definition: Fill.h:64
double m_fillTopVal
Definition: Fill.h:89
Fill(const Fill &)
Definition: Fill.h:32
virtual void getProperties(librevenge::RVNGPropertyList *out) const =0
double m_opacity
Definition: Fill.h:67

Generated for libmspub by doxygen 1.8.13