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
{ namespace sun
{ namespace star
{
28 namespace chart2
{ class XChartDocument
; }
31 namespace oox
{ namespace core
{ class XmlFilterBase
; } }
37 /** Enumerates different object types for specific automatic formatting behaviour. */
40 OBJECTTYPE_CHARTSPACE
, /// Chart background.
41 OBJECTTYPE_CHARTTITLE
, /// Chart title.
42 OBJECTTYPE_LEGEND
, /// Legend.
43 OBJECTTYPE_PLOTAREA2D
, /// Plot area containing axes and data series in 2D charts.
44 OBJECTTYPE_PLOTAREA3D
, /// Plot area containing axes and data series in 3D charts.
45 OBJECTTYPE_WALL
, /// Background and side wall in 3D charts.
46 OBJECTTYPE_FLOOR
, /// Floor in 3D charts.
47 OBJECTTYPE_AXIS
, /// Axis line, labels, tick marks.
48 OBJECTTYPE_AXISTITLE
, /// Axis title.
49 OBJECTTYPE_AXISUNIT
, /// Axis unit label.
50 OBJECTTYPE_MAJORGRIDLINE
, /// Axis major grid line.
51 OBJECTTYPE_MINORGRIDLINE
, /// Axis minor grid line.
52 OBJECTTYPE_LINEARSERIES2D
, /// Linear series in 2D line/radarline/scatter charts.
53 OBJECTTYPE_FILLEDSERIES2D
, /// Filled series in 2D bar/area/radararea/bubble/pie/surface charts.
54 OBJECTTYPE_FILLEDSERIES3D
, /// Filled series in 3D charts.
55 OBJECTTYPE_DATALABEL
, /// Labels for data points.
56 OBJECTTYPE_TRENDLINE
, /// Data series trend line.
57 OBJECTTYPE_TRENDLINELABEL
, /// Trend line label.
58 OBJECTTYPE_ERRORBAR
, /// Data series error indicator line.
59 OBJECTTYPE_SERLINE
, /// Data point connector lines.
60 OBJECTTYPE_LEADERLINE
, /// Leader lines between pie slice and data label.
61 OBJECTTYPE_DROPLINE
, /// Drop lines between data points and X axis.
62 OBJECTTYPE_HILOLINE
, /// High/low lines in line/stock charts.
63 OBJECTTYPE_UPBAR
, /// Up-bar in line/stock charts.
64 OBJECTTYPE_DOWNBAR
, /// Down-bar in line/stock charts.
65 OBJECTTYPE_DATATABLE
/// Data table.
68 struct ChartSpaceModel
;
69 struct ObjectFormatterData
;
70 struct PictureOptionsModel
;
75 explicit ObjectFormatter(
76 const ::oox::core::XmlFilterBase
& rFilter
,
77 const css::uno::Reference
< css::chart2::XChartDocument
>& rxChartDoc
,
78 const ChartSpaceModel
& rChartSpace
);
81 /** Sets the maximum series index used for color cycling/fading. */
82 void setMaxSeriesIndex( sal_Int32 nMaxSeriesIdx
);
83 /** Returns the current maximum series index used for color cycling/fading. */
84 sal_Int32
getMaxSeriesIndex() const;
86 /** Sets frame formatting properties to the passed property set. */
87 void convertFrameFormatting(
88 PropertySet
& rPropSet
,
89 const ModelRef
< Shape
>& rxShapeProp
,
91 sal_Int32 nSeriesIdx
= -1 );
93 /** Sets frame formatting properties to the passed property set. */
94 void convertFrameFormatting(
95 PropertySet
& rPropSet
,
96 const ModelRef
< Shape
>& rxShapeProp
,
97 const PictureOptionsModel
& rPicOptions
,
99 sal_Int32 nSeriesIdx
= -1 );
101 /** Sets text formatting properties to the passed property set. */
102 void convertTextFormatting(
103 PropertySet
& rPropSet
,
104 const ModelRef
< TextBody
>& rxTextProp
,
105 ObjectType eObjType
);
107 /** Sets frame/text formatting properties to the passed property set. */
108 void convertFormatting(
109 PropertySet
& rPropSet
,
110 const ModelRef
< Shape
>& rxShapeProp
,
111 const ModelRef
< TextBody
>& rxTextProp
,
112 ObjectType eObjType
);
114 /** Sets text formatting properties to the passed property set. */
115 void convertTextFormatting(
116 PropertySet
& rPropSet
,
117 const TextCharacterProperties
& rTextProps
,
118 ObjectType eObjType
);
120 /** Sets text rotation properties to the passed property set. */
121 static void convertTextRotation(
122 PropertySet
& rPropSet
,
123 const ModelRef
< TextBody
>& rxTextProp
,
124 bool bSupportsStacked
, sal_Int32 nDefaultRotation
= 0);
126 /** Sets text wrap properties to the passed property set. */
127 static void convertTextWrap(
128 PropertySet
& rPropSet
,
129 const ModelRef
< TextBody
>& rxTextProp
);
131 /** Sets number format properties to the passed property set. */
132 void convertNumberFormat(
133 PropertySet
& rPropSet
,
134 const NumberFormat
& rNumberFormat
,
136 bool bShowPercent
= false );
138 /** Sets automatic fill properties to the passed property set. */
139 void convertAutomaticFill(
140 PropertySet
& rPropSet
,
142 sal_Int32 nSeriesIdx
);
144 /** Returns true, if the passed shape properties have automatic fill mode. */
145 static bool isAutomaticFill( const ModelRef
< Shape
>& rxShapeProp
);
147 /** Returns true, if the X Axis label rotation is 0 degree. */
148 static bool getTextRotation(
149 const ModelRef
< TextBody
>& rxTextProp
,
150 sal_Int32 nDefaultRotation
= 0 );
153 std::shared_ptr
< ObjectFormatterData
> mxData
;
157 } // namespace drawingml
162 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */