summaryrefslogtreecommitdiff
path: root/svx/source/svdraw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-09-05 20:52:48 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-09-06 08:50:50 +0200
commit396473a3d6ddd1f1ee2d4e0fd3bae5c41d2cc3fd (patch)
tree9450276aa36268b94779482cb3e5d4c1ab9a4f11 /svx/source/svdraw
parent8494a95f29c74b06cfdf78c6a218ddeba81e3914 (diff)
use unique_ptr in ImpConvertContainedTextToSdrPathObjs
Change-Id: I7995bb3e8732ec20b941bd029e5a77aa78d09592 Reviewed-on: https://gerrit.libreoffice.org/78673 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source/svdraw')
-rw-r--r--svx/source/svdraw/svdoashp.cxx8
-rw-r--r--svx/source/svdraw/svdocirc.cxx6
-rw-r--r--svx/source/svdraw/svdoedge.cxx6
-rw-r--r--svx/source/svdraw/svdograf.cxx2
-rw-r--r--svx/source/svdraw/svdomeas.cxx6
-rw-r--r--svx/source/svdraw/svdopath.cxx8
-rw-r--r--svx/source/svdraw/svdorect.cxx8
-rw-r--r--svx/source/svdraw/svdotxtr.cxx22
8 files changed, 33 insertions, 33 deletions
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
index 70c523de5c56..d42b0d17e81e 100644
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -2802,7 +2802,7 @@ basegfx::B2DPolyPolygon SdrObjCustomShape::TakeContour() const
SdrObject* SdrObjCustomShape::DoConvertToPolyObj(bool bBezier, bool bAddText) const
{
// #i37011#
- SdrObject* pRetval = nullptr;
+ SdrObjectUniquePtr pRetval;
SdrObject* pRenderedCustomShape = nullptr;
if ( !mXRenderedCustomShape.is() )
@@ -2821,7 +2821,7 @@ SdrObject* SdrObjCustomShape::DoConvertToPolyObj(bool bBezier, bool bAddText) co
// Clone to same SdrModel
SdrObject* pCandidate(pRenderedCustomShape->CloneSdrObject(pRenderedCustomShape->getSdrModelFromSdrObject()));
DBG_ASSERT(pCandidate, "SdrObjCustomShape::DoConvertToPolyObj: Could not clone SdrObject (!)");
- pRetval = pCandidate->DoConvertToPolyObj(bBezier, bAddText);
+ pRetval.reset(pCandidate->DoConvertToPolyObj(bBezier, bAddText));
SdrObject::Free( pCandidate );
if(pRetval)
@@ -2835,11 +2835,11 @@ SdrObject* SdrObjCustomShape::DoConvertToPolyObj(bool bBezier, bool bAddText) co
if(bAddText && HasText() && !IsTextPath())
{
- pRetval = ImpConvertAddText(pRetval, bBezier);
+ pRetval = ImpConvertAddText(std::move(pRetval), bBezier);
}
}
- return pRetval;
+ return pRetval.release();
}
void SdrObjCustomShape::NbcSetStyleSheet( SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr )
diff --git a/svx/source/svdraw/svdocirc.cxx b/svx/source/svdraw/svdocirc.cxx
index 2af9ac8e6d09..6e05fce61690 100644
--- a/svx/source/svdraw/svdocirc.cxx
+++ b/svx/source/svdraw/svdocirc.cxx
@@ -1151,14 +1151,14 @@ SdrObject* SdrCircObj::DoConvertToPolyObj(bool bBezier, bool bAddText) const
{
const bool bFill(meCircleKind != SdrCircKind::Arc);
const basegfx::B2DPolygon aCircPolygon(ImpCalcXPolyCirc(meCircleKind, maRect, nStartAngle, nEndAngle));
- SdrObject* pRet = ImpConvertMakeObj(basegfx::B2DPolyPolygon(aCircPolygon), bFill, bBezier).release();
+ SdrObjectUniquePtr pRet = ImpConvertMakeObj(basegfx::B2DPolyPolygon(aCircPolygon), bFill, bBezier);
if(bAddText)
{
- pRet = ImpConvertAddText(pRet, bBezier);
+ pRet = ImpConvertAddText(std::move(pRet), bBezier);
}
- return pRet;
+ return pRet.release();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/svdraw/svdoedge.cxx b/svx/source/svdraw/svdoedge.cxx
index 07512a1e01d5..97c057836359 100644
--- a/svx/source/svdraw/svdoedge.cxx
+++ b/svx/source/svdraw/svdoedge.cxx
@@ -2405,14 +2405,14 @@ SdrObject* SdrEdgeObj::DoConvertToPolyObj(bool bBezier, bool bAddText) const
{
basegfx::B2DPolyPolygon aPolyPolygon;
aPolyPolygon.append(pEdgeTrack->getB2DPolygon());
- SdrObject* pRet = ImpConvertMakeObj(aPolyPolygon, false, bBezier).release();
+ SdrObjectUniquePtr pRet = ImpConvertMakeObj(aPolyPolygon, false, bBezier);
if(bAddText)
{
- pRet = ImpConvertAddText(pRet, bBezier);
+ pRet = ImpConvertAddText(std::move(pRet), bBezier);
}
- return pRet;
+ return pRet.release();
}
sal_uInt32 SdrEdgeObj::GetSnapPointCount() const
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index 329bbaf768ea..306f0543ab97 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -957,7 +957,7 @@ SdrObject* SdrGrafObj::DoConvertToPolyObj(bool bBezier, bool bAddText ) const
if(bAddText)
{
- pRetval = ImpConvertAddText(pRetval, bBezier);
+ pRetval = ImpConvertAddText(SdrObjectUniquePtr(pRetval), bBezier).release();
}
// convert all children
diff --git a/svx/source/svdraw/svdomeas.cxx b/svx/source/svdraw/svdomeas.cxx
index 6e5591a129e4..7f01b2074582 100644
--- a/svx/source/svdraw/svdomeas.cxx
+++ b/svx/source/svdraw/svdomeas.cxx
@@ -1141,7 +1141,7 @@ SdrObject* SdrMeasureObj::DoConvertToPolyObj(bool bBezier, bool bAddText) const
SfxStyleSheet* pStyleSheet = GetStyleSheet();
// prepare group
- SdrObjGroup* pGroup = new SdrObjGroup(getSdrModelFromSdrObject());
+ std::unique_ptr<SdrObjGroup,SdrObjectFreeOp> pGroup(new SdrObjGroup(getSdrModelFromSdrObject()));
// prepare parameters
basegfx::B2DPolyPolygon aPolyPoly;
@@ -1259,11 +1259,11 @@ SdrObject* SdrMeasureObj::DoConvertToPolyObj(bool bBezier, bool bAddText) const
if(bAddText)
{
- return ImpConvertAddText(pGroup, bBezier);
+ return ImpConvertAddText(std::move(pGroup), bBezier).release();
}
else
{
- return pGroup;
+ return pGroup.release();
}
}
diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx
index e15e2c9e12a8..e15e8a6b8e55 100644
--- a/svx/source/svdraw/svdopath.cxx
+++ b/svx/source/svdraw/svdopath.cxx
@@ -2676,7 +2676,7 @@ SdrObject* SdrPathObj::DoConvertToPolyObj(bool bBezier, bool bAddText) const
const bool bHideContour(
!aText.isDefault() && !aText.getSdrFormTextAttribute().isDefault() && aText.isHideContour());
- SdrObject* pRet = nullptr;
+ SdrObjectUniquePtr pRet;
if(!bHideContour)
{
@@ -2698,15 +2698,15 @@ SdrObject* SdrPathObj::DoConvertToPolyObj(bool bBezier, bool bAddText) const
pPath->SetPathPoly(basegfx::utils::expandToCurve(pPath->GetPathPoly()));
}
}
- pRet = pPath.release();
+ pRet = std::move(pPath);
}
if(bAddText)
{
- pRet = ImpConvertAddText(pRet, bBezier);
+ pRet = ImpConvertAddText(std::move(pRet), bBezier);
}
- return pRet;
+ return pRet.release();
}
SdrObjGeoData* SdrPathObj::NewGeoData() const
diff --git a/svx/source/svdraw/svdorect.cxx b/svx/source/svdraw/svdorect.cxx
index 6b8c328b154f..43da02b4c7d2 100644
--- a/svx/source/svdraw/svdorect.cxx
+++ b/svx/source/svdraw/svdorect.cxx
@@ -564,22 +564,22 @@ SdrObject* SdrRectObj::DoConvertToPolyObj(bool bBezier, bool bAddText) const
basegfx::B2DPolyPolygon aPolyPolygon(aXP.getB2DPolygon());
aPolyPolygon.removeDoublePoints();
- SdrObject* pRet = nullptr;
+ SdrObjectUniquePtr pRet;
// small correction: Do not create something when no fill and no line. To
// be sure to not damage something with non-text frames, do this only
// when used with bAddText==false from other converters
if((bAddText && !IsTextFrame()) || HasFill() || HasLine())
{
- pRet = ImpConvertMakeObj(aPolyPolygon, true, bBezier).release();
+ pRet = ImpConvertMakeObj(aPolyPolygon, true, bBezier);
}
if(bAddText)
{
- pRet = ImpConvertAddText(pRet, bBezier);
+ pRet = ImpConvertAddText(std::move(pRet), bBezier);
}
- return pRet;
+ return pRet.release();
}
void SdrRectObj::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
diff --git a/svx/source/svdraw/svdotxtr.cxx b/svx/source/svdraw/svdotxtr.cxx
index 6a9050b6cb6c..d4203b212cd2 100644
--- a/svx/source/svdraw/svdotxtr.cxx
+++ b/svx/source/svdraw/svdotxtr.cxx
@@ -287,9 +287,9 @@ void SdrTextObj::NbcMirror(const Point& rRef1, const Point& rRef2)
}
-SdrObject* SdrTextObj::ImpConvertContainedTextToSdrPathObjs(bool bToPoly) const
+SdrObjectUniquePtr SdrTextObj::ImpConvertContainedTextToSdrPathObjs(bool bToPoly) const
{
- SdrObject* pRetval = nullptr;
+ SdrObjectUniquePtr pRetval;
if(!ImpCanConvTextToCurve())
{
@@ -398,7 +398,7 @@ SdrObject* SdrTextObj::ImpConvertContainedTextToSdrPathObjs(bool bToPoly) const
}
else if(1 == pObjectList->GetObjCount())
{
- pRetval = pObjectList->RemoveObject(0);
+ pRetval.reset(pObjectList->RemoveObject(0));
// always use SdrObject::Free(...) for SdrObjects (!)
SdrObject* pTemp(pGroup);
@@ -406,7 +406,7 @@ SdrObject* SdrTextObj::ImpConvertContainedTextToSdrPathObjs(bool bToPoly) const
}
else
{
- pRetval = pGroup;
+ pRetval.reset(pGroup);
}
}
}
@@ -419,7 +419,7 @@ SdrObject* SdrTextObj::DoConvertToPolyObj(bool bBezier, bool bAddText) const
{
if(bAddText)
{
- return ImpConvertContainedTextToSdrPathObjs(!bBezier);
+ return ImpConvertContainedTextToSdrPathObjs(!bBezier).release();
}
return nullptr;
@@ -464,14 +464,14 @@ SdrPathObjUniquePtr SdrTextObj::ImpConvertMakeObj(const basegfx::B2DPolyPolygon&
return pPathObj;
}
-SdrObject* SdrTextObj::ImpConvertAddText(SdrObject* pObj, bool bBezier) const
+SdrObjectUniquePtr SdrTextObj::ImpConvertAddText(SdrObjectUniquePtr pObj, bool bBezier) const
{
if(!ImpCanConvTextToCurve())
{
return pObj;
}
- SdrObject* pText = ImpConvertContainedTextToSdrPathObjs(!bBezier);
+ SdrObjectUniquePtr pText = ImpConvertContainedTextToSdrPathObjs(!bBezier);
if(!pText)
{
@@ -487,17 +487,17 @@ SdrObject* SdrTextObj::ImpConvertAddText(SdrObject* pObj, bool bBezier) const
{
// is already group object, add partial shape in front
SdrObjList* pOL=pText->GetSubList();
- pOL->InsertObject(pObj,0);
+ pOL->InsertObject(pObj.release(),0);
return pText;
}
else
{
// not yet a group, create one and add partial and new shapes
- SdrObjGroup* pGrp=new SdrObjGroup(getSdrModelFromSdrObject());
+ std::unique_ptr<SdrObjGroup, SdrObjectFreeOp> pGrp(new SdrObjGroup(getSdrModelFromSdrObject()));
SdrObjList* pOL=pGrp->GetSubList();
- pOL->InsertObject(pObj);
- pOL->InsertObject(pText);
+ pOL->InsertObject(pObj.release());
+ pOL->InsertObject(pText.release());
return pGrp;
}