include/svx/svdundo.hxx | 5 +++-- svx/source/svdraw/svdundo.cxx | 24 ++++++++++++------------ 2 files changed, 15 insertions(+), 14 deletions(-)
New commits: commit d3fbfa4a4b3ef80575ec5f27ca13d937d6f52bf6 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Sat Sep 18 21:56:40 2021 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Sun Sep 19 12:57:07 2021 +0200 no need to allocate SfxItemSet separately in SdrUndoAttrObj Change-Id: I32c9d79262c711a4f28c910e1b8f8ca9c1f011e9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122305 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/include/svx/svdundo.hxx b/include/svx/svdundo.hxx index 0064aa85c6c5..67ca464b5b4c 100644 --- a/include/svx/svdundo.hxx +++ b/include/svx/svdundo.hxx @@ -26,6 +26,7 @@ #include <vector> #include <editeng/outlobj.hxx> +#include <svl/itemset.hxx> #include <svl/undo.hxx> #include <svl/style.hxx> #include <tools/gen.hxx> @@ -144,8 +145,8 @@ protected: class SVXCORE_DLLPUBLIC SdrUndoAttrObj : public SdrUndoObj { protected: - std::unique_ptr<SfxItemSet> pUndoSet; - std::unique_ptr<SfxItemSet> pRedoSet; + std::optional<SfxItemSet> moUndoSet; + std::optional<SfxItemSet> moRedoSet; // FIXME: Or should we better remember the StyleSheetNames? rtl::Reference< SfxStyleSheetBase > mxUndoStyleSheet; diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx index 9cc06ee19a81..116c5e479a13 100644 --- a/svx/source/svdraw/svdundo.cxx +++ b/svx/source/svdraw/svdundo.cxx @@ -268,7 +268,7 @@ SdrUndoAttrObj::SdrUndoAttrObj(SdrObject& rNewObj, bool bStyleSheet1, bool bSave if(bIsGroup && !bIs3DScene) return; - pUndoSet.reset( new SfxItemSet(pObj->GetMergedItemSet()) ); + moUndoSet.emplace( pObj->GetMergedItemSet() ); if(bStyleSheet) mxUndoStyleSheet = pObj->GetStyleSheet(); @@ -283,8 +283,8 @@ SdrUndoAttrObj::SdrUndoAttrObj(SdrObject& rNewObj, bool bStyleSheet1, bool bSave SdrUndoAttrObj::~SdrUndoAttrObj() { - pUndoSet.reset(); - pRedoSet.reset(); + moUndoSet.reset(); + moRedoSet.reset(); pUndoGroup.reset(); pTextUndo.reset(); pTextRedo.reset(); @@ -304,7 +304,7 @@ void SdrUndoAttrObj::Undo() { bHaveToTakeRedoSet = false; - pRedoSet.reset( new SfxItemSet(pObj->GetMergedItemSet()) ); + moRedoSet.emplace( pObj->GetMergedItemSet() ); if(bStyleSheet) mxRedoStyleSheet = pObj->GetStyleSheet(); @@ -346,7 +346,7 @@ void SdrUndoAttrObj::Undo() // SdrObjCustomShape::NbcSetSnapRect needs logic instead of snap rect const tools::Rectangle aLogicRect = pObj->GetLogicRect(); - if(pUndoSet) + if(moUndoSet) { if(dynamic_cast<const SdrCaptionObj*>( pObj) != nullptr) { @@ -355,12 +355,12 @@ void SdrUndoAttrObj::Undo() // vertical text is changed. When clearing only set items it's // slower, but safer regarding such information (it's not changed // usually) - SfxWhichIter aIter(*pUndoSet); + SfxWhichIter aIter(*moUndoSet); sal_uInt16 nWhich(aIter.FirstWhich()); while(nWhich) { - if(SfxItemState::SET != pUndoSet->GetItemState(nWhich, false)) + if(SfxItemState::SET != moUndoSet->GetItemState(nWhich, false)) { pObj->ClearMergedItem(nWhich); } @@ -373,7 +373,7 @@ void SdrUndoAttrObj::Undo() pObj->ClearMergedItem(); } - pObj->SetMergedItemSet(*pUndoSet); + pObj->SetMergedItemSet(*moUndoSet); } // Restore previous size here when it was changed. @@ -427,7 +427,7 @@ void SdrUndoAttrObj::Redo() const tools::Rectangle aSnapRect = pObj->GetSnapRect(); const tools::Rectangle aLogicRect = pObj->GetLogicRect(); - if(pRedoSet) + if(moRedoSet) { if(dynamic_cast<const SdrCaptionObj*>( pObj) != nullptr) { @@ -436,12 +436,12 @@ void SdrUndoAttrObj::Redo() // vertical text is changed. When clearing only set items it's // slower, but safer regarding such information (it's not changed // usually) - SfxWhichIter aIter(*pRedoSet); + SfxWhichIter aIter(*moRedoSet); sal_uInt16 nWhich(aIter.FirstWhich()); while(nWhich) { - if(SfxItemState::SET != pRedoSet->GetItemState(nWhich, false)) + if(SfxItemState::SET != moRedoSet->GetItemState(nWhich, false)) { pObj->ClearMergedItem(nWhich); } @@ -454,7 +454,7 @@ void SdrUndoAttrObj::Redo() pObj->ClearMergedItem(); } - pObj->SetMergedItemSet(*pRedoSet); + pObj->SetMergedItemSet(*moRedoSet); } // Restore previous size here when it was changed.