summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-06-29 15:38:29 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-07-02 08:47:58 +0200
commit50c63e5c2f7962e8893e2d04b0e958209432f4c9 (patch)
tree308893225e96328c5ff5fd071a97c2110e61577b /sd
parentd98f1e4e0373782ad71b945dcc92c1c3d6dcf6c8 (diff)
pass OutlinerParaObject around by std::unique_ptr
SdrText::SetOutlinerParaObject was modified to not check for self-assign, and instead assert because the existing check was no longer possible. Fix bug in SdrUndoObjSetText::Undo(), where it was calling SdrText::SetOutlinerParaObject unnecessarily, because NbcSetOutlinerParaObjectForText already does that. Optimise Outliner::GetEmptyParaObject by creating a new constructor for OutlinerParaObject, so we don't need to copy the new object we get back from GetEmptyTextObject, unnecessarily. Change-Id: I57c475583d6c31658c154e24992b3d587bad9841 Reviewed-on: https://gerrit.libreoffice.org/56730 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd')
-rw-r--r--sd/inc/textapi.hxx2
-rw-r--r--sd/source/core/drawdoc4.cxx6
-rw-r--r--sd/source/core/sdpage.cxx8
-rw-r--r--sd/source/core/text/textapi.cxx8
-rw-r--r--sd/source/filter/xml/sdtransform.cxx1
-rw-r--r--sd/source/filter/xml/sdxmlwrp.cxx1
-rw-r--r--sd/source/ui/annotations/annotationwindow.cxx4
-rw-r--r--sd/source/ui/dlg/headerfooterdlg.cxx1
-rw-r--r--sd/source/ui/docshell/docshel4.cxx5
-rw-r--r--sd/source/ui/func/fuexpand.cxx11
-rw-r--r--sd/source/ui/func/fuinsert.cxx1
-rw-r--r--sd/source/ui/func/fuinsfil.cxx5
-rw-r--r--sd/source/ui/func/fumorph.cxx1
-rw-r--r--sd/source/ui/slidesorter/controller/SlsSlotManager.cxx3
-rw-r--r--sd/source/ui/view/DocumentRenderer.cxx9
-rw-r--r--sd/source/ui/view/drviews2.cxx4
-rw-r--r--sd/source/ui/view/drviews7.cxx3
-rw-r--r--sd/source/ui/view/drviews8.cxx1
-rw-r--r--sd/source/ui/view/drviews9.cxx1
-rw-r--r--sd/source/ui/view/drviewse.cxx5
-rw-r--r--sd/source/ui/view/outlnvsh.cxx17
-rw-r--r--sd/source/ui/view/outlview.cxx3
-rw-r--r--sd/source/ui/view/sdview.cxx1
-rw-r--r--sd/source/ui/view/sdview4.cxx1
-rw-r--r--sd/source/ui/view/viewshe2.cxx1
25 files changed, 50 insertions, 53 deletions
diff --git a/sd/inc/textapi.hxx b/sd/inc/textapi.hxx
index d81ecf4b4ce2..00a60d13791d 100644
--- a/sd/inc/textapi.hxx
+++ b/sd/inc/textapi.hxx
@@ -40,7 +40,7 @@ public:
/// @throws css::uno::RuntimeException
void dispose();
- OutlinerParaObject* CreateText();
+ std::unique_ptr<OutlinerParaObject> CreateText();
void SetText( OutlinerParaObject const & rText );
OUString GetText();
diff --git a/sd/source/core/drawdoc4.cxx b/sd/source/core/drawdoc4.cxx
index b938697eba50..171d2b345d63 100644
--- a/sd/source/core/drawdoc4.cxx
+++ b/sd/source/core/drawdoc4.cxx
@@ -904,7 +904,7 @@ void SdDrawDocument::SpellObject(SdrTextObj* pObj)
if (mbHasOnlineSpellErrors)
{
- OutlinerParaObject* pOPO = pOutl->CreateParaObject();
+ std::unique_ptr<OutlinerParaObject> pOPO = pOutl->CreateParaObject();
if (pOPO)
{
if (!( *pOPO == *pObj->GetOutlinerParaObject() ) ||
@@ -914,11 +914,9 @@ void SdDrawDocument::SpellObject(SdrTextObj* pObj)
// taking text from the outliner
// use non-broadcasting version to avoid O(n^2)
- pObj->NbcSetOutlinerParaObject( pOPO );
- pOPO = nullptr;
+ pObj->NbcSetOutlinerParaObject( std::move(pOPO) );
}
}
- delete pOPO;
}
}
diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index 539932c8e9dc..1746ea72cbd8 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -2097,8 +2097,9 @@ SdrObject* convertPresentationObjectImpl(SdPage& rPage, SdrObject* pSourceObj, P
SdOutliner* pOutl = rModel.GetInternalOutliner();
pOutl->Clear();
pOutl->SetText( *pOutlParaObj );
- pOutlParaObj = pOutl->CreateParaObject();
- pNewObj->SetOutlinerParaObject( pOutlParaObj );
+ std::unique_ptr<OutlinerParaObject> pNew = pOutl->CreateParaObject();
+ pOutlParaObj = pNew.get();
+ pNewObj->SetOutlinerParaObject( std::move(pNew) );
pOutl->Clear();
pNewObj->SetEmptyPresObj(false);
@@ -2155,8 +2156,7 @@ SdrObject* convertPresentationObjectImpl(SdPage& rPage, SdrObject* pSourceObj, P
SdOutliner* pOutl = rModel.GetInternalOutliner();
pOutl->Clear();
pOutl->SetText( *pOutlParaObj );
- pOutlParaObj = pOutl->CreateParaObject();
- pNewObj->SetOutlinerParaObject( pOutlParaObj );
+ pNewObj->SetOutlinerParaObject( pOutl->CreateParaObject() );
pOutl->Clear();
pNewObj->SetEmptyPresObj(false);
diff --git a/sd/source/core/text/textapi.cxx b/sd/source/core/text/textapi.cxx
index 4965b84a471b..ec968c510f6e 100644
--- a/sd/source/core/text/textapi.cxx
+++ b/sd/source/core/text/textapi.cxx
@@ -64,7 +64,7 @@ UndoTextAPIChanged::UndoTextAPIChanged(SdrModel& rModel, TextApiObject* pTextObj
void UndoTextAPIChanged::Undo()
{
if( !mpNewText )
- mpNewText.reset( mxTextObj->CreateText() );
+ mpNewText = mxTextObj->CreateText();
mxTextObj->SetText( *mpOldText );
}
@@ -99,7 +99,7 @@ public:
void Dispose();
void SetText( OutlinerParaObject const & rText );
- OutlinerParaObject* CreateText();
+ std::unique_ptr<OutlinerParaObject> CreateText();
OUString GetText();
SdDrawDocument* GetDoc() { return m_xImpl->mpDoc; }
};
@@ -150,7 +150,7 @@ void TextApiObject::dispose()
}
-OutlinerParaObject* TextApiObject::CreateText()
+std::unique_ptr<OutlinerParaObject> TextApiObject::CreateText()
{
return mpSource->CreateText();
}
@@ -247,7 +247,7 @@ void TextAPIEditSource::SetText( OutlinerParaObject const & rText )
}
}
-OutlinerParaObject* TextAPIEditSource::CreateText()
+std::unique_ptr<OutlinerParaObject> TextAPIEditSource::CreateText()
{
if (m_xImpl->mpDoc && m_xImpl->mpOutliner)
return m_xImpl->mpOutliner->CreateParaObject();
diff --git a/sd/source/filter/xml/sdtransform.cxx b/sd/source/filter/xml/sdtransform.cxx
index f496e353be0e..ca1bfb12bbb8 100644
--- a/sd/source/filter/xml/sdtransform.cxx
+++ b/sd/source/filter/xml/sdtransform.cxx
@@ -29,6 +29,7 @@
#include <editeng/eeitem.hxx>
#include <editeng/lrspitem.hxx>
#include <editeng/numitem.hxx>
+#include <editeng/outlobj.hxx>
#include <drawdoc.hxx>
#include <glob.hxx>
diff --git a/sd/source/filter/xml/sdxmlwrp.cxx b/sd/source/filter/xml/sdxmlwrp.cxx
index ddeb44fc778c..cd7d5e86abd7 100644
--- a/sd/source/filter/xml/sdxmlwrp.cxx
+++ b/sd/source/filter/xml/sdxmlwrp.cxx
@@ -25,6 +25,7 @@
#include <com/sun/star/xml/sax/SAXParseException.hpp>
#include <comphelper/processfactory.hxx>
#include <comphelper/propertysequence.hxx>
+#include <editeng/outlobj.hxx>
#include <sfx2/docfile.hxx>
#include <sfx2/docfilt.hxx>
#include <sfx2/sfxsids.hrc>
diff --git a/sd/source/ui/annotations/annotationwindow.cxx b/sd/source/ui/annotations/annotationwindow.cxx
index 186728414c66..aefa5b680a64 100644
--- a/sd/source/ui/annotations/annotationwindow.cxx
+++ b/sd/source/ui/annotations/annotationwindow.cxx
@@ -606,14 +606,14 @@ void AnnotationWindow::Deactivate()
if( pTextApi )
{
- OutlinerParaObject* pOPO = Engine()->CreateParaObject();
+ std::unique_ptr<OutlinerParaObject> pOPO = Engine()->CreateParaObject();
if( pOPO )
{
if( mpDoc->IsUndoEnabled() )
mpDoc->BegUndo( SdResId( STR_ANNOTATION_UNDO_EDIT ) );
pTextApi->SetText( *pOPO );
- delete pOPO;
+ pOPO.reset();
// set current time to changed annotation
xAnnotation->setDateTime( getCurrentDateTime() );
diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx b/sd/source/ui/dlg/headerfooterdlg.cxx
index 0963fb1023c0..f876f3d54221 100644
--- a/sd/source/ui/dlg/headerfooterdlg.cxx
+++ b/sd/source/ui/dlg/headerfooterdlg.cxx
@@ -21,6 +21,7 @@
#include <editeng/eeitem.hxx>
#include <editeng/flditem.hxx>
#include <editeng/langitem.hxx>
+#include <editeng/outlobj.hxx>
#include <svx/langbox.hxx>
#include <svx/svdotext.hxx>
#include <editeng/editeng.hxx>
diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx
index 975b9af9dd56..54efa8178a26 100644
--- a/sd/source/ui/docshell/docshel4.cxx
+++ b/sd/source/ui/docshell/docshel4.cxx
@@ -24,6 +24,7 @@
#include <DrawDocShell.hxx>
#include <com/sun/star/document/PrinterIndependentLayout.hpp>
+#include <editeng/outlobj.hxx>
#include <o3tl/make_unique.hxx>
#include <tools/urlobj.hxx>
#include <sfx2/progress.hxx>
@@ -590,8 +591,8 @@ bool DrawDocShell::SaveAs( SfxMedium& rMedium )
SdrOutliner* pOutl = mpViewShell->GetView()->GetTextEditOutliner();
if( pObj && pOutl && pOutl->IsModified() )
{
- OutlinerParaObject* pNewText = pOutl->CreateParaObject( 0, pOutl->GetParagraphCount() );
- pObj->SetOutlinerParaObject( pNewText );
+ std::unique_ptr<OutlinerParaObject> pNewText = pOutl->CreateParaObject( 0, pOutl->GetParagraphCount() );
+ pObj->SetOutlinerParaObject( std::move(pNewText) );
pOutl->ClearModifyFlag();
}
}
diff --git a/sd/source/ui/func/fuexpand.cxx b/sd/source/ui/func/fuexpand.cxx
index c0b54ec139b4..8406faf30000 100644
--- a/sd/source/ui/func/fuexpand.cxx
+++ b/sd/source/ui/func/fuexpand.cxx
@@ -185,7 +185,7 @@ void FuExpandPage::DoExecute( SfxRequest& )
if (!pTextObj)
continue;
- OutlinerParaObject* pOutlinerParaObject = pOutl->CreateParaObject( nParaPos, 1);
+ std::unique_ptr<OutlinerParaObject> pOutlinerParaObject = pOutl->CreateParaObject( nParaPos, 1);
pOutlinerParaObject->SetOutlinerMode(OutlinerMode::TitleObject);
if( pOutlinerParaObject->GetDepth(0) != -1 )
@@ -194,14 +194,14 @@ void FuExpandPage::DoExecute( SfxRequest& )
pTempOutl->SetText( *pOutlinerParaObject );
- delete pOutlinerParaObject;
+ pOutlinerParaObject.reset();
pTempOutl->SetDepth( pTempOutl->GetParagraph( 0 ), -1 );
pOutlinerParaObject = pTempOutl->CreateParaObject();
}
- pTextObj->SetOutlinerParaObject(pOutlinerParaObject);
+ pTextObj->SetOutlinerParaObject(std::move(pOutlinerParaObject));
pTextObj->SetEmptyPresObj(false);
@@ -215,7 +215,7 @@ void FuExpandPage::DoExecute( SfxRequest& )
if (pOutlineObj)
{
// create structuring text objects
- OutlinerParaObject* pOPO = pOutl->CreateParaObject(++nParaPos, nChildCount);
+ std::unique_ptr<OutlinerParaObject> pOPO = pOutl->CreateParaObject(++nParaPos, nChildCount);
std::unique_ptr<SdrOutliner> pTempOutl = SdrMakeOutliner(OutlinerMode::OutlineObject, *mpDoc);
pTempOutl->SetText( *pOPO );
@@ -229,11 +229,10 @@ void FuExpandPage::DoExecute( SfxRequest& )
pTempOutl->GetDepth( nPara ) - 1);
}
- delete pOPO;
pOPO = pTempOutl->CreateParaObject();
pTempOutl.reset();
- pOutlineObj->SetOutlinerParaObject( pOPO );
+ pOutlineObj->SetOutlinerParaObject( std::move(pOPO) );
pOutlineObj->SetEmptyPresObj(false);
// remove hard attributes (Flag to sal_True)
diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx
index 8743db87416e..2ba29aa2e041 100644
--- a/sd/source/ui/func/fuinsert.cxx
+++ b/sd/source/ui/func/fuinsert.cxx
@@ -21,6 +21,7 @@
#include <fuinsert.hxx>
#include <comphelper/storagehelper.hxx>
+#include <editeng/outlobj.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <svx/svxdlg.hxx>
#include <com/sun/star/embed/EmbedVerbs.hpp>
diff --git a/sd/source/ui/func/fuinsfil.cxx b/sd/source/ui/func/fuinsfil.cxx
index f57a8556137a..a71502a61b45 100644
--- a/sd/source/ui/func/fuinsfil.cxx
+++ b/sd/source/ui/func/fuinsfil.cxx
@@ -493,19 +493,18 @@ void FuInsertFile::InsTextOrRTFinDrMode(SfxMedium* pMedium)
}
}
- OutlinerParaObject* pOPO = pOutliner->CreateParaObject();
+ std::unique_ptr<OutlinerParaObject> pOPO = pOutliner->CreateParaObject();
if (pOutlinerView)
{
pOutlinerView->InsertText(*pOPO);
- delete pOPO;
}
else
{
SdrRectObj* pTO = new SdrRectObj(
mpView->getSdrModelFromSdrView(),
OBJ_TEXT);
- pTO->SetOutlinerParaObject(pOPO);
+ pTO->SetOutlinerParaObject(std::move(pOPO));
const bool bUndo = mpView->IsUndoEnabled();
if( bUndo )
diff --git a/sd/source/ui/func/fumorph.cxx b/sd/source/ui/func/fumorph.cxx
index 92e7ed2d488d..45fd78f522a3 100644
--- a/sd/source/ui/func/fumorph.cxx
+++ b/sd/source/ui/func/fumorph.cxx
@@ -25,6 +25,7 @@
#include <svx/svdopath.hxx>
#include <svx/svdogrp.hxx>
#include <editeng/eeitem.hxx>
+#include <editeng/outlobj.hxx>
#include <View.hxx>
#include <ViewShell.hxx>
diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
index 8d5b591de045..d380d2e55bef 100644
--- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
@@ -553,10 +553,9 @@ void SlotManager::GetMenuState (SfxItemSet& rSet)
SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj );
if( pTextObj )
{
- OutlinerParaObject* pParaObj = pTextObj->GetEditOutlinerParaObject();
+ std::unique_ptr<OutlinerParaObject> pParaObj = pTextObj->GetEditOutlinerParaObject();
if( pParaObj )
{
- delete pParaObj;
bDisable = false;
}
}
diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx
index 184b22be9151..6c69c5e266fa 100644
--- a/sd/source/ui/view/DocumentRenderer.cxx
+++ b/sd/source/ui/view/DocumentRenderer.cxx
@@ -1066,7 +1066,7 @@ namespace {
{
public:
OutlinerPrinterPage (
- OutlinerParaObject* pParaObject,
+ std::unique_ptr<OutlinerParaObject> pParaObject,
const MapMode& rMapMode,
const OUString& rsPageString,
const Point& rPageStringOffset,
@@ -1075,15 +1075,10 @@ namespace {
const sal_uInt16 nPaperTray)
: PrinterPage(PageKind::Handout, rMapMode, false, rsPageString,
rPageStringOffset, nDrawMode, eOrientation, nPaperTray),
- mpParaObject(pParaObject)
+ mpParaObject(std::move(pParaObject))
{
}
- virtual ~OutlinerPrinterPage() override
- {
- mpParaObject.reset();
- }
-
virtual void Print (
Printer& rPrinter,
SdDrawDocument& rDocument,
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index c7bd428a3a10..af5b57298246 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -2338,7 +2338,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
OutlinerMode nOutlMode = pOutl->GetMode();
pOutl->SetStyleSheet( 0, nullptr );
pOutl->QuickInsertField( *pFieldItem, ESelection() );
- OutlinerParaObject* pOutlParaObject = pOutl->CreateParaObject();
+ std::unique_ptr<OutlinerParaObject> pOutlParaObject = pOutl->CreateParaObject();
SdrRectObj* pRectObj = new SdrRectObj(
*GetDoc(),
@@ -2360,7 +2360,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
::tools::Rectangle aLogicRect(aPos, aSize);
pRectObj->SetLogicRect(aLogicRect);
- pRectObj->SetOutlinerParaObject( pOutlParaObject );
+ pRectObj->SetOutlinerParaObject( std::move(pOutlParaObject) );
mpDrawView->InsertObjectAtView(pRectObj, *mpDrawView->GetSdrPageView());
pOutl->Init( nOutlMode );
}
diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx
index 33fdf1edf914..a6634821ad7c 100644
--- a/sd/source/ui/view/drviews7.cxx
+++ b/sd/source/ui/view/drviews7.cxx
@@ -379,10 +379,9 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet )
SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj );
if( pTextObj )
{
- OutlinerParaObject* pParaObj = pTextObj->GetEditOutlinerParaObject();
+ std::unique_ptr<OutlinerParaObject> pParaObj = pTextObj->GetEditOutlinerParaObject();
if( pParaObj )
{
- delete pParaObj;
bDisable = false;
}
}
diff --git a/sd/source/ui/view/drviews8.cxx b/sd/source/ui/view/drviews8.cxx
index ca2128ccd556..d21a3ad1eaa1 100644
--- a/sd/source/ui/view/drviews8.cxx
+++ b/sd/source/ui/view/drviews8.cxx
@@ -22,6 +22,7 @@
#include <ViewShellHint.hxx>
#include <com/sun/star/scanner/XScannerManager2.hpp>
+#include <editeng/outlobj.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <sfx2/dispatch.hxx>
#include <svx/svxids.hrc>
diff --git a/sd/source/ui/view/drviews9.cxx b/sd/source/ui/view/drviews9.cxx
index b253e25098ec..c6db972461c7 100644
--- a/sd/source/ui/view/drviews9.cxx
+++ b/sd/source/ui/view/drviews9.cxx
@@ -20,6 +20,7 @@
#include <config_features.h>
#include <DrawViewShell.hxx>
+#include <editeng/outlobj.hxx>
#include <vcl/wrkwin.hxx>
#include <svx/xgrad.hxx>
#include <svx/svdpagv.hxx>
diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx
index 0792f0cc281a..eaf4612ef6b9 100644
--- a/sd/source/ui/view/drviewse.cxx
+++ b/sd/source/ui/view/drviewse.cxx
@@ -31,6 +31,7 @@
#include <vcl/waitobj.hxx>
#include <svl/aeitem.hxx>
#include <editeng/editstat.hxx>
+#include <editeng/outlobj.hxx>
#include <vcl/weld.hxx>
#include <svl/urlbmk.hxx>
#include <svx/svdpagv.hxx>
@@ -1456,7 +1457,7 @@ void DrawViewShell::InsertURLField(const OUString& rURL, const OUString& rText,
aURLField.SetTargetFrame(rTarget);
SvxFieldItem aURLItem(aURLField, EE_FEATURE_FIELD);
pOutl->QuickInsertField( aURLItem, ESelection() );
- OutlinerParaObject* pOutlParaObject = pOutl->CreateParaObject();
+ std::unique_ptr<OutlinerParaObject> pOutlParaObject = pOutl->CreateParaObject();
SdrRectObj* pRectObj = new SdrRectObj(
GetView()->getSdrModelFromSdrView(),
@@ -1476,7 +1477,7 @@ void DrawViewShell::InsertURLField(const OUString& rURL, const OUString& rText,
::tools::Rectangle aLogicRect(aPos, aSize);
pRectObj->SetLogicRect(aLogicRect);
- pRectObj->SetOutlinerParaObject( pOutlParaObject );
+ pRectObj->SetOutlinerParaObject( std::move(pOutlParaObject) );
mpDrawView->InsertObjectAtView(pRectObj, *mpDrawView->GetSdrPageView());
pOutl->Init( nOutlMode );
}
diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx
index 2434813299e6..e8de41e29cb1 100644
--- a/sd/source/ui/view/outlnvsh.cxx
+++ b/sd/source/ui/view/outlnvsh.cxx
@@ -971,10 +971,9 @@ void OutlineViewShell::GetMenuState( SfxItemSet &rSet )
SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj );
if( pTextObj )
{
- OutlinerParaObject* pParaObj = pTextObj->GetEditOutlinerParaObject();
+ std::unique_ptr<OutlinerParaObject> pParaObj = pTextObj->GetEditOutlinerParaObject();
if( pParaObj )
{
- delete pParaObj;
bDisable = false;
}
}
@@ -1593,7 +1592,9 @@ void OutlineViewShell::UpdateTitleObject( SdPage* pPage, Paragraph const * pPara
}
// if we have a title object and a text, set the text
- OutlinerParaObject* pOPO = pTO ? rOutliner.CreateParaObject(rOutliner.GetAbsPos(pPara), 1) : nullptr;
+ std::unique_ptr<OutlinerParaObject> pOPO;
+ if (pTO)
+ pOPO = rOutliner.CreateParaObject(rOutliner.GetAbsPos(pPara), 1);
if (pOPO)
{
pOPO->SetOutlinerMode( OutlinerMode::TitleObject );
@@ -1601,7 +1602,6 @@ void OutlineViewShell::UpdateTitleObject( SdPage* pPage, Paragraph const * pPara
if( pTO->GetOutlinerParaObject() && (pOPO->GetTextObject() == pTO->GetOutlinerParaObject()->GetTextObject()) )
{
// do nothing, same text already set
- delete pOPO;
}
else
{
@@ -1609,7 +1609,7 @@ void OutlineViewShell::UpdateTitleObject( SdPage* pPage, Paragraph const * pPara
if( !bNewObject && pOlView->isRecordingUndo() )
pOlView->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoObjectSetText(*pTO,0));
- pTO->SetOutlinerParaObject( pOPO );
+ pTO->SetOutlinerParaObject( std::move(pOPO) );
pTO->SetEmptyPresObj( false );
pTO->ActionChanged();
}
@@ -1654,7 +1654,7 @@ void OutlineViewShell::UpdateOutlineObject( SdPage* pPage, Paragraph* pPara )
return;
::Outliner& rOutliner = pOlView->GetOutliner();
- OutlinerParaObject* pOPO = nullptr;
+ std::unique_ptr<OutlinerParaObject> pOPO;
SdrTextObj* pTO = nullptr;
bool bNewObject = false;
@@ -1703,20 +1703,17 @@ void OutlineViewShell::UpdateOutlineObject( SdPage* pPage, Paragraph* pPara )
if( pTO->GetOutlinerParaObject() && (pOPO->GetTextObject() == pTO->GetOutlinerParaObject()->GetTextObject()) )
{
// do nothing, same text already set
- delete pOPO;
}
else
{
if( !bNewObject && pOlView->isRecordingUndo() )
pOlView->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoObjectSetText(*pTO,0));
- pTO->SetOutlinerParaObject( pOPO );
+ pTO->SetOutlinerParaObject( std::move(pOPO) );
pTO->SetEmptyPresObj( false );
pTO->ActionChanged();
}
}
- else
- delete pOPO;
}
else if( pTO )
{
diff --git a/sd/source/ui/view/outlview.cxx b/sd/source/ui/view/outlview.cxx
index 1d04b5ecc3c1..534a484ce810 100644
--- a/sd/source/ui/view/outlview.cxx
+++ b/sd/source/ui/view/outlview.cxx
@@ -1339,11 +1339,10 @@ SvtScriptType OutlineView::GetScriptType() const
{
SvtScriptType nScriptType = ::sd::View::GetScriptType();
- OutlinerParaObject* pTempOPObj = mrOutliner.CreateParaObject();
+ std::unique_ptr<OutlinerParaObject> pTempOPObj = mrOutliner.CreateParaObject();
if(pTempOPObj)
{
nScriptType = pTempOPObj->GetTextObject().GetScriptType();
- delete pTempOPObj;
}
return nScriptType;
diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx
index d03cc9dfede4..ca98672ef38c 100644
--- a/sd/source/ui/view/sdview.cxx
+++ b/sd/source/ui/view/sdview.cxx
@@ -21,6 +21,7 @@
#include <com/sun/star/linguistic2/XSpellChecker1.hpp>
#include <View.hxx>
+#include <editeng/outlobj.hxx>
#include <editeng/unolingu.hxx>
#include <sfx2/request.hxx>
#include <svx/obj3d.hxx>
diff --git a/sd/source/ui/view/sdview4.cxx b/sd/source/ui/view/sdview4.cxx
index fa9a48ea1a2c..61671f11d991 100644
--- a/sd/source/ui/view/sdview4.cxx
+++ b/sd/source/ui/view/sdview4.cxx
@@ -21,6 +21,7 @@
#include <View.hxx>
#include <osl/file.hxx>
+#include <editeng/outlobj.hxx>
#include <sfx2/bindings.hxx>
#include <sfx2/request.hxx>
#include <sfx2/docfilt.hxx>
diff --git a/sd/source/ui/view/viewshe2.cxx b/sd/source/ui/view/viewshe2.cxx
index 2b45314c419a..885422b508c5 100644
--- a/sd/source/ui/view/viewshe2.cxx
+++ b/sd/source/ui/view/viewshe2.cxx
@@ -36,6 +36,7 @@
#include <sfx2/dispatch.hxx>
#include <sfx2/app.hxx>
#include <svx/ruler.hxx>
+#include <editeng/outlobj.hxx>
#include <editeng/outliner.hxx>
#include <svtools/ehdl.hxx>
#include <svx/svdoole2.hxx>