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