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