Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / oox / inc / drawingml / misccontexts.hxx
blob3aabbd15b54eca969111479da28937b775499bfc
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_OOX_DRAWINGML_MISCCONTEXTS_HXX
21 #define INCLUDED_OOX_DRAWINGML_MISCCONTEXTS_HXX
23 #include <drawingml/colorchoicecontext.hxx>
25 #include <drawingml/fillproperties.hxx>
27 namespace oox {
28 namespace drawingml {
31 /** Context handler that imports the a:solidFill element. */
32 class SolidFillContext : public ColorContext
34 public:
35 explicit SolidFillContext(
36 ::oox::core::ContextHandler2Helper const & rParent,
37 FillProperties& rFillProps );
41 /** Context handler that imports the a:gradFill element. */
42 class GradientFillContext : public ::oox::core::ContextHandler2
44 public:
45 explicit GradientFillContext(
46 ::oox::core::ContextHandler2Helper const & rParent,
47 const ::oox::AttributeList& rAttribs,
48 GradientFillProperties& rGradientProps );
50 virtual ::oox::core::ContextHandlerRef
51 onCreateContext(
52 sal_Int32 nElement,
53 const ::oox::AttributeList& rAttribs ) override;
55 private:
56 GradientFillProperties& mrGradientProps;
59 /** Context handler that imports the a:pattFill element. */
60 class PatternFillContext : public ::oox::core::ContextHandler2
62 public:
63 explicit PatternFillContext(
64 ::oox::core::ContextHandler2Helper const & rParent,
65 const ::oox::AttributeList& rAttribs,
66 PatternFillProperties& rPatternProps );
68 virtual ::oox::core::ContextHandlerRef
69 onCreateContext(
70 sal_Int32 nElement,
71 const ::oox::AttributeList& rAttribs ) override;
73 private:
74 PatternFillProperties& mrPatternProps;
78 /** Context handler that imports a14:imgProps, a14:imgLayer, a14:imgEffect containers
79 and the a14:artistic* effect tags defined in the MS-ODRAWXML extension. */
80 class ArtisticEffectContext : public ::oox::core::ContextHandler2
82 public:
83 explicit ArtisticEffectContext(
84 ::oox::core::ContextHandler2Helper const & rParent,
85 ArtisticEffectProperties& rEffect );
86 virtual ~ArtisticEffectContext() override;
88 virtual ::oox::core::ContextHandlerRef
89 onCreateContext(
90 sal_Int32 nElement,
91 const ::oox::AttributeList& rAttribs ) override;
93 private:
94 ArtisticEffectProperties& maEffect;
98 /** Context handler that imports the a:extLst element inside a:blip and its
99 children a:ext, which can contain transformations to the bitmap. */
100 class BlipExtensionContext : public ::oox::core::ContextHandler2
102 public:
103 explicit BlipExtensionContext(
104 ::oox::core::ContextHandler2Helper const & rParent,
105 BlipFillProperties& rBlipProps );
106 virtual ~BlipExtensionContext() override;
108 virtual ::oox::core::ContextHandlerRef
109 onCreateContext(
110 sal_Int32 nElement,
111 const ::oox::AttributeList& rAttribs ) override;
113 private:
114 BlipFillProperties& mrBlipProps;
118 /** Context handler that imports the a:duotone element containing the colors
119 of a bitmap duotone transformation. */
120 class DuotoneContext : public ::oox::core::ContextHandler2
122 public:
123 explicit DuotoneContext(
124 ::oox::core::ContextHandler2Helper const & rParent,
125 BlipFillProperties& rBlipProps );
126 virtual ~DuotoneContext() override;
128 virtual ::oox::core::ContextHandlerRef
129 onCreateContext(
130 sal_Int32 nElement,
131 const ::oox::AttributeList& rAttribs ) override;
133 private:
134 BlipFillProperties& mrBlipProps;
135 int mnColorIndex;
139 /** Context handler that imports the a:clrChange element containing the colors
140 of a bitmap color change transformation. */
141 class ColorChangeContext : public ::oox::core::ContextHandler2
143 public:
144 explicit ColorChangeContext(
145 ::oox::core::ContextHandler2Helper const & rParent,
146 const ::oox::AttributeList& rAttribs,
147 BlipFillProperties& rBlipProps );
148 virtual ~ColorChangeContext() override;
150 virtual ::oox::core::ContextHandlerRef
151 onCreateContext(
152 sal_Int32 nElement,
153 const ::oox::AttributeList& rAttribs ) override;
155 private:
156 BlipFillProperties& mrBlipProps;
157 bool mbUseAlpha;
160 /** Context handler that imports the a:blip element containing the fill bitmap
161 and bitmap color transformation settings. */
162 class BlipContext : public ::oox::core::ContextHandler2
164 public:
165 explicit BlipContext(
166 ::oox::core::ContextHandler2Helper const & rParent,
167 const ::oox::AttributeList& rAttribs,
168 BlipFillProperties& rBlipProps );
170 virtual ::oox::core::ContextHandlerRef
171 onCreateContext(
172 sal_Int32 nElement,
173 const ::oox::AttributeList& rAttribs ) override;
175 private:
176 BlipFillProperties& mrBlipProps;
179 /** Context handler that imports the a:blipFill element. */
180 class BlipFillContext : public ::oox::core::ContextHandler2
182 public:
183 explicit BlipFillContext(
184 ::oox::core::ContextHandler2Helper const & rParent,
185 const ::oox::AttributeList& rAttribs,
186 BlipFillProperties& rBlipProps );
188 virtual ::oox::core::ContextHandlerRef
189 onCreateContext(
190 sal_Int32 nElement,
191 const ::oox::AttributeList& rAttribs ) override;
193 private:
194 BlipFillProperties& mrBlipProps;
197 /** Context handler for elements that contain a fill property element
198 (a:noFill, a:solidFill, a:gradFill, a:pattFill, a:blipFill, a:grpFill). */
199 class FillPropertiesContext : public ::oox::core::ContextHandler2
201 public:
202 explicit FillPropertiesContext(
203 ::oox::core::ContextHandler2Helper const & rParent,
204 FillProperties& rFillProps );
206 virtual ::oox::core::ContextHandlerRef
207 onCreateContext(
208 sal_Int32 nElement,
209 const ::oox::AttributeList& rAttribs ) override;
211 static ::oox::core::ContextHandlerRef
212 createFillContext(
213 ::oox::core::ContextHandler2Helper const & rParent,
214 sal_Int32 nElement,
215 const ::oox::AttributeList& rAttribs,
216 FillProperties& rFillProps );
218 private:
219 FillProperties& mrFillProps;
222 /** Context handler for elements that contain a fill property element
223 (a:noFill, a:solidFill, a:gradFill, a:pattFill, a:blipFill, a:grpFill).
225 This context handler takes a simple color instead of a fill properties
226 struct. The imported fill properties are converted automatically to the
227 best fitting solid color.
229 class SimpleFillPropertiesContext final : private FillProperties, public FillPropertiesContext
231 public:
232 explicit SimpleFillPropertiesContext(
233 ::oox::core::ContextHandler2Helper const & rParent,
234 Color& rColor );
235 virtual ~SimpleFillPropertiesContext() override;
237 private:
238 Color& mrColor;
241 } // namespace drawingml
242 } // namespace oox
244 #endif
246 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */