diff options
author | David Tardon <dtardon@redhat.com> | 2016-04-28 10:08:27 +0200 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2016-05-02 06:54:30 +0200 |
commit | 10b818d4b68f5df490c9c8f499e3a7aa83d7e5bb (patch) | |
tree | 722843f2e8190e33577de150404aa02f54f4101c | |
parent | ffacf4ba0f8c77cd66561962ab540f3e6b726649 (diff) |
use unique_ptr
Change-Id: I38d5c436985b0a68530be01c7482a68cf4e99018
m--------- | helpcontent2 | 0 | ||||
-rw-r--r-- | sd/source/ui/dlg/unchss.cxx | 20 | ||||
-rw-r--r-- | sd/source/ui/inc/unchss.hxx | 7 | ||||
m--------- | translations | 0 |
4 files changed, 12 insertions, 15 deletions
diff --git a/helpcontent2 b/helpcontent2 -Subproject 743ed49ef0759b6cbd65d707ae9b8bba90e81a4 +Subproject 1ca8cf973396ef4f41dd3474b79d79fe84105b9 diff --git a/sd/source/ui/dlg/unchss.cxx b/sd/source/ui/dlg/unchss.cxx index 1c24d1eaebd5..97a37cfe3cc3 100644 --- a/sd/source/ui/dlg/unchss.cxx +++ b/sd/source/ui/dlg/unchss.cxx @@ -17,6 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <o3tl/make_unique.hxx> + #include <svl/itemset.hxx> #include <svl/style.hxx> #include <svl/smplhint.hxx> @@ -43,11 +45,11 @@ StyleSheetUndoAction::StyleSheetUndoAction(SdDrawDocument* pTheDoc, // Create ItemSets; Attention, it is possible that the new one is from a, // different pool. Therefore we clone it with its items. - pNewSet = new SfxItemSet(static_cast<SfxItemPool&>(SdrObject::GetGlobalDrawObjectItemPool()), pTheNewItemSet->GetRanges()); - SdrModel::MigrateItemSet( pTheNewItemSet, pNewSet, pTheDoc ); + pNewSet = o3tl::make_unique<SfxItemSet>(static_cast<SfxItemPool&>(SdrObject::GetGlobalDrawObjectItemPool()), pTheNewItemSet->GetRanges()); + SdrModel::MigrateItemSet( pTheNewItemSet, pNewSet.get(), pTheDoc ); - pOldSet = new SfxItemSet(static_cast<SfxItemPool&>(SdrObject::GetGlobalDrawObjectItemPool()), pStyleSheet->GetItemSet().GetRanges()); - SdrModel::MigrateItemSet( &pStyleSheet->GetItemSet(), pOldSet, pTheDoc ); + pOldSet = o3tl::make_unique<SfxItemSet>(static_cast<SfxItemPool&>(SdrObject::GetGlobalDrawObjectItemPool()), pStyleSheet->GetItemSet().GetRanges()); + SdrModel::MigrateItemSet( &pStyleSheet->GetItemSet(), pOldSet.get(), pTheDoc ); aComment = SD_RESSTR(STR_UNDO_CHANGE_PRES_OBJECT); OUString aName(pStyleSheet->GetName()); @@ -95,7 +97,7 @@ StyleSheetUndoAction::StyleSheetUndoAction(SdDrawDocument* pTheDoc, void StyleSheetUndoAction::Undo() { SfxItemSet aNewSet( mpDoc->GetItemPool(), pOldSet->GetRanges() ); - SdrModel::MigrateItemSet( pOldSet, &aNewSet, mpDoc ); + SdrModel::MigrateItemSet( pOldSet.get(), &aNewSet, mpDoc ); pStyleSheet->GetItemSet().Set(aNewSet); if( pStyleSheet->GetFamily() == SD_STYLE_FAMILY_PSEUDO ) @@ -107,7 +109,7 @@ void StyleSheetUndoAction::Undo() void StyleSheetUndoAction::Redo() { SfxItemSet aNewSet( mpDoc->GetItemPool(), pOldSet->GetRanges() ); - SdrModel::MigrateItemSet( pNewSet, &aNewSet, mpDoc ); + SdrModel::MigrateItemSet( pNewSet.get(), &aNewSet, mpDoc ); pStyleSheet->GetItemSet().Set(aNewSet); if( pStyleSheet->GetFamily() == SD_STYLE_FAMILY_PSEUDO ) @@ -116,12 +118,6 @@ void StyleSheetUndoAction::Redo() pStyleSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED)); } -StyleSheetUndoAction::~StyleSheetUndoAction() -{ - delete pNewSet; - delete pOldSet; -} - OUString StyleSheetUndoAction::GetComment() const { return aComment; diff --git a/sd/source/ui/inc/unchss.hxx b/sd/source/ui/inc/unchss.hxx index 88b9e33d37b8..ed72911829d5 100644 --- a/sd/source/ui/inc/unchss.hxx +++ b/sd/source/ui/inc/unchss.hxx @@ -20,6 +20,8 @@ #ifndef INCLUDED_SD_SOURCE_UI_INC_UNCHSS_HXX #define INCLUDED_SD_SOURCE_UI_INC_UNCHSS_HXX +#include <memory> + #include "sdundo.hxx" class SfxItemSet; @@ -30,8 +32,8 @@ class StyleSheetUndoAction : public SdUndoAction { SfxStyleSheet* pStyleSheet; - SfxItemSet* pNewSet; - SfxItemSet* pOldSet; + std::unique_ptr<SfxItemSet> pNewSet; + std::unique_ptr<SfxItemSet> pOldSet; OUString aComment; public: @@ -39,7 +41,6 @@ public: SfxStyleSheet* pTheStyleSheet, const SfxItemSet* pTheNewItemSet); - virtual ~StyleSheetUndoAction(); virtual void Undo() override; virtual void Redo() override; diff --git a/translations b/translations -Subproject 0732bbfc5365529452255fc0263416c0455b127 +Subproject b0a83a046ece7e828d6a7a2d1304661a8367012 |