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 #include "ChartItemPool.hxx"
21 #include <chartview/ChartSfxItemIds.hxx>
22 #include <svx/chrtitem.hxx>
23 #include <svl/intitem.hxx>
24 #include <editeng/brushitem.hxx>
25 #include <editeng/sizeitem.hxx>
26 #include <svl/stritem.hxx>
27 #include <svl/ilstitem.hxx>
28 #include <editeng/editids.hrc>
29 #include <svx/svxids.hrc>
32 #include <com/sun/star/chart2/LegendPosition.hpp>
37 ChartItemPool::ChartItemPool():
38 SfxItemPool( "ChartItemPool" , SCHATTR_START
, SCHATTR_END
, nullptr, nullptr ),
39 pItemInfos(new SfxItemInfo
[SCHATTR_END
- SCHATTR_START
+ 1])
41 /**************************************************************************
43 **************************************************************************/
44 std::vector
<SfxPoolItem
*>* ppPoolDefaults
= new std::vector
<SfxPoolItem
*>(SCHATTR_END
- SCHATTR_START
+ 1);
45 std::vector
<SfxPoolItem
*>& rPoolDefaults
= *ppPoolDefaults
;
46 rPoolDefaults
[SCHATTR_DATADESCR_SHOW_NUMBER
- SCHATTR_START
] = new SfxBoolItem(SCHATTR_DATADESCR_SHOW_NUMBER
);
47 rPoolDefaults
[SCHATTR_DATADESCR_SHOW_PERCENTAGE
- SCHATTR_START
] = new SfxBoolItem(SCHATTR_DATADESCR_SHOW_PERCENTAGE
);
48 rPoolDefaults
[SCHATTR_DATADESCR_SHOW_CATEGORY
- SCHATTR_START
] = new SfxBoolItem(SCHATTR_DATADESCR_SHOW_CATEGORY
);
49 rPoolDefaults
[SCHATTR_DATADESCR_SHOW_SYMBOL
- SCHATTR_START
] = new SfxBoolItem(SCHATTR_DATADESCR_SHOW_SYMBOL
);
50 rPoolDefaults
[SCHATTR_DATADESCR_WRAP_TEXT
- SCHATTR_START
] = new SfxBoolItem(SCHATTR_DATADESCR_WRAP_TEXT
);
51 rPoolDefaults
[SCHATTR_DATADESCR_SEPARATOR
- SCHATTR_START
] = new SfxStringItem(SCHATTR_DATADESCR_SEPARATOR
," ");
52 rPoolDefaults
[SCHATTR_DATADESCR_PLACEMENT
- SCHATTR_START
] = new SfxInt32Item(SCHATTR_DATADESCR_PLACEMENT
,0);
53 rPoolDefaults
[SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS
- SCHATTR_START
] = new SfxIntegerListItem(SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS
, std::vector
< sal_Int32
>() );
54 rPoolDefaults
[SCHATTR_DATADESCR_NO_PERCENTVALUE
- SCHATTR_START
] = new SfxBoolItem(SCHATTR_DATADESCR_NO_PERCENTVALUE
);
55 rPoolDefaults
[SCHATTR_PERCENT_NUMBERFORMAT_VALUE
- SCHATTR_START
] = new SfxUInt32Item(SCHATTR_PERCENT_NUMBERFORMAT_VALUE
, 0);
56 rPoolDefaults
[SCHATTR_PERCENT_NUMBERFORMAT_SOURCE
- SCHATTR_START
] = new SfxBoolItem(SCHATTR_PERCENT_NUMBERFORMAT_SOURCE
);
59 rPoolDefaults
[SCHATTR_LEGEND_POS
- SCHATTR_START
] = new SfxInt32Item(SCHATTR_LEGEND_POS
, sal_Int32(css::chart2::LegendPosition_LINE_END
) );
60 rPoolDefaults
[SCHATTR_LEGEND_SHOW
- SCHATTR_START
] = new SfxBoolItem(SCHATTR_LEGEND_SHOW
, true);
63 rPoolDefaults
[SCHATTR_TEXT_DEGREES
- SCHATTR_START
] = new SfxInt32Item(SCHATTR_TEXT_DEGREES
, 0);
64 rPoolDefaults
[SCHATTR_TEXT_STACKED
- SCHATTR_START
] = new SfxBoolItem(SCHATTR_TEXT_STACKED
,false);
67 rPoolDefaults
[SCHATTR_STAT_AVERAGE
- SCHATTR_START
] = new SfxBoolItem (SCHATTR_STAT_AVERAGE
);
68 rPoolDefaults
[SCHATTR_STAT_KIND_ERROR
- SCHATTR_START
] = new SvxChartKindErrorItem (SvxChartKindError::NONE
, SCHATTR_STAT_KIND_ERROR
);
69 rPoolDefaults
[SCHATTR_STAT_PERCENT
- SCHATTR_START
] = new SvxDoubleItem (0.0, SCHATTR_STAT_PERCENT
);
70 rPoolDefaults
[SCHATTR_STAT_BIGERROR
- SCHATTR_START
] = new SvxDoubleItem (0.0, SCHATTR_STAT_BIGERROR
);
71 rPoolDefaults
[SCHATTR_STAT_CONSTPLUS
- SCHATTR_START
] = new SvxDoubleItem (0.0, SCHATTR_STAT_CONSTPLUS
);
72 rPoolDefaults
[SCHATTR_STAT_CONSTMINUS
- SCHATTR_START
] = new SvxDoubleItem (0.0, SCHATTR_STAT_CONSTMINUS
);
73 rPoolDefaults
[SCHATTR_STAT_INDICATE
- SCHATTR_START
] = new SvxChartIndicateItem (SvxChartIndicate::NONE
, SCHATTR_STAT_INDICATE
);
74 rPoolDefaults
[SCHATTR_STAT_RANGE_POS
- SCHATTR_START
] = new SfxStringItem (SCHATTR_STAT_RANGE_POS
, OUString());
75 rPoolDefaults
[SCHATTR_STAT_RANGE_NEG
- SCHATTR_START
] = new SfxStringItem (SCHATTR_STAT_RANGE_NEG
, OUString());
76 rPoolDefaults
[SCHATTR_STAT_ERRORBAR_TYPE
- SCHATTR_START
] = new SfxBoolItem(SCHATTR_STAT_ERRORBAR_TYPE
, true);
78 rPoolDefaults
[SCHATTR_STYLE_DEEP
- SCHATTR_START
] = new SfxBoolItem (SCHATTR_STYLE_DEEP
, false);
79 rPoolDefaults
[SCHATTR_STYLE_3D
- SCHATTR_START
] = new SfxBoolItem (SCHATTR_STYLE_3D
, false);
80 rPoolDefaults
[SCHATTR_STYLE_VERTICAL
- SCHATTR_START
] = new SfxBoolItem (SCHATTR_STYLE_VERTICAL
, false);
81 rPoolDefaults
[SCHATTR_STYLE_BASETYPE
- SCHATTR_START
] = new SfxInt32Item(SCHATTR_STYLE_BASETYPE
, 0);
82 rPoolDefaults
[SCHATTR_STYLE_LINES
- SCHATTR_START
] = new SfxBoolItem (SCHATTR_STYLE_LINES
, false);
83 rPoolDefaults
[SCHATTR_STYLE_PERCENT
- SCHATTR_START
] = new SfxBoolItem (SCHATTR_STYLE_PERCENT
, false);
84 rPoolDefaults
[SCHATTR_STYLE_STACKED
- SCHATTR_START
] = new SfxBoolItem (SCHATTR_STYLE_STACKED
, false);
85 rPoolDefaults
[SCHATTR_STYLE_SPLINES
- SCHATTR_START
] = new SfxInt32Item (SCHATTR_STYLE_SPLINES
, 0); //Bug: was Bool! test ->Fileformat (touches only 5's)
86 rPoolDefaults
[SCHATTR_STYLE_SYMBOL
- SCHATTR_START
] = new SfxInt32Item (SCHATTR_STYLE_SYMBOL
, 0);
87 rPoolDefaults
[SCHATTR_STYLE_SHAPE
- SCHATTR_START
] = new SfxInt32Item (SCHATTR_STYLE_SHAPE
, 0);
89 rPoolDefaults
[SCHATTR_AXIS
- SCHATTR_START
] = new SfxInt32Item(SCHATTR_AXIS
,2); //2 = Y-Axis!!!
92 rPoolDefaults
[SCHATTR_AXISTYPE
- SCHATTR_START
] = new SfxInt32Item(SCHATTR_AXISTYPE
, CHART_AXIS_REALNUMBER
);
93 rPoolDefaults
[SCHATTR_AXIS_REVERSE
- SCHATTR_START
] = new SfxBoolItem(SCHATTR_AXIS_REVERSE
,false);
94 rPoolDefaults
[SCHATTR_AXIS_AUTO_MIN
- SCHATTR_START
] = new SfxBoolItem(SCHATTR_AXIS_AUTO_MIN
);
95 rPoolDefaults
[SCHATTR_AXIS_MIN
- SCHATTR_START
] = new SvxDoubleItem(0.0, SCHATTR_AXIS_MIN
);
96 rPoolDefaults
[SCHATTR_AXIS_AUTO_MAX
- SCHATTR_START
] = new SfxBoolItem(SCHATTR_AXIS_AUTO_MAX
);
97 rPoolDefaults
[SCHATTR_AXIS_MAX
- SCHATTR_START
] = new SvxDoubleItem(0.0, SCHATTR_AXIS_MAX
);
98 rPoolDefaults
[SCHATTR_AXIS_AUTO_STEP_MAIN
- SCHATTR_START
] = new SfxBoolItem(SCHATTR_AXIS_AUTO_STEP_MAIN
);
99 rPoolDefaults
[SCHATTR_AXIS_STEP_MAIN
- SCHATTR_START
] = new SvxDoubleItem(0.0, SCHATTR_AXIS_STEP_MAIN
);
100 rPoolDefaults
[SCHATTR_AXIS_MAIN_TIME_UNIT
- SCHATTR_START
] = new SfxInt32Item(SCHATTR_AXIS_MAIN_TIME_UNIT
,2);
101 rPoolDefaults
[SCHATTR_AXIS_AUTO_STEP_HELP
- SCHATTR_START
] = new SfxBoolItem(SCHATTR_AXIS_AUTO_STEP_HELP
);
102 rPoolDefaults
[SCHATTR_AXIS_STEP_HELP
- SCHATTR_START
] = new SfxInt32Item(SCHATTR_AXIS_STEP_HELP
,0);
103 rPoolDefaults
[SCHATTR_AXIS_HELP_TIME_UNIT
- SCHATTR_START
] = new SfxInt32Item(SCHATTR_AXIS_HELP_TIME_UNIT
,2);
104 rPoolDefaults
[SCHATTR_AXIS_AUTO_TIME_RESOLUTION
- SCHATTR_START
] = new SfxBoolItem(SCHATTR_AXIS_AUTO_TIME_RESOLUTION
);
105 rPoolDefaults
[SCHATTR_AXIS_TIME_RESOLUTION
- SCHATTR_START
] = new SfxInt32Item(SCHATTR_AXIS_TIME_RESOLUTION
,2);
106 rPoolDefaults
[SCHATTR_AXIS_LOGARITHM
- SCHATTR_START
] = new SfxBoolItem(SCHATTR_AXIS_LOGARITHM
);
107 rPoolDefaults
[SCHATTR_AXIS_AUTO_DATEAXIS
- SCHATTR_START
] = new SfxBoolItem(SCHATTR_AXIS_AUTO_DATEAXIS
);
108 rPoolDefaults
[SCHATTR_AXIS_ALLOW_DATEAXIS
- SCHATTR_START
] = new SfxBoolItem(SCHATTR_AXIS_ALLOW_DATEAXIS
);
109 rPoolDefaults
[SCHATTR_AXIS_AUTO_ORIGIN
- SCHATTR_START
] = new SfxBoolItem(SCHATTR_AXIS_AUTO_ORIGIN
);
110 rPoolDefaults
[SCHATTR_AXIS_ORIGIN
- SCHATTR_START
] = new SvxDoubleItem(0.0, SCHATTR_AXIS_ORIGIN
);
113 rPoolDefaults
[SCHATTR_AXIS_TICKS
- SCHATTR_START
] = new SfxInt32Item(SCHATTR_AXIS_TICKS
,CHAXIS_MARK_OUTER
);
114 rPoolDefaults
[SCHATTR_AXIS_HELPTICKS
- SCHATTR_START
] = new SfxInt32Item(SCHATTR_AXIS_HELPTICKS
,0);
115 rPoolDefaults
[SCHATTR_AXIS_POSITION
- SCHATTR_START
] = new SfxInt32Item(SCHATTR_AXIS_POSITION
,0);
116 rPoolDefaults
[SCHATTR_AXIS_POSITION_VALUE
- SCHATTR_START
] = new SvxDoubleItem(0.0, SCHATTR_AXIS_POSITION_VALUE
);
117 rPoolDefaults
[SCHATTR_AXIS_CROSSING_MAIN_AXIS_NUMBERFORMAT
- SCHATTR_START
] = new SfxUInt32Item(SCHATTR_AXIS_CROSSING_MAIN_AXIS_NUMBERFORMAT
,0);
118 rPoolDefaults
[SCHATTR_AXIS_LABEL_POSITION
- SCHATTR_START
] = new SfxInt32Item(SCHATTR_AXIS_LABEL_POSITION
,0);
119 rPoolDefaults
[SCHATTR_AXIS_MARK_POSITION
- SCHATTR_START
] = new SfxInt32Item(SCHATTR_AXIS_MARK_POSITION
,0);
122 rPoolDefaults
[SCHATTR_AXIS_SHOWDESCR
- SCHATTR_START
] = new SfxBoolItem(SCHATTR_AXIS_SHOWDESCR
,false);
123 rPoolDefaults
[SCHATTR_AXIS_LABEL_ORDER
- SCHATTR_START
] = new SvxChartTextOrderItem(SvxChartTextOrder::SideBySide
, SCHATTR_AXIS_LABEL_ORDER
);
124 rPoolDefaults
[SCHATTR_AXIS_LABEL_OVERLAP
- SCHATTR_START
] = new SfxBoolItem(SCHATTR_AXIS_LABEL_OVERLAP
,false);
125 rPoolDefaults
[SCHATTR_AXIS_LABEL_BREAK
- SCHATTR_START
] = new SfxBoolItem(SCHATTR_AXIS_LABEL_BREAK
, false );
127 rPoolDefaults
[SCHATTR_SYMBOL_BRUSH
- SCHATTR_START
] = new SvxBrushItem(SCHATTR_SYMBOL_BRUSH
);
128 rPoolDefaults
[SCHATTR_STOCK_VOLUME
- SCHATTR_START
] = new SfxBoolItem(SCHATTR_STOCK_VOLUME
,false);
129 rPoolDefaults
[SCHATTR_STOCK_UPDOWN
- SCHATTR_START
] = new SfxBoolItem(SCHATTR_STOCK_UPDOWN
,false);
130 rPoolDefaults
[SCHATTR_SYMBOL_SIZE
- SCHATTR_START
] = new SvxSizeItem(SCHATTR_SYMBOL_SIZE
,Size(0,0));
133 rPoolDefaults
[SCHATTR_BAR_OVERLAP
- SCHATTR_START
] = new SfxInt32Item(SCHATTR_BAR_OVERLAP
,0);
134 rPoolDefaults
[SCHATTR_BAR_GAPWIDTH
- SCHATTR_START
] = new SfxInt32Item(SCHATTR_BAR_GAPWIDTH
,0);
135 rPoolDefaults
[SCHATTR_BAR_CONNECT
- SCHATTR_START
] = new SfxBoolItem(SCHATTR_BAR_CONNECT
, false);
136 rPoolDefaults
[SCHATTR_NUM_OF_LINES_FOR_BAR
- SCHATTR_START
] = new SfxInt32Item( SCHATTR_NUM_OF_LINES_FOR_BAR
, 0 );
137 rPoolDefaults
[SCHATTR_SPLINE_ORDER
- SCHATTR_START
] = new SfxInt32Item( SCHATTR_SPLINE_ORDER
, 3 );
138 rPoolDefaults
[SCHATTR_SPLINE_RESOLUTION
- SCHATTR_START
] = new SfxInt32Item( SCHATTR_SPLINE_RESOLUTION
, 20 );
139 rPoolDefaults
[SCHATTR_GROUP_BARS_PER_AXIS
- SCHATTR_START
] = new SfxBoolItem(SCHATTR_GROUP_BARS_PER_AXIS
, false);
140 rPoolDefaults
[SCHATTR_STARTING_ANGLE
- SCHATTR_START
] = new SfxInt32Item( SCHATTR_STARTING_ANGLE
, 90 );
141 rPoolDefaults
[SCHATTR_CLOCKWISE
- SCHATTR_START
] = new SfxBoolItem( SCHATTR_CLOCKWISE
, false );
143 rPoolDefaults
[SCHATTR_MISSING_VALUE_TREATMENT
- SCHATTR_START
] = new SfxInt32Item(SCHATTR_MISSING_VALUE_TREATMENT
, 0);
144 rPoolDefaults
[SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS
- SCHATTR_START
] = new SfxIntegerListItem(SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS
, std::vector
< sal_Int32
>() );
145 rPoolDefaults
[SCHATTR_INCLUDE_HIDDEN_CELLS
- SCHATTR_START
] = new SfxBoolItem(SCHATTR_INCLUDE_HIDDEN_CELLS
, true);
146 rPoolDefaults
[SCHATTR_HIDE_LEGEND_ENTRY
- SCHATTR_START
] = new SfxBoolItem(SCHATTR_HIDE_LEGEND_ENTRY
, false);
148 rPoolDefaults
[SCHATTR_AXIS_FOR_ALL_SERIES
- SCHATTR_START
] = new SfxInt32Item(SCHATTR_AXIS_FOR_ALL_SERIES
, 0);
150 rPoolDefaults
[SCHATTR_REGRESSION_TYPE
- SCHATTR_START
] = new SvxChartRegressItem (SvxChartRegress::NONE
, SCHATTR_REGRESSION_TYPE
);
151 rPoolDefaults
[SCHATTR_REGRESSION_SHOW_EQUATION
- SCHATTR_START
] = new SfxBoolItem(SCHATTR_REGRESSION_SHOW_EQUATION
, false);
152 rPoolDefaults
[SCHATTR_REGRESSION_SHOW_COEFF
- SCHATTR_START
] = new SfxBoolItem(SCHATTR_REGRESSION_SHOW_COEFF
, false);
153 rPoolDefaults
[SCHATTR_REGRESSION_DEGREE
- SCHATTR_START
] = new SfxInt32Item(SCHATTR_REGRESSION_DEGREE
, 2);
154 rPoolDefaults
[SCHATTR_REGRESSION_PERIOD
- SCHATTR_START
] = new SfxInt32Item(SCHATTR_REGRESSION_PERIOD
, 2);
155 rPoolDefaults
[SCHATTR_REGRESSION_EXTRAPOLATE_FORWARD
- SCHATTR_START
] = new SvxDoubleItem(0.0, SCHATTR_REGRESSION_EXTRAPOLATE_FORWARD
);
156 rPoolDefaults
[SCHATTR_REGRESSION_EXTRAPOLATE_BACKWARD
- SCHATTR_START
] = new SvxDoubleItem(0.0, SCHATTR_REGRESSION_EXTRAPOLATE_BACKWARD
);
157 rPoolDefaults
[SCHATTR_REGRESSION_SET_INTERCEPT
- SCHATTR_START
] = new SfxBoolItem(SCHATTR_REGRESSION_SET_INTERCEPT
, false);
158 rPoolDefaults
[SCHATTR_REGRESSION_INTERCEPT_VALUE
- SCHATTR_START
] = new SvxDoubleItem(0.0, SCHATTR_REGRESSION_INTERCEPT_VALUE
);
159 rPoolDefaults
[SCHATTR_REGRESSION_CURVE_NAME
- SCHATTR_START
] = new SfxStringItem(SCHATTR_REGRESSION_CURVE_NAME
, OUString());
160 rPoolDefaults
[SCHATTR_REGRESSION_XNAME
- SCHATTR_START
] = new SfxStringItem(SCHATTR_REGRESSION_XNAME
, "x");
161 rPoolDefaults
[SCHATTR_REGRESSION_YNAME
- SCHATTR_START
] = new SfxStringItem(SCHATTR_REGRESSION_YNAME
, "f(x)");
163 /**************************************************************************
165 **************************************************************************/
166 const sal_uInt16 nMax
= SCHATTR_END
- SCHATTR_START
+ 1;
167 for( sal_uInt16 i
= 0; i
< nMax
; i
++ )
169 pItemInfos
[i
]._nSID
= 0;
170 pItemInfos
[i
]._bPoolable
= true;
173 // slot ids differing from which ids
174 pItemInfos
[SCHATTR_SYMBOL_BRUSH
- SCHATTR_START
]._nSID
= SID_ATTR_BRUSH
;
175 pItemInfos
[SCHATTR_STYLE_SYMBOL
- SCHATTR_START
]._nSID
= SID_ATTR_SYMBOLTYPE
;
176 pItemInfos
[SCHATTR_SYMBOL_SIZE
- SCHATTR_START
]._nSID
= SID_ATTR_SYMBOLSIZE
;
178 SetDefaults(ppPoolDefaults
);
179 SetItemInfos(pItemInfos
.get());
182 ChartItemPool::ChartItemPool(const ChartItemPool
& rPool
):
187 ChartItemPool::~ChartItemPool()
190 // release and delete static pool default items
191 ReleaseDefaults(true);
194 SfxItemPool
* ChartItemPool::Clone() const
196 return new ChartItemPool(*this);
199 MapUnit
ChartItemPool::GetMetric(sal_uInt16
/* nWhich */) const
201 return MapUnit::Map100thMM
;
204 SfxItemPool
* ChartItemPool::CreateChartItemPool()
206 return new ChartItemPool();
211 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */