1*e3508121SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*e3508121SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*e3508121SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*e3508121SAndrew Rist  * distributed with this work for additional information
6*e3508121SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*e3508121SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*e3508121SAndrew Rist  * "License"); you may not use this file except in compliance
9*e3508121SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*e3508121SAndrew Rist  *
11*e3508121SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*e3508121SAndrew Rist  *
13*e3508121SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*e3508121SAndrew Rist  * software distributed under the License is distributed on an
15*e3508121SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*e3508121SAndrew Rist  * KIND, either express or implied.  See the License for the
17*e3508121SAndrew Rist  * specific language governing permissions and limitations
18*e3508121SAndrew Rist  * under the License.
19*e3508121SAndrew Rist  *
20*e3508121SAndrew Rist  *************************************************************/
21*e3508121SAndrew Rist 
22*e3508121SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef OOX_DRAWINGML_FILLPROPERTIESGROUPCONTEXT_HPP
25cdf0e10cSrcweir #define OOX_DRAWINGML_FILLPROPERTIESGROUPCONTEXT_HPP
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "oox/drawingml/colorchoicecontext.hxx"
28cdf0e10cSrcweir #include "oox/drawingml/fillproperties.hxx"
29cdf0e10cSrcweir 
30cdf0e10cSrcweir namespace oox {
31cdf0e10cSrcweir namespace drawingml {
32cdf0e10cSrcweir 
33cdf0e10cSrcweir // ============================================================================
34cdf0e10cSrcweir 
35cdf0e10cSrcweir /** Context handler that imports the a:solidFill element. */
36cdf0e10cSrcweir class SolidFillContext : public ColorContext
37cdf0e10cSrcweir {
38cdf0e10cSrcweir public:
39cdf0e10cSrcweir     explicit            SolidFillContext(
40cdf0e10cSrcweir                             ::oox::core::ContextHandler& rParent,
41cdf0e10cSrcweir                             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs,
42cdf0e10cSrcweir                             FillProperties& rFillProps );
43cdf0e10cSrcweir };
44cdf0e10cSrcweir 
45cdf0e10cSrcweir // ============================================================================
46cdf0e10cSrcweir 
47cdf0e10cSrcweir /** Context handler that imports the a:gradFill element. */
48cdf0e10cSrcweir class GradientFillContext : public ::oox::core::ContextHandler
49cdf0e10cSrcweir {
50cdf0e10cSrcweir public:
51cdf0e10cSrcweir     explicit            GradientFillContext(
52cdf0e10cSrcweir                             ::oox::core::ContextHandler& rParent,
53cdf0e10cSrcweir                             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs,
54cdf0e10cSrcweir                             GradientFillProperties& rGradientProps );
55cdf0e10cSrcweir 
56cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
57cdf0e10cSrcweir                         createFastChildContext(
58cdf0e10cSrcweir                             sal_Int32 nElement,
59cdf0e10cSrcweir                             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
60cdf0e10cSrcweir                         throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
61cdf0e10cSrcweir 
62cdf0e10cSrcweir private:
63cdf0e10cSrcweir     GradientFillProperties& mrGradientProps;
64cdf0e10cSrcweir };
65cdf0e10cSrcweir 
66cdf0e10cSrcweir // ============================================================================
67cdf0e10cSrcweir 
68cdf0e10cSrcweir /** Context handler that imports the a:pattFill element. */
69cdf0e10cSrcweir class PatternFillContext : public ::oox::core::ContextHandler
70cdf0e10cSrcweir {
71cdf0e10cSrcweir public:
72cdf0e10cSrcweir     explicit            PatternFillContext(
73cdf0e10cSrcweir                             ::oox::core::ContextHandler& rParent,
74cdf0e10cSrcweir                             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs,
75cdf0e10cSrcweir                             PatternFillProperties& rPatternProps );
76cdf0e10cSrcweir 
77cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
78cdf0e10cSrcweir                         createFastChildContext(
79cdf0e10cSrcweir                             sal_Int32 nElement,
80cdf0e10cSrcweir                             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
81cdf0e10cSrcweir                         throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
82cdf0e10cSrcweir 
83cdf0e10cSrcweir private:
84cdf0e10cSrcweir     PatternFillProperties& mrPatternProps;
85cdf0e10cSrcweir };
86cdf0e10cSrcweir 
87cdf0e10cSrcweir // ============================================================================
88cdf0e10cSrcweir // ============================================================================
89cdf0e10cSrcweir 
90cdf0e10cSrcweir /** Context handler that imports the a:clrChange element containing the colors
91cdf0e10cSrcweir     of a bitmap color change transformation. */
92cdf0e10cSrcweir class ColorChangeContext : public ::oox::core::ContextHandler
93cdf0e10cSrcweir {
94cdf0e10cSrcweir public:
95cdf0e10cSrcweir     explicit            ColorChangeContext(
96cdf0e10cSrcweir                             ::oox::core::ContextHandler& rParent,
97cdf0e10cSrcweir                             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs,
98cdf0e10cSrcweir                             BlipFillProperties& rBlipProps );
99cdf0e10cSrcweir     virtual             ~ColorChangeContext();
100cdf0e10cSrcweir 
101cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
102cdf0e10cSrcweir                         createFastChildContext(
103cdf0e10cSrcweir                             sal_Int32 nElement,
104cdf0e10cSrcweir                             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
105cdf0e10cSrcweir                         throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
106cdf0e10cSrcweir 
107cdf0e10cSrcweir private:
108cdf0e10cSrcweir     BlipFillProperties& mrBlipProps;
109cdf0e10cSrcweir     bool                mbUseAlpha;
110cdf0e10cSrcweir };
111cdf0e10cSrcweir 
112cdf0e10cSrcweir // ============================================================================
113cdf0e10cSrcweir 
114cdf0e10cSrcweir /** Context handler that imports the a:blip element containing the fill bitmap
115cdf0e10cSrcweir     and bitmap color transformation settings. */
116cdf0e10cSrcweir class BlipContext : public ::oox::core::ContextHandler
117cdf0e10cSrcweir {
118cdf0e10cSrcweir public:
119cdf0e10cSrcweir     explicit            BlipContext(
120cdf0e10cSrcweir                             ::oox::core::ContextHandler& rParent,
121cdf0e10cSrcweir                             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs,
122cdf0e10cSrcweir                             BlipFillProperties& rBlipProps );
123cdf0e10cSrcweir 
124cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
125cdf0e10cSrcweir                         createFastChildContext(
126cdf0e10cSrcweir                             sal_Int32 nElement,
127cdf0e10cSrcweir                             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
128cdf0e10cSrcweir                         throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
129cdf0e10cSrcweir 
130cdf0e10cSrcweir private:
131cdf0e10cSrcweir     BlipFillProperties& mrBlipProps;
132cdf0e10cSrcweir };
133cdf0e10cSrcweir 
134cdf0e10cSrcweir // ============================================================================
135cdf0e10cSrcweir 
136cdf0e10cSrcweir /** Context handler that imports the a:blipFill element. */
137cdf0e10cSrcweir class BlipFillContext : public ::oox::core::ContextHandler
138cdf0e10cSrcweir {
139cdf0e10cSrcweir public:
140cdf0e10cSrcweir     explicit            BlipFillContext(
141cdf0e10cSrcweir                             ::oox::core::ContextHandler& rParent,
142cdf0e10cSrcweir                             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs,
143cdf0e10cSrcweir                             BlipFillProperties& rBlipProps );
144cdf0e10cSrcweir 
145cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
146cdf0e10cSrcweir                         createFastChildContext(
147cdf0e10cSrcweir                             sal_Int32 nElement,
148cdf0e10cSrcweir                             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
149cdf0e10cSrcweir                         throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
150cdf0e10cSrcweir 
151cdf0e10cSrcweir private:
152cdf0e10cSrcweir     BlipFillProperties& mrBlipProps;
153cdf0e10cSrcweir };
154cdf0e10cSrcweir 
155cdf0e10cSrcweir // ============================================================================
156cdf0e10cSrcweir // ============================================================================
157cdf0e10cSrcweir 
158cdf0e10cSrcweir /** Context handler for elements that contain a fill property element
159cdf0e10cSrcweir     (a:noFill, a:solidFill, a:gradFill, a:pattFill, a:blipFill, a:grpFill). */
160cdf0e10cSrcweir class FillPropertiesContext : public ::oox::core::ContextHandler
161cdf0e10cSrcweir {
162cdf0e10cSrcweir public:
163cdf0e10cSrcweir     explicit            FillPropertiesContext(
164cdf0e10cSrcweir                             ::oox::core::ContextHandler& rParent,
165cdf0e10cSrcweir                             FillProperties& rFillProps );
166cdf0e10cSrcweir 
167cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
168cdf0e10cSrcweir                         createFastChildContext(
169cdf0e10cSrcweir                             sal_Int32 nElement,
170cdf0e10cSrcweir                             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
171cdf0e10cSrcweir                         throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
172cdf0e10cSrcweir 
173cdf0e10cSrcweir     static ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler >
174cdf0e10cSrcweir                         createFillContext(
175cdf0e10cSrcweir                             ::oox::core::ContextHandler& rParent,
176cdf0e10cSrcweir                             sal_Int32 nElement,
177cdf0e10cSrcweir                             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs,
178cdf0e10cSrcweir                             FillProperties& rFillProps );
179cdf0e10cSrcweir 
180cdf0e10cSrcweir protected:
181cdf0e10cSrcweir     FillProperties&     mrFillProps;
182cdf0e10cSrcweir };
183cdf0e10cSrcweir 
184cdf0e10cSrcweir // ============================================================================
185cdf0e10cSrcweir 
186cdf0e10cSrcweir /** Context handler for elements that contain a fill property element
187cdf0e10cSrcweir     (a:noFill, a:solidFill, a:gradFill, a:pattFill, a:blipFill, a:grpFill).
188cdf0e10cSrcweir 
189cdf0e10cSrcweir     This context handler takes a simple color instead of a fill properties
190cdf0e10cSrcweir     struct. The imported fill properties are converted automatically to the
191cdf0e10cSrcweir     best fitting solid color.
192cdf0e10cSrcweir  */
193cdf0e10cSrcweir class SimpleFillPropertiesContext : private FillProperties, public FillPropertiesContext
194cdf0e10cSrcweir {
195cdf0e10cSrcweir public:
196cdf0e10cSrcweir     explicit            SimpleFillPropertiesContext(
197cdf0e10cSrcweir                             ::oox::core::ContextHandler& rParent,
198cdf0e10cSrcweir                             Color& rColor );
199cdf0e10cSrcweir     virtual             ~SimpleFillPropertiesContext();
200cdf0e10cSrcweir 
201cdf0e10cSrcweir protected:
202cdf0e10cSrcweir     Color&              mrColor;
203cdf0e10cSrcweir };
204cdf0e10cSrcweir 
205cdf0e10cSrcweir // ============================================================================
206cdf0e10cSrcweir 
207cdf0e10cSrcweir } // namespace drawingml
208cdf0e10cSrcweir } // namespace oox
209cdf0e10cSrcweir 
210cdf0e10cSrcweir #endif
211cdf0e10cSrcweir 
212