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