diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2022-09-09 20:30:53 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-09-10 12:19:13 +0200 |
commit | 16987d2aae9e0ed052de8a8f7155070c4b05cf4a (patch) | |
tree | 19a8216f86c3b263165a8152d24a75b0bd946678 /chart2 | |
parent | 9e67902277421aa3fae3bf10eb7bb8b70259c78e (diff) |
unique_ptr->optional for Graphic
Graphic is just a wrapper around shared_ptr, so no need to
allocate this separately
Change-Id: Ie657dea1c021e66a6876e814090a44cb6f995b91
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139739
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2')
3 files changed, 9 insertions, 9 deletions
diff --git a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx index bc5bc46a82e1..a838f784d1a4 100644 --- a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx +++ b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx @@ -316,10 +316,10 @@ void ObjectPropertiesDialogParameter::init( const rtl::Reference<::chart::ChartM const sal_uInt16 nNoArrowNoShadowDlg = 1101; void SchAttribTabDlg::setSymbolInformation( SfxItemSet&& rSymbolShapeProperties, - std::unique_ptr<Graphic> pAutoSymbolGraphic ) + std::optional<Graphic> oAutoSymbolGraphic ) { m_oSymbolShapeProperties.emplace(std::move(rSymbolShapeProperties)); - m_pAutoSymbolGraphic = std::move(pAutoSymbolGraphic); + m_oAutoSymbolGraphic = std::move(oAutoSymbolGraphic); } void SchAttribTabDlg::SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth ) @@ -511,8 +511,8 @@ void SchAttribTabDlg::PageCreated(const OString& rId, SfxTabPage &rPage) aSet.Put(OfaPtrItem(SID_OBJECT_LIST,m_pViewElementListProvider->GetSymbolList())); if( m_oSymbolShapeProperties ) aSet.Put(SfxTabDialogItem(SID_ATTR_SET, *m_oSymbolShapeProperties)); - if( m_pAutoSymbolGraphic ) - aSet.Put(SvxGraphicItem(*m_pAutoSymbolGraphic)); + if( m_oAutoSymbolGraphic ) + aSet.Put(SvxGraphicItem(*m_oAutoSymbolGraphic)); } rPage.PageCreated(aSet); } diff --git a/chart2/source/controller/inc/dlg_ObjectProperties.hxx b/chart2/source/controller/inc/dlg_ObjectProperties.hxx index c4c1c0d83bf0..4311add0f733 100644 --- a/chart2/source/controller/inc/dlg_ObjectProperties.hxx +++ b/chart2/source/controller/inc/dlg_ObjectProperties.hxx @@ -20,9 +20,9 @@ #include <ObjectIdentifier.hxx> #include <sfx2/tabdlg.hxx> +#include <vcl/graph.hxx> namespace com::sun::star::util { class XNumberFormatsSupplier; } -class Graphic; namespace chart { @@ -115,7 +115,7 @@ private: SvNumberFormatter* m_pNumberFormatter; std::optional<SfxItemSet> m_oSymbolShapeProperties; - std::unique_ptr<Graphic> m_pAutoSymbolGraphic; + std::optional<Graphic> m_oAutoSymbolGraphic; double m_fAxisMinorStepWidthForErrorBarDecimals; bool m_bOKPressed; @@ -133,7 +133,7 @@ public: //pSymbolShapeProperties: Properties to be set on the symbollist shapes //pAutoSymbolGraphic: Graphic to be shown if AutoSymbol gets selected - void setSymbolInformation( SfxItemSet&& rSymbolShapeProperties, std::unique_ptr<Graphic> pAutoSymbolGraphic ); + void setSymbolInformation( SfxItemSet&& rSymbolShapeProperties, std::optional<Graphic> oAutoSymbolGraphic ); void SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth ); diff --git a/chart2/source/controller/main/ChartController_Properties.cxx b/chart2/source/controller/main/ChartController_Properties.cxx index a78bed1530e4..46dbe5431ff6 100644 --- a/chart2/source/controller/main/ChartController_Properties.cxx +++ b/chart2/source/controller/main/ChartController_Properties.cxx @@ -778,9 +778,9 @@ bool ChartController::executeDlg_ObjectProperties_withoutUndoGuard( aSymbolItemConverter.FillItemSet( aSymbolShapeProperties ); sal_Int32 const nStandardSymbol=0;//@todo get from somewhere - std::unique_ptr<Graphic> pAutoSymbolGraphic(new Graphic( aViewElementListProvider.GetSymbolGraphic( nStandardSymbol, &aSymbolShapeProperties ) )); + std::optional<Graphic> oAutoSymbolGraphic(std::in_place, aViewElementListProvider.GetSymbolGraphic( nStandardSymbol, &aSymbolShapeProperties ) ); // note: the dialog takes the ownership of pSymbolShapeProperties and pAutoSymbolGraphic - aDlg.setSymbolInformation( std::move(aSymbolShapeProperties), std::move(pAutoSymbolGraphic) ); + aDlg.setSymbolInformation( std::move(aSymbolShapeProperties), std::move(oAutoSymbolGraphic) ); } if( aDialogParameter.HasStatisticProperties() ) { |