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 : #include "oox/drawingml/chart/objectformatter.hxx"
21 :
22 : #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
23 : #include <com/sun/star/util/XNumberFormatTypes.hpp>
24 : #include <osl/thread.h>
25 : #include <rtl/strbuf.hxx>
26 : #include "oox/core/xmlfilterbase.hxx"
27 : #include "oox/drawingml/fillproperties.hxx"
28 : #include "oox/drawingml/lineproperties.hxx"
29 : #include "oox/drawingml/shapepropertymap.hxx"
30 : #include "oox/drawingml/textbody.hxx"
31 : #include "oox/drawingml/textparagraph.hxx"
32 : #include "oox/drawingml/theme.hxx"
33 : #include "oox/drawingml/chart/chartspacemodel.hxx"
34 : #include "oox/helper/modelobjecthelper.hxx"
35 :
36 : namespace oox {
37 : namespace drawingml {
38 : namespace chart {
39 :
40 : // ============================================================================
41 :
42 : using namespace ::com::sun::star::chart2;
43 : using namespace ::com::sun::star::frame;
44 : using namespace ::com::sun::star::graphic;
45 : using namespace ::com::sun::star::lang;
46 : using namespace ::com::sun::star::uno;
47 : using namespace ::com::sun::star::util;
48 :
49 : using ::oox::core::XmlFilterBase;
50 :
51 : // ============================================================================
52 :
53 : namespace {
54 :
55 : struct AutoFormatPatternEntry
56 : {
57 : sal_Int32 mnColorToken; /// Theme color token.
58 : sal_Int32 mnModToken; /// Color modification token.
59 : sal_Int32 mnModValue; /// Color modification value.
60 : };
61 :
62 : #define AUTOFORMAT_PATTERN_COLOR( color_token ) \
63 : { color_token, XML_TOKEN_INVALID, 0 }
64 :
65 : #define AUTOFORMAT_PATTERN_COLORMOD( color_token, mod_token, mod_value ) \
66 : { color_token, mod_token, mod_value }
67 :
68 : #define AUTOFORMAT_PATTERN_END() \
69 : AUTOFORMAT_PATTERN_COLOR( XML_TOKEN_INVALID )
70 :
71 : static const AutoFormatPatternEntry spAutoFormatPattern1[] =
72 : {
73 : AUTOFORMAT_PATTERN_COLORMOD( XML_dk1, XML_tint, 88500 ),
74 : AUTOFORMAT_PATTERN_COLORMOD( XML_dk1, XML_tint, 55000 ),
75 : AUTOFORMAT_PATTERN_COLORMOD( XML_dk1, XML_tint, 78000 ),
76 : AUTOFORMAT_PATTERN_COLORMOD( XML_dk1, XML_tint, 92500 ),
77 : AUTOFORMAT_PATTERN_COLORMOD( XML_dk1, XML_tint, 70000 ),
78 : AUTOFORMAT_PATTERN_COLORMOD( XML_dk1, XML_tint, 30000 ),
79 : AUTOFORMAT_PATTERN_END()
80 : };
81 :
82 : static const AutoFormatPatternEntry spAutoFormatPattern2[] =
83 : {
84 : AUTOFORMAT_PATTERN_COLOR( XML_accent1 ),
85 : AUTOFORMAT_PATTERN_COLOR( XML_accent2 ),
86 : AUTOFORMAT_PATTERN_COLOR( XML_accent3 ),
87 : AUTOFORMAT_PATTERN_COLOR( XML_accent4 ),
88 : AUTOFORMAT_PATTERN_COLOR( XML_accent5 ),
89 : AUTOFORMAT_PATTERN_COLOR( XML_accent6 ),
90 : AUTOFORMAT_PATTERN_END()
91 : };
92 :
93 : static const AutoFormatPatternEntry spAutoFormatPattern3[] =
94 : {
95 : AUTOFORMAT_PATTERN_COLORMOD( XML_accent1, XML_shade, 50000 ),
96 : AUTOFORMAT_PATTERN_COLORMOD( XML_accent2, XML_shade, 50000 ),
97 : AUTOFORMAT_PATTERN_COLORMOD( XML_accent3, XML_shade, 50000 ),
98 : AUTOFORMAT_PATTERN_COLORMOD( XML_accent4, XML_shade, 50000 ),
99 : AUTOFORMAT_PATTERN_COLORMOD( XML_accent5, XML_shade, 50000 ),
100 : AUTOFORMAT_PATTERN_COLORMOD( XML_accent6, XML_shade, 50000 ),
101 : AUTOFORMAT_PATTERN_END()
102 : };
103 :
104 : static const AutoFormatPatternEntry spAutoFormatPattern4[] =
105 : {
106 : AUTOFORMAT_PATTERN_COLORMOD( XML_dk1, XML_tint, 5000 ),
107 : AUTOFORMAT_PATTERN_COLORMOD( XML_dk1, XML_tint, 55000 ),
108 : AUTOFORMAT_PATTERN_COLORMOD( XML_dk1, XML_tint, 78000 ),
109 : AUTOFORMAT_PATTERN_COLORMOD( XML_dk1, XML_tint, 15000 ),
110 : AUTOFORMAT_PATTERN_COLORMOD( XML_dk1, XML_tint, 70000 ),
111 : AUTOFORMAT_PATTERN_COLORMOD( XML_dk1, XML_tint, 30000 ),
112 : AUTOFORMAT_PATTERN_END()
113 : };
114 :
115 : #undef AUTOFORMAT_PATTERN_COLOR
116 : #undef AUTOFORMAT_PATTERN_COLORMOD
117 : #undef AUTOFORMAT_PATTERN_END
118 :
119 : // ----------------------------------------------------------------------------
120 :
121 : struct AutoFormatEntry
122 : {
123 : sal_Int32 mnFirstStyleIdx; /// First chart style index.
124 : sal_Int32 mnLastStyleIdx; /// Last chart style index.
125 : sal_Int32 mnThemedIdx; /// Themed style index.
126 : sal_Int32 mnColorToken; /// Theme color token.
127 : sal_Int32 mnModToken; /// Color modification token.
128 : sal_Int32 mnModValue; /// Color modification value.
129 : sal_Int32 mnRelLineWidth; /// Relative line width (percent).
130 : const AutoFormatPatternEntry* mpPattern;/// Color cycling pattern for data series.
131 : bool mbFadedColor; /// True = Faded color for data series.
132 : };
133 :
134 : #define AUTOFORMAT_COLOR( first, last, themed_style, color_token ) \
135 : { first, last, themed_style, color_token, XML_TOKEN_INVALID, 0, 100, 0, false }
136 :
137 : #define AUTOFORMAT_COLORMOD( first, last, themed_style, color_token, mod_token, mod_value ) \
138 : { first, last, themed_style, color_token, mod_token, mod_value, 100, 0, false }
139 :
140 : #define AUTOFORMAT_ACCENTSMOD( first, themed_style, mod_token, mod_value ) \
141 : AUTOFORMAT_COLORMOD( first, first, themed_style, XML_accent1, mod_token, mod_value ), \
142 : AUTOFORMAT_COLORMOD( first + 1, first + 1, themed_style, XML_accent2, mod_token, mod_value ), \
143 : AUTOFORMAT_COLORMOD( first + 2, first + 2, themed_style, XML_accent3, mod_token, mod_value ), \
144 : AUTOFORMAT_COLORMOD( first + 3, first + 3, themed_style, XML_accent4, mod_token, mod_value ), \
145 : AUTOFORMAT_COLORMOD( first + 4, first + 4, themed_style, XML_accent5, mod_token, mod_value ), \
146 : AUTOFORMAT_COLORMOD( first + 5, first + 5, themed_style, XML_accent6, mod_token, mod_value )
147 :
148 : #define AUTOFORMAT_PATTERN( first, last, themed_style, line_width, pattern ) \
149 : { first, last, themed_style, XML_TOKEN_INVALID, XML_TOKEN_INVALID, 0, line_width, pattern, false }
150 :
151 : #define AUTOFORMAT_FADED( first, last, themed_style, color_token, line_width ) \
152 : { first, last, themed_style, color_token, XML_TOKEN_INVALID, 0, line_width, 0, true }
153 :
154 : #define AUTOFORMAT_FADEDACCENTS( first, themed_style, line_width ) \
155 : AUTOFORMAT_FADED( first, first, themed_style, XML_accent1, line_width ), \
156 : AUTOFORMAT_FADED( first + 1, first + 1, themed_style, XML_accent2, line_width ), \
157 : AUTOFORMAT_FADED( first + 2, first + 2, themed_style, XML_accent3, line_width ), \
158 : AUTOFORMAT_FADED( first + 3, first + 3, themed_style, XML_accent4, line_width ), \
159 : AUTOFORMAT_FADED( first + 4, first + 4, themed_style, XML_accent5, line_width ), \
160 : AUTOFORMAT_FADED( first + 5, first + 5, themed_style, XML_accent6, line_width )
161 :
162 : #define AUTOFORMAT_INVISIBLE( first, last ) \
163 : AUTOFORMAT_COLOR( first, last, -1, XML_TOKEN_INVALID )
164 :
165 : #define AUTOFORMAT_END() \
166 : AUTOFORMAT_INVISIBLE( -1, -1 )
167 :
168 : static const AutoFormatEntry spNoFormats[] =
169 : {
170 : AUTOFORMAT_INVISIBLE( 1, 48 ),
171 : AUTOFORMAT_END()
172 : };
173 :
174 : static const AutoFormatEntry spDataTableLines[] =
175 : {
176 : AUTOFORMAT_COLORMOD( 1, 32, THEMED_STYLE_SUBTLE, XML_tx1, XML_tint, 75000 ),
177 : AUTOFORMAT_COLORMOD( 33, 40, THEMED_STYLE_SUBTLE, XML_dk1, XML_tint, 75000 ),
178 : // 41...48: no line, same as Chart2
179 : AUTOFORMAT_END()
180 : };
181 :
182 : static const AutoFormatEntry spPlotArea2dFills[] =
183 : {
184 : AUTOFORMAT_COLOR( 1, 32, THEMED_STYLE_SUBTLE, XML_bg1 ),
185 : AUTOFORMAT_COLORMOD( 33, 34, THEMED_STYLE_SUBTLE, XML_dk1, XML_tint, 20000 ),
186 : AUTOFORMAT_ACCENTSMOD( 35, THEMED_STYLE_SUBTLE, XML_tint, 20000 ), // tint not documented!?
187 : AUTOFORMAT_COLORMOD( 41, 48, THEMED_STYLE_SUBTLE, XML_dk1, XML_tint, 95000 ),
188 : AUTOFORMAT_END()
189 : };
190 :
191 : static const AutoFormatEntry spWallFloorLines[] =
192 : {
193 : AUTOFORMAT_COLORMOD( 1, 32, THEMED_STYLE_SUBTLE, XML_tx1, XML_tint, 75000 ),
194 : AUTOFORMAT_COLORMOD( 33, 40, THEMED_STYLE_SUBTLE, XML_dk1, XML_tint, 75000 ),
195 : // 41...48: no line, same as Chart2
196 : AUTOFORMAT_END()
197 : };
198 :
199 : static const AutoFormatEntry spWallFloorFills[] =
200 : {
201 : AUTOFORMAT_INVISIBLE( 1, 32 ),
202 : AUTOFORMAT_COLORMOD( 33, 34, THEMED_STYLE_SUBTLE, XML_dk1, XML_tint, 20000 ),
203 : AUTOFORMAT_ACCENTSMOD( 35, THEMED_STYLE_SUBTLE, XML_tint, 20000 ), // tint not documented!?
204 : AUTOFORMAT_COLORMOD( 41, 48, THEMED_STYLE_SUBTLE, XML_dk1, XML_tint, 95000 ),
205 : AUTOFORMAT_END()
206 : };
207 :
208 : static const AutoFormatEntry spAxisLines[] =
209 : {
210 : AUTOFORMAT_COLORMOD( 1, 32, THEMED_STYLE_SUBTLE, XML_tx1, XML_tint, 75000 ), // tint not documented!?
211 : AUTOFORMAT_COLORMOD( 33, 48, THEMED_STYLE_SUBTLE, XML_dk1, XML_tint, 75000 ), // tint not documented!?
212 : AUTOFORMAT_END()
213 : };
214 :
215 : static const AutoFormatEntry spMajorGridLines[] =
216 : {
217 : AUTOFORMAT_COLORMOD( 1, 32, THEMED_STYLE_SUBTLE, XML_tx1, XML_tint, 75000 ), // tint not documented!?
218 : AUTOFORMAT_COLORMOD( 33, 48, THEMED_STYLE_SUBTLE, XML_dk1, XML_tint, 75000 ), // tint not documented!?
219 : AUTOFORMAT_END()
220 : };
221 :
222 : static const AutoFormatEntry spMinorGridLines[] =
223 : {
224 : AUTOFORMAT_COLORMOD( 1, 40, THEMED_STYLE_SUBTLE, XML_tx1, XML_tint, 50000 ),
225 : AUTOFORMAT_COLORMOD( 41, 48, THEMED_STYLE_SUBTLE, XML_tx1, XML_tint, 90000 ),
226 : AUTOFORMAT_END()
227 : };
228 :
229 : static const AutoFormatEntry spOtherLines[] =
230 : {
231 : AUTOFORMAT_COLOR( 1, 32, THEMED_STYLE_SUBTLE, XML_tx1 ),
232 : AUTOFORMAT_COLOR( 33, 34, THEMED_STYLE_SUBTLE, XML_dk1 ),
233 : AUTOFORMAT_COLORMOD( 35, 40, THEMED_STYLE_SUBTLE, XML_dk1, XML_shade, 25000 ),
234 : AUTOFORMAT_COLOR( 41, 48, THEMED_STYLE_SUBTLE, XML_lt1 ),
235 : AUTOFORMAT_END()
236 : };
237 :
238 : static const AutoFormatEntry spLinearSeriesLines[] =
239 : {
240 : AUTOFORMAT_PATTERN( 1, 1, THEMED_STYLE_SUBTLE, 300, spAutoFormatPattern1 ),
241 : AUTOFORMAT_PATTERN( 2, 2, THEMED_STYLE_SUBTLE, 300, spAutoFormatPattern2 ),
242 : AUTOFORMAT_FADEDACCENTS( 3, THEMED_STYLE_SUBTLE, 300 ),
243 : AUTOFORMAT_PATTERN( 9, 9, THEMED_STYLE_SUBTLE, 500, spAutoFormatPattern1 ),
244 : AUTOFORMAT_PATTERN( 10, 10, THEMED_STYLE_SUBTLE, 500, spAutoFormatPattern2 ),
245 : AUTOFORMAT_FADEDACCENTS( 11, THEMED_STYLE_SUBTLE, 500 ),
246 : AUTOFORMAT_PATTERN( 17, 17, THEMED_STYLE_SUBTLE, 500, spAutoFormatPattern1 ),
247 : AUTOFORMAT_PATTERN( 18, 18, THEMED_STYLE_SUBTLE, 500, spAutoFormatPattern2 ),
248 : AUTOFORMAT_FADEDACCENTS( 19, THEMED_STYLE_SUBTLE, 500 ),
249 : AUTOFORMAT_PATTERN( 25, 25, THEMED_STYLE_SUBTLE, 700, spAutoFormatPattern1 ),
250 : AUTOFORMAT_PATTERN( 26, 26, THEMED_STYLE_SUBTLE, 700, spAutoFormatPattern2 ),
251 : AUTOFORMAT_FADEDACCENTS( 27, THEMED_STYLE_SUBTLE, 700 ),
252 : AUTOFORMAT_PATTERN( 33, 33, THEMED_STYLE_SUBTLE, 500, spAutoFormatPattern1 ),
253 : AUTOFORMAT_PATTERN( 34, 34, THEMED_STYLE_SUBTLE, 500, spAutoFormatPattern2 ),
254 : AUTOFORMAT_FADEDACCENTS( 35, THEMED_STYLE_SUBTLE, 500 ),
255 : AUTOFORMAT_PATTERN( 41, 42, THEMED_STYLE_SUBTLE, 500, spAutoFormatPattern4 ),
256 : AUTOFORMAT_PATTERN( 42, 42, THEMED_STYLE_SUBTLE, 500, spAutoFormatPattern2 ),
257 : AUTOFORMAT_FADEDACCENTS( 43, THEMED_STYLE_SUBTLE, 500 ),
258 : AUTOFORMAT_END()
259 : };
260 :
261 : static const AutoFormatEntry spFilledSeriesLines[] =
262 : {
263 : AUTOFORMAT_INVISIBLE( 1, 8 ),
264 : AUTOFORMAT_COLOR( 9, 16, THEMED_STYLE_SUBTLE, XML_lt1 ),
265 : AUTOFORMAT_INVISIBLE( 17, 32 ),
266 : AUTOFORMAT_COLORMOD( 33, 33, THEMED_STYLE_SUBTLE, XML_dk1, XML_shade, 50000 ),
267 : AUTOFORMAT_PATTERN( 34, 34, THEMED_STYLE_SUBTLE, 100, spAutoFormatPattern3 ),
268 : AUTOFORMAT_ACCENTSMOD( 35, THEMED_STYLE_SUBTLE, XML_shade, 50000 ),
269 : AUTOFORMAT_INVISIBLE( 41, 48 ),
270 : AUTOFORMAT_END()
271 : };
272 :
273 : static const AutoFormatEntry spFilledSeries2dFills[] =
274 : {
275 : AUTOFORMAT_PATTERN( 1, 1, THEMED_STYLE_SUBTLE, 100, spAutoFormatPattern1 ),
276 : AUTOFORMAT_PATTERN( 2, 2, THEMED_STYLE_SUBTLE, 100, spAutoFormatPattern2 ),
277 : AUTOFORMAT_FADEDACCENTS( 3, THEMED_STYLE_SUBTLE, 100 ),
278 : AUTOFORMAT_PATTERN( 9, 9, THEMED_STYLE_SUBTLE, 100, spAutoFormatPattern1 ),
279 : AUTOFORMAT_PATTERN( 10, 10, THEMED_STYLE_SUBTLE, 100, spAutoFormatPattern2 ),
280 : AUTOFORMAT_FADEDACCENTS( 11, THEMED_STYLE_SUBTLE, 100 ),
281 : AUTOFORMAT_PATTERN( 17, 17, THEMED_STYLE_INTENSE, 100, spAutoFormatPattern1 ),
282 : AUTOFORMAT_PATTERN( 18, 18, THEMED_STYLE_INTENSE, 100, spAutoFormatPattern2 ),
283 : AUTOFORMAT_FADEDACCENTS( 19, THEMED_STYLE_INTENSE, 100 ),
284 : AUTOFORMAT_PATTERN( 25, 25, THEMED_STYLE_INTENSE, 100, spAutoFormatPattern1 ),
285 : AUTOFORMAT_PATTERN( 26, 26, THEMED_STYLE_INTENSE, 100, spAutoFormatPattern2 ),
286 : AUTOFORMAT_FADEDACCENTS( 27, THEMED_STYLE_INTENSE, 100 ),
287 : AUTOFORMAT_PATTERN( 33, 33, THEMED_STYLE_SUBTLE, 100, spAutoFormatPattern1 ),
288 : AUTOFORMAT_PATTERN( 34, 34, THEMED_STYLE_SUBTLE, 100, spAutoFormatPattern2 ),
289 : AUTOFORMAT_FADEDACCENTS( 35, THEMED_STYLE_SUBTLE, 100 ),
290 : AUTOFORMAT_PATTERN( 41, 42, THEMED_STYLE_INTENSE, 100, spAutoFormatPattern4 ),
291 : AUTOFORMAT_PATTERN( 42, 42, THEMED_STYLE_INTENSE, 100, spAutoFormatPattern2 ),
292 : AUTOFORMAT_FADEDACCENTS( 43, THEMED_STYLE_INTENSE, 100 ),
293 : AUTOFORMAT_END()
294 : };
295 :
296 : static const AutoFormatEntry spFilledSeries3dFills[] =
297 : {
298 : AUTOFORMAT_PATTERN( 1, 1, THEMED_STYLE_SUBTLE, 100, spAutoFormatPattern1 ),
299 : AUTOFORMAT_PATTERN( 2, 2, THEMED_STYLE_SUBTLE, 100, spAutoFormatPattern2 ),
300 : AUTOFORMAT_FADEDACCENTS( 3, THEMED_STYLE_SUBTLE, 100 ),
301 : AUTOFORMAT_PATTERN( 9, 9, THEMED_STYLE_SUBTLE, 100, spAutoFormatPattern1 ),
302 : AUTOFORMAT_PATTERN( 10, 10, THEMED_STYLE_SUBTLE, 100, spAutoFormatPattern2 ),
303 : AUTOFORMAT_FADEDACCENTS( 11, THEMED_STYLE_SUBTLE, 100 ),
304 : AUTOFORMAT_PATTERN( 17, 17, THEMED_STYLE_SUBTLE, 100, spAutoFormatPattern1 ),
305 : AUTOFORMAT_PATTERN( 18, 18, THEMED_STYLE_INTENSE, 100, spAutoFormatPattern2 ),
306 : AUTOFORMAT_FADEDACCENTS( 19, THEMED_STYLE_SUBTLE, 100 ),
307 : AUTOFORMAT_PATTERN( 25, 25, THEMED_STYLE_SUBTLE, 100, spAutoFormatPattern1 ),
308 : AUTOFORMAT_PATTERN( 26, 26, THEMED_STYLE_INTENSE, 100, spAutoFormatPattern2 ),
309 : AUTOFORMAT_FADEDACCENTS( 27, THEMED_STYLE_SUBTLE, 100 ),
310 : AUTOFORMAT_PATTERN( 33, 33, THEMED_STYLE_SUBTLE, 100, spAutoFormatPattern1 ),
311 : AUTOFORMAT_PATTERN( 34, 34, THEMED_STYLE_SUBTLE, 100, spAutoFormatPattern2 ),
312 : AUTOFORMAT_FADEDACCENTS( 35, THEMED_STYLE_SUBTLE, 100 ),
313 : AUTOFORMAT_PATTERN( 41, 42, THEMED_STYLE_SUBTLE, 100, spAutoFormatPattern4 ),
314 : AUTOFORMAT_PATTERN( 42, 42, THEMED_STYLE_INTENSE, 100, spAutoFormatPattern2 ),
315 : AUTOFORMAT_FADEDACCENTS( 43, THEMED_STYLE_SUBTLE, 100 ),
316 : AUTOFORMAT_END()
317 : };
318 :
319 : static const AutoFormatEntry spFilledSeriesEffects[] =
320 : {
321 : // 1...8: no effect, same as Chart2
322 : AUTOFORMAT_COLOR( 9, 16, THEMED_STYLE_SUBTLE, XML_dk1 ),
323 : AUTOFORMAT_COLOR( 17, 24, THEMED_STYLE_MODERATE, XML_dk1 ),
324 : AUTOFORMAT_COLOR( 25, 32, THEMED_STYLE_INTENSE, XML_dk1 ),
325 : // 33...40: no effect, same as Chart2
326 : AUTOFORMAT_COLOR( 41, 48, THEMED_STYLE_INTENSE, XML_dk1 ),
327 : AUTOFORMAT_END()
328 : };
329 :
330 : static const AutoFormatEntry spUpDownBarLines[] =
331 : {
332 : AUTOFORMAT_COLOR( 1, 16, THEMED_STYLE_SUBTLE, XML_tx1 ),
333 : AUTOFORMAT_INVISIBLE( 17, 32 ),
334 : AUTOFORMAT_COLOR( 33, 34, THEMED_STYLE_SUBTLE, XML_dk1 ),
335 : AUTOFORMAT_ACCENTSMOD( 35, THEMED_STYLE_SUBTLE, XML_shade, 25000 ),
336 : AUTOFORMAT_INVISIBLE( 41, 48 ),
337 : AUTOFORMAT_END()
338 : };
339 :
340 : static const AutoFormatEntry spUpBarFills[] =
341 : {
342 : AUTOFORMAT_COLORMOD( 1, 1, THEMED_STYLE_SUBTLE, XML_dk1, XML_tint, 25000 ),
343 : AUTOFORMAT_COLORMOD( 2, 2, THEMED_STYLE_SUBTLE, XML_dk1, XML_tint, 5000 ),
344 : AUTOFORMAT_ACCENTSMOD( 3, THEMED_STYLE_SUBTLE, XML_tint, 25000 ),
345 : AUTOFORMAT_COLORMOD( 9, 9, THEMED_STYLE_SUBTLE, XML_dk1, XML_tint, 25000 ),
346 : AUTOFORMAT_COLORMOD( 10, 10, THEMED_STYLE_SUBTLE, XML_dk1, XML_tint, 5000 ),
347 : AUTOFORMAT_ACCENTSMOD( 11, THEMED_STYLE_SUBTLE, XML_tint, 25000 ),
348 : AUTOFORMAT_COLORMOD( 17, 17, THEMED_STYLE_INTENSE, XML_dk1, XML_tint, 25000 ),
349 : AUTOFORMAT_COLORMOD( 18, 18, THEMED_STYLE_INTENSE, XML_dk1, XML_tint, 5000 ),
350 : AUTOFORMAT_ACCENTSMOD( 19, THEMED_STYLE_INTENSE, XML_tint, 25000 ),
351 : AUTOFORMAT_COLORMOD( 25, 25, THEMED_STYLE_INTENSE, XML_dk1, XML_tint, 25000 ),
352 : AUTOFORMAT_COLORMOD( 26, 26, THEMED_STYLE_INTENSE, XML_dk1, XML_tint, 5000 ),
353 : AUTOFORMAT_ACCENTSMOD( 27, THEMED_STYLE_INTENSE, XML_tint, 25000 ),
354 : AUTOFORMAT_COLOR( 33, 40, THEMED_STYLE_SUBTLE, XML_lt1 ),
355 : AUTOFORMAT_COLORMOD( 41, 41, THEMED_STYLE_INTENSE, XML_dk1, XML_tint, 25000 ),
356 : AUTOFORMAT_COLOR( 42, 42, THEMED_STYLE_INTENSE, XML_lt1 ),
357 : AUTOFORMAT_ACCENTSMOD( 43, THEMED_STYLE_INTENSE, XML_tint, 25000 ),
358 : AUTOFORMAT_END()
359 : };
360 :
361 : static const AutoFormatEntry spDownBarFills[] =
362 : {
363 : AUTOFORMAT_COLORMOD( 1, 1, THEMED_STYLE_SUBTLE, XML_dk1, XML_tint, 85000 ),
364 : AUTOFORMAT_COLORMOD( 2, 2, THEMED_STYLE_SUBTLE, XML_dk1, XML_tint, 95000 ),
365 : AUTOFORMAT_ACCENTSMOD( 3, THEMED_STYLE_SUBTLE, XML_shade, 25000 ),
366 : AUTOFORMAT_COLORMOD( 9, 9, THEMED_STYLE_SUBTLE, XML_dk1, XML_tint, 85000 ),
367 : AUTOFORMAT_COLORMOD( 10, 10, THEMED_STYLE_SUBTLE, XML_dk1, XML_tint, 95000 ),
368 : AUTOFORMAT_ACCENTSMOD( 11, THEMED_STYLE_SUBTLE, XML_shade, 25000 ),
369 : AUTOFORMAT_COLORMOD( 17, 17, THEMED_STYLE_INTENSE, XML_dk1, XML_tint, 85000 ),
370 : AUTOFORMAT_COLORMOD( 18, 18, THEMED_STYLE_INTENSE, XML_dk1, XML_tint, 95000 ),
371 : AUTOFORMAT_ACCENTSMOD( 19, THEMED_STYLE_INTENSE, XML_shade, 25000 ),
372 : AUTOFORMAT_COLORMOD( 25, 25, THEMED_STYLE_INTENSE, XML_dk1, XML_tint, 85000 ),
373 : AUTOFORMAT_COLORMOD( 26, 26, THEMED_STYLE_INTENSE, XML_dk1, XML_tint, 95000 ),
374 : AUTOFORMAT_ACCENTSMOD( 27, THEMED_STYLE_INTENSE, XML_shade, 25000 ),
375 : AUTOFORMAT_COLORMOD( 33, 33, THEMED_STYLE_SUBTLE, XML_dk1, XML_tint, 85000 ),
376 : AUTOFORMAT_COLORMOD( 34, 34, THEMED_STYLE_SUBTLE, XML_dk1, XML_tint, 95000 ),
377 : AUTOFORMAT_ACCENTSMOD( 27, THEMED_STYLE_SUBTLE, XML_shade, 25000 ),
378 : AUTOFORMAT_COLORMOD( 41, 41, THEMED_STYLE_INTENSE, XML_dk1, XML_tint, 85000 ),
379 : AUTOFORMAT_COLOR( 42, 42, THEMED_STYLE_INTENSE, XML_dk1 ),
380 : AUTOFORMAT_ACCENTSMOD( 43, THEMED_STYLE_INTENSE, XML_shade, 25000 ),
381 : AUTOFORMAT_END()
382 : };
383 :
384 : static const AutoFormatEntry spUpDownBarEffects[] =
385 : {
386 : // 1...8: no effect, same as Chart2
387 : AUTOFORMAT_COLOR( 9, 16, THEMED_STYLE_SUBTLE, XML_dk1 ),
388 : AUTOFORMAT_COLOR( 17, 24, THEMED_STYLE_MODERATE, XML_dk1 ),
389 : AUTOFORMAT_COLOR( 25, 32, THEMED_STYLE_INTENSE, XML_dk1 ),
390 : // 33...40: no effect, same as Chart2
391 : AUTOFORMAT_COLOR( 41, 48, THEMED_STYLE_INTENSE, XML_dk1 ),
392 : AUTOFORMAT_END()
393 : };
394 :
395 : #undef AUTOFORMAT_COLOR
396 : #undef AUTOFORMAT_COLORMOD
397 : #undef AUTOFORMAT_ACCENTSMOD
398 : #undef AUTOFORMAT_PATTERN
399 : #undef AUTOFORMAT_FADED
400 : #undef AUTOFORMAT_FADEDACCENTS
401 : #undef AUTOFORMAT_INVISIBLE
402 : #undef AUTOFORMAT_END
403 :
404 156 : const AutoFormatEntry* lclGetAutoFormatEntry( const AutoFormatEntry* pEntries, sal_Int32 nStyle )
405 : {
406 198 : for( ; pEntries && (pEntries->mnFirstStyleIdx >= 0); ++pEntries )
407 98 : if( (pEntries->mnFirstStyleIdx <= nStyle) && (nStyle <= pEntries->mnLastStyleIdx) )
408 56 : return pEntries;
409 100 : return 0;
410 : }
411 :
412 : // ----------------------------------------------------------------------------
413 :
414 : struct AutoTextEntry
415 : {
416 : sal_Int32 mnFirstStyleIdx; /// First chart style index.
417 : sal_Int32 mnLastStyleIdx; /// Last chart style index.
418 : sal_Int32 mnThemedFont; /// Themed font (minor/major).
419 : sal_Int32 mnColorToken; /// Theme color token.
420 : sal_Int32 mnDefFontSize; /// Default font size (1/100 points).
421 : sal_Int32 mnRelFontSize; /// Font size relative to chart global font (percent).
422 : bool mbBold; /// True = bold font.
423 : };
424 :
425 : #define AUTOTEXT_COLOR( first, last, themed_font, color_token, def_font_size, rel_font_size, bold ) \
426 : { first, last, themed_font, color_token, def_font_size, rel_font_size, bold }
427 :
428 : #define AUTOTEXT_END() \
429 : AUTOTEXT_COLOR( -1, -1, XML_none, XML_TOKEN_INVALID, 1000, 100, false )
430 :
431 : static const AutoTextEntry spChartTitleTexts[] =
432 : {
433 : AUTOTEXT_COLOR( 1, 40, XML_minor, XML_tx1, 1800, 120, true ),
434 : AUTOTEXT_COLOR( 41, 48, XML_minor, XML_lt1, 1800, 120, true ),
435 : AUTOTEXT_END()
436 : };
437 :
438 : static const AutoTextEntry spAxisTitleTexts[] =
439 : {
440 : AUTOTEXT_COLOR( 1, 40, XML_minor, XML_tx1, 1000, 100, true ),
441 : AUTOTEXT_COLOR( 41, 48, XML_minor, XML_lt1, 1000, 100, true ),
442 : AUTOTEXT_END()
443 : };
444 :
445 : static const AutoTextEntry spOtherTexts[] =
446 : {
447 : AUTOTEXT_COLOR( 1, 40, XML_minor, XML_tx1, 1000, 100, false ),
448 : AUTOTEXT_COLOR( 41, 48, XML_minor, XML_lt1, 1000, 100, false ),
449 : AUTOTEXT_END()
450 : };
451 :
452 : #undef AUTOTEXT_COLOR
453 : #undef AUTOTEXT_END
454 :
455 52 : const AutoTextEntry* lclGetAutoTextEntry( const AutoTextEntry* pEntries, sal_Int32 nStyle )
456 : {
457 52 : for( ; pEntries && (pEntries->mnFirstStyleIdx >= 0); ++pEntries )
458 16 : if( (pEntries->mnFirstStyleIdx <= nStyle) && (nStyle <= pEntries->mnLastStyleIdx) )
459 16 : return pEntries;
460 36 : return 0;
461 : }
462 :
463 : // ----------------------------------------------------------------------------
464 :
465 : /** Property identifiers for common chart objects, to be used in ShapePropertyInfo. */
466 : static const sal_Int32 spnCommonPropIds[] =
467 : {
468 : PROP_LineStyle, PROP_LineWidth, PROP_LineColor, PROP_LineTransparence, PROP_LineDashName,
469 : PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID,
470 : PROP_FillStyle, PROP_FillColor, PROP_FillTransparence, PROP_FillGradientName,
471 : PROP_FillBitmapName, PROP_FillBitmapMode, PROP_FillBitmapSizeX, PROP_FillBitmapSizeY,
472 : PROP_FillBitmapPositionOffsetX, PROP_FillBitmapPositionOffsetY, PROP_FillBitmapRectanglePoint
473 : };
474 :
475 : /** Property identifiers for linear data series, to be used in ShapePropertyInfo. */
476 : static const sal_Int32 spnLinearPropIds[] =
477 : {
478 : PROP_LineStyle, PROP_LineWidth, PROP_Color, PROP_Transparency, PROP_LineDashName,
479 : PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID,
480 : PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID,
481 : PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID,
482 : PROP_INVALID, PROP_INVALID, PROP_INVALID
483 : };
484 :
485 : /** Property identifiers for filled data series, to be used in ShapePropertyInfo. */
486 : static const sal_Int32 spnFilledPropIds[] =
487 : {
488 : PROP_BorderStyle, PROP_BorderWidth, PROP_BorderColor, PROP_BorderTransparency, PROP_BorderDashName,
489 : PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID,
490 : PROP_FillStyle, PROP_Color, PROP_Transparency, PROP_GradientName,
491 : PROP_FillBitmapName, PROP_FillBitmapMode, PROP_FillBitmapSizeX, PROP_FillBitmapSizeY,
492 : PROP_FillBitmapPositionOffsetX, PROP_FillBitmapPositionOffsetY, PROP_FillBitmapRectanglePoint
493 : };
494 :
495 : /** Property info for common chart objects, to be used in ShapePropertyMap. */
496 47 : static const ShapePropertyInfo saCommonPropInfo( spnCommonPropIds, false, true, true, true );
497 : /** Property info for linear data series, to be used in ShapePropertyMap. */
498 47 : static const ShapePropertyInfo saLinearPropInfo( spnLinearPropIds, false, true, true, true );
499 : /** Property info for filled data series, to be used in ShapePropertyMap. */
500 47 : static const ShapePropertyInfo saFilledPropInfo( spnFilledPropIds, false, true, true, true );
501 :
502 : // ----------------------------------------------------------------------------
503 :
504 : /** Contains information about formatting of a specific chart object type. */
505 : struct ObjectTypeFormatEntry
506 : {
507 : ObjectType meObjType; /// Object type for automatic format.
508 : const ShapePropertyInfo* mpPropInfo; /// Property info for the ShapePropertyMap class.
509 : const AutoFormatEntry* mpAutoLines; /// Automatic line formatting for all chart styles.
510 : const AutoFormatEntry* mpAutoFills; /// Automatic fill formatting for all chart styles.
511 : const AutoFormatEntry* mpAutoEffects; /// Automatic effect formatting for all chart styles.
512 : const AutoTextEntry* mpAutoTexts; /// Automatic text attributes for all chart styles.
513 : bool mbIsFrame; /// True = object is a frame, false = object is a line.
514 : };
515 :
516 : #define TYPEFORMAT_FRAME( obj_type, prop_type, auto_texts, auto_lines, auto_fills, auto_effects ) \
517 : { obj_type, prop_type, auto_lines, auto_fills, auto_effects, auto_texts, true }
518 :
519 : #define TYPEFORMAT_LINE( obj_type, prop_type, auto_texts, auto_lines ) \
520 : { obj_type, prop_type, auto_lines, 0, 0, auto_texts, false }
521 :
522 : static const ObjectTypeFormatEntry spObjTypeFormatEntries[] =
523 : {
524 : // object type property info auto text auto line auto fill auto effect
525 : TYPEFORMAT_FRAME( OBJECTTYPE_CHARTSPACE, &saCommonPropInfo, 0, spNoFormats, spNoFormats, 0 /* eq to Ch2 */ ),
526 : TYPEFORMAT_FRAME( OBJECTTYPE_CHARTTITLE, &saCommonPropInfo, spChartTitleTexts, 0 /* eq to Ch2 */, 0 /* eq to Ch2 */, 0 /* eq to Ch2 */ ),
527 : TYPEFORMAT_FRAME( OBJECTTYPE_LEGEND, &saCommonPropInfo, spOtherTexts, spNoFormats, spNoFormats, 0 /* eq to Ch2 */ ),
528 : TYPEFORMAT_FRAME( OBJECTTYPE_PLOTAREA2D, &saCommonPropInfo, 0, 0 /* eq to Ch2 */, spPlotArea2dFills, 0 /* eq to Ch2 */ ),
529 : TYPEFORMAT_FRAME( OBJECTTYPE_PLOTAREA3D, &saCommonPropInfo, 0, 0 /* eq to Ch2 */, 0 /* eq to Ch2 */, 0 /* eq to Ch2 */ ),
530 : TYPEFORMAT_FRAME( OBJECTTYPE_WALL, &saCommonPropInfo, 0, spWallFloorLines, spWallFloorFills, 0 /* eq to Ch2 */ ),
531 : TYPEFORMAT_FRAME( OBJECTTYPE_FLOOR, &saCommonPropInfo, 0, spWallFloorLines, spWallFloorFills, 0 /* eq to Ch2 */ ),
532 : TYPEFORMAT_LINE( OBJECTTYPE_AXIS, &saCommonPropInfo, spOtherTexts, spAxisLines ),
533 : TYPEFORMAT_FRAME( OBJECTTYPE_AXISTITLE, &saCommonPropInfo, spAxisTitleTexts, 0 /* eq to Ch2 */, 0 /* eq to Ch2 */, 0 /* eq to Ch2 */ ),
534 : TYPEFORMAT_FRAME( OBJECTTYPE_AXISUNIT, &saCommonPropInfo, spAxisTitleTexts, 0 /* eq in Ch2 */, 0 /* eq in Ch2 */, 0 /* eq in Ch2 */ ),
535 : TYPEFORMAT_LINE( OBJECTTYPE_MAJORGRIDLINE, &saCommonPropInfo, 0, spMajorGridLines ),
536 : TYPEFORMAT_LINE( OBJECTTYPE_MINORGRIDLINE, &saCommonPropInfo, 0, spMinorGridLines ),
537 : TYPEFORMAT_LINE( OBJECTTYPE_LINEARSERIES2D, &saLinearPropInfo, 0, spLinearSeriesLines ),
538 : TYPEFORMAT_FRAME( OBJECTTYPE_FILLEDSERIES2D, &saFilledPropInfo, 0, spFilledSeriesLines, spFilledSeries2dFills, spFilledSeriesEffects ),
539 : TYPEFORMAT_FRAME( OBJECTTYPE_FILLEDSERIES3D, &saFilledPropInfo, 0, spFilledSeriesLines, spFilledSeries3dFills, spFilledSeriesEffects ),
540 : TYPEFORMAT_FRAME( OBJECTTYPE_DATALABEL, &saCommonPropInfo, spOtherTexts, 0 /* eq to Ch2 */, 0 /* eq to Ch2 */, 0 /* eq to Ch2 */ ),
541 : TYPEFORMAT_LINE( OBJECTTYPE_TRENDLINE, &saCommonPropInfo, 0, spOtherLines ),
542 : TYPEFORMAT_FRAME( OBJECTTYPE_TRENDLINELABEL, &saCommonPropInfo, spOtherTexts, 0 /* eq to Ch2 */, 0 /* eq to Ch2 */, 0 /* eq to Ch2 */ ),
543 : TYPEFORMAT_LINE( OBJECTTYPE_ERRORBAR, &saCommonPropInfo, 0, spOtherLines ),
544 : TYPEFORMAT_LINE( OBJECTTYPE_SERLINE, &saCommonPropInfo, 0, spOtherLines ),
545 : TYPEFORMAT_LINE( OBJECTTYPE_LEADERLINE, &saCommonPropInfo, 0, spOtherLines ),
546 : TYPEFORMAT_LINE( OBJECTTYPE_DROPLINE, &saCommonPropInfo, 0, spOtherLines ),
547 : TYPEFORMAT_LINE( OBJECTTYPE_HILOLINE, &saLinearPropInfo, 0, spOtherLines ),
548 : TYPEFORMAT_FRAME( OBJECTTYPE_UPBAR, &saCommonPropInfo, 0, spUpDownBarLines, spUpBarFills, spUpDownBarEffects ),
549 : TYPEFORMAT_FRAME( OBJECTTYPE_DOWNBAR, &saCommonPropInfo, 0, spUpDownBarLines, spDownBarFills, spUpDownBarEffects ),
550 : TYPEFORMAT_LINE( OBJECTTYPE_DATATABLE, &saCommonPropInfo, spOtherTexts, spDataTableLines )
551 : };
552 :
553 : #undef TYPEFORMAT_FRAME
554 : #undef TYPEFORMAT_LINE
555 :
556 : // ----------------------------------------------------------------------------
557 :
558 0 : void lclConvertPictureOptions( FillProperties& orFillProps, const PictureOptionsModel& rPicOptions )
559 : {
560 0 : bool bStacked = (rPicOptions.mnPictureFormat == XML_stack) || (rPicOptions.mnPictureFormat == XML_stackScale);
561 0 : orFillProps.maBlipProps.moBitmapMode = bStacked ? XML_tile : XML_stretch;
562 0 : }
563 :
564 : } // namespace
565 :
566 : // ============================================================================
567 :
568 : struct ObjectFormatterData;
569 :
570 : // ----------------------------------------------------------------------------
571 :
572 208 : class DetailFormatterBase
573 : {
574 : public:
575 : explicit DetailFormatterBase(
576 : ObjectFormatterData& rData,
577 : const AutoFormatEntry* pAutoFormatEntry );
578 : explicit DetailFormatterBase(
579 : ObjectFormatterData& rData,
580 : const AutoTextEntry* pAutoTextEntry );
581 :
582 : protected:
583 : /** Returns the placeholder color which may depend on the passed series index. */
584 : sal_Int32 getPhColor( sal_Int32 nSeriesIdx ) const;
585 :
586 : private:
587 : /** Resolves and returns the scheme color with the passed transformation. */
588 : sal_Int32 getSchemeColor( sal_Int32 nColorToken, sal_Int32 nModToken, sal_Int32 nModValue ) const;
589 :
590 : protected:
591 : typedef ::std::vector< sal_Int32 > ColorPatternVec;
592 :
593 : ObjectFormatterData& mrData; /// Shared formatter data.
594 : sal_Int32 mnPhClr; /// RGB placeholder color for themed style.
595 : ColorPatternVec maColorPattern; /// Different cycling colors for data series.
596 : };
597 :
598 : // ----------------------------------------------------------------------------
599 :
600 52 : class LineFormatter : public DetailFormatterBase
601 : {
602 : public:
603 : explicit LineFormatter(
604 : ObjectFormatterData& rData,
605 : const AutoFormatEntry* pAutoFormatEntry );
606 :
607 : /** Converts line formatting to the passed property set. */
608 : void convertFormatting(
609 : ShapePropertyMap& rPropMap,
610 : const ModelRef< Shape >& rxShapeProp,
611 : sal_Int32 nSeriesIdx );
612 :
613 : private:
614 : LinePropertiesPtr mxAutoLine; /// Automatic line properties.
615 : };
616 :
617 : // ----------------------------------------------------------------------------
618 :
619 52 : class FillFormatter : public DetailFormatterBase
620 : {
621 : public:
622 : explicit FillFormatter(
623 : ObjectFormatterData& rData,
624 : const AutoFormatEntry* pAutoFormatEntry );
625 :
626 : /** Converts area formatting to the passed property set. */
627 : void convertFormatting(
628 : ShapePropertyMap& rPropMap,
629 : const ModelRef< Shape >& rxShapeProp,
630 : const PictureOptionsModel* pPicOptions,
631 : sal_Int32 nSeriesIdx );
632 :
633 : private:
634 : FillPropertiesPtr mxAutoFill; /// Automatic fill properties.
635 : };
636 :
637 : // ----------------------------------------------------------------------------
638 :
639 52 : class EffectFormatter : public DetailFormatterBase
640 : {
641 : public:
642 : explicit EffectFormatter(
643 : ObjectFormatterData& rData,
644 : const AutoFormatEntry* pAutoFormatEntry );
645 :
646 : /** Converts effect formatting to the passed property set. */
647 : void convertFormatting(
648 : ShapePropertyMap& rPropMap,
649 : const ModelRef< Shape >& rxShapeProp,
650 : sal_Int32 nSeriesIdx ) const;
651 : };
652 :
653 : // ----------------------------------------------------------------------------
654 :
655 52 : class TextFormatter : public DetailFormatterBase
656 : {
657 : public:
658 : explicit TextFormatter(
659 : ObjectFormatterData& rData,
660 : const AutoTextEntry* pAutoTextEntry,
661 : const ModelRef< TextBody >& rxGlobalTextProp );
662 :
663 : /** Converts text formatting to the passed property set. */
664 : void convertFormatting(
665 : PropertySet& rPropSet,
666 : const TextCharacterProperties* pTextProps );
667 : /** Converts text formatting to the passed property set. */
668 : void convertFormatting(
669 : PropertySet& rPropSet,
670 : const ModelRef< TextBody >& rxTextProp );
671 :
672 : private:
673 : TextCharacterPropertiesPtr mxAutoText; /// Automatic text properties.
674 : };
675 :
676 : // ----------------------------------------------------------------------------
677 :
678 : /** Formatter for a specific object type. */
679 52 : class ObjectTypeFormatter
680 : {
681 : public:
682 : explicit ObjectTypeFormatter(
683 : ObjectFormatterData& rData,
684 : const ObjectTypeFormatEntry& rEntry,
685 : const ChartSpaceModel& rChartSpace );
686 :
687 : /** Sets frame formatting properties to the passed property set. */
688 : void convertFrameFormatting(
689 : PropertySet& rPropSet,
690 : const ModelRef< Shape >& rxShapeProp,
691 : const PictureOptionsModel* pPicOptions,
692 : sal_Int32 nSeriesIdx );
693 :
694 : /** Sets text formatting properties to the passed property set. */
695 : void convertTextFormatting(
696 : PropertySet& rPropSet,
697 : const ModelRef< TextBody >& rxTextProp );
698 :
699 : /** Sets frame/text formatting properties to the passed property set. */
700 : void convertFormatting(
701 : PropertySet& rPropSet,
702 : const ModelRef< Shape >& rxShapeProp,
703 : const ModelRef< TextBody >& rxTextProp );
704 :
705 : /** Sets text formatting properties to the passed property set. */
706 : void convertTextFormatting(
707 : PropertySet& rPropSet,
708 : const TextCharacterProperties& rTextProps );
709 :
710 : /** Sets automatic fill properties to the passed property set. */
711 : void convertAutomaticFill(
712 : PropertySet& rPropSet,
713 : sal_Int32 nSeriesIdx );
714 :
715 : private:
716 : LineFormatter maLineFormatter; /// Converter for line formatting.
717 : FillFormatter maFillFormatter; /// Converter for fill formatting.
718 : EffectFormatter maEffectFormatter; /// Converter for effect formatting.
719 : TextFormatter maTextFormatter; /// Converter for text formatting.
720 : ModelObjectHelper& mrModelObjHelper; /// Helper for named drawing formatting.
721 : const ObjectTypeFormatEntry& mrEntry; /// Additional settings.
722 : };
723 :
724 : // ----------------------------------------------------------------------------
725 :
726 2 : struct ObjectFormatterData
727 : {
728 : typedef RefMap< ObjectType, ObjectTypeFormatter > ObjectTypeFormatterMap;
729 :
730 : const XmlFilterBase& mrFilter; /// Base filter object.
731 : ObjectTypeFormatterMap maTypeFormatters; /// Formatters for all types of objects in a chart.
732 : ModelObjectHelper maModelObjHelper; /// Helper for named drawing formatting (dashes, gradients, bitmaps).
733 : Reference< XNumberFormats > mxNumFmts; /// Number formats collection of container document.
734 : Reference< XNumberFormatTypes > mxNumTypes; /// Number format types collection of container document.
735 : Locale maEnUsLocale; /// Locale struct containing en-US.
736 : Locale maFromLocale; /// Empty locale struct.
737 : sal_Int32 mnMaxSeriesIdx; /// Maximum series index used for color cycling/fading.
738 :
739 : explicit ObjectFormatterData(
740 : const XmlFilterBase& rFilter,
741 : const Reference< XChartDocument >& rxChartDoc,
742 : const ChartSpaceModel& rChartSpace );
743 :
744 : ObjectTypeFormatter* getTypeFormatter( ObjectType eObjType );
745 : };
746 :
747 : // ============================================================================
748 :
749 156 : DetailFormatterBase::DetailFormatterBase( ObjectFormatterData& rData, const AutoFormatEntry* pAutoFormatEntry ) :
750 : mrData( rData ),
751 156 : mnPhClr( -1 )
752 : {
753 156 : if( pAutoFormatEntry )
754 : {
755 56 : if( pAutoFormatEntry->mpPattern )
756 : {
757 : // prepare multi-color pattern
758 42 : for( const AutoFormatPatternEntry* pPatternEntry = pAutoFormatEntry->mpPattern; pPatternEntry->mnColorToken != XML_TOKEN_INVALID; ++pPatternEntry )
759 36 : maColorPattern.push_back( getSchemeColor( pPatternEntry->mnColorToken, pPatternEntry->mnModToken, pPatternEntry->mnModValue ) );
760 : }
761 50 : else if( pAutoFormatEntry->mnColorToken != XML_TOKEN_INVALID )
762 : {
763 : // prepare color or single-color pattern (color fading)
764 34 : mnPhClr = getSchemeColor( pAutoFormatEntry->mnColorToken, pAutoFormatEntry->mnModToken, pAutoFormatEntry->mnModValue );
765 34 : if( pAutoFormatEntry->mbFadedColor )
766 0 : maColorPattern.push_back( mnPhClr );
767 : }
768 : }
769 156 : }
770 :
771 52 : DetailFormatterBase::DetailFormatterBase( ObjectFormatterData& rData, const AutoTextEntry* pAutoTextEntry ) :
772 : mrData( rData ),
773 52 : mnPhClr( -1 )
774 : {
775 52 : if( pAutoTextEntry && (pAutoTextEntry->mnColorToken != XML_TOKEN_INVALID) )
776 16 : mnPhClr = getSchemeColor( pAutoTextEntry->mnColorToken, XML_TOKEN_INVALID, 0 );
777 52 : }
778 :
779 41 : sal_Int32 DetailFormatterBase::getPhColor( sal_Int32 nSeriesIdx ) const
780 : {
781 41 : if( maColorPattern.empty() || (mrData.mnMaxSeriesIdx < 0) || (nSeriesIdx < 0) )
782 39 : return mnPhClr;
783 :
784 : /* Apply tint/shade depending on the cycle index. The colors of leading
785 : series are darkened (color shade), the colors of trailing series are
786 : lightened (color tint). Shade/tint is applied in an exclusive range of
787 : -70% to 70%.
788 :
789 : Example 1: 3 data series using single-color shading with accent color 1
790 : (e.g. automatic chart style #3). Shade/tint is applied per series.
791 : Shade/tint changes in steps of 140%/(<series_count+1) = 140%/4 = 35%,
792 : starting at -70%:
793 : Step 1: -70% -> Not used.
794 : Step 2: -35% -> Series 1 has 35% shade of accent color 1.
795 : Step 3: 0% -> Series 2 has pure accent color 1.
796 : Step 4: 35% -> Series 3 has 35% tint of accent color 1.
797 : Step 5: 70% -> Not used.
798 :
799 : Example 2: 20 data series using accent color pattern (e.g. automatic
800 : chart style #2). Each color cycle has a size of 6 series (accent colors
801 : 1 to 6). Shade/tint is applied per color cycle.
802 : Cycle #1: Series 1...6 are based on accent colors 1 to 6.
803 : Cycle #2: Series 7...12 are based on accent colors 1 to 6.
804 : Cycle #3: Series 13...18 are based on accent colors 1 to 6.
805 : Cycle #4: Series 19...20 are based on accent colors 1 to 2.
806 : Shade/tint changes in steps of 140%/(cycle_count+1) = 140%/5 = 28%,
807 : starting at -70%:
808 : Step 1: -70% -> Not used.
809 : Step 2: -42% -> Cycle #1 has 42% shade of accent colors 1...6
810 : step 3: -14% -> Cycle #2 has 14% shade of accent colors 1...6
811 : step 4: 14% -> Cycle #3 has 14% tint of accent colors 1...6
812 : step 5: 42% -> Cycle #4 has 42% tint of accent colors 1...6
813 : step 6: 70% -> Not used.
814 : */
815 2 : sal_Int32 nPhClr = maColorPattern[ static_cast< size_t >( nSeriesIdx % maColorPattern.size() ) ];
816 2 : size_t nCycleIdx = static_cast< size_t >( nSeriesIdx / maColorPattern.size() );
817 2 : size_t nMaxCycleIdx = static_cast< size_t >( mrData.mnMaxSeriesIdx / maColorPattern.size() );
818 2 : double fShadeTint = static_cast< double >( nCycleIdx + 1 ) / (nMaxCycleIdx + 2) * 1.4 - 0.7;
819 2 : if( fShadeTint != 0.0 )
820 : {
821 0 : Color aColor;
822 0 : aColor.setSrgbClr( nPhClr );
823 0 : aColor.addChartTintTransformation( fShadeTint );
824 0 : nPhClr = aColor.getColor( mrData.mrFilter.getGraphicHelper() );
825 : }
826 :
827 2 : return nPhClr;
828 : }
829 :
830 86 : sal_Int32 DetailFormatterBase::getSchemeColor( sal_Int32 nColorToken, sal_Int32 nModToken, sal_Int32 nModValue ) const
831 : {
832 86 : Color aColor;
833 86 : aColor.setSchemeClr( nColorToken );
834 86 : if( nModToken != XML_TOKEN_INVALID )
835 16 : aColor.addTransformation( nModToken, nModValue );
836 86 : return aColor.getColor( mrData.mrFilter.getGraphicHelper() );
837 : }
838 :
839 : // ============================================================================
840 :
841 52 : LineFormatter::LineFormatter( ObjectFormatterData& rData, const AutoFormatEntry* pAutoFormatEntry ) :
842 52 : DetailFormatterBase( rData, pAutoFormatEntry )
843 : {
844 52 : if( pAutoFormatEntry )
845 : {
846 38 : mxAutoLine.reset( new LineProperties );
847 38 : mxAutoLine->maLineFill.moFillType = XML_noFill;
848 38 : if( const Theme* pTheme = mrData.mrFilter.getCurrentTheme() )
849 38 : if( const LineProperties* pLineProps = pTheme->getLineStyle( pAutoFormatEntry->mnThemedIdx ) )
850 0 : *mxAutoLine = *pLineProps;
851 : // change line width according to chart auto style
852 38 : if( mxAutoLine->moLineWidth.has() )
853 0 : mxAutoLine->moLineWidth = mxAutoLine->moLineWidth.get() * pAutoFormatEntry->mnRelLineWidth / 100;
854 : }
855 52 : }
856 :
857 17 : void LineFormatter::convertFormatting( ShapePropertyMap& rPropMap, const ModelRef< Shape >& rxShapeProp, sal_Int32 nSeriesIdx )
858 : {
859 17 : LineProperties aLineProps;
860 17 : if( mxAutoLine.get() )
861 13 : aLineProps.assignUsed( *mxAutoLine );
862 17 : if( rxShapeProp.is() )
863 14 : aLineProps.assignUsed( rxShapeProp->getLineProperties() );
864 17 : aLineProps.pushToPropMap( rPropMap, mrData.mrFilter.getGraphicHelper(), getPhColor( nSeriesIdx ) );
865 17 : }
866 :
867 : // ============================================================================
868 :
869 52 : FillFormatter::FillFormatter( ObjectFormatterData& rData, const AutoFormatEntry* pAutoFormatEntry ) :
870 52 : DetailFormatterBase( rData, pAutoFormatEntry )
871 : {
872 52 : if( pAutoFormatEntry )
873 : {
874 18 : mxAutoFill.reset( new FillProperties );
875 18 : mxAutoFill->moFillType = XML_noFill;
876 18 : if( const Theme* pTheme = mrData.mrFilter.getCurrentTheme() )
877 18 : if( const FillProperties* pFillProps = pTheme->getFillStyle( pAutoFormatEntry->mnThemedIdx ) )
878 0 : *mxAutoFill = *pFillProps;
879 : }
880 52 : }
881 :
882 8 : void FillFormatter::convertFormatting( ShapePropertyMap& rPropMap, const ModelRef< Shape >& rxShapeProp, const PictureOptionsModel* pPicOptions, sal_Int32 nSeriesIdx )
883 : {
884 8 : FillProperties aFillProps;
885 8 : if( mxAutoFill.get() )
886 6 : aFillProps.assignUsed( *mxAutoFill );
887 8 : if( rxShapeProp.is() )
888 6 : aFillProps.assignUsed( rxShapeProp->getFillProperties() );
889 8 : if( pPicOptions )
890 0 : lclConvertPictureOptions( aFillProps, *pPicOptions );
891 8 : aFillProps.pushToPropMap( rPropMap, mrData.mrFilter.getGraphicHelper(), 0, getPhColor( nSeriesIdx ) );
892 8 : }
893 :
894 : // ============================================================================
895 :
896 52 : EffectFormatter::EffectFormatter( ObjectFormatterData& rData, const AutoFormatEntry* pAutoFormatEntry ) :
897 52 : DetailFormatterBase( rData, pAutoFormatEntry )
898 : {
899 52 : }
900 : //TODO :
901 17 : void EffectFormatter::convertFormatting( ShapePropertyMap& /*rPropMap*/, const ModelRef< Shape >& /*rxShapeProp*/, sal_Int32 /*nSeriesIdx*/ ) const
902 : {
903 17 : }
904 :
905 : // ============================================================================
906 :
907 : namespace {
908 :
909 24 : const TextCharacterProperties* lclGetTextProperties( const ModelRef< TextBody >& rxTextProp )
910 : {
911 24 : return (rxTextProp.is() && !rxTextProp->getParagraphs().empty()) ?
912 24 : &rxTextProp->getParagraphs().front()->getProperties().getTextCharacterProperties() : 0;
913 : }
914 :
915 : } // namespace
916 :
917 52 : TextFormatter::TextFormatter( ObjectFormatterData& rData, const AutoTextEntry* pAutoTextEntry, const ModelRef< TextBody >& rxGlobalTextProp ) :
918 52 : DetailFormatterBase( rData, pAutoTextEntry )
919 : {
920 52 : if( pAutoTextEntry )
921 : {
922 16 : mxAutoText.reset( new TextCharacterProperties );
923 16 : if( const Theme* pTheme = mrData.mrFilter.getCurrentTheme() )
924 16 : if( const TextCharacterProperties* pTextProps = pTheme->getFontStyle( pAutoTextEntry->mnThemedFont ) )
925 0 : *mxAutoText = *pTextProps;
926 16 : sal_Int32 nTextColor = getPhColor( -1 );
927 16 : if( nTextColor >= 0 )
928 0 : mxAutoText->maCharColor.setSrgbClr( nTextColor );
929 16 : mxAutoText->moHeight = pAutoTextEntry->mnDefFontSize;
930 16 : mxAutoText->moBold = pAutoTextEntry->mbBold;
931 :
932 16 : if( const TextCharacterProperties* pTextProps = lclGetTextProperties( rxGlobalTextProp ) )
933 : {
934 0 : mxAutoText->assignUsed( *pTextProps );
935 0 : if( pTextProps->moHeight.has() )
936 0 : mxAutoText->moHeight = pTextProps->moHeight.get() * pAutoTextEntry->mnRelFontSize / 100;
937 : }
938 : }
939 52 : }
940 :
941 8 : void TextFormatter::convertFormatting( PropertySet& rPropSet, const TextCharacterProperties* pTextProps )
942 : {
943 8 : TextCharacterProperties aTextProps;
944 8 : if( mxAutoText.get() )
945 8 : aTextProps.assignUsed( *mxAutoText );
946 8 : if( pTextProps )
947 0 : aTextProps.assignUsed( *pTextProps );
948 8 : aTextProps.pushToPropSet( rPropSet, mrData.mrFilter );
949 8 : }
950 :
951 8 : void TextFormatter::convertFormatting( PropertySet& rPropSet, const ModelRef< TextBody >& rxTextProp )
952 : {
953 8 : convertFormatting( rPropSet, lclGetTextProperties( rxTextProp ) );
954 8 : }
955 :
956 : // ============================================================================
957 :
958 52 : ObjectTypeFormatter::ObjectTypeFormatter( ObjectFormatterData& rData, const ObjectTypeFormatEntry& rEntry, const ChartSpaceModel& rChartSpace ) :
959 : maLineFormatter( rData, lclGetAutoFormatEntry( rEntry.mpAutoLines, rChartSpace.mnStyle ) ),
960 : maFillFormatter( rData, lclGetAutoFormatEntry( rEntry.mpAutoFills, rChartSpace.mnStyle ) ),
961 : maEffectFormatter( rData, lclGetAutoFormatEntry( rEntry.mpAutoEffects, rChartSpace.mnStyle ) ),
962 : maTextFormatter( rData, lclGetAutoTextEntry( rEntry.mpAutoTexts, rChartSpace.mnStyle ), rChartSpace.mxTextProp ),
963 : mrModelObjHelper( rData.maModelObjHelper ),
964 52 : mrEntry( rEntry )
965 : {
966 52 : }
967 :
968 17 : void ObjectTypeFormatter::convertFrameFormatting( PropertySet& rPropSet, const ModelRef< Shape >& rxShapeProp, const PictureOptionsModel* pPicOptions, sal_Int32 nSeriesIdx )
969 : {
970 17 : ShapePropertyMap aPropMap( mrModelObjHelper, *mrEntry.mpPropInfo );
971 17 : maLineFormatter.convertFormatting( aPropMap, rxShapeProp, nSeriesIdx );
972 17 : if( mrEntry.mbIsFrame )
973 8 : maFillFormatter.convertFormatting( aPropMap, rxShapeProp, pPicOptions, nSeriesIdx );
974 17 : maEffectFormatter.convertFormatting( aPropMap, rxShapeProp, nSeriesIdx );
975 17 : rPropSet.setProperties( aPropMap );
976 17 : }
977 :
978 8 : void ObjectTypeFormatter::convertTextFormatting( PropertySet& rPropSet, const ModelRef< TextBody >& rxTextProp )
979 : {
980 8 : maTextFormatter.convertFormatting( rPropSet, rxTextProp );
981 8 : }
982 :
983 6 : void ObjectTypeFormatter::convertFormatting( PropertySet& rPropSet, const ModelRef< Shape >& rxShapeProp, const ModelRef< TextBody >& rxTextProp )
984 : {
985 6 : convertFrameFormatting( rPropSet, rxShapeProp, 0, -1 );
986 6 : convertTextFormatting( rPropSet, rxTextProp );
987 6 : }
988 :
989 0 : void ObjectTypeFormatter::convertTextFormatting( PropertySet& rPropSet, const TextCharacterProperties& rTextProps )
990 : {
991 0 : maTextFormatter.convertFormatting( rPropSet, &rTextProps );
992 0 : }
993 :
994 0 : void ObjectTypeFormatter::convertAutomaticFill( PropertySet& rPropSet, sal_Int32 nSeriesIdx )
995 : {
996 0 : ShapePropertyMap aPropMap( mrModelObjHelper, *mrEntry.mpPropInfo );
997 0 : ModelRef< Shape > xShapeProp;
998 0 : maFillFormatter.convertFormatting( aPropMap, xShapeProp, 0, nSeriesIdx );
999 0 : maEffectFormatter.convertFormatting( aPropMap, xShapeProp, nSeriesIdx );
1000 0 : rPropSet.setProperties( aPropMap );
1001 0 : }
1002 :
1003 : // ============================================================================
1004 :
1005 2 : ObjectFormatterData::ObjectFormatterData( const XmlFilterBase& rFilter, const Reference< XChartDocument >& rxChartDoc, const ChartSpaceModel& rChartSpace ) :
1006 : mrFilter( rFilter ),
1007 : maModelObjHelper( Reference< XMultiServiceFactory >( rxChartDoc, UNO_QUERY ) ),
1008 : maEnUsLocale( "en", "US", OUString() ),
1009 2 : mnMaxSeriesIdx( -1 )
1010 : {
1011 2 : const ObjectTypeFormatEntry* pEntryEnd = STATIC_ARRAY_END( spObjTypeFormatEntries );
1012 54 : for( const ObjectTypeFormatEntry* pEntry = spObjTypeFormatEntries; pEntry != pEntryEnd; ++pEntry )
1013 52 : maTypeFormatters[ pEntry->meObjType ].reset( new ObjectTypeFormatter( *this, *pEntry, rChartSpace ) );
1014 :
1015 : try
1016 : {
1017 2 : Reference< XNumberFormatsSupplier > xNumFmtsSupp( rxChartDoc, UNO_QUERY_THROW );
1018 2 : mxNumFmts = xNumFmtsSupp->getNumberFormats();
1019 2 : mxNumTypes.set( mxNumFmts, UNO_QUERY );
1020 : }
1021 0 : catch( Exception& )
1022 : {
1023 : }
1024 : OSL_ENSURE( mxNumFmts.is() && mxNumTypes.is(), "ObjectFormatterData::ObjectFormatterData - cannot get number formats" );
1025 2 : }
1026 :
1027 19 : ObjectTypeFormatter* ObjectFormatterData::getTypeFormatter( ObjectType eObjType )
1028 : {
1029 : OSL_ENSURE( maTypeFormatters.has( eObjType ), "ObjectFormatterData::getTypeFormatter - unknown object type" );
1030 19 : return maTypeFormatters.get( eObjType ).get();
1031 : }
1032 :
1033 : // ============================================================================
1034 :
1035 2 : ObjectFormatter::ObjectFormatter( const XmlFilterBase& rFilter, const Reference< XChartDocument >& rxChartDoc, const ChartSpaceModel& rChartSpace ) :
1036 2 : mxData( new ObjectFormatterData( rFilter, rxChartDoc, rChartSpace ) )
1037 : {
1038 2 : }
1039 :
1040 2 : ObjectFormatter::~ObjectFormatter()
1041 : {
1042 2 : }
1043 :
1044 2 : void ObjectFormatter::setMaxSeriesIndex( sal_Int32 nMaxSeriesIdx )
1045 : {
1046 2 : mxData->mnMaxSeriesIdx = nMaxSeriesIdx;
1047 2 : }
1048 :
1049 0 : sal_Int32 ObjectFormatter::getMaxSeriesIndex() const
1050 : {
1051 0 : return mxData->mnMaxSeriesIdx;
1052 : }
1053 :
1054 11 : void ObjectFormatter::convertFrameFormatting( PropertySet& rPropSet, const ModelRef< Shape >& rxShapeProp, ObjectType eObjType, sal_Int32 nSeriesIdx )
1055 : {
1056 11 : if( ObjectTypeFormatter* pFormat = mxData->getTypeFormatter( eObjType ) )
1057 11 : pFormat->convertFrameFormatting( rPropSet, rxShapeProp, 0, nSeriesIdx );
1058 11 : }
1059 :
1060 0 : void ObjectFormatter::convertFrameFormatting( PropertySet& rPropSet, const ModelRef< Shape >& rxShapeProp, const PictureOptionsModel& rPicOptions, ObjectType eObjType, sal_Int32 nSeriesIdx )
1061 : {
1062 0 : if( ObjectTypeFormatter* pFormat = mxData->getTypeFormatter( eObjType ) )
1063 0 : pFormat->convertFrameFormatting( rPropSet, rxShapeProp, &rPicOptions, nSeriesIdx );
1064 0 : }
1065 :
1066 2 : void ObjectFormatter::convertTextFormatting( PropertySet& rPropSet, const ModelRef< TextBody >& rxTextProp, ObjectType eObjType )
1067 : {
1068 2 : if( ObjectTypeFormatter* pFormat = mxData->getTypeFormatter( eObjType ) )
1069 2 : pFormat->convertTextFormatting( rPropSet, rxTextProp );
1070 2 : }
1071 :
1072 6 : void ObjectFormatter::convertFormatting( PropertySet& rPropSet, const ModelRef< Shape >& rxShapeProp, const ModelRef< TextBody >& rxTextProp, ObjectType eObjType )
1073 : {
1074 6 : if( ObjectTypeFormatter* pFormat = mxData->getTypeFormatter( eObjType ) )
1075 6 : pFormat->convertFormatting( rPropSet, rxShapeProp, rxTextProp );
1076 6 : }
1077 :
1078 0 : void ObjectFormatter::convertTextFormatting( PropertySet& rPropSet, const TextCharacterProperties& rTextProps, ObjectType eObjType )
1079 : {
1080 0 : if( ObjectTypeFormatter* pFormat = mxData->getTypeFormatter( eObjType ) )
1081 0 : pFormat->convertTextFormatting( rPropSet, rTextProps );
1082 0 : }
1083 :
1084 6 : void ObjectFormatter::convertTextRotation( PropertySet& rPropSet, const ModelRef< TextBody >& rxTextProp, bool bSupportsStacked )
1085 : {
1086 6 : if( rxTextProp.is() )
1087 : {
1088 0 : bool bStacked = false;
1089 0 : if( bSupportsStacked )
1090 : {
1091 0 : sal_Int32 nVert = rxTextProp->getTextProperties().moVert.get( XML_horz );
1092 0 : bStacked = (nVert == XML_wordArtVert) || (nVert == XML_wordArtVertRtl);
1093 0 : rPropSet.setProperty( PROP_StackCharacters, bStacked );
1094 : }
1095 :
1096 : /* Chart2 expects rotation angle as double value in range of [0,360).
1097 : OOXML counts clockwise, Chart2 counts counterclockwise. */
1098 0 : double fAngle = static_cast< double >( bStacked ? 0 : rxTextProp->getTextProperties().moRotation.get( 0 ) );
1099 0 : fAngle = getDoubleIntervalValue< double >( -fAngle / 60000.0, 0.0, 360.0 );
1100 0 : rPropSet.setProperty( PROP_TextRotation, fAngle );
1101 : }
1102 6 : }
1103 :
1104 4 : void ObjectFormatter::convertNumberFormat( PropertySet& rPropSet, const NumberFormat& rNumberFormat, bool bPercentFormat )
1105 : {
1106 4 : if( mxData->mxNumFmts.is() )
1107 : {
1108 4 : sal_Int32 nPropId = bPercentFormat ? PROP_PercentageNumberFormat : PROP_NumberFormat;
1109 4 : if( rNumberFormat.mbSourceLinked || rNumberFormat.maFormatCode.isEmpty() )
1110 : {
1111 4 : rPropSet.setAnyProperty( nPropId, Any() );
1112 : }
1113 : else try
1114 : {
1115 0 : sal_Int32 nIndex = rNumberFormat.maFormatCode.equalsIgnoreAsciiCase("general") ?
1116 0 : mxData->mxNumTypes->getStandardIndex( mxData->maFromLocale ) :
1117 0 : mxData->mxNumFmts->addNewConverted( rNumberFormat.maFormatCode, mxData->maEnUsLocale, mxData->maFromLocale );
1118 0 : if( nIndex >= 0 )
1119 0 : rPropSet.setProperty( nPropId, nIndex );
1120 : }
1121 0 : catch( Exception& )
1122 : {
1123 : OSL_FAIL( OStringBuffer( "ObjectFormatter::convertNumberFormat - cannot create number format '" ).
1124 : append( OUStringToOString( rNumberFormat.maFormatCode, osl_getThreadTextEncoding() ) ).append( '\'' ).getStr() );
1125 : }
1126 : }
1127 4 : }
1128 :
1129 0 : void ObjectFormatter::convertAutomaticFill( PropertySet& rPropSet, ObjectType eObjType, sal_Int32 nSeriesIdx )
1130 : {
1131 0 : if( ObjectTypeFormatter* pFormat = mxData->getTypeFormatter( eObjType ) )
1132 0 : pFormat->convertAutomaticFill( rPropSet, nSeriesIdx );
1133 0 : }
1134 :
1135 0 : bool ObjectFormatter::isAutomaticFill( const ModelRef< Shape >& rxShapeProp )
1136 : {
1137 0 : return !rxShapeProp || !rxShapeProp->getFillProperties().moFillType.has();
1138 : }
1139 :
1140 : // ============================================================================
1141 :
1142 : } // namespace chart
1143 : } // namespace drawingml
1144 141 : } // namespace oox
1145 :
1146 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|