xref: /AOO41X/main/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
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 // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_chart2.hxx"
30*cdf0e10cSrcweir #include "DiagramWrapper.hxx"
31*cdf0e10cSrcweir #include "macros.hxx"
32*cdf0e10cSrcweir #include "servicenames_charttypes.hxx"
33*cdf0e10cSrcweir #include "DataSeriesPointWrapper.hxx"
34*cdf0e10cSrcweir #include "AxisWrapper.hxx"
35*cdf0e10cSrcweir #include "AxisHelper.hxx"
36*cdf0e10cSrcweir #include "Chart2ModelContact.hxx"
37*cdf0e10cSrcweir #include "PositionAndSizeHelper.hxx"
38*cdf0e10cSrcweir #include "WallFloorWrapper.hxx"
39*cdf0e10cSrcweir #include "MinMaxLineWrapper.hxx"
40*cdf0e10cSrcweir #include "UpDownBarWrapper.hxx"
41*cdf0e10cSrcweir #include "DiagramHelper.hxx"
42*cdf0e10cSrcweir #include "DataSourceHelper.hxx"
43*cdf0e10cSrcweir #include "ChartModelHelper.hxx"
44*cdf0e10cSrcweir #include "WrappedIgnoreProperty.hxx"
45*cdf0e10cSrcweir #include "WrappedAxisAndGridExistenceProperties.hxx"
46*cdf0e10cSrcweir #include "WrappedStatisticProperties.hxx"
47*cdf0e10cSrcweir #include "WrappedSymbolProperties.hxx"
48*cdf0e10cSrcweir #include "WrappedDataCaptionProperties.hxx"
49*cdf0e10cSrcweir #include "WrappedSplineProperties.hxx"
50*cdf0e10cSrcweir #include "WrappedStockProperties.hxx"
51*cdf0e10cSrcweir #include "WrappedSceneProperty.hxx"
52*cdf0e10cSrcweir #include "RelativePositionHelper.hxx"
53*cdf0e10cSrcweir #include "ContainerHelper.hxx"
54*cdf0e10cSrcweir #include "ControllerLockGuard.hxx"
55*cdf0e10cSrcweir #include "ModifyListenerHelper.hxx"
56*cdf0e10cSrcweir #include "DisposeHelper.hxx"
57*cdf0e10cSrcweir #include <comphelper/InlineContainer.hxx>
58*cdf0e10cSrcweir #include "WrappedAutomaticPositionProperties.hxx"
59*cdf0e10cSrcweir #include "CommonConverters.hxx"
60*cdf0e10cSrcweir 
61*cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp>
62*cdf0e10cSrcweir #include <com/sun/star/chart2/XTitled.hpp>
63*cdf0e10cSrcweir #include <com/sun/star/chart/ChartDataRowSource.hpp>
64*cdf0e10cSrcweir #include <com/sun/star/chart2/RelativeSize.hpp>
65*cdf0e10cSrcweir #include <com/sun/star/chart2/RelativePosition.hpp>
66*cdf0e10cSrcweir #include <com/sun/star/chart/ChartSolidType.hpp>
67*cdf0e10cSrcweir 
68*cdf0e10cSrcweir #include "LineProperties.hxx"
69*cdf0e10cSrcweir #include "FillProperties.hxx"
70*cdf0e10cSrcweir #include "UserDefinedProperties.hxx"
71*cdf0e10cSrcweir #include "SceneProperties.hxx"
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir #include <map>
74*cdf0e10cSrcweir #include <algorithm>
75*cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
76*cdf0e10cSrcweir // header for define DBG_ERROR
77*cdf0e10cSrcweir #include <tools/debug.hxx>
78*cdf0e10cSrcweir #include <com/sun/star/lang/XServiceName.hpp>
79*cdf0e10cSrcweir #include <com/sun/star/util/XRefreshable.hpp>
80*cdf0e10cSrcweir 
81*cdf0e10cSrcweir using namespace ::com::sun::star;
82*cdf0e10cSrcweir using namespace ::chart::wrapper;
83*cdf0e10cSrcweir 
84*cdf0e10cSrcweir using ::com::sun::star::uno::Reference;
85*cdf0e10cSrcweir using ::com::sun::star::uno::Any;
86*cdf0e10cSrcweir using ::com::sun::star::uno::Sequence;
87*cdf0e10cSrcweir using ::com::sun::star::beans::Property;
88*cdf0e10cSrcweir using ::com::sun::star::chart::XAxis;
89*cdf0e10cSrcweir using ::osl::MutexGuard;
90*cdf0e10cSrcweir using ::rtl::OUString;
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir namespace
93*cdf0e10cSrcweir {
94*cdf0e10cSrcweir static const OUString lcl_aServiceName(
95*cdf0e10cSrcweir     RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.Diagram" ));
96*cdf0e10cSrcweir 
97*cdf0e10cSrcweir enum
98*cdf0e10cSrcweir {
99*cdf0e10cSrcweir     PROP_DIAGRAM_ATTRIBUTED_DATA_POINTS,
100*cdf0e10cSrcweir     PROP_DIAGRAM_PERCENT_STACKED,
101*cdf0e10cSrcweir     PROP_DIAGRAM_STACKED,
102*cdf0e10cSrcweir     PROP_DIAGRAM_THREE_D,
103*cdf0e10cSrcweir     PROP_DIAGRAM_SOLIDTYPE,
104*cdf0e10cSrcweir     PROP_DIAGRAM_DEEP,
105*cdf0e10cSrcweir     PROP_DIAGRAM_VERTICAL,
106*cdf0e10cSrcweir     PROP_DIAGRAM_NUMBER_OF_LINES,
107*cdf0e10cSrcweir     PROP_DIAGRAM_STACKED_BARS_CONNECTED,
108*cdf0e10cSrcweir     PROP_DIAGRAM_DATAROW_SOURCE,
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir     PROP_DIAGRAM_GROUP_BARS_PER_AXIS,
111*cdf0e10cSrcweir     PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS,
112*cdf0e10cSrcweir 
113*cdf0e10cSrcweir     PROP_DIAGRAM_SORT_BY_X_VALUES,
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir     PROP_DIAGRAM_STARTING_ANGLE,
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir     PROP_DIAGRAM_RIGHT_ANGLED_AXES,
118*cdf0e10cSrcweir     PROP_DIAGRAM_PERSPECTIVE,
119*cdf0e10cSrcweir     PROP_DIAGRAM_ROTATION_HORIZONTAL,
120*cdf0e10cSrcweir     PROP_DIAGRAM_ROTATION_VERTICAL,
121*cdf0e10cSrcweir 
122*cdf0e10cSrcweir     PROP_DIAGRAM_MISSING_VALUE_TREATMENT,
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir     PROP_DIAGRAM_HAS_X_AXIS,
125*cdf0e10cSrcweir     PROP_DIAGRAM_HAS_X_AXIS_DESCR,
126*cdf0e10cSrcweir     PROP_DIAGRAM_HAS_X_AXIS_TITLE,
127*cdf0e10cSrcweir     PROP_DIAGRAM_HAS_X_AXIS_GRID,
128*cdf0e10cSrcweir     PROP_DIAGRAM_HAS_X_AXIS_HELP_GRID,
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir     PROP_DIAGRAM_HAS_Y_AXIS,
131*cdf0e10cSrcweir     PROP_DIAGRAM_HAS_Y_AXIS_DESCR,
132*cdf0e10cSrcweir     PROP_DIAGRAM_HAS_Y_AXIS_TITLE,
133*cdf0e10cSrcweir     PROP_DIAGRAM_HAS_Y_AXIS_GRID,
134*cdf0e10cSrcweir     PROP_DIAGRAM_HAS_Y_AXIS_HELP_GRID,
135*cdf0e10cSrcweir 
136*cdf0e10cSrcweir     PROP_DIAGRAM_HAS_Z_AXIS,
137*cdf0e10cSrcweir     PROP_DIAGRAM_HAS_Z_AXIS_DESCR,
138*cdf0e10cSrcweir     PROP_DIAGRAM_HAS_Z_AXIS_TITLE,
139*cdf0e10cSrcweir     PROP_DIAGRAM_HAS_Z_AXIS_GRID,
140*cdf0e10cSrcweir     PROP_DIAGRAM_HAS_Z_AXIS_HELP_GRID,
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir     PROP_DIAGRAM_HAS_SECOND_X_AXIS,
143*cdf0e10cSrcweir     PROP_DIAGRAM_HAS_SECOND_X_AXIS_DESCR,
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir     PROP_DIAGRAM_HAS_SECOND_Y_AXIS,
146*cdf0e10cSrcweir     PROP_DIAGRAM_HAS_SECOND_Y_AXIS_DESCR,
147*cdf0e10cSrcweir 
148*cdf0e10cSrcweir     PROP_DIAGRAM_HAS_SECOND_X_AXIS_TITLE,
149*cdf0e10cSrcweir     PROP_DIAGRAM_HAS_SECOND_Y_AXIS_TITLE,
150*cdf0e10cSrcweir 
151*cdf0e10cSrcweir     PROP_DIAGRAM_AUTOMATIC_SIZE
152*cdf0e10cSrcweir };
153*cdf0e10cSrcweir 
154*cdf0e10cSrcweir void lcl_AddPropertiesToVector(
155*cdf0e10cSrcweir     ::std::vector< Property > & rOutProperties )
156*cdf0e10cSrcweir {
157*cdf0e10cSrcweir     rOutProperties.push_back(
158*cdf0e10cSrcweir         Property( C2U( "AttributedDataPoints" ),
159*cdf0e10cSrcweir                   PROP_DIAGRAM_ATTRIBUTED_DATA_POINTS,
160*cdf0e10cSrcweir                   ::getCppuType( reinterpret_cast< const uno::Sequence< uno::Sequence< sal_Int32 > > * >(0)),
161*cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
162*cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEVOID ));
163*cdf0e10cSrcweir 
164*cdf0e10cSrcweir     // see com.sun.star.chart.StackableDiagram
165*cdf0e10cSrcweir     rOutProperties.push_back(
166*cdf0e10cSrcweir         Property( C2U( "Percent" ),
167*cdf0e10cSrcweir                   PROP_DIAGRAM_PERCENT_STACKED,
168*cdf0e10cSrcweir                   ::getBooleanCppuType(),
169*cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
170*cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
171*cdf0e10cSrcweir     rOutProperties.push_back(
172*cdf0e10cSrcweir         Property( C2U( "Stacked" ),
173*cdf0e10cSrcweir                   PROP_DIAGRAM_STACKED,
174*cdf0e10cSrcweir                   ::getBooleanCppuType(),
175*cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
176*cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
177*cdf0e10cSrcweir 
178*cdf0e10cSrcweir     rOutProperties.push_back(
179*cdf0e10cSrcweir         Property( C2U( "Dim3D" ),
180*cdf0e10cSrcweir                   PROP_DIAGRAM_THREE_D,
181*cdf0e10cSrcweir                   ::getBooleanCppuType(),
182*cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
183*cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
184*cdf0e10cSrcweir 
185*cdf0e10cSrcweir     // see com.sun.star.chart.Chart3DBarProperties
186*cdf0e10cSrcweir     rOutProperties.push_back(
187*cdf0e10cSrcweir         Property( C2U( "SolidType" ),
188*cdf0e10cSrcweir                   PROP_DIAGRAM_SOLIDTYPE,
189*cdf0e10cSrcweir                   ::getCppuType( reinterpret_cast< sal_Int32 * >(0)),
190*cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
191*cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
192*cdf0e10cSrcweir 
193*cdf0e10cSrcweir     // see com.sun.star.chart.BarDiagram
194*cdf0e10cSrcweir     rOutProperties.push_back(
195*cdf0e10cSrcweir         Property( C2U( "Deep" ),
196*cdf0e10cSrcweir                   PROP_DIAGRAM_DEEP,
197*cdf0e10cSrcweir                   ::getBooleanCppuType(),
198*cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
199*cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
200*cdf0e10cSrcweir     rOutProperties.push_back(
201*cdf0e10cSrcweir         Property( C2U( "Vertical" ),
202*cdf0e10cSrcweir                   PROP_DIAGRAM_VERTICAL,
203*cdf0e10cSrcweir                   ::getBooleanCppuType(),
204*cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
205*cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
206*cdf0e10cSrcweir     rOutProperties.push_back(
207*cdf0e10cSrcweir         Property( C2U( "NumberOfLines" ),
208*cdf0e10cSrcweir                   PROP_DIAGRAM_NUMBER_OF_LINES,
209*cdf0e10cSrcweir                   ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
210*cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
211*cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
212*cdf0e10cSrcweir     rOutProperties.push_back(
213*cdf0e10cSrcweir         Property( C2U( "StackedBarsConnected" ),
214*cdf0e10cSrcweir                   PROP_DIAGRAM_STACKED_BARS_CONNECTED,
215*cdf0e10cSrcweir                   ::getBooleanCppuType(),
216*cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
217*cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
218*cdf0e10cSrcweir 
219*cdf0e10cSrcweir     rOutProperties.push_back(
220*cdf0e10cSrcweir         Property( C2U( "DataRowSource" ),
221*cdf0e10cSrcweir                   PROP_DIAGRAM_DATAROW_SOURCE,
222*cdf0e10cSrcweir                   ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::ChartDataRowSource * >(0)),
223*cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
224*cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
225*cdf0e10cSrcweir 
226*cdf0e10cSrcweir     rOutProperties.push_back(
227*cdf0e10cSrcweir         Property( C2U( "GroupBarsPerAxis" ),
228*cdf0e10cSrcweir                   PROP_DIAGRAM_GROUP_BARS_PER_AXIS,
229*cdf0e10cSrcweir                   ::getBooleanCppuType(),
230*cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
231*cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
232*cdf0e10cSrcweir 
233*cdf0e10cSrcweir     rOutProperties.push_back(
234*cdf0e10cSrcweir         Property( C2U( "IncludeHiddenCells" ),
235*cdf0e10cSrcweir                   PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS,
236*cdf0e10cSrcweir                   ::getBooleanCppuType(),
237*cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
238*cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
239*cdf0e10cSrcweir 
240*cdf0e10cSrcweir     //new for XY charts
241*cdf0e10cSrcweir     rOutProperties.push_back(
242*cdf0e10cSrcweir         Property( C2U( "SortByXValues" ),
243*cdf0e10cSrcweir                   PROP_DIAGRAM_SORT_BY_X_VALUES,
244*cdf0e10cSrcweir                   ::getBooleanCppuType(),
245*cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
246*cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
247*cdf0e10cSrcweir 
248*cdf0e10cSrcweir     //for pie and donut charts
249*cdf0e10cSrcweir     rOutProperties.push_back(
250*cdf0e10cSrcweir         Property( C2U( "StartingAngle" ),
251*cdf0e10cSrcweir                   PROP_DIAGRAM_STARTING_ANGLE,
252*cdf0e10cSrcweir                   ::getCppuType( reinterpret_cast< const sal_Int32 * >(0) ),
253*cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
254*cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
255*cdf0e10cSrcweir 
256*cdf0e10cSrcweir     //new for 3D charts
257*cdf0e10cSrcweir     rOutProperties.push_back(
258*cdf0e10cSrcweir         Property( C2U("RightAngledAxes"),
259*cdf0e10cSrcweir                   PROP_DIAGRAM_RIGHT_ANGLED_AXES,
260*cdf0e10cSrcweir                   ::getBooleanCppuType(),
261*cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
262*cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
263*cdf0e10cSrcweir 
264*cdf0e10cSrcweir     rOutProperties.push_back(
265*cdf0e10cSrcweir         Property( C2U("Perspective"),
266*cdf0e10cSrcweir                   PROP_DIAGRAM_PERSPECTIVE,
267*cdf0e10cSrcweir                   ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
268*cdf0e10cSrcweir                   beans::PropertyAttribute::MAYBEVOID ));
269*cdf0e10cSrcweir 
270*cdf0e10cSrcweir     rOutProperties.push_back(
271*cdf0e10cSrcweir         Property( C2U("RotationHorizontal"),
272*cdf0e10cSrcweir                   PROP_DIAGRAM_ROTATION_HORIZONTAL,
273*cdf0e10cSrcweir                   ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
274*cdf0e10cSrcweir                   beans::PropertyAttribute::MAYBEVOID ));
275*cdf0e10cSrcweir 
276*cdf0e10cSrcweir     rOutProperties.push_back(
277*cdf0e10cSrcweir         Property( C2U("RotationVertical"),
278*cdf0e10cSrcweir                   PROP_DIAGRAM_ROTATION_VERTICAL,
279*cdf0e10cSrcweir                   ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
280*cdf0e10cSrcweir                   beans::PropertyAttribute::MAYBEVOID ));
281*cdf0e10cSrcweir 
282*cdf0e10cSrcweir     // XAxisXSupplier
283*cdf0e10cSrcweir     rOutProperties.push_back(
284*cdf0e10cSrcweir         Property( C2U( "HasXAxis" ),
285*cdf0e10cSrcweir                   PROP_DIAGRAM_HAS_X_AXIS,
286*cdf0e10cSrcweir                   ::getBooleanCppuType(),
287*cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
288*cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
289*cdf0e10cSrcweir     rOutProperties.push_back(
290*cdf0e10cSrcweir         Property( C2U( "HasXAxisDescription" ),
291*cdf0e10cSrcweir                   PROP_DIAGRAM_HAS_X_AXIS_DESCR,
292*cdf0e10cSrcweir                   ::getBooleanCppuType(),
293*cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
294*cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
295*cdf0e10cSrcweir     rOutProperties.push_back(
296*cdf0e10cSrcweir         Property( C2U( "HasXAxisTitle" ),
297*cdf0e10cSrcweir                   PROP_DIAGRAM_HAS_X_AXIS_TITLE,
298*cdf0e10cSrcweir                   ::getBooleanCppuType(),
299*cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
300*cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
301*cdf0e10cSrcweir     rOutProperties.push_back(
302*cdf0e10cSrcweir         Property( C2U( "HasXAxisGrid" ),
303*cdf0e10cSrcweir                   PROP_DIAGRAM_HAS_X_AXIS_GRID,
304*cdf0e10cSrcweir                   ::getBooleanCppuType(),
305*cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
306*cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
307*cdf0e10cSrcweir     rOutProperties.push_back(
308*cdf0e10cSrcweir         Property( C2U( "HasXAxisHelpGrid" ),
309*cdf0e10cSrcweir                   PROP_DIAGRAM_HAS_X_AXIS_HELP_GRID,
310*cdf0e10cSrcweir                   ::getBooleanCppuType(),
311*cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
312*cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
313*cdf0e10cSrcweir 
314*cdf0e10cSrcweir     // XAxisYSupplier
315*cdf0e10cSrcweir     rOutProperties.push_back(
316*cdf0e10cSrcweir         Property( C2U( "HasYAxis" ),
317*cdf0e10cSrcweir                   PROP_DIAGRAM_HAS_Y_AXIS,
318*cdf0e10cSrcweir                   ::getBooleanCppuType(),
319*cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
320*cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
321*cdf0e10cSrcweir     rOutProperties.push_back(
322*cdf0e10cSrcweir         Property( C2U( "HasYAxisDescription" ),
323*cdf0e10cSrcweir                   PROP_DIAGRAM_HAS_Y_AXIS_DESCR,
324*cdf0e10cSrcweir                   ::getBooleanCppuType(),
325*cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
326*cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
327*cdf0e10cSrcweir     rOutProperties.push_back(
328*cdf0e10cSrcweir         Property( C2U( "HasYAxisTitle" ),
329*cdf0e10cSrcweir                   PROP_DIAGRAM_HAS_Y_AXIS_TITLE,
330*cdf0e10cSrcweir                   ::getBooleanCppuType(),
331*cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
332*cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
333*cdf0e10cSrcweir     rOutProperties.push_back(
334*cdf0e10cSrcweir         Property( C2U( "HasYAxisGrid" ),
335*cdf0e10cSrcweir                   PROP_DIAGRAM_HAS_Y_AXIS_GRID,
336*cdf0e10cSrcweir                   ::getBooleanCppuType(),
337*cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
338*cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
339*cdf0e10cSrcweir     rOutProperties.push_back(
340*cdf0e10cSrcweir         Property( C2U( "HasYAxisHelpGrid" ),
341*cdf0e10cSrcweir                   PROP_DIAGRAM_HAS_Y_AXIS_HELP_GRID,
342*cdf0e10cSrcweir                   ::getBooleanCppuType(),
343*cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
344*cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
345*cdf0e10cSrcweir 
346*cdf0e10cSrcweir     // XAxisZSupplier
347*cdf0e10cSrcweir     rOutProperties.push_back(
348*cdf0e10cSrcweir         Property( C2U( "HasZAxis" ),
349*cdf0e10cSrcweir                   PROP_DIAGRAM_HAS_Z_AXIS,
350*cdf0e10cSrcweir                   ::getBooleanCppuType(),
351*cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
352*cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
353*cdf0e10cSrcweir     rOutProperties.push_back(
354*cdf0e10cSrcweir         Property( C2U( "HasZAxisDescription" ),
355*cdf0e10cSrcweir                   PROP_DIAGRAM_HAS_Z_AXIS_DESCR,
356*cdf0e10cSrcweir                   ::getBooleanCppuType(),
357*cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
358*cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
359*cdf0e10cSrcweir     rOutProperties.push_back(
360*cdf0e10cSrcweir         Property( C2U( "HasZAxisTitle" ),
361*cdf0e10cSrcweir                   PROP_DIAGRAM_HAS_Z_AXIS_TITLE,
362*cdf0e10cSrcweir                   ::getBooleanCppuType(),
363*cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
364*cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
365*cdf0e10cSrcweir     rOutProperties.push_back(
366*cdf0e10cSrcweir         Property( C2U( "HasZAxisGrid" ),
367*cdf0e10cSrcweir                   PROP_DIAGRAM_HAS_Z_AXIS_GRID,
368*cdf0e10cSrcweir                   ::getBooleanCppuType(),
369*cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
370*cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
371*cdf0e10cSrcweir     rOutProperties.push_back(
372*cdf0e10cSrcweir         Property( C2U( "HasZAxisHelpGrid" ),
373*cdf0e10cSrcweir                   PROP_DIAGRAM_HAS_Z_AXIS_HELP_GRID,
374*cdf0e10cSrcweir                   ::getBooleanCppuType(),
375*cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
376*cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
377*cdf0e10cSrcweir 
378*cdf0e10cSrcweir     // XTwoAxisXSupplier
379*cdf0e10cSrcweir     rOutProperties.push_back(
380*cdf0e10cSrcweir         Property( C2U( "HasSecondaryXAxis" ),
381*cdf0e10cSrcweir                   PROP_DIAGRAM_HAS_SECOND_X_AXIS,
382*cdf0e10cSrcweir                   ::getBooleanCppuType(),
383*cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
384*cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
385*cdf0e10cSrcweir     rOutProperties.push_back(
386*cdf0e10cSrcweir         Property( C2U( "HasSecondaryXAxisDescription" ),
387*cdf0e10cSrcweir                   PROP_DIAGRAM_HAS_SECOND_X_AXIS_DESCR,
388*cdf0e10cSrcweir                   ::getBooleanCppuType(),
389*cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
390*cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
391*cdf0e10cSrcweir 
392*cdf0e10cSrcweir     // XTwoAxisYSupplier
393*cdf0e10cSrcweir     rOutProperties.push_back(
394*cdf0e10cSrcweir         Property( C2U( "HasSecondaryYAxis" ),
395*cdf0e10cSrcweir                   PROP_DIAGRAM_HAS_SECOND_Y_AXIS,
396*cdf0e10cSrcweir                   ::getBooleanCppuType(),
397*cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
398*cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
399*cdf0e10cSrcweir     rOutProperties.push_back(
400*cdf0e10cSrcweir         Property( C2U( "HasSecondaryYAxisDescription" ),
401*cdf0e10cSrcweir                   PROP_DIAGRAM_HAS_SECOND_Y_AXIS_DESCR,
402*cdf0e10cSrcweir                   ::getBooleanCppuType(),
403*cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
404*cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
405*cdf0e10cSrcweir 
406*cdf0e10cSrcweir     // XSecondAxisTitleSupplier
407*cdf0e10cSrcweir     rOutProperties.push_back(
408*cdf0e10cSrcweir         Property( C2U( "HasSecondaryXAxisTitle" ),
409*cdf0e10cSrcweir                   PROP_DIAGRAM_HAS_SECOND_X_AXIS_TITLE,
410*cdf0e10cSrcweir                   ::getBooleanCppuType(),
411*cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
412*cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
413*cdf0e10cSrcweir     rOutProperties.push_back(
414*cdf0e10cSrcweir         Property( C2U( "HasSecondaryYAxisTitle" ),
415*cdf0e10cSrcweir                   PROP_DIAGRAM_HAS_SECOND_Y_AXIS_TITLE,
416*cdf0e10cSrcweir                   ::getBooleanCppuType(),
417*cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
418*cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
419*cdf0e10cSrcweir 
420*cdf0e10cSrcweir     rOutProperties.push_back(
421*cdf0e10cSrcweir         Property( C2U( "MissingValueTreatment" ),
422*cdf0e10cSrcweir                   PROP_DIAGRAM_MISSING_VALUE_TREATMENT,
423*cdf0e10cSrcweir                   ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
424*cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
425*cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEVOID ));
426*cdf0e10cSrcweir 
427*cdf0e10cSrcweir     rOutProperties.push_back(
428*cdf0e10cSrcweir         Property( C2U( "AutomaticSize" ),
429*cdf0e10cSrcweir                   PROP_DIAGRAM_AUTOMATIC_SIZE,
430*cdf0e10cSrcweir                   ::getBooleanCppuType(),
431*cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
432*cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
433*cdf0e10cSrcweir }
434*cdf0e10cSrcweir 
435*cdf0e10cSrcweir struct StaticDiagramWrapperPropertyArray_Initializer
436*cdf0e10cSrcweir {
437*cdf0e10cSrcweir     Sequence< Property >* operator()()
438*cdf0e10cSrcweir     {
439*cdf0e10cSrcweir         static Sequence< Property > aPropSeq( lcl_GetPropertySequence() );
440*cdf0e10cSrcweir         return &aPropSeq;
441*cdf0e10cSrcweir     }
442*cdf0e10cSrcweir 
443*cdf0e10cSrcweir private:
444*cdf0e10cSrcweir     uno::Sequence< Property > lcl_GetPropertySequence()
445*cdf0e10cSrcweir     {
446*cdf0e10cSrcweir         ::std::vector< ::com::sun::star::beans::Property > aProperties;
447*cdf0e10cSrcweir         lcl_AddPropertiesToVector( aProperties );
448*cdf0e10cSrcweir         ::chart::LineProperties::AddPropertiesToVector( aProperties );
449*cdf0e10cSrcweir         ::chart::FillProperties::AddPropertiesToVector( aProperties );
450*cdf0e10cSrcweir         ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
451*cdf0e10cSrcweir         ::chart::SceneProperties::AddPropertiesToVector( aProperties );
452*cdf0e10cSrcweir         WrappedStatisticProperties::addProperties( aProperties );
453*cdf0e10cSrcweir         WrappedSymbolProperties::addProperties( aProperties );
454*cdf0e10cSrcweir         WrappedDataCaptionProperties::addProperties( aProperties );
455*cdf0e10cSrcweir         WrappedSplineProperties::addProperties( aProperties );
456*cdf0e10cSrcweir         WrappedStockProperties::addProperties( aProperties );
457*cdf0e10cSrcweir         WrappedAutomaticPositionProperties::addProperties( aProperties );
458*cdf0e10cSrcweir 
459*cdf0e10cSrcweir         ::std::sort( aProperties.begin(), aProperties.end(),
460*cdf0e10cSrcweir                      ::chart::PropertyNameLess() );
461*cdf0e10cSrcweir 
462*cdf0e10cSrcweir         return ::chart::ContainerHelper::ContainerToSequence( aProperties );
463*cdf0e10cSrcweir     }
464*cdf0e10cSrcweir };
465*cdf0e10cSrcweir 
466*cdf0e10cSrcweir struct StaticDiagramWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticDiagramWrapperPropertyArray_Initializer >
467*cdf0e10cSrcweir {
468*cdf0e10cSrcweir };
469*cdf0e10cSrcweir 
470*cdf0e10cSrcweir bool lcl_isXYChart( const Reference< chart2::XDiagram > xDiagram )
471*cdf0e10cSrcweir {
472*cdf0e10cSrcweir     bool bRet = false;
473*cdf0e10cSrcweir     Reference< chart2::XChartType > xChartType( ::chart::DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) );
474*cdf0e10cSrcweir     if( xChartType.is() )
475*cdf0e10cSrcweir     {
476*cdf0e10cSrcweir         rtl::OUString aChartType( xChartType->getChartType() );
477*cdf0e10cSrcweir         if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER) )
478*cdf0e10cSrcweir             bRet = true;
479*cdf0e10cSrcweir     }
480*cdf0e10cSrcweir     return bRet;
481*cdf0e10cSrcweir }
482*cdf0e10cSrcweir 
483*cdf0e10cSrcweir sal_Int32 lcl_getNewAPIIndexForOldAPIIndex(
484*cdf0e10cSrcweir                 sal_Int32 nOldAPIIndex
485*cdf0e10cSrcweir                 , Reference< chart2::XDiagram > xDiagram )
486*cdf0e10cSrcweir {
487*cdf0e10cSrcweir     sal_Int32 nNewAPIIndex = nOldAPIIndex;
488*cdf0e10cSrcweir 
489*cdf0e10cSrcweir     if( lcl_isXYChart( xDiagram ) )
490*cdf0e10cSrcweir     {
491*cdf0e10cSrcweir         if( nNewAPIIndex >= 1 )
492*cdf0e10cSrcweir             nNewAPIIndex -= 1;
493*cdf0e10cSrcweir     }
494*cdf0e10cSrcweir 
495*cdf0e10cSrcweir     ::std::vector< uno::Reference< chart2::XDataSeries > > aSeriesList(
496*cdf0e10cSrcweir         ::chart::DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
497*cdf0e10cSrcweir     if( nNewAPIIndex >= static_cast<sal_Int32>(aSeriesList.size()) )
498*cdf0e10cSrcweir         nNewAPIIndex = -1;
499*cdf0e10cSrcweir 
500*cdf0e10cSrcweir     return nNewAPIIndex;
501*cdf0e10cSrcweir }
502*cdf0e10cSrcweir 
503*cdf0e10cSrcweir typedef ::std::map< OUString, OUString > tChartTypeMap;
504*cdf0e10cSrcweir 
505*cdf0e10cSrcweir OUString lcl_getDiagramType( const OUString & rTemplateServiceName )
506*cdf0e10cSrcweir {
507*cdf0e10cSrcweir     const OUString aPrefix( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart2.template."));
508*cdf0e10cSrcweir 
509*cdf0e10cSrcweir     if( rTemplateServiceName.match( aPrefix ))
510*cdf0e10cSrcweir     {
511*cdf0e10cSrcweir         const OUString aName( rTemplateServiceName.copy( aPrefix.getLength()));
512*cdf0e10cSrcweir 
513*cdf0e10cSrcweir         // "Area" "StackedArea" "PercentStackedArea" "ThreeDArea"
514*cdf0e10cSrcweir         // "StackedThreeDArea" "PercentStackedThreeDArea"
515*cdf0e10cSrcweir         if( aName.indexOf( C2U("Area") ) != -1 )
516*cdf0e10cSrcweir             return C2U( "com.sun.star.chart.AreaDiagram" );
517*cdf0e10cSrcweir 
518*cdf0e10cSrcweir         // "Pie" "PieAllExploded" "ThreeDPie" "ThreeDPieAllExploded"
519*cdf0e10cSrcweir         if( aName.indexOf( C2U("Pie") ) != -1 )
520*cdf0e10cSrcweir             return C2U( "com.sun.star.chart.PieDiagram" );
521*cdf0e10cSrcweir 
522*cdf0e10cSrcweir         // "Column" "StackedColumn" "PercentStackedColumn" "ThreeDColumnDeep"
523*cdf0e10cSrcweir         // "ThreeDColumnFlat" "StackedThreeDColumnFlat"
524*cdf0e10cSrcweir         // "PercentStackedThreeDColumnFlat" "Bar" "StackedBar"
525*cdf0e10cSrcweir         // "PercentStackedBar" "ThreeDBarDeep" "ThreeDBarFlat"
526*cdf0e10cSrcweir         // "StackedThreeDBarFlat" "PercentStackedThreeDBarFlat" "ColumnWithLine"
527*cdf0e10cSrcweir         // "StackedColumnWithLine"
528*cdf0e10cSrcweir         if( aName.indexOf( C2U("Column") ) != -1 || aName.indexOf( C2U("Bar") ) != -1 )
529*cdf0e10cSrcweir             return C2U( "com.sun.star.chart.BarDiagram" );
530*cdf0e10cSrcweir 
531*cdf0e10cSrcweir         // "Donut" "DonutAllExploded" "ThreeDDonut" "ThreeDDonutAllExploded"
532*cdf0e10cSrcweir         if( aName.indexOf( C2U("Donut") ) != -1 )
533*cdf0e10cSrcweir             return C2U( "com.sun.star.chart.DonutDiagram" );
534*cdf0e10cSrcweir 
535*cdf0e10cSrcweir         // "ScatterLineSymbol" "ScatterLine" "ScatterSymbol" "ThreeDScatter"
536*cdf0e10cSrcweir         if( aName.indexOf( C2U("Scatter") ) != -1 )
537*cdf0e10cSrcweir             return C2U( "com.sun.star.chart.XYDiagram" );
538*cdf0e10cSrcweir 
539*cdf0e10cSrcweir         // "FilledNet" "StackedFilledNet" "PercentStackedFilledNet"
540*cdf0e10cSrcweir         if( aName.indexOf( C2U("FilledNet") ) != -1 )
541*cdf0e10cSrcweir             return C2U( "com.sun.star.chart.FilledNetDiagram" );
542*cdf0e10cSrcweir 
543*cdf0e10cSrcweir         // "Net" "NetSymbol" "NetLine" "StackedNet" "StackedNetSymbol"
544*cdf0e10cSrcweir         // "StackedNetLine" "PercentStackedNet" "PercentStackedNetSymbol"
545*cdf0e10cSrcweir         // "PercentStackedNetLine"
546*cdf0e10cSrcweir         if( aName.indexOf( C2U("Net") ) != -1 )
547*cdf0e10cSrcweir             return C2U( "com.sun.star.chart.NetDiagram" );
548*cdf0e10cSrcweir 
549*cdf0e10cSrcweir         // "StockLowHighClose" "StockOpenLowHighClose" "StockVolumeLowHighClose"
550*cdf0e10cSrcweir         // "StockVolumeOpenLowHighClose"
551*cdf0e10cSrcweir         if( aName.indexOf( C2U("Stock") ) != -1 )
552*cdf0e10cSrcweir             return C2U( "com.sun.star.chart.StockDiagram" );
553*cdf0e10cSrcweir 
554*cdf0e10cSrcweir         if( aName.indexOf( C2U("Bubble") ) != -1 )
555*cdf0e10cSrcweir             return C2U( "com.sun.star.chart.BubbleDiagram" );
556*cdf0e10cSrcweir 
557*cdf0e10cSrcweir         // Note: this must be checked after Bar, Net and Scatter
558*cdf0e10cSrcweir 
559*cdf0e10cSrcweir         // "Symbol" "StackedSymbol" "PercentStackedSymbol" "Line" "StackedLine"
560*cdf0e10cSrcweir         // "PercentStackedLine" "LineSymbol" "StackedLineSymbol"
561*cdf0e10cSrcweir         // "PercentStackedLineSymbol" "ThreeDLine" "StackedThreeDLine"
562*cdf0e10cSrcweir         // "PercentStackedThreeDLine" "ThreeDLineDeep"
563*cdf0e10cSrcweir         if( aName.indexOf( C2U("Line") ) != -1 || aName.indexOf( C2U("Symbol") ) != -1 )
564*cdf0e10cSrcweir             return C2U( "com.sun.star.chart.LineDiagram" );
565*cdf0e10cSrcweir 
566*cdf0e10cSrcweir         OSL_ENSURE( false, "unknown template" );
567*cdf0e10cSrcweir     }
568*cdf0e10cSrcweir 
569*cdf0e10cSrcweir     return OUString();
570*cdf0e10cSrcweir }
571*cdf0e10cSrcweir 
572*cdf0e10cSrcweir typedef ::comphelper::MakeMap< ::rtl::OUString, ::rtl::OUString > tMakeStringStringMap;
573*cdf0e10cSrcweir const tMakeStringStringMap& lcl_getChartTypeNameMap()
574*cdf0e10cSrcweir {
575*cdf0e10cSrcweir     static tMakeStringStringMap g_aChartTypeNameMap =
576*cdf0e10cSrcweir         tMakeStringStringMap
577*cdf0e10cSrcweir         ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.LineChartType" )
578*cdf0e10cSrcweir         , ::rtl::OUString::createFromAscii( "com.sun.star.chart.LineDiagram" ) )
579*cdf0e10cSrcweir 
580*cdf0e10cSrcweir         ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.AreaChartType" )
581*cdf0e10cSrcweir         , ::rtl::OUString::createFromAscii( "com.sun.star.chart.AreaDiagram" ) )
582*cdf0e10cSrcweir 
583*cdf0e10cSrcweir         ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.ColumnChartType" )
584*cdf0e10cSrcweir         , ::rtl::OUString::createFromAscii( "com.sun.star.chart.BarDiagram" ) )
585*cdf0e10cSrcweir 
586*cdf0e10cSrcweir         ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.PieChartType" )
587*cdf0e10cSrcweir         , ::rtl::OUString::createFromAscii( "com.sun.star.chart.PieDiagram" ) )
588*cdf0e10cSrcweir 
589*cdf0e10cSrcweir         ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.DonutChartType" )
590*cdf0e10cSrcweir         , ::rtl::OUString::createFromAscii( "com.sun.star.chart.DonutDiagram" ) )
591*cdf0e10cSrcweir 
592*cdf0e10cSrcweir         ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.ScatterChartType" )
593*cdf0e10cSrcweir         , ::rtl::OUString::createFromAscii( "com.sun.star.chart.XYDiagram" ) )
594*cdf0e10cSrcweir 
595*cdf0e10cSrcweir         ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.FilledNetChartType" )
596*cdf0e10cSrcweir         , ::rtl::OUString::createFromAscii( "com.sun.star.chart.FilledNetDiagram" ) )
597*cdf0e10cSrcweir 
598*cdf0e10cSrcweir         ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.NetChartType" )
599*cdf0e10cSrcweir         , ::rtl::OUString::createFromAscii( "com.sun.star.chart.NetDiagram" ) )
600*cdf0e10cSrcweir 
601*cdf0e10cSrcweir         ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.CandleStickChartType" )
602*cdf0e10cSrcweir         , ::rtl::OUString::createFromAscii( "com.sun.star.chart.StockDiagram" ) )
603*cdf0e10cSrcweir 
604*cdf0e10cSrcweir         ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.BubbleChartType" )
605*cdf0e10cSrcweir         , ::rtl::OUString::createFromAscii( "com.sun.star.chart.BubbleDiagram" ) )
606*cdf0e10cSrcweir 
607*cdf0e10cSrcweir         ;
608*cdf0e10cSrcweir     return g_aChartTypeNameMap;
609*cdf0e10cSrcweir }
610*cdf0e10cSrcweir 
611*cdf0e10cSrcweir 
612*cdf0e10cSrcweir OUString lcl_getOldChartTypeName( const OUString & rNewChartTypeName )
613*cdf0e10cSrcweir {
614*cdf0e10cSrcweir     OUString aOld(rNewChartTypeName);
615*cdf0e10cSrcweir 
616*cdf0e10cSrcweir     const tMakeStringStringMap& rMap = lcl_getChartTypeNameMap();
617*cdf0e10cSrcweir     tMakeStringStringMap::const_iterator aIt( rMap.find( rNewChartTypeName ));
618*cdf0e10cSrcweir     if( aIt != rMap.end())
619*cdf0e10cSrcweir     {
620*cdf0e10cSrcweir         aOld = aIt->second;
621*cdf0e10cSrcweir     }
622*cdf0e10cSrcweir     return aOld;
623*cdf0e10cSrcweir }
624*cdf0e10cSrcweir 
625*cdf0e10cSrcweir } // anonymous namespace
626*cdf0e10cSrcweir 
627*cdf0e10cSrcweir // --------------------------------------------------------------------------------
628*cdf0e10cSrcweir 
629*cdf0e10cSrcweir namespace chart
630*cdf0e10cSrcweir {
631*cdf0e10cSrcweir namespace wrapper
632*cdf0e10cSrcweir {
633*cdf0e10cSrcweir 
634*cdf0e10cSrcweir DiagramWrapper::DiagramWrapper(
635*cdf0e10cSrcweir     ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) :
636*cdf0e10cSrcweir         m_spChart2ModelContact( spChart2ModelContact ),
637*cdf0e10cSrcweir         m_aEventListenerContainer( m_aMutex )
638*cdf0e10cSrcweir {
639*cdf0e10cSrcweir }
640*cdf0e10cSrcweir 
641*cdf0e10cSrcweir DiagramWrapper::~DiagramWrapper()
642*cdf0e10cSrcweir {}
643*cdf0e10cSrcweir 
644*cdf0e10cSrcweir // ____ XDiagram ____
645*cdf0e10cSrcweir OUString SAL_CALL DiagramWrapper::getDiagramType()
646*cdf0e10cSrcweir     throw (uno::RuntimeException)
647*cdf0e10cSrcweir {
648*cdf0e10cSrcweir     OUString aRet;
649*cdf0e10cSrcweir 
650*cdf0e10cSrcweir     Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
651*cdf0e10cSrcweir     Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
652*cdf0e10cSrcweir     if( xChartDoc.is() && xDiagram.is() )
653*cdf0e10cSrcweir     {
654*cdf0e10cSrcweir         Reference< beans::XPropertySet > xChartDocProp( xChartDoc, uno::UNO_QUERY );
655*cdf0e10cSrcweir         if( xChartDocProp.is() )
656*cdf0e10cSrcweir         {
657*cdf0e10cSrcweir             uno::Reference< util::XRefreshable > xAddIn;
658*cdf0e10cSrcweir             if( xChartDocProp->getPropertyValue( C2U( "AddIn" ) ) >>= xAddIn )
659*cdf0e10cSrcweir             {
660*cdf0e10cSrcweir                 uno::Reference< lang::XServiceName > xServiceName( xAddIn, uno::UNO_QUERY );
661*cdf0e10cSrcweir 			    if( xServiceName.is())
662*cdf0e10cSrcweir 				    return xServiceName->getServiceName();
663*cdf0e10cSrcweir             }
664*cdf0e10cSrcweir         }
665*cdf0e10cSrcweir 
666*cdf0e10cSrcweir         Reference< lang::XMultiServiceFactory > xChartTypeManager( xChartDoc->getChartTypeManager(), uno::UNO_QUERY );
667*cdf0e10cSrcweir         DiagramHelper::tTemplateWithServiceName aTemplateAndService =
668*cdf0e10cSrcweir             DiagramHelper::getTemplateForDiagram( xDiagram, xChartTypeManager );
669*cdf0e10cSrcweir 
670*cdf0e10cSrcweir         aRet = lcl_getDiagramType( aTemplateAndService.second );
671*cdf0e10cSrcweir     }
672*cdf0e10cSrcweir 
673*cdf0e10cSrcweir     if( !aRet.getLength())
674*cdf0e10cSrcweir     {
675*cdf0e10cSrcweir         // none of the standard templates matched
676*cdf0e10cSrcweir         // use first chart type
677*cdf0e10cSrcweir         Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) );
678*cdf0e10cSrcweir         if( xChartType.is() )
679*cdf0e10cSrcweir         {
680*cdf0e10cSrcweir             aRet = xChartType->getChartType();
681*cdf0e10cSrcweir             if( aRet.getLength() )
682*cdf0e10cSrcweir                 aRet = lcl_getOldChartTypeName( aRet );
683*cdf0e10cSrcweir         }
684*cdf0e10cSrcweir         if( !aRet.getLength())
685*cdf0e10cSrcweir             aRet = C2U( "com.sun.star.chart.BarDiagram" );
686*cdf0e10cSrcweir     }
687*cdf0e10cSrcweir 
688*cdf0e10cSrcweir     return aRet;
689*cdf0e10cSrcweir }
690*cdf0e10cSrcweir 
691*cdf0e10cSrcweir Reference<
692*cdf0e10cSrcweir     beans::XPropertySet > SAL_CALL DiagramWrapper::getDataRowProperties( sal_Int32 nRow )
693*cdf0e10cSrcweir     throw (lang::IndexOutOfBoundsException,
694*cdf0e10cSrcweir            uno::RuntimeException)
695*cdf0e10cSrcweir {
696*cdf0e10cSrcweir     if( nRow < 0 )
697*cdf0e10cSrcweir         throw lang::IndexOutOfBoundsException(
698*cdf0e10cSrcweir             C2U( "DataSeries index invalid" ), static_cast< ::cppu::OWeakObject * >( this ));
699*cdf0e10cSrcweir 
700*cdf0e10cSrcweir     Reference< chart2::XDataSeries > xSeries;
701*cdf0e10cSrcweir 
702*cdf0e10cSrcweir     sal_Int32 nNewAPIIndex = lcl_getNewAPIIndexForOldAPIIndex( nRow, m_spChart2ModelContact->getChart2Diagram() );
703*cdf0e10cSrcweir     if( nNewAPIIndex < 0 )
704*cdf0e10cSrcweir         throw lang::IndexOutOfBoundsException(
705*cdf0e10cSrcweir             C2U( "DataSeries index invalid" ), static_cast< ::cppu::OWeakObject * >( this ));
706*cdf0e10cSrcweir 
707*cdf0e10cSrcweir     Reference< beans::XPropertySet > xRet( new DataSeriesPointWrapper(
708*cdf0e10cSrcweir           DataSeriesPointWrapper::DATA_SERIES, nNewAPIIndex, 0, m_spChart2ModelContact ) );
709*cdf0e10cSrcweir     return xRet;
710*cdf0e10cSrcweir }
711*cdf0e10cSrcweir 
712*cdf0e10cSrcweir Reference<
713*cdf0e10cSrcweir     beans::XPropertySet > SAL_CALL DiagramWrapper::getDataPointProperties( sal_Int32 nCol, sal_Int32 nRow )
714*cdf0e10cSrcweir     throw (lang::IndexOutOfBoundsException,
715*cdf0e10cSrcweir            uno::RuntimeException)
716*cdf0e10cSrcweir {
717*cdf0e10cSrcweir     if( nCol < 0 || nRow < 0 )
718*cdf0e10cSrcweir         throw lang::IndexOutOfBoundsException(
719*cdf0e10cSrcweir             C2U( "DataSeries index invalid" ), static_cast< ::cppu::OWeakObject * >( this ));
720*cdf0e10cSrcweir 
721*cdf0e10cSrcweir     Reference< chart2::XDataSeries > xSeries;
722*cdf0e10cSrcweir 
723*cdf0e10cSrcweir     sal_Int32 nNewAPIIndex = lcl_getNewAPIIndexForOldAPIIndex( nRow, m_spChart2ModelContact->getChart2Diagram() );
724*cdf0e10cSrcweir     if( nNewAPIIndex < 0 )
725*cdf0e10cSrcweir         throw lang::IndexOutOfBoundsException(
726*cdf0e10cSrcweir             C2U( "DataSeries index invalid" ), static_cast< ::cppu::OWeakObject * >( this ));
727*cdf0e10cSrcweir 
728*cdf0e10cSrcweir     //todo: check borders of point index
729*cdf0e10cSrcweir 
730*cdf0e10cSrcweir     Reference< beans::XPropertySet > xRet( new DataSeriesPointWrapper(
731*cdf0e10cSrcweir           DataSeriesPointWrapper::DATA_POINT, nNewAPIIndex, nCol, m_spChart2ModelContact ) );
732*cdf0e10cSrcweir 
733*cdf0e10cSrcweir     return xRet;
734*cdf0e10cSrcweir }
735*cdf0e10cSrcweir 
736*cdf0e10cSrcweir // ____ XShape (base of XDiagram) ____
737*cdf0e10cSrcweir awt::Point SAL_CALL DiagramWrapper::getPosition()
738*cdf0e10cSrcweir     throw (uno::RuntimeException)
739*cdf0e10cSrcweir {
740*cdf0e10cSrcweir     awt::Point aPosition = ToPoint( m_spChart2ModelContact->GetDiagramRectangleIncludingAxes() );
741*cdf0e10cSrcweir     return aPosition;
742*cdf0e10cSrcweir }
743*cdf0e10cSrcweir 
744*cdf0e10cSrcweir void SAL_CALL DiagramWrapper::setPosition( const awt::Point& aPosition )
745*cdf0e10cSrcweir     throw (uno::RuntimeException)
746*cdf0e10cSrcweir {
747*cdf0e10cSrcweir     ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
748*cdf0e10cSrcweir     Reference< beans::XPropertySet > xProp( this->getInnerPropertySet() );
749*cdf0e10cSrcweir     if( xProp.is() )
750*cdf0e10cSrcweir     {
751*cdf0e10cSrcweir         awt::Size aPageSize( m_spChart2ModelContact->GetPageSize() );
752*cdf0e10cSrcweir 
753*cdf0e10cSrcweir         chart2::RelativePosition aRelativePosition;
754*cdf0e10cSrcweir         aRelativePosition.Anchor = drawing::Alignment_TOP_LEFT;
755*cdf0e10cSrcweir         aRelativePosition.Primary = double(aPosition.X)/double(aPageSize.Width);
756*cdf0e10cSrcweir         aRelativePosition.Secondary = double(aPosition.Y)/double(aPageSize.Height);
757*cdf0e10cSrcweir         if( aRelativePosition.Primary < 0 || aRelativePosition.Secondary < 0 || aRelativePosition.Primary > 1 || aRelativePosition.Secondary > 1 )
758*cdf0e10cSrcweir         {
759*cdf0e10cSrcweir             DBG_ERROR("DiagramWrapper::setPosition called with a position out of range -> automatic values are taken instead" );
760*cdf0e10cSrcweir             uno::Any aEmpty;
761*cdf0e10cSrcweir             xProp->setPropertyValue( C2U( "RelativePosition" ), aEmpty );
762*cdf0e10cSrcweir             return;
763*cdf0e10cSrcweir         }
764*cdf0e10cSrcweir         xProp->setPropertyValue( C2U( "RelativePosition" ), uno::makeAny(aRelativePosition) );
765*cdf0e10cSrcweir         xProp->setPropertyValue( C2U( "PosSizeExcludeAxes" ), uno::makeAny(false) );
766*cdf0e10cSrcweir     }
767*cdf0e10cSrcweir }
768*cdf0e10cSrcweir 
769*cdf0e10cSrcweir awt::Size SAL_CALL DiagramWrapper::getSize()
770*cdf0e10cSrcweir     throw (uno::RuntimeException)
771*cdf0e10cSrcweir {
772*cdf0e10cSrcweir     awt::Size aSize = ToSize( m_spChart2ModelContact->GetDiagramRectangleIncludingAxes() );
773*cdf0e10cSrcweir     return aSize;
774*cdf0e10cSrcweir }
775*cdf0e10cSrcweir 
776*cdf0e10cSrcweir void SAL_CALL DiagramWrapper::setSize( const awt::Size& aSize )
777*cdf0e10cSrcweir     throw (beans::PropertyVetoException,
778*cdf0e10cSrcweir            uno::RuntimeException)
779*cdf0e10cSrcweir {
780*cdf0e10cSrcweir     ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
781*cdf0e10cSrcweir     Reference< beans::XPropertySet > xProp( this->getInnerPropertySet() );
782*cdf0e10cSrcweir     if( xProp.is() )
783*cdf0e10cSrcweir     {
784*cdf0e10cSrcweir         awt::Size aPageSize( m_spChart2ModelContact->GetPageSize() );
785*cdf0e10cSrcweir 
786*cdf0e10cSrcweir         chart2::RelativeSize aRelativeSize;
787*cdf0e10cSrcweir         aRelativeSize.Primary = double(aSize.Width)/double(aPageSize.Width);
788*cdf0e10cSrcweir         aRelativeSize.Secondary = double(aSize.Height)/double(aPageSize.Height);
789*cdf0e10cSrcweir 
790*cdf0e10cSrcweir         if( aRelativeSize.Primary > 1 || aRelativeSize.Secondary > 1 )
791*cdf0e10cSrcweir         {
792*cdf0e10cSrcweir             DBG_ERROR("DiagramWrapper::setSize called with sizes bigger than page -> automatic values are taken instead" );
793*cdf0e10cSrcweir             uno::Any aEmpty;
794*cdf0e10cSrcweir             xProp->setPropertyValue( C2U( "RelativeSize" ), aEmpty );
795*cdf0e10cSrcweir             return;
796*cdf0e10cSrcweir         }
797*cdf0e10cSrcweir 
798*cdf0e10cSrcweir         xProp->setPropertyValue( C2U( "RelativeSize" ), uno::makeAny(aRelativeSize) );
799*cdf0e10cSrcweir         xProp->setPropertyValue( C2U( "PosSizeExcludeAxes" ), uno::makeAny(false) );
800*cdf0e10cSrcweir     }
801*cdf0e10cSrcweir }
802*cdf0e10cSrcweir 
803*cdf0e10cSrcweir // ____ XShapeDescriptor (base of XShape) ____
804*cdf0e10cSrcweir OUString SAL_CALL DiagramWrapper::getShapeType()
805*cdf0e10cSrcweir     throw (uno::RuntimeException)
806*cdf0e10cSrcweir {
807*cdf0e10cSrcweir 	return C2U( "com.sun.star.chart.Diagram" );
808*cdf0e10cSrcweir }
809*cdf0e10cSrcweir 
810*cdf0e10cSrcweir // ____ XDiagramPositioning ____
811*cdf0e10cSrcweir 
812*cdf0e10cSrcweir void SAL_CALL DiagramWrapper::setAutomaticDiagramPositioning() throw (uno::RuntimeException)
813*cdf0e10cSrcweir {
814*cdf0e10cSrcweir     ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
815*cdf0e10cSrcweir     uno::Reference< beans::XPropertySet > xDiaProps( this->getDiagram(), uno::UNO_QUERY );
816*cdf0e10cSrcweir     if( xDiaProps.is() )
817*cdf0e10cSrcweir     {
818*cdf0e10cSrcweir         xDiaProps->setPropertyValue( C2U( "RelativeSize" ), Any() );
819*cdf0e10cSrcweir         xDiaProps->setPropertyValue( C2U( "RelativePosition" ), Any() );
820*cdf0e10cSrcweir     }
821*cdf0e10cSrcweir }
822*cdf0e10cSrcweir ::sal_Bool SAL_CALL DiagramWrapper::isAutomaticDiagramPositioning(  ) throw (uno::RuntimeException)
823*cdf0e10cSrcweir {
824*cdf0e10cSrcweir     uno::Reference< beans::XPropertySet > xDiaProps( this->getDiagram(), uno::UNO_QUERY );
825*cdf0e10cSrcweir     if( xDiaProps.is() )
826*cdf0e10cSrcweir     {
827*cdf0e10cSrcweir         Any aRelativeSize( xDiaProps->getPropertyValue( C2U( "RelativeSize" ) ) );
828*cdf0e10cSrcweir         Any aRelativePosition( xDiaProps->getPropertyValue( C2U( "RelativePosition" ) ) );
829*cdf0e10cSrcweir         if( aRelativeSize.hasValue() && aRelativePosition.hasValue() )
830*cdf0e10cSrcweir             return false;
831*cdf0e10cSrcweir     }
832*cdf0e10cSrcweir     return true;
833*cdf0e10cSrcweir }
834*cdf0e10cSrcweir void SAL_CALL DiagramWrapper::setDiagramPositionExcludingAxes( const awt::Rectangle& rPositionRect ) throw (uno::RuntimeException)
835*cdf0e10cSrcweir {
836*cdf0e10cSrcweir     ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
837*cdf0e10cSrcweir     DiagramHelper::setDiagramPositioning( m_spChart2ModelContact->getChartModel(), rPositionRect );
838*cdf0e10cSrcweir     uno::Reference< beans::XPropertySet > xDiaProps( this->getDiagram(), uno::UNO_QUERY );
839*cdf0e10cSrcweir     if( xDiaProps.is() )
840*cdf0e10cSrcweir         xDiaProps->setPropertyValue(C2U("PosSizeExcludeAxes"), uno::makeAny(true) );
841*cdf0e10cSrcweir }
842*cdf0e10cSrcweir ::sal_Bool SAL_CALL DiagramWrapper::isExcludingDiagramPositioning() throw (uno::RuntimeException)
843*cdf0e10cSrcweir {
844*cdf0e10cSrcweir     uno::Reference< beans::XPropertySet > xDiaProps( this->getDiagram(), uno::UNO_QUERY );
845*cdf0e10cSrcweir     if( xDiaProps.is() )
846*cdf0e10cSrcweir     {
847*cdf0e10cSrcweir         Any aRelativeSize( xDiaProps->getPropertyValue( C2U( "RelativeSize" ) ) );
848*cdf0e10cSrcweir         Any aRelativePosition( xDiaProps->getPropertyValue( C2U( "RelativePosition" ) ) );
849*cdf0e10cSrcweir         if( aRelativeSize.hasValue() && aRelativePosition.hasValue() )
850*cdf0e10cSrcweir         {
851*cdf0e10cSrcweir             sal_Bool bPosSizeExcludeAxes = false;
852*cdf0e10cSrcweir             xDiaProps->getPropertyValue( C2U( "PosSizeExcludeAxes" ) ) >>= bPosSizeExcludeAxes;
853*cdf0e10cSrcweir             return bPosSizeExcludeAxes;
854*cdf0e10cSrcweir         }
855*cdf0e10cSrcweir     }
856*cdf0e10cSrcweir     return false;
857*cdf0e10cSrcweir }
858*cdf0e10cSrcweir awt::Rectangle SAL_CALL DiagramWrapper::calculateDiagramPositionExcludingAxes(  ) throw (uno::RuntimeException)
859*cdf0e10cSrcweir {
860*cdf0e10cSrcweir     return m_spChart2ModelContact->GetDiagramRectangleExcludingAxes();
861*cdf0e10cSrcweir }
862*cdf0e10cSrcweir void SAL_CALL DiagramWrapper::setDiagramPositionIncludingAxes( const awt::Rectangle& rPositionRect ) throw (uno::RuntimeException)
863*cdf0e10cSrcweir {
864*cdf0e10cSrcweir     ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
865*cdf0e10cSrcweir     DiagramHelper::setDiagramPositioning( m_spChart2ModelContact->getChartModel(), rPositionRect );
866*cdf0e10cSrcweir     uno::Reference< beans::XPropertySet > xDiaProps( this->getDiagram(), uno::UNO_QUERY );
867*cdf0e10cSrcweir     if( xDiaProps.is() )
868*cdf0e10cSrcweir         xDiaProps->setPropertyValue(C2U("PosSizeExcludeAxes"), uno::makeAny(false) );
869*cdf0e10cSrcweir }
870*cdf0e10cSrcweir awt::Rectangle SAL_CALL DiagramWrapper::calculateDiagramPositionIncludingAxes(  ) throw (uno::RuntimeException)
871*cdf0e10cSrcweir {
872*cdf0e10cSrcweir     return m_spChart2ModelContact->GetDiagramRectangleIncludingAxes();
873*cdf0e10cSrcweir }
874*cdf0e10cSrcweir void SAL_CALL DiagramWrapper::setDiagramPositionIncludingAxesAndAxisTitles( const awt::Rectangle& rPositionRect ) throw (uno::RuntimeException)
875*cdf0e10cSrcweir {
876*cdf0e10cSrcweir     ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
877*cdf0e10cSrcweir     awt::Rectangle aRect( m_spChart2ModelContact->SubstractAxisTitleSizes(rPositionRect) );
878*cdf0e10cSrcweir     DiagramWrapper::setDiagramPositionIncludingAxes( aRect );
879*cdf0e10cSrcweir }
880*cdf0e10cSrcweir ::com::sun::star::awt::Rectangle SAL_CALL DiagramWrapper::calculateDiagramPositionIncludingAxesAndAxisTitles(  ) throw (::com::sun::star::uno::RuntimeException)
881*cdf0e10cSrcweir {
882*cdf0e10cSrcweir     return m_spChart2ModelContact->GetDiagramRectangleIncludingTitle();
883*cdf0e10cSrcweir }
884*cdf0e10cSrcweir 
885*cdf0e10cSrcweir // ____ XAxisSupplier ____
886*cdf0e10cSrcweir Reference< XAxis > SAL_CALL DiagramWrapper::getAxis( sal_Int32 nDimensionIndex )
887*cdf0e10cSrcweir     throw (uno::RuntimeException)
888*cdf0e10cSrcweir {
889*cdf0e10cSrcweir     Reference< XAxis > xAxis;
890*cdf0e10cSrcweir     if(!nDimensionIndex)
891*cdf0e10cSrcweir     {
892*cdf0e10cSrcweir         if( !m_xXAxis.is() )
893*cdf0e10cSrcweir             m_xXAxis = new AxisWrapper( AxisWrapper::X_AXIS, m_spChart2ModelContact );
894*cdf0e10cSrcweir         xAxis = m_xXAxis;
895*cdf0e10cSrcweir     }
896*cdf0e10cSrcweir     else if(1==nDimensionIndex)
897*cdf0e10cSrcweir     {
898*cdf0e10cSrcweir         if( !m_xYAxis.is() )
899*cdf0e10cSrcweir             m_xYAxis = new AxisWrapper( AxisWrapper::Y_AXIS, m_spChart2ModelContact );
900*cdf0e10cSrcweir         xAxis = m_xYAxis;
901*cdf0e10cSrcweir     }
902*cdf0e10cSrcweir     else if(2==nDimensionIndex)
903*cdf0e10cSrcweir     {
904*cdf0e10cSrcweir         if( !m_xZAxis.is() )
905*cdf0e10cSrcweir             m_xZAxis = new AxisWrapper( AxisWrapper::Z_AXIS, m_spChart2ModelContact );
906*cdf0e10cSrcweir         xAxis = m_xZAxis;
907*cdf0e10cSrcweir     }
908*cdf0e10cSrcweir     return xAxis;
909*cdf0e10cSrcweir }
910*cdf0e10cSrcweir 
911*cdf0e10cSrcweir Reference< XAxis > SAL_CALL DiagramWrapper::getSecondaryAxis( sal_Int32 nDimensionIndex )
912*cdf0e10cSrcweir     throw (uno::RuntimeException)
913*cdf0e10cSrcweir {
914*cdf0e10cSrcweir     Reference< XAxis > xAxis;
915*cdf0e10cSrcweir     if(!nDimensionIndex)
916*cdf0e10cSrcweir     {
917*cdf0e10cSrcweir         if( !m_xSecondXAxis.is() )
918*cdf0e10cSrcweir             m_xSecondXAxis = new AxisWrapper( AxisWrapper::SECOND_X_AXIS, m_spChart2ModelContact );
919*cdf0e10cSrcweir         xAxis = m_xSecondXAxis;
920*cdf0e10cSrcweir     }
921*cdf0e10cSrcweir     else if(1==nDimensionIndex)
922*cdf0e10cSrcweir     {
923*cdf0e10cSrcweir         if( !m_xSecondYAxis.is() )
924*cdf0e10cSrcweir             m_xSecondYAxis = new AxisWrapper( AxisWrapper::SECOND_Y_AXIS, m_spChart2ModelContact );
925*cdf0e10cSrcweir         xAxis = m_xSecondYAxis;
926*cdf0e10cSrcweir     }
927*cdf0e10cSrcweir     return xAxis;
928*cdf0e10cSrcweir }
929*cdf0e10cSrcweir 
930*cdf0e10cSrcweir // ____ XAxisZSupplier ____
931*cdf0e10cSrcweir Reference< drawing::XShape > SAL_CALL DiagramWrapper::getZAxisTitle()
932*cdf0e10cSrcweir     throw (uno::RuntimeException)
933*cdf0e10cSrcweir {
934*cdf0e10cSrcweir     Reference< drawing::XShape > xRet;
935*cdf0e10cSrcweir     Reference< XAxis > xAxis( getAxis(2) );
936*cdf0e10cSrcweir     if( xAxis.is() )
937*cdf0e10cSrcweir         xRet = Reference< drawing::XShape >( xAxis->getAxisTitle(), uno::UNO_QUERY );
938*cdf0e10cSrcweir     return xRet;
939*cdf0e10cSrcweir }
940*cdf0e10cSrcweir 
941*cdf0e10cSrcweir Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getZMainGrid()
942*cdf0e10cSrcweir     throw (uno::RuntimeException)
943*cdf0e10cSrcweir {
944*cdf0e10cSrcweir     Reference< beans::XPropertySet > xRet;
945*cdf0e10cSrcweir     Reference< XAxis > xAxis( getAxis(2) );
946*cdf0e10cSrcweir     if( xAxis.is() )
947*cdf0e10cSrcweir         xRet = xAxis->getMajorGrid();
948*cdf0e10cSrcweir     return xRet;
949*cdf0e10cSrcweir }
950*cdf0e10cSrcweir 
951*cdf0e10cSrcweir Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getZHelpGrid()
952*cdf0e10cSrcweir     throw (uno::RuntimeException)
953*cdf0e10cSrcweir {
954*cdf0e10cSrcweir     Reference< beans::XPropertySet > xRet;
955*cdf0e10cSrcweir     Reference< XAxis > xAxis( getAxis(2) );
956*cdf0e10cSrcweir     if( xAxis.is() )
957*cdf0e10cSrcweir         xRet = xAxis->getMinorGrid();
958*cdf0e10cSrcweir     return xRet;
959*cdf0e10cSrcweir }
960*cdf0e10cSrcweir 
961*cdf0e10cSrcweir Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getZAxis()
962*cdf0e10cSrcweir     throw (uno::RuntimeException)
963*cdf0e10cSrcweir {
964*cdf0e10cSrcweir     if( ! m_xZAxis.is())
965*cdf0e10cSrcweir         m_xZAxis = new AxisWrapper( AxisWrapper::Z_AXIS, m_spChart2ModelContact );
966*cdf0e10cSrcweir     return Reference< beans::XPropertySet >( m_xZAxis, uno::UNO_QUERY );
967*cdf0e10cSrcweir }
968*cdf0e10cSrcweir 
969*cdf0e10cSrcweir 
970*cdf0e10cSrcweir // ____ XTwoAxisXSupplier ____
971*cdf0e10cSrcweir Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getSecondaryXAxis()
972*cdf0e10cSrcweir     throw (uno::RuntimeException)
973*cdf0e10cSrcweir {
974*cdf0e10cSrcweir     if( ! m_xSecondXAxis.is())
975*cdf0e10cSrcweir         m_xSecondXAxis = new AxisWrapper( AxisWrapper::SECOND_X_AXIS, m_spChart2ModelContact );
976*cdf0e10cSrcweir     return Reference< beans::XPropertySet >( m_xSecondXAxis, uno::UNO_QUERY );
977*cdf0e10cSrcweir }
978*cdf0e10cSrcweir 
979*cdf0e10cSrcweir 
980*cdf0e10cSrcweir // ____ XAxisXSupplier (base of XTwoAxisXSupplier) ____
981*cdf0e10cSrcweir Reference< drawing::XShape > SAL_CALL DiagramWrapper::getXAxisTitle()
982*cdf0e10cSrcweir     throw (uno::RuntimeException)
983*cdf0e10cSrcweir {
984*cdf0e10cSrcweir     Reference< drawing::XShape > xRet;
985*cdf0e10cSrcweir     Reference< XAxis > xAxis( getAxis(0) );
986*cdf0e10cSrcweir     if( xAxis.is() )
987*cdf0e10cSrcweir         xRet = Reference< drawing::XShape >( xAxis->getAxisTitle(), uno::UNO_QUERY );
988*cdf0e10cSrcweir     return xRet;
989*cdf0e10cSrcweir }
990*cdf0e10cSrcweir 
991*cdf0e10cSrcweir Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getXAxis()
992*cdf0e10cSrcweir     throw (uno::RuntimeException)
993*cdf0e10cSrcweir {
994*cdf0e10cSrcweir     if( ! m_xXAxis.is())
995*cdf0e10cSrcweir         m_xXAxis = new AxisWrapper( AxisWrapper::X_AXIS, m_spChart2ModelContact );
996*cdf0e10cSrcweir     return Reference< beans::XPropertySet >( m_xXAxis, uno::UNO_QUERY );
997*cdf0e10cSrcweir }
998*cdf0e10cSrcweir 
999*cdf0e10cSrcweir Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getXMainGrid()
1000*cdf0e10cSrcweir     throw (uno::RuntimeException)
1001*cdf0e10cSrcweir {
1002*cdf0e10cSrcweir     Reference< beans::XPropertySet > xRet;
1003*cdf0e10cSrcweir     Reference< XAxis > xAxis( getAxis(0) );
1004*cdf0e10cSrcweir     if( xAxis.is() )
1005*cdf0e10cSrcweir         xRet = xAxis->getMajorGrid();
1006*cdf0e10cSrcweir     return xRet;
1007*cdf0e10cSrcweir }
1008*cdf0e10cSrcweir 
1009*cdf0e10cSrcweir Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getXHelpGrid()
1010*cdf0e10cSrcweir     throw (uno::RuntimeException)
1011*cdf0e10cSrcweir {
1012*cdf0e10cSrcweir     Reference< beans::XPropertySet > xRet;
1013*cdf0e10cSrcweir     Reference< XAxis > xAxis( getAxis(0) );
1014*cdf0e10cSrcweir     if( xAxis.is() )
1015*cdf0e10cSrcweir         xRet = xAxis->getMinorGrid();
1016*cdf0e10cSrcweir     return xRet;
1017*cdf0e10cSrcweir }
1018*cdf0e10cSrcweir 
1019*cdf0e10cSrcweir 
1020*cdf0e10cSrcweir // ____ XTwoAxisYSupplier ____
1021*cdf0e10cSrcweir Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getSecondaryYAxis()
1022*cdf0e10cSrcweir     throw (uno::RuntimeException)
1023*cdf0e10cSrcweir {
1024*cdf0e10cSrcweir     if( ! m_xSecondYAxis.is())
1025*cdf0e10cSrcweir         m_xSecondYAxis = new AxisWrapper( AxisWrapper::SECOND_Y_AXIS, m_spChart2ModelContact );
1026*cdf0e10cSrcweir     return Reference< beans::XPropertySet >( m_xSecondYAxis, uno::UNO_QUERY );
1027*cdf0e10cSrcweir }
1028*cdf0e10cSrcweir 
1029*cdf0e10cSrcweir 
1030*cdf0e10cSrcweir // ____ XAxisYSupplier (base of XTwoAxisYSupplier) ____
1031*cdf0e10cSrcweir Reference< drawing::XShape > SAL_CALL DiagramWrapper::getYAxisTitle()
1032*cdf0e10cSrcweir     throw (uno::RuntimeException)
1033*cdf0e10cSrcweir {
1034*cdf0e10cSrcweir     Reference< drawing::XShape > xRet;
1035*cdf0e10cSrcweir     Reference< XAxis > xAxis( getAxis(1) );
1036*cdf0e10cSrcweir     if( xAxis.is() )
1037*cdf0e10cSrcweir         xRet = Reference< drawing::XShape >( xAxis->getAxisTitle(), uno::UNO_QUERY );
1038*cdf0e10cSrcweir     return xRet;
1039*cdf0e10cSrcweir }
1040*cdf0e10cSrcweir 
1041*cdf0e10cSrcweir Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getYAxis()
1042*cdf0e10cSrcweir     throw (uno::RuntimeException)
1043*cdf0e10cSrcweir {
1044*cdf0e10cSrcweir     if( ! m_xYAxis.is())
1045*cdf0e10cSrcweir         m_xYAxis = new AxisWrapper( AxisWrapper::Y_AXIS, m_spChart2ModelContact );
1046*cdf0e10cSrcweir     return Reference< beans::XPropertySet >( m_xYAxis, uno::UNO_QUERY );
1047*cdf0e10cSrcweir }
1048*cdf0e10cSrcweir 
1049*cdf0e10cSrcweir Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getYMainGrid()
1050*cdf0e10cSrcweir     throw (uno::RuntimeException)
1051*cdf0e10cSrcweir {
1052*cdf0e10cSrcweir     Reference< beans::XPropertySet > xRet;
1053*cdf0e10cSrcweir     Reference< XAxis > xAxis( getAxis(1) );
1054*cdf0e10cSrcweir     if( xAxis.is() )
1055*cdf0e10cSrcweir         xRet = xAxis->getMajorGrid();
1056*cdf0e10cSrcweir     return xRet;
1057*cdf0e10cSrcweir }
1058*cdf0e10cSrcweir 
1059*cdf0e10cSrcweir Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getYHelpGrid()
1060*cdf0e10cSrcweir     throw (uno::RuntimeException)
1061*cdf0e10cSrcweir {
1062*cdf0e10cSrcweir     Reference< beans::XPropertySet > xRet;
1063*cdf0e10cSrcweir     Reference< XAxis > xAxis( getAxis(1) );
1064*cdf0e10cSrcweir     if( xAxis.is() )
1065*cdf0e10cSrcweir         xRet = xAxis->getMinorGrid();
1066*cdf0e10cSrcweir     return xRet;
1067*cdf0e10cSrcweir }
1068*cdf0e10cSrcweir 
1069*cdf0e10cSrcweir // ____ XSecondAxisTitleSupplier ____
1070*cdf0e10cSrcweir Reference< drawing::XShape > SAL_CALL DiagramWrapper::getSecondXAxisTitle()
1071*cdf0e10cSrcweir     throw (uno::RuntimeException)
1072*cdf0e10cSrcweir {
1073*cdf0e10cSrcweir     Reference< drawing::XShape > xRet;
1074*cdf0e10cSrcweir     Reference< XAxis > xAxis( getSecondaryAxis(0) );
1075*cdf0e10cSrcweir     if( xAxis.is() )
1076*cdf0e10cSrcweir         xRet = Reference< drawing::XShape >( xAxis->getAxisTitle(), uno::UNO_QUERY );
1077*cdf0e10cSrcweir     return xRet;
1078*cdf0e10cSrcweir }
1079*cdf0e10cSrcweir 
1080*cdf0e10cSrcweir Reference< drawing::XShape > SAL_CALL DiagramWrapper::getSecondYAxisTitle()
1081*cdf0e10cSrcweir     throw (uno::RuntimeException)
1082*cdf0e10cSrcweir {
1083*cdf0e10cSrcweir     Reference< drawing::XShape > xRet;
1084*cdf0e10cSrcweir     Reference< XAxis > xAxis( getSecondaryAxis(1) );
1085*cdf0e10cSrcweir     if( xAxis.is() )
1086*cdf0e10cSrcweir         xRet = Reference< drawing::XShape >( xAxis->getAxisTitle(), uno::UNO_QUERY );
1087*cdf0e10cSrcweir     return xRet;
1088*cdf0e10cSrcweir }
1089*cdf0e10cSrcweir 
1090*cdf0e10cSrcweir // ____ XStatisticDisplay ____
1091*cdf0e10cSrcweir Reference<
1092*cdf0e10cSrcweir     beans::XPropertySet > SAL_CALL DiagramWrapper::getUpBar()
1093*cdf0e10cSrcweir     throw (uno::RuntimeException)
1094*cdf0e10cSrcweir {
1095*cdf0e10cSrcweir     if( !m_xUpBarWrapper.is() )
1096*cdf0e10cSrcweir     {
1097*cdf0e10cSrcweir         m_xUpBarWrapper = new UpDownBarWrapper( true, m_spChart2ModelContact );
1098*cdf0e10cSrcweir     }
1099*cdf0e10cSrcweir     return m_xUpBarWrapper;
1100*cdf0e10cSrcweir }
1101*cdf0e10cSrcweir 
1102*cdf0e10cSrcweir Reference<
1103*cdf0e10cSrcweir     beans::XPropertySet > SAL_CALL DiagramWrapper::getDownBar()
1104*cdf0e10cSrcweir     throw (uno::RuntimeException)
1105*cdf0e10cSrcweir {
1106*cdf0e10cSrcweir     if( !m_xDownBarWrapper.is() )
1107*cdf0e10cSrcweir     {
1108*cdf0e10cSrcweir         m_xDownBarWrapper = new UpDownBarWrapper( false, m_spChart2ModelContact );
1109*cdf0e10cSrcweir     }
1110*cdf0e10cSrcweir     return m_xDownBarWrapper;
1111*cdf0e10cSrcweir }
1112*cdf0e10cSrcweir 
1113*cdf0e10cSrcweir Reference<
1114*cdf0e10cSrcweir     beans::XPropertySet > SAL_CALL DiagramWrapper::getMinMaxLine()
1115*cdf0e10cSrcweir     throw (uno::RuntimeException)
1116*cdf0e10cSrcweir {
1117*cdf0e10cSrcweir     if( !m_xMinMaxLineWrapper.is() )
1118*cdf0e10cSrcweir     {
1119*cdf0e10cSrcweir         m_xMinMaxLineWrapper = new MinMaxLineWrapper( m_spChart2ModelContact );
1120*cdf0e10cSrcweir     }
1121*cdf0e10cSrcweir     return m_xMinMaxLineWrapper;
1122*cdf0e10cSrcweir }
1123*cdf0e10cSrcweir 
1124*cdf0e10cSrcweir // ____ X3DDisplay ____
1125*cdf0e10cSrcweir Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getWall()
1126*cdf0e10cSrcweir     throw (uno::RuntimeException)
1127*cdf0e10cSrcweir {
1128*cdf0e10cSrcweir     if( !m_xWall.is() )
1129*cdf0e10cSrcweir     {
1130*cdf0e10cSrcweir         m_xWall = new WallFloorWrapper( true, m_spChart2ModelContact );
1131*cdf0e10cSrcweir     }
1132*cdf0e10cSrcweir     return m_xWall;
1133*cdf0e10cSrcweir }
1134*cdf0e10cSrcweir 
1135*cdf0e10cSrcweir Reference<
1136*cdf0e10cSrcweir     beans::XPropertySet > SAL_CALL DiagramWrapper::getFloor()
1137*cdf0e10cSrcweir     throw (uno::RuntimeException)
1138*cdf0e10cSrcweir {
1139*cdf0e10cSrcweir     if( !m_xFloor.is() )
1140*cdf0e10cSrcweir     {
1141*cdf0e10cSrcweir         m_xFloor = new WallFloorWrapper( false, m_spChart2ModelContact );
1142*cdf0e10cSrcweir     }
1143*cdf0e10cSrcweir     return m_xFloor;
1144*cdf0e10cSrcweir }
1145*cdf0e10cSrcweir 
1146*cdf0e10cSrcweir // ____ X3DDefaultSetter ____
1147*cdf0e10cSrcweir void SAL_CALL DiagramWrapper::set3DSettingsToDefault()
1148*cdf0e10cSrcweir     throw (uno::RuntimeException)
1149*cdf0e10cSrcweir {
1150*cdf0e10cSrcweir     Reference< X3DDefaultSetter > x3DDefaultSetter( m_spChart2ModelContact->getChart2Diagram(), uno::UNO_QUERY );
1151*cdf0e10cSrcweir     if( x3DDefaultSetter.is() )
1152*cdf0e10cSrcweir         x3DDefaultSetter->set3DSettingsToDefault();
1153*cdf0e10cSrcweir }
1154*cdf0e10cSrcweir 
1155*cdf0e10cSrcweir void SAL_CALL DiagramWrapper::setDefaultRotation()
1156*cdf0e10cSrcweir     throw (uno::RuntimeException)
1157*cdf0e10cSrcweir {
1158*cdf0e10cSrcweir     Reference< X3DDefaultSetter > x3DDefaultSetter( m_spChart2ModelContact->getChart2Diagram(), uno::UNO_QUERY );
1159*cdf0e10cSrcweir     if( x3DDefaultSetter.is() )
1160*cdf0e10cSrcweir         x3DDefaultSetter->setDefaultRotation();
1161*cdf0e10cSrcweir }
1162*cdf0e10cSrcweir 
1163*cdf0e10cSrcweir void SAL_CALL DiagramWrapper::setDefaultIllumination()
1164*cdf0e10cSrcweir     throw (uno::RuntimeException)
1165*cdf0e10cSrcweir {
1166*cdf0e10cSrcweir     Reference< X3DDefaultSetter > x3DDefaultSetter( m_spChart2ModelContact->getChart2Diagram(), uno::UNO_QUERY );
1167*cdf0e10cSrcweir     if( x3DDefaultSetter.is() )
1168*cdf0e10cSrcweir         x3DDefaultSetter->setDefaultIllumination();
1169*cdf0e10cSrcweir }
1170*cdf0e10cSrcweir 
1171*cdf0e10cSrcweir // ____ XComponent ____
1172*cdf0e10cSrcweir void SAL_CALL DiagramWrapper::dispose()
1173*cdf0e10cSrcweir     throw (uno::RuntimeException)
1174*cdf0e10cSrcweir {
1175*cdf0e10cSrcweir     m_aEventListenerContainer.disposeAndClear( lang::EventObject( static_cast< ::cppu::OWeakObject* >( this )));
1176*cdf0e10cSrcweir 
1177*cdf0e10cSrcweir     // /--
1178*cdf0e10cSrcweir     MutexGuard aGuard( GetMutex());
1179*cdf0e10cSrcweir 
1180*cdf0e10cSrcweir     DisposeHelper::DisposeAndClear( m_xXAxis );
1181*cdf0e10cSrcweir     DisposeHelper::DisposeAndClear( m_xYAxis );
1182*cdf0e10cSrcweir     DisposeHelper::DisposeAndClear( m_xZAxis );
1183*cdf0e10cSrcweir     DisposeHelper::DisposeAndClear( m_xSecondXAxis );
1184*cdf0e10cSrcweir     DisposeHelper::DisposeAndClear( m_xSecondYAxis );
1185*cdf0e10cSrcweir     DisposeHelper::DisposeAndClear( m_xWall );
1186*cdf0e10cSrcweir     DisposeHelper::DisposeAndClear( m_xFloor );
1187*cdf0e10cSrcweir     DisposeHelper::DisposeAndClear( m_xMinMaxLineWrapper );
1188*cdf0e10cSrcweir     DisposeHelper::DisposeAndClear( m_xUpBarWrapper );
1189*cdf0e10cSrcweir     DisposeHelper::DisposeAndClear( m_xDownBarWrapper );
1190*cdf0e10cSrcweir 
1191*cdf0e10cSrcweir     clearWrappedPropertySet();
1192*cdf0e10cSrcweir     // \--
1193*cdf0e10cSrcweir }
1194*cdf0e10cSrcweir 
1195*cdf0e10cSrcweir void SAL_CALL DiagramWrapper::addEventListener(
1196*cdf0e10cSrcweir     const Reference< lang::XEventListener >& xListener )
1197*cdf0e10cSrcweir     throw (uno::RuntimeException)
1198*cdf0e10cSrcweir {
1199*cdf0e10cSrcweir 	m_aEventListenerContainer.addInterface( xListener );
1200*cdf0e10cSrcweir }
1201*cdf0e10cSrcweir 
1202*cdf0e10cSrcweir void SAL_CALL DiagramWrapper::removeEventListener(
1203*cdf0e10cSrcweir     const Reference< lang::XEventListener >& aListener )
1204*cdf0e10cSrcweir     throw (uno::RuntimeException)
1205*cdf0e10cSrcweir {
1206*cdf0e10cSrcweir 	m_aEventListenerContainer.removeInterface( aListener );
1207*cdf0e10cSrcweir }
1208*cdf0e10cSrcweir 
1209*cdf0e10cSrcweir // ____ XEventListener ____
1210*cdf0e10cSrcweir // void SAL_CALL DiagramWrapper::disposing( const lang::EventObject& Source )
1211*cdf0e10cSrcweir //     throw (uno::RuntimeException)
1212*cdf0e10cSrcweir // {
1213*cdf0e10cSrcweir // }
1214*cdf0e10cSrcweir 
1215*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
1216*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
1217*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
1218*cdf0e10cSrcweir 
1219*cdf0e10cSrcweir //PROP_DIAGRAM_DATAROW_SOURCE
1220*cdf0e10cSrcweir class WrappedDataRowSourceProperty : public WrappedProperty
1221*cdf0e10cSrcweir {
1222*cdf0e10cSrcweir public:
1223*cdf0e10cSrcweir     WrappedDataRowSourceProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
1224*cdf0e10cSrcweir     virtual ~WrappedDataRowSourceProperty();
1225*cdf0e10cSrcweir 
1226*cdf0e10cSrcweir     virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
1227*cdf0e10cSrcweir                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
1228*cdf0e10cSrcweir 
1229*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
1230*cdf0e10cSrcweir                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
1231*cdf0e10cSrcweir 
1232*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
1233*cdf0e10cSrcweir                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
1234*cdf0e10cSrcweir 
1235*cdf0e10cSrcweir private: //member
1236*cdf0e10cSrcweir     ::boost::shared_ptr< Chart2ModelContact >   m_spChart2ModelContact;
1237*cdf0e10cSrcweir     mutable Any                                 m_aOuterValue;
1238*cdf0e10cSrcweir };
1239*cdf0e10cSrcweir 
1240*cdf0e10cSrcweir WrappedDataRowSourceProperty::WrappedDataRowSourceProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
1241*cdf0e10cSrcweir             : WrappedProperty(C2U("DataRowSource"),OUString())
1242*cdf0e10cSrcweir             , m_spChart2ModelContact( spChart2ModelContact )
1243*cdf0e10cSrcweir             , m_aOuterValue()
1244*cdf0e10cSrcweir {
1245*cdf0e10cSrcweir     m_aOuterValue = WrappedDataRowSourceProperty::getPropertyDefault( 0 );
1246*cdf0e10cSrcweir }
1247*cdf0e10cSrcweir 
1248*cdf0e10cSrcweir WrappedDataRowSourceProperty::~WrappedDataRowSourceProperty()
1249*cdf0e10cSrcweir {
1250*cdf0e10cSrcweir }
1251*cdf0e10cSrcweir 
1252*cdf0e10cSrcweir void WrappedDataRowSourceProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
1253*cdf0e10cSrcweir                 throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
1254*cdf0e10cSrcweir {
1255*cdf0e10cSrcweir     ::com::sun::star::chart::ChartDataRowSource eChartDataRowSource = ::com::sun::star::chart::ChartDataRowSource_ROWS;
1256*cdf0e10cSrcweir     if( ! (rOuterValue >>= eChartDataRowSource) )
1257*cdf0e10cSrcweir     {
1258*cdf0e10cSrcweir         sal_Int32 nNew = ::com::sun::star::chart::ChartDataRowSource_ROWS;
1259*cdf0e10cSrcweir         if( !(rOuterValue >>= nNew) )
1260*cdf0e10cSrcweir             throw lang::IllegalArgumentException( C2U("Property DataRowSource requires ::com::sun::star::chart::ChartDataRowSource value"), 0, 0 );
1261*cdf0e10cSrcweir         else
1262*cdf0e10cSrcweir             eChartDataRowSource = ::com::sun::star::chart::ChartDataRowSource(nNew);
1263*cdf0e10cSrcweir     }
1264*cdf0e10cSrcweir 
1265*cdf0e10cSrcweir     m_aOuterValue = rOuterValue;
1266*cdf0e10cSrcweir 
1267*cdf0e10cSrcweir     bool bNewUseColumns = eChartDataRowSource == ::com::sun::star::chart::ChartDataRowSource_COLUMNS;
1268*cdf0e10cSrcweir 
1269*cdf0e10cSrcweir     ::rtl::OUString aRangeString;
1270*cdf0e10cSrcweir     bool bUseColumns = true;
1271*cdf0e10cSrcweir     bool bFirstCellAsLabel = true;
1272*cdf0e10cSrcweir     bool bHasCategories = true;
1273*cdf0e10cSrcweir     uno::Sequence< sal_Int32 > aSequenceMapping;
1274*cdf0e10cSrcweir 
1275*cdf0e10cSrcweir     if( DataSourceHelper::detectRangeSegmentation(
1276*cdf0e10cSrcweir             m_spChart2ModelContact->getChartModel(), aRangeString, aSequenceMapping, bUseColumns
1277*cdf0e10cSrcweir             , bFirstCellAsLabel, bHasCategories ) )
1278*cdf0e10cSrcweir     {
1279*cdf0e10cSrcweir         if( bUseColumns != bNewUseColumns )
1280*cdf0e10cSrcweir         {
1281*cdf0e10cSrcweir             aSequenceMapping.realloc(0);
1282*cdf0e10cSrcweir             DataSourceHelper::setRangeSegmentation(
1283*cdf0e10cSrcweir                 m_spChart2ModelContact->getChartModel(), aSequenceMapping, bNewUseColumns , bHasCategories, bFirstCellAsLabel );
1284*cdf0e10cSrcweir         }
1285*cdf0e10cSrcweir     }
1286*cdf0e10cSrcweir }
1287*cdf0e10cSrcweir 
1288*cdf0e10cSrcweir Any WrappedDataRowSourceProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
1289*cdf0e10cSrcweir                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1290*cdf0e10cSrcweir {
1291*cdf0e10cSrcweir     ::rtl::OUString aRangeString;
1292*cdf0e10cSrcweir     bool bUseColumns = true;
1293*cdf0e10cSrcweir     bool bFirstCellAsLabel = true;
1294*cdf0e10cSrcweir     bool bHasCategories = true;
1295*cdf0e10cSrcweir     uno::Sequence< sal_Int32 > aSequenceMapping;
1296*cdf0e10cSrcweir 
1297*cdf0e10cSrcweir     if( DataSourceHelper::detectRangeSegmentation(
1298*cdf0e10cSrcweir             m_spChart2ModelContact->getChartModel(), aRangeString, aSequenceMapping, bUseColumns
1299*cdf0e10cSrcweir             , bFirstCellAsLabel, bHasCategories ) )
1300*cdf0e10cSrcweir     {
1301*cdf0e10cSrcweir         ::com::sun::star::chart::ChartDataRowSource eChartDataRowSource = ::com::sun::star::chart::ChartDataRowSource_ROWS;
1302*cdf0e10cSrcweir         if(bUseColumns)
1303*cdf0e10cSrcweir             eChartDataRowSource = ::com::sun::star::chart::ChartDataRowSource_COLUMNS;
1304*cdf0e10cSrcweir 
1305*cdf0e10cSrcweir         m_aOuterValue <<= eChartDataRowSource;
1306*cdf0e10cSrcweir     }
1307*cdf0e10cSrcweir 
1308*cdf0e10cSrcweir     return m_aOuterValue;
1309*cdf0e10cSrcweir }
1310*cdf0e10cSrcweir 
1311*cdf0e10cSrcweir Any WrappedDataRowSourceProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
1312*cdf0e10cSrcweir                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1313*cdf0e10cSrcweir {
1314*cdf0e10cSrcweir     Any aRet;
1315*cdf0e10cSrcweir     aRet <<= ::com::sun::star::chart::ChartDataRowSource_COLUMNS;
1316*cdf0e10cSrcweir     return aRet;
1317*cdf0e10cSrcweir }
1318*cdf0e10cSrcweir 
1319*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
1320*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
1321*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
1322*cdf0e10cSrcweir 
1323*cdf0e10cSrcweir 
1324*cdf0e10cSrcweir //PROP_DIAGRAM_STACKED
1325*cdf0e10cSrcweir //PROP_DIAGRAM_DEEP
1326*cdf0e10cSrcweir //PROP_DIAGRAM_PERCENT_STACKED
1327*cdf0e10cSrcweir class WrappedStackingProperty : public WrappedProperty
1328*cdf0e10cSrcweir {
1329*cdf0e10cSrcweir public:
1330*cdf0e10cSrcweir     WrappedStackingProperty( StackMode eStackMode, ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
1331*cdf0e10cSrcweir     virtual ~WrappedStackingProperty();
1332*cdf0e10cSrcweir 
1333*cdf0e10cSrcweir     virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
1334*cdf0e10cSrcweir                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
1335*cdf0e10cSrcweir 
1336*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
1337*cdf0e10cSrcweir                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
1338*cdf0e10cSrcweir 
1339*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
1340*cdf0e10cSrcweir                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
1341*cdf0e10cSrcweir 
1342*cdf0e10cSrcweir protected: //methods
1343*cdf0e10cSrcweir     bool    detectInnerValue( StackMode& eInnerStackMode ) const;
1344*cdf0e10cSrcweir 
1345*cdf0e10cSrcweir private: //member
1346*cdf0e10cSrcweir ::boost::shared_ptr< Chart2ModelContact >   m_spChart2ModelContact;
1347*cdf0e10cSrcweir     const StackMode                         m_eStackMode;
1348*cdf0e10cSrcweir     mutable Any                             m_aOuterValue;
1349*cdf0e10cSrcweir };
1350*cdf0e10cSrcweir 
1351*cdf0e10cSrcweir WrappedStackingProperty::WrappedStackingProperty( StackMode eStackMode, ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
1352*cdf0e10cSrcweir             : WrappedProperty(OUString(),OUString())
1353*cdf0e10cSrcweir             , m_spChart2ModelContact( spChart2ModelContact )
1354*cdf0e10cSrcweir             , m_eStackMode( eStackMode )
1355*cdf0e10cSrcweir             , m_aOuterValue()
1356*cdf0e10cSrcweir {
1357*cdf0e10cSrcweir     switch( m_eStackMode )
1358*cdf0e10cSrcweir     {
1359*cdf0e10cSrcweir     case StackMode_Y_STACKED:
1360*cdf0e10cSrcweir         m_aOuterName = C2U( "Stacked" );
1361*cdf0e10cSrcweir         break;
1362*cdf0e10cSrcweir     case StackMode_Y_STACKED_PERCENT:
1363*cdf0e10cSrcweir         m_aOuterName = C2U( "Percent" );
1364*cdf0e10cSrcweir         break;
1365*cdf0e10cSrcweir     case StackMode_Z_STACKED:
1366*cdf0e10cSrcweir         m_aOuterName = C2U( "Deep" );
1367*cdf0e10cSrcweir         break;
1368*cdf0e10cSrcweir     default:
1369*cdf0e10cSrcweir         OSL_ENSURE( false, "unexpected stack mode" );
1370*cdf0e10cSrcweir         break;
1371*cdf0e10cSrcweir     }
1372*cdf0e10cSrcweir }
1373*cdf0e10cSrcweir 
1374*cdf0e10cSrcweir WrappedStackingProperty::~WrappedStackingProperty()
1375*cdf0e10cSrcweir {
1376*cdf0e10cSrcweir }
1377*cdf0e10cSrcweir 
1378*cdf0e10cSrcweir bool WrappedStackingProperty::detectInnerValue( StackMode& eStackMode ) const
1379*cdf0e10cSrcweir {
1380*cdf0e10cSrcweir     bool bHasDetectableInnerValue = false;
1381*cdf0e10cSrcweir     bool bIsAmbiguous = false;
1382*cdf0e10cSrcweir     eStackMode = DiagramHelper::getStackMode( m_spChart2ModelContact->getChart2Diagram()
1383*cdf0e10cSrcweir         , bHasDetectableInnerValue, bIsAmbiguous );
1384*cdf0e10cSrcweir     return bHasDetectableInnerValue;
1385*cdf0e10cSrcweir }
1386*cdf0e10cSrcweir 
1387*cdf0e10cSrcweir void WrappedStackingProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
1388*cdf0e10cSrcweir                 throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
1389*cdf0e10cSrcweir {
1390*cdf0e10cSrcweir     sal_Bool bNewValue = false;
1391*cdf0e10cSrcweir     if( ! (rOuterValue >>= bNewValue) )
1392*cdf0e10cSrcweir         throw lang::IllegalArgumentException( C2U("Stacking Properties require boolean values"), 0, 0 );
1393*cdf0e10cSrcweir 
1394*cdf0e10cSrcweir     StackMode eInnerStackMode;
1395*cdf0e10cSrcweir     bool bHasDetectableInnerValue = detectInnerValue( eInnerStackMode );
1396*cdf0e10cSrcweir 
1397*cdf0e10cSrcweir     if( !bHasDetectableInnerValue )
1398*cdf0e10cSrcweir     {
1399*cdf0e10cSrcweir         m_aOuterValue = rOuterValue;
1400*cdf0e10cSrcweir         return;
1401*cdf0e10cSrcweir     }
1402*cdf0e10cSrcweir 
1403*cdf0e10cSrcweir     if( bNewValue && eInnerStackMode == m_eStackMode )
1404*cdf0e10cSrcweir         return;
1405*cdf0e10cSrcweir     if( !bNewValue && eInnerStackMode != m_eStackMode )
1406*cdf0e10cSrcweir         return;
1407*cdf0e10cSrcweir 
1408*cdf0e10cSrcweir     Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
1409*cdf0e10cSrcweir     if( xDiagram.is() )
1410*cdf0e10cSrcweir     {
1411*cdf0e10cSrcweir         StackMode eNewStackMode = bNewValue ? m_eStackMode : StackMode_NONE;
1412*cdf0e10cSrcweir         DiagramHelper::setStackMode( xDiagram, eNewStackMode );
1413*cdf0e10cSrcweir     }
1414*cdf0e10cSrcweir }
1415*cdf0e10cSrcweir 
1416*cdf0e10cSrcweir Any WrappedStackingProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
1417*cdf0e10cSrcweir                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1418*cdf0e10cSrcweir {
1419*cdf0e10cSrcweir     StackMode eInnerStackMode;
1420*cdf0e10cSrcweir     if( detectInnerValue( eInnerStackMode ) )
1421*cdf0e10cSrcweir     {
1422*cdf0e10cSrcweir         sal_Bool bValue = (eInnerStackMode == m_eStackMode);
1423*cdf0e10cSrcweir         Any aAny;
1424*cdf0e10cSrcweir         aAny <<= bValue;
1425*cdf0e10cSrcweir         return aAny;
1426*cdf0e10cSrcweir     }
1427*cdf0e10cSrcweir     return m_aOuterValue;
1428*cdf0e10cSrcweir }
1429*cdf0e10cSrcweir 
1430*cdf0e10cSrcweir Any WrappedStackingProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
1431*cdf0e10cSrcweir                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1432*cdf0e10cSrcweir {
1433*cdf0e10cSrcweir     Any aRet;
1434*cdf0e10cSrcweir     aRet <<= sal_Bool( sal_False );
1435*cdf0e10cSrcweir     return aRet;
1436*cdf0e10cSrcweir }
1437*cdf0e10cSrcweir 
1438*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
1439*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
1440*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
1441*cdf0e10cSrcweir 
1442*cdf0e10cSrcweir //PROP_DIAGRAM_THREE_D
1443*cdf0e10cSrcweir class WrappedDim3DProperty : public WrappedProperty
1444*cdf0e10cSrcweir {
1445*cdf0e10cSrcweir public:
1446*cdf0e10cSrcweir     WrappedDim3DProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
1447*cdf0e10cSrcweir     virtual ~WrappedDim3DProperty();
1448*cdf0e10cSrcweir 
1449*cdf0e10cSrcweir     virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
1450*cdf0e10cSrcweir                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
1451*cdf0e10cSrcweir 
1452*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
1453*cdf0e10cSrcweir                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
1454*cdf0e10cSrcweir 
1455*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
1456*cdf0e10cSrcweir                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
1457*cdf0e10cSrcweir 
1458*cdf0e10cSrcweir private: //member
1459*cdf0e10cSrcweir     ::boost::shared_ptr< Chart2ModelContact >   m_spChart2ModelContact;
1460*cdf0e10cSrcweir     mutable Any                                 m_aOuterValue;
1461*cdf0e10cSrcweir };
1462*cdf0e10cSrcweir 
1463*cdf0e10cSrcweir WrappedDim3DProperty::WrappedDim3DProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
1464*cdf0e10cSrcweir             : WrappedProperty(C2U("Dim3D"),OUString())
1465*cdf0e10cSrcweir             , m_spChart2ModelContact( spChart2ModelContact )
1466*cdf0e10cSrcweir             , m_aOuterValue()
1467*cdf0e10cSrcweir {
1468*cdf0e10cSrcweir     m_aOuterValue = WrappedDim3DProperty::getPropertyDefault( 0 );
1469*cdf0e10cSrcweir }
1470*cdf0e10cSrcweir 
1471*cdf0e10cSrcweir WrappedDim3DProperty::~WrappedDim3DProperty()
1472*cdf0e10cSrcweir {
1473*cdf0e10cSrcweir }
1474*cdf0e10cSrcweir 
1475*cdf0e10cSrcweir void WrappedDim3DProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
1476*cdf0e10cSrcweir                 throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
1477*cdf0e10cSrcweir {
1478*cdf0e10cSrcweir     sal_Bool bNew3D = false;
1479*cdf0e10cSrcweir     if( ! (rOuterValue >>= bNew3D) )
1480*cdf0e10cSrcweir         throw lang::IllegalArgumentException( C2U("Property Dim3D requires boolean value"), 0, 0 );
1481*cdf0e10cSrcweir 
1482*cdf0e10cSrcweir     m_aOuterValue = rOuterValue;
1483*cdf0e10cSrcweir 
1484*cdf0e10cSrcweir     Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
1485*cdf0e10cSrcweir     if( !xDiagram.is() )
1486*cdf0e10cSrcweir         return;
1487*cdf0e10cSrcweir 
1488*cdf0e10cSrcweir     sal_Bool bOld3D = DiagramHelper::getDimension( xDiagram ) == 3;
1489*cdf0e10cSrcweir     if( bOld3D != bNew3D )
1490*cdf0e10cSrcweir         DiagramHelper::setDimension( xDiagram, bNew3D ? 3 : 2 );
1491*cdf0e10cSrcweir }
1492*cdf0e10cSrcweir 
1493*cdf0e10cSrcweir Any WrappedDim3DProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
1494*cdf0e10cSrcweir                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1495*cdf0e10cSrcweir {
1496*cdf0e10cSrcweir     Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
1497*cdf0e10cSrcweir     if( xDiagram.is() )
1498*cdf0e10cSrcweir     {
1499*cdf0e10cSrcweir         sal_Bool b3D = DiagramHelper::getDimension( xDiagram ) == 3;
1500*cdf0e10cSrcweir         m_aOuterValue <<= b3D;
1501*cdf0e10cSrcweir     }
1502*cdf0e10cSrcweir     return m_aOuterValue;
1503*cdf0e10cSrcweir }
1504*cdf0e10cSrcweir 
1505*cdf0e10cSrcweir Any WrappedDim3DProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
1506*cdf0e10cSrcweir                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1507*cdf0e10cSrcweir {
1508*cdf0e10cSrcweir     Any aRet;
1509*cdf0e10cSrcweir     aRet <<= sal_Bool( sal_False );
1510*cdf0e10cSrcweir     return aRet;
1511*cdf0e10cSrcweir }
1512*cdf0e10cSrcweir 
1513*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
1514*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
1515*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
1516*cdf0e10cSrcweir 
1517*cdf0e10cSrcweir //PROP_DIAGRAM_VERTICAL
1518*cdf0e10cSrcweir class WrappedVerticalProperty : public WrappedProperty
1519*cdf0e10cSrcweir {
1520*cdf0e10cSrcweir public:
1521*cdf0e10cSrcweir     WrappedVerticalProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
1522*cdf0e10cSrcweir     virtual ~WrappedVerticalProperty();
1523*cdf0e10cSrcweir 
1524*cdf0e10cSrcweir     virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
1525*cdf0e10cSrcweir                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
1526*cdf0e10cSrcweir 
1527*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
1528*cdf0e10cSrcweir                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
1529*cdf0e10cSrcweir 
1530*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
1531*cdf0e10cSrcweir                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
1532*cdf0e10cSrcweir 
1533*cdf0e10cSrcweir private: //member
1534*cdf0e10cSrcweir     ::boost::shared_ptr< Chart2ModelContact >   m_spChart2ModelContact;
1535*cdf0e10cSrcweir     mutable Any                                 m_aOuterValue;
1536*cdf0e10cSrcweir };
1537*cdf0e10cSrcweir 
1538*cdf0e10cSrcweir WrappedVerticalProperty::WrappedVerticalProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
1539*cdf0e10cSrcweir             : WrappedProperty(C2U("Vertical"),OUString())
1540*cdf0e10cSrcweir             , m_spChart2ModelContact( spChart2ModelContact )
1541*cdf0e10cSrcweir             , m_aOuterValue()
1542*cdf0e10cSrcweir {
1543*cdf0e10cSrcweir     m_aOuterValue = WrappedVerticalProperty::getPropertyDefault( 0 );
1544*cdf0e10cSrcweir }
1545*cdf0e10cSrcweir 
1546*cdf0e10cSrcweir WrappedVerticalProperty::~WrappedVerticalProperty()
1547*cdf0e10cSrcweir {
1548*cdf0e10cSrcweir }
1549*cdf0e10cSrcweir 
1550*cdf0e10cSrcweir void WrappedVerticalProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
1551*cdf0e10cSrcweir                 throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
1552*cdf0e10cSrcweir {
1553*cdf0e10cSrcweir     sal_Bool bNewVertical = false;
1554*cdf0e10cSrcweir     if( ! (rOuterValue >>= bNewVertical) )
1555*cdf0e10cSrcweir         throw lang::IllegalArgumentException( C2U("Property Vertical requires boolean value"), 0, 0 );
1556*cdf0e10cSrcweir 
1557*cdf0e10cSrcweir     m_aOuterValue = rOuterValue;
1558*cdf0e10cSrcweir 
1559*cdf0e10cSrcweir     Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
1560*cdf0e10cSrcweir     if( !xDiagram.is() )
1561*cdf0e10cSrcweir         return;
1562*cdf0e10cSrcweir 
1563*cdf0e10cSrcweir     bool bFound = false;
1564*cdf0e10cSrcweir     bool bAmbiguous = false;
1565*cdf0e10cSrcweir     sal_Bool bOldVertical = DiagramHelper::getVertical( xDiagram, bFound, bAmbiguous );
1566*cdf0e10cSrcweir     if( bFound && ( bOldVertical != bNewVertical || bAmbiguous ) )
1567*cdf0e10cSrcweir         DiagramHelper::setVertical( xDiagram, bNewVertical );
1568*cdf0e10cSrcweir }
1569*cdf0e10cSrcweir 
1570*cdf0e10cSrcweir Any WrappedVerticalProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
1571*cdf0e10cSrcweir                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1572*cdf0e10cSrcweir {
1573*cdf0e10cSrcweir     bool bFound = false;
1574*cdf0e10cSrcweir     bool bAmbiguous = false;
1575*cdf0e10cSrcweir     Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
1576*cdf0e10cSrcweir     if( xDiagram.is() )
1577*cdf0e10cSrcweir     {
1578*cdf0e10cSrcweir         sal_Bool bVertical = DiagramHelper::getVertical( xDiagram, bFound, bAmbiguous );
1579*cdf0e10cSrcweir         if( bFound )
1580*cdf0e10cSrcweir             m_aOuterValue <<= bVertical;
1581*cdf0e10cSrcweir     }
1582*cdf0e10cSrcweir     return m_aOuterValue;
1583*cdf0e10cSrcweir }
1584*cdf0e10cSrcweir 
1585*cdf0e10cSrcweir Any WrappedVerticalProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
1586*cdf0e10cSrcweir                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1587*cdf0e10cSrcweir {
1588*cdf0e10cSrcweir     Any aRet;
1589*cdf0e10cSrcweir     aRet <<= sal_Bool( sal_False );
1590*cdf0e10cSrcweir     return aRet;
1591*cdf0e10cSrcweir }
1592*cdf0e10cSrcweir 
1593*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
1594*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
1595*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
1596*cdf0e10cSrcweir 
1597*cdf0e10cSrcweir //PROP_DIAGRAM_NUMBER_OF_LINES
1598*cdf0e10cSrcweir class WrappedNumberOfLinesProperty : public WrappedProperty
1599*cdf0e10cSrcweir {
1600*cdf0e10cSrcweir public:
1601*cdf0e10cSrcweir     WrappedNumberOfLinesProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
1602*cdf0e10cSrcweir     virtual ~WrappedNumberOfLinesProperty();
1603*cdf0e10cSrcweir 
1604*cdf0e10cSrcweir     virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
1605*cdf0e10cSrcweir                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
1606*cdf0e10cSrcweir 
1607*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
1608*cdf0e10cSrcweir                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
1609*cdf0e10cSrcweir 
1610*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
1611*cdf0e10cSrcweir                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
1612*cdf0e10cSrcweir 
1613*cdf0e10cSrcweir protected: //methods
1614*cdf0e10cSrcweir     bool    detectInnerValue( uno::Any& rInnerValue ) const;
1615*cdf0e10cSrcweir 
1616*cdf0e10cSrcweir private: //member
1617*cdf0e10cSrcweir     ::boost::shared_ptr< Chart2ModelContact >   m_spChart2ModelContact;
1618*cdf0e10cSrcweir     mutable Any                                 m_aOuterValue;
1619*cdf0e10cSrcweir };
1620*cdf0e10cSrcweir 
1621*cdf0e10cSrcweir WrappedNumberOfLinesProperty::WrappedNumberOfLinesProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
1622*cdf0e10cSrcweir             : WrappedProperty(C2U("NumberOfLines"),OUString())
1623*cdf0e10cSrcweir             , m_spChart2ModelContact( spChart2ModelContact )
1624*cdf0e10cSrcweir             , m_aOuterValue( this->getPropertyDefault(0) )
1625*cdf0e10cSrcweir {
1626*cdf0e10cSrcweir }
1627*cdf0e10cSrcweir 
1628*cdf0e10cSrcweir WrappedNumberOfLinesProperty::~WrappedNumberOfLinesProperty()
1629*cdf0e10cSrcweir {
1630*cdf0e10cSrcweir }
1631*cdf0e10cSrcweir 
1632*cdf0e10cSrcweir bool WrappedNumberOfLinesProperty::detectInnerValue( uno::Any& rInnerValue ) const
1633*cdf0e10cSrcweir {
1634*cdf0e10cSrcweir     sal_Int32 nNumberOfLines = 0;
1635*cdf0e10cSrcweir     bool bHasDetectableInnerValue = false;
1636*cdf0e10cSrcweir     Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
1637*cdf0e10cSrcweir     uno::Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
1638*cdf0e10cSrcweir     if( xDiagram.is() && xChartDoc.is() )
1639*cdf0e10cSrcweir     {
1640*cdf0e10cSrcweir         ::std::vector< uno::Reference< chart2::XDataSeries > > aSeriesVector(
1641*cdf0e10cSrcweir             DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
1642*cdf0e10cSrcweir         if( aSeriesVector.size() > 0 )
1643*cdf0e10cSrcweir         {
1644*cdf0e10cSrcweir             Reference< lang::XMultiServiceFactory > xFact( xChartDoc->getChartTypeManager(), uno::UNO_QUERY );
1645*cdf0e10cSrcweir             DiagramHelper::tTemplateWithServiceName aTemplateAndService =
1646*cdf0e10cSrcweir                     DiagramHelper::getTemplateForDiagram( xDiagram, xFact );
1647*cdf0e10cSrcweir             if( aTemplateAndService.second.equals( C2U( "com.sun.star.chart2.template.ColumnWithLine" ) ) )
1648*cdf0e10cSrcweir             {
1649*cdf0e10cSrcweir                 try
1650*cdf0e10cSrcweir                 {
1651*cdf0e10cSrcweir                     uno::Reference< beans::XPropertySet > xProp( aTemplateAndService.first, uno::UNO_QUERY );
1652*cdf0e10cSrcweir                     xProp->getPropertyValue( m_aOuterName ) >>= nNumberOfLines;
1653*cdf0e10cSrcweir                     bHasDetectableInnerValue = true;
1654*cdf0e10cSrcweir                 }
1655*cdf0e10cSrcweir                 catch( uno::Exception & ex )
1656*cdf0e10cSrcweir                 {
1657*cdf0e10cSrcweir                     ASSERT_EXCEPTION( ex );
1658*cdf0e10cSrcweir                 }
1659*cdf0e10cSrcweir             }
1660*cdf0e10cSrcweir         }
1661*cdf0e10cSrcweir     }
1662*cdf0e10cSrcweir     if(bHasDetectableInnerValue)
1663*cdf0e10cSrcweir         rInnerValue = uno::makeAny(nNumberOfLines);
1664*cdf0e10cSrcweir     return bHasDetectableInnerValue;
1665*cdf0e10cSrcweir }
1666*cdf0e10cSrcweir 
1667*cdf0e10cSrcweir void WrappedNumberOfLinesProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
1668*cdf0e10cSrcweir                 throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
1669*cdf0e10cSrcweir {
1670*cdf0e10cSrcweir     sal_Int32 nNewValue;
1671*cdf0e10cSrcweir     if( ! (rOuterValue >>= nNewValue) )
1672*cdf0e10cSrcweir         throw lang::IllegalArgumentException( C2U("property NumberOfLines requires sal_Int32 value"), 0, 0 );
1673*cdf0e10cSrcweir 
1674*cdf0e10cSrcweir     m_aOuterValue = rOuterValue;
1675*cdf0e10cSrcweir 
1676*cdf0e10cSrcweir     uno::Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
1677*cdf0e10cSrcweir     Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
1678*cdf0e10cSrcweir     sal_Int32 nDimension = ::chart::DiagramHelper::getDimension( xDiagram );
1679*cdf0e10cSrcweir     if( xChartDoc.is() && xDiagram.is() && nDimension == 2 )
1680*cdf0e10cSrcweir     {
1681*cdf0e10cSrcweir         Reference< lang::XMultiServiceFactory > xFact( xChartDoc->getChartTypeManager(), uno::UNO_QUERY );
1682*cdf0e10cSrcweir         DiagramHelper::tTemplateWithServiceName aTemplateAndService =
1683*cdf0e10cSrcweir                 DiagramHelper::getTemplateForDiagram( xDiagram, xFact );
1684*cdf0e10cSrcweir 
1685*cdf0e10cSrcweir         uno::Reference< chart2::XChartTypeTemplate > xTemplate(0);
1686*cdf0e10cSrcweir         if( aTemplateAndService.second.equals( C2U( "com.sun.star.chart2.template.ColumnWithLine" ) ) )
1687*cdf0e10cSrcweir         {
1688*cdf0e10cSrcweir             if( nNewValue != 0 )
1689*cdf0e10cSrcweir             {
1690*cdf0e10cSrcweir                 xTemplate.set( aTemplateAndService.first );
1691*cdf0e10cSrcweir                 try
1692*cdf0e10cSrcweir                 {
1693*cdf0e10cSrcweir                     sal_Int32 nOldValue = 0;
1694*cdf0e10cSrcweir                     uno::Reference< beans::XPropertySet > xProp( xTemplate, uno::UNO_QUERY );
1695*cdf0e10cSrcweir                     xProp->getPropertyValue( m_aOuterName ) >>= nOldValue;
1696*cdf0e10cSrcweir                     if( nOldValue == nNewValue )
1697*cdf0e10cSrcweir                         return;
1698*cdf0e10cSrcweir                 }
1699*cdf0e10cSrcweir                 catch( uno::Exception & ex )
1700*cdf0e10cSrcweir                 {
1701*cdf0e10cSrcweir                     ASSERT_EXCEPTION( ex );
1702*cdf0e10cSrcweir                 }
1703*cdf0e10cSrcweir             }
1704*cdf0e10cSrcweir             else
1705*cdf0e10cSrcweir             {
1706*cdf0e10cSrcweir                 xTemplate.set( xFact->createInstance( C2U( "com.sun.star.chart2.template.Column" ) ), uno::UNO_QUERY );
1707*cdf0e10cSrcweir             }
1708*cdf0e10cSrcweir         }
1709*cdf0e10cSrcweir         else if( aTemplateAndService.second.equals( C2U( "com.sun.star.chart2.template.Column" ) ) )
1710*cdf0e10cSrcweir         {
1711*cdf0e10cSrcweir             if( nNewValue == 0 )
1712*cdf0e10cSrcweir                 return;
1713*cdf0e10cSrcweir             xTemplate.set( xFact->createInstance( C2U( "com.sun.star.chart2.template.ColumnWithLine" ) ), uno::UNO_QUERY );
1714*cdf0e10cSrcweir         }
1715*cdf0e10cSrcweir 
1716*cdf0e10cSrcweir         if(xTemplate.is())
1717*cdf0e10cSrcweir         {
1718*cdf0e10cSrcweir             try
1719*cdf0e10cSrcweir             {
1720*cdf0e10cSrcweir                 // /-- locked controllers
1721*cdf0e10cSrcweir                 ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
1722*cdf0e10cSrcweir                 uno::Reference< beans::XPropertySet > xProp( xTemplate, uno::UNO_QUERY );
1723*cdf0e10cSrcweir                 xProp->setPropertyValue( C2U( "NumberOfLines" ), uno::makeAny(nNewValue) );
1724*cdf0e10cSrcweir                 xTemplate->changeDiagram( xDiagram );
1725*cdf0e10cSrcweir                 // \-- locked controllers
1726*cdf0e10cSrcweir             }
1727*cdf0e10cSrcweir             catch( uno::Exception & ex )
1728*cdf0e10cSrcweir             {
1729*cdf0e10cSrcweir                 ASSERT_EXCEPTION( ex );
1730*cdf0e10cSrcweir             }
1731*cdf0e10cSrcweir         }
1732*cdf0e10cSrcweir     }
1733*cdf0e10cSrcweir }
1734*cdf0e10cSrcweir 
1735*cdf0e10cSrcweir Any WrappedNumberOfLinesProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
1736*cdf0e10cSrcweir                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1737*cdf0e10cSrcweir {
1738*cdf0e10cSrcweir     Any aRet;
1739*cdf0e10cSrcweir     if( !detectInnerValue( aRet ) )
1740*cdf0e10cSrcweir         aRet = m_aOuterValue;
1741*cdf0e10cSrcweir     return aRet;
1742*cdf0e10cSrcweir }
1743*cdf0e10cSrcweir 
1744*cdf0e10cSrcweir Any WrappedNumberOfLinesProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
1745*cdf0e10cSrcweir                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1746*cdf0e10cSrcweir {
1747*cdf0e10cSrcweir     Any aRet;
1748*cdf0e10cSrcweir     aRet <<= sal_Int32( 0 );
1749*cdf0e10cSrcweir     return aRet;
1750*cdf0e10cSrcweir }
1751*cdf0e10cSrcweir 
1752*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
1753*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
1754*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
1755*cdf0e10cSrcweir 
1756*cdf0e10cSrcweir //PROP_DIAGRAM_ATTRIBUTED_DATA_POINTS
1757*cdf0e10cSrcweir class WrappedAttributedDataPointsProperty : public WrappedProperty
1758*cdf0e10cSrcweir {
1759*cdf0e10cSrcweir public:
1760*cdf0e10cSrcweir     WrappedAttributedDataPointsProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
1761*cdf0e10cSrcweir     virtual ~WrappedAttributedDataPointsProperty();
1762*cdf0e10cSrcweir 
1763*cdf0e10cSrcweir     virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
1764*cdf0e10cSrcweir                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
1765*cdf0e10cSrcweir 
1766*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
1767*cdf0e10cSrcweir                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
1768*cdf0e10cSrcweir 
1769*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
1770*cdf0e10cSrcweir                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
1771*cdf0e10cSrcweir 
1772*cdf0e10cSrcweir private: //member
1773*cdf0e10cSrcweir     ::boost::shared_ptr< Chart2ModelContact >   m_spChart2ModelContact;
1774*cdf0e10cSrcweir     mutable Any                                 m_aOuterValue;
1775*cdf0e10cSrcweir };
1776*cdf0e10cSrcweir 
1777*cdf0e10cSrcweir WrappedAttributedDataPointsProperty::WrappedAttributedDataPointsProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
1778*cdf0e10cSrcweir             : WrappedProperty(C2U("AttributedDataPoints"),OUString())
1779*cdf0e10cSrcweir             , m_spChart2ModelContact( spChart2ModelContact )
1780*cdf0e10cSrcweir             , m_aOuterValue()
1781*cdf0e10cSrcweir {
1782*cdf0e10cSrcweir     m_aOuterValue = WrappedAttributedDataPointsProperty::getPropertyDefault( 0 );
1783*cdf0e10cSrcweir }
1784*cdf0e10cSrcweir 
1785*cdf0e10cSrcweir WrappedAttributedDataPointsProperty::~WrappedAttributedDataPointsProperty()
1786*cdf0e10cSrcweir {
1787*cdf0e10cSrcweir }
1788*cdf0e10cSrcweir 
1789*cdf0e10cSrcweir void WrappedAttributedDataPointsProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
1790*cdf0e10cSrcweir                 throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
1791*cdf0e10cSrcweir {
1792*cdf0e10cSrcweir     uno::Sequence< uno::Sequence< sal_Int32 > > aNewValue;
1793*cdf0e10cSrcweir     if( ! (rOuterValue >>= aNewValue) )
1794*cdf0e10cSrcweir         throw lang::IllegalArgumentException( C2U("Property AttributedDataPoints requires value of type uno::Sequence< uno::Sequence< sal_Int32 > >"), 0, 0 );
1795*cdf0e10cSrcweir 
1796*cdf0e10cSrcweir     m_aOuterValue = rOuterValue;
1797*cdf0e10cSrcweir 
1798*cdf0e10cSrcweir     Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
1799*cdf0e10cSrcweir     Reference< beans::XPropertySet > xDiaProp( xDiagram, uno::UNO_QUERY );
1800*cdf0e10cSrcweir 
1801*cdf0e10cSrcweir     if( xDiagram.is() && xDiaProp.is())
1802*cdf0e10cSrcweir     {
1803*cdf0e10cSrcweir         ::std::vector< Reference< chart2::XDataSeries > > aSeriesVector(
1804*cdf0e10cSrcweir             ::chart::DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
1805*cdf0e10cSrcweir 
1806*cdf0e10cSrcweir         uno::Sequence< uno::Sequence< sal_Int32 > > aResult( aSeriesVector.size() );
1807*cdf0e10cSrcweir 
1808*cdf0e10cSrcweir         ::std::vector< Reference< chart2::XDataSeries > >::const_iterator aIt =
1809*cdf0e10cSrcweir                 aSeriesVector.begin();
1810*cdf0e10cSrcweir         sal_Int32 i = 0;
1811*cdf0e10cSrcweir         for( ; aIt != aSeriesVector.end(); ++aIt, ++i )
1812*cdf0e10cSrcweir         {
1813*cdf0e10cSrcweir             Reference< beans::XPropertySet > xProp( *aIt, uno::UNO_QUERY );
1814*cdf0e10cSrcweir             if( xProp.is())
1815*cdf0e10cSrcweir             {
1816*cdf0e10cSrcweir                 uno::Any aVal;
1817*cdf0e10cSrcweir                 if( i < aNewValue.getLength() )
1818*cdf0e10cSrcweir                     aVal <<= aNewValue[i];
1819*cdf0e10cSrcweir                 else
1820*cdf0e10cSrcweir                 {
1821*cdf0e10cSrcweir                     //set empty sequence
1822*cdf0e10cSrcweir                     uno::Sequence< sal_Int32 > aSeq;
1823*cdf0e10cSrcweir                     aVal <<= aSeq;
1824*cdf0e10cSrcweir                 }
1825*cdf0e10cSrcweir                 xProp->setPropertyValue( C2U( "AttributedDataPoints" ), aVal );
1826*cdf0e10cSrcweir             }
1827*cdf0e10cSrcweir         }
1828*cdf0e10cSrcweir     }
1829*cdf0e10cSrcweir }
1830*cdf0e10cSrcweir 
1831*cdf0e10cSrcweir Any WrappedAttributedDataPointsProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
1832*cdf0e10cSrcweir                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1833*cdf0e10cSrcweir {
1834*cdf0e10cSrcweir     Reference< chart2::XDiagram >    xDiagram( m_spChart2ModelContact->getChart2Diagram() );
1835*cdf0e10cSrcweir     Reference< beans::XPropertySet > xDiaProp( xDiagram, uno::UNO_QUERY );
1836*cdf0e10cSrcweir 
1837*cdf0e10cSrcweir     if( xDiagram.is() && xDiaProp.is())
1838*cdf0e10cSrcweir     {
1839*cdf0e10cSrcweir         ::std::vector< Reference< chart2::XDataSeries > > aSeriesVector(
1840*cdf0e10cSrcweir             ::chart::DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
1841*cdf0e10cSrcweir 
1842*cdf0e10cSrcweir         uno::Sequence< uno::Sequence< sal_Int32 > > aResult( aSeriesVector.size() );
1843*cdf0e10cSrcweir 
1844*cdf0e10cSrcweir         ::std::vector< Reference< chart2::XDataSeries > >::const_iterator aIt =
1845*cdf0e10cSrcweir                 aSeriesVector.begin();
1846*cdf0e10cSrcweir         sal_Int32 i = 0;
1847*cdf0e10cSrcweir         for( ; aIt != aSeriesVector.end(); ++aIt, ++i )
1848*cdf0e10cSrcweir         {
1849*cdf0e10cSrcweir             Reference< beans::XPropertySet > xProp( *aIt, uno::UNO_QUERY );
1850*cdf0e10cSrcweir             if( xProp.is())
1851*cdf0e10cSrcweir             {
1852*cdf0e10cSrcweir                 uno::Any aVal(
1853*cdf0e10cSrcweir                     xProp->getPropertyValue( C2U( "AttributedDataPoints" )));
1854*cdf0e10cSrcweir                 uno::Sequence< sal_Int32 > aSeq;
1855*cdf0e10cSrcweir                 if( aVal >>= aSeq )
1856*cdf0e10cSrcweir                     aResult[ i ] = aSeq;
1857*cdf0e10cSrcweir             }
1858*cdf0e10cSrcweir         }
1859*cdf0e10cSrcweir         m_aOuterValue <<= aResult;
1860*cdf0e10cSrcweir     }
1861*cdf0e10cSrcweir     return m_aOuterValue;
1862*cdf0e10cSrcweir }
1863*cdf0e10cSrcweir 
1864*cdf0e10cSrcweir Any WrappedAttributedDataPointsProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
1865*cdf0e10cSrcweir                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1866*cdf0e10cSrcweir {
1867*cdf0e10cSrcweir     Any aRet;
1868*cdf0e10cSrcweir     uno::Sequence< uno::Sequence< sal_Int32 > > aSeq;
1869*cdf0e10cSrcweir     aRet <<= aSeq;
1870*cdf0e10cSrcweir     return aRet;
1871*cdf0e10cSrcweir }
1872*cdf0e10cSrcweir 
1873*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
1874*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
1875*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
1876*cdf0e10cSrcweir 
1877*cdf0e10cSrcweir //PROP_DIAGRAM_SOLIDTYPE
1878*cdf0e10cSrcweir class WrappedSolidTypeProperty : public WrappedProperty
1879*cdf0e10cSrcweir {
1880*cdf0e10cSrcweir public:
1881*cdf0e10cSrcweir     WrappedSolidTypeProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
1882*cdf0e10cSrcweir     virtual ~WrappedSolidTypeProperty();
1883*cdf0e10cSrcweir 
1884*cdf0e10cSrcweir     virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
1885*cdf0e10cSrcweir                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
1886*cdf0e10cSrcweir 
1887*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
1888*cdf0e10cSrcweir                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
1889*cdf0e10cSrcweir 
1890*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
1891*cdf0e10cSrcweir                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
1892*cdf0e10cSrcweir 
1893*cdf0e10cSrcweir private: //member
1894*cdf0e10cSrcweir     ::boost::shared_ptr< Chart2ModelContact >   m_spChart2ModelContact;
1895*cdf0e10cSrcweir     mutable Any                                 m_aOuterValue;
1896*cdf0e10cSrcweir };
1897*cdf0e10cSrcweir 
1898*cdf0e10cSrcweir WrappedSolidTypeProperty::WrappedSolidTypeProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
1899*cdf0e10cSrcweir             : WrappedProperty( C2U( "SolidType" ), OUString() )
1900*cdf0e10cSrcweir             , m_spChart2ModelContact( spChart2ModelContact )
1901*cdf0e10cSrcweir             , m_aOuterValue()
1902*cdf0e10cSrcweir {
1903*cdf0e10cSrcweir     m_aOuterValue = WrappedSolidTypeProperty::getPropertyDefault( 0 );
1904*cdf0e10cSrcweir }
1905*cdf0e10cSrcweir 
1906*cdf0e10cSrcweir WrappedSolidTypeProperty::~WrappedSolidTypeProperty()
1907*cdf0e10cSrcweir {
1908*cdf0e10cSrcweir }
1909*cdf0e10cSrcweir 
1910*cdf0e10cSrcweir void WrappedSolidTypeProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
1911*cdf0e10cSrcweir                 throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
1912*cdf0e10cSrcweir {
1913*cdf0e10cSrcweir     sal_Int32 nNewSolidType = ::com::sun::star::chart::ChartSolidType::RECTANGULAR_SOLID;
1914*cdf0e10cSrcweir     if( ! (rOuterValue >>= nNewSolidType) )
1915*cdf0e10cSrcweir         throw lang::IllegalArgumentException( C2U("Property SolidType requires integer value"), 0, 0 );
1916*cdf0e10cSrcweir 
1917*cdf0e10cSrcweir     m_aOuterValue = rOuterValue;
1918*cdf0e10cSrcweir 
1919*cdf0e10cSrcweir     Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
1920*cdf0e10cSrcweir     if( !xDiagram.is() )
1921*cdf0e10cSrcweir         return;
1922*cdf0e10cSrcweir 
1923*cdf0e10cSrcweir     bool bFound = false;
1924*cdf0e10cSrcweir     bool bAmbiguous = false;
1925*cdf0e10cSrcweir     sal_Int32 nOldSolidType = DiagramHelper::getGeometry3D( xDiagram, bFound, bAmbiguous );
1926*cdf0e10cSrcweir     if( bFound && ( nOldSolidType != nNewSolidType || bAmbiguous ) )
1927*cdf0e10cSrcweir         DiagramHelper::setGeometry3D( xDiagram, nNewSolidType );
1928*cdf0e10cSrcweir }
1929*cdf0e10cSrcweir 
1930*cdf0e10cSrcweir Any WrappedSolidTypeProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
1931*cdf0e10cSrcweir                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1932*cdf0e10cSrcweir {
1933*cdf0e10cSrcweir     bool bFound = false;
1934*cdf0e10cSrcweir     bool bAmbiguous = false;
1935*cdf0e10cSrcweir     Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
1936*cdf0e10cSrcweir     if( xDiagram.is() )
1937*cdf0e10cSrcweir     {
1938*cdf0e10cSrcweir         sal_Int32 nGeometry = DiagramHelper::getGeometry3D( xDiagram, bFound, bAmbiguous );
1939*cdf0e10cSrcweir         if( bFound )
1940*cdf0e10cSrcweir             m_aOuterValue <<= nGeometry;
1941*cdf0e10cSrcweir     }
1942*cdf0e10cSrcweir     return m_aOuterValue;
1943*cdf0e10cSrcweir }
1944*cdf0e10cSrcweir 
1945*cdf0e10cSrcweir Any WrappedSolidTypeProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
1946*cdf0e10cSrcweir                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1947*cdf0e10cSrcweir {
1948*cdf0e10cSrcweir     return uno::makeAny( ::com::sun::star::chart::ChartSolidType::RECTANGULAR_SOLID );
1949*cdf0e10cSrcweir }
1950*cdf0e10cSrcweir 
1951*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
1952*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
1953*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
1954*cdf0e10cSrcweir 
1955*cdf0e10cSrcweir class WrappedAutomaticSizeProperty : public WrappedProperty
1956*cdf0e10cSrcweir {
1957*cdf0e10cSrcweir public:
1958*cdf0e10cSrcweir     WrappedAutomaticSizeProperty();
1959*cdf0e10cSrcweir     virtual ~WrappedAutomaticSizeProperty();
1960*cdf0e10cSrcweir 
1961*cdf0e10cSrcweir     virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
1962*cdf0e10cSrcweir                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
1963*cdf0e10cSrcweir 
1964*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
1965*cdf0e10cSrcweir                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
1966*cdf0e10cSrcweir 
1967*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
1968*cdf0e10cSrcweir                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
1969*cdf0e10cSrcweir };
1970*cdf0e10cSrcweir 
1971*cdf0e10cSrcweir WrappedAutomaticSizeProperty::WrappedAutomaticSizeProperty()
1972*cdf0e10cSrcweir             : WrappedProperty( C2U( "AutomaticSize" ), OUString() )
1973*cdf0e10cSrcweir {
1974*cdf0e10cSrcweir }
1975*cdf0e10cSrcweir 
1976*cdf0e10cSrcweir WrappedAutomaticSizeProperty::~WrappedAutomaticSizeProperty()
1977*cdf0e10cSrcweir {
1978*cdf0e10cSrcweir }
1979*cdf0e10cSrcweir 
1980*cdf0e10cSrcweir void WrappedAutomaticSizeProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
1981*cdf0e10cSrcweir                 throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
1982*cdf0e10cSrcweir {
1983*cdf0e10cSrcweir     if( xInnerPropertySet.is() )
1984*cdf0e10cSrcweir     {
1985*cdf0e10cSrcweir         bool bNewValue = true;
1986*cdf0e10cSrcweir         if( ! (rOuterValue >>= bNewValue) )
1987*cdf0e10cSrcweir             throw lang::IllegalArgumentException( C2U("Property AutomaticSize requires value of type boolean"), 0, 0 );
1988*cdf0e10cSrcweir 
1989*cdf0e10cSrcweir         try
1990*cdf0e10cSrcweir         {
1991*cdf0e10cSrcweir             if( bNewValue )
1992*cdf0e10cSrcweir             {
1993*cdf0e10cSrcweir                 Any aRelativeSize( xInnerPropertySet->getPropertyValue( C2U( "RelativeSize" ) ) );
1994*cdf0e10cSrcweir                 if( aRelativeSize.hasValue() )
1995*cdf0e10cSrcweir                     xInnerPropertySet->setPropertyValue( C2U( "RelativeSize" ), Any() );
1996*cdf0e10cSrcweir             }
1997*cdf0e10cSrcweir         }
1998*cdf0e10cSrcweir         catch( uno::Exception & ex )
1999*cdf0e10cSrcweir         {
2000*cdf0e10cSrcweir             ASSERT_EXCEPTION( ex );
2001*cdf0e10cSrcweir         }
2002*cdf0e10cSrcweir     }
2003*cdf0e10cSrcweir }
2004*cdf0e10cSrcweir 
2005*cdf0e10cSrcweir Any WrappedAutomaticSizeProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
2006*cdf0e10cSrcweir                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
2007*cdf0e10cSrcweir {
2008*cdf0e10cSrcweir     Any aRet( getPropertyDefault( Reference< beans::XPropertyState >( xInnerPropertySet, uno::UNO_QUERY ) ) );
2009*cdf0e10cSrcweir     if( xInnerPropertySet.is() )
2010*cdf0e10cSrcweir     {
2011*cdf0e10cSrcweir         Any aRelativeSize( xInnerPropertySet->getPropertyValue( C2U( "RelativeSize" ) ) );
2012*cdf0e10cSrcweir         if( !aRelativeSize.hasValue() )
2013*cdf0e10cSrcweir             aRet <<= true;
2014*cdf0e10cSrcweir     }
2015*cdf0e10cSrcweir     return aRet;
2016*cdf0e10cSrcweir }
2017*cdf0e10cSrcweir 
2018*cdf0e10cSrcweir Any WrappedAutomaticSizeProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
2019*cdf0e10cSrcweir                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
2020*cdf0e10cSrcweir {
2021*cdf0e10cSrcweir     Any aRet;
2022*cdf0e10cSrcweir     aRet <<= false;
2023*cdf0e10cSrcweir     return aRet;
2024*cdf0e10cSrcweir }
2025*cdf0e10cSrcweir 
2026*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
2027*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
2028*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
2029*cdf0e10cSrcweir 
2030*cdf0e10cSrcweir //PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS
2031*cdf0e10cSrcweir class WrappedIncludeHiddenCellsProperty : public WrappedProperty
2032*cdf0e10cSrcweir {
2033*cdf0e10cSrcweir public:
2034*cdf0e10cSrcweir     WrappedIncludeHiddenCellsProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
2035*cdf0e10cSrcweir     virtual ~WrappedIncludeHiddenCellsProperty();
2036*cdf0e10cSrcweir 
2037*cdf0e10cSrcweir     virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
2038*cdf0e10cSrcweir                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
2039*cdf0e10cSrcweir 
2040*cdf0e10cSrcweir private: //member
2041*cdf0e10cSrcweir     ::boost::shared_ptr< Chart2ModelContact >   m_spChart2ModelContact;
2042*cdf0e10cSrcweir };
2043*cdf0e10cSrcweir 
2044*cdf0e10cSrcweir WrappedIncludeHiddenCellsProperty::WrappedIncludeHiddenCellsProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
2045*cdf0e10cSrcweir             : WrappedProperty(C2U("IncludeHiddenCells"),C2U("IncludeHiddenCells"))
2046*cdf0e10cSrcweir             , m_spChart2ModelContact( spChart2ModelContact )
2047*cdf0e10cSrcweir {
2048*cdf0e10cSrcweir }
2049*cdf0e10cSrcweir 
2050*cdf0e10cSrcweir WrappedIncludeHiddenCellsProperty::~WrappedIncludeHiddenCellsProperty()
2051*cdf0e10cSrcweir {
2052*cdf0e10cSrcweir }
2053*cdf0e10cSrcweir 
2054*cdf0e10cSrcweir void WrappedIncludeHiddenCellsProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
2055*cdf0e10cSrcweir                 throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
2056*cdf0e10cSrcweir {
2057*cdf0e10cSrcweir     sal_Bool bNewValue = false;
2058*cdf0e10cSrcweir     if( ! (rOuterValue >>= bNewValue) )
2059*cdf0e10cSrcweir         throw lang::IllegalArgumentException( C2U("Property Dim3D requires boolean value"), 0, 0 );
2060*cdf0e10cSrcweir 
2061*cdf0e10cSrcweir     ChartModelHelper::setIncludeHiddenCells( bNewValue, m_spChart2ModelContact->getChartModel() );
2062*cdf0e10cSrcweir }
2063*cdf0e10cSrcweir 
2064*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
2065*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
2066*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
2067*cdf0e10cSrcweir 
2068*cdf0e10cSrcweir // ____ XDiagramProvider ____
2069*cdf0e10cSrcweir Reference< chart2::XDiagram > SAL_CALL DiagramWrapper::getDiagram()
2070*cdf0e10cSrcweir     throw (uno::RuntimeException)
2071*cdf0e10cSrcweir {
2072*cdf0e10cSrcweir     return m_spChart2ModelContact->getChart2Diagram();
2073*cdf0e10cSrcweir }
2074*cdf0e10cSrcweir 
2075*cdf0e10cSrcweir void SAL_CALL DiagramWrapper::setDiagram(
2076*cdf0e10cSrcweir     const Reference< chart2::XDiagram >& /*xDiagram*/ )
2077*cdf0e10cSrcweir     throw (uno::RuntimeException)
2078*cdf0e10cSrcweir {
2079*cdf0e10cSrcweir     //@todo: remove this method from interface
2080*cdf0e10cSrcweir     DBG_ERROR("DiagramWrapper::setDiagram is not implemented, should be removed and not be called" );
2081*cdf0e10cSrcweir }
2082*cdf0e10cSrcweir 
2083*cdf0e10cSrcweir // ================================================================================
2084*cdf0e10cSrcweir 
2085*cdf0e10cSrcweir Reference< beans::XPropertySet > DiagramWrapper::getInnerPropertySet()
2086*cdf0e10cSrcweir {
2087*cdf0e10cSrcweir     return Reference< beans::XPropertySet >( m_spChart2ModelContact->getChart2Diagram(), uno::UNO_QUERY );
2088*cdf0e10cSrcweir }
2089*cdf0e10cSrcweir 
2090*cdf0e10cSrcweir const Sequence< beans::Property >& DiagramWrapper::getPropertySequence()
2091*cdf0e10cSrcweir {
2092*cdf0e10cSrcweir     return *StaticDiagramWrapperPropertyArray::get();
2093*cdf0e10cSrcweir }
2094*cdf0e10cSrcweir 
2095*cdf0e10cSrcweir const std::vector< WrappedProperty* > DiagramWrapper::createWrappedProperties()
2096*cdf0e10cSrcweir {
2097*cdf0e10cSrcweir     ::std::vector< ::chart::WrappedProperty* > aWrappedProperties;
2098*cdf0e10cSrcweir 
2099*cdf0e10cSrcweir     WrappedAxisAndGridExistenceProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
2100*cdf0e10cSrcweir     WrappedAxisTitleExistenceProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
2101*cdf0e10cSrcweir     WrappedAxisLabelExistenceProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
2102*cdf0e10cSrcweir     WrappedSceneProperty::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
2103*cdf0e10cSrcweir     WrappedIgnoreProperties::addIgnoreFillProperties( aWrappedProperties );
2104*cdf0e10cSrcweir     WrappedIgnoreProperties::addIgnoreLineProperties( aWrappedProperties );
2105*cdf0e10cSrcweir     WrappedStatisticProperties::addWrappedPropertiesForDiagram( aWrappedProperties, m_spChart2ModelContact );
2106*cdf0e10cSrcweir     WrappedSymbolProperties::addWrappedPropertiesForDiagram( aWrappedProperties, m_spChart2ModelContact );
2107*cdf0e10cSrcweir     WrappedDataCaptionProperties::addWrappedPropertiesForDiagram( aWrappedProperties, m_spChart2ModelContact );
2108*cdf0e10cSrcweir     WrappedSplineProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
2109*cdf0e10cSrcweir     WrappedStockProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
2110*cdf0e10cSrcweir     WrappedAutomaticPositionProperties::addWrappedProperties( aWrappedProperties );
2111*cdf0e10cSrcweir 
2112*cdf0e10cSrcweir     aWrappedProperties.push_back( new WrappedDataRowSourceProperty( m_spChart2ModelContact ) );
2113*cdf0e10cSrcweir     aWrappedProperties.push_back( new WrappedStackingProperty( StackMode_Y_STACKED,m_spChart2ModelContact ) );
2114*cdf0e10cSrcweir     aWrappedProperties.push_back( new WrappedStackingProperty( StackMode_Y_STACKED_PERCENT, m_spChart2ModelContact ) );
2115*cdf0e10cSrcweir     aWrappedProperties.push_back( new WrappedStackingProperty( StackMode_Z_STACKED, m_spChart2ModelContact ) );
2116*cdf0e10cSrcweir     aWrappedProperties.push_back( new WrappedDim3DProperty( m_spChart2ModelContact ) );
2117*cdf0e10cSrcweir     aWrappedProperties.push_back( new WrappedVerticalProperty( m_spChart2ModelContact ) );
2118*cdf0e10cSrcweir     aWrappedProperties.push_back( new WrappedNumberOfLinesProperty( m_spChart2ModelContact ) );
2119*cdf0e10cSrcweir     aWrappedProperties.push_back( new WrappedAttributedDataPointsProperty( m_spChart2ModelContact ) );
2120*cdf0e10cSrcweir     aWrappedProperties.push_back( new WrappedProperty( C2U( "StackedBarsConnected" ), C2U( "ConnectBars" ) ) );
2121*cdf0e10cSrcweir     aWrappedProperties.push_back( new WrappedSolidTypeProperty( m_spChart2ModelContact ) );
2122*cdf0e10cSrcweir     aWrappedProperties.push_back( new WrappedAutomaticSizeProperty() );
2123*cdf0e10cSrcweir     aWrappedProperties.push_back( new WrappedIncludeHiddenCellsProperty( m_spChart2ModelContact ) );
2124*cdf0e10cSrcweir 
2125*cdf0e10cSrcweir     return aWrappedProperties;
2126*cdf0e10cSrcweir }
2127*cdf0e10cSrcweir 
2128*cdf0e10cSrcweir // ================================================================================
2129*cdf0e10cSrcweir 
2130*cdf0e10cSrcweir uno::Sequence< OUString > DiagramWrapper::getSupportedServiceNames_Static()
2131*cdf0e10cSrcweir {
2132*cdf0e10cSrcweir     uno::Sequence< OUString > aServices( 8 );
2133*cdf0e10cSrcweir     aServices[ 0 ] = C2U( "com.sun.star.chart.Diagram" );
2134*cdf0e10cSrcweir     aServices[ 1 ] = C2U( "com.sun.star.xml.UserDefinedAttributeSupplier" );
2135*cdf0e10cSrcweir     aServices[ 2 ] = C2U( "com.sun.star.chart.StackableDiagram" );
2136*cdf0e10cSrcweir     aServices[ 3 ] = C2U( "com.sun.star.chart.ChartAxisXSupplier" );
2137*cdf0e10cSrcweir     aServices[ 4 ] = C2U( "com.sun.star.chart.ChartAxisYSupplier" );
2138*cdf0e10cSrcweir     aServices[ 5 ] = C2U( "com.sun.star.chart.ChartAxisZSupplier" );
2139*cdf0e10cSrcweir     aServices[ 6 ] = C2U( "com.sun.star.chart.ChartTwoAxisXSupplier" );
2140*cdf0e10cSrcweir     aServices[ 7 ] = C2U( "com.sun.star.chart.ChartTwoAxisYSupplier" );
2141*cdf0e10cSrcweir //     aServices[ x ] = C2U( "com.sun.star.beans.PropertySet" );
2142*cdf0e10cSrcweir //     aServices[ x ] = C2U( "com.sun.star.drawing.FillProperties" );
2143*cdf0e10cSrcweir //     aServices[ x ] = C2U( "com.sun.star.drawing.LineProperties" );
2144*cdf0e10cSrcweir 
2145*cdf0e10cSrcweir     return aServices;
2146*cdf0e10cSrcweir }
2147*cdf0e10cSrcweir 
2148*cdf0e10cSrcweir // implement XServiceInfo methods basing upon getSupportedServiceNames_Static
2149*cdf0e10cSrcweir APPHELPER_XSERVICEINFO_IMPL( DiagramWrapper, lcl_aServiceName );
2150*cdf0e10cSrcweir 
2151*cdf0e10cSrcweir } //  namespace wrapper
2152*cdf0e10cSrcweir } //  namespace chart
2153*cdf0e10cSrcweir 
2154