diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-07-21 23:11:49 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-07-21 23:12:34 -0400 |
commit | 998ab5c405963accf47afc69a6bf04e045f6f71f (patch) | |
tree | 4ac3253b0e6e2eb8dac2056367ef72ea81ec0b78 /chart2/source/controller/main | |
parent | 9e970303ddcccd9e33641f8f00bbc4c739a58cd7 (diff) |
More on removing (unreasonable) use of std::auto_ptr.
Change-Id: I98f5fb22eecb7749e4c86e1ce52965b0c73641ca
Diffstat (limited to 'chart2/source/controller/main')
4 files changed, 32 insertions, 45 deletions
diff --git a/chart2/source/controller/main/ChartController.hxx b/chart2/source/controller/main/ChartController.hxx index ee8b60ae8f99..a75f8638d182 100644 --- a/chart2/source/controller/main/ChartController.hxx +++ b/chart2/source/controller/main/ChartController.hxx @@ -534,7 +534,7 @@ private: //private methods bool impl_isDisposedOrSuspended() const; - ::std::auto_ptr< ReferenceSizeProvider > impl_createReferenceSizeProvider(); + ReferenceSizeProvider* impl_createReferenceSizeProvider(); void impl_adaptDataSeriesAutoResize(); void impl_createDrawViewController(); diff --git a/chart2/source/controller/main/ChartController_Insert.cxx b/chart2/source/controller/main/ChartController_Insert.cxx index 1111bbe8cd46..7c83ecc569fc 100644 --- a/chart2/source/controller/main/ChartController_Insert.cxx +++ b/chart2/source/controller/main/ChartController_Insert.cxx @@ -184,7 +184,7 @@ void ChartController::executeDispatch_InsertTitles() { // lock controllers till end of block ControllerLockGuardUNO aCLGuard( getModel() ); - TitleDialogData aDialogOutput( impl_createReferenceSizeProvider().release()); + TitleDialogData aDialogOutput(impl_createReferenceSizeProvider()); aDlg.getResult( aDialogOutput ); bool bChanged = aDialogOutput.writeDifferenceToModel( getModel(), m_xCC, &aDialogInput ); if( bChanged ) diff --git a/chart2/source/controller/main/ChartController_Properties.cxx b/chart2/source/controller/main/ChartController_Properties.cxx index 32891de08d0e..86e51c032eeb 100644 --- a/chart2/source/controller/main/ChartController_Properties.cxx +++ b/chart2/source/controller/main/ChartController_Properties.cxx @@ -69,16 +69,10 @@ using ::com::sun::star::uno::Reference; namespace { -SAL_WNODEPRECATED_DECLARATIONS_PUSH ::comphelper::ItemConverter* createItemConverter( - const OUString & aObjectCID - , const uno::Reference< frame::XModel > & xChartModel - , const uno::Reference< uno::XComponentContext > & xContext - , SdrModel & rDrawModel - , ExplicitValueProvider * pExplicitValueProvider = NULL - , ::std::auto_ptr< ReferenceSizeProvider > pRefSizeProvider = - ::std::auto_ptr< ReferenceSizeProvider >() - ) + const OUString & aObjectCID, const uno::Reference<frame::XModel>& xChartModel, + const uno::Reference<uno::XComponentContext>& xContext, SdrModel& rDrawModel, + ExplicitValueProvider* pExplicitValueProvider, ReferenceSizeProvider* pRefSizeProvider ) { ::comphelper::ItemConverter* pItemConverter=NULL; @@ -110,7 +104,7 @@ SAL_WNODEPRECATED_DECLARATIONS_PUSH case OBJECTTYPE_TITLE: { boost::scoped_ptr<awt::Size> pRefSize; - if( pRefSizeProvider.get() ) + if (pRefSizeProvider) pRefSize.reset(new awt::Size(pRefSizeProvider->getPageSize())); pItemConverter = new wrapper::TitleItemConverter( @@ -121,14 +115,14 @@ SAL_WNODEPRECATED_DECLARATIONS_PUSH break; case OBJECTTYPE_LEGEND: { - ::std::auto_ptr< awt::Size > pRefSize; - if( pRefSizeProvider.get() ) + boost::scoped_ptr<awt::Size> pRefSize; + if (pRefSizeProvider) pRefSize.reset( new awt::Size( pRefSizeProvider->getPageSize())); - pItemConverter = new wrapper::LegendItemConverter( xObjectProperties, - rDrawModel.GetItemPool(), rDrawModel, - uno::Reference< lang::XMultiServiceFactory >( xChartModel, uno::UNO_QUERY ), - pRefSize ); + pItemConverter = new wrapper::LegendItemConverter( + xObjectProperties, rDrawModel.GetItemPool(), rDrawModel, + uno::Reference<lang::XMultiServiceFactory>(xChartModel, uno::UNO_QUERY), + pRefSize.get()); } break; case OBJECTTYPE_LEGEND_ENTRY: @@ -145,7 +139,7 @@ SAL_WNODEPRECATED_DECLARATIONS_PUSH case OBJECTTYPE_AXIS: { boost::scoped_ptr<awt::Size> pRefSize; - if( pRefSizeProvider.get() ) + if (pRefSizeProvider) pRefSize.reset( new awt::Size( pRefSizeProvider->getPageSize())); uno::Reference< beans::XPropertySet > xDiaProp; @@ -178,7 +172,7 @@ SAL_WNODEPRECATED_DECLARATIONS_PUSH case OBJECTTYPE_DATA_POINT: { boost::scoped_ptr<awt::Size> pRefSize; - if( pRefSizeProvider.get() ) + if (pRefSizeProvider) pRefSize.reset( new awt::Size( pRefSizeProvider->getPageSize())); wrapper::GraphicPropertyItemConverter::eGraphicObjectType eMapTo = @@ -193,6 +187,7 @@ SAL_WNODEPRECATED_DECLARATIONS_PUSH eMapTo = wrapper::GraphicPropertyItemConverter::LINE_DATA_POINT; bool bDataSeries = ( eObjectType == OBJECTTYPE_DATA_SERIES || eObjectType == OBJECTTYPE_DATA_LABELS ); + fprintf(stdout, "chart::createItemConverter: data series = %d\n", bDataSeries); //special color for pie chart: bool bUseSpecialFillColor = false; @@ -255,7 +250,7 @@ SAL_WNODEPRECATED_DECLARATIONS_PUSH case OBJECTTYPE_DATA_CURVE_EQUATION: { boost::scoped_ptr<awt::Size> pRefSize; - if( pRefSizeProvider.get() ) + if (pRefSizeProvider) pRefSize.reset(new awt::Size(pRefSizeProvider->getPageSize())); pItemConverter = new wrapper::RegressionEquationItemConverter( @@ -289,7 +284,7 @@ SAL_WNODEPRECATED_DECLARATIONS_PUSH case OBJECTTYPE_AXIS: { boost::scoped_ptr<awt::Size> pRefSize; - if( pRefSizeProvider.get() ) + if (pRefSizeProvider) pRefSize.reset( new awt::Size( pRefSizeProvider->getPageSize())); pItemConverter = new wrapper::AllAxisItemConverter( @@ -309,7 +304,6 @@ SAL_WNODEPRECATED_DECLARATIONS_PUSH } return pItemConverter; } -SAL_WNODEPRECATED_DECLARATIONS_POP OUString lcl_getTitleCIDForCommand( const OString& rDispatchCommand, const uno::Reference< frame::XModel > & xChartModel ) { @@ -715,14 +709,13 @@ bool ChartController::executeDlg_ObjectProperties_withoutUndoGuard( const OUStri //convert properties to ItemSet - SAL_WNODEPRECATED_DECLARATIONS_PUSH - ::std::auto_ptr< ReferenceSizeProvider > pRefSizeProv( - impl_createReferenceSizeProvider()); + boost::scoped_ptr<ReferenceSizeProvider> pRefSizeProv(impl_createReferenceSizeProvider()); + ::std::auto_ptr< ::comphelper::ItemConverter > apItemConverter( createItemConverter( rObjectCID, getModel(), m_xCC, m_pDrawModelWrapper->getSdrModel(), ExplicitValueProvider::getExplicitValueProvider(m_xChartView), - pRefSizeProv )); + pRefSizeProv.get())); SAL_WNODEPRECATED_DECLARATIONS_POP if(!apItemConverter.get()) return bRet; diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx index 186ec57e9274..d7544c8a9681 100644 --- a/chart2/source/controller/main/ChartController_Tools.cxx +++ b/chart2/source/controller/main/ChartController_Tools.cxx @@ -152,25 +152,19 @@ bool lcl_deleteDataCurve( } // anonymous namespace -SAL_WNODEPRECATED_DECLARATIONS_PUSH -::std::auto_ptr< ReferenceSizeProvider > ChartController::impl_createReferenceSizeProvider() +ReferenceSizeProvider* ChartController::impl_createReferenceSizeProvider() { awt::Size aPageSize( ChartModelHelper::getPageSize( getModel() ) ); - return ::std::auto_ptr< ReferenceSizeProvider >( - new ReferenceSizeProvider( aPageSize, - Reference< chart2::XChartDocument >( getModel(), uno::UNO_QUERY ))); + return new ReferenceSizeProvider( + aPageSize, Reference<chart2::XChartDocument>(getModel(), uno::UNO_QUERY)); } -SAL_WNODEPRECATED_DECLARATIONS_POP void ChartController::impl_adaptDataSeriesAutoResize() { - SAL_WNODEPRECATED_DECLARATIONS_PUSH - ::std::auto_ptr< ReferenceSizeProvider > apRefSizeProvider( - impl_createReferenceSizeProvider()); - SAL_WNODEPRECATED_DECLARATIONS_POP - if( apRefSizeProvider.get()) - apRefSizeProvider->setValuesAtAllDataSeries(); + boost::scoped_ptr<ReferenceSizeProvider> pRefSizeProvider(impl_createReferenceSizeProvider()); + if (pRefSizeProvider) + pRefSizeProvider->setValuesAtAllDataSeries(); } void ChartController::executeDispatch_NewArrangement() @@ -243,12 +237,12 @@ void ChartController::executeDispatch_ScaleText() SCH_RESSTR( STR_ACTION_SCALE_TEXT ), m_xUndoManager ); ControllerLockGuardUNO aCtlLockGuard( getModel() ); - SAL_WNODEPRECATED_DECLARATIONS_PUSH - ::std::auto_ptr< ReferenceSizeProvider > apRefSizeProv( impl_createReferenceSizeProvider()); - SAL_WNODEPRECATED_DECLARATIONS_POP - OSL_ASSERT( apRefSizeProv.get()); - if( apRefSizeProv.get()) - apRefSizeProv->toggleAutoResizeState(); + + boost::scoped_ptr<ReferenceSizeProvider> pRefSizeProv(impl_createReferenceSizeProvider()); + OSL_ASSERT( pRefSizeProv.get()); + if (pRefSizeProv) + pRefSizeProv->toggleAutoResizeState(); + aUndoGuard.commit(); } |