1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_OOX_DRAWINGML_CHART_OBJECTFORMATTER_HXX
21 #define INCLUDED_OOX_DRAWINGML_CHART_OBJECTFORMATTER_HXX
23 #include <oox/helper/propertyset.hxx>
24 #include <oox/drawingml/drawingmltypes.hxx>
25 #include <oox/drawingml/chart/modelbase.hxx>
27 namespace com::sun::star
{
28 namespace chart2
{ class XChartDocument
; }
31 namespace oox::core
{ class XmlFilterBase
; }
33 namespace oox::drawingml::chart
{
35 /** Enumerates different object types for specific automatic formatting behaviour. */
38 OBJECTTYPE_CHARTSPACE
, /// Chart background.
39 OBJECTTYPE_CHARTTITLE
, /// Chart title.
40 OBJECTTYPE_LEGEND
, /// Legend.
41 OBJECTTYPE_PLOTAREA2D
, /// Plot area containing axes and data series in 2D charts.
42 OBJECTTYPE_PLOTAREA3D
, /// Plot area containing axes and data series in 3D charts.
43 OBJECTTYPE_WALL
, /// Background and side wall in 3D charts.
44 OBJECTTYPE_FLOOR
, /// Floor in 3D charts.
45 OBJECTTYPE_AXIS
, /// Axis line, labels, tick marks.
46 OBJECTTYPE_AXISTITLE
, /// Axis title.
47 OBJECTTYPE_AXISUNIT
, /// Axis unit label.
48 OBJECTTYPE_MAJORGRIDLINE
, /// Axis major grid line.
49 OBJECTTYPE_MINORGRIDLINE
, /// Axis minor grid line.
50 OBJECTTYPE_LINEARSERIES2D
, /// Linear series in 2D line/radarline/scatter charts.
51 OBJECTTYPE_FILLEDSERIES2D
, /// Filled series in 2D bar/area/radararea/bubble/pie/surface charts.
52 OBJECTTYPE_FILLEDSERIES3D
, /// Filled series in 3D charts.
53 OBJECTTYPE_DATALABEL
, /// Labels for data points.
54 OBJECTTYPE_TRENDLINE
, /// Data series trend line.
55 OBJECTTYPE_TRENDLINELABEL
, /// Trend line label.
56 OBJECTTYPE_ERRORBAR
, /// Data series error indicator line.
57 OBJECTTYPE_SERLINE
, /// Data point connector lines.
58 OBJECTTYPE_LEADERLINE
, /// Leader lines between pie slice and data label.
59 OBJECTTYPE_DROPLINE
, /// Drop lines between data points and X axis.
60 OBJECTTYPE_HILOLINE
, /// High/low lines in line/stock charts.
61 OBJECTTYPE_UPBAR
, /// Up-bar in line/stock charts.
62 OBJECTTYPE_DOWNBAR
, /// Down-bar in line/stock charts.
63 OBJECTTYPE_DATATABLE
/// Data table.
66 struct ChartSpaceModel
;
67 struct ObjectFormatterData
;
68 struct PictureOptionsModel
;
73 explicit ObjectFormatter(
74 const ::oox::core::XmlFilterBase
& rFilter
,
75 const css::uno::Reference
< css::chart2::XChartDocument
>& rxChartDoc
,
76 const ChartSpaceModel
& rChartSpace
);
79 /** Sets the maximum series index used for color cycling/fading. */
80 void setMaxSeriesIndex( sal_Int32 nMaxSeriesIdx
);
81 /** Returns the current maximum series index used for color cycling/fading. */
82 sal_Int32
getMaxSeriesIndex() const;
84 /** Sets frame formatting properties to the passed property set. */
85 void convertFrameFormatting(
86 PropertySet
& rPropSet
,
87 const ModelRef
< Shape
>& rxShapeProp
,
89 sal_Int32 nSeriesIdx
= -1 );
91 /** Sets frame formatting properties to the passed property set. */
92 void convertFrameFormatting(
93 PropertySet
& rPropSet
,
94 const ModelRef
< Shape
>& rxShapeProp
,
95 const PictureOptionsModel
& rPicOptions
,
97 sal_Int32 nSeriesIdx
= -1 );
99 /** Sets text formatting properties to the passed property set. */
100 void convertTextFormatting(
101 PropertySet
& rPropSet
,
102 const ModelRef
< TextBody
>& rxTextProp
,
103 ObjectType eObjType
);
105 /** Sets frame/text formatting properties to the passed property set. */
106 void convertFormatting(
107 PropertySet
& rPropSet
,
108 const ModelRef
< Shape
>& rxShapeProp
,
109 const ModelRef
< TextBody
>& rxTextProp
,
110 ObjectType eObjType
);
112 /** Sets text formatting properties to the passed property set. */
113 void convertTextFormatting(
114 PropertySet
& rPropSet
,
115 const TextCharacterProperties
& rTextProps
,
116 ObjectType eObjType
);
118 /** Sets text rotation properties to the passed property set. */
119 static void convertTextRotation(
120 PropertySet
& rPropSet
,
121 const ModelRef
< TextBody
>& rxTextProp
,
122 bool bSupportsStacked
, sal_Int32 nDefaultRotation
= 0);
124 /** Sets text wrap properties to the passed property set. */
125 static void convertTextWrap(
126 PropertySet
& rPropSet
,
127 const ModelRef
< TextBody
>& rxTextProp
);
129 /** Sets number format properties to the passed property set. */
130 void convertNumberFormat(
131 PropertySet
& rPropSet
,
132 const NumberFormat
& rNumberFormat
,
134 bool bShowPercent
= false );
136 /** Sets automatic fill properties to the passed property set. */
137 void convertAutomaticFill(
138 PropertySet
& rPropSet
,
140 sal_Int32 nSeriesIdx
);
142 /** Returns true, if the passed shape properties have automatic fill mode. */
143 static bool isAutomaticFill( const ModelRef
< Shape
>& rxShapeProp
);
145 /** Returns the index lookup key given for this number formatting code **/
146 sal_Int32
getNumberFormatKey(const OUString
& sNumberFormat
);
149 std::shared_ptr
< ObjectFormatterData
> mxData
;
152 } // namespace oox::drawingml::chart
156 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */