Line data Source code
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:
46 : const MSPUBCollector *m_owner;
47 : public:
48 : Fill(const MSPUBCollector *owner);
49 : virtual WPXPropertyListVector getProperties(WPXPropertyList *out) const = 0;
50 0 : virtual ~Fill() { }
51 : private:
52 : Fill(const Fill &) : m_owner(NULL) { }
53 : Fill &operator=(const Fill &);
54 : };
55 :
56 0 : class ImgFill : public Fill
57 : {
58 : protected:
59 : unsigned m_imgIndex;
60 : private:
61 : bool m_isTexture;
62 : public:
63 : ImgFill(unsigned imgIndex, const MSPUBCollector *owner, bool isTexture);
64 : virtual WPXPropertyListVector getProperties(WPXPropertyList *out) const;
65 : private:
66 : ImgFill(const ImgFill &) : Fill(NULL), m_imgIndex(0), m_isTexture(false) { }
67 : ImgFill &operator=(const ImgFill &);
68 : };
69 :
70 0 : class PatternFill : public ImgFill
71 : {
72 : ColorReference m_fg;
73 : ColorReference m_bg;
74 : public:
75 : PatternFill(unsigned imgIndex, const MSPUBCollector *owner, ColorReference fg, ColorReference bg);
76 : WPXPropertyListVector getProperties(WPXPropertyList *out) const;
77 : private:
78 : PatternFill(const PatternFill &) : ImgFill(0, NULL, true), m_fg(0x08000000), m_bg(0x08000000) { }
79 : PatternFill &operator=(const ImgFill &);
80 : };
81 :
82 0 : class SolidFill : public Fill
83 : {
84 : ColorReference m_color;
85 : double m_opacity;
86 : public:
87 : SolidFill(ColorReference color, double opacity, const MSPUBCollector *owner);
88 : WPXPropertyListVector getProperties(WPXPropertyList *out) const;
89 : private:
90 : SolidFill(const SolidFill &) : Fill(NULL), m_color(0x08000000), m_opacity(1) { }
91 : SolidFill &operator=(const SolidFill &);
92 : };
93 :
94 0 : class GradientFill : public Fill
95 : {
96 : struct StopInfo
97 : {
98 : ColorReference m_colorReference;
99 : unsigned m_offsetPercent;
100 : double m_opacity;
101 0 : StopInfo(ColorReference colorReference, unsigned offsetPercent, double opacity) : m_colorReference(colorReference), m_offsetPercent(offsetPercent), m_opacity(opacity) { }
102 : };
103 : std::vector<StopInfo> m_stops;
104 : double m_angle;
105 : public:
106 : GradientFill(const MSPUBCollector *owner, double angle = 0);
107 : void addColor(ColorReference c, unsigned offsetPercent, double opacity);
108 : WPXPropertyListVector getProperties(WPXPropertyList *out) const;
109 : private:
110 : GradientFill(const GradientFill &) : Fill(NULL), m_stops(), m_angle(0) { }
111 : GradientFill &operator=(const GradientFill &);
112 : };
113 : }
114 :
115 : #endif /* __FILL_H__ */
116 : /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
|