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 <oox/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 0 : 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 0 : 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 0 : 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 the a:duotone element containing the colors
82 : of a bitmap duotone transformation. */
83 : class DuotoneContext : public ::oox::core::ContextHandler2
84 : {
85 : public:
86 : explicit DuotoneContext(
87 : ::oox::core::ContextHandler2Helper& rParent,
88 : const ::oox::AttributeList& rAttribs,
89 : BlipFillProperties& rBlipProps );
90 : virtual ~DuotoneContext();
91 :
92 : virtual ::oox::core::ContextHandlerRef
93 : onCreateContext(
94 : sal_Int32 nElement,
95 : const ::oox::AttributeList& rAttribs ) SAL_OVERRIDE;
96 :
97 : private:
98 : BlipFillProperties& mrBlipProps;
99 : int mnColorIndex;
100 : };
101 :
102 :
103 :
104 : /** Context handler that imports the a:clrChange element containing the colors
105 : of a bitmap color change transformation. */
106 : class ColorChangeContext : public ::oox::core::ContextHandler2
107 : {
108 : public:
109 : explicit ColorChangeContext(
110 : ::oox::core::ContextHandler2Helper& rParent,
111 : const ::oox::AttributeList& rAttribs,
112 : BlipFillProperties& rBlipProps );
113 : virtual ~ColorChangeContext();
114 :
115 : virtual ::oox::core::ContextHandlerRef
116 : onCreateContext(
117 : sal_Int32 nElement,
118 : const ::oox::AttributeList& rAttribs ) SAL_OVERRIDE;
119 :
120 : private:
121 : BlipFillProperties& mrBlipProps;
122 : bool mbUseAlpha;
123 : };
124 :
125 : /** Context handler that imports the a:blip element containing the fill bitmap
126 : and bitmap color transformation settings. */
127 0 : class BlipContext : public ::oox::core::ContextHandler2
128 : {
129 : public:
130 : explicit BlipContext(
131 : ::oox::core::ContextHandler2Helper& rParent,
132 : const ::oox::AttributeList& rAttribs,
133 : BlipFillProperties& rBlipProps );
134 :
135 : virtual ::oox::core::ContextHandlerRef
136 : onCreateContext(
137 : sal_Int32 nElement,
138 : const ::oox::AttributeList& rAttribs ) SAL_OVERRIDE;
139 :
140 : private:
141 : BlipFillProperties& mrBlipProps;
142 : };
143 :
144 : /** Context handler that imports the a:blipFill element. */
145 0 : class BlipFillContext : public ::oox::core::ContextHandler2
146 : {
147 : public:
148 : explicit BlipFillContext(
149 : ::oox::core::ContextHandler2Helper& rParent,
150 : const ::oox::AttributeList& rAttribs,
151 : BlipFillProperties& rBlipProps );
152 :
153 : virtual ::oox::core::ContextHandlerRef
154 : onCreateContext(
155 : sal_Int32 nElement,
156 : const ::oox::AttributeList& rAttribs ) SAL_OVERRIDE;
157 :
158 : private:
159 : BlipFillProperties& mrBlipProps;
160 : };
161 :
162 : /** Context handler for elements that contain a fill property element
163 : (a:noFill, a:solidFill, a:gradFill, a:pattFill, a:blipFill, a:grpFill). */
164 0 : class FillPropertiesContext : public ::oox::core::ContextHandler2
165 : {
166 : public:
167 : explicit FillPropertiesContext(
168 : ::oox::core::ContextHandler2Helper& rParent,
169 : FillProperties& rFillProps );
170 :
171 : virtual ::oox::core::ContextHandlerRef
172 : onCreateContext(
173 : sal_Int32 nElement,
174 : const ::oox::AttributeList& rAttribs ) SAL_OVERRIDE;
175 :
176 : static ::oox::core::ContextHandlerRef
177 : createFillContext(
178 : ::oox::core::ContextHandler2Helper& rParent,
179 : sal_Int32 nElement,
180 : const ::oox::AttributeList& rAttribs,
181 : FillProperties& rFillProps );
182 :
183 : protected:
184 : FillProperties& mrFillProps;
185 : };
186 :
187 : /** Context handler for elements that contain a fill property element
188 : (a:noFill, a:solidFill, a:gradFill, a:pattFill, a:blipFill, a:grpFill).
189 :
190 : This context handler takes a simple color instead of a fill properties
191 : struct. The imported fill properties are converted automatically to the
192 : best fitting solid color.
193 : */
194 : class SimpleFillPropertiesContext : private FillProperties, public FillPropertiesContext
195 : {
196 : public:
197 : explicit SimpleFillPropertiesContext(
198 : ::oox::core::ContextHandler2Helper& rParent,
199 : Color& rColor );
200 : virtual ~SimpleFillPropertiesContext();
201 :
202 : protected:
203 : Color& mrColor;
204 : };
205 :
206 : } // namespace drawingml
207 : } // namespace oox
208 :
209 : #endif
210 :
211 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|