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