Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice 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 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_OOX_DRAWINGML_FILLPROPERTIESGROUPCONTEXT_HXX
21 : #define INCLUDED_OOX_DRAWINGML_FILLPROPERTIESGROUPCONTEXT_HXX
22 :
23 : #include <drawingml/colorchoicecontext.hxx>
24 : #include <oox/drawingml/fillproperties.hxx>
25 :
26 : namespace oox {
27 : namespace drawingml {
28 :
29 :
30 :
31 : /** Context handler that imports the a:solidFill element. */
32 21316 : class SolidFillContext : public ColorContext
33 : {
34 : public:
35 : explicit SolidFillContext(
36 : ::oox::core::ContextHandler2Helper& rParent,
37 : const ::oox::AttributeList& rAttribs,
38 : FillProperties& rFillProps );
39 : };
40 :
41 :
42 :
43 : /** Context handler that imports the a:gradFill element. */
44 11222 : class GradientFillContext : public ::oox::core::ContextHandler2
45 : {
46 : public:
47 : explicit GradientFillContext(
48 : ::oox::core::ContextHandler2Helper& rParent,
49 : const ::oox::AttributeList& rAttribs,
50 : GradientFillProperties& rGradientProps );
51 :
52 : virtual ::oox::core::ContextHandlerRef
53 : onCreateContext(
54 : sal_Int32 nElement,
55 : const ::oox::AttributeList& rAttribs ) SAL_OVERRIDE;
56 :
57 : private:
58 : GradientFillProperties& mrGradientProps;
59 : };
60 :
61 : /** Context handler that imports the a:pattFill element. */
62 194 : class PatternFillContext : public ::oox::core::ContextHandler2
63 : {
64 : public:
65 : explicit PatternFillContext(
66 : ::oox::core::ContextHandler2Helper& rParent,
67 : const ::oox::AttributeList& rAttribs,
68 : PatternFillProperties& rPatternProps );
69 :
70 : virtual ::oox::core::ContextHandlerRef
71 : onCreateContext(
72 : sal_Int32 nElement,
73 : const ::oox::AttributeList& rAttribs ) SAL_OVERRIDE;
74 :
75 : private:
76 : PatternFillProperties& mrPatternProps;
77 : };
78 :
79 :
80 :
81 : /** Context handler that imports a14:imgProps, a14:imgLayer, a14:imgEffect containers
82 : and the a14:artistic* effect tags defined in the MS-ODRAWXML extension. */
83 : class ArtisticEffectContext : public ::oox::core::ContextHandler2
84 : {
85 : public:
86 : explicit ArtisticEffectContext(
87 : ::oox::core::ContextHandler2Helper& rParent,
88 : ArtisticEffectProperties& rEffect );
89 : virtual ~ArtisticEffectContext();
90 :
91 : virtual ::oox::core::ContextHandlerRef
92 : onCreateContext(
93 : sal_Int32 nElement,
94 : const ::oox::AttributeList& rAttribs ) SAL_OVERRIDE;
95 :
96 : private:
97 : ArtisticEffectProperties& maEffect;
98 : };
99 :
100 :
101 :
102 : /** Context handler that imports the a:extLst element inside a:blip and its
103 : children a:ext, which can contain transformations to the bitmap. */
104 : class BlipExtensionContext : public ::oox::core::ContextHandler2
105 : {
106 : public:
107 : explicit BlipExtensionContext(
108 : ::oox::core::ContextHandler2Helper& rParent,
109 : BlipFillProperties& rBlipProps );
110 : virtual ~BlipExtensionContext();
111 :
112 : virtual ::oox::core::ContextHandlerRef
113 : onCreateContext(
114 : sal_Int32 nElement,
115 : const ::oox::AttributeList& rAttribs ) SAL_OVERRIDE;
116 :
117 : private:
118 : BlipFillProperties& mrBlipProps;
119 : };
120 :
121 :
122 :
123 : /** Context handler that imports the a:duotone element containing the colors
124 : of a bitmap duotone transformation. */
125 : class DuotoneContext : public ::oox::core::ContextHandler2
126 : {
127 : public:
128 : explicit DuotoneContext(
129 : ::oox::core::ContextHandler2Helper& rParent,
130 : const ::oox::AttributeList& rAttribs,
131 : BlipFillProperties& rBlipProps );
132 : virtual ~DuotoneContext();
133 :
134 : virtual ::oox::core::ContextHandlerRef
135 : onCreateContext(
136 : sal_Int32 nElement,
137 : const ::oox::AttributeList& rAttribs ) SAL_OVERRIDE;
138 :
139 : private:
140 : BlipFillProperties& mrBlipProps;
141 : int mnColorIndex;
142 : };
143 :
144 :
145 :
146 : /** Context handler that imports the a:clrChange element containing the colors
147 : of a bitmap color change transformation. */
148 : class ColorChangeContext : public ::oox::core::ContextHandler2
149 : {
150 : public:
151 : explicit ColorChangeContext(
152 : ::oox::core::ContextHandler2Helper& rParent,
153 : const ::oox::AttributeList& rAttribs,
154 : BlipFillProperties& rBlipProps );
155 : virtual ~ColorChangeContext();
156 :
157 : virtual ::oox::core::ContextHandlerRef
158 : onCreateContext(
159 : sal_Int32 nElement,
160 : const ::oox::AttributeList& rAttribs ) SAL_OVERRIDE;
161 :
162 : private:
163 : BlipFillProperties& mrBlipProps;
164 : bool mbUseAlpha;
165 : };
166 :
167 : /** Context handler that imports the a:blip element containing the fill bitmap
168 : and bitmap color transformation settings. */
169 894 : class BlipContext : public ::oox::core::ContextHandler2
170 : {
171 : public:
172 : explicit BlipContext(
173 : ::oox::core::ContextHandler2Helper& rParent,
174 : const ::oox::AttributeList& rAttribs,
175 : BlipFillProperties& rBlipProps );
176 :
177 : virtual ::oox::core::ContextHandlerRef
178 : onCreateContext(
179 : sal_Int32 nElement,
180 : const ::oox::AttributeList& rAttribs ) SAL_OVERRIDE;
181 :
182 : private:
183 : BlipFillProperties& mrBlipProps;
184 : };
185 :
186 : /** Context handler that imports the a:blipFill element. */
187 904 : class BlipFillContext : public ::oox::core::ContextHandler2
188 : {
189 : public:
190 : explicit BlipFillContext(
191 : ::oox::core::ContextHandler2Helper& rParent,
192 : const ::oox::AttributeList& rAttribs,
193 : BlipFillProperties& rBlipProps );
194 :
195 : virtual ::oox::core::ContextHandlerRef
196 : onCreateContext(
197 : sal_Int32 nElement,
198 : const ::oox::AttributeList& rAttribs ) SAL_OVERRIDE;
199 :
200 : private:
201 : BlipFillProperties& mrBlipProps;
202 : };
203 :
204 : /** Context handler for elements that contain a fill property element
205 : (a:noFill, a:solidFill, a:gradFill, a:pattFill, a:blipFill, a:grpFill). */
206 303 : class FillPropertiesContext : public ::oox::core::ContextHandler2
207 : {
208 : public:
209 : explicit FillPropertiesContext(
210 : ::oox::core::ContextHandler2Helper& rParent,
211 : FillProperties& rFillProps );
212 :
213 : virtual ::oox::core::ContextHandlerRef
214 : onCreateContext(
215 : sal_Int32 nElement,
216 : const ::oox::AttributeList& rAttribs ) SAL_OVERRIDE;
217 :
218 : static ::oox::core::ContextHandlerRef
219 : createFillContext(
220 : ::oox::core::ContextHandler2Helper& rParent,
221 : sal_Int32 nElement,
222 : const ::oox::AttributeList& rAttribs,
223 : FillProperties& rFillProps );
224 :
225 : protected:
226 : FillProperties& mrFillProps;
227 : };
228 :
229 : /** Context handler for elements that contain a fill property element
230 : (a:noFill, a:solidFill, a:gradFill, a:pattFill, a:blipFill, a:grpFill).
231 :
232 : This context handler takes a simple color instead of a fill properties
233 : struct. The imported fill properties are converted automatically to the
234 : best fitting solid color.
235 : */
236 : class SimpleFillPropertiesContext : private FillProperties, public FillPropertiesContext
237 : {
238 : public:
239 : explicit SimpleFillPropertiesContext(
240 : ::oox::core::ContextHandler2Helper& rParent,
241 : Color& rColor );
242 : virtual ~SimpleFillPropertiesContext();
243 :
244 : protected:
245 : Color& mrColor;
246 : };
247 :
248 : } // namespace drawingml
249 : } // namespace oox
250 :
251 : #endif
252 :
253 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|