diff options
Diffstat (limited to 'chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx')
-rw-r--r-- | chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx | 418 |
1 files changed, 204 insertions, 214 deletions
diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx index f46abaae3027..2917b989f040 100644 --- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx @@ -20,14 +20,18 @@ #include "DiagramWrapper.hxx" #include <servicenames_charttypes.hxx> #include "DataSeriesPointWrapper.hxx" +#include <DataSeriesProperties.hxx> #include "AxisWrapper.hxx" #include "Chart2ModelContact.hxx" #include "WallFloorWrapper.hxx" #include "MinMaxLineWrapper.hxx" #include "UpDownBarWrapper.hxx" +#include <Diagram.hxx> #include <DiagramHelper.hxx> #include <DataSourceHelper.hxx> #include <ChartModelHelper.hxx> +#include <ChartType.hxx> +#include <DataSeries.hxx> #include <WrappedIgnoreProperty.hxx> #include "WrappedAxisAndGridExistenceProperties.hxx" #include "WrappedStatisticProperties.hxx" @@ -43,15 +47,16 @@ #include <unonames.hxx> #include <comphelper/sequence.hxx> #include <cppuhelper/supportsservice.hxx> +#include <ChartTypeManager.hxx> +#include <ChartTypeTemplate.hxx> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/chart/ChartDataRowSource.hpp> #include <com/sun/star/chart2/RelativeSize.hpp> #include <com/sun/star/chart2/RelativePosition.hpp> -#include <com/sun/star/chart2/XChartDocument.hpp> +#include <com/sun/star/chart2/PieChartSubType.hpp> #include <com/sun/star/chart/ChartSolidType.hpp> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <LinePropertiesHelper.hxx> #include <FillProperties.hxx> @@ -62,17 +67,19 @@ #include <map> #include <com/sun/star/lang/XServiceName.hpp> #include <com/sun/star/util/XRefreshable.hpp> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> +#include <o3tl/string_view.hxx> +#include <utility> using namespace ::com::sun::star; using namespace ::chart::wrapper; +using namespace ::chart::DataSeriesProperties; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Any; using ::com::sun::star::uno::Sequence; using ::com::sun::star::beans::Property; using ::com::sun::star::chart::XAxis; -using ::osl::MutexGuard; namespace { @@ -96,6 +103,7 @@ enum PROP_DIAGRAM_SORT_BY_X_VALUES, PROP_DIAGRAM_STARTING_ANGLE, + PROP_DIAGRAM_OF_PIE_TYPE, PROP_DIAGRAM_RIGHT_ANGLED_AXES, PROP_DIAGRAM_PERSPECTIVE, @@ -132,9 +140,6 @@ enum PROP_DIAGRAM_HAS_SECOND_Y_AXIS_TITLE, PROP_DIAGRAM_AUTOMATIC_SIZE, - PROP_DIAGRAM_DATATABLEHBORDER, - PROP_DIAGRAM_DATATABLEVBORDER, - PROP_DIAGRAM_DATATABLEOUTLINE, PROP_DIAGRAM_EXTERNALDATA }; @@ -225,6 +230,11 @@ void lcl_AddPropertiesToVector( cppu::UnoType<sal_Int32>::get(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::MAYBEDEFAULT ); + rOutProperties.emplace_back( "SubPieType", + PROP_DIAGRAM_OF_PIE_TYPE, + cppu::UnoType<chart2::PieChartSubType>::get(), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::MAYBEDEFAULT ); //new for 3D charts rOutProperties.emplace_back( "RightAngledAxes", @@ -376,21 +386,7 @@ void lcl_AddPropertiesToVector( cppu::UnoType<bool>::get(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::MAYBEDEFAULT ); - rOutProperties.emplace_back( "DataTableHBorder", - PROP_DIAGRAM_DATATABLEHBORDER, - cppu::UnoType<bool>::get(), - beans::PropertyAttribute::BOUND - | beans::PropertyAttribute::MAYBEDEFAULT ); - rOutProperties.emplace_back( "DataTableVBorder", - PROP_DIAGRAM_DATATABLEVBORDER, - cppu::UnoType<bool>::get(), - beans::PropertyAttribute::BOUND - | beans::PropertyAttribute::MAYBEDEFAULT ); - rOutProperties.emplace_back( "DataTableOutline", - PROP_DIAGRAM_DATATABLEOUTLINE, - cppu::UnoType<bool>::get(), - beans::PropertyAttribute::BOUND - | beans::PropertyAttribute::MAYBEDEFAULT ); + rOutProperties.emplace_back( "ExternalData", PROP_DIAGRAM_EXTERNALDATA, cppu::UnoType<OUString>::get(), @@ -398,45 +394,35 @@ void lcl_AddPropertiesToVector( | beans::PropertyAttribute::MAYBEVOID ); } -struct StaticDiagramWrapperPropertyArray_Initializer -{ - Sequence< Property >* operator()() - { - static Sequence< Property > aPropSeq( lcl_GetPropertySequence() ); - return &aPropSeq; - } - -private: - static uno::Sequence< Property > lcl_GetPropertySequence() - { - std::vector< css::beans::Property > aProperties; - lcl_AddPropertiesToVector( aProperties ); - ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties ); - ::chart::FillProperties::AddPropertiesToVector( aProperties ); - ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties ); - ::chart::SceneProperties::AddPropertiesToVector( aProperties ); - WrappedStatisticProperties::addProperties( aProperties ); - WrappedSymbolProperties::addProperties( aProperties ); - WrappedDataCaptionProperties::addProperties( aProperties ); - WrappedSplineProperties::addProperties( aProperties ); - WrappedStockProperties::addProperties( aProperties ); - WrappedAutomaticPositionProperties::addProperties( aProperties ); - - std::sort( aProperties.begin(), aProperties.end(), - ::chart::PropertyNameLess() ); - - return comphelper::containerToSequence( aProperties ); - } -}; - -struct StaticDiagramWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticDiagramWrapperPropertyArray_Initializer > +const Sequence< Property >& StaticDiagramWrapperPropertyArray() { + static Sequence< Property > aPropSeq = []() + { + std::vector< css::beans::Property > aProperties; + lcl_AddPropertiesToVector( aProperties ); + ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties ); + ::chart::FillProperties::AddPropertiesToVector( aProperties ); + ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties ); + ::chart::SceneProperties::AddPropertiesToVector( aProperties ); + WrappedStatisticProperties::addProperties( aProperties ); + WrappedSymbolProperties::addProperties( aProperties ); + WrappedDataCaptionProperties::addProperties( aProperties ); + WrappedSplineProperties::addProperties( aProperties ); + WrappedStockProperties::addProperties( aProperties ); + WrappedAutomaticPositionProperties::addProperties( aProperties ); + + std::sort( aProperties.begin(), aProperties.end(), + ::chart::PropertyNameLess() ); + + return comphelper::containerToSequence( aProperties ); + }(); + return aPropSeq; }; -bool lcl_isXYChart( const Reference< chart2::XDiagram >& rDiagram ) +bool lcl_isXYChart( const rtl::Reference< ::chart::Diagram >& xDiagram ) { bool bRet = false; - Reference< chart2::XChartType > xChartType( ::chart::DiagramHelper::getChartTypeByIndex( rDiagram, 0 ) ); + rtl::Reference< ::chart::ChartType > xChartType( xDiagram->getChartTypeByIndex( 0 ) ); if( xChartType.is() ) { OUString aChartType( xChartType->getChartType() ); @@ -448,7 +434,7 @@ bool lcl_isXYChart( const Reference< chart2::XDiagram >& rDiagram ) sal_Int32 lcl_getNewAPIIndexForOldAPIIndex( sal_Int32 nOldAPIIndex - , const Reference< chart2::XDiagram >& xDiagram ) + , const rtl::Reference< ::chart::Diagram >& xDiagram ) { sal_Int32 nNewAPIIndex = nOldAPIIndex; @@ -458,29 +444,38 @@ sal_Int32 lcl_getNewAPIIndexForOldAPIIndex( nNewAPIIndex -= 1; } - std::vector< uno::Reference< chart2::XDataSeries > > aSeriesList( - ::chart::DiagramHelper::getDataSeriesFromDiagram( xDiagram ) ); + std::vector< rtl::Reference< ::chart::DataSeries > > aSeriesList = + xDiagram->getDataSeries(); if( nNewAPIIndex >= static_cast<sal_Int32>(aSeriesList.size()) ) nNewAPIIndex = -1; return nNewAPIIndex; } -OUString lcl_getDiagramType( const OUString & rTemplateServiceName ) +OUString lcl_getDiagramType( std::u16string_view rTemplateServiceName ) { - static const OUStringLiteral aPrefix(u"com.sun.star.chart2.template."); + static constexpr OUString aPrefix(u"com.sun.star.chart2.template."_ustr); - if( rTemplateServiceName.match( aPrefix )) + if( o3tl::starts_with(rTemplateServiceName, aPrefix) ) { - const OUString aName( rTemplateServiceName.copy( aPrefix.getLength())); + const std::u16string_view aName( rTemplateServiceName.substr( aPrefix.getLength())); // "Area" "StackedArea" "PercentStackedArea" "ThreeDArea" // "StackedThreeDArea" "PercentStackedThreeDArea" - if( aName.indexOf( "Area" ) != -1 ) + if( aName.find( u"Area" ) != std::u16string_view::npos ) return "com.sun.star.chart.AreaDiagram"; + // Handle bar-of-pie and pie-of-pie before simple pie + // "BarOfPie" + if( aName.find( u"BarOfPie" ) != std::u16string_view::npos ) + return "com.sun.star.chart.BarOfPieDiagram"; + + // "PieOfPie" + if( aName.find( u"PieOfPie" ) != std::u16string_view::npos ) + return "com.sun.star.chart.PieOfPieDiagram"; + // "Pie" "PieAllExploded" "ThreeDPie" "ThreeDPieAllExploded" - if( aName.indexOf( "Pie" ) != -1 ) + if( aName.find( u"Pie" ) != std::u16string_view::npos ) return "com.sun.star.chart.PieDiagram"; // "Column" "StackedColumn" "PercentStackedColumn" "ThreeDColumnDeep" @@ -489,33 +484,33 @@ OUString lcl_getDiagramType( const OUString & rTemplateServiceName ) // "PercentStackedBar" "ThreeDBarDeep" "ThreeDBarFlat" // "StackedThreeDBarFlat" "PercentStackedThreeDBarFlat" "ColumnWithLine" // "StackedColumnWithLine" - if( aName.indexOf( "Column" ) != -1 || aName.indexOf( "Bar" ) != -1 ) + if( aName.find( u"Column" ) != std::u16string_view::npos || aName.find( u"Bar" ) != std::u16string_view::npos ) return "com.sun.star.chart.BarDiagram"; // "Donut" "DonutAllExploded" "ThreeDDonut" "ThreeDDonutAllExploded" - if( aName.indexOf( "Donut" ) != -1 ) + if( aName.find( u"Donut" ) != std::u16string_view::npos ) return "com.sun.star.chart.DonutDiagram"; // "ScatterLineSymbol" "ScatterLine" "ScatterSymbol" "ThreeDScatter" - if( aName.indexOf( "Scatter" ) != -1 ) + if( aName.find( u"Scatter" ) != std::u16string_view::npos ) return "com.sun.star.chart.XYDiagram"; // "FilledNet" "StackedFilledNet" "PercentStackedFilledNet" - if( aName.indexOf( "FilledNet" ) != -1 ) + if( aName.find( u"FilledNet" ) != std::u16string_view::npos ) return "com.sun.star.chart.FilledNetDiagram"; // "Net" "NetSymbol" "NetLine" "StackedNet" "StackedNetSymbol" // "StackedNetLine" "PercentStackedNet" "PercentStackedNetSymbol" // "PercentStackedNetLine" - if( aName.indexOf( "Net" ) != -1 ) + if( aName.find( u"Net" ) != std::u16string_view::npos ) return "com.sun.star.chart.NetDiagram"; // "StockLowHighClose" "StockOpenLowHighClose" "StockVolumeLowHighClose" // "StockVolumeOpenLowHighClose" - if( aName.indexOf( "Stock" ) != -1 ) + if( aName.find( u"Stock" ) != std::u16string_view::npos ) return "com.sun.star.chart.StockDiagram"; - if( aName.indexOf( "Bubble" ) != -1 ) + if( aName.find( u"Bubble" ) != std::u16string_view::npos ) return "com.sun.star.chart.BubbleDiagram"; // Note: this must be checked after Bar, Net and Scatter @@ -524,7 +519,7 @@ OUString lcl_getDiagramType( const OUString & rTemplateServiceName ) // "PercentStackedLine" "LineSymbol" "StackedLineSymbol" // "PercentStackedLineSymbol" "ThreeDLine" "StackedThreeDLine" // "PercentStackedThreeDLine" "ThreeDLineDeep" - if( aName.indexOf( "Line" ) != -1 || aName.indexOf( "Symbol" ) != -1 ) + if( aName.find( u"Line" ) != std::u16string_view::npos || aName.find( u"Symbol" ) != std::u16string_view::npos ) return "com.sun.star.chart.LineDiagram"; OSL_FAIL( "unknown template" ); @@ -570,9 +565,8 @@ OUString lcl_getOldChartTypeName( const OUString & rNewChartTypeName ) namespace chart::wrapper { -DiagramWrapper::DiagramWrapper(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact) - : m_spChart2ModelContact(spChart2ModelContact) - , m_aEventListenerContainer(m_aMutex) +DiagramWrapper::DiagramWrapper(std::shared_ptr<Chart2ModelContact> spChart2ModelContact) + : m_spChart2ModelContact(std::move(spChart2ModelContact)) { } @@ -584,11 +578,11 @@ OUString SAL_CALL DiagramWrapper::getDiagramType() { OUString aRet; - Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() ); - Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() ); + rtl::Reference< ChartModel > xChartDoc( m_spChart2ModelContact->getDocumentModel() ); + rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() ); if( xChartDoc.is() && xDiagram.is() ) { - Reference< beans::XPropertySet > xChartDocProp( xChartDoc, uno::UNO_QUERY ); + Reference< beans::XPropertySet > xChartDocProp( static_cast<cppu::OWeakObject*>(xChartDoc.get()), uno::UNO_QUERY ); if( xChartDocProp.is() ) { uno::Reference< util::XRefreshable > xAddIn; @@ -600,27 +594,30 @@ OUString SAL_CALL DiagramWrapper::getDiagramType() } } - Reference< lang::XMultiServiceFactory > xChartTypeManager( xChartDoc->getChartTypeManager(), uno::UNO_QUERY ); - DiagramHelper::tTemplateWithServiceName aTemplateAndService = - DiagramHelper::getTemplateForDiagram( xDiagram, xChartTypeManager ); + rtl::Reference< ::chart::ChartTypeManager > xChartTypeManager = xChartDoc->getTypeManager(); + Diagram::tTemplateWithServiceName aTemplateAndService = + xDiagram->getTemplate( xChartTypeManager ); - aRet = lcl_getDiagramType( aTemplateAndService.second ); + aRet = lcl_getDiagramType( aTemplateAndService.sServiceName ); } - if( aRet.isEmpty()) + if( !aRet.isEmpty()) + return aRet; + + // none of the standard templates matched + // use first chart type + if (xDiagram) { - // none of the standard templates matched - // use first chart type - Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) ); + rtl::Reference< ChartType > xChartType( xDiagram->getChartTypeByIndex( 0 ) ); if( xChartType.is() ) { aRet = xChartType->getChartType(); if( !aRet.isEmpty() ) aRet = lcl_getOldChartTypeName( aRet ); } - if( aRet.isEmpty()) - aRet = "com.sun.star.chart.BarDiagram"; } + if( aRet.isEmpty()) + aRet = "com.sun.star.chart.BarDiagram"; return aRet; } @@ -632,7 +629,7 @@ Reference< throw lang::IndexOutOfBoundsException("DataSeries index invalid", static_cast< ::cppu::OWeakObject * >( this )); - sal_Int32 nNewAPIIndex = lcl_getNewAPIIndexForOldAPIIndex( nRow, m_spChart2ModelContact->getChart2Diagram() ); + sal_Int32 nNewAPIIndex = lcl_getNewAPIIndexForOldAPIIndex( nRow, m_spChart2ModelContact->getDiagram() ); if( nNewAPIIndex < 0 ) throw lang::IndexOutOfBoundsException("DataSeries index invalid", static_cast< ::cppu::OWeakObject * >( this )); @@ -649,7 +646,7 @@ Reference< throw lang::IndexOutOfBoundsException("DataSeries index invalid", static_cast< ::cppu::OWeakObject * >( this )); - sal_Int32 nNewAPIIndex = lcl_getNewAPIIndexForOldAPIIndex( nRow, m_spChart2ModelContact->getChart2Diagram() ); + sal_Int32 nNewAPIIndex = lcl_getNewAPIIndexForOldAPIIndex( nRow, m_spChart2ModelContact->getDiagram() ); if( nNewAPIIndex < 0 ) throw lang::IndexOutOfBoundsException("DataSeries index invalid", static_cast< ::cppu::OWeakObject * >( this )); @@ -671,7 +668,7 @@ awt::Point SAL_CALL DiagramWrapper::getPosition() void SAL_CALL DiagramWrapper::setPosition( const awt::Point& aPosition ) { - ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getChartModel() ); + ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getDocumentModel() ); Reference< beans::XPropertySet > xProp( getInnerPropertySet() ); if( !xProp.is() ) return; @@ -701,7 +698,7 @@ awt::Size SAL_CALL DiagramWrapper::getSize() void SAL_CALL DiagramWrapper::setSize( const awt::Size& aSize ) { - ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getChartModel() ); + ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getDocumentModel() ); Reference< beans::XPropertySet > xProp( getInnerPropertySet() ); if( !xProp.is() ) return; @@ -734,7 +731,7 @@ OUString SAL_CALL DiagramWrapper::getShapeType() void SAL_CALL DiagramWrapper::setAutomaticDiagramPositioning() { - ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getChartModel() ); + ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getDocumentModel() ); uno::Reference< beans::XPropertySet > xDiaProps( getDiagram(), uno::UNO_QUERY ); if( xDiaProps.is() ) { @@ -756,8 +753,8 @@ sal_Bool SAL_CALL DiagramWrapper::isAutomaticDiagramPositioning( ) } void SAL_CALL DiagramWrapper::setDiagramPositionExcludingAxes( const awt::Rectangle& rPositionRect ) { - ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getChartModel() ); - DiagramHelper::setDiagramPositioning( m_spChart2ModelContact->getChartModel(), rPositionRect ); + ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getDocumentModel() ); + DiagramHelper::setDiagramPositioning( m_spChart2ModelContact->getDocumentModel(), rPositionRect ); uno::Reference< beans::XPropertySet > xDiaProps( getDiagram(), uno::UNO_QUERY ); if( xDiaProps.is() ) xDiaProps->setPropertyValue("PosSizeExcludeAxes", uno::Any(true) ); @@ -784,8 +781,8 @@ awt::Rectangle SAL_CALL DiagramWrapper::calculateDiagramPositionExcludingAxes( } void SAL_CALL DiagramWrapper::setDiagramPositionIncludingAxes( const awt::Rectangle& rPositionRect ) { - ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getChartModel() ); - DiagramHelper::setDiagramPositioning( m_spChart2ModelContact->getChartModel(), rPositionRect ); + ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getDocumentModel() ); + DiagramHelper::setDiagramPositioning( m_spChart2ModelContact->getDocumentModel(), rPositionRect ); uno::Reference< beans::XPropertySet > xDiaProps( getDiagram(), uno::UNO_QUERY ); if( xDiaProps.is() ) xDiaProps->setPropertyValue("PosSizeExcludeAxes", uno::Any(false) ); @@ -796,7 +793,7 @@ awt::Rectangle SAL_CALL DiagramWrapper::calculateDiagramPositionIncludingAxes( } void SAL_CALL DiagramWrapper::setDiagramPositionIncludingAxesAndAxisTitles( const awt::Rectangle& rPositionRect ) { - ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getChartModel() ); + ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getDocumentModel() ); awt::Rectangle aRect( m_spChart2ModelContact->SubstractAxisTitleSizes(rPositionRect) ); DiagramWrapper::setDiagramPositionIncludingAxes( aRect ); } @@ -1042,21 +1039,21 @@ Reference< // ____ X3DDefaultSetter ____ void SAL_CALL DiagramWrapper::set3DSettingsToDefault() { - Reference< X3DDefaultSetter > x3DDefaultSetter( m_spChart2ModelContact->getChart2Diagram(), uno::UNO_QUERY ); + rtl::Reference< ::chart::Diagram > x3DDefaultSetter( m_spChart2ModelContact->getDiagram() ); if( x3DDefaultSetter.is() ) x3DDefaultSetter->set3DSettingsToDefault(); } void SAL_CALL DiagramWrapper::setDefaultRotation() { - Reference< X3DDefaultSetter > x3DDefaultSetter( m_spChart2ModelContact->getChart2Diagram(), uno::UNO_QUERY ); + rtl::Reference< ::chart::Diagram > x3DDefaultSetter( m_spChart2ModelContact->getDiagram() ); if( x3DDefaultSetter.is() ) x3DDefaultSetter->setDefaultRotation(); } void SAL_CALL DiagramWrapper::setDefaultIllumination() { - Reference< X3DDefaultSetter > x3DDefaultSetter( m_spChart2ModelContact->getChart2Diagram(), uno::UNO_QUERY ); + rtl::Reference< ::chart::Diagram > x3DDefaultSetter( m_spChart2ModelContact->getDiagram() ); if( x3DDefaultSetter.is() ) x3DDefaultSetter->setDefaultIllumination(); } @@ -1064,9 +1061,8 @@ void SAL_CALL DiagramWrapper::setDefaultIllumination() // ____ XComponent ____ void SAL_CALL DiagramWrapper::dispose() { - m_aEventListenerContainer.disposeAndClear( lang::EventObject( static_cast< ::cppu::OWeakObject* >( this ))); - - MutexGuard aGuard( m_aMutex); + std::unique_lock g(m_aMutex); + m_aEventListenerContainer.disposeAndClear( g, lang::EventObject( static_cast< ::cppu::OWeakObject* >( this ))); DisposeHelper::DisposeAndClear( m_xXAxis ); DisposeHelper::DisposeAndClear( m_xYAxis ); @@ -1085,13 +1081,15 @@ void SAL_CALL DiagramWrapper::dispose() void SAL_CALL DiagramWrapper::addEventListener( const Reference< lang::XEventListener >& xListener ) { - m_aEventListenerContainer.addInterface( xListener ); + std::unique_lock g(m_aMutex); + m_aEventListenerContainer.addInterface( g, xListener ); } void SAL_CALL DiagramWrapper::removeEventListener( const Reference< lang::XEventListener >& aListener ) { - m_aEventListenerContainer.removeInterface( aListener ); + std::unique_lock g(m_aMutex); + m_aEventListenerContainer.removeInterface( g, aListener ); } namespace { @@ -1100,7 +1098,7 @@ namespace { class WrappedDataRowSourceProperty : public WrappedProperty { public: - explicit WrappedDataRowSourceProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact); + explicit WrappedDataRowSourceProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact); virtual void setPropertyValue( const css::uno::Any& rOuterValue, const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const override; @@ -1115,9 +1113,9 @@ private: //member } -WrappedDataRowSourceProperty::WrappedDataRowSourceProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact) +WrappedDataRowSourceProperty::WrappedDataRowSourceProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact) : WrappedProperty("DataRowSource",OUString()) - , m_spChart2ModelContact( spChart2ModelContact ) + , m_spChart2ModelContact(std::move( spChart2ModelContact )) { m_aOuterValue = WrappedDataRowSourceProperty::getPropertyDefault( nullptr ); } @@ -1144,14 +1142,14 @@ void WrappedDataRowSourceProperty::setPropertyValue( const Any& rOuterValue, con uno::Sequence< sal_Int32 > aSequenceMapping; if( DataSourceHelper::detectRangeSegmentation( - m_spChart2ModelContact->getChartModel(), aRangeString, aSequenceMapping, bUseColumns + m_spChart2ModelContact->getDocumentModel(), aRangeString, aSequenceMapping, bUseColumns , bFirstCellAsLabel, bHasCategories ) ) { if( bUseColumns != bNewUseColumns ) { aSequenceMapping.realloc(0); DataSourceHelper::setRangeSegmentation( - m_spChart2ModelContact->getChartModel(), aSequenceMapping, bNewUseColumns , bFirstCellAsLabel , bHasCategories); + m_spChart2ModelContact->getDocumentModel(), aSequenceMapping, bNewUseColumns , bFirstCellAsLabel , bHasCategories); } } } @@ -1165,7 +1163,7 @@ Any WrappedDataRowSourceProperty::getPropertyValue( const Reference< beans::XPro uno::Sequence< sal_Int32 > aSequenceMapping; if( DataSourceHelper::detectRangeSegmentation( - m_spChart2ModelContact->getChartModel(), aRangeString, aSequenceMapping, bUseColumns + m_spChart2ModelContact->getDocumentModel(), aRangeString, aSequenceMapping, bUseColumns , bFirstCellAsLabel, bHasCategories ) ) { css::chart::ChartDataRowSource eChartDataRowSource = css::chart::ChartDataRowSource_ROWS; @@ -1193,7 +1191,7 @@ namespace { class WrappedStackingProperty : public WrappedProperty { public: - WrappedStackingProperty(StackMode eStackMode, const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact); + WrappedStackingProperty(StackMode eStackMode, std::shared_ptr<Chart2ModelContact> spChart2ModelContact); virtual void setPropertyValue( const css::uno::Any& rOuterValue, const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const override; @@ -1212,9 +1210,9 @@ std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; } -WrappedStackingProperty::WrappedStackingProperty(StackMode eStackMode, const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact) +WrappedStackingProperty::WrappedStackingProperty(StackMode eStackMode, std::shared_ptr<Chart2ModelContact> spChart2ModelContact) : WrappedProperty(OUString(),OUString()) - , m_spChart2ModelContact( spChart2ModelContact ) + , m_spChart2ModelContact(std::move( spChart2ModelContact )) , m_eStackMode( eStackMode ) { switch( m_eStackMode ) @@ -1238,8 +1236,8 @@ bool WrappedStackingProperty::detectInnerValue( StackMode& eStackMode ) const { bool bHasDetectableInnerValue = false; bool bIsAmbiguous = false; - eStackMode = DiagramHelper::getStackMode( m_spChart2ModelContact->getChart2Diagram() - , bHasDetectableInnerValue, bIsAmbiguous ); + rtl::Reference<Diagram> xDiagram = m_spChart2ModelContact->getDiagram(); + eStackMode = xDiagram ? xDiagram->getStackMode( bHasDetectableInnerValue, bIsAmbiguous ) : StackMode::NONE; return bHasDetectableInnerValue; } @@ -1263,11 +1261,11 @@ void WrappedStackingProperty::setPropertyValue( const Any& rOuterValue, const Re if( !bNewValue && eInnerStackMode != m_eStackMode ) return; - Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() ); + rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() ); if( xDiagram.is() ) { StackMode eNewStackMode = bNewValue ? m_eStackMode : StackMode::NONE; - DiagramHelper::setStackMode( xDiagram, eNewStackMode ); + xDiagram->setStackMode( eNewStackMode ); } } @@ -1295,7 +1293,7 @@ namespace { class WrappedDim3DProperty : public WrappedProperty { public: - explicit WrappedDim3DProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact); + explicit WrappedDim3DProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact); virtual void setPropertyValue( const css::uno::Any& rOuterValue, const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const override; @@ -1310,9 +1308,9 @@ private: //member } -WrappedDim3DProperty::WrappedDim3DProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact) +WrappedDim3DProperty::WrappedDim3DProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact) : WrappedProperty("Dim3D",OUString()) - , m_spChart2ModelContact( spChart2ModelContact ) + , m_spChart2ModelContact(std::move( spChart2ModelContact )) { m_aOuterValue = WrappedDim3DProperty::getPropertyDefault( nullptr ); } @@ -1325,21 +1323,21 @@ void WrappedDim3DProperty::setPropertyValue( const Any& rOuterValue, const Refer m_aOuterValue = rOuterValue; - Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() ); + rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() ); if( !xDiagram.is() ) return; - bool bOld3D = DiagramHelper::getDimension( xDiagram ) == 3; + bool bOld3D = xDiagram->getDimension() == 3; if( bOld3D != bNew3D ) - DiagramHelper::setDimension( xDiagram, bNew3D ? 3 : 2 ); + xDiagram->setDimension( bNew3D ? 3 : 2 ); } Any WrappedDim3DProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const { - Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() ); + rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() ); if( xDiagram.is() ) { - bool b3D = DiagramHelper::getDimension( xDiagram ) == 3; + bool b3D = xDiagram->getDimension() == 3; m_aOuterValue <<= b3D; } return m_aOuterValue; @@ -1358,7 +1356,7 @@ namespace { class WrappedVerticalProperty : public WrappedProperty { public: - explicit WrappedVerticalProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact); + explicit WrappedVerticalProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact); virtual void setPropertyValue( const css::uno::Any& rOuterValue, const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const override; @@ -1373,9 +1371,9 @@ private: //member } -WrappedVerticalProperty::WrappedVerticalProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact) +WrappedVerticalProperty::WrappedVerticalProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact) : WrappedProperty("Vertical",OUString()) - , m_spChart2ModelContact( spChart2ModelContact ) + , m_spChart2ModelContact(std::move( spChart2ModelContact )) { m_aOuterValue = WrappedVerticalProperty::getPropertyDefault( nullptr ); } @@ -1388,25 +1386,25 @@ void WrappedVerticalProperty::setPropertyValue( const Any& rOuterValue, const Re m_aOuterValue = rOuterValue; - Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() ); + rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() ); if( !xDiagram.is() ) return; bool bFound = false; bool bAmbiguous = false; - bool bOldVertical = DiagramHelper::getVertical( xDiagram, bFound, bAmbiguous ); + bool bOldVertical = xDiagram->getVertical( bFound, bAmbiguous ); if( bFound && ( bOldVertical != bNewVertical || bAmbiguous ) ) - DiagramHelper::setVertical( xDiagram, bNewVertical ); + xDiagram->setVertical( bNewVertical ); } Any WrappedVerticalProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const { - Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() ); + rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() ); if( xDiagram.is() ) { bool bFound = false; bool bAmbiguous = false; - bool bVertical = DiagramHelper::getVertical( xDiagram, bFound, bAmbiguous ); + bool bVertical = xDiagram->getVertical( bFound, bAmbiguous ); if( bFound ) m_aOuterValue <<= bVertical; } @@ -1426,7 +1424,7 @@ namespace { class WrappedNumberOfLinesProperty : public WrappedProperty { public: - explicit WrappedNumberOfLinesProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact); + explicit WrappedNumberOfLinesProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact); virtual void setPropertyValue( const css::uno::Any& rOuterValue, const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const override; @@ -1444,9 +1442,9 @@ private: //member } -WrappedNumberOfLinesProperty::WrappedNumberOfLinesProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact) +WrappedNumberOfLinesProperty::WrappedNumberOfLinesProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact) : WrappedProperty("NumberOfLines",OUString()) - , m_spChart2ModelContact( spChart2ModelContact ) + , m_spChart2ModelContact(std::move( spChart2ModelContact )) , m_aOuterValue( getPropertyDefault(nullptr) ) { } @@ -1455,22 +1453,22 @@ bool WrappedNumberOfLinesProperty::detectInnerValue( uno::Any& rInnerValue ) con { sal_Int32 nNumberOfLines = 0; bool bHasDetectableInnerValue = false; - Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() ); - uno::Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() ); + rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() ); + rtl::Reference< ChartModel > xChartDoc( m_spChart2ModelContact->getDocumentModel() ); if( xDiagram.is() && xChartDoc.is() ) { - std::vector< uno::Reference< chart2::XDataSeries > > aSeriesVector( - DiagramHelper::getDataSeriesFromDiagram( xDiagram ) ); + std::vector< rtl::Reference< DataSeries > > aSeriesVector = + xDiagram->getDataSeries(); if( !aSeriesVector.empty() ) { - Reference< lang::XMultiServiceFactory > xFact( xChartDoc->getChartTypeManager(), uno::UNO_QUERY ); - DiagramHelper::tTemplateWithServiceName aTemplateAndService = - DiagramHelper::getTemplateForDiagram( xDiagram, xFact ); - if( aTemplateAndService.second == "com.sun.star.chart2.template.ColumnWithLine" ) + rtl::Reference< ::chart::ChartTypeManager > xChartTypeManager = xChartDoc->getTypeManager(); + Diagram::tTemplateWithServiceName aTemplateAndService = + xDiagram->getTemplate( xChartTypeManager ); + if( aTemplateAndService.sServiceName == "com.sun.star.chart2.template.ColumnWithLine" ) { try { - uno::Reference< beans::XPropertySet > xProp( aTemplateAndService.first, uno::UNO_QUERY ); + uno::Reference< beans::XPropertySet > xProp( static_cast<cppu::OWeakObject*>(aTemplateAndService.xChartTypeTemplate.get()), uno::UNO_QUERY ); xProp->getPropertyValue( m_aOuterName ) >>= nNumberOfLines; bHasDetectableInnerValue = true; } @@ -1494,26 +1492,28 @@ void WrappedNumberOfLinesProperty::setPropertyValue( const Any& rOuterValue, con m_aOuterValue = rOuterValue; - uno::Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() ); - Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() ); - sal_Int32 nDimension = ::chart::DiagramHelper::getDimension( xDiagram ); - if( !(xChartDoc.is() && xDiagram.is() && nDimension == 2) ) + rtl::Reference< ChartModel > xChartDoc( m_spChart2ModelContact->getDocumentModel() ); + rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() ); + if( !xChartDoc || !xDiagram ) + return; + sal_Int32 nDimension = xDiagram->getDimension(); + if( nDimension != 2 ) return; - Reference< lang::XMultiServiceFactory > xFact( xChartDoc->getChartTypeManager(), uno::UNO_QUERY ); - DiagramHelper::tTemplateWithServiceName aTemplateAndService = - DiagramHelper::getTemplateForDiagram( xDiagram, xFact ); + rtl::Reference< ::chart::ChartTypeManager > xChartTypeManager = xChartDoc->getTypeManager(); + Diagram::tTemplateWithServiceName aTemplateAndService = + xDiagram->getTemplate( xChartTypeManager ); - uno::Reference< chart2::XChartTypeTemplate > xTemplate; - if( aTemplateAndService.second == "com.sun.star.chart2.template.ColumnWithLine" ) + rtl::Reference< ChartTypeTemplate > xTemplate; + if( aTemplateAndService.sServiceName == "com.sun.star.chart2.template.ColumnWithLine" ) { if( nNewValue != 0 ) { - xTemplate.set( aTemplateAndService.first ); + xTemplate = aTemplateAndService.xChartTypeTemplate; try { sal_Int32 nOldValue = 0; - uno::Reference< beans::XPropertySet > xProp( xTemplate, uno::UNO_QUERY ); + uno::Reference< beans::XPropertySet > xProp( static_cast<cppu::OWeakObject*>(xTemplate.get()), uno::UNO_QUERY ); xProp->getPropertyValue( m_aOuterName ) >>= nOldValue; if( nOldValue == nNewValue ) return; @@ -1525,14 +1525,14 @@ void WrappedNumberOfLinesProperty::setPropertyValue( const Any& rOuterValue, con } else { - xTemplate.set( xFact->createInstance("com.sun.star.chart2.template.Column"), uno::UNO_QUERY ); + xTemplate = xChartTypeManager->createTemplate("com.sun.star.chart2.template.Column"); } } - else if( aTemplateAndService.second == "com.sun.star.chart2.template.Column" ) + else if( aTemplateAndService.sServiceName == "com.sun.star.chart2.template.Column" ) { if( nNewValue == 0 ) return; - xTemplate.set( xFact->createInstance( "com.sun.star.chart2.template.ColumnWithLine" ), uno::UNO_QUERY ); + xTemplate = xChartTypeManager->createTemplate( "com.sun.star.chart2.template.ColumnWithLine" ); } if(!xTemplate.is()) @@ -1541,8 +1541,8 @@ void WrappedNumberOfLinesProperty::setPropertyValue( const Any& rOuterValue, con try { // locked controllers - ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getChartModel() ); - uno::Reference< beans::XPropertySet > xProp( xTemplate, uno::UNO_QUERY ); + ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getDocumentModel() ); + uno::Reference< beans::XPropertySet > xProp( static_cast<cppu::OWeakObject*>(xTemplate.get()), uno::UNO_QUERY ); xProp->setPropertyValue( "NumberOfLines", uno::Any(nNewValue) ); xTemplate->changeDiagram( xDiagram ); } @@ -1573,7 +1573,7 @@ namespace { class WrappedAttributedDataPointsProperty : public WrappedProperty { public: - explicit WrappedAttributedDataPointsProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact); + explicit WrappedAttributedDataPointsProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact); virtual void setPropertyValue( const css::uno::Any& rOuterValue, const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const override; @@ -1588,9 +1588,9 @@ private: //member } -WrappedAttributedDataPointsProperty::WrappedAttributedDataPointsProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact) +WrappedAttributedDataPointsProperty::WrappedAttributedDataPointsProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact) : WrappedProperty("AttributedDataPoints",OUString()) - , m_spChart2ModelContact( spChart2ModelContact ) + , m_spChart2ModelContact(std::move( spChart2ModelContact )) { m_aOuterValue = WrappedAttributedDataPointsProperty::getPropertyDefault( nullptr ); } @@ -1603,59 +1603,49 @@ void WrappedAttributedDataPointsProperty::setPropertyValue( const Any& rOuterVal m_aOuterValue = rOuterValue; - Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() ); - Reference< beans::XPropertySet > xDiaProp( xDiagram, uno::UNO_QUERY ); + rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() ); - if( !(xDiagram.is() && xDiaProp.is())) + if( !xDiagram ) return; - std::vector< Reference< chart2::XDataSeries > > aSeriesVector( - ::chart::DiagramHelper::getDataSeriesFromDiagram( xDiagram ) ); + std::vector< rtl::Reference< DataSeries > > aSeriesVector = + xDiagram->getDataSeries(); sal_Int32 i = 0; for (auto const& series : aSeriesVector) { - Reference< beans::XPropertySet > xProp(series, uno::UNO_QUERY); - if( xProp.is()) + uno::Any aVal; + if( i < aNewValue.getLength() ) + aVal <<= aNewValue[i]; + else { - uno::Any aVal; - if( i < aNewValue.getLength() ) - aVal <<= aNewValue[i]; - else - { - //set empty sequence - uno::Sequence< sal_Int32 > aSeq; - aVal <<= aSeq; - } - xProp->setPropertyValue( "AttributedDataPoints", aVal ); + //set empty sequence + uno::Sequence< sal_Int32 > aSeq; + aVal <<= aSeq; } + series->setFastPropertyValue( PROP_DATASERIES_ATTRIBUTED_DATA_POINTS, aVal ); // "AttributedDataPoints" ++i; } } Any WrappedAttributedDataPointsProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const { - Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() ); - Reference< beans::XPropertySet > xDiaProp( xDiagram, uno::UNO_QUERY ); + rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() ); - if( xDiagram.is() && xDiaProp.is()) + if( xDiagram ) { - std::vector< Reference< chart2::XDataSeries > > aSeriesVector( - ::chart::DiagramHelper::getDataSeriesFromDiagram( xDiagram ) ); + std::vector< rtl::Reference< DataSeries > > aSeriesVector = + xDiagram->getDataSeries(); uno::Sequence< uno::Sequence< sal_Int32 > > aResult( aSeriesVector.size() ); auto aResultRange = asNonConstRange(aResult); sal_Int32 i = 0; for (auto const& series : aSeriesVector) { - Reference< beans::XPropertySet > xProp(series, uno::UNO_QUERY); - if( xProp.is()) - { - uno::Any aVal( - xProp->getPropertyValue("AttributedDataPoints")); - uno::Sequence< sal_Int32 > aSeq; - if( aVal >>= aSeq ) - aResultRange[ i ] = aSeq; - } + uno::Any aVal( + series->getFastPropertyValue(PROP_DATASERIES_ATTRIBUTED_DATA_POINTS)); // "AttributedDataPoints" + uno::Sequence< sal_Int32 > aSeq; + if( aVal >>= aSeq ) + aResultRange[ i ] = aSeq; ++i; } m_aOuterValue <<= aResult; @@ -1677,7 +1667,7 @@ namespace { class WrappedSolidTypeProperty : public WrappedProperty { public: - explicit WrappedSolidTypeProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact); + explicit WrappedSolidTypeProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact); virtual void setPropertyValue( const css::uno::Any& rOuterValue, const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const override; @@ -1692,9 +1682,9 @@ private: //member } -WrappedSolidTypeProperty::WrappedSolidTypeProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact) +WrappedSolidTypeProperty::WrappedSolidTypeProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact) : WrappedProperty( "SolidType", OUString() ) - , m_spChart2ModelContact( spChart2ModelContact ) + , m_spChart2ModelContact(std::move( spChart2ModelContact )) { m_aOuterValue = WrappedSolidTypeProperty::getPropertyDefault( nullptr ); } @@ -1707,25 +1697,25 @@ void WrappedSolidTypeProperty::setPropertyValue( const Any& rOuterValue, const R m_aOuterValue = rOuterValue; - Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() ); + rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() ); if( !xDiagram.is() ) return; bool bFound = false; bool bAmbiguous = false; - sal_Int32 nOldSolidType = DiagramHelper::getGeometry3D( xDiagram, bFound, bAmbiguous ); + sal_Int32 nOldSolidType = xDiagram->getGeometry3D( bFound, bAmbiguous ); if( bFound && ( nOldSolidType != nNewSolidType || bAmbiguous ) ) - DiagramHelper::setGeometry3D( xDiagram, nNewSolidType ); + xDiagram->setGeometry3D( nNewSolidType ); } Any WrappedSolidTypeProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const { - Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() ); + rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() ); if( xDiagram.is() ) { bool bFound = false; bool bAmbiguous = false; - sal_Int32 nGeometry = DiagramHelper::getGeometry3D( xDiagram, bFound, bAmbiguous ); + sal_Int32 nGeometry = xDiagram->getGeometry3D( bFound, bAmbiguous ); if( bFound ) m_aOuterValue <<= nGeometry; } @@ -1807,7 +1797,7 @@ namespace { class WrappedIncludeHiddenCellsProperty : public WrappedProperty { public: - explicit WrappedIncludeHiddenCellsProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact); + explicit WrappedIncludeHiddenCellsProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact); virtual void setPropertyValue( const css::uno::Any& rOuterValue, const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const override; virtual Any getPropertyValue(const Reference<beans::XPropertySet>& xInnerPropertySet) const override; @@ -1818,9 +1808,9 @@ private: //member } -WrappedIncludeHiddenCellsProperty::WrappedIncludeHiddenCellsProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact) +WrappedIncludeHiddenCellsProperty::WrappedIncludeHiddenCellsProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact) : WrappedProperty("IncludeHiddenCells","IncludeHiddenCells") - , m_spChart2ModelContact( spChart2ModelContact ) + , m_spChart2ModelContact(std::move( spChart2ModelContact )) { } @@ -1830,19 +1820,19 @@ void WrappedIncludeHiddenCellsProperty::setPropertyValue( const Any& rOuterValue if( ! (rOuterValue >>= bNewValue) ) throw lang::IllegalArgumentException( "Property IncludeHiddenCells requires boolean value", nullptr, 0 ); - ChartModelHelper::setIncludeHiddenCells( bNewValue, *m_spChart2ModelContact->getModel() ); + ChartModelHelper::setIncludeHiddenCells( bNewValue, *m_spChart2ModelContact->getDocumentModel() ); } Any WrappedIncludeHiddenCellsProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const { - bool bValue = ChartModelHelper::isIncludeHiddenCells( m_spChart2ModelContact->getChartModel() ); + bool bValue = ChartModelHelper::isIncludeHiddenCells( m_spChart2ModelContact->getDocumentModel() ); return uno::Any(bValue); } // ____ XDiagramProvider ____ Reference< chart2::XDiagram > SAL_CALL DiagramWrapper::getDiagram() { - return m_spChart2ModelContact->getChart2Diagram(); + return m_spChart2ModelContact->getDiagram(); } void SAL_CALL DiagramWrapper::setDiagram( @@ -1854,12 +1844,12 @@ void SAL_CALL DiagramWrapper::setDiagram( Reference< beans::XPropertySet > DiagramWrapper::getInnerPropertySet() { - return Reference< beans::XPropertySet >( m_spChart2ModelContact->getChart2Diagram(), uno::UNO_QUERY ); + return m_spChart2ModelContact->getDiagram(); } const Sequence< beans::Property >& DiagramWrapper::getPropertySequence() { - return *StaticDiagramWrapperPropertyArray::get(); + return StaticDiagramWrapperPropertyArray(); } std::vector< std::unique_ptr<WrappedProperty> > DiagramWrapper::createWrappedProperties() |