diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2021-08-15 17:35:58 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-08-16 12:07:15 +0200 |
commit | eec42f0dbcc79a4c9f456ce97fa1066b8031ea28 (patch) | |
tree | f089f757270293bd94dfac881c62520af76975e0 /sd/source/ui/func | |
parent | a6ca6215a5ec82e833ebfcd2ebd4455cb504fd8e (diff) |
pass OutlinerParaObject around by value
since it uses o3tl::cow_wrapper, so it is really just a wrapper
around a pointer, no point in allocating it on the heap
Remove assert in SdrText::SetOutlinerParaObject, which was
bogus anyhow, because it was comparing pointers, not deep equality.
And since we are now being more efficient and avoiding
copying of the internal data in OutlinerParaObject, we hit
this assert.
Change-Id: I6dbfaab5ee2ca05b2001baf63110041e469df9c5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120510
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd/source/ui/func')
-rw-r--r-- | sd/source/ui/func/fuexpand.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/func/fuinsert.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/func/fuinsfil.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/func/fumorph.cxx | 4 |
4 files changed, 6 insertions, 6 deletions
diff --git a/sd/source/ui/func/fuexpand.cxx b/sd/source/ui/func/fuexpand.cxx index 833d628742e0..7b499db91786 100644 --- a/sd/source/ui/func/fuexpand.cxx +++ b/sd/source/ui/func/fuexpand.cxx @@ -183,7 +183,7 @@ void FuExpandPage::DoExecute( SfxRequest& ) if (!pTextObj) continue; - std::unique_ptr<OutlinerParaObject> pOutlinerParaObject = aOutliner.CreateParaObject( nParaPos, 1); + std::optional<OutlinerParaObject> pOutlinerParaObject = aOutliner.CreateParaObject( nParaPos, 1); pOutlinerParaObject->SetOutlinerMode(OutlinerMode::TitleObject); if( pOutlinerParaObject->GetDepth(0) != -1 ) @@ -213,7 +213,7 @@ void FuExpandPage::DoExecute( SfxRequest& ) if (pOutlineObj) { // create structuring text objects - std::unique_ptr<OutlinerParaObject> pOPO = aOutliner.CreateParaObject(++nParaPos, nChildCount); + std::optional<OutlinerParaObject> pOPO = aOutliner.CreateParaObject(++nParaPos, nChildCount); std::unique_ptr<SdrOutliner> pTempOutl = SdrMakeOutliner(OutlinerMode::OutlineObject, *mpDoc); pTempOutl->SetText( *pOPO ); diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx index 07d1417e0161..f8f5625e7763 100644 --- a/sd/source/ui/func/fuinsert.cxx +++ b/sd/source/ui/func/fuinsert.cxx @@ -546,7 +546,7 @@ void FuInsertOLE::DoExecute( SfxRequest& rReq ) // the empty OLE object gets a new IPObj bInsertNewObject = false; pObj->SetEmptyPresObj(false); - static_cast<SdrOle2Obj*>(pObj)->SetOutlinerParaObject(nullptr); + static_cast<SdrOle2Obj*>(pObj)->SetOutlinerParaObject(std::nullopt); static_cast<SdrOle2Obj*>(pObj)->SetObjRef(xObj); static_cast<SdrOle2Obj*>(pObj)->SetPersistName(aName); static_cast<SdrOle2Obj*>(pObj)->SetName(aName); diff --git a/sd/source/ui/func/fuinsfil.cxx b/sd/source/ui/func/fuinsfil.cxx index aec950b0c779..d776e07f1246 100644 --- a/sd/source/ui/func/fuinsfil.cxx +++ b/sd/source/ui/func/fuinsfil.cxx @@ -480,7 +480,7 @@ void FuInsertFile::InsTextOrRTFinDrMode(SfxMedium* pMedium) } } - std::unique_ptr<OutlinerParaObject> pOPO = aOutliner.CreateParaObject(); + std::optional<OutlinerParaObject> pOPO = aOutliner.CreateParaObject(); if (pOutlinerView) { diff --git a/sd/source/ui/func/fumorph.cxx b/sd/source/ui/func/fumorph.cxx index cf51719d3857..9782c3f0c27e 100644 --- a/sd/source/ui/func/fumorph.cxx +++ b/sd/source/ui/func/fumorph.cxx @@ -86,8 +86,8 @@ void FuMorph::DoExecute( SfxRequest& ) SdrObject* pCloneObj2(pObj2->CloneSdrObject(pObj2->getSdrModelFromSdrObject())); // delete text at clone, otherwise we do not get a correct PathObj - pCloneObj1->SetOutlinerParaObject(nullptr); - pCloneObj2->SetOutlinerParaObject(nullptr); + pCloneObj1->SetOutlinerParaObject(std::nullopt); + pCloneObj2->SetOutlinerParaObject(std::nullopt); // create path objects SdrObjectUniquePtr pPolyObj1 = pCloneObj1->ConvertToPolyObj(false, false); |