Fill.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* libmspub
3  * Version: MPL 1.1 / GPLv2+ / LGPLv2+
4  *
5  * The contents of this file are subject to the Mozilla Public License Version
6  * 1.1 (the "License"); you may not use this file except in compliance with
7  * the License or as specified alternatively below. You may obtain a copy of
8  * the License at http://www.mozilla.org/MPL/
9  *
10  * Software distributed under the License is distributed on an "AS IS" basis,
11  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12  * for the specific language governing rights and limitations under the
13  * License.
14  *
15  * Major Contributor(s):
16  * Copyright (C) 2012 Brennan Vincent <brennanv@email.arizona.edu>
17  *
18  * All Rights Reserved.
19  *
20  * For minor contributions see the git repository.
21  *
22  * Alternatively, the contents of this file may be used under the terms of
23  * either the GNU General Public License Version 2 or later (the "GPLv2+"), or
24  * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
25  * in which case the provisions of the GPLv2+ or the LGPLv2+ are applicable
26  * instead of those above.
27  */
28 
29 #ifndef __FILL_H__
30 #define __FILL_H__
31 
32 #include <cstddef>
33 
34 #include <vector>
35 
36 #include <libwpd/libwpd.h>
37 
38 #include "ColorReference.h"
39 
40 namespace libmspub
41 {
42 class MSPUBCollector;
43 class Fill
44 {
45 protected:
47 public:
48  Fill(const MSPUBCollector *owner);
49  virtual WPXPropertyListVector getProperties(WPXPropertyList *out) const = 0;
50  virtual ~Fill() { }
51 private:
52  Fill(const Fill &) : m_owner(NULL) { }
53  Fill &operator=(const Fill &);
54 };
55 
56 class ImgFill : public Fill
57 {
58 protected:
59  unsigned m_imgIndex;
60 private:
62 protected:
64 public:
65  ImgFill(unsigned imgIndex, const MSPUBCollector *owner, bool isTexture, int rotation);
66  virtual WPXPropertyListVector getProperties(WPXPropertyList *out) const;
67 private:
68  ImgFill(const ImgFill &) : Fill(NULL), m_imgIndex(0), m_isTexture(false), m_rotation(0) { }
69  ImgFill &operator=(const ImgFill &);
70 };
71 
72 class PatternFill : public ImgFill
73 {
76 public:
77  PatternFill(unsigned imgIndex, const MSPUBCollector *owner, ColorReference fg, ColorReference bg);
78  WPXPropertyListVector getProperties(WPXPropertyList *out) const;
79 private:
80  PatternFill(const PatternFill &) : ImgFill(0, NULL, true, 0), m_fg(0x08000000), m_bg(0x08000000) { }
81  PatternFill &operator=(const ImgFill &);
82 };
83 
84 class SolidFill : public Fill
85 {
87  double m_opacity;
88 public:
89  SolidFill(ColorReference color, double opacity, const MSPUBCollector *owner);
90  WPXPropertyListVector getProperties(WPXPropertyList *out) const;
91 private:
92  SolidFill(const SolidFill &) : Fill(NULL), m_color(0x08000000), m_opacity(1) { }
93  SolidFill &operator=(const SolidFill &);
94 };
95 
96 class GradientFill : public Fill
97 {
98  struct StopInfo
99  {
101  unsigned m_offsetPercent;
102  double m_opacity;
103  StopInfo(ColorReference colorReference, unsigned offsetPercent, double opacity) : m_colorReference(colorReference), m_offsetPercent(offsetPercent), m_opacity(opacity) { }
104  };
105  std::vector<StopInfo> m_stops;
106  double m_angle;
107  int m_type;
109  double m_fillTopVal;
112 public:
113  GradientFill(const MSPUBCollector *owner, double angle = 0, int type = 7);
114  void setFillCenter(double left, double top, double right, double bottom);
115  void addColor(ColorReference c, unsigned offsetPercent, double opacity);
116  void addColorReverse(ColorReference c, unsigned offsetPercent, double opacity);
117  void completeComplexFill();
118  WPXPropertyListVector getProperties(WPXPropertyList *out) const;
119 private:
122 };
123 }
124 
125 #endif /* __FILL_H__ */
126 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */

Generated for libmspub by doxygen 1.8.1.2