Kaydet (Commit) ee4f3509 authored tarafından David Tardon's avatar David Tardon

use unique_ptr

Change-Id: I55ff9ae568a0d44c8ee8be922adf40e12038e436
üst a084962e
......@@ -18,6 +18,7 @@
*/
#include "undoback.hxx"
#include "sdpage.hxx"
#include "sdresid.hxx"
#include "strings.hrc"
......@@ -36,7 +37,7 @@ SdBackgroundObjUndoAction::SdBackgroundObjUndoAction(
const SfxItemSet& rItemSet)
: SdUndoAction(&rDoc),
mrPage(rPage),
mpItemSet(new SfxItemSet(rItemSet)),
mpItemSet(o3tl::make_unique<SfxItemSet>(rItemSet)),
mbHasFillBitmap(false)
{
OUString aString( SdResId( STR_UNDO_CHANGE_PAGEFORMAT ) );
......@@ -44,22 +45,16 @@ SdBackgroundObjUndoAction::SdBackgroundObjUndoAction(
saveFillBitmap(*mpItemSet);
}
SdBackgroundObjUndoAction::~SdBackgroundObjUndoAction()
{
delete mpItemSet;
}
void SdBackgroundObjUndoAction::ImplRestoreBackgroundObj()
{
SfxItemSet* pNew = new SfxItemSet(mrPage.getSdrPageProperties().GetItemSet());
std::unique_ptr<SfxItemSet> pNew = o3tl::make_unique<SfxItemSet>(mrPage.getSdrPageProperties().GetItemSet());
mrPage.getSdrPageProperties().ClearItem();
if (bool(mpFillBitmapItem))
restoreFillBitmap(*mpItemSet);
mpFillBitmapItem.reset();
mbHasFillBitmap = false;
mrPage.getSdrPageProperties().PutItemSet(*mpItemSet);
delete mpItemSet;
mpItemSet = pNew;
mpItemSet = std::move(pNew);
saveFillBitmap(*mpItemSet);
// tell the page that it's visualization has changed
......
......@@ -21,6 +21,7 @@
#define INCLUDED_SD_SOURCE_UI_INC_UNDOBACK_HXX
#include <memory>
#include "sdundo.hxx"
class SdDrawDocument;
......@@ -34,7 +35,7 @@ class SdBackgroundObjUndoAction : public SdUndoAction
private:
SdPage& mrPage;
SfxItemSet* mpItemSet;
std::unique_ptr<SfxItemSet> mpItemSet;
std::unique_ptr<SfxPoolItem> mpFillBitmapItem;
bool mbHasFillBitmap;
......@@ -49,7 +50,6 @@ public:
SdDrawDocument& rDoc,
SdPage& rPage,
const SfxItemSet& rItemSet);
virtual ~SdBackgroundObjUndoAction();
virtual void Undo() override;
virtual void Redo() override;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment