LibreOffice Module chart2 (master) 1
Diagram.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 <Diagram.hxx>
21#include <AxisHelper.hxx>
22#include <BaseGFXHelper.hxx>
23#include <ChartTypeHelper.hxx>
24#include <ChartTypeManager.hxx>
25#include <ChartTypeTemplate.hxx>
26#include <ChartType.hxx>
27#include <DataSeriesHelper.hxx>
28#include <PropertyHelper.hxx>
31#include "Wall.hxx"
34#include <ConfigColorScheme.hxx>
35#include <DiagramHelper.hxx>
36#include <ThreeDHelper.hxx>
37#include <CloneHelper.hxx>
38#include <SceneProperties.hxx>
39#include <unonames.hxx>
41#include <Legend.hxx>
42#include <Axis.hxx>
43#include <DataTable.hxx>
45#include <defines.hxx>
46
48#include <com/sun/star/beans/PropertyAttribute.hpp>
49#include <com/sun/star/chart2/AxisType.hpp>
50#include <com/sun/star/chart2/DataPointGeometry3D.hpp>
51#include <com/sun/star/chart2/StackingDirection.hpp>
52#include <com/sun/star/chart2/RelativePosition.hpp>
53#include <com/sun/star/chart2/RelativeSize.hpp>
54#include <com/sun/star/chart/MissingValueTreatment.hpp>
55#include <com/sun/star/container/NoSuchElementException.hpp>
56#include <com/sun/star/drawing/ShadeMode.hpp>
57#include <com/sun/star/uno/XComponentContext.hpp>
58#include <com/sun/star/util/CloseVetoException.hpp>
59
62#include <editeng/unoprnms.hxx>
63#include <o3tl/safeint.hxx>
64#include <rtl/math.hxx>
65#include <tools/helpers.hxx>
66
67#include <algorithm>
68#include <utility>
69
70using namespace ::com::sun::star;
71using namespace ::com::sun::star::beans::PropertyAttribute;
72using namespace ::chart::SceneProperties;
73
74using ::com::sun::star::beans::Property;
75using ::com::sun::star::uno::Sequence;
76using ::com::sun::star::uno::Reference;
77using ::com::sun::star::uno::Any;
78using ::osl::MutexGuard;
79
80namespace
81{
82
83enum
84{
85 PROP_DIAGRAM_REL_POS,
86 PROP_DIAGRAM_REL_SIZE,
87 PROP_DIAGRAM_POSSIZE_EXCLUDE_LABELS,
88 PROP_DIAGRAM_SORT_BY_X_VALUES,
89 PROP_DIAGRAM_CONNECT_BARS,
90 PROP_DIAGRAM_GROUP_BARS_PER_AXIS,
91 PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS,
92 PROP_DIAGRAM_STARTING_ANGLE,
93 PROP_DIAGRAM_RIGHT_ANGLED_AXES,
94 PROP_DIAGRAM_PERSPECTIVE,
95 PROP_DIAGRAM_ROTATION_HORIZONTAL,
96 PROP_DIAGRAM_ROTATION_VERTICAL,
97 PROP_DIAGRAM_MISSING_VALUE_TREATMENT,
98 PROP_DIAGRAM_3DRELATIVEHEIGHT,
99 PROP_DIAGRAM_DATATABLEHBORDER,
100 PROP_DIAGRAM_DATATABLEVBORDER,
101 PROP_DIAGRAM_DATATABLEOUTLINE,
102 PROP_DIAGRAM_EXTERNALDATA
103};
104
105void lcl_AddPropertiesToVector(
106 std::vector< Property > & rOutProperties )
107{
108 rOutProperties.emplace_back( "RelativePosition",
109 PROP_DIAGRAM_REL_POS,
111 beans::PropertyAttribute::BOUND
112 | beans::PropertyAttribute::MAYBEVOID );
113
114 rOutProperties.emplace_back( "RelativeSize",
115 PROP_DIAGRAM_REL_SIZE,
117 beans::PropertyAttribute::BOUND
118 | beans::PropertyAttribute::MAYBEVOID );
119
120 rOutProperties.emplace_back( "PosSizeExcludeAxes",
121 PROP_DIAGRAM_POSSIZE_EXCLUDE_LABELS,
123 beans::PropertyAttribute::BOUND
124 | beans::PropertyAttribute::MAYBEDEFAULT );
125
126 rOutProperties.emplace_back( CHART_UNONAME_SORT_BY_XVALUES,
127 PROP_DIAGRAM_SORT_BY_X_VALUES,
129 beans::PropertyAttribute::BOUND
130 | beans::PropertyAttribute::MAYBEDEFAULT );
131
132 rOutProperties.emplace_back( "ConnectBars",
133 PROP_DIAGRAM_CONNECT_BARS,
135 beans::PropertyAttribute::BOUND
136 | beans::PropertyAttribute::MAYBEDEFAULT );
137
138 rOutProperties.emplace_back( "GroupBarsPerAxis",
139 PROP_DIAGRAM_GROUP_BARS_PER_AXIS,
141 beans::PropertyAttribute::BOUND
142 | beans::PropertyAttribute::MAYBEDEFAULT );
143
144 rOutProperties.emplace_back( "IncludeHiddenCells",
145 PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS,
147 beans::PropertyAttribute::BOUND
148 | beans::PropertyAttribute::MAYBEDEFAULT );
149
150 rOutProperties.emplace_back( "StartingAngle",
151 PROP_DIAGRAM_STARTING_ANGLE,
153 beans::PropertyAttribute::BOUND
154 | beans::PropertyAttribute::MAYBEDEFAULT );
155
156 rOutProperties.emplace_back( "RightAngledAxes",
157 PROP_DIAGRAM_RIGHT_ANGLED_AXES,
159 beans::PropertyAttribute::BOUND
160 | beans::PropertyAttribute::MAYBEDEFAULT );
161
162 rOutProperties.emplace_back( "Perspective",
163 PROP_DIAGRAM_PERSPECTIVE,
165 beans::PropertyAttribute::MAYBEVOID );
166
167 rOutProperties.emplace_back( "RotationHorizontal",
168 PROP_DIAGRAM_ROTATION_HORIZONTAL,
170 beans::PropertyAttribute::MAYBEVOID );
171
172 rOutProperties.emplace_back( "RotationVertical",
173 PROP_DIAGRAM_ROTATION_VERTICAL,
175 beans::PropertyAttribute::MAYBEVOID );
176
177 rOutProperties.emplace_back( "MissingValueTreatment",
178 PROP_DIAGRAM_MISSING_VALUE_TREATMENT,
180 beans::PropertyAttribute::BOUND
181 | beans::PropertyAttribute::MAYBEVOID );
182 rOutProperties.emplace_back( "3DRelativeHeight",
183 PROP_DIAGRAM_3DRELATIVEHEIGHT,
185 beans::PropertyAttribute::MAYBEVOID );
186 rOutProperties.emplace_back( "ExternalData",
187 PROP_DIAGRAM_EXTERNALDATA,
189 beans::PropertyAttribute::MAYBEVOID );
190}
191
192const ::chart::tPropertyValueMap& StaticDiagramDefaults()
193{
194 static ::chart::tPropertyValueMap aStaticDefaults = []()
195 {
197 ::chart::PropertyHelper::setPropertyValueDefault( aMap, PROP_DIAGRAM_POSSIZE_EXCLUDE_LABELS, true );
198 ::chart::PropertyHelper::setPropertyValueDefault( aMap, PROP_DIAGRAM_SORT_BY_X_VALUES, false );
199 ::chart::PropertyHelper::setPropertyValueDefault( aMap, PROP_DIAGRAM_CONNECT_BARS, false );
200 ::chart::PropertyHelper::setPropertyValueDefault( aMap, PROP_DIAGRAM_GROUP_BARS_PER_AXIS, true );
201 ::chart::PropertyHelper::setPropertyValueDefault( aMap, PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS, true );
202 ::chart::PropertyHelper::setPropertyValueDefault( aMap, PROP_DIAGRAM_RIGHT_ANGLED_AXES, false );
203 ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aMap, PROP_DIAGRAM_STARTING_ANGLE, 90 );
204 ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aMap, PROP_DIAGRAM_3DRELATIVEHEIGHT, 100 );
206 return aMap;
207 }();
208 return aStaticDefaults;
209};
210
211::cppu::OPropertyArrayHelper& StaticDiagramInfoHelper()
212{
213 static ::cppu::OPropertyArrayHelper aPropHelper = []()
214 {
215 std::vector< css::beans::Property > aProperties;
216 lcl_AddPropertiesToVector( aProperties );
219
220 std::sort( aProperties.begin(), aProperties.end(),
222
223 return ::cppu::OPropertyArrayHelper( aProperties.data(), aProperties.size() );
224 }();
225 return aPropHelper;
226};
227
228const uno::Reference< beans::XPropertySetInfo >& StaticDiagramInfo()
229{
230 static const uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
231 ::cppu::OPropertySetHelper::createPropertySetInfo(StaticDiagramInfoHelper() ) );
232 return xPropertySetInfo;
233};
234
235void lcl_CloneCoordinateSystems(
236 const ::chart::Diagram::tCoordinateSystemContainerType & rSource,
238{
239 for( rtl::Reference< ::chart::BaseCoordinateSystem > const & i : rSource )
240 {
241 auto xClone = i->createClone();
242 ::chart::BaseCoordinateSystem* pClone = dynamic_cast<::chart::BaseCoordinateSystem*>(xClone.get());
243 assert(pClone);
244 rDestination.push_back( pClone );
245 }
246}
247
248} // anonymous namespace
249
250namespace chart
251{
252
253Diagram::Diagram( uno::Reference< uno::XComponentContext > xContext ) :
254 m_xContext(std::move( xContext )),
255 m_xModifyEventForwarder( new ModifyEventForwarder() )
256{
257 // Set camera position to a default position (that should be set hard, so
258 // that it will be exported. The property default is a camera looking
259 // straight ono the scene). These defaults have been acquired from the old
260 // chart implementation.
261 setFastPropertyValue_NoBroadcast(
263 ThreeDHelper::getDefaultCameraGeometry()));
264}
265
266Diagram::Diagram( const Diagram & rOther ) :
267 impl::Diagram_Base(rOther),
268 ::property::OPropertySet( rOther ),
269 m_xContext( rOther.m_xContext ),
270 m_xModifyEventForwarder( new ModifyEventForwarder() )
271{
272 lcl_CloneCoordinateSystems( rOther.m_aCoordSystems, m_aCoordSystems );
273 for (auto & xSystem : m_aCoordSystems)
274 xSystem->addModifyListener(m_xModifyEventForwarder);
275
276 if ( rOther.m_xWall )
277 m_xWall = new Wall( *rOther.m_xWall );
278 if ( rOther.m_xFloor )
279 m_xFloor = new Wall( *rOther.m_xFloor );
281 if (rOther.m_xLegend)
282 m_xLegend = new Legend(*rOther.m_xLegend);
283 if (rOther.m_xDataTable)
284 m_xDataTable = new DataTable(*rOther.m_xDataTable);
285
286 if ( m_xWall )
287 m_xWall->addModifyListener( m_xModifyEventForwarder );
288 if ( m_xFloor )
289 m_xFloor->addModifyListener( m_xModifyEventForwarder );
292}
293
295{
296 try
297 {
298 for (auto & xSystem : m_aCoordSystems)
299 xSystem->removeModifyListener(m_xModifyEventForwarder);
300
301 if ( m_xWall )
302 m_xWall->removeModifyListener( m_xModifyEventForwarder );
303 if ( m_xFloor )
304 m_xFloor->removeModifyListener( m_xModifyEventForwarder );
307 }
308 catch( const uno::Exception & )
309 {
310 DBG_UNHANDLED_EXCEPTION("chart2");
311 }
312}
313
314// ____ XDiagram ____
316{
318 bool bAddListener = false;
319 {
320 MutexGuard aGuard( m_aMutex );
321 if( !m_xWall.is() )
322 {
323 m_xWall.set( new Wall() );
324 bAddListener = true;
325 }
326 xRet = m_xWall;
327 }
328 if(bAddListener)
329 xRet->addModifyListener( m_xModifyEventForwarder );
330 return xRet;
331}
332
334{
336 bool bAddListener = false;
337 {
338 MutexGuard aGuard( m_aMutex );
339 if( !m_xFloor.is() )
340 {
341 m_xFloor.set( new Wall() );
342 bAddListener = true;
343 }
344 xRet = m_xFloor;
345 }
346 if(bAddListener)
347 xRet->addModifyListener( m_xModifyEventForwarder );
348 return xRet;
349}
350
352{
353 MutexGuard aGuard( m_aMutex );
354 return m_xLegend;
355}
356
358{
359 MutexGuard aGuard( m_aMutex );
360 return m_xLegend;
361}
362
363void SAL_CALL Diagram::setLegend( const uno::Reference< chart2::XLegend >& xNewLegend )
364{
365 auto pLegend = dynamic_cast<Legend*>(xNewLegend.get());
366 assert(!xNewLegend || pLegend);
368}
369
370void Diagram::setLegend( const rtl::Reference< Legend >& xNewLegend )
371{
372 rtl::Reference< Legend > xOldLegend;
373 {
374 MutexGuard aGuard( m_aMutex );
375 if( m_xLegend == xNewLegend )
376 return;
377 xOldLegend = m_xLegend;
378 m_xLegend = xNewLegend;
379 }
380 if( xOldLegend.is())
382 if( xNewLegend.is())
385}
386
388{
390 {
391 MutexGuard aGuard( m_aMutex );
392 xRet = m_xColorScheme;
393 }
394
395 if( !xRet.is())
396 {
398 MutexGuard aGuard( m_aMutex );
399 m_xColorScheme = xRet;
400 }
401 return xRet;
402}
403
405{
406 {
407 MutexGuard aGuard( m_aMutex );
408 m_xColorScheme.set( xColorScheme );
409 }
411}
412
415 const Sequence< beans::PropertyValue >& aArguments )
416{
417 rtl::Reference< ::chart::ChartTypeManager > xChartTypeManager = new ::chart::ChartTypeManager( m_xContext );
418 Diagram::tTemplateWithServiceName aTemplateAndService = getTemplate( xChartTypeManager );
420 if( !xTemplate.is() )
421 xTemplate = xChartTypeManager->createTemplate( "com.sun.star.chart2.template.Column" );
422 if(!xTemplate.is())
423 return;
424 xTemplate->changeDiagramData( rtl::Reference< ::chart::Diagram >(this), xDataSource, aArguments );
425}
426
427// ____ XTitled ____
429{
430 MutexGuard aGuard( m_aMutex );
431 return m_xTitle;
432}
433
435{
437 {
438 MutexGuard aGuard( m_aMutex );
439 if( m_xTitle == xNewTitle )
440 return;
441 xOldTitle = m_xTitle;
442 m_xTitle = xNewTitle;
443 }
444 if( xOldTitle.is())
446 if( xNewTitle.is())
449}
450
451// ____ X3DDefaultSetter ____
453{
454 setPropertyToDefault( "D3DSceneDistance");
455 setPropertyToDefault( "D3DSceneFocalLength");
458}
459
461{
462 bool bPieOrDonut( isPieOrDonutChart() );
463 setDefaultRotation( bPieOrDonut );
464}
465
466static ::basegfx::B3DHomMatrix lcl_getCompleteRotationMatrix( Diagram& rDiagram )
467{
468 ::basegfx::B3DHomMatrix aCompleteRotation;
469 double fXAngleRad=0.0;
470 double fYAngleRad=0.0;
471 double fZAngleRad=0.0;
472 rDiagram.getRotationAngle( fXAngleRad, fYAngleRad, fZAngleRad );
473 aCompleteRotation.rotate( fXAngleRad, fYAngleRad, fZAngleRad );
474 return aCompleteRotation;
475}
476static void lcl_RotateLightSource( Diagram& rDiagram
477 , int nLightSourceDirectionProp
478 , int nLightSourceOnProp
479 , const ::basegfx::B3DHomMatrix& rRotationMatrix )
480{
481 bool bLightOn = false;
482 if( !(rDiagram.getFastPropertyValue( nLightSourceOnProp ) >>= bLightOn) )
483 return;
484
485 if( bLightOn )
486 {
487 drawing::Direction3D aLight;
488 if( rDiagram.getFastPropertyValue( nLightSourceDirectionProp ) >>= aLight )
489 {
491 aLightVector = rRotationMatrix*aLightVector;
492
493 rDiagram.setFastPropertyValue( nLightSourceDirectionProp
494 , uno::Any( BaseGFXHelper::B3DVectorToDirection3D( aLightVector ) ) );
495 }
496 }
497}
498
499static void lcl_setLightsForScheme( Diagram& rDiagram, const ThreeDLookScheme& rScheme )
500{
502 return;
503
504 // "D3DSceneLightOn2" / UNO_NAME_3D_SCENE_LIGHTON_2
506
507 rtl::Reference< ChartType > xChartType( rDiagram.getChartTypeByIndex( 0 ) );
511
512 // "D3DSceneLightDirection2" / UNO_NAME_3D_SCENE_LIGHTDIRECTION_2
513 rDiagram.setFastPropertyValue( PROP_SCENE_LIGHT_DIRECTION_2, aADirection );
514 //rotate light direction when right angled axes are off but supported
515 {
516 bool bRightAngledAxes = false;
517 rDiagram.getFastPropertyValue( PROP_DIAGRAM_RIGHT_ANGLED_AXES ) >>= bRightAngledAxes; // "RightAngledAxes"
518 if(!bRightAngledAxes)
519 {
521 {
524 // "D3DSceneLightDirection2", "D3DSceneLightOn2"
526 }
527 }
528 }
529
531 rScheme == ThreeDLookScheme::ThreeDLookScheme_Simple, xChartType);
532 // "D3DSceneLightColor2" / UNO_NAME_3D_SCENE_LIGHTCOLOR_2
534
536 rScheme == ThreeDLookScheme::ThreeDLookScheme_Simple, xChartType);
537 // "D3DSceneAmbientColor" / UNO_NAME_3D_SCENE_AMBIENTCOLOR
538 rDiagram.setFastPropertyValue( PROP_SCENE_AMBIENT_COLOR, uno::Any( nAmbientColor ) );
539}
540
542{
543 drawing::ShadeMode aShadeMode( drawing::ShadeMode_SMOOTH );
544 try
545 {
546 // "D3DSceneShadeMode"
548 // "D3DSceneLightOn1" / UNO_NAME_3D_SCENE_LIGHTON_1
556 }
557 catch( const uno::Exception & )
558 {
559 DBG_UNHANDLED_EXCEPTION("chart2");
560 }
561
562 ThreeDLookScheme aScheme = (aShadeMode == drawing::ShadeMode_FLAT)
565 lcl_setLightsForScheme( *this, aScheme );
566}
567
568// ____ XCoordinateSystemContainer ____
571{
572 ::chart::BaseCoordinateSystem* pCoordSys = dynamic_cast<::chart::BaseCoordinateSystem*>(aCoordSys.get());
573 assert(pCoordSys);
574 {
575 MutexGuard aGuard( m_aMutex );
576 if( std::find( m_aCoordSystems.begin(), m_aCoordSystems.end(), pCoordSys )
577 != m_aCoordSystems.end())
578 throw lang::IllegalArgumentException("coordsys not found", static_cast<cppu::OWeakObject*>(this), 1);
579
580 if( !m_aCoordSystems.empty() )
581 {
582 OSL_FAIL( "more than one coordinatesystem is not supported yet by the fileformat" );
583 return;
584 }
585 m_aCoordSystems.push_back( pCoordSys );
586 }
589}
590
593{
594 ::chart::BaseCoordinateSystem* pCoordSys = dynamic_cast<::chart::BaseCoordinateSystem*>(aCoordSys.get());
595 assert(pCoordSys);
596 {
597 MutexGuard aGuard( m_aMutex );
598 auto aIt = std::find( m_aCoordSystems.begin(), m_aCoordSystems.end(), pCoordSys );
599 if( aIt == m_aCoordSystems.end())
600 throw container::NoSuchElementException(
601 "The given coordinate-system is no element of the container",
602 static_cast< uno::XWeak * >( this ));
603 m_aCoordSystems.erase( aIt );
604 }
607}
608
610{
611 MutexGuard aGuard( m_aMutex );
612 return comphelper::containerToSequence<uno::Reference< chart2::XCoordinateSystem >>( m_aCoordSystems );
613}
614
616{
617 MutexGuard aGuard( m_aMutex );
618 return m_aCoordSystems;
619}
620
622 const Sequence< Reference< chart2::XCoordinateSystem > >& aCoordinateSystems )
623{
626 if( aCoordinateSystems.hasElements() )
627 {
628 OSL_ENSURE( aCoordinateSystems.getLength()<=1, "more than one coordinatesystem is not supported yet by the fileformat" );
629 ::chart::BaseCoordinateSystem* pCoordSys = dynamic_cast<::chart::BaseCoordinateSystem*>(aCoordinateSystems[0].get());
630 assert(pCoordSys);
631 aNew.push_back( pCoordSys );
632 }
633 {
634 MutexGuard aGuard( m_aMutex );
635 std::swap( aOld, m_aCoordSystems );
636 m_aCoordSystems = aNew;
637 }
638 for (auto & xSystem : aOld)
639 xSystem->removeModifyListener(m_xModifyEventForwarder);
640 for (auto & xSystem : aNew)
641 xSystem->addModifyListener(m_xModifyEventForwarder);
643}
644
646 const std::vector< rtl::Reference< BaseCoordinateSystem > >& aCoordinateSystems )
647{
650 if( !aCoordinateSystems.empty() )
651 {
652 OSL_ENSURE( aCoordinateSystems.size()<=1, "more than one coordinatesystem is not supported yet by the fileformat" );
653 aNew.push_back( aCoordinateSystems[0] );
654 }
655 {
656 MutexGuard aGuard( m_aMutex );
657 std::swap( aOld, m_aCoordSystems );
658 m_aCoordSystems = aNew;
659 }
660 for (auto & xSystem : aOld)
661 xSystem->removeModifyListener(m_xModifyEventForwarder);
662 for (auto & xSystem : aNew)
663 xSystem->addModifyListener(m_xModifyEventForwarder);
665}
666
667// ____ XCloneable ____
669{
670 MutexGuard aGuard( m_aMutex );
671 return Reference< util::XCloneable >( new Diagram( *this ));
672}
673
674// ____ XModifyBroadcaster ____
676{
677 m_xModifyEventForwarder->addModifyListener( aListener );
678}
679
681{
682 m_xModifyEventForwarder->removeModifyListener( aListener );
683}
684
685// ____ XModifyListener ____
686void SAL_CALL Diagram::modified( const lang::EventObject& aEvent )
687{
688 m_xModifyEventForwarder->modified( aEvent );
689}
690
691// ____ XEventListener (base of XModifyListener) ____
692void SAL_CALL Diagram::disposing( const lang::EventObject& /* Source */ )
693{
694 // nothing
695}
696
697// ____ OPropertySet ____
699{
701}
702
704{
705 m_xModifyEventForwarder->modified( lang::EventObject( static_cast< uno::XWeak* >( this )));
706}
707
708// ____ OPropertySet ____
709void Diagram::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) const
710{
711 const tPropertyValueMap& rStaticDefaults = StaticDiagramDefaults();
712 tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
713 if( aFound == rStaticDefaults.end() )
714 rAny.clear();
715 else
716 rAny = (*aFound).second;
717}
718
719// ____ OPropertySet ____
721{
722 return StaticDiagramInfoHelper();
723}
724
725// ____ XPropertySet ____
727{
728 return StaticDiagramInfo();
729}
730
731// ____ XFastPropertySet ____
732void SAL_CALL Diagram::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue )
733{
734 //special treatment for some 3D properties
735 if( nHandle == PROP_DIAGRAM_PERSPECTIVE )
736 {
737 sal_Int32 fPerspective = 20;
738 if( rValue >>=fPerspective )
740 }
741 else if( nHandle == PROP_DIAGRAM_ROTATION_HORIZONTAL
742 || nHandle == PROP_DIAGRAM_ROTATION_VERTICAL )
743 {
744 sal_Int32 nNewAngleDegree = 0;
745 if( rValue >>=nNewAngleDegree )
746 {
747 sal_Int32 nHorizontal, nVertical;
749 if( nHandle == PROP_DIAGRAM_ROTATION_HORIZONTAL )
750 nHorizontal = nNewAngleDegree;
751 else
752 nVertical = nNewAngleDegree;
754 }
755 }
756 else
757 ::property::OPropertySet::setFastPropertyValue_NoBroadcast( nHandle, rValue );
758}
759
760void SAL_CALL Diagram::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const
761{
762 //special treatment for some 3D properties
763 if( nHandle == PROP_DIAGRAM_PERSPECTIVE )
764 {
765 sal_Int32 nPerspective = ::basegfx::fround( ThreeDHelper::CameraDistanceToPerspective(
766 const_cast< Diagram* >( this )->getCameraDistance() ) );
767 rValue <<= nPerspective;
768 }
769 else if( nHandle == PROP_DIAGRAM_ROTATION_HORIZONTAL
770 || nHandle == PROP_DIAGRAM_ROTATION_VERTICAL )
771 {
772 sal_Int32 nHorizontal, nVertical;
773 const_cast< Diagram* >( this )->getRotation( nHorizontal, nVertical );
774 sal_Int32 nAngleDegree = 0;
775 if( nHandle == PROP_DIAGRAM_ROTATION_HORIZONTAL )
776 nAngleDegree = nHorizontal;
777 else
778 nAngleDegree = nVertical;
779 rValue <<= nAngleDegree;
780 }
781 else
782 ::property::OPropertySet::getFastPropertyValue( rValue,nHandle );
783}
784
786{
787 MutexGuard aGuard( m_aMutex );
788 return m_xDataTable;
789}
790
792{
793 MutexGuard aGuard( m_aMutex );
794 return m_xDataTable;
795}
796
797void SAL_CALL Diagram::setDataTable(const uno::Reference<chart2::XDataTable>& xDataTable)
798{
799 auto* pDataTable = dynamic_cast<DataTable*>(xDataTable.get());
800 assert(!xDataTable || pDataTable);
802}
803
804void Diagram::setDataTable(const rtl::Reference<DataTable>& xNewDataTable)
805{
806 rtl::Reference<DataTable> xOldDataTable;
807 {
808 MutexGuard aGuard(m_aMutex);
809 if (m_xDataTable == xNewDataTable)
810 return;
811 xOldDataTable = m_xDataTable;
812 m_xDataTable = xNewDataTable;
813 }
814 if (xOldDataTable.is())
816 if (xNewDataTable.is())
819}
820
822
825
826// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
827OUString SAL_CALL Diagram::getImplementationName()
828{
829 return "com.sun.star.comp.chart2.Diagram";
830}
831
832sal_Bool SAL_CALL Diagram::supportsService( const OUString& rServiceName )
833{
834 return cppu::supportsService(this, rServiceName);
835}
836
837css::uno::Sequence< OUString > SAL_CALL Diagram::getSupportedServiceNames()
838{
839 return {
840 "com.sun.star.chart2.Diagram",
841 "com.sun.star.layout.LayoutElement",
842 "com.sun.star.beans.PropertySet" };
843}
844
846{
848 chart2::RelativePosition aRelPos;
849 chart2::RelativeSize aRelSize;
850 if( (getFastPropertyValue(PROP_DIAGRAM_REL_POS) >>= aRelPos ) &&
851 (getFastPropertyValue(PROP_DIAGRAM_REL_SIZE) >>= aRelSize ) )
852 {
853 bool bPosSizeExcludeAxes=false;
854 getFastPropertyValue(PROP_DIAGRAM_POSSIZE_EXCLUDE_LABELS) >>= bPosSizeExcludeAxes;
855 if( bPosSizeExcludeAxes )
857 else
859 }
860 return eMode;
861}
862
863
865 const rtl::Reference< ChartType >& xChartType )
866{
867 sal_Int32 nResult = css::chart::MissingValueTreatment::LEAVE_GAP;
868 const uno::Sequence < sal_Int32 > aAvailableMissingValueTreatments(
870
871 if( getFastPropertyValue( PROP_DIAGRAM_MISSING_VALUE_TREATMENT ) >>= nResult )
872 {
873 //ensure that the set value is supported by this charttype
874 for( sal_Int32 n : aAvailableMissingValueTreatments )
875 if( n == nResult )
876 return nResult; //ok
877 }
878
879 //otherwise use the first supported one
880 if( aAvailableMissingValueTreatments.hasElements() )
881 {
882 nResult = aAvailableMissingValueTreatments[0];
883 return nResult;
884 }
885
886 return nResult;
887}
888
889void Diagram::setGeometry3D( sal_Int32 nNewGeometry )
890{
891 std::vector< rtl::Reference< DataSeries > > aSeriesVec =
893
894 for (auto const& series : aSeriesVec)
895 {
897 series, "Geometry3D", uno::Any( nNewGeometry ));
898 }
899}
900
901sal_Int32 Diagram::getGeometry3D( bool& rbFound, bool& rbAmbiguous )
902{
903 sal_Int32 nCommonGeom( css::chart2::DataPointGeometry3D::CUBOID );
904 rbFound = false;
905 rbAmbiguous = false;
906
907 std::vector< rtl::Reference< DataSeries > > aSeriesVec = getDataSeries();
908
909 if( aSeriesVec.empty())
910 rbAmbiguous = true;
911
912 for (auto const& series : aSeriesVec)
913 {
914 try
915 {
916 sal_Int32 nGeom = 0;
917 if( series->getPropertyValue( "Geometry3D") >>= nGeom )
918 {
919 if( ! rbFound )
920 {
921 // first series
922 nCommonGeom = nGeom;
923 rbFound = true;
924 }
925 // further series: compare for uniqueness
926 else if( nCommonGeom != nGeom )
927 {
928 rbAmbiguous = true;
929 break;
930 }
931 }
932 }
933 catch( const uno::Exception & )
934 {
935 DBG_UNHANDLED_EXCEPTION("chart2");
936 }
937 }
938
939 return nCommonGeom;
940}
941
943{
945
946 if( xChartType .is() )
947 {
948 OUString aChartType = xChartType->getChartType();
949 if( aChartType == CHART2_SERVICE_NAME_CHARTTYPE_PIE )
950 return true;
951 }
952 return false;
953}
954
956{
957 //pies and donuts currently do not support this because of wrong files from older versions
958 //todo: allow this in future again, if fileversion is available for OLE objects (metastream)
959 //thus the wrong bottom can be removed on import
960
961 const std::vector< rtl::Reference< ChartType > > aTypes = getChartTypes();
962 for( rtl::Reference< ChartType > const & xType : aTypes )
963 {
964 OUString sChartType = xType->getChartType();
965 if( sChartType.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE) )
966 return false;
967 if( sChartType.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) )
968 return false;
969 if( sChartType.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) )
970 return false;
971 }
972 return true;
973}
974
1005 Diagram& rDiagram,
1006 const rtl::Reference< DataSeries >& xGivenDataSeries,
1007 bool bForward,
1008 bool bDoMove )
1009{
1010 bool bMovedOrMoveAllowed = false;
1011
1012 try
1013 {
1014 if( !xGivenDataSeries.is() )
1015 return false;
1016
1017 //find position of series.
1018 bool bFound = false;
1019 const std::vector< rtl::Reference< BaseCoordinateSystem > > & aCooSysList( rDiagram.getBaseCoordinateSystems() );
1020
1021 for( std::size_t nCS = 0; !bFound && nCS < aCooSysList.size(); ++nCS )
1022 {
1023 const rtl::Reference< BaseCoordinateSystem > & xCooSys( aCooSysList[nCS] );
1024
1025 //iterate through all chart types in the current coordinate system
1026 std::vector< rtl::Reference< ChartType > > aChartTypeList( xCooSys->getChartTypes2() );
1027 rtl::Reference< ChartType > xFormerChartType;
1028
1029 for( std::size_t nT = 0; !bFound && nT < aChartTypeList.size(); ++nT )
1030 {
1031 rtl::Reference< ChartType > xCurrentChartType( aChartTypeList[nT] );
1032
1033 //iterate through all series in this chart type
1034
1035 std::vector< rtl::Reference< DataSeries > > aSeriesList = xCurrentChartType->getDataSeries2();
1036
1037 for( std::size_t nS = 0; !bFound && nS < aSeriesList.size(); ++nS )
1038 {
1039
1040 // We found the series we are interested in!
1041 if( xGivenDataSeries==aSeriesList[nS] )
1042 {
1043 std::size_t nOldSeriesIndex = nS;
1044 bFound = true;
1045
1046 try
1047 {
1048 sal_Int32 nNewSeriesIndex = nS;
1049
1050 // tdf#34517 Bringing forward means increasing, backwards means decreasing series position
1051 if( !bForward )
1052 nNewSeriesIndex--;
1053 else
1054 nNewSeriesIndex++;
1055
1056 if( nNewSeriesIndex >= 0 && o3tl::make_unsigned(nNewSeriesIndex) < aSeriesList.size() )
1057 {
1058 //move series in the same charttype
1059 bMovedOrMoveAllowed = true;
1060 if( bDoMove )
1061 {
1062 aSeriesList[ nOldSeriesIndex ] = aSeriesList[ nNewSeriesIndex ];
1063 aSeriesList[ nNewSeriesIndex ] = xGivenDataSeries;
1064 xCurrentChartType->setDataSeries( aSeriesList );
1065 }
1066 }
1067 else if( nNewSeriesIndex<0 )
1068 {
1069 //exchange series with former charttype
1070 if( xFormerChartType.is() && DiagramHelper::areChartTypesCompatible( xFormerChartType, xCurrentChartType ) )
1071 {
1072 bMovedOrMoveAllowed = true;
1073 if( bDoMove )
1074 {
1075 std::vector< rtl::Reference< DataSeries > > aOtherSeriesList = xFormerChartType->getDataSeries2();
1076 sal_Int32 nOtherSeriesIndex = aOtherSeriesList.size()-1;
1077 if( nOtherSeriesIndex >= 0 && o3tl::make_unsigned(nOtherSeriesIndex) < aOtherSeriesList.size() )
1078 {
1079 rtl::Reference< DataSeries > xExchangeSeries( aOtherSeriesList[nOtherSeriesIndex] );
1080 aOtherSeriesList[nOtherSeriesIndex] = xGivenDataSeries;
1081 xFormerChartType->setDataSeries(aOtherSeriesList);
1082
1083 aSeriesList[nOldSeriesIndex]=xExchangeSeries;
1084 xCurrentChartType->setDataSeries(aSeriesList);
1085 }
1086 }
1087 }
1088 }
1089 else if( nT+1 < aChartTypeList.size() )
1090 {
1091 //exchange series with next charttype
1092 rtl::Reference< ChartType > xOtherChartType( aChartTypeList[nT+1] );
1093 if( xOtherChartType.is() && DiagramHelper::areChartTypesCompatible( xOtherChartType, xCurrentChartType ) )
1094 {
1095 bMovedOrMoveAllowed = true;
1096 if( bDoMove )
1097 {
1098 std::vector< rtl::Reference< DataSeries > > aOtherSeriesList = xOtherChartType->getDataSeries2();
1099 if( !aOtherSeriesList.empty() )
1100 {
1101 rtl::Reference< DataSeries > xExchangeSeries( aOtherSeriesList[0] );
1102 aOtherSeriesList[0] = xGivenDataSeries;
1103 xOtherChartType->setDataSeries(aOtherSeriesList);
1104
1105 aSeriesList[nOldSeriesIndex]=xExchangeSeries;
1106 xCurrentChartType->setDataSeries(aSeriesList);
1107 }
1108 }
1109 }
1110 }
1111 }
1112 catch( const util::CloseVetoException& )
1113 {
1114 }
1115 catch( const uno::RuntimeException& )
1116 {
1117 }
1118 }
1119 }
1120 xFormerChartType = xCurrentChartType;
1121 }
1122 }
1123 }
1124 catch( const util::CloseVetoException& )
1125 {
1126 }
1127 catch( const uno::RuntimeException& )
1128 {
1129 }
1130 return bMovedOrMoveAllowed;
1131}
1132
1134 const rtl::Reference< DataSeries >& xGivenDataSeries,
1135 bool bForward )
1136{
1137 const bool bDoMove = false;
1138
1139 bool bIsMoveable = lcl_moveSeriesOrCheckIfMoveIsAllowed(
1140 *this, xGivenDataSeries, bForward, bDoMove );
1141
1142 return bIsMoveable;
1143}
1144
1145bool Diagram::moveSeries( const rtl::Reference< DataSeries >& xGivenDataSeries, bool bForward )
1146{
1147 const bool bDoMove = true;
1148
1150 *this, xGivenDataSeries, bForward, bDoMove );
1151
1152 return bMoved;
1153}
1154
1155std::vector< rtl::Reference< ChartType > > Diagram::getChartTypes()
1156{
1157 std::vector< rtl::Reference< ChartType > > aResult;
1158 try
1159 {
1161 {
1162 const std::vector< rtl::Reference< ChartType > > & aChartTypeSeq( coords->getChartTypes2());
1163 aResult.insert( aResult.end(), aChartTypeSeq.begin(), aChartTypeSeq.end() );
1164 }
1165 }
1166 catch( const uno::Exception & )
1167 {
1168 DBG_UNHANDLED_EXCEPTION("chart2");
1169 }
1170
1171 return aResult;
1172}
1173
1175{
1176 rtl::Reference< ChartType > xChartType;
1177
1178 //iterate through all coordinate systems
1179 sal_Int32 nTypesSoFar = 0;
1181 {
1182 const std::vector< rtl::Reference< ChartType > > & aChartTypeList( coords->getChartTypes2() );
1183 if( nIndex >= 0 && o3tl::make_unsigned(nIndex) < nTypesSoFar + aChartTypeList.size() )
1184 {
1185 xChartType = aChartTypeList[nIndex - nTypesSoFar];
1186 break;
1187 }
1188 nTypesSoFar += aChartTypeList.size();
1189 }
1190
1191 return xChartType;
1192}
1193
1195{
1196 return ::chart::ChartTypeHelper::isSupportingDateAxis( getChartTypeByIndex( 0 ), 0 );
1197}
1198
1199static std::vector< rtl::Reference< Axis > > lcl_getAxisHoldingCategoriesFromDiagram(
1200 Diagram& rDiagram )
1201{
1202 std::vector< rtl::Reference< Axis > > aRet;
1203
1204 // return first x-axis as fall-back
1205 rtl::Reference< Axis > xFallBack;
1206 try
1207 {
1208 for( rtl::Reference< BaseCoordinateSystem > const & xCooSys : rDiagram.getBaseCoordinateSystems() )
1209 {
1210 OSL_ASSERT( xCooSys.is());
1211 for( sal_Int32 nN = xCooSys->getDimension(); nN--; )
1212 {
1213 const sal_Int32 nMaximumScaleIndex = xCooSys->getMaximumAxisIndexByDimension(nN);
1214 for(sal_Int32 nI=0; nI<=nMaximumScaleIndex; ++nI)
1215 {
1216 rtl::Reference< Axis > xAxis = xCooSys->getAxisByDimension2( nN,nI );
1217 OSL_ASSERT( xAxis.is());
1218 if( xAxis.is())
1219 {
1220 chart2::ScaleData aScaleData = xAxis->getScaleData();
1221 if( aScaleData.Categories.is() || (aScaleData.AxisType == chart2::AxisType::CATEGORY) )
1222 {
1223 aRet.push_back(xAxis);
1224 }
1225 if( (nN == 0) && !xFallBack.is())
1226 xFallBack = xAxis;
1227 }
1228 }
1229 }
1230 }
1231 }
1232 catch( const uno::Exception & )
1233 {
1234 DBG_UNHANDLED_EXCEPTION("chart2" );
1235 }
1236
1237 if( aRet.empty() )
1238 aRet.push_back(xFallBack);
1239
1240 return aRet;
1241}
1242
1244{
1246
1247 try
1248 {
1249 std::vector< rtl::Reference< Axis > > aCatAxes(
1251 //search for first categories
1252 if (aCatAxes.empty())
1253 return xResult;
1254
1255 rtl::Reference< Axis > xCatAxis(aCatAxes[0]);
1256 if( !xCatAxis.is())
1257 return xResult;
1258
1259 chart2::ScaleData aScaleData( xCatAxis->getScaleData());
1260 if( !aScaleData.Categories.is() )
1261 return xResult;
1262
1263 xResult = aScaleData.Categories;
1264 uno::Reference<beans::XPropertySet> xProp(xResult->getValues(), uno::UNO_QUERY );
1265 if( xProp.is() )
1266 {
1267 try
1268 {
1269 xProp->setPropertyValue( "Role", uno::Any( OUString("categories") ) );
1270 }
1271 catch( const uno::Exception & )
1272 {
1273 DBG_UNHANDLED_EXCEPTION("chart2");
1274 }
1275 }
1276 }
1277 catch( const uno::Exception & )
1278 {
1279 DBG_UNHANDLED_EXCEPTION("chart2");
1280 }
1281
1282 return xResult;
1283}
1284
1287 bool bSetAxisType /* = false */,
1288 bool bCategoryAxis /* = true */ )
1289{
1290 std::vector< rtl::Reference< Axis > > aCatAxes(
1292
1293 for (const rtl::Reference< Axis >& xCatAxis : aCatAxes)
1294 {
1295 if( xCatAxis.is())
1296 {
1297 chart2::ScaleData aScaleData( xCatAxis->getScaleData());
1298 aScaleData.Categories = xCategories;
1299 if( bSetAxisType )
1300 {
1301 if( bCategoryAxis )
1302 aScaleData.AxisType = chart2::AxisType::CATEGORY;
1303 else if( aScaleData.AxisType == chart2::AxisType::CATEGORY || aScaleData.AxisType == chart2::AxisType::DATE )
1304 aScaleData.AxisType = chart2::AxisType::REALNUMBER;
1305 }
1306 xCatAxis->setScaleData( aScaleData );
1307 }
1308 }
1309}
1310
1312{
1313 try
1314 {
1316 {
1317 for( sal_Int32 nN = xCooSys->getDimension(); nN--; )
1318 {
1319 const sal_Int32 nMaximumScaleIndex = xCooSys->getMaximumAxisIndexByDimension(nN);
1320 for(sal_Int32 nI=0; nI<=nMaximumScaleIndex; ++nI)
1321 {
1322 rtl::Reference< Axis > xAxis = xCooSys->getAxisByDimension2( nN,nI );
1323 OSL_ASSERT( xAxis.is());
1324 if( xAxis.is())
1325 {
1326 chart2::ScaleData aScaleData = xAxis->getScaleData();
1327 if( aScaleData.AxisType == chart2::AxisType::CATEGORY || aScaleData.AxisType == chart2::AxisType::DATE )
1328 return true;
1329 }
1330 }
1331 }
1332 }
1333 }
1334 catch( const uno::Exception & )
1335 {
1336 DBG_UNHANDLED_EXCEPTION("chart2");
1337 }
1338
1339 return false;
1340}
1341
1342std::vector< std::vector< rtl::Reference< DataSeries > > >
1344{
1345 std::vector< std::vector< rtl::Reference< DataSeries > > > aResult;
1346
1347 //iterate through all coordinate systems
1349 {
1350 //iterate through all chart types in the current coordinate system
1351 for( rtl::Reference< ChartType > const & chartType : coords->getChartTypes2() )
1352 {
1353 aResult.push_back( chartType->getDataSeries2() );
1354 }
1355 }
1356 return aResult;
1357}
1358
1359std::vector< rtl::Reference< ::chart::DataSeries > >
1361{
1362 std::vector< rtl::Reference< DataSeries > > aResult;
1363 try
1364 {
1366 {
1367 for( rtl::Reference< ChartType> const & chartType : coords->getChartTypes2() )
1368 {
1369 const std::vector< rtl::Reference< DataSeries > > aSeriesSeq( chartType->getDataSeries2() );
1370 aResult.insert( aResult.end(), aSeriesSeq.begin(), aSeriesSeq.end() );
1371 }
1372 }
1373 }
1374 catch( const uno::Exception & )
1375 {
1376 DBG_UNHANDLED_EXCEPTION("chart2");
1377 }
1378
1379 return aResult;
1380}
1381
1383 const rtl::Reference< DataSeries >& xGivenDataSeries )
1384{
1385 if( !xGivenDataSeries.is() )
1386 return nullptr;
1387
1388 //iterate through the model to find the given xSeries
1389 //the found parent indicates the charttype
1390
1391 //iterate through all coordinate systems
1392
1394 {
1395 //iterate through all chart types in the current coordinate system
1396 const std::vector< rtl::Reference< ChartType > > & aChartTypeList( xCooSys->getChartTypes2() );
1397 for( rtl::Reference< ChartType > const & xChartType : aChartTypeList )
1398 {
1399 //iterate through all series in this chart type
1400 for( rtl::Reference< DataSeries > const & dataSeries : xChartType->getDataSeries2() )
1401 {
1402 if( xGivenDataSeries==dataSeries )
1403 return xChartType;
1404 }
1405 }
1406 }
1407 return nullptr;
1408}
1409
1411 const rtl::Reference< DataSeries >& xSeries )
1412{
1414}
1415
1416bool Diagram::attachSeriesToAxis( bool bAttachToMainAxis
1417 , const rtl::Reference< DataSeries >& xDataSeries
1419 , bool bAdaptAxes )
1420{
1421 bool bChanged = false;
1422
1423 //set property at axis
1424
1425 sal_Int32 nNewAxisIndex = bAttachToMainAxis ? 0 : 1;
1426 sal_Int32 nOldAxisIndex = DataSeriesHelper::getAttachedAxisIndex(xDataSeries);
1427 rtl::Reference< Axis > xOldAxis = getAttachedAxis( xDataSeries );
1428
1429 if( nOldAxisIndex != nNewAxisIndex )
1430 {
1431 try
1432 {
1433 xDataSeries->setPropertyValue( "AttachedAxisIndex", uno::Any( nNewAxisIndex ) );
1434 bChanged = true;
1435 }
1436 catch( const uno::Exception & )
1437 {
1438 DBG_UNHANDLED_EXCEPTION("chart2");
1439 }
1440 }
1441
1442 if( bChanged )
1443 {
1444 rtl::Reference< Axis > xAxis = AxisHelper::getAxis( 1, bAttachToMainAxis, this );
1445 if(!xAxis.is()) //create an axis if necessary
1446 xAxis = AxisHelper::createAxis( 1, bAttachToMainAxis, this, xContext );
1447 if( bAdaptAxes )
1448 {
1451 }
1452 }
1453
1454 return bChanged;
1455}
1456
1458 const rtl::Reference< BaseCoordinateSystem > & xCooSysToReplace,
1459 const rtl::Reference< BaseCoordinateSystem > & xReplacement )
1460{
1461 // update the coordinate-system container
1462 try
1463 {
1465
1466 // move chart types of xCooSysToReplace to xReplacement
1467 xReplacement->setChartTypes( xCooSysToReplace->getChartTypes());
1468
1469 removeCoordinateSystem( xCooSysToReplace );
1470 addCoordinateSystem( xReplacement );
1471
1472 if( xCategories.is() )
1473 setCategories( xCategories );
1474 }
1475 catch( const uno::Exception & )
1476 {
1477 DBG_UNHANDLED_EXCEPTION("chart2");
1478 }
1479}
1480
1482{
1483 // -1: not yet set
1484 sal_Int32 nResult = -1;
1485
1486 try
1487 {
1489 {
1490 if(xCooSys.is())
1491 {
1492 nResult = xCooSys->getDimension();
1493 break;
1494 }
1495 }
1496 }
1497 catch( const uno::Exception & )
1498 {
1499 DBG_UNHANDLED_EXCEPTION("chart2");
1500 }
1501
1502 return nResult;
1503}
1504
1505void Diagram::setDimension( sal_Int32 nNewDimensionCount )
1506{
1507 if( getDimension() == nNewDimensionCount )
1508 return;
1509
1510 try
1511 {
1512 bool rbFound = false;
1513 bool rbAmbiguous = true;
1514 StackMode eStackMode = getStackMode( rbFound, rbAmbiguous );
1515 bool bIsSupportingOnlyDeepStackingFor3D=false;
1516
1517 //change all coordinate systems:
1518 auto aCoordSystems = getBaseCoordinateSystems();
1519 for( rtl::Reference<BaseCoordinateSystem> const & xOldCooSys : aCoordSystems )
1520 {
1522
1523 const std::vector< rtl::Reference< ChartType > > aChartTypeList( xOldCooSys->getChartTypes2() );
1524 for( rtl::Reference< ChartType > const & xChartType : aChartTypeList )
1525 {
1526 bIsSupportingOnlyDeepStackingFor3D = ChartTypeHelper::isSupportingOnlyDeepStackingFor3D( xChartType );
1527 if(!xNewCooSys.is())
1528 {
1529 xNewCooSys = dynamic_cast<BaseCoordinateSystem*>(xChartType->createCoordinateSystem( nNewDimensionCount ).get());
1530 assert(xNewCooSys);
1531 break;
1532 }
1533 //@todo make sure that all following charttypes are also capable of the new dimension
1534 //otherwise separate them in a different group
1535 //BM: might be done in replaceCoordinateSystem()
1536 }
1537
1538 // replace the old coordinate system at all places where it was used
1539 replaceCoordinateSystem( xOldCooSys, xNewCooSys );
1540 }
1541
1542 //correct stack mode if necessary
1543 if( nNewDimensionCount==3 && eStackMode != StackMode::ZStacked && bIsSupportingOnlyDeepStackingFor3D )
1545 else if( nNewDimensionCount==2 && eStackMode == StackMode::ZStacked )
1547 }
1548 catch( const uno::Exception & )
1549 {
1550 DBG_UNHANDLED_EXCEPTION("chart2");
1551 }
1552}
1553
1555{
1556 try
1557 {
1558 bool bValueFound = false;
1559 bool bIsAmbiguous = false;
1560 StackMode eOldStackMode = getStackMode( bValueFound, bIsAmbiguous );
1561
1562 if( eStackMode == eOldStackMode && !bIsAmbiguous )
1563 return;
1564
1565 chart2::StackingDirection eNewDirection = chart2::StackingDirection_NO_STACKING;
1566 if( eStackMode == StackMode::YStacked || eStackMode == StackMode::YStackedPercent )
1567 eNewDirection = chart2::StackingDirection_Y_STACKING;
1568 else if( eStackMode == StackMode::ZStacked )
1569 eNewDirection = chart2::StackingDirection_Z_STACKING;
1570
1571 uno::Any aNewDirection( eNewDirection );
1572
1573 bool bPercent = false;
1574 if( eStackMode == StackMode::YStackedPercent )
1575 bPercent = true;
1576
1577 //iterate through all coordinate systems
1579 {
1580 //set correct percent stacking
1581 const sal_Int32 nMaximumScaleIndex = xCooSys->getMaximumAxisIndexByDimension(1);
1582 for(sal_Int32 nI=0; nI<=nMaximumScaleIndex; ++nI)
1583 {
1584 rtl::Reference< Axis > xAxis = xCooSys->getAxisByDimension2( 1,nI );
1585 if( xAxis.is())
1586 {
1587 chart2::ScaleData aScaleData = xAxis->getScaleData();
1588 if( (aScaleData.AxisType==chart2::AxisType::PERCENT) != bPercent )
1589 {
1590 if( bPercent )
1591 aScaleData.AxisType = chart2::AxisType::PERCENT;
1592 else
1593 aScaleData.AxisType = chart2::AxisType::REALNUMBER;
1594 xAxis->setScaleData( aScaleData );
1595 }
1596 }
1597 }
1598 //iterate through all chart types in the current coordinate system
1599 const std::vector< rtl::Reference< ChartType > > & aChartTypeList( xCooSys->getChartTypes2() );
1600 if (aChartTypeList.empty())
1601 continue;
1602
1603 rtl::Reference< ChartType > xChartType( aChartTypeList[0] );
1604
1605 //iterate through all series in this chart type
1606 for( rtl::Reference< DataSeries > const & dataSeries : xChartType->getDataSeries2() )
1607 {
1608 dataSeries->setPropertyValue( "StackingDirection", aNewDirection );
1609 }
1610 }
1611 }
1612 catch( const uno::Exception & )
1613 {
1614 DBG_UNHANDLED_EXCEPTION("chart2");
1615 }
1616}
1617
1618StackMode Diagram::getStackMode( bool& rbFound, bool& rbAmbiguous )
1619{
1620 rbFound=false;
1621 rbAmbiguous=false;
1622
1623 StackMode eGlobalStackMode = StackMode::NONE;
1624
1625 //iterate through all coordinate systems
1627 {
1628 //iterate through all chart types in the current coordinate system
1629 std::vector< rtl::Reference< ChartType > > aChartTypeList( xCooSys->getChartTypes2() );
1630 for( std::size_t nT = 0; nT < aChartTypeList.size(); ++nT )
1631 {
1632 rtl::Reference< ChartType > xChartType( aChartTypeList[nT] );
1633
1635 xChartType, rbFound, rbAmbiguous, xCooSys );
1636
1637 if( rbFound && eLocalStackMode != eGlobalStackMode && nT>0 )
1638 {
1639 rbAmbiguous = true;
1640 return eGlobalStackMode;
1641 }
1642
1643 eGlobalStackMode = eLocalStackMode;
1644 }
1645 }
1646
1647 return eGlobalStackMode;
1648}
1649
1650void Diagram::setVertical( bool bVertical /* = true */ )
1651{
1652 try
1653 {
1654 uno::Any aValue;
1655 aValue <<= bVertical;
1657 {
1658 bool bChanged = false;
1659 bool bOldSwap = false;
1660 if( !(xCooSys->getPropertyValue("SwapXAndYAxis") >>= bOldSwap)
1661 || bVertical != bOldSwap )
1662 bChanged = true;
1663
1664 if( bChanged )
1665 xCooSys->setPropertyValue("SwapXAndYAxis", aValue);
1666
1667 const sal_Int32 nDimensionCount = xCooSys->getDimension();
1668 sal_Int32 nDimIndex = 0;
1669 for (nDimIndex=0; nDimIndex < nDimensionCount; ++nDimIndex)
1670 {
1671 const sal_Int32 nMaximumScaleIndex = xCooSys->getMaximumAxisIndexByDimension(nDimIndex);
1672 for (sal_Int32 nI = 0; nI <= nMaximumScaleIndex; ++nI)
1673 {
1674 rtl::Reference<Axis> xAxis = xCooSys->getAxisByDimension2(nDimIndex,nI);
1675 if (!xAxis.is())
1676 continue;
1677
1678 //adapt title rotation only when axis swapping has changed
1679 if (!bChanged)
1680 continue;
1681
1682 Reference< beans::XPropertySet > xTitleProps( xAxis->getTitleObject(), uno::UNO_QUERY );
1683 if (!xTitleProps.is())
1684 continue;
1685
1686 double fAngleDegree = 0.0;
1687 xTitleProps->getPropertyValue("TextRotation") >>= fAngleDegree;
1688 if (fAngleDegree != 0.0 &&
1689 !rtl::math::approxEqual(fAngleDegree, 90.0))
1690 continue;
1691
1692 double fNewAngleDegree = 0.0;
1693 if( !bVertical && nDimIndex == 1 )
1694 fNewAngleDegree = 90.0;
1695 else if( bVertical && nDimIndex == 0 )
1696 fNewAngleDegree = 90.0;
1697
1698 xTitleProps->setPropertyValue("TextRotation", uno::Any(fNewAngleDegree));
1699 }
1700 }
1701 }
1702 }
1703 catch( const uno::Exception & )
1704 {
1705 DBG_UNHANDLED_EXCEPTION("chart2");
1706 }
1707}
1708
1709bool Diagram::getVertical( bool& rbFound, bool& rbAmbiguous )
1710{
1711 bool bValue = false;
1712 rbFound = false;
1713 rbAmbiguous = false;
1714
1716 {
1717 bool bCurrent = false;
1718 if (coords->getPropertyValue("SwapXAndYAxis") >>= bCurrent)
1719 {
1720 if (!rbFound)
1721 {
1722 bValue = bCurrent;
1723 rbFound = true;
1724 }
1725 else if (bCurrent != bValue)
1726 {
1727 // ambiguous -> choose always first found
1728 rbAmbiguous = true;
1729 }
1730 }
1731 }
1732 return bValue;
1733}
1734
1737 const rtl::Reference< ::chart::ChartTypeManager > & xChartTypeManager )
1738{
1740
1741 if( !xChartTypeManager )
1742 return aResult;
1743
1744 Sequence< OUString > aServiceNames( xChartTypeManager->getAvailableServiceNames());
1745 const sal_Int32 nLength = aServiceNames.getLength();
1746
1747 bool bTemplateFound = false;
1748
1749 for( sal_Int32 i = 0; ! bTemplateFound && i < nLength; ++i )
1750 {
1751 try
1752 {
1754 xChartTypeManager->createTemplate( aServiceNames[ i ] );
1755
1756 if (xTempl.is() && xTempl->matchesTemplate2(this, true))
1757 {
1758 aResult.xChartTypeTemplate = xTempl;
1759 aResult.sServiceName = aServiceNames[ i ];
1760 bTemplateFound = true;
1761 }
1762 }
1763 catch( const uno::Exception & )
1764 {
1765 DBG_UNHANDLED_EXCEPTION("chart2");
1766 }
1767 }
1768
1769 return aResult;
1770}
1771
1772std::vector< rtl::Reference< RegressionCurveModel > >
1774{
1775 std::vector< rtl::Reference< RegressionCurveModel > > aResult;
1776 std::vector< rtl::Reference< DataSeries > > aSeries( getDataSeries());
1777 for (auto const& elem : aSeries)
1778 {
1779 for( rtl::Reference< RegressionCurveModel > const & curve : elem->getRegressionCurves2() )
1780 {
1782 aResult.push_back( curve );
1783 }
1784 }
1785
1786 return aResult;
1787}
1788
1790{
1791 double fCameraDistance = FIXED_SIZE_FOR_3D_CHART_VOLUME;
1792
1793 try
1794 {
1795 drawing::CameraGeometry aCG( ThreeDHelper::getDefaultCameraGeometry() );
1798 fCameraDistance = aVRP.getLength();
1799
1800 ThreeDHelper::ensureCameraDistanceRange( fCameraDistance );
1801 }
1802 catch( const uno::Exception & )
1803 {
1804 DBG_UNHANDLED_EXCEPTION("chart2");
1805 }
1806 return fCameraDistance;
1807}
1808
1809void Diagram::setCameraDistance(double fCameraDistance )
1810{
1811 try
1812 {
1813 if( fCameraDistance <= 0 )
1814 fCameraDistance = FIXED_SIZE_FOR_3D_CHART_VOLUME;
1815
1816 drawing::CameraGeometry aCG( ThreeDHelper::getDefaultCameraGeometry() );
1819 if( ::basegfx::fTools::equalZero( aVRP.getLength() ) )
1820 aVRP = ::basegfx::B3DVector(0,0,1);
1821 aVRP.setLength(fCameraDistance);
1822 aCG.vrp = BaseGFXHelper::B3DVectorToPosition3D( aVRP );
1823
1825 }
1826 catch( const uno::Exception & )
1827 {
1828 DBG_UNHANDLED_EXCEPTION("chart2");
1829 }
1830}
1831
1833{
1834 bool bRightAngledAxes = false;
1835 rDiagram.getFastPropertyValue( PROP_DIAGRAM_RIGHT_ANGLED_AXES ) >>= bRightAngledAxes; // "RightAngledAxes"
1836 if(bRightAngledAxes)
1837 {
1839 rDiagram.getChartTypeByIndex( 0 ) ) )
1840 {
1841 return true;
1842 }
1843 }
1844 return false;
1845}
1846
1847void Diagram::getRotation( sal_Int32& rnHorizontalAngleDegree, sal_Int32& rnVerticalAngleDegree )
1848{
1849 double fXAngle, fYAngle, fZAngle;
1850 getRotationAngle( fXAngle, fYAngle, fZAngle );
1851
1853 {
1855 rnHorizontalAngleDegree, rnVerticalAngleDegree, fXAngle, fYAngle, fZAngle);
1856 rnVerticalAngleDegree*=-1;
1857 }
1858 else
1859 {
1860 rnHorizontalAngleDegree = basegfx::fround(basegfx::rad2deg(fXAngle));
1861 rnVerticalAngleDegree = basegfx::fround(-1.0 * basegfx::rad2deg(fYAngle));
1862 // nZRotation = basegfx::fround(-1.0 * basegfx::rad2deg(fZAngle));
1863 }
1864
1865 rnHorizontalAngleDegree = NormAngle180(rnHorizontalAngleDegree);
1866 rnVerticalAngleDegree = NormAngle180(rnVerticalAngleDegree);
1867}
1868
1869void Diagram::setRotation( sal_Int32 nHorizontalAngleDegree, sal_Int32 nVerticalYAngleDegree )
1870{
1871 //todo: x and y is not equal to horz and vert in case of RightAngledAxes==false
1872 double fXAngle = basegfx::deg2rad(nHorizontalAngleDegree);
1873 double fYAngle = basegfx::deg2rad(-1 * nVerticalYAngleDegree);
1874 double fZAngle = 0.0;
1875
1878 nHorizontalAngleDegree, -1*nVerticalYAngleDegree, fXAngle, fYAngle, fZAngle );
1879
1880 setRotationAngle( fXAngle, fYAngle, fZAngle );
1881}
1882
1883static ::basegfx::B3DHomMatrix lcl_getCameraMatrix( Diagram& rDiagram )
1884{
1885 drawing::HomogenMatrix aCameraMatrix;
1886
1887 drawing::CameraGeometry aCG( ThreeDHelper::getDefaultCameraGeometry() );
1888 rDiagram.getFastPropertyValue( PROP_SCENE_CAMERA_GEOMETRY ) >>= aCG; // "D3DCameraGeometry"
1889
1892
1893 //normalize vectors:
1894 aVPN.normalize();
1895 aVUP.normalize();
1896
1897 ::basegfx::B3DVector aCross = ::basegfx::cross( aVUP, aVPN );
1898
1899 //first line is VUP x VPN
1900 aCameraMatrix.Line1.Column1 = aCross[0];
1901 aCameraMatrix.Line1.Column2 = aCross[1];
1902 aCameraMatrix.Line1.Column3 = aCross[2];
1903 aCameraMatrix.Line1.Column4 = 0.0;
1904
1905 //second line is VUP
1906 aCameraMatrix.Line2.Column1 = aVUP[0];
1907 aCameraMatrix.Line2.Column2 = aVUP[1];
1908 aCameraMatrix.Line2.Column3 = aVUP[2];
1909 aCameraMatrix.Line2.Column4 = 0.0;
1910
1911 //third line is VPN
1912 aCameraMatrix.Line3.Column1 = aVPN[0];
1913 aCameraMatrix.Line3.Column2 = aVPN[1];
1914 aCameraMatrix.Line3.Column3 = aVPN[2];
1915 aCameraMatrix.Line3.Column4 = 0.0;
1916
1917 //fourth line is 0 0 0 1
1918 aCameraMatrix.Line4.Column1 = 0.0;
1919 aCameraMatrix.Line4.Column2 = 0.0;
1920 aCameraMatrix.Line4.Column3 = 0.0;
1921 aCameraMatrix.Line4.Column4 = 1.0;
1922
1923 return BaseGFXHelper::HomogenMatrixToB3DHomMatrix( aCameraMatrix );
1924}
1925
1926static double lcl_shiftAngleToIntervalMinusPiToPi( double fAngleRad )
1927{
1928 //valid range: ]-Pi,Pi]
1929 while( fAngleRad<=-M_PI )
1930 fAngleRad+=(2*M_PI);
1931 while( fAngleRad>M_PI )
1932 fAngleRad-=(2*M_PI);
1933 return fAngleRad;
1934}
1935
1936void Diagram::getRotationAngle( double& rfXAngleRad, double& rfYAngleRad, double& rfZAngleRad )
1937{
1938 //takes the camera and the transformation matrix into account
1939
1940 rfXAngleRad = rfYAngleRad = rfZAngleRad = 0.0;
1941
1942 //get camera rotation
1943 ::basegfx::B3DHomMatrix aFixCameraRotationMatrix( lcl_getCameraMatrix( *this ) );
1944 BaseGFXHelper::ReduceToRotationMatrix( aFixCameraRotationMatrix );
1945
1946 //get scene rotation
1947 ::basegfx::B3DHomMatrix aSceneRotation;
1948 {
1949 drawing::HomogenMatrix aHomMatrix;
1950 // "D3DTransformMatrix"
1951 if( getFastPropertyValue( PROP_SCENE_TRANSF_MATRIX ) >>= aHomMatrix )
1952 {
1953 aSceneRotation = BaseGFXHelper::HomogenMatrixToB3DHomMatrix( aHomMatrix );
1954 BaseGFXHelper::ReduceToRotationMatrix( aSceneRotation );
1955 }
1956 }
1957
1958 ::basegfx::B3DHomMatrix aResultRotation = aFixCameraRotationMatrix * aSceneRotation;
1959 ::basegfx::B3DTuple aRotation( BaseGFXHelper::GetRotationFromMatrix( aResultRotation ) );
1960
1961 rfXAngleRad = lcl_shiftAngleToIntervalMinusPiToPi(aRotation.getX());
1962 rfYAngleRad = lcl_shiftAngleToIntervalMinusPiToPi(aRotation.getY());
1963 rfZAngleRad = lcl_shiftAngleToIntervalMinusPiToPi(aRotation.getZ());
1964
1965 if(rfZAngleRad<-M_PI_2 || rfZAngleRad>M_PI_2)
1966 {
1967 rfZAngleRad-=M_PI;
1968 rfXAngleRad-=M_PI;
1969 rfYAngleRad=(M_PI-rfYAngleRad);
1970
1971 rfXAngleRad = lcl_shiftAngleToIntervalMinusPiToPi(rfXAngleRad);
1972 rfYAngleRad = lcl_shiftAngleToIntervalMinusPiToPi(rfYAngleRad);
1973 rfZAngleRad = lcl_shiftAngleToIntervalMinusPiToPi(rfZAngleRad);
1974 }
1975}
1976
1977static ::basegfx::B3DHomMatrix lcl_getInverseRotationMatrix( Diagram& rDiagram )
1978{
1979 ::basegfx::B3DHomMatrix aInverseRotation;
1980 double fXAngleRad=0.0;
1981 double fYAngleRad=0.0;
1982 double fZAngleRad=0.0;
1983 rDiagram.getRotationAngle( fXAngleRad, fYAngleRad, fZAngleRad );
1984 aInverseRotation.rotate( 0.0, 0.0, -fZAngleRad );
1985 aInverseRotation.rotate( 0.0, -fYAngleRad, 0.0 );
1986 aInverseRotation.rotate( -fXAngleRad, 0.0, 0.0 );
1987 return aInverseRotation;
1988}
1989
1990static void lcl_rotateLights( const ::basegfx::B3DHomMatrix& rLightRotation, Diagram& rDiagram )
1991{
1992 ::basegfx::B3DHomMatrix aLightRotation( rLightRotation );
1993 BaseGFXHelper::ReduceToRotationMatrix( aLightRotation );
1994
1995 // "D3DSceneLightDirection1","D3DSceneLightOn1",
2004}
2005
2007 double fXAngleRad, double fYAngleRad, double fZAngleRad )
2008{
2009 //the rotation of the camera is not touched but taken into account
2010 //the rotation difference is applied to the transformation matrix
2011
2012 //the light sources will be adapted also
2013
2014 try
2015 {
2016 //remind old rotation for adaptation of light directions
2017 ::basegfx::B3DHomMatrix aInverseOldRotation( lcl_getInverseRotationMatrix( *this ) );
2018
2019 ::basegfx::B3DHomMatrix aInverseCameraRotation;
2020 {
2022 lcl_getCameraMatrix( *this ) ) );
2023 aInverseCameraRotation.rotate( 0.0, 0.0, -aR.getZ() );
2024 aInverseCameraRotation.rotate( 0.0, -aR.getY(), 0.0 );
2025 aInverseCameraRotation.rotate( -aR.getX(), 0.0, 0.0 );
2026 }
2027
2028 ::basegfx::B3DHomMatrix aCumulatedRotation;
2029 aCumulatedRotation.rotate( fXAngleRad, fYAngleRad, fZAngleRad );
2030
2031 //calculate new scene matrix
2032 ::basegfx::B3DHomMatrix aSceneRotation = aInverseCameraRotation*aCumulatedRotation;
2033 BaseGFXHelper::ReduceToRotationMatrix( aSceneRotation );
2034
2035 //set new rotation to transformation matrix ("D3DTransformMatrix")
2038
2039 //rotate lights if RightAngledAxes are not set or not supported
2040 bool bRightAngledAxes = false;
2041 getFastPropertyValue( PROP_DIAGRAM_RIGHT_ANGLED_AXES ) >>= bRightAngledAxes;
2042 if(!bRightAngledAxes || !ChartTypeHelper::isSupportingRightAngledAxes(
2043 getChartTypeByIndex( 0 ) ) )
2044 {
2045 ::basegfx::B3DHomMatrix aNewRotation;
2046 aNewRotation.rotate( fXAngleRad, fYAngleRad, fZAngleRad );
2047 lcl_rotateLights( aNewRotation*aInverseOldRotation, *this );
2048 }
2049 }
2050 catch( const uno::Exception & )
2051 {
2052 DBG_UNHANDLED_EXCEPTION("chart2");
2053 }
2054}
2055
2056static bool lcl_isEqual( const drawing::Direction3D& rA, const drawing::Direction3D& rB )
2057{
2058 return ::rtl::math::approxEqual(rA.DirectionX, rB.DirectionX)
2059 && ::rtl::math::approxEqual(rA.DirectionY, rB.DirectionY)
2060 && ::rtl::math::approxEqual(rA.DirectionZ, rB.DirectionZ);
2061}
2062static bool lcl_isSimpleScheme( drawing::ShadeMode aShadeMode
2063 , sal_Int32 nRoundedEdges
2064 , sal_Int32 nObjectLines
2065 , const rtl::Reference< Diagram >& xDiagram )
2066{
2067 if(aShadeMode!=drawing::ShadeMode_FLAT)
2068 return false;
2069 if(nRoundedEdges!=0)
2070 return false;
2071 if(nObjectLines==0)
2072 {
2073 rtl::Reference< ChartType > xChartType( xDiagram->getChartTypeByIndex( 0 ) );
2074 return ChartTypeHelper::noBordersForSimpleScheme( xChartType );
2075 }
2076 if(nObjectLines!=1)
2077 return false;
2078 return true;
2079}
2080static bool lcl_isRealisticScheme( drawing::ShadeMode aShadeMode
2081 , sal_Int32 nRoundedEdges
2082 , sal_Int32 nObjectLines )
2083{
2084 if(aShadeMode!=drawing::ShadeMode_SMOOTH)
2085 return false;
2086 if(nRoundedEdges!=5)
2087 return false;
2088 if(nObjectLines!=0)
2089 return false;
2090 return true;
2091}
2092static bool lcl_isLightScheme( Diagram& rDiagram, bool bRealistic )
2093{
2094 bool bIsOn = false;
2095 // "D3DSceneLightOn2" / UNO_NAME_3D_SCENE_LIGHTON_2
2096 rDiagram.getFastPropertyValue( PROP_SCENE_LIGHT_ON_2 ) >>= bIsOn;
2097 if(!bIsOn)
2098 return false;
2099
2100 rtl::Reference< ChartType > xChartType( rDiagram.getChartTypeByIndex( 0 ) );
2101
2102 sal_Int32 nColor = 0;
2103 // "D3DSceneLightColor2" / UNO_NAME_3D_SCENE_LIGHTCOLOR_2
2104 rDiagram.getFastPropertyValue( PROP_SCENE_LIGHT_COLOR_2 ) >>= nColor;
2105 if( nColor != ::chart::ChartTypeHelper::getDefaultDirectLightColor( !bRealistic, xChartType ) )
2106 return false;
2107
2108 sal_Int32 nAmbientColor = 0;
2109 // "D3DSceneAmbientColor" / UNO_NAME_3D_SCENE_AMBIENTCOLOR
2110 rDiagram.getFastPropertyValue( PROP_SCENE_AMBIENT_COLOR ) >>= nAmbientColor;
2111 if( nAmbientColor != ::chart::ChartTypeHelper::getDefaultAmbientLightColor( !bRealistic, xChartType ) )
2112 return false;
2113
2114 drawing::Direction3D aDirection(0,0,0);
2115 // "D3DSceneLightDirection2" / UNO_NAME_3D_SCENE_LIGHTDIRECTION_2
2117
2118 drawing::Direction3D aDefaultDirection( bRealistic
2121
2122 //rotate default light direction when right angled axes are off but supported
2123 {
2124 bool bRightAngledAxes = false;
2125 rDiagram.getFastPropertyValue( PROP_DIAGRAM_RIGHT_ANGLED_AXES ) >>= bRightAngledAxes; // "RightAngledAxes"
2126 if(!bRightAngledAxes)
2127 {
2129 rDiagram.getChartTypeByIndex( 0 ) ) )
2130 {
2133 ::basegfx::B3DVector aLightVector( BaseGFXHelper::Direction3DToB3DVector( aDefaultDirection ) );
2134 aLightVector = aRotation*aLightVector;
2135 aDefaultDirection = BaseGFXHelper::B3DVectorToDirection3D( aLightVector );
2136 }
2137 }
2138 }
2139
2140 return lcl_isEqual( aDirection, aDefaultDirection );
2141}
2142static bool lcl_isRealisticLightScheme( Diagram& rDiagram )
2143{
2144 return lcl_isLightScheme( rDiagram, true /*bRealistic*/ );
2145}
2146static bool lcl_isSimpleLightScheme( Diagram& rDiagram )
2147{
2148 return lcl_isLightScheme( rDiagram, false /*bRealistic*/ );
2149}
2150
2152{
2154
2155 sal_Int32 nRoundedEdges;
2156 sal_Int32 nObjectLines;
2157 ThreeDHelper::getRoundedEdgesAndObjectLines( this, nRoundedEdges, nObjectLines );
2158
2159 //get shade mode and light settings:
2160 drawing::ShadeMode aShadeMode( drawing::ShadeMode_SMOOTH );
2161 try
2162 {
2163 getFastPropertyValue( PROP_SCENE_SHADE_MODE )>>= aShadeMode; // "D3DSceneShadeMode"
2164 }
2165 catch( const uno::Exception & )
2166 {
2167 DBG_UNHANDLED_EXCEPTION("chart2");
2168 }
2169
2170 if( lcl_isSimpleScheme( aShadeMode, nRoundedEdges, nObjectLines, this ) )
2171 {
2172 if( lcl_isSimpleLightScheme(*this) )
2174 }
2175 else if( lcl_isRealisticScheme( aShadeMode, nRoundedEdges, nObjectLines ) )
2176 {
2177 if( lcl_isRealisticLightScheme(*this) )
2179 }
2180
2181 return aScheme;
2182}
2183
2184static void lcl_setRealisticScheme( drawing::ShadeMode& rShadeMode
2185 , sal_Int32& rnRoundedEdges
2186 , sal_Int32& rnObjectLines )
2187{
2188 rShadeMode = drawing::ShadeMode_SMOOTH;
2189 rnRoundedEdges = 5;
2190 rnObjectLines = 0;
2191}
2192
2193static void lcl_setSimpleScheme( drawing::ShadeMode& rShadeMode
2194 , sal_Int32& rnRoundedEdges
2195 , sal_Int32& rnObjectLines
2196 , const rtl::Reference< Diagram >& xDiagram )
2197{
2198 rShadeMode = drawing::ShadeMode_FLAT;
2199 rnRoundedEdges = 0;
2200
2201 rtl::Reference< ChartType > xChartType( xDiagram->getChartTypeByIndex( 0 ) );
2202 rnObjectLines = ChartTypeHelper::noBordersForSimpleScheme( xChartType ) ? 0 : 1;
2203}
2205{
2207 return;
2208
2209 drawing::ShadeMode aShadeMode;
2210 sal_Int32 nRoundedEdges;
2211 sal_Int32 nObjectLines;
2212
2214 lcl_setSimpleScheme(aShadeMode,nRoundedEdges,nObjectLines,this);
2215 else
2216 lcl_setRealisticScheme(aShadeMode,nRoundedEdges,nObjectLines);
2217
2218 try
2219 {
2220 ThreeDHelper::setRoundedEdgesAndObjectLines( this, nRoundedEdges, nObjectLines );
2221
2222 drawing::ShadeMode aOldShadeMode;
2223 if( ! (getFastPropertyValue( PROP_SCENE_SHADE_MODE)>>=aOldShadeMode) ||
2224 aOldShadeMode != aShadeMode )
2225 {
2226 setFastPropertyValue( PROP_SCENE_SHADE_MODE, uno::Any( aShadeMode )); // "D3DSceneShadeMode"
2227 }
2228
2229 lcl_setLightsForScheme( *this, aScheme );
2230 }
2231 catch( const uno::Exception & )
2232 {
2233 DBG_UNHANDLED_EXCEPTION("chart2");
2234 }
2235
2236}
2237
2238void Diagram::setDefaultRotation( bool bPieOrDonut )
2239{
2240 drawing::CameraGeometry aCameraGeo( ThreeDHelper::getDefaultCameraGeometry( bPieOrDonut ) );
2241 // "D3DCameraGeometry"
2243
2244 ::basegfx::B3DHomMatrix aSceneRotation;
2245 if( bPieOrDonut )
2246 aSceneRotation.rotate( -M_PI/3.0, 0, 0 );
2247 // "D3DTransformMatrix"
2250}
2251
2252void Diagram::switchRightAngledAxes( bool bRightAngledAxes )
2253{
2254 try
2255 {
2256 bool bOldRightAngledAxes = false;
2257 getFastPropertyValue( PROP_DIAGRAM_RIGHT_ANGLED_AXES ) >>= bOldRightAngledAxes; // "RightAngledAxes"
2258 if( bOldRightAngledAxes!=bRightAngledAxes)
2259 {
2260 setFastPropertyValue( PROP_DIAGRAM_RIGHT_ANGLED_AXES, uno::Any( bRightAngledAxes ));
2261 if(bRightAngledAxes)
2262 {
2263 ::basegfx::B3DHomMatrix aInverseRotation( lcl_getInverseRotationMatrix( *this ) );
2264 lcl_rotateLights( aInverseRotation, *this );
2265 }
2266 else
2267 {
2268 ::basegfx::B3DHomMatrix aCompleteRotation( lcl_getCompleteRotationMatrix( *this ) );
2269 lcl_rotateLights( aCompleteRotation, *this );
2270 }
2271 }
2272 }
2273 catch( const uno::Exception & )
2274 {
2275 DBG_UNHANDLED_EXCEPTION("chart2");
2276 }
2277}
2278
2279} // namespace chart
2280
2281extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
2282com_sun_star_comp_chart2_Diagram_get_implementation(css::uno::XComponentContext *context,
2283 css::uno::Sequence<css::uno::Any> const &)
2284{
2285 return cppu::acquire(new ::chart::Diagram(context));
2286}
2287
2288/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_chart2_Diagram_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
Definition: Diagram.cxx:2282
Reference< uno::XComponentContext > m_xContext
PropertiesInfo aProperties
AnyEventRef aEvent
void rotate(double fAngleX, double fAngleY, double fAngleZ)
double getLength() const
B3DVector & setLength(double fLen)
B3DVector & normalize()
TYPE getX() const
TYPE getZ() const
TYPE getY() const
static rtl::Reference< ::chart::Axis > getAxis(sal_Int32 nDimensionIndex, bool bMainAxis, const rtl::Reference< ::chart::Diagram > &xDiagram)
static rtl::Reference< ::chart::Axis > createAxis(sal_Int32 nDimensionIndex, bool bMainAxis, const rtl::Reference< ::chart::Diagram > &xDiagram, const css::uno::Reference< css::uno::XComponentContext > &xContext, ReferenceSizeProvider *pRefSizeProvider=nullptr)
static void makeAxisVisible(const rtl::Reference< ::chart::Axis > &xAxis)
Definition: AxisHelper.cxx:442
static void hideAxisIfNoDataIsAttached(const rtl::Reference< ::chart::Axis > &xAxis, const rtl::Reference< ::chart::Diagram > &xDiagram)
Definition: AxisHelper.cxx:475
static SAL_DLLPRIVATE sal_Int32 getDefaultAmbientLightColor(bool bSimple, const rtl::Reference< ::chart::ChartType > &xChartType)
static bool isSupportingOnlyDeepStackingFor3D(const rtl::Reference< ::chart::ChartType > &xChartType)
static css::uno::Sequence< sal_Int32 > getSupportedMissingValueTreatments(const rtl::Reference< ::chart::ChartType > &xChartType)
static SAL_DLLPRIVATE sal_Int32 getDefaultDirectLightColor(bool bSimple, const rtl::Reference< ::chart::ChartType > &xChartType)
static SAL_DLLPRIVATE css::drawing::Direction3D getDefaultRealisticLightDirection(const rtl::Reference< ::chart::ChartType > &xChartType)
static SAL_DLLPRIVATE bool noBordersForSimpleScheme(const rtl::Reference< ::chart::ChartType > &xChartType)
static bool isSupportingRightAngledAxes(const rtl::Reference< ::chart::ChartType > &xChartType)
static SAL_DLLPRIVATE css::drawing::Direction3D getDefaultSimpleLightDirection(const rtl::Reference< ::chart::ChartType > &xChartType)
Data table implementation.
Definition: DataTable.hxx:32
static SAL_DLLPRIVATE bool areChartTypesCompatible(const rtl::Reference< ::chart::ChartType > &xFirstType, const rtl::Reference< ::chart::ChartType > &xSecondType)
static StackMode getStackModeFromChartType(const rtl::Reference< ::chart::ChartType > &xChartType, bool &rbFound, bool &rbAmbiguous, const rtl::Reference< ::chart::BaseCoordinateSystem > &xCorrespondingCoordinateSystem)
Retrieves the stackmode of the first DataSeries or none.
static bool isSeriesAttachedToMainAxis(const rtl::Reference< ::chart::DataSeries > &xDataSeries)
void setRotationAngle(double fXAngleRad, double fYAngleRad, double fZAngleRad)
Definition: Diagram.cxx:2006
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
The InfoHelper table contains all property names and types of this object.
Definition: Diagram.cxx:720
void setStackMode(StackMode eStackMode)
The stacking mode is only set at the series found inside the first chart type.
Definition: Diagram.cxx:1554
rtl::Reference<::chart::Legend > m_xLegend
Definition: Diagram.hxx:374
virtual void SAL_CALL set3DSettingsToDefault() override
Definition: Diagram.cxx:452
void setGeometry3D(sal_Int32 nNewGeometry)
Definition: Diagram.cxx:889
virtual void SAL_CALL setDefaultIllumination() override
Definition: Diagram.cxx:541
rtl::Reference< Wall > m_xWall
Definition: Diagram.hxx:369
virtual void SAL_CALL setDataTable(const css::uno::Reference< css::chart2::XDataTable > &xDataTable) override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: Diagram.cxx:832
bool isCategory()
Definition: Diagram.cxx:1311
css::uno::Reference< css::chart2::XTitle > m_xTitle
Definition: Diagram.hxx:372
bool isSupportingDateAxis()
Definition: Diagram.cxx:1194
bool moveSeries(const rtl::Reference< DataSeries > &xGivenDataSeries, bool bForward)
Move a series forward or backward.
Definition: Diagram.cxx:1145
virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override
Definition: Diagram.cxx:668
void setDimension(sal_Int32 nNewDimensionCount)
Sets the dimension of the diagram given.
Definition: Diagram.cxx:1505
virtual void SAL_CALL modified(const css::lang::EventObject &aEvent) override
Definition: Diagram.cxx:686
virtual css::uno::Reference< css::chart2::XDataTable > SAL_CALL getDataTable() override
Definition: Diagram.cxx:785
virtual void firePropertyChangeEvent() override
implement this method in derived classes to get called when properties change.
Definition: Diagram.cxx:698
virtual css::uno::Reference< css::chart2::XLegend > SAL_CALL getLegend() override
Definition: Diagram.cxx:351
void setCameraDistance(double fCameraDistance)
Definition: Diagram.cxx:1809
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const css::uno::Any &rValue) override
The same as setFastPropertyValue; nHandle is always valid.
Definition: Diagram.cxx:732
virtual void SAL_CALL setLegend(const css::uno::Reference< css::chart2::XLegend > &xLegend) override
void getRotation(sal_Int32 &rnHorizontalAngleDegree, sal_Int32 &rnVerticalAngleDegree)
Definition: Diagram.cxx:1847
virtual void SAL_CALL setDefaultRotation() override
Definition: Diagram.cxx:460
rtl::Reference<::chart::DataTable > m_xDataTable
Definition: Diagram.hxx:375
virtual css::uno::Reference< css::chart2::XTitle > SAL_CALL getTitleObject() override
Definition: Diagram.cxx:428
virtual void SAL_CALL addCoordinateSystem(const css::uno::Reference< css::chart2::XCoordinateSystem > &aCoordSys) override
Definition: Diagram.cxx:569
css::uno::Reference< css::chart2::XColorScheme > m_xColorScheme
Definition: Diagram.hxx:376
tCoordinateSystemContainerType m_aCoordSystems
Definition: Diagram.hxx:367
tTemplateWithServiceName getTemplate(const rtl::Reference< ::chart::ChartTypeManager > &xChartTypeManager)
tries to find a template in the chart-type manager that matches this diagram.
Definition: Diagram.cxx:1736
tCoordinateSystemContainerType getBaseCoordinateSystems() const
Definition: Diagram.cxx:615
virtual void SAL_CALL setCoordinateSystems(const css::uno::Sequence< css::uno::Reference< css::chart2::XCoordinateSystem > > &aCoordinateSystems) override
double getCameraDistance()
Definition: Diagram.cxx:1789
rtl::Reference< ChartType > getChartTypeByIndex(sal_Int32 nIndex)
Definition: Diagram.cxx:1174
sal_Int32 getDimension()
Returns the dimension found for all chart types in the tree.
Definition: Diagram.cxx:1481
bool isSeriesMoveable(const rtl::Reference< DataSeries > &xGivenDataSeries, bool bForward)
Test if a series can be moved.
Definition: Diagram.cxx:1133
virtual void SAL_CALL addModifyListener(const css::uno::Reference< css::util::XModifyListener > &aListener) override
Definition: Diagram.cxx:675
bool isSupportingFloorAndWall()
Definition: Diagram.cxx:955
std::vector< rtl::Reference< ::chart::DataSeries > > getDataSeries()
Definition: Diagram.cxx:1360
void fireModifyEvent()
Definition: Diagram.cxx:703
virtual void SAL_CALL setDefaultColorScheme(const css::uno::Reference< css::chart2::XColorScheme > &xColorScheme) override
Definition: Diagram.cxx:404
virtual css::uno::Sequence< css::uno::Reference< css::chart2::XCoordinateSystem > > SAL_CALL getCoordinateSystems() override
Definition: Diagram.cxx:609
StackMode getStackMode(bool &rbFound, bool &rbAmbiguous)
Definition: Diagram.cxx:1618
virtual ~Diagram() override
Definition: Diagram.cxx:294
rtl::Reference< Wall > m_xFloor
Definition: Diagram.hxx:370
virtual void SAL_CALL getFastPropertyValue(css::uno::Any &rValue, sal_Int32 nHandle) const override
The same as getFastPropertyValue, but return the value through rValue and nHandle is always valid.
Definition: Diagram.cxx:760
DiagramPositioningMode getDiagramPositioningMode()
Definition: Diagram.cxx:845
bool isPieOrDonutChart()
Definition: Diagram.cxx:942
SAL_DLLPRIVATE void replaceCoordinateSystem(const rtl::Reference< ::chart::BaseCoordinateSystem > &xCooSysToReplace, const rtl::Reference< ::chart::BaseCoordinateSystem > &xReplacement)
Replaces all occurrences of xCooSysToReplace in the tree with xReplacement in the diagram's tree.
Definition: Diagram.cxx:1457
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: Diagram.cxx:837
void switchRightAngledAxes(bool bRightAngledAxes)
Definition: Diagram.cxx:2252
void setScheme(ThreeDLookScheme aScheme)
Definition: Diagram.cxx:2204
std::vector< std::vector< rtl::Reference< ::chart::DataSeries > > > getDataSeriesGroups()
return all data series in this diagram grouped by chart-types
Definition: Diagram.cxx:1343
Diagram(css::uno::Reference< css::uno::XComponentContext > xContext)
rtl::Reference< ::chart::Axis > getAttachedAxis(const rtl::Reference< ::chart::DataSeries > &xSeries)
Definition: Diagram.cxx:1410
virtual void SAL_CALL setDiagramData(const css::uno::Reference< css::chart2::data::XDataSource > &xDataSource, const css::uno::Sequence< css::beans::PropertyValue > &aArguments) override
Definition: Diagram.cxx:413
virtual void SAL_CALL removeModifyListener(const css::uno::Reference< css::util::XModifyListener > &aListener) override
Definition: Diagram.cxx:680
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: Diagram.cxx:726
bool getVertical(bool &rbOutFoundResult, bool &rbOutAmbiguousResult)
Gets the "SwapXAndYAxis" property at all coordinate systems found in the given diagram.
Definition: Diagram.cxx:1709
sal_Int32 getCorrectedMissingValueTreatment(const rtl::Reference< ::chart::ChartType > &xChartType)
Definition: Diagram.cxx:864
void getRotationAngle(double &rfXAngleRad, double &rfYAngleRad, double &rfZAngleRad)
Definition: Diagram.cxx:1936
void setRotation(sal_Int32 nHorizontalAngleDegree, sal_Int32 nVerticalYAngleDegree)
Definition: Diagram.cxx:1869
bool attachSeriesToAxis(bool bMainAxis, const rtl::Reference< DataSeries > &xSeries, const css::uno::Reference< css::uno::XComponentContext > &xContext, bool bAdaptAxes=true)
Definition: Diagram.cxx:1416
virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getFloor() override
Definition: Diagram.cxx:333
virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getWall() override
Definition: Diagram.cxx:315
rtl::Reference< ChartType > getChartTypeOfSeries(const rtl::Reference< DataSeries > &xSeries)
Definition: Diagram.cxx:1382
sal_Int32 getGeometry3D(bool &rbFound, bool &rbAmbiguous)
Definition: Diagram.cxx:901
ThreeDLookScheme detectScheme()
Definition: Diagram.cxx:2151
std::vector< rtl::Reference< ::chart::BaseCoordinateSystem > > tCoordinateSystemContainerType
Definition: Diagram.hxx:164
void setVertical(bool bVertical)
Sets the "SwapXAndYAxis" property at all coordinate systems found in the given diagram.
Definition: Diagram.cxx:1650
css::uno::Reference< css::chart2::data::XLabeledDataSequence > getCategories()
Definition: Diagram.cxx:1243
rtl::Reference< ::chart::Legend > getLegend2() const
Definition: Diagram.cxx:357
void setCategories(const css::uno::Reference< css::chart2::data::XLabeledDataSequence > &xCategories, bool bSetAxisType=false, bool bCategoryAxis=true)
Definition: Diagram.cxx:1285
std::vector< rtl::Reference<::chart::RegressionCurveModel > > getAllRegressionCurvesNotMeanValueLine()
Definition: Diagram.cxx:1773
virtual void SAL_CALL removeCoordinateSystem(const css::uno::Reference< css::chart2::XCoordinateSystem > &aCoordSys) override
Definition: Diagram.cxx:591
std::vector< rtl::Reference< ChartType > > getChartTypes()
Definition: Diagram.cxx:1155
css::uno::Reference< css::uno::XComponentContext > m_xContext
Definition: Diagram.hxx:366
virtual void GetDefaultValue(sal_Int32 nHandle, css::uno::Any &rAny) const override
implement this method to provide default values for all properties supporting defaults.
Definition: Diagram.cxx:709
rtl::Reference< ModifyEventForwarder > m_xModifyEventForwarder
Definition: Diagram.hxx:377
rtl::Reference<::chart::DataTable > getDataTableRef() const
Definition: Diagram.cxx:791
virtual void SAL_CALL setTitleObject(const css::uno::Reference< css::chart2::XTitle > &Title) override
Definition: Diagram.cxx:434
virtual css::uno::Reference< css::chart2::XColorScheme > SAL_CALL getDefaultColorScheme() override
Definition: Diagram.cxx:387
This helper class serves as forwarder of modify events.
static void setRoundedEdgesAndObjectLines(const rtl::Reference< ::chart::Diagram > &xDiagram, sal_Int32 nRoundedEdges, sal_Int32 nObjectLines)
static void getRoundedEdgesAndObjectLines(const rtl::Reference< ::chart::Diagram > &xDiagram, sal_Int32 &rnRoundedEdges, sal_Int32 &rnObjectLines)
static css::drawing::CameraGeometry getDefaultCameraGeometry(bool bPie=false)
Returns the default camera geometry that is set in the Diagram CTOR.
static double CameraDistanceToPerspective(double fCameraDistance)
static double PerspectiveToCameraDistance(double fPerspective)
static SAL_DLLPRIVATE void convertXYZAngleRadToElevationRotationDeg(sal_Int32 &rnElevationDeg, sal_Int32 &rnRotationDeg, double fXRad, double fYRad, double fZRad)
static void convertElevationRotationDegToXYZAngleRad(sal_Int32 nElevationDeg, sal_Int32 nRotationDeg, double &rfXAngleRad, double &rfYAngleRad, double &rfZAngleRad)
static SAL_DLLPRIVATE void ensureCameraDistanceRange(double &rfCameraDistance)
mutable::osl::Mutex m_aMutex
static css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL createPropertySetInfo(IPropertyArrayHelper &rProperties)
void SAL_CALL disposing()
virtual void SAL_CALL setPropertyToDefault(const OUString &PropertyName) override final
virtual void SAL_CALL setFastPropertyValue(sal_Int32 nHandle, const css::uno::Any &rValue) override final
constexpr double FIXED_SIZE_FOR_3D_CHART_VOLUME
Definition: defines.hxx:22
#define DBG_UNHANDLED_EXCEPTION(...)
const char nHorizontal
const char nVertical
Sequence< OUString > aServiceNames
std::enable_if< std::is_signed< T >::value, T >::type NormAngle180(T angle)
Sequence< PropertyValue > aArguments
sal_Int32 nIndex
Mode eMode
sal_Int64 n
constexpr double rad2deg(double v)
B2IRange fround(const B2DRange &rRange)
constexpr double deg2rad(double v)
void ReduceToRotationMatrix(::basegfx::B3DHomMatrix &rB3DMatrix)
OOO_DLLPUBLIC_CHARTTOOLS::basegfx::B3DTuple GetRotationFromMatrix(const ::basegfx::B3DHomMatrix &rB3DMatrix)
OOO_DLLPUBLIC_CHARTTOOLS css::drawing::HomogenMatrix B3DHomMatrixToHomogenMatrix(const ::basegfx::B3DHomMatrix &rB3DMatrix)
::basegfx::B3DVector Position3DToB3DVector(const css::drawing::Position3D &rPosition)
::basegfx::B3DVector Direction3DToB3DVector(const css::drawing::Direction3D &rDirection)
css::drawing::Direction3D B3DVectorToDirection3D(const ::basegfx::B3DVector &rB3DVector)
OOO_DLLPUBLIC_CHARTTOOLS::basegfx::B3DHomMatrix HomogenMatrixToB3DHomMatrix(const css::drawing::HomogenMatrix &rHomogenMatrix)
css::drawing::Position3D B3DVectorToPosition3D(const ::basegfx::B3DVector &rB3DVector)
OOO_DLLPUBLIC_CHARTTOOLS void AddDefaultsToMap(::chart::tPropertyValueMap &rOutMap)
OOO_DLLPUBLIC_CHARTTOOLS void AddPropertiesToVector(std::vector< css::beans::Property > &rOutProperties)
OOO_DLLPUBLIC_CHARTTOOLS void setPropertyAlsoToAllAttributedDataPoints(const rtl::Reference< ::chart::DataSeries > &xSeries, const OUString &rPropertyName, const css::uno::Any &rPropertyValue)
OOO_DLLPUBLIC_CHARTTOOLS sal_Int32 getAttachedAxisIndex(const rtl::Reference< ::chart::DataSeries > &xSeries)
void removeListener(const InterfaceRef &xObject, const css::uno::Reference< css::util::XModifyListener > &xListener)
void addListener(const InterfaceRef &xObject, const css::uno::Reference< css::util::XModifyListener > &xListener)
void setPropertyValueDefault(tPropertyValueMap &rOutMap, tPropertyValueMapKey key, const Value &value)
Calls setPropertyValue() but asserts that the given property hasn't been set before.
OOO_DLLPUBLIC_CHARTTOOLS bool isMeanValueLine(const css::uno::Reference< css::chart2::XRegressionCurve > &xRegCurve)
::cppu::WeakImplHelper< css::chart2::XDiagram, css::lang::XServiceInfo, css::chart2::XCoordinateSystemContainer, css::chart2::XTitled, css::chart::X3DDefaultSetter, css::util::XModifyBroadcaster, css::util::XModifyListener, css::util::XCloneable > Diagram_Base
Definition: Diagram.hxx:72
::basegfx::B3DHomMatrix lcl_getCompleteRotationMatrix(Diagram &rDiagram)
Definition: Diagram.cxx:466
static double lcl_shiftAngleToIntervalMinusPiToPi(double fAngleRad)
Definition: Diagram.cxx:1926
static void lcl_setSimpleScheme(drawing::ShadeMode &rShadeMode, sal_Int32 &rnRoundedEdges, sal_Int32 &rnObjectLines, const rtl::Reference< Diagram > &xDiagram)
Definition: Diagram.cxx:2193
static void lcl_RotateLightSource(Diagram &rDiagram, int nLightSourceDirectionProp, int nLightSourceOnProp, const ::basegfx::B3DHomMatrix &rRotationMatrix)
Definition: Diagram.cxx:476
std::unordered_map< tPropertyValueMapKey, css::uno::Any > tPropertyValueMap
static bool lcl_isLightScheme(Diagram &rDiagram, bool bRealistic)
Definition: Diagram.cxx:2092
::basegfx::B3DHomMatrix lcl_getCameraMatrix(Diagram &rDiagram)
Definition: Diagram.cxx:1883
DiagramPositioningMode
Definition: Diagram.hxx:56
static bool lcl_isEqual(const drawing::Direction3D &rA, const drawing::Direction3D &rB)
Definition: Diagram.cxx:2056
static bool lcl_moveSeriesOrCheckIfMoveIsAllowed(Diagram &rDiagram, const rtl::Reference< DataSeries > &xGivenDataSeries, bool bForward, bool bDoMove)
This method implements the logic of checking if a series can be moved forward/backward.
Definition: Diagram.cxx:1004
static bool lcl_isSimpleLightScheme(Diagram &rDiagram)
Definition: Diagram.cxx:2146
::basegfx::B3DHomMatrix lcl_getInverseRotationMatrix(Diagram &rDiagram)
Definition: Diagram.cxx:1977
ThreeDLookScheme
static std::vector< rtl::Reference< Axis > > lcl_getAxisHoldingCategoriesFromDiagram(Diagram &rDiagram)
Definition: Diagram.cxx:1199
static bool lcl_isRealisticLightScheme(Diagram &rDiagram)
Definition: Diagram.cxx:2142
static void lcl_setLightsForScheme(Diagram &rDiagram, const ThreeDLookScheme &rScheme)
Definition: Diagram.cxx:499
static bool lcl_isSimpleScheme(drawing::ShadeMode aShadeMode, sal_Int32 nRoundedEdges, sal_Int32 nObjectLines, const rtl::Reference< Diagram > &xDiagram)
Definition: Diagram.cxx:2062
static bool lcl_isRightAngledAxesSetAndSupported(Diagram &rDiagram)
Definition: Diagram.cxx:1832
static void lcl_setRealisticScheme(drawing::ShadeMode &rShadeMode, sal_Int32 &rnRoundedEdges, sal_Int32 &rnObjectLines)
Definition: Diagram.cxx:2184
OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference< css::chart2::XColorScheme > createConfigColorScheme(const css::uno::Reference< css::uno::XComponentContext > &xContext)
static void lcl_rotateLights(const ::basegfx::B3DHomMatrix &rLightRotation, Diagram &rDiagram)
Definition: Diagram.cxx:1990
static bool lcl_isRealisticScheme(drawing::ShadeMode aShadeMode, sal_Int32 nRoundedEdges, sal_Int32 nObjectLines)
Definition: Diagram.cxx:2080
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
int i
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
IMPLEMENT_FORWARD_XTYPEPROVIDER2(ChildWindowPane, ChildWindowPaneInterfaceBase, Pane)
IMPLEMENT_FORWARD_XINTERFACE2(ChildWindowPane, ChildWindowPaneInterfaceBase, Pane)
HashMap_OWString_Interface aMap
sal_Int32 nHandle
constexpr OUStringLiteral CHART2_SERVICE_NAME_CHARTTYPE_PIE
constexpr OUStringLiteral CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET
constexpr OUStringLiteral CHART2_SERVICE_NAME_CHARTTYPE_NET
functor that clones a UNO-Reference
Definition: CloneHelper.hxx:33
rtl::Reference< ::chart::ChartTypeTemplate > xChartTypeTemplate
Definition: Diagram.hxx:314
css::drawing::Direction3D aDirection
unsigned char sal_Bool
constexpr OUStringLiteral CHART_UNONAME_SORT_BY_XVALUES
Definition: unonames.hxx:14
const SvXMLTokenMapEntry aTypes[]
sal_Int32 nLength