fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / chart2 / source / controller / chartapiwrapper / DiagramWrapper.cxx
blob3d9112f909aac83d2a7a087a14545b6cfff32430
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "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 "WrappedGL3DProperties.hxx"
43 #include "RelativePositionHelper.hxx"
44 #include "ContainerHelper.hxx"
45 #include "ControllerLockGuard.hxx"
46 #include "ModifyListenerHelper.hxx"
47 #include "DisposeHelper.hxx"
48 #include <comphelper/InlineContainer.hxx>
49 #include "WrappedAutomaticPositionProperties.hxx"
50 #include "CommonConverters.hxx"
51 #include <unonames.hxx>
52 #include <cppuhelper/supportsservice.hxx>
54 #include <com/sun/star/beans/PropertyAttribute.hpp>
55 #include <com/sun/star/chart2/XTitled.hpp>
56 #include <com/sun/star/chart/ChartDataRowSource.hpp>
57 #include <com/sun/star/chart2/RelativeSize.hpp>
58 #include <com/sun/star/chart2/RelativePosition.hpp>
59 #include <com/sun/star/chart/ChartSolidType.hpp>
61 #include "LinePropertiesHelper.hxx"
62 #include "FillProperties.hxx"
63 #include "UserDefinedProperties.hxx"
64 #include "SceneProperties.hxx"
66 #include <algorithm>
67 #include <rtl/ustrbuf.hxx>
68 #include <com/sun/star/lang/XServiceName.hpp>
69 #include <com/sun/star/util/XRefreshable.hpp>
71 using namespace ::com::sun::star;
72 using namespace ::chart::wrapper;
74 using ::com::sun::star::uno::Reference;
75 using ::com::sun::star::uno::Any;
76 using ::com::sun::star::uno::Sequence;
77 using ::com::sun::star::beans::Property;
78 using ::com::sun::star::chart::XAxis;
79 using ::osl::MutexGuard;
81 namespace
83 static const char lcl_aServiceName[] = "com.sun.star.comp.chart.Diagram";
85 enum
87 PROP_DIAGRAM_ATTRIBUTED_DATA_POINTS,
88 PROP_DIAGRAM_PERCENT_STACKED,
89 PROP_DIAGRAM_STACKED,
90 PROP_DIAGRAM_THREE_D,
91 PROP_DIAGRAM_SOLIDTYPE,
92 PROP_DIAGRAM_DEEP,
93 PROP_DIAGRAM_VERTICAL,
94 PROP_DIAGRAM_NUMBER_OF_LINES,
95 PROP_DIAGRAM_STACKED_BARS_CONNECTED,
96 PROP_DIAGRAM_DATAROW_SOURCE,
98 PROP_DIAGRAM_GROUP_BARS_PER_AXIS,
99 PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS,
101 PROP_DIAGRAM_SORT_BY_X_VALUES,
103 PROP_DIAGRAM_STARTING_ANGLE,
105 PROP_DIAGRAM_RIGHT_ANGLED_AXES,
106 PROP_DIAGRAM_PERSPECTIVE,
107 PROP_DIAGRAM_ROTATION_HORIZONTAL,
108 PROP_DIAGRAM_ROTATION_VERTICAL,
110 PROP_DIAGRAM_MISSING_VALUE_TREATMENT,
112 PROP_DIAGRAM_HAS_X_AXIS,
113 PROP_DIAGRAM_HAS_X_AXIS_DESCR,
114 PROP_DIAGRAM_HAS_X_AXIS_TITLE,
115 PROP_DIAGRAM_HAS_X_AXIS_GRID,
116 PROP_DIAGRAM_HAS_X_AXIS_HELP_GRID,
118 PROP_DIAGRAM_HAS_Y_AXIS,
119 PROP_DIAGRAM_HAS_Y_AXIS_DESCR,
120 PROP_DIAGRAM_HAS_Y_AXIS_TITLE,
121 PROP_DIAGRAM_HAS_Y_AXIS_GRID,
122 PROP_DIAGRAM_HAS_Y_AXIS_HELP_GRID,
124 PROP_DIAGRAM_HAS_Z_AXIS,
125 PROP_DIAGRAM_HAS_Z_AXIS_DESCR,
126 PROP_DIAGRAM_HAS_Z_AXIS_TITLE,
127 PROP_DIAGRAM_HAS_Z_AXIS_GRID,
128 PROP_DIAGRAM_HAS_Z_AXIS_HELP_GRID,
130 PROP_DIAGRAM_HAS_SECOND_X_AXIS,
131 PROP_DIAGRAM_HAS_SECOND_X_AXIS_DESCR,
133 PROP_DIAGRAM_HAS_SECOND_Y_AXIS,
134 PROP_DIAGRAM_HAS_SECOND_Y_AXIS_DESCR,
136 PROP_DIAGRAM_HAS_SECOND_X_AXIS_TITLE,
137 PROP_DIAGRAM_HAS_SECOND_Y_AXIS_TITLE,
139 PROP_DIAGRAM_AUTOMATIC_SIZE,
140 PROP_DIAGRAM_DATATABLEHBORDER,
141 PROP_DIAGRAM_DATATABLEVBORDER,
142 PROP_DIAGRAM_DATATABLEOUTLINE,
143 PROP_DIAGRAM_EXTERNALDATA,
145 PROP_DIAGRAM_ROUNDED_EDGE
148 void lcl_AddPropertiesToVector(
149 ::std::vector< Property > & rOutProperties )
151 rOutProperties.push_back(
152 Property( "AttributedDataPoints",
153 PROP_DIAGRAM_ATTRIBUTED_DATA_POINTS,
154 cppu::UnoType<uno::Sequence< uno::Sequence< sal_Int32 > >>::get(),
155 beans::PropertyAttribute::BOUND
156 | beans::PropertyAttribute::MAYBEVOID ));
158 // see com.sun.star.chart.StackableDiagram
159 rOutProperties.push_back(
160 Property( "Percent",
161 PROP_DIAGRAM_PERCENT_STACKED,
162 cppu::UnoType<bool>::get(),
163 beans::PropertyAttribute::BOUND
164 | beans::PropertyAttribute::MAYBEDEFAULT ));
165 rOutProperties.push_back(
166 Property( "Stacked",
167 PROP_DIAGRAM_STACKED,
168 cppu::UnoType<bool>::get(),
169 beans::PropertyAttribute::BOUND
170 | beans::PropertyAttribute::MAYBEDEFAULT ));
172 rOutProperties.push_back(
173 Property( "Dim3D",
174 PROP_DIAGRAM_THREE_D,
175 cppu::UnoType<bool>::get(),
176 beans::PropertyAttribute::BOUND
177 | beans::PropertyAttribute::MAYBEDEFAULT ));
179 // see com.sun.star.chart.Chart3DBarProperties
180 rOutProperties.push_back(
181 Property( "SolidType",
182 PROP_DIAGRAM_SOLIDTYPE,
183 cppu::UnoType<sal_Int32>::get(),
184 beans::PropertyAttribute::BOUND
185 | beans::PropertyAttribute::MAYBEDEFAULT ));
187 // see com.sun.star.chart.BarDiagram
188 rOutProperties.push_back(
189 Property( "Deep",
190 PROP_DIAGRAM_DEEP,
191 cppu::UnoType<bool>::get(),
192 beans::PropertyAttribute::BOUND
193 | beans::PropertyAttribute::MAYBEDEFAULT ));
194 rOutProperties.push_back(
195 Property( "Vertical",
196 PROP_DIAGRAM_VERTICAL,
197 cppu::UnoType<bool>::get(),
198 beans::PropertyAttribute::BOUND
199 | beans::PropertyAttribute::MAYBEDEFAULT ));
200 rOutProperties.push_back(
201 Property( "NumberOfLines",
202 PROP_DIAGRAM_NUMBER_OF_LINES,
203 cppu::UnoType<sal_Int32>::get(),
204 beans::PropertyAttribute::BOUND
205 | beans::PropertyAttribute::MAYBEDEFAULT ));
206 rOutProperties.push_back(
207 Property( "StackedBarsConnected",
208 PROP_DIAGRAM_STACKED_BARS_CONNECTED,
209 cppu::UnoType<bool>::get(),
210 beans::PropertyAttribute::BOUND
211 | beans::PropertyAttribute::MAYBEDEFAULT ));
213 rOutProperties.push_back(
214 Property( "DataRowSource",
215 PROP_DIAGRAM_DATAROW_SOURCE,
216 cppu::UnoType<com::sun::star::chart::ChartDataRowSource>::get(),
217 beans::PropertyAttribute::BOUND
218 | beans::PropertyAttribute::MAYBEDEFAULT ));
220 rOutProperties.push_back(
221 Property( "GroupBarsPerAxis",
222 PROP_DIAGRAM_GROUP_BARS_PER_AXIS,
223 cppu::UnoType<bool>::get(),
224 beans::PropertyAttribute::BOUND
225 | beans::PropertyAttribute::MAYBEDEFAULT ));
227 rOutProperties.push_back(
228 Property( "IncludeHiddenCells",
229 PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS,
230 cppu::UnoType<bool>::get(),
231 beans::PropertyAttribute::BOUND
232 | beans::PropertyAttribute::MAYBEDEFAULT ));
234 //new for XY charts
235 rOutProperties.push_back(
236 Property( CHART_UNONAME_SORT_BY_XVALUES,
237 PROP_DIAGRAM_SORT_BY_X_VALUES,
238 cppu::UnoType<bool>::get(),
239 beans::PropertyAttribute::BOUND
240 | beans::PropertyAttribute::MAYBEDEFAULT ));
242 //for pie and donut charts
243 rOutProperties.push_back(
244 Property( "StartingAngle",
245 PROP_DIAGRAM_STARTING_ANGLE,
246 cppu::UnoType<sal_Int32>::get(),
247 beans::PropertyAttribute::BOUND
248 | beans::PropertyAttribute::MAYBEDEFAULT ));
250 //new for 3D charts
251 rOutProperties.push_back(
252 Property( "RightAngledAxes",
253 PROP_DIAGRAM_RIGHT_ANGLED_AXES,
254 cppu::UnoType<bool>::get(),
255 beans::PropertyAttribute::BOUND
256 | beans::PropertyAttribute::MAYBEDEFAULT ));
258 rOutProperties.push_back(
259 Property( "Perspective",
260 PROP_DIAGRAM_PERSPECTIVE,
261 cppu::UnoType<sal_Int32>::get(),
262 beans::PropertyAttribute::MAYBEVOID ));
264 rOutProperties.push_back(
265 Property( "RotationHorizontal",
266 PROP_DIAGRAM_ROTATION_HORIZONTAL,
267 cppu::UnoType<sal_Int32>::get(),
268 beans::PropertyAttribute::MAYBEVOID ));
270 rOutProperties.push_back(
271 Property( "RotationVertical",
272 PROP_DIAGRAM_ROTATION_VERTICAL,
273 cppu::UnoType<sal_Int32>::get(),
274 beans::PropertyAttribute::MAYBEVOID ));
276 // XAxisXSupplier
277 rOutProperties.push_back(
278 Property( "HasXAxis",
279 PROP_DIAGRAM_HAS_X_AXIS,
280 cppu::UnoType<bool>::get(),
281 beans::PropertyAttribute::BOUND
282 | beans::PropertyAttribute::MAYBEDEFAULT ));
283 rOutProperties.push_back(
284 Property( "HasXAxisDescription",
285 PROP_DIAGRAM_HAS_X_AXIS_DESCR,
286 cppu::UnoType<bool>::get(),
287 beans::PropertyAttribute::BOUND
288 | beans::PropertyAttribute::MAYBEDEFAULT ));
289 rOutProperties.push_back(
290 Property( "HasXAxisTitle",
291 PROP_DIAGRAM_HAS_X_AXIS_TITLE,
292 cppu::UnoType<bool>::get(),
293 beans::PropertyAttribute::BOUND
294 | beans::PropertyAttribute::MAYBEDEFAULT ));
295 rOutProperties.push_back(
296 Property( "HasXAxisGrid",
297 PROP_DIAGRAM_HAS_X_AXIS_GRID,
298 cppu::UnoType<bool>::get(),
299 beans::PropertyAttribute::BOUND
300 | beans::PropertyAttribute::MAYBEDEFAULT ));
301 rOutProperties.push_back(
302 Property( "HasXAxisHelpGrid",
303 PROP_DIAGRAM_HAS_X_AXIS_HELP_GRID,
304 cppu::UnoType<bool>::get(),
305 beans::PropertyAttribute::BOUND
306 | beans::PropertyAttribute::MAYBEDEFAULT ));
308 // XAxisYSupplier
309 rOutProperties.push_back(
310 Property( "HasYAxis",
311 PROP_DIAGRAM_HAS_Y_AXIS,
312 cppu::UnoType<bool>::get(),
313 beans::PropertyAttribute::BOUND
314 | beans::PropertyAttribute::MAYBEDEFAULT ));
315 rOutProperties.push_back(
316 Property( "HasYAxisDescription",
317 PROP_DIAGRAM_HAS_Y_AXIS_DESCR,
318 cppu::UnoType<bool>::get(),
319 beans::PropertyAttribute::BOUND
320 | beans::PropertyAttribute::MAYBEDEFAULT ));
321 rOutProperties.push_back(
322 Property( "HasYAxisTitle",
323 PROP_DIAGRAM_HAS_Y_AXIS_TITLE,
324 cppu::UnoType<bool>::get(),
325 beans::PropertyAttribute::BOUND
326 | beans::PropertyAttribute::MAYBEDEFAULT ));
327 rOutProperties.push_back(
328 Property( "HasYAxisGrid",
329 PROP_DIAGRAM_HAS_Y_AXIS_GRID,
330 cppu::UnoType<bool>::get(),
331 beans::PropertyAttribute::BOUND
332 | beans::PropertyAttribute::MAYBEDEFAULT ));
333 rOutProperties.push_back(
334 Property( "HasYAxisHelpGrid",
335 PROP_DIAGRAM_HAS_Y_AXIS_HELP_GRID,
336 cppu::UnoType<bool>::get(),
337 beans::PropertyAttribute::BOUND
338 | beans::PropertyAttribute::MAYBEDEFAULT ));
340 // XAxisZSupplier
341 rOutProperties.push_back(
342 Property( "HasZAxis",
343 PROP_DIAGRAM_HAS_Z_AXIS,
344 cppu::UnoType<bool>::get(),
345 beans::PropertyAttribute::BOUND
346 | beans::PropertyAttribute::MAYBEDEFAULT ));
347 rOutProperties.push_back(
348 Property( "HasZAxisDescription",
349 PROP_DIAGRAM_HAS_Z_AXIS_DESCR,
350 cppu::UnoType<bool>::get(),
351 beans::PropertyAttribute::BOUND
352 | beans::PropertyAttribute::MAYBEDEFAULT ));
353 rOutProperties.push_back(
354 Property( "HasZAxisTitle",
355 PROP_DIAGRAM_HAS_Z_AXIS_TITLE,
356 cppu::UnoType<bool>::get(),
357 beans::PropertyAttribute::BOUND
358 | beans::PropertyAttribute::MAYBEDEFAULT ));
359 rOutProperties.push_back(
360 Property( "HasZAxisGrid",
361 PROP_DIAGRAM_HAS_Z_AXIS_GRID,
362 cppu::UnoType<bool>::get(),
363 beans::PropertyAttribute::BOUND
364 | beans::PropertyAttribute::MAYBEDEFAULT ));
365 rOutProperties.push_back(
366 Property( "HasZAxisHelpGrid",
367 PROP_DIAGRAM_HAS_Z_AXIS_HELP_GRID,
368 cppu::UnoType<bool>::get(),
369 beans::PropertyAttribute::BOUND
370 | beans::PropertyAttribute::MAYBEDEFAULT ));
372 // XTwoAxisXSupplier
373 rOutProperties.push_back(
374 Property( "HasSecondaryXAxis",
375 PROP_DIAGRAM_HAS_SECOND_X_AXIS,
376 cppu::UnoType<bool>::get(),
377 beans::PropertyAttribute::BOUND
378 | beans::PropertyAttribute::MAYBEDEFAULT ));
379 rOutProperties.push_back(
380 Property( "HasSecondaryXAxisDescription",
381 PROP_DIAGRAM_HAS_SECOND_X_AXIS_DESCR,
382 cppu::UnoType<bool>::get(),
383 beans::PropertyAttribute::BOUND
384 | beans::PropertyAttribute::MAYBEDEFAULT ));
386 // XTwoAxisYSupplier
387 rOutProperties.push_back(
388 Property( "HasSecondaryYAxis",
389 PROP_DIAGRAM_HAS_SECOND_Y_AXIS,
390 cppu::UnoType<bool>::get(),
391 beans::PropertyAttribute::BOUND
392 | beans::PropertyAttribute::MAYBEDEFAULT ));
393 rOutProperties.push_back(
394 Property( "HasSecondaryYAxisDescription",
395 PROP_DIAGRAM_HAS_SECOND_Y_AXIS_DESCR,
396 cppu::UnoType<bool>::get(),
397 beans::PropertyAttribute::BOUND
398 | beans::PropertyAttribute::MAYBEDEFAULT ));
400 // XSecondAxisTitleSupplier
401 rOutProperties.push_back(
402 Property( "HasSecondaryXAxisTitle",
403 PROP_DIAGRAM_HAS_SECOND_X_AXIS_TITLE,
404 cppu::UnoType<bool>::get(),
405 beans::PropertyAttribute::BOUND
406 | beans::PropertyAttribute::MAYBEDEFAULT ));
407 rOutProperties.push_back(
408 Property( "HasSecondaryYAxisTitle",
409 PROP_DIAGRAM_HAS_SECOND_Y_AXIS_TITLE,
410 cppu::UnoType<bool>::get(),
411 beans::PropertyAttribute::BOUND
412 | beans::PropertyAttribute::MAYBEDEFAULT ));
414 rOutProperties.push_back(
415 Property( "MissingValueTreatment",
416 PROP_DIAGRAM_MISSING_VALUE_TREATMENT,
417 cppu::UnoType<sal_Int32>::get(),
418 beans::PropertyAttribute::BOUND
419 | beans::PropertyAttribute::MAYBEVOID ));
421 rOutProperties.push_back(
422 Property( "AutomaticSize",
423 PROP_DIAGRAM_AUTOMATIC_SIZE,
424 cppu::UnoType<bool>::get(),
425 beans::PropertyAttribute::BOUND
426 | beans::PropertyAttribute::MAYBEDEFAULT ));
427 rOutProperties.push_back(
428 Property( "DataTableHBorder",
429 PROP_DIAGRAM_DATATABLEHBORDER,
430 cppu::UnoType<bool>::get(),
431 beans::PropertyAttribute::BOUND
432 | beans::PropertyAttribute::MAYBEDEFAULT ));
433 rOutProperties.push_back(
434 Property( "DataTableVBorder",
435 PROP_DIAGRAM_DATATABLEVBORDER,
436 cppu::UnoType<bool>::get(),
437 beans::PropertyAttribute::BOUND
438 | beans::PropertyAttribute::MAYBEDEFAULT ));
439 rOutProperties.push_back(
440 Property( "DataTableOutline",
441 PROP_DIAGRAM_DATATABLEOUTLINE,
442 cppu::UnoType<bool>::get(),
443 beans::PropertyAttribute::BOUND
444 | beans::PropertyAttribute::MAYBEDEFAULT ));
445 rOutProperties.push_back(
446 Property( "ExternalData",
447 PROP_DIAGRAM_EXTERNALDATA,
448 cppu::UnoType<OUString>::get(),
449 beans::PropertyAttribute::BOUND
450 | beans::PropertyAttribute::MAYBEVOID ));
453 struct StaticDiagramWrapperPropertyArray_Initializer
455 Sequence< Property >* operator()()
457 static Sequence< Property > aPropSeq( lcl_GetPropertySequence() );
458 return &aPropSeq;
461 private:
462 static uno::Sequence< Property > lcl_GetPropertySequence()
464 ::std::vector< ::com::sun::star::beans::Property > aProperties;
465 lcl_AddPropertiesToVector( aProperties );
466 ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
467 ::chart::FillProperties::AddPropertiesToVector( aProperties );
468 ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
469 ::chart::SceneProperties::AddPropertiesToVector( aProperties );
470 WrappedStatisticProperties::addProperties( aProperties );
471 WrappedSymbolProperties::addProperties( aProperties );
472 WrappedDataCaptionProperties::addProperties( aProperties );
473 WrappedSplineProperties::addProperties( aProperties );
474 WrappedStockProperties::addProperties( aProperties );
475 WrappedAutomaticPositionProperties::addProperties( aProperties );
476 WrappedGL3DProperties::addProperties(aProperties);
478 ::std::sort( aProperties.begin(), aProperties.end(),
479 ::chart::PropertyNameLess() );
481 return ::chart::ContainerHelper::ContainerToSequence( aProperties );
485 struct StaticDiagramWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticDiagramWrapperPropertyArray_Initializer >
489 bool lcl_isXYChart( const Reference< chart2::XDiagram >& rDiagram )
491 bool bRet = false;
492 Reference< chart2::XChartType > xChartType( ::chart::DiagramHelper::getChartTypeByIndex( rDiagram, 0 ) );
493 if( xChartType.is() )
495 OUString aChartType( xChartType->getChartType() );
496 if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER) )
497 bRet = true;
499 return bRet;
502 sal_Int32 lcl_getNewAPIIndexForOldAPIIndex(
503 sal_Int32 nOldAPIIndex
504 , Reference< chart2::XDiagram > xDiagram )
506 sal_Int32 nNewAPIIndex = nOldAPIIndex;
508 if( lcl_isXYChart( xDiagram ) )
510 if( nNewAPIIndex >= 1 )
511 nNewAPIIndex -= 1;
514 ::std::vector< uno::Reference< chart2::XDataSeries > > aSeriesList(
515 ::chart::DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
516 if( nNewAPIIndex >= static_cast<sal_Int32>(aSeriesList.size()) )
517 nNewAPIIndex = -1;
519 return nNewAPIIndex;
522 OUString lcl_getDiagramType( const OUString & rTemplateServiceName )
524 const OUString aPrefix("com.sun.star.chart2.template.");
526 if( rTemplateServiceName.match( aPrefix ))
528 const OUString aName( rTemplateServiceName.copy( aPrefix.getLength()));
530 if (aName.indexOf("GL3DBar") != -1)
531 return OUString("com.sun.star.chart.GL3DBarDiagram");
533 // "Area" "StackedArea" "PercentStackedArea" "ThreeDArea"
534 // "StackedThreeDArea" "PercentStackedThreeDArea"
535 if( aName.indexOf( "Area" ) != -1 )
536 return OUString("com.sun.star.chart.AreaDiagram");
538 // "Pie" "PieAllExploded" "ThreeDPie" "ThreeDPieAllExploded"
539 if( aName.indexOf( "Pie" ) != -1 )
540 return OUString("com.sun.star.chart.PieDiagram");
542 // "Column" "StackedColumn" "PercentStackedColumn" "ThreeDColumnDeep"
543 // "ThreeDColumnFlat" "StackedThreeDColumnFlat"
544 // "PercentStackedThreeDColumnFlat" "Bar" "StackedBar"
545 // "PercentStackedBar" "ThreeDBarDeep" "ThreeDBarFlat"
546 // "StackedThreeDBarFlat" "PercentStackedThreeDBarFlat" "ColumnWithLine"
547 // "StackedColumnWithLine"
548 if( aName.indexOf( "Column" ) != -1 || aName.indexOf( "Bar" ) != -1 )
549 return OUString( "com.sun.star.chart.BarDiagram" );
551 // "Donut" "DonutAllExploded" "ThreeDDonut" "ThreeDDonutAllExploded"
552 if( aName.indexOf( "Donut" ) != -1 )
553 return OUString( "com.sun.star.chart.DonutDiagram" );
555 // "ScatterLineSymbol" "ScatterLine" "ScatterSymbol" "ThreeDScatter"
556 if( aName.indexOf( "Scatter" ) != -1 )
557 return OUString( "com.sun.star.chart.XYDiagram" );
559 // "FilledNet" "StackedFilledNet" "PercentStackedFilledNet"
560 if( aName.indexOf( "FilledNet" ) != -1 )
561 return OUString( "com.sun.star.chart.FilledNetDiagram" );
563 // "Net" "NetSymbol" "NetLine" "StackedNet" "StackedNetSymbol"
564 // "StackedNetLine" "PercentStackedNet" "PercentStackedNetSymbol"
565 // "PercentStackedNetLine"
566 if( aName.indexOf( "Net" ) != -1 )
567 return OUString( "com.sun.star.chart.NetDiagram" );
569 // "StockLowHighClose" "StockOpenLowHighClose" "StockVolumeLowHighClose"
570 // "StockVolumeOpenLowHighClose"
571 if( aName.indexOf( "Stock" ) != -1 )
572 return OUString( "com.sun.star.chart.StockDiagram" );
574 if( aName.indexOf( "Bubble" ) != -1 )
575 return OUString( "com.sun.star.chart.BubbleDiagram" );
577 // Note: this must be checked after Bar, Net and Scatter
579 // "Symbol" "StackedSymbol" "PercentStackedSymbol" "Line" "StackedLine"
580 // "PercentStackedLine" "LineSymbol" "StackedLineSymbol"
581 // "PercentStackedLineSymbol" "ThreeDLine" "StackedThreeDLine"
582 // "PercentStackedThreeDLine" "ThreeDLineDeep"
583 if( aName.indexOf( "Line" ) != -1 || aName.indexOf( "Symbol" ) != -1 )
584 return OUString( "com.sun.star.chart.LineDiagram" );
586 OSL_FAIL( "unknown template" );
589 return OUString();
592 typedef ::comphelper::MakeMap< OUString, OUString > tMakeStringStringMap;
594 const tMakeStringStringMap& lcl_getChartTypeNameMap()
596 static tMakeStringStringMap g_aChartTypeNameMap =
597 tMakeStringStringMap
598 ( "com.sun.star.chart2.LineChartType", "com.sun.star.chart.LineDiagram" )
599 ( "com.sun.star.chart2.AreaChartType", "com.sun.star.chart.AreaDiagram" )
600 ( "com.sun.star.chart2.ColumnChartType", "com.sun.star.chart.BarDiagram" )
601 ( "com.sun.star.chart2.PieChartType", "com.sun.star.chart.PieDiagram" )
602 ( "com.sun.star.chart2.DonutChartType", "com.sun.star.chart.DonutDiagram" )
603 ( "com.sun.star.chart2.ScatterChartType", "com.sun.star.chart.XYDiagram" )
604 ( "com.sun.star.chart2.FilledNetChartType", "com.sun.star.chart.FilledNetDiagram" )
605 ( "com.sun.star.chart2.NetChartType", "com.sun.star.chart.NetDiagram" )
606 ( "com.sun.star.chart2.CandleStickChartType", "com.sun.star.chart.StockDiagram" )
607 ( "com.sun.star.chart2.BubbleChartType", "com.sun.star.chart.BubbleDiagram" )
608 ( "com.sun.star.chart2.GL3DBarChartType", "com.sun.star.chart.GL3DBarDiagram" )
610 return g_aChartTypeNameMap;
613 OUString lcl_getOldChartTypeName( const OUString & rNewChartTypeName )
615 OUString aOld(rNewChartTypeName);
617 const tMakeStringStringMap& rMap = lcl_getChartTypeNameMap();
618 tMakeStringStringMap::const_iterator aIt( rMap.find( rNewChartTypeName ));
619 if( aIt != rMap.end())
621 aOld = aIt->second;
623 return aOld;
626 } // anonymous namespace
628 namespace chart
630 namespace wrapper
633 DiagramWrapper::DiagramWrapper(
634 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) :
635 m_spChart2ModelContact( spChart2ModelContact ),
636 m_aEventListenerContainer( m_aMutex )
640 DiagramWrapper::~DiagramWrapper()
643 // ____ XDiagram ____
644 OUString SAL_CALL DiagramWrapper::getDiagramType()
645 throw (uno::RuntimeException, std::exception)
647 OUString aRet;
649 Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
650 Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
651 if( xChartDoc.is() && xDiagram.is() )
653 Reference< beans::XPropertySet > xChartDocProp( xChartDoc, uno::UNO_QUERY );
654 if( xChartDocProp.is() )
656 uno::Reference< util::XRefreshable > xAddIn;
657 if( xChartDocProp->getPropertyValue( "AddIn" ) >>= xAddIn )
659 uno::Reference< lang::XServiceName > xServiceName( xAddIn, uno::UNO_QUERY );
660 if( xServiceName.is())
661 return xServiceName->getServiceName();
665 Reference< lang::XMultiServiceFactory > xChartTypeManager( xChartDoc->getChartTypeManager(), uno::UNO_QUERY );
666 DiagramHelper::tTemplateWithServiceName aTemplateAndService =
667 DiagramHelper::getTemplateForDiagram( xDiagram, xChartTypeManager );
669 aRet = lcl_getDiagramType( aTemplateAndService.second );
672 if( aRet.isEmpty())
674 // none of the standard templates matched
675 // use first chart type
676 Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) );
677 if( xChartType.is() )
679 aRet = xChartType->getChartType();
680 if( !aRet.isEmpty() )
681 aRet = lcl_getOldChartTypeName( aRet );
683 if( aRet.isEmpty())
684 aRet = "com.sun.star.chart.BarDiagram";
687 return aRet;
690 Reference<
691 beans::XPropertySet > SAL_CALL DiagramWrapper::getDataRowProperties( sal_Int32 nRow )
692 throw (lang::IndexOutOfBoundsException,
693 uno::RuntimeException, std::exception)
695 if( nRow < 0 )
696 throw lang::IndexOutOfBoundsException("DataSeries index invalid",
697 static_cast< ::cppu::OWeakObject * >( this ));
699 Reference< chart2::XDataSeries > xSeries;
701 sal_Int32 nNewAPIIndex = lcl_getNewAPIIndexForOldAPIIndex( nRow, m_spChart2ModelContact->getChart2Diagram() );
702 if( nNewAPIIndex < 0 )
703 throw lang::IndexOutOfBoundsException("DataSeries index invalid",
704 static_cast< ::cppu::OWeakObject * >( this ));
706 Reference< beans::XPropertySet > xRet( new DataSeriesPointWrapper(
707 DataSeriesPointWrapper::DATA_SERIES, nNewAPIIndex, 0, m_spChart2ModelContact ) );
708 return xRet;
711 Reference<
712 beans::XPropertySet > SAL_CALL DiagramWrapper::getDataPointProperties( sal_Int32 nCol, sal_Int32 nRow )
713 throw (lang::IndexOutOfBoundsException,
714 uno::RuntimeException, std::exception)
716 if( nCol < 0 || nRow < 0 )
717 throw lang::IndexOutOfBoundsException("DataSeries index invalid",
718 static_cast< ::cppu::OWeakObject * >( this ));
720 Reference< chart2::XDataSeries > xSeries;
722 sal_Int32 nNewAPIIndex = lcl_getNewAPIIndexForOldAPIIndex( nRow, m_spChart2ModelContact->getChart2Diagram() );
723 if( nNewAPIIndex < 0 )
724 throw lang::IndexOutOfBoundsException("DataSeries index invalid",
725 static_cast< ::cppu::OWeakObject * >( this ));
727 //todo: check borders of point index
729 Reference< beans::XPropertySet > xRet( new DataSeriesPointWrapper(
730 DataSeriesPointWrapper::DATA_POINT, nNewAPIIndex, nCol, m_spChart2ModelContact ) );
732 return xRet;
735 // ____ XShape (base of XDiagram) ____
736 awt::Point SAL_CALL DiagramWrapper::getPosition()
737 throw (uno::RuntimeException, std::exception)
739 awt::Point aPosition = ToPoint( m_spChart2ModelContact->GetDiagramRectangleIncludingAxes() );
740 return aPosition;
743 void SAL_CALL DiagramWrapper::setPosition( const awt::Point& aPosition )
744 throw (uno::RuntimeException, std::exception)
746 ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
747 Reference< beans::XPropertySet > xProp( this->getInnerPropertySet() );
748 if( xProp.is() )
750 awt::Size aPageSize( m_spChart2ModelContact->GetPageSize() );
752 chart2::RelativePosition aRelativePosition;
753 aRelativePosition.Anchor = drawing::Alignment_TOP_LEFT;
754 aRelativePosition.Primary = double(aPosition.X)/double(aPageSize.Width);
755 aRelativePosition.Secondary = double(aPosition.Y)/double(aPageSize.Height);
756 if( aRelativePosition.Primary < 0 || aRelativePosition.Secondary < 0 || aRelativePosition.Primary > 1 || aRelativePosition.Secondary > 1 )
758 OSL_FAIL("DiagramWrapper::setPosition called with a position out of range -> automatic values are taken instead" );
759 uno::Any aEmpty;
760 xProp->setPropertyValue( "RelativePosition", aEmpty );
761 return;
763 xProp->setPropertyValue( "RelativePosition", uno::makeAny(aRelativePosition) );
764 xProp->setPropertyValue( "PosSizeExcludeAxes", uno::makeAny(false) );
768 awt::Size SAL_CALL DiagramWrapper::getSize()
769 throw (uno::RuntimeException, std::exception)
771 awt::Size aSize = ToSize( m_spChart2ModelContact->GetDiagramRectangleIncludingAxes() );
772 return aSize;
775 void SAL_CALL DiagramWrapper::setSize( const awt::Size& aSize )
776 throw (beans::PropertyVetoException,
777 uno::RuntimeException, std::exception)
779 ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
780 Reference< beans::XPropertySet > xProp( this->getInnerPropertySet() );
781 if( xProp.is() )
783 awt::Size aPageSize( m_spChart2ModelContact->GetPageSize() );
785 chart2::RelativeSize aRelativeSize;
786 aRelativeSize.Primary = double(aSize.Width)/double(aPageSize.Width);
787 aRelativeSize.Secondary = double(aSize.Height)/double(aPageSize.Height);
789 if( aRelativeSize.Primary > 1 || aRelativeSize.Secondary > 1 )
791 OSL_FAIL("DiagramWrapper::setSize called with sizes bigger than page -> automatic values are taken instead" );
792 uno::Any aEmpty;
793 xProp->setPropertyValue( "RelativeSize", aEmpty );
794 return;
797 xProp->setPropertyValue( "RelativeSize", uno::makeAny(aRelativeSize) );
798 xProp->setPropertyValue( "PosSizeExcludeAxes", uno::makeAny(false) );
802 // ____ XShapeDescriptor (base of XShape) ____
803 OUString SAL_CALL DiagramWrapper::getShapeType()
804 throw (uno::RuntimeException, std::exception)
806 return OUString( "com.sun.star.chart.Diagram" );
809 // ____ XDiagramPositioning ____
811 void SAL_CALL DiagramWrapper::setAutomaticDiagramPositioning() throw (uno::RuntimeException, std::exception)
813 ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
814 uno::Reference< beans::XPropertySet > xDiaProps( this->getDiagram(), uno::UNO_QUERY );
815 if( xDiaProps.is() )
817 xDiaProps->setPropertyValue( "RelativeSize", Any() );
818 xDiaProps->setPropertyValue( "RelativePosition", Any() );
821 sal_Bool SAL_CALL DiagramWrapper::isAutomaticDiagramPositioning( ) throw (uno::RuntimeException, std::exception)
823 uno::Reference< beans::XPropertySet > xDiaProps( this->getDiagram(), uno::UNO_QUERY );
824 if( xDiaProps.is() )
826 Any aRelativeSize( xDiaProps->getPropertyValue( "RelativeSize" ) );
827 Any aRelativePosition( xDiaProps->getPropertyValue( "RelativePosition" ) );
828 if( aRelativeSize.hasValue() && aRelativePosition.hasValue() )
829 return false;
831 return true;
833 void SAL_CALL DiagramWrapper::setDiagramPositionExcludingAxes( const awt::Rectangle& rPositionRect ) throw (uno::RuntimeException, std::exception)
835 ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
836 DiagramHelper::setDiagramPositioning( m_spChart2ModelContact->getChartModel(), rPositionRect );
837 uno::Reference< beans::XPropertySet > xDiaProps( this->getDiagram(), uno::UNO_QUERY );
838 if( xDiaProps.is() )
839 xDiaProps->setPropertyValue("PosSizeExcludeAxes", uno::makeAny(true) );
841 sal_Bool SAL_CALL DiagramWrapper::isExcludingDiagramPositioning() throw (uno::RuntimeException, std::exception)
843 uno::Reference< beans::XPropertySet > xDiaProps( this->getDiagram(), uno::UNO_QUERY );
844 if( xDiaProps.is() )
846 Any aRelativeSize( xDiaProps->getPropertyValue( "RelativeSize" ) );
847 Any aRelativePosition( xDiaProps->getPropertyValue( "RelativePosition" ) );
848 if( aRelativeSize.hasValue() && aRelativePosition.hasValue() )
850 bool bPosSizeExcludeAxes = false;
851 xDiaProps->getPropertyValue( "PosSizeExcludeAxes" ) >>= bPosSizeExcludeAxes;
852 return bPosSizeExcludeAxes;
855 return false;
857 awt::Rectangle SAL_CALL DiagramWrapper::calculateDiagramPositionExcludingAxes( ) throw (uno::RuntimeException, std::exception)
859 return m_spChart2ModelContact->GetDiagramRectangleExcludingAxes();
861 void SAL_CALL DiagramWrapper::setDiagramPositionIncludingAxes( const awt::Rectangle& rPositionRect ) throw (uno::RuntimeException, std::exception)
863 ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
864 DiagramHelper::setDiagramPositioning( m_spChart2ModelContact->getChartModel(), rPositionRect );
865 uno::Reference< beans::XPropertySet > xDiaProps( this->getDiagram(), uno::UNO_QUERY );
866 if( xDiaProps.is() )
867 xDiaProps->setPropertyValue("PosSizeExcludeAxes", uno::makeAny(false) );
869 awt::Rectangle SAL_CALL DiagramWrapper::calculateDiagramPositionIncludingAxes( ) throw (uno::RuntimeException, std::exception)
871 return m_spChart2ModelContact->GetDiagramRectangleIncludingAxes();
873 void SAL_CALL DiagramWrapper::setDiagramPositionIncludingAxesAndAxisTitles( const awt::Rectangle& rPositionRect ) throw (uno::RuntimeException, std::exception)
875 ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
876 awt::Rectangle aRect( m_spChart2ModelContact->SubstractAxisTitleSizes(rPositionRect) );
877 DiagramWrapper::setDiagramPositionIncludingAxes( aRect );
879 ::com::sun::star::awt::Rectangle SAL_CALL DiagramWrapper::calculateDiagramPositionIncludingAxesAndAxisTitles( ) throw (::com::sun::star::uno::RuntimeException, std::exception)
881 return m_spChart2ModelContact->GetDiagramRectangleIncludingTitle();
884 // ____ XAxisSupplier ____
885 Reference< XAxis > SAL_CALL DiagramWrapper::getAxis( sal_Int32 nDimensionIndex )
886 throw (uno::RuntimeException, std::exception)
888 Reference< XAxis > xAxis;
889 if(!nDimensionIndex)
891 if( !m_xXAxis.is() )
892 m_xXAxis = new AxisWrapper( AxisWrapper::X_AXIS, m_spChart2ModelContact );
893 xAxis = m_xXAxis;
895 else if(1==nDimensionIndex)
897 if( !m_xYAxis.is() )
898 m_xYAxis = new AxisWrapper( AxisWrapper::Y_AXIS, m_spChart2ModelContact );
899 xAxis = m_xYAxis;
901 else if(2==nDimensionIndex)
903 if( !m_xZAxis.is() )
904 m_xZAxis = new AxisWrapper( AxisWrapper::Z_AXIS, m_spChart2ModelContact );
905 xAxis = m_xZAxis;
907 return xAxis;
910 Reference< XAxis > SAL_CALL DiagramWrapper::getSecondaryAxis( sal_Int32 nDimensionIndex )
911 throw (uno::RuntimeException, std::exception)
913 Reference< XAxis > xAxis;
914 if(!nDimensionIndex)
916 if( !m_xSecondXAxis.is() )
917 m_xSecondXAxis = new AxisWrapper( AxisWrapper::SECOND_X_AXIS, m_spChart2ModelContact );
918 xAxis = m_xSecondXAxis;
920 else if(1==nDimensionIndex)
922 if( !m_xSecondYAxis.is() )
923 m_xSecondYAxis = new AxisWrapper( AxisWrapper::SECOND_Y_AXIS, m_spChart2ModelContact );
924 xAxis = m_xSecondYAxis;
926 return xAxis;
929 // ____ XAxisZSupplier ____
930 Reference< drawing::XShape > SAL_CALL DiagramWrapper::getZAxisTitle()
931 throw (uno::RuntimeException, std::exception)
933 Reference< drawing::XShape > xRet;
934 Reference< XAxis > xAxis( getAxis(2) );
935 if( xAxis.is() )
936 xRet = Reference< drawing::XShape >( xAxis->getAxisTitle(), uno::UNO_QUERY );
937 return xRet;
940 Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getZMainGrid()
941 throw (uno::RuntimeException, std::exception)
943 Reference< beans::XPropertySet > xRet;
944 Reference< XAxis > xAxis( getAxis(2) );
945 if( xAxis.is() )
946 xRet = xAxis->getMajorGrid();
947 return xRet;
950 Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getZHelpGrid()
951 throw (uno::RuntimeException, std::exception)
953 Reference< beans::XPropertySet > xRet;
954 Reference< XAxis > xAxis( getAxis(2) );
955 if( xAxis.is() )
956 xRet = xAxis->getMinorGrid();
957 return xRet;
960 Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getZAxis()
961 throw (uno::RuntimeException, std::exception)
963 if( ! m_xZAxis.is())
964 m_xZAxis = new AxisWrapper( AxisWrapper::Z_AXIS, m_spChart2ModelContact );
965 return Reference< beans::XPropertySet >( m_xZAxis, uno::UNO_QUERY );
968 // ____ XTwoAxisXSupplier ____
969 Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getSecondaryXAxis()
970 throw (uno::RuntimeException, std::exception)
972 if( ! m_xSecondXAxis.is())
973 m_xSecondXAxis = new AxisWrapper( AxisWrapper::SECOND_X_AXIS, m_spChart2ModelContact );
974 return Reference< beans::XPropertySet >( m_xSecondXAxis, uno::UNO_QUERY );
977 // ____ XAxisXSupplier (base of XTwoAxisXSupplier) ____
978 Reference< drawing::XShape > SAL_CALL DiagramWrapper::getXAxisTitle()
979 throw (uno::RuntimeException, std::exception)
981 Reference< drawing::XShape > xRet;
982 Reference< XAxis > xAxis( getAxis(0) );
983 if( xAxis.is() )
984 xRet = Reference< drawing::XShape >( xAxis->getAxisTitle(), uno::UNO_QUERY );
985 return xRet;
988 Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getXAxis()
989 throw (uno::RuntimeException, std::exception)
991 if( ! m_xXAxis.is())
992 m_xXAxis = new AxisWrapper( AxisWrapper::X_AXIS, m_spChart2ModelContact );
993 return Reference< beans::XPropertySet >( m_xXAxis, uno::UNO_QUERY );
996 Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getXMainGrid()
997 throw (uno::RuntimeException, std::exception)
999 Reference< beans::XPropertySet > xRet;
1000 Reference< XAxis > xAxis( getAxis(0) );
1001 if( xAxis.is() )
1002 xRet = xAxis->getMajorGrid();
1003 return xRet;
1006 Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getXHelpGrid()
1007 throw (uno::RuntimeException, std::exception)
1009 Reference< beans::XPropertySet > xRet;
1010 Reference< XAxis > xAxis( getAxis(0) );
1011 if( xAxis.is() )
1012 xRet = xAxis->getMinorGrid();
1013 return xRet;
1016 // ____ XTwoAxisYSupplier ____
1017 Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getSecondaryYAxis()
1018 throw (uno::RuntimeException, std::exception)
1020 if( ! m_xSecondYAxis.is())
1021 m_xSecondYAxis = new AxisWrapper( AxisWrapper::SECOND_Y_AXIS, m_spChart2ModelContact );
1022 return Reference< beans::XPropertySet >( m_xSecondYAxis, uno::UNO_QUERY );
1025 // ____ XAxisYSupplier (base of XTwoAxisYSupplier) ____
1026 Reference< drawing::XShape > SAL_CALL DiagramWrapper::getYAxisTitle()
1027 throw (uno::RuntimeException, std::exception)
1029 Reference< drawing::XShape > xRet;
1030 Reference< XAxis > xAxis( getAxis(1) );
1031 if( xAxis.is() )
1032 xRet = Reference< drawing::XShape >( xAxis->getAxisTitle(), uno::UNO_QUERY );
1033 return xRet;
1036 Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getYAxis()
1037 throw (uno::RuntimeException, std::exception)
1039 if( ! m_xYAxis.is())
1040 m_xYAxis = new AxisWrapper( AxisWrapper::Y_AXIS, m_spChart2ModelContact );
1041 return Reference< beans::XPropertySet >( m_xYAxis, uno::UNO_QUERY );
1044 Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getYMainGrid()
1045 throw (uno::RuntimeException, std::exception)
1047 Reference< beans::XPropertySet > xRet;
1048 Reference< XAxis > xAxis( getAxis(1) );
1049 if( xAxis.is() )
1050 xRet = xAxis->getMajorGrid();
1051 return xRet;
1054 Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getYHelpGrid()
1055 throw (uno::RuntimeException, std::exception)
1057 Reference< beans::XPropertySet > xRet;
1058 Reference< XAxis > xAxis( getAxis(1) );
1059 if( xAxis.is() )
1060 xRet = xAxis->getMinorGrid();
1061 return xRet;
1064 // ____ XSecondAxisTitleSupplier ____
1065 Reference< drawing::XShape > SAL_CALL DiagramWrapper::getSecondXAxisTitle()
1066 throw (uno::RuntimeException, std::exception)
1068 Reference< drawing::XShape > xRet;
1069 Reference< XAxis > xAxis( getSecondaryAxis(0) );
1070 if( xAxis.is() )
1071 xRet = Reference< drawing::XShape >( xAxis->getAxisTitle(), uno::UNO_QUERY );
1072 return xRet;
1075 Reference< drawing::XShape > SAL_CALL DiagramWrapper::getSecondYAxisTitle()
1076 throw (uno::RuntimeException, std::exception)
1078 Reference< drawing::XShape > xRet;
1079 Reference< XAxis > xAxis( getSecondaryAxis(1) );
1080 if( xAxis.is() )
1081 xRet = Reference< drawing::XShape >( xAxis->getAxisTitle(), uno::UNO_QUERY );
1082 return xRet;
1085 // ____ XStatisticDisplay ____
1086 Reference<
1087 beans::XPropertySet > SAL_CALL DiagramWrapper::getUpBar()
1088 throw (uno::RuntimeException, std::exception)
1090 if( !m_xUpBarWrapper.is() )
1092 m_xUpBarWrapper = new UpDownBarWrapper( true, m_spChart2ModelContact );
1094 return m_xUpBarWrapper;
1097 Reference<
1098 beans::XPropertySet > SAL_CALL DiagramWrapper::getDownBar()
1099 throw (uno::RuntimeException, std::exception)
1101 if( !m_xDownBarWrapper.is() )
1103 m_xDownBarWrapper = new UpDownBarWrapper( false, m_spChart2ModelContact );
1105 return m_xDownBarWrapper;
1108 Reference<
1109 beans::XPropertySet > SAL_CALL DiagramWrapper::getMinMaxLine()
1110 throw (uno::RuntimeException, std::exception)
1112 if( !m_xMinMaxLineWrapper.is() )
1114 m_xMinMaxLineWrapper = new MinMaxLineWrapper( m_spChart2ModelContact );
1116 return m_xMinMaxLineWrapper;
1119 // ____ X3DDisplay ____
1120 Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getWall()
1121 throw (uno::RuntimeException, std::exception)
1123 if( !m_xWall.is() )
1125 m_xWall = new WallFloorWrapper( true, m_spChart2ModelContact );
1127 return m_xWall;
1130 Reference<
1131 beans::XPropertySet > SAL_CALL DiagramWrapper::getFloor()
1132 throw (uno::RuntimeException, std::exception)
1134 if( !m_xFloor.is() )
1136 m_xFloor = new WallFloorWrapper( false, m_spChart2ModelContact );
1138 return m_xFloor;
1141 // ____ X3DDefaultSetter ____
1142 void SAL_CALL DiagramWrapper::set3DSettingsToDefault()
1143 throw (uno::RuntimeException, std::exception)
1145 Reference< X3DDefaultSetter > x3DDefaultSetter( m_spChart2ModelContact->getChart2Diagram(), uno::UNO_QUERY );
1146 if( x3DDefaultSetter.is() )
1147 x3DDefaultSetter->set3DSettingsToDefault();
1150 void SAL_CALL DiagramWrapper::setDefaultRotation()
1151 throw (uno::RuntimeException, std::exception)
1153 Reference< X3DDefaultSetter > x3DDefaultSetter( m_spChart2ModelContact->getChart2Diagram(), uno::UNO_QUERY );
1154 if( x3DDefaultSetter.is() )
1155 x3DDefaultSetter->setDefaultRotation();
1158 void SAL_CALL DiagramWrapper::setDefaultIllumination()
1159 throw (uno::RuntimeException, std::exception)
1161 Reference< X3DDefaultSetter > x3DDefaultSetter( m_spChart2ModelContact->getChart2Diagram(), uno::UNO_QUERY );
1162 if( x3DDefaultSetter.is() )
1163 x3DDefaultSetter->setDefaultIllumination();
1166 // ____ XComponent ____
1167 void SAL_CALL DiagramWrapper::dispose()
1168 throw (uno::RuntimeException, std::exception)
1170 m_aEventListenerContainer.disposeAndClear( lang::EventObject( static_cast< ::cppu::OWeakObject* >( this )));
1172 MutexGuard aGuard( GetMutex());
1174 DisposeHelper::DisposeAndClear( m_xXAxis );
1175 DisposeHelper::DisposeAndClear( m_xYAxis );
1176 DisposeHelper::DisposeAndClear( m_xZAxis );
1177 DisposeHelper::DisposeAndClear( m_xSecondXAxis );
1178 DisposeHelper::DisposeAndClear( m_xSecondYAxis );
1179 DisposeHelper::DisposeAndClear( m_xWall );
1180 DisposeHelper::DisposeAndClear( m_xFloor );
1181 DisposeHelper::DisposeAndClear( m_xMinMaxLineWrapper );
1182 DisposeHelper::DisposeAndClear( m_xUpBarWrapper );
1183 DisposeHelper::DisposeAndClear( m_xDownBarWrapper );
1185 clearWrappedPropertySet();
1188 void SAL_CALL DiagramWrapper::addEventListener(
1189 const Reference< lang::XEventListener >& xListener )
1190 throw (uno::RuntimeException, std::exception)
1192 m_aEventListenerContainer.addInterface( xListener );
1195 void SAL_CALL DiagramWrapper::removeEventListener(
1196 const Reference< lang::XEventListener >& aListener )
1197 throw (uno::RuntimeException, std::exception)
1199 m_aEventListenerContainer.removeInterface( aListener );
1202 //PROP_DIAGRAM_DATAROW_SOURCE
1203 class WrappedDataRowSourceProperty : public WrappedProperty
1205 public:
1206 WrappedDataRowSourceProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
1207 virtual ~WrappedDataRowSourceProperty();
1209 virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
1210 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) SAL_OVERRIDE;
1212 virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
1213 throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
1215 virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
1216 throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
1218 private: //member
1219 ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
1220 mutable Any m_aOuterValue;
1223 WrappedDataRowSourceProperty::WrappedDataRowSourceProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
1224 : WrappedProperty("DataRowSource",OUString())
1225 , m_spChart2ModelContact( spChart2ModelContact )
1226 , m_aOuterValue()
1228 m_aOuterValue = WrappedDataRowSourceProperty::getPropertyDefault( 0 );
1231 WrappedDataRowSourceProperty::~WrappedDataRowSourceProperty()
1235 void WrappedDataRowSourceProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
1236 throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
1238 ::com::sun::star::chart::ChartDataRowSource eChartDataRowSource = ::com::sun::star::chart::ChartDataRowSource_ROWS;
1239 if( ! (rOuterValue >>= eChartDataRowSource) )
1241 sal_Int32 nNew = ::com::sun::star::chart::ChartDataRowSource_ROWS;
1242 if( !(rOuterValue >>= nNew) )
1243 throw lang::IllegalArgumentException( "Property DataRowSource requires ::com::sun::star::chart::ChartDataRowSource value", 0, 0 );
1244 else
1245 eChartDataRowSource = ::com::sun::star::chart::ChartDataRowSource(nNew);
1248 m_aOuterValue = rOuterValue;
1250 bool bNewUseColumns = eChartDataRowSource == ::com::sun::star::chart::ChartDataRowSource_COLUMNS;
1252 OUString aRangeString;
1253 bool bUseColumns = true;
1254 bool bFirstCellAsLabel = true;
1255 bool bHasCategories = true;
1256 uno::Sequence< sal_Int32 > aSequenceMapping;
1258 if( DataSourceHelper::detectRangeSegmentation(
1259 m_spChart2ModelContact->getChartModel(), aRangeString, aSequenceMapping, bUseColumns
1260 , bFirstCellAsLabel, bHasCategories ) )
1262 if( bUseColumns != bNewUseColumns )
1264 aSequenceMapping.realloc(0);
1265 DataSourceHelper::setRangeSegmentation(
1266 m_spChart2ModelContact->getChartModel(), aSequenceMapping, bNewUseColumns , bFirstCellAsLabel , bHasCategories);
1271 Any WrappedDataRowSourceProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
1272 throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1274 OUString aRangeString;
1275 bool bUseColumns = true;
1276 bool bFirstCellAsLabel = true;
1277 bool bHasCategories = true;
1278 uno::Sequence< sal_Int32 > aSequenceMapping;
1280 if( DataSourceHelper::detectRangeSegmentation(
1281 m_spChart2ModelContact->getChartModel(), aRangeString, aSequenceMapping, bUseColumns
1282 , bFirstCellAsLabel, bHasCategories ) )
1284 ::com::sun::star::chart::ChartDataRowSource eChartDataRowSource = ::com::sun::star::chart::ChartDataRowSource_ROWS;
1285 if(bUseColumns)
1286 eChartDataRowSource = ::com::sun::star::chart::ChartDataRowSource_COLUMNS;
1288 m_aOuterValue <<= eChartDataRowSource;
1291 return m_aOuterValue;
1294 Any WrappedDataRowSourceProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
1295 throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1297 Any aRet;
1298 aRet <<= ::com::sun::star::chart::ChartDataRowSource_COLUMNS;
1299 return aRet;
1302 //PROP_DIAGRAM_STACKED
1303 //PROP_DIAGRAM_DEEP
1304 //PROP_DIAGRAM_PERCENT_STACKED
1305 class WrappedStackingProperty : public WrappedProperty
1307 public:
1308 WrappedStackingProperty( StackMode eStackMode, ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
1309 virtual ~WrappedStackingProperty();
1311 virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
1312 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) SAL_OVERRIDE;
1314 virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
1315 throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
1317 virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
1318 throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
1320 protected: //methods
1321 bool detectInnerValue( StackMode& eInnerStackMode ) const;
1323 private: //member
1324 ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
1325 const StackMode m_eStackMode;
1326 mutable Any m_aOuterValue;
1329 WrappedStackingProperty::WrappedStackingProperty( StackMode eStackMode, ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
1330 : WrappedProperty(OUString(),OUString())
1331 , m_spChart2ModelContact( spChart2ModelContact )
1332 , m_eStackMode( eStackMode )
1333 , m_aOuterValue()
1335 switch( m_eStackMode )
1337 case StackMode_Y_STACKED:
1338 m_aOuterName = "Stacked";
1339 break;
1340 case StackMode_Y_STACKED_PERCENT:
1341 m_aOuterName = "Percent";
1342 break;
1343 case StackMode_Z_STACKED:
1344 m_aOuterName = "Deep";
1345 break;
1346 default:
1347 OSL_FAIL( "unexpected stack mode" );
1348 break;
1352 WrappedStackingProperty::~WrappedStackingProperty()
1356 bool WrappedStackingProperty::detectInnerValue( StackMode& eStackMode ) const
1358 bool bHasDetectableInnerValue = false;
1359 bool bIsAmbiguous = false;
1360 eStackMode = DiagramHelper::getStackMode( m_spChart2ModelContact->getChart2Diagram()
1361 , bHasDetectableInnerValue, bIsAmbiguous );
1362 return bHasDetectableInnerValue;
1365 void WrappedStackingProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
1366 throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
1368 bool bNewValue = false;
1369 if( ! (rOuterValue >>= bNewValue) )
1370 throw lang::IllegalArgumentException( "Stacking Properties require boolean values", 0, 0 );
1372 StackMode eInnerStackMode;
1373 bool bHasDetectableInnerValue = detectInnerValue( eInnerStackMode );
1375 if( !bHasDetectableInnerValue )
1377 m_aOuterValue = rOuterValue;
1378 return;
1381 if( bNewValue && eInnerStackMode == m_eStackMode )
1382 return;
1383 if( !bNewValue && eInnerStackMode != m_eStackMode )
1384 return;
1386 Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
1387 if( xDiagram.is() )
1389 StackMode eNewStackMode = bNewValue ? m_eStackMode : StackMode_NONE;
1390 DiagramHelper::setStackMode( xDiagram, eNewStackMode );
1394 Any WrappedStackingProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
1395 throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1397 StackMode eInnerStackMode;
1398 if( detectInnerValue( eInnerStackMode ) )
1400 bool bValue = (eInnerStackMode == m_eStackMode);
1401 Any aAny;
1402 aAny <<= bValue;
1403 return aAny;
1405 return m_aOuterValue;
1408 Any WrappedStackingProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
1409 throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1411 Any aRet;
1412 aRet <<= false;
1413 return aRet;
1416 //PROP_DIAGRAM_THREE_D
1417 class WrappedDim3DProperty : public WrappedProperty
1419 public:
1420 WrappedDim3DProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
1421 virtual ~WrappedDim3DProperty();
1423 virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
1424 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) SAL_OVERRIDE;
1426 virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
1427 throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
1429 virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
1430 throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
1432 private: //member
1433 ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
1434 mutable Any m_aOuterValue;
1437 WrappedDim3DProperty::WrappedDim3DProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
1438 : WrappedProperty("Dim3D",OUString())
1439 , m_spChart2ModelContact( spChart2ModelContact )
1440 , m_aOuterValue()
1442 m_aOuterValue = WrappedDim3DProperty::getPropertyDefault( 0 );
1445 WrappedDim3DProperty::~WrappedDim3DProperty()
1449 void WrappedDim3DProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
1450 throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
1452 bool bNew3D = false;
1453 if( ! (rOuterValue >>= bNew3D) )
1454 throw lang::IllegalArgumentException( "Property Dim3D requires boolean value", 0, 0 );
1456 m_aOuterValue = rOuterValue;
1458 Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
1459 if( !xDiagram.is() )
1460 return;
1462 bool bOld3D = DiagramHelper::getDimension( xDiagram ) == 3;
1463 if( bOld3D != bNew3D )
1464 DiagramHelper::setDimension( xDiagram, bNew3D ? 3 : 2 );
1467 Any WrappedDim3DProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
1468 throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1470 Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
1471 if( xDiagram.is() )
1473 bool b3D = DiagramHelper::getDimension( xDiagram ) == 3;
1474 m_aOuterValue <<= b3D;
1476 return m_aOuterValue;
1479 Any WrappedDim3DProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
1480 throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1482 Any aRet;
1483 aRet <<= false;
1484 return aRet;
1487 //PROP_DIAGRAM_VERTICAL
1488 class WrappedVerticalProperty : public WrappedProperty
1490 public:
1491 WrappedVerticalProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
1492 virtual ~WrappedVerticalProperty();
1494 virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
1495 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) SAL_OVERRIDE;
1497 virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
1498 throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
1500 virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
1501 throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
1503 private: //member
1504 ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
1505 mutable Any m_aOuterValue;
1508 WrappedVerticalProperty::WrappedVerticalProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
1509 : WrappedProperty("Vertical",OUString())
1510 , m_spChart2ModelContact( spChart2ModelContact )
1511 , m_aOuterValue()
1513 m_aOuterValue = WrappedVerticalProperty::getPropertyDefault( 0 );
1516 WrappedVerticalProperty::~WrappedVerticalProperty()
1520 void WrappedVerticalProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
1521 throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
1523 bool bNewVertical = false;
1524 if( ! (rOuterValue >>= bNewVertical) )
1525 throw lang::IllegalArgumentException( "Property Vertical requires boolean value", 0, 0 );
1527 m_aOuterValue = rOuterValue;
1529 Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
1530 if( !xDiagram.is() )
1531 return;
1533 bool bFound = false;
1534 bool bAmbiguous = false;
1535 bool bOldVertical = DiagramHelper::getVertical( xDiagram, bFound, bAmbiguous );
1536 if( bFound && ( bOldVertical != bNewVertical || bAmbiguous ) )
1537 DiagramHelper::setVertical( xDiagram, bNewVertical );
1540 Any WrappedVerticalProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
1541 throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1543 Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
1544 if( xDiagram.is() )
1546 bool bFound = false;
1547 bool bAmbiguous = false;
1548 bool bVertical = DiagramHelper::getVertical( xDiagram, bFound, bAmbiguous );
1549 if( bFound )
1550 m_aOuterValue <<= bVertical;
1552 return m_aOuterValue;
1555 Any WrappedVerticalProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
1556 throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1558 Any aRet;
1559 aRet <<= false;
1560 return aRet;
1563 //PROP_DIAGRAM_NUMBER_OF_LINES
1564 class WrappedNumberOfLinesProperty : public WrappedProperty
1566 public:
1567 WrappedNumberOfLinesProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
1568 virtual ~WrappedNumberOfLinesProperty();
1570 virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
1571 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) SAL_OVERRIDE;
1573 virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
1574 throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
1576 virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
1577 throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
1579 protected: //methods
1580 bool detectInnerValue( uno::Any& rInnerValue ) const;
1582 private: //member
1583 ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
1584 mutable Any m_aOuterValue;
1587 WrappedNumberOfLinesProperty::WrappedNumberOfLinesProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
1588 : WrappedProperty("NumberOfLines",OUString())
1589 , m_spChart2ModelContact( spChart2ModelContact )
1590 , m_aOuterValue( this->getPropertyDefault(0) )
1594 WrappedNumberOfLinesProperty::~WrappedNumberOfLinesProperty()
1598 bool WrappedNumberOfLinesProperty::detectInnerValue( uno::Any& rInnerValue ) const
1600 sal_Int32 nNumberOfLines = 0;
1601 bool bHasDetectableInnerValue = false;
1602 Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
1603 uno::Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
1604 if( xDiagram.is() && xChartDoc.is() )
1606 ::std::vector< uno::Reference< chart2::XDataSeries > > aSeriesVector(
1607 DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
1608 if( aSeriesVector.size() > 0 )
1610 Reference< lang::XMultiServiceFactory > xFact( xChartDoc->getChartTypeManager(), uno::UNO_QUERY );
1611 DiagramHelper::tTemplateWithServiceName aTemplateAndService =
1612 DiagramHelper::getTemplateForDiagram( xDiagram, xFact );
1613 if( aTemplateAndService.second == "com.sun.star.chart2.template.ColumnWithLine" )
1617 uno::Reference< beans::XPropertySet > xProp( aTemplateAndService.first, uno::UNO_QUERY );
1618 xProp->getPropertyValue( m_aOuterName ) >>= nNumberOfLines;
1619 bHasDetectableInnerValue = true;
1621 catch( const uno::Exception & ex )
1623 ASSERT_EXCEPTION( ex );
1628 if(bHasDetectableInnerValue)
1629 rInnerValue = uno::makeAny(nNumberOfLines);
1630 return bHasDetectableInnerValue;
1633 void WrappedNumberOfLinesProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
1634 throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
1636 sal_Int32 nNewValue;
1637 if( ! (rOuterValue >>= nNewValue) )
1638 throw lang::IllegalArgumentException( "property NumberOfLines requires sal_Int32 value", 0, 0 );
1640 m_aOuterValue = rOuterValue;
1642 uno::Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
1643 Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
1644 sal_Int32 nDimension = ::chart::DiagramHelper::getDimension( xDiagram );
1645 if( xChartDoc.is() && xDiagram.is() && nDimension == 2 )
1647 Reference< lang::XMultiServiceFactory > xFact( xChartDoc->getChartTypeManager(), uno::UNO_QUERY );
1648 DiagramHelper::tTemplateWithServiceName aTemplateAndService =
1649 DiagramHelper::getTemplateForDiagram( xDiagram, xFact );
1651 uno::Reference< chart2::XChartTypeTemplate > xTemplate(0);
1652 if( aTemplateAndService.second == "com.sun.star.chart2.template.ColumnWithLine" )
1654 if( nNewValue != 0 )
1656 xTemplate.set( aTemplateAndService.first );
1659 sal_Int32 nOldValue = 0;
1660 uno::Reference< beans::XPropertySet > xProp( xTemplate, uno::UNO_QUERY );
1661 xProp->getPropertyValue( m_aOuterName ) >>= nOldValue;
1662 if( nOldValue == nNewValue )
1663 return;
1665 catch( const uno::Exception & ex )
1667 ASSERT_EXCEPTION( ex );
1670 else
1672 xTemplate.set( xFact->createInstance("com.sun.star.chart2.template.Column"), uno::UNO_QUERY );
1675 else if( aTemplateAndService.second == "com.sun.star.chart2.template.Column" )
1677 if( nNewValue == 0 )
1678 return;
1679 xTemplate.set( xFact->createInstance( "com.sun.star.chart2.template.ColumnWithLine" ), uno::UNO_QUERY );
1682 if(xTemplate.is())
1686 // locked controllers
1687 ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
1688 uno::Reference< beans::XPropertySet > xProp( xTemplate, uno::UNO_QUERY );
1689 xProp->setPropertyValue( "NumberOfLines", uno::makeAny(nNewValue) );
1690 xTemplate->changeDiagram( xDiagram );
1692 catch( const uno::Exception & ex )
1694 ASSERT_EXCEPTION( ex );
1700 Any WrappedNumberOfLinesProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
1701 throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1703 Any aRet;
1704 if( !detectInnerValue( aRet ) )
1705 aRet = m_aOuterValue;
1706 return aRet;
1709 Any WrappedNumberOfLinesProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
1710 throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1712 Any aRet;
1713 aRet <<= sal_Int32( 0 );
1714 return aRet;
1717 //PROP_DIAGRAM_ATTRIBUTED_DATA_POINTS
1718 class WrappedAttributedDataPointsProperty : public WrappedProperty
1720 public:
1721 WrappedAttributedDataPointsProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
1722 virtual ~WrappedAttributedDataPointsProperty();
1724 virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
1725 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) SAL_OVERRIDE;
1727 virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
1728 throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
1730 virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
1731 throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
1733 private: //member
1734 ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
1735 mutable Any m_aOuterValue;
1738 WrappedAttributedDataPointsProperty::WrappedAttributedDataPointsProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
1739 : WrappedProperty("AttributedDataPoints",OUString())
1740 , m_spChart2ModelContact( spChart2ModelContact )
1741 , m_aOuterValue()
1743 m_aOuterValue = WrappedAttributedDataPointsProperty::getPropertyDefault( 0 );
1746 WrappedAttributedDataPointsProperty::~WrappedAttributedDataPointsProperty()
1750 void WrappedAttributedDataPointsProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
1751 throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
1753 uno::Sequence< uno::Sequence< sal_Int32 > > aNewValue;
1754 if( ! (rOuterValue >>= aNewValue) )
1755 throw lang::IllegalArgumentException( "Property AttributedDataPoints requires value of type uno::Sequence< uno::Sequence< sal_Int32 > >", 0, 0 );
1757 m_aOuterValue = rOuterValue;
1759 Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
1760 Reference< beans::XPropertySet > xDiaProp( xDiagram, uno::UNO_QUERY );
1762 if( xDiagram.is() && xDiaProp.is())
1764 ::std::vector< Reference< chart2::XDataSeries > > aSeriesVector(
1765 ::chart::DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
1766 ::std::vector< Reference< chart2::XDataSeries > >::const_iterator aIt =
1767 aSeriesVector.begin();
1768 sal_Int32 i = 0;
1769 for( ; aIt != aSeriesVector.end(); ++aIt, ++i )
1771 Reference< beans::XPropertySet > xProp( *aIt, uno::UNO_QUERY );
1772 if( xProp.is())
1774 uno::Any aVal;
1775 if( i < aNewValue.getLength() )
1776 aVal <<= aNewValue[i];
1777 else
1779 //set empty sequence
1780 uno::Sequence< sal_Int32 > aSeq;
1781 aVal <<= aSeq;
1783 xProp->setPropertyValue( "AttributedDataPoints", aVal );
1789 Any WrappedAttributedDataPointsProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
1790 throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1792 Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
1793 Reference< beans::XPropertySet > xDiaProp( xDiagram, uno::UNO_QUERY );
1795 if( xDiagram.is() && xDiaProp.is())
1797 ::std::vector< Reference< chart2::XDataSeries > > aSeriesVector(
1798 ::chart::DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
1800 uno::Sequence< uno::Sequence< sal_Int32 > > aResult( aSeriesVector.size() );
1802 ::std::vector< Reference< chart2::XDataSeries > >::const_iterator aIt =
1803 aSeriesVector.begin();
1804 sal_Int32 i = 0;
1805 for( ; aIt != aSeriesVector.end(); ++aIt, ++i )
1807 Reference< beans::XPropertySet > xProp( *aIt, uno::UNO_QUERY );
1808 if( xProp.is())
1810 uno::Any aVal(
1811 xProp->getPropertyValue("AttributedDataPoints"));
1812 uno::Sequence< sal_Int32 > aSeq;
1813 if( aVal >>= aSeq )
1814 aResult[ i ] = aSeq;
1817 m_aOuterValue <<= aResult;
1819 return m_aOuterValue;
1822 Any WrappedAttributedDataPointsProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
1823 throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1825 Any aRet;
1826 uno::Sequence< uno::Sequence< sal_Int32 > > aSeq;
1827 aRet <<= aSeq;
1828 return aRet;
1831 //PROP_DIAGRAM_SOLIDTYPE
1832 class WrappedSolidTypeProperty : public WrappedProperty
1834 public:
1835 WrappedSolidTypeProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
1836 virtual ~WrappedSolidTypeProperty();
1838 virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
1839 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) SAL_OVERRIDE;
1841 virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
1842 throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
1844 virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
1845 throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
1847 private: //member
1848 ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
1849 mutable Any m_aOuterValue;
1852 WrappedSolidTypeProperty::WrappedSolidTypeProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
1853 : WrappedProperty( "SolidType", OUString() )
1854 , m_spChart2ModelContact( spChart2ModelContact )
1855 , m_aOuterValue()
1857 m_aOuterValue = WrappedSolidTypeProperty::getPropertyDefault( 0 );
1860 WrappedSolidTypeProperty::~WrappedSolidTypeProperty()
1864 void WrappedSolidTypeProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
1865 throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
1867 sal_Int32 nNewSolidType = ::com::sun::star::chart::ChartSolidType::RECTANGULAR_SOLID;
1868 if( ! (rOuterValue >>= nNewSolidType) )
1869 throw lang::IllegalArgumentException( "Property SolidType requires integer value", 0, 0 );
1871 m_aOuterValue = rOuterValue;
1873 Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
1874 if( !xDiagram.is() )
1875 return;
1877 bool bFound = false;
1878 bool bAmbiguous = false;
1879 sal_Int32 nOldSolidType = DiagramHelper::getGeometry3D( xDiagram, bFound, bAmbiguous );
1880 if( bFound && ( nOldSolidType != nNewSolidType || bAmbiguous ) )
1881 DiagramHelper::setGeometry3D( xDiagram, nNewSolidType );
1884 Any WrappedSolidTypeProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
1885 throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1887 Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
1888 if( xDiagram.is() )
1890 bool bFound = false;
1891 bool bAmbiguous = false;
1892 sal_Int32 nGeometry = DiagramHelper::getGeometry3D( xDiagram, bFound, bAmbiguous );
1893 if( bFound )
1894 m_aOuterValue <<= nGeometry;
1896 return m_aOuterValue;
1899 Any WrappedSolidTypeProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
1900 throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1902 return uno::makeAny( ::com::sun::star::chart::ChartSolidType::RECTANGULAR_SOLID );
1905 class WrappedAutomaticSizeProperty : public WrappedProperty
1907 public:
1908 WrappedAutomaticSizeProperty();
1909 virtual ~WrappedAutomaticSizeProperty();
1911 virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
1912 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) SAL_OVERRIDE;
1914 virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
1915 throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
1917 virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
1918 throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
1921 WrappedAutomaticSizeProperty::WrappedAutomaticSizeProperty()
1922 : WrappedProperty( "AutomaticSize", OUString() )
1926 WrappedAutomaticSizeProperty::~WrappedAutomaticSizeProperty()
1930 void WrappedAutomaticSizeProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
1931 throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
1933 if( xInnerPropertySet.is() )
1935 bool bNewValue = true;
1936 if( ! (rOuterValue >>= bNewValue) )
1937 throw lang::IllegalArgumentException( "Property AutomaticSize requires value of type boolean", 0, 0 );
1941 if( bNewValue )
1943 Any aRelativeSize( xInnerPropertySet->getPropertyValue( "RelativeSize" ) );
1944 if( aRelativeSize.hasValue() )
1945 xInnerPropertySet->setPropertyValue( "RelativeSize", Any() );
1948 catch( const uno::Exception & ex )
1950 ASSERT_EXCEPTION( ex );
1955 Any WrappedAutomaticSizeProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
1956 throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1958 Any aRet( getPropertyDefault( Reference< beans::XPropertyState >( xInnerPropertySet, uno::UNO_QUERY ) ) );
1959 if( xInnerPropertySet.is() )
1961 Any aRelativeSize( xInnerPropertySet->getPropertyValue( "RelativeSize" ) );
1962 if( !aRelativeSize.hasValue() )
1963 aRet <<= true;
1965 return aRet;
1968 Any WrappedAutomaticSizeProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
1969 throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1971 Any aRet;
1972 aRet <<= false;
1973 return aRet;
1976 //PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS
1977 class WrappedIncludeHiddenCellsProperty : public WrappedProperty
1979 public:
1980 WrappedIncludeHiddenCellsProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
1981 virtual ~WrappedIncludeHiddenCellsProperty();
1983 virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
1984 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) SAL_OVERRIDE;
1985 virtual Any getPropertyValue(const Reference<beans::XPropertySet>& xInnerPropertySet) const
1986 throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) SAL_OVERRIDE;
1988 private: //member
1989 ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
1992 WrappedIncludeHiddenCellsProperty::WrappedIncludeHiddenCellsProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
1993 : WrappedProperty("IncludeHiddenCells","IncludeHiddenCells")
1994 , m_spChart2ModelContact( spChart2ModelContact )
1998 WrappedIncludeHiddenCellsProperty::~WrappedIncludeHiddenCellsProperty()
2002 void WrappedIncludeHiddenCellsProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
2003 throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
2005 bool bNewValue = false;
2006 if( ! (rOuterValue >>= bNewValue) )
2007 throw lang::IllegalArgumentException( "Property IncludeHiddenCells requires boolean value", 0, 0 );
2009 ChartModelHelper::setIncludeHiddenCells( bNewValue, *m_spChart2ModelContact->getModel() );
2012 Any WrappedIncludeHiddenCellsProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
2013 throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
2015 bool bValue = ChartModelHelper::isIncludeHiddenCells( m_spChart2ModelContact->getChartModel() );
2016 uno::Any aAny;
2017 aAny <<= bValue;
2018 return aAny;
2021 // ____ XDiagramProvider ____
2022 Reference< chart2::XDiagram > SAL_CALL DiagramWrapper::getDiagram()
2023 throw (uno::RuntimeException, std::exception)
2025 return m_spChart2ModelContact->getChart2Diagram();
2028 void SAL_CALL DiagramWrapper::setDiagram(
2029 const Reference< chart2::XDiagram >& /*xDiagram*/ )
2030 throw (uno::RuntimeException, std::exception)
2032 //@todo: remove this method from interface
2033 OSL_FAIL("DiagramWrapper::setDiagram is not implemented, should be removed and not be called" );
2036 Reference< beans::XPropertySet > DiagramWrapper::getInnerPropertySet()
2038 return Reference< beans::XPropertySet >( m_spChart2ModelContact->getChart2Diagram(), uno::UNO_QUERY );
2041 const Sequence< beans::Property >& DiagramWrapper::getPropertySequence()
2043 return *StaticDiagramWrapperPropertyArray::get();
2046 const std::vector< WrappedProperty* > DiagramWrapper::createWrappedProperties()
2048 ::std::vector< ::chart::WrappedProperty* > aWrappedProperties;
2050 WrappedAxisAndGridExistenceProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
2051 WrappedAxisTitleExistenceProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
2052 WrappedAxisLabelExistenceProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
2053 WrappedSceneProperty::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
2054 WrappedIgnoreProperties::addIgnoreFillProperties( aWrappedProperties );
2055 WrappedIgnoreProperties::addIgnoreLineProperties( aWrappedProperties );
2056 WrappedStatisticProperties::addWrappedPropertiesForDiagram( aWrappedProperties, m_spChart2ModelContact );
2057 WrappedSymbolProperties::addWrappedPropertiesForDiagram( aWrappedProperties, m_spChart2ModelContact );
2058 WrappedDataCaptionProperties::addWrappedPropertiesForDiagram( aWrappedProperties, m_spChart2ModelContact );
2059 WrappedSplineProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
2060 WrappedStockProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
2061 WrappedAutomaticPositionProperties::addWrappedProperties( aWrappedProperties );
2062 WrappedGL3DProperties::addWrappedProperties(aWrappedProperties, m_spChart2ModelContact);
2064 aWrappedProperties.push_back( new WrappedDataRowSourceProperty( m_spChart2ModelContact ) );
2065 aWrappedProperties.push_back( new WrappedStackingProperty( StackMode_Y_STACKED,m_spChart2ModelContact ) );
2066 aWrappedProperties.push_back( new WrappedStackingProperty( StackMode_Y_STACKED_PERCENT, m_spChart2ModelContact ) );
2067 aWrappedProperties.push_back( new WrappedStackingProperty( StackMode_Z_STACKED, m_spChart2ModelContact ) );
2068 aWrappedProperties.push_back( new WrappedDim3DProperty( m_spChart2ModelContact ) );
2069 aWrappedProperties.push_back( new WrappedVerticalProperty( m_spChart2ModelContact ) );
2070 aWrappedProperties.push_back( new WrappedNumberOfLinesProperty( m_spChart2ModelContact ) );
2071 aWrappedProperties.push_back( new WrappedAttributedDataPointsProperty( m_spChart2ModelContact ) );
2072 aWrappedProperties.push_back( new WrappedProperty( "StackedBarsConnected", "ConnectBars" ) );
2073 aWrappedProperties.push_back( new WrappedSolidTypeProperty( m_spChart2ModelContact ) );
2074 aWrappedProperties.push_back( new WrappedAutomaticSizeProperty() );
2075 aWrappedProperties.push_back( new WrappedIncludeHiddenCellsProperty( m_spChart2ModelContact ) );
2077 return aWrappedProperties;
2080 uno::Sequence< OUString > DiagramWrapper::getSupportedServiceNames_Static()
2082 uno::Sequence< OUString > aServices( 8 );
2083 aServices[ 0 ] = "com.sun.star.chart.Diagram";
2084 aServices[ 1 ] = "com.sun.star.xml.UserDefinedAttributesSupplier";
2085 aServices[ 2 ] = "com.sun.star.chart.StackableDiagram";
2086 aServices[ 3 ] = "com.sun.star.chart.ChartAxisXSupplier";
2087 aServices[ 4 ] = "com.sun.star.chart.ChartAxisYSupplier";
2088 aServices[ 5 ] = "com.sun.star.chart.ChartAxisZSupplier";
2089 aServices[ 6 ] = "com.sun.star.chart.ChartTwoAxisXSupplier";
2090 aServices[ 7 ] = "com.sun.star.chart.ChartTwoAxisYSupplier";
2092 return aServices;
2095 // implement XServiceInfo methods basing upon getSupportedServiceNames_Static
2096 OUString SAL_CALL DiagramWrapper::getImplementationName()
2097 throw( css::uno::RuntimeException, std::exception )
2099 return getImplementationName_Static();
2102 OUString DiagramWrapper::getImplementationName_Static()
2104 return OUString(lcl_aServiceName);
2107 sal_Bool SAL_CALL DiagramWrapper::supportsService( const OUString& rServiceName )
2108 throw( css::uno::RuntimeException, std::exception )
2110 return cppu::supportsService(this, rServiceName);
2113 css::uno::Sequence< OUString > SAL_CALL DiagramWrapper::getSupportedServiceNames()
2114 throw( css::uno::RuntimeException, std::exception )
2116 return getSupportedServiceNames_Static();
2119 } // namespace wrapper
2120 } // namespace chart
2122 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */