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