diff options
Diffstat (limited to 'chart2/source/controller/dialogs/TitleDialogData.cxx')
-rw-r--r-- | chart2/source/controller/dialogs/TitleDialogData.cxx | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/chart2/source/controller/dialogs/TitleDialogData.cxx b/chart2/source/controller/dialogs/TitleDialogData.cxx index 7f48d90a0b24..45dda2c897b0 100644 --- a/chart2/source/controller/dialogs/TitleDialogData.cxx +++ b/chart2/source/controller/dialogs/TitleDialogData.cxx @@ -19,11 +19,8 @@ #include <sal/config.h> -#include <com/sun/star/frame/XModel.hpp> - #include <TitleDialogData.hxx> #include <TitleHelper.hxx> -#include <ChartModelHelper.hxx> #include <Diagram.hxx> #include <AxisHelper.hxx> #include <ChartModel.hxx> @@ -33,7 +30,7 @@ namespace chart using namespace ::com::sun::star; using namespace ::com::sun::star::chart2; -TitleDialogData::TitleDialogData( std::unique_ptr<ReferenceSizeProvider> pRefSizeProvider ) +TitleDialogData::TitleDialogData( std::optional<ReferenceSizeProvider> pRefSizeProvider ) : aPossibilityList{ true, true, true, true, true, true, true } , aExistenceList{ false, false, false, false, false, false, false } , aTextList(7) @@ -43,7 +40,7 @@ TitleDialogData::TitleDialogData( std::unique_ptr<ReferenceSizeProvider> pRefSiz void TitleDialogData::readFromModel( const rtl::Reference<::chart::ChartModel>& xChartModel ) { - rtl::Reference< Diagram > xDiagram = ChartModelHelper::findDiagram(xChartModel); + rtl::Reference< Diagram > xDiagram = xChartModel->getFirstChartDiagram(); //get possibilities uno::Sequence< sal_Bool > aAxisPossibilityList; @@ -59,11 +56,11 @@ void TitleDialogData::readFromModel( const rtl::Reference<::chart::ChartModel>& auto pTextList = aTextList.getArray(); //find out which title exists and get their text //main title: - for( sal_Int32 nTitleIndex = static_cast< sal_Int32 >( TitleHelper::TITLE_BEGIN); - nTitleIndex < static_cast< sal_Int32 >( TitleHelper::NORMAL_TITLE_END ); + for( auto nTitleIndex = +TitleHelper::TITLE_BEGIN; + nTitleIndex < +TitleHelper::NORMAL_TITLE_END; nTitleIndex++) { - uno::Reference< XTitle > xTitle = TitleHelper::getTitle( + rtl::Reference< Title > xTitle = TitleHelper::getTitle( static_cast< TitleHelper::eTitleType >( nTitleIndex ), xChartModel ); pExistenceList[nTitleIndex] = xTitle.is(); pTextList[nTitleIndex]=TitleHelper::getCompleteString( xTitle ); @@ -73,11 +70,11 @@ void TitleDialogData::readFromModel( const rtl::Reference<::chart::ChartModel>& bool TitleDialogData::writeDifferenceToModel( const rtl::Reference<::chart::ChartModel>& xChartModel , const uno::Reference< uno::XComponentContext >& xContext - , TitleDialogData* pOldState ) + , const TitleDialogData* pOldState ) { bool bChanged = false; - for( sal_Int32 nN = static_cast< sal_Int32 >( TitleHelper::TITLE_BEGIN ); - nN < static_cast< sal_Int32 >( TitleHelper::NORMAL_TITLE_END ); + for( auto nN = +TitleHelper::TITLE_BEGIN; + nN < +TitleHelper::NORMAL_TITLE_END; nN++) { if( !pOldState || ( pOldState->aExistenceList[nN] != aExistenceList[nN] ) ) @@ -86,7 +83,7 @@ bool TitleDialogData::writeDifferenceToModel( { TitleHelper::createTitle( static_cast< TitleHelper::eTitleType >( nN ), aTextList[nN], xChartModel, xContext, - apReferenceSizeProvider.get() ); + apReferenceSizeProvider.has_value() ? &*apReferenceSizeProvider : nullptr ); bChanged = true; } else @@ -98,7 +95,7 @@ bool TitleDialogData::writeDifferenceToModel( else if( !pOldState || ( pOldState->aTextList[nN] != aTextList[nN] ) ) { //change content - uno::Reference< XTitle > xTitle( + rtl::Reference< Title > xTitle( TitleHelper::getTitle( static_cast< TitleHelper::eTitleType >( nN ), xChartModel ) ); if(xTitle.is()) { |