summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-05-02 13:00:30 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-05-02 13:58:07 +0200
commitbe48eb2e82a3d8891ee84145567e2b89884f1fd6 (patch)
tree17e123be98ce578c3ff10c31a275141dfe2e3afa /svx
parentf66edd357c4572fd69d42c2330f922ec2beaa415 (diff)
return std::unique_ptr from SdrMakeOutliner
and some of its callers Change-Id: I121a7810e3e35e76da4ffe5fc5405a7bf86cb66d Reviewed-on: https://gerrit.libreoffice.org/53728 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/inc/svdoutlinercache.hxx2
-rw-r--r--svx/source/sdr/properties/textproperties.cxx3
-rw-r--r--svx/source/svdraw/svdedxv.cxx2
-rw-r--r--svx/source/svdraw/svdetc.cxx4
-rw-r--r--svx/source/svdraw/svdmodel.cxx8
-rw-r--r--svx/source/svdraw/svdoutlinercache.cxx10
-rw-r--r--svx/source/table/tablecontroller.cxx4
-rw-r--r--svx/source/unodraw/unoshtxt.cxx2
8 files changed, 17 insertions, 18 deletions
diff --git a/svx/source/inc/svdoutlinercache.hxx b/svx/source/inc/svdoutlinercache.hxx
index 30f5c6699e11..9eba3da602c9 100644
--- a/svx/source/inc/svdoutlinercache.hxx
+++ b/svx/source/inc/svdoutlinercache.hxx
@@ -41,7 +41,7 @@ public:
SdrOutlinerCache( SdrModel* pModel );
~SdrOutlinerCache();
- SdrOutliner* createOutliner( OutlinerMode nOutlinerMode );
+ std::unique_ptr<SdrOutliner> createOutliner( OutlinerMode nOutlinerMode );
void disposeOutliner( SdrOutliner* pOutliner );
std::vector< SdrOutliner* > GetActiveOutliners() const;
};
diff --git a/svx/source/sdr/properties/textproperties.cxx b/svx/source/sdr/properties/textproperties.cxx
index aac5e1b59a2d..503872cb4ba6 100644
--- a/svx/source/sdr/properties/textproperties.cxx
+++ b/svx/source/sdr/properties/textproperties.cxx
@@ -397,7 +397,7 @@ namespace sdr
if(!rObj.IsTextEditActive() && !rObj.IsLinkedText())
{
- Outliner* pOutliner = SdrMakeOutliner(OutlinerMode::OutlineObject, rObj.getSdrModelFromSdrObject());
+ std::unique_ptr<Outliner> pOutliner = SdrMakeOutliner(OutlinerMode::OutlineObject, rObj.getSdrModelFromSdrObject());
const svx::ITextProvider& rTextProvider(getTextProvider());
sal_Int32 nText = rTextProvider.getTextCount();
while (nText--)
@@ -525,7 +525,6 @@ namespace sdr
pOutliner->Clear();
}
- delete pOutliner;
}
}
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index 21e1f10d43f7..211537d4c411 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -1091,7 +1091,7 @@ bool SdrObjEditView::SdrBeginTextEdit(
mxTextEditObj.reset( pObj );
pTextEditOutliner=pGivenOutliner;
if (pTextEditOutliner==nullptr)
- pTextEditOutliner = SdrMakeOutliner( OutlinerMode::TextObject, mxTextEditObj->getSdrModelFromSdrObject() );
+ pTextEditOutliner = SdrMakeOutliner( OutlinerMode::TextObject, mxTextEditObj->getSdrModelFromSdrObject() ).release();
{
SvtAccessibilityOptions aOptions;
diff --git a/svx/source/svdraw/svdetc.cxx b/svx/source/svdraw/svdetc.cxx
index 3633bfbba696..fb8aab8a82ec 100644
--- a/svx/source/svdraw/svdetc.cxx
+++ b/svx/source/svdraw/svdetc.cxx
@@ -331,10 +331,10 @@ bool GetDraftFillColor(const SfxItemSet& rSet, Color& rCol)
return bRetval;
}
-SdrOutliner* SdrMakeOutliner(OutlinerMode nOutlinerMode, SdrModel& rModel)
+std::unique_ptr<SdrOutliner> SdrMakeOutliner(OutlinerMode nOutlinerMode, SdrModel& rModel)
{
SfxItemPool* pPool = &rModel.GetItemPool();
- SdrOutliner* pOutl = new SdrOutliner( pPool, nOutlinerMode );
+ std::unique_ptr<SdrOutliner> pOutl(new SdrOutliner( pPool, nOutlinerMode ));
pOutl->SetEditTextObjectPool( pPool );
pOutl->SetStyleSheetPool( static_cast<SfxStyleSheetPool*>(rModel.GetStyleSheetPool()));
pOutl->SetDefTab(rModel.GetDefaultTabulator());
diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx
index ccb3e52d3416..47fdc5fa4e92 100644
--- a/svx/source/svdraw/svdmodel.cxx
+++ b/svx/source/svdraw/svdmodel.cxx
@@ -198,15 +198,15 @@ void SdrModel::ImpCtor(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* _pEmbe
// can't create DrawOutliner OnDemand, because I can't get the Pool,
// then (only from 302 onwards!)
- pDrawOutliner.reset(SdrMakeOutliner(OutlinerMode::TextObject, *this));
+ pDrawOutliner = SdrMakeOutliner(OutlinerMode::TextObject, *this);
ImpSetOutlinerDefaults(pDrawOutliner.get(), true);
- pHitTestOutliner.reset(SdrMakeOutliner(OutlinerMode::TextObject, *this));
+ pHitTestOutliner = SdrMakeOutliner(OutlinerMode::TextObject, *this);
ImpSetOutlinerDefaults(pHitTestOutliner.get(), true);
/* Start Text Chaining related code */
// Initialize Chaining Outliner
- pChainingOutliner.reset(SdrMakeOutliner( OutlinerMode::TextObject, *this ));
+ pChainingOutliner = SdrMakeOutliner( OutlinerMode::TextObject, *this );
ImpSetOutlinerDefaults(pChainingOutliner.get(), true);
// Make a TextChain
@@ -1861,7 +1861,7 @@ void SdrModel::ReformatAllTextObjects()
ImpReformatAllTextObjects();
}
-SdrOutliner* SdrModel::createOutliner( OutlinerMode nOutlinerMode )
+std::unique_ptr<SdrOutliner> SdrModel::createOutliner( OutlinerMode nOutlinerMode )
{
if( !mpOutlinerCache )
mpOutlinerCache.reset(new SdrOutlinerCache(this));
diff --git a/svx/source/svdraw/svdoutlinercache.cxx b/svx/source/svdraw/svdoutlinercache.cxx
index 419837070d4f..fe66e5f0a42f 100644
--- a/svx/source/svdraw/svdoutlinercache.cxx
+++ b/svx/source/svdraw/svdoutlinercache.cxx
@@ -30,18 +30,18 @@ SdrOutlinerCache::SdrOutlinerCache( SdrModel* pModel )
{
}
-SdrOutliner* SdrOutlinerCache::createOutliner( OutlinerMode nOutlinerMode )
+std::unique_ptr<SdrOutliner> SdrOutlinerCache::createOutliner( OutlinerMode nOutlinerMode )
{
- SdrOutliner* pOutliner = nullptr;
+ std::unique_ptr<SdrOutliner> pOutliner;
if( (OutlinerMode::OutlineObject == nOutlinerMode) && !maModeOutline.empty() )
{
- pOutliner = maModeOutline.back().release();
+ pOutliner = std::move(maModeOutline.back());
maModeOutline.pop_back();
}
else if( (OutlinerMode::TextObject == nOutlinerMode) && !maModeText.empty() )
{
- pOutliner = maModeText.back().release();
+ pOutliner = std::move(maModeText.back());
maModeText.pop_back();
}
else
@@ -49,7 +49,7 @@ SdrOutliner* SdrOutlinerCache::createOutliner( OutlinerMode nOutlinerMode )
pOutliner = SdrMakeOutliner(nOutlinerMode, *mpModel);
Outliner& aDrawOutliner = mpModel->GetDrawOutliner();
pOutliner->SetCalcFieldValueHdl( aDrawOutliner.GetCalcFieldValueHdl() );
- maActiveOutliners.insert(pOutliner);
+ maActiveOutliners.insert(pOutliner.get());
}
return pOutliner;
diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx
index 0e2b612c85e4..ecdd0a233be5 100644
--- a/svx/source/table/tablecontroller.cxx
+++ b/svx/source/table/tablecontroller.cxx
@@ -1907,12 +1907,12 @@ void SvxTableController::EditCell(const CellPos& rPos, vcl::Window* pWindow, Tbl
// create new outliner, owner will be the SdrObjEditView
SdrModel& rModel(rTableObj.getSdrModelFromSdrObject());
- SdrOutliner* pOutl(SdrMakeOutliner(OutlinerMode::OutlineObject, rModel));
+ std::unique_ptr<SdrOutliner> pOutl(SdrMakeOutliner(OutlinerMode::OutlineObject, rModel));
if (pOutl && rTableObj.IsVerticalWriting())
pOutl->SetVertical( true );
- if (mrView.SdrBeginTextEdit(&rTableObj, pPV, pWindow, true, pOutl))
+ if (mrView.SdrBeginTextEdit(&rTableObj, pPV, pWindow, true, pOutl.release()))
{
maCursorLastPos = maCursorFirstPos = rPos;
diff --git a/svx/source/unodraw/unoshtxt.cxx b/svx/source/unodraw/unoshtxt.cxx
index 9fdefcbb5791..779d7c066e8e 100644
--- a/svx/source/unodraw/unoshtxt.cxx
+++ b/svx/source/unodraw/unoshtxt.cxx
@@ -516,7 +516,7 @@ SvxTextForwarder* SvxTextEditSourceImpl::GetBackgroundTextForwarder()
if( pTextObj && pTextObj->IsTextFrame() && pTextObj->GetTextKind() == OBJ_OUTLINETEXT )
nOutlMode = OutlinerMode::OutlineObject;
- mpOutliner = mpModel->createOutliner( nOutlMode );
+ mpOutliner = mpModel->createOutliner( nOutlMode ).release();
// Do the setup after outliner creation, would be useless otherwise
if( HasView() )