summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-08-19 10:00:01 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-08-19 11:53:13 +0200
commit55c4bfc5717c6f915e8760eec95be76813d5fce8 (patch)
tree5d83d6f74efa0b58bb7e27b0b8b8d8f803f8c061 /svx
parente545598e738407019419a4c0fc252314d8f434d4 (diff)
use std::optional<OutlinerParaObject> in SdrUndoAttrObj
it is a COW object, no need to allocate separately on heap Change-Id: Ibfecb263eedb6ef5eca8122e80a564cb1e872db1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120699 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/svdraw/svdundo.cxx4
-rw-r--r--svx/source/table/tableundo.cxx10
-rw-r--r--svx/source/table/tableundo.hxx3
3 files changed, 7 insertions, 10 deletions
diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx
index 2eea31d23237..51f35d8e80c7 100644
--- a/svx/source/svdraw/svdundo.cxx
+++ b/svx/source/svdraw/svdundo.cxx
@@ -279,7 +279,7 @@ SdrUndoAttrObj::SdrUndoAttrObj(SdrObject& rNewObj, bool bStyleSheet1, bool bSave
{
auto p = pObj->GetOutlinerParaObject();
if(p)
- pTextUndo.reset( new OutlinerParaObject(*p) );
+ pTextUndo = *p;
}
}
@@ -316,7 +316,7 @@ void SdrUndoAttrObj::Undo()
// #i8508#
auto p = pObj->GetOutlinerParaObject();
if(p)
- pTextRedo.reset( new OutlinerParaObject(*p) );
+ pTextRedo = *p;
}
}
diff --git a/svx/source/table/tableundo.cxx b/svx/source/table/tableundo.cxx
index 2840562a4acf..66641469dd09 100644
--- a/svx/source/table/tableundo.cxx
+++ b/svx/source/table/tableundo.cxx
@@ -61,10 +61,8 @@ void CellUndo::dispose()
maUndoData.mpProperties = nullptr;
delete maRedoData.mpProperties;
maRedoData.mpProperties = nullptr;
- delete maUndoData.mpOutlinerParaObject;
- maUndoData.mpOutlinerParaObject = nullptr;
- delete maRedoData.mpOutlinerParaObject;
- maRedoData.mpOutlinerParaObject = nullptr;
+ maUndoData.mpOutlinerParaObject.reset();
+ maRedoData.mpOutlinerParaObject.reset();
}
void CellUndo::ObjectInDestruction(const SdrObject& )
@@ -136,9 +134,9 @@ void CellUndo::getDataFromCell( Data& rData )
rData.mpProperties = mxCell->CloneProperties( *mxObjRef, *mxCell);
if( mxCell->GetOutlinerParaObject() )
- rData.mpOutlinerParaObject = new OutlinerParaObject(*mxCell->GetOutlinerParaObject());
+ rData.mpOutlinerParaObject = *mxCell->GetOutlinerParaObject();
else
- rData.mpOutlinerParaObject = nullptr;
+ rData.mpOutlinerParaObject.reset();
rData.msFormula = mxCell->msFormula;
rData.mfValue = mxCell->mfValue;
diff --git a/svx/source/table/tableundo.hxx b/svx/source/table/tableundo.hxx
index 861251963658..822f5ec642fa 100644
--- a/svx/source/table/tableundo.hxx
+++ b/svx/source/table/tableundo.hxx
@@ -55,7 +55,7 @@ private:
struct Data
{
sdr::properties::TextProperties* mpProperties;
- OutlinerParaObject* mpOutlinerParaObject;
+ std::optional<OutlinerParaObject> mpOutlinerParaObject;
OUString msFormula;
double mfValue;
@@ -66,7 +66,6 @@ private:
Data()
: mpProperties(nullptr)
- , mpOutlinerParaObject(nullptr)
, mfValue(0)
, mnError(0)
, mbMerged(false)