summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2021-08-15 17:35:58 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-08-16 12:07:15 +0200
commiteec42f0dbcc79a4c9f456ce97fa1066b8031ea28 (patch)
treef089f757270293bd94dfac881c62520af76975e0 /oox
parenta6ca6215a5ec82e833ebfcd2ebd4455cb504fd8e (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 'oox')
-rw-r--r--oox/source/export/drawingml.cxx12
-rw-r--r--oox/source/export/vmlexport.cxx12
2 files changed, 8 insertions, 16 deletions
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 91f4a779a984..54a7f2f6eab1 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -3457,8 +3457,7 @@ void DrawingML::WriteText(const Reference<XInterface>& rXIface, bool bBodyPr, bo
const SdrTextObj* pTxtObj = dynamic_cast<SdrTextObj*>( pSdrObject );
if (pTxtObj && mpTextExport)
{
- const OutlinerParaObject* pParaObj = nullptr;
- bool bOwnParaObj = false;
+ std::optional<OutlinerParaObject> pParaObj;
/*
#i13885#
@@ -3467,18 +3466,15 @@ void DrawingML::WriteText(const Reference<XInterface>& rXIface, bool bBodyPr, bo
*/
if (pTxtObj->IsTextEditActive())
{
- pParaObj = pTxtObj->CreateEditOutlinerParaObject().release();
- bOwnParaObj = true;
+ pParaObj = pTxtObj->CreateEditOutlinerParaObject();
}
- else
- pParaObj = pTxtObj->GetOutlinerParaObject();
+ else if (pTxtObj->GetOutlinerParaObject())
+ pParaObj = *pTxtObj->GetOutlinerParaObject();
if (pParaObj)
{
// this is reached only in case some text is attached to the shape
mpTextExport->WriteOutliner(*pParaObj);
- if (bOwnParaObj)
- delete pParaObj;
}
return;
}
diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index 5b267184a291..d4243c6e07bf 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -1420,8 +1420,7 @@ sal_Int32 VMLExport::StartShape()
const SdrTextObj* pTxtObj = dynamic_cast<const SdrTextObj*>( m_pSdrObject );
if (pTxtObj && m_pTextExport && msfilter::util::HasTextBoxContent(m_nShapeType) && !IsWaterMarkShape(m_pSdrObject->GetName()) && !lcl_isTextBox(m_pSdrObject))
{
- const OutlinerParaObject* pParaObj = nullptr;
- bool bOwnParaObj = false;
+ std::optional<OutlinerParaObject> pParaObj;
/*
#i13885#
@@ -1430,12 +1429,11 @@ sal_Int32 VMLExport::StartShape()
*/
if (pTxtObj->IsTextEditActive())
{
- pParaObj = pTxtObj->CreateEditOutlinerParaObject().release();
- bOwnParaObj = true;
+ pParaObj = pTxtObj->CreateEditOutlinerParaObject();
}
- else
+ else if (pTxtObj->GetOutlinerParaObject())
{
- pParaObj = pTxtObj->GetOutlinerParaObject();
+ pParaObj = *pTxtObj->GetOutlinerParaObject();
}
if( pParaObj )
@@ -1450,8 +1448,6 @@ sal_Int32 VMLExport::StartShape()
m_pSerializer->startElementNS(XML_v, XML_textbox, pTextboxAttrList);
m_pTextExport->WriteOutliner(*pParaObj);
m_pSerializer->endElementNS(XML_v, XML_textbox);
- if( bOwnParaObj )
- delete pParaObj;
}
}