diff options
-rw-r--r-- | cui/source/options/optchart.cxx | 16 | ||||
-rw-r--r-- | cui/source/options/optchart.hxx | 4 |
2 files changed, 9 insertions, 11 deletions
diff --git a/cui/source/options/optchart.cxx b/cui/source/options/optchart.cxx index d9c92433c006..02676c9d63f7 100644 --- a/cui/source/options/optchart.cxx +++ b/cui/source/options/optchart.cxx @@ -135,20 +135,20 @@ SvxDefaultColorOptPage::SvxDefaultColorOptPage(vcl::Window* pParent, const SfxIt m_pValSetColorBox->SetExtraSpacing( 0 ); m_pValSetColorBox->Show(); - pChartOptions = new SvxChartOptions; + pChartOptions.reset(new SvxChartOptions); pColorList = XColorList::CreateStdColorList(); const SfxPoolItem* pItem = nullptr; if ( rInAttrs.GetItemState( SID_SCH_EDITOPTIONS, false, &pItem ) == SfxItemState::SET ) { - pColorConfig = static_cast< SvxChartColorTableItem* >(pItem->Clone()); + pColorConfig.reset(static_cast< SvxChartColorTableItem* >(pItem->Clone())); } else { SvxChartColorTable aTable; aTable.useDefault(); - pColorConfig = new SvxChartColorTableItem( SID_SCH_EDITOPTIONS, aTable ); - pColorConfig->SetOptions( pChartOptions ); + pColorConfig.reset(new SvxChartColorTableItem( SID_SCH_EDITOPTIONS, aTable )); + pColorConfig->SetOptions( pChartOptions.get() ); } Construct(); @@ -167,10 +167,8 @@ void SvxDefaultColorOptPage::dispose() pChartOptions->SetDefaultColors( pColorConfig->GetColorList() ); pChartOptions->Commit(); - delete pColorConfig; - pColorConfig = nullptr; - delete pChartOptions; - pChartOptions = nullptr; + pColorConfig.reset(); + pChartOptions.reset(); } m_pLbChartColors.clear(); m_pValSetColorBox.clear(); @@ -198,7 +196,7 @@ VclPtr<SfxTabPage> SvxDefaultColorOptPage::Create( TabPageParent pParent, const bool SvxDefaultColorOptPage::FillItemSet( SfxItemSet* rOutAttrs ) { if( pColorConfig ) - rOutAttrs->Put( *static_cast< SfxPoolItem* >(pColorConfig) ); + rOutAttrs->Put( *pColorConfig ); return true; } diff --git a/cui/source/options/optchart.hxx b/cui/source/options/optchart.hxx index 97ae4b2ed509..fc7d01091871 100644 --- a/cui/source/options/optchart.hxx +++ b/cui/source/options/optchart.hxx @@ -40,8 +40,8 @@ private: VclPtr<PushButton> m_pPBAdd; VclPtr<PushButton> m_pPBRemove; - SvxChartOptions* pChartOptions; - SvxChartColorTableItem* pColorConfig; + std::unique_ptr<SvxChartOptions> pChartOptions; + std::unique_ptr<SvxChartColorTableItem> pColorConfig; XColorListRef pColorList; ImpColorList aColorList; |