Branch data 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 OOX_DRAWINGML_FILLPROPERTIESGROUPCONTEXT_HPP
21 : : #define OOX_DRAWINGML_FILLPROPERTIESGROUPCONTEXT_HPP
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 [ - + ]: 228 : class SolidFillContext : public ColorContext
33 : : {
34 : : public:
35 : : explicit SolidFillContext(
36 : : ::oox::core::ContextHandler& rParent,
37 : : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs,
38 : : FillProperties& rFillProps );
39 : : };
40 : :
41 : : // ============================================================================
42 : :
43 : : /** Context handler that imports the a:gradFill element. */
44 [ - + ]: 144 : class GradientFillContext : public ::oox::core::ContextHandler
45 : : {
46 : : public:
47 : : explicit GradientFillContext(
48 : : ::oox::core::ContextHandler& rParent,
49 : : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs,
50 : : GradientFillProperties& rGradientProps );
51 : :
52 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
53 : : createFastChildContext(
54 : : sal_Int32 nElement,
55 : : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
56 : : throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
57 : :
58 : : private:
59 : : GradientFillProperties& mrGradientProps;
60 : : };
61 : :
62 : : // ============================================================================
63 : :
64 : : /** Context handler that imports the a:pattFill element. */
65 [ # # ]: 0 : class PatternFillContext : public ::oox::core::ContextHandler
66 : : {
67 : : public:
68 : : explicit PatternFillContext(
69 : : ::oox::core::ContextHandler& rParent,
70 : : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs,
71 : : PatternFillProperties& rPatternProps );
72 : :
73 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
74 : : createFastChildContext(
75 : : sal_Int32 nElement,
76 : : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
77 : : throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
78 : :
79 : : private:
80 : : PatternFillProperties& mrPatternProps;
81 : : };
82 : :
83 : : // ============================================================================
84 : : // ============================================================================
85 : :
86 : : /** Context handler that imports the a:clrChange element containing the colors
87 : : of a bitmap color change transformation. */
88 : : class ColorChangeContext : public ::oox::core::ContextHandler
89 : : {
90 : : public:
91 : : explicit ColorChangeContext(
92 : : ::oox::core::ContextHandler& rParent,
93 : : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs,
94 : : BlipFillProperties& rBlipProps );
95 : : virtual ~ColorChangeContext();
96 : :
97 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
98 : : createFastChildContext(
99 : : sal_Int32 nElement,
100 : : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
101 : : throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
102 : :
103 : : private:
104 : : BlipFillProperties& mrBlipProps;
105 : : bool mbUseAlpha;
106 : : };
107 : :
108 : : // ============================================================================
109 : :
110 : : /** Context handler that imports the a:blip element containing the fill bitmap
111 : : and bitmap color transformation settings. */
112 [ - + ]: 30 : class BlipContext : public ::oox::core::ContextHandler
113 : : {
114 : : public:
115 : : explicit BlipContext(
116 : : ::oox::core::ContextHandler& rParent,
117 : : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs,
118 : : BlipFillProperties& rBlipProps );
119 : :
120 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
121 : : createFastChildContext(
122 : : sal_Int32 nElement,
123 : : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
124 : : throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
125 : :
126 : : private:
127 : : BlipFillProperties& mrBlipProps;
128 : : };
129 : :
130 : : // ============================================================================
131 : :
132 : : /** Context handler that imports the a:blipFill element. */
133 [ - + ]: 30 : class BlipFillContext : public ::oox::core::ContextHandler
134 : : {
135 : : public:
136 : : explicit BlipFillContext(
137 : : ::oox::core::ContextHandler& rParent,
138 : : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs,
139 : : BlipFillProperties& rBlipProps );
140 : :
141 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
142 : : createFastChildContext(
143 : : sal_Int32 nElement,
144 : : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
145 : : throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
146 : :
147 : : private:
148 : : BlipFillProperties& mrBlipProps;
149 : : };
150 : :
151 : : // ============================================================================
152 : : // ============================================================================
153 : :
154 : : /** Context handler for elements that contain a fill property element
155 : : (a:noFill, a:solidFill, a:gradFill, a:pattFill, a:blipFill, a:grpFill). */
156 [ # # ]: 0 : class FillPropertiesContext : public ::oox::core::ContextHandler
157 : : {
158 : : public:
159 : : explicit FillPropertiesContext(
160 : : ::oox::core::ContextHandler& rParent,
161 : : FillProperties& rFillProps );
162 : :
163 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
164 : : createFastChildContext(
165 : : sal_Int32 nElement,
166 : : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
167 : : throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
168 : :
169 : : static ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler >
170 : : createFillContext(
171 : : ::oox::core::ContextHandler& rParent,
172 : : sal_Int32 nElement,
173 : : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs,
174 : : FillProperties& rFillProps );
175 : :
176 : : protected:
177 : : FillProperties& mrFillProps;
178 : : };
179 : :
180 : : // ============================================================================
181 : :
182 : : /** Context handler for elements that contain a fill property element
183 : : (a:noFill, a:solidFill, a:gradFill, a:pattFill, a:blipFill, a:grpFill).
184 : :
185 : : This context handler takes a simple color instead of a fill properties
186 : : struct. The imported fill properties are converted automatically to the
187 : : best fitting solid color.
188 : : */
189 : : class SimpleFillPropertiesContext : private FillProperties, public FillPropertiesContext
190 : : {
191 : : public:
192 : : explicit SimpleFillPropertiesContext(
193 : : ::oox::core::ContextHandler& rParent,
194 : : Color& rColor );
195 : : virtual ~SimpleFillPropertiesContext();
196 : :
197 : : protected:
198 : : Color& mrColor;
199 : : };
200 : :
201 : : // ============================================================================
202 : :
203 : : } // namespace drawingml
204 : : } // namespace oox
205 : :
206 : : #endif
207 : :
208 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|