summaryrefslogtreecommitdiff
path: root/svx/source/svdraw
diff options
context:
space:
mode:
authorNoel <noel.grandin@collabora.co.uk>2021-02-19 15:53:30 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-02-20 11:38:55 +0100
commitd8ed3bda462b351d2b98ec57cfdb879e0eec0010 (patch)
tree10d3696813b853e6b90cf045d89b9203206004b9 /svx/source/svdraw
parenta87fa0206bbcbcf9aa13ee17f6f41d34e176775e (diff)
loplugin:refcounting in svx
Change-Id: I79afd219a29ad176ce72020579d2b29a0b3ec09d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111220 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source/svdraw')
-rw-r--r--svx/source/svdraw/svdobj.cxx3
-rw-r--r--svx/source/svdraw/svdotextdecomposition.cxx19
-rw-r--r--svx/source/svdraw/svdotextpathdecomposition.cxx22
3 files changed, 20 insertions, 24 deletions
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index dad689840f04..c68c952b8f54 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -2885,7 +2885,8 @@ css::uno::Reference< css::uno::XInterface > SdrObject::getUnoShape()
// the most basic stuff like SdrInventor::E3d and SdrInventor::Default. All
// the other SdrInventor enum entries are from overloads and are *not accessible*
// using this fallback (!) - what a bad trap
- mpSvxShape = SvxDrawPage::CreateShapeByTypeAndInventor( GetObjIdentifier(), GetObjInventor(), this );
+ rtl::Reference<SvxShape> xNewShape = SvxDrawPage::CreateShapeByTypeAndInventor( GetObjIdentifier(), GetObjInventor(), this );
+ mpSvxShape = xNewShape.get();
maWeakUnoShape = xShape = static_cast< ::cppu::OWeakObject* >( mpSvxShape );
}
}
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx
index fd53bf0e9d3d..9c8c419873e9 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -94,7 +94,7 @@ namespace
DECL_LINK(decomposeStretchBulletPrimitive, DrawBulletInfo*, void);
void impCreateTextPortionPrimitive(const DrawPortionInfo& rInfo);
- static drawinglayer::primitive2d::BasePrimitive2D* impCheckFieldPrimitive(drawinglayer::primitive2d::BasePrimitive2D* pPrimitive, const DrawPortionInfo& rInfo);
+ static rtl::Reference<drawinglayer::primitive2d::BasePrimitive2D> impCheckFieldPrimitive(drawinglayer::primitive2d::BasePrimitive2D* pPrimitive, const DrawPortionInfo& rInfo);
void impFlushTextPortionPrimitivesToLinePrimitives();
void impFlushLinePrimitivesToParagraphPrimitives(sal_Int32 nPara);
void impHandleDrawPortionInfo(const DrawPortionInfo& rInfo);
@@ -252,7 +252,7 @@ namespace
const bool bWordLineMode(rInfo.mrFont.IsWordLineMode() && !rInfo.mbEndOfBullet);
// prepare new primitive
- drawinglayer::primitive2d::BasePrimitive2D* pNewPrimitive = nullptr;
+ rtl::Reference<drawinglayer::primitive2d::BasePrimitive2D> pNewPrimitive;
const bool bDecoratedIsNeeded(
LINESTYLE_NONE != rInfo.mrFont.GetOverline()
|| LINESTYLE_NONE != rInfo.mrFont.GetUnderline()
@@ -376,7 +376,7 @@ namespace
if(rInfo.mpFieldData)
{
- pNewPrimitive = impCheckFieldPrimitive(pNewPrimitive, rInfo);
+ pNewPrimitive = impCheckFieldPrimitive(pNewPrimitive.get(), rInfo);
}
maTextPortionPrimitives.push_back(pNewPrimitive);
@@ -444,8 +444,9 @@ namespace
}
}
- drawinglayer::primitive2d::BasePrimitive2D* impTextBreakupHandler::impCheckFieldPrimitive(drawinglayer::primitive2d::BasePrimitive2D* pPrimitive, const DrawPortionInfo& rInfo)
+ rtl::Reference<drawinglayer::primitive2d::BasePrimitive2D> impTextBreakupHandler::impCheckFieldPrimitive(drawinglayer::primitive2d::BasePrimitive2D* pPrimitive, const DrawPortionInfo& rInfo)
{
+ rtl::Reference<drawinglayer::primitive2d::BasePrimitive2D> xRet = pPrimitive;
if(rInfo.mpFieldData)
{
// Support for FIELD_SEQ_BEGIN, FIELD_SEQ_END. If used, create a TextHierarchyFieldPrimitive2D
@@ -471,19 +472,19 @@ namespace
meValues.emplace_back("Representation", pURLField->GetRepresentation());
meValues.emplace_back("TargetFrame", pURLField->GetTargetFrame());
meValues.emplace_back("SvxURLFormat", OUString::number(static_cast<sal_uInt16>(pURLField->GetFormat())));
- pPrimitive = new drawinglayer::primitive2d::TextHierarchyFieldPrimitive2D(aSequence, drawinglayer::primitive2d::FIELD_TYPE_URL, &meValues);
+ xRet = new drawinglayer::primitive2d::TextHierarchyFieldPrimitive2D(aSequence, drawinglayer::primitive2d::FIELD_TYPE_URL, &meValues);
}
else if(pPageField)
{
- pPrimitive = new drawinglayer::primitive2d::TextHierarchyFieldPrimitive2D(aSequence, drawinglayer::primitive2d::FIELD_TYPE_PAGE);
+ xRet = new drawinglayer::primitive2d::TextHierarchyFieldPrimitive2D(aSequence, drawinglayer::primitive2d::FIELD_TYPE_PAGE);
}
else
{
- pPrimitive = new drawinglayer::primitive2d::TextHierarchyFieldPrimitive2D(aSequence, drawinglayer::primitive2d::FIELD_TYPE_COMMON);
+ xRet = new drawinglayer::primitive2d::TextHierarchyFieldPrimitive2D(aSequence, drawinglayer::primitive2d::FIELD_TYPE_COMMON);
}
}
- return pPrimitive;
+ return xRet;
}
void impTextBreakupHandler::impFlushTextPortionPrimitivesToLinePrimitives()
@@ -557,7 +558,7 @@ namespace
// embed in TextHierarchyBulletPrimitive2D
const drawinglayer::primitive2d::Primitive2DContainer aNewSequence { aNewReference };
- drawinglayer::primitive2d::BasePrimitive2D* pNewPrimitive = new drawinglayer::primitive2d::TextHierarchyBulletPrimitive2D(aNewSequence);
+ rtl::Reference<drawinglayer::primitive2d::BasePrimitive2D> pNewPrimitive = new drawinglayer::primitive2d::TextHierarchyBulletPrimitive2D(aNewSequence);
// add to output
maTextPortionPrimitives.push_back(pNewPrimitive);
diff --git a/svx/source/svdraw/svdotextpathdecomposition.cxx b/svx/source/svdraw/svdotextpathdecomposition.cxx
index a607d05c7800..44f72ec8de07 100644
--- a/svx/source/svdraw/svdotextpathdecomposition.cxx
+++ b/svx/source/svdraw/svdotextpathdecomposition.cxx
@@ -497,7 +497,7 @@ namespace
const Color aShadowColor(maSdrFormTextAttribute.getFormTextShdwColor());
const basegfx::BColor aRGBShadowColor(aShadowColor.getBColor());
- drawinglayer::primitive2d::TextSimplePortionPrimitive2D* pNew =
+ mrShadowDecomposition.push_back(
new drawinglayer::primitive2d::TextSimplePortionPrimitive2D(
aNewTransformB * aNewShadowTransform * aNewTransformA,
pCandidate->getText(),
@@ -506,9 +506,7 @@ namespace
aNewDXArray,
aCandidateFontAttribute,
pCandidate->getLocale(),
- aRGBShadowColor);
-
- mrShadowDecomposition.push_back(pNew);
+ aRGBShadowColor) );
}
{
@@ -516,7 +514,7 @@ namespace
const Color aColor(pCandidate->getFont().GetColor());
const basegfx::BColor aRGBColor(aColor.getBColor());
- drawinglayer::primitive2d::TextSimplePortionPrimitive2D* pNew =
+ mrDecomposition.push_back(
new drawinglayer::primitive2d::TextSimplePortionPrimitive2D(
aNewTransformB * aNewTransformA,
pCandidate->getText(),
@@ -525,9 +523,7 @@ namespace
aNewDXArray,
aCandidateFontAttribute,
pCandidate->getLocale(),
- aRGBColor);
-
- mrDecomposition.push_back(pNew);
+ aRGBColor) );
}
}
@@ -564,10 +560,9 @@ namespace
for(auto const& rPolygon : aB2DPolyPolygon)
{
// create one primitive per polygon
- drawinglayer::primitive2d::PolygonStrokePrimitive2D* pNew =
+ rTarget.push_back(
new drawinglayer::primitive2d::PolygonStrokePrimitive2D(
- rPolygon, rLineAttribute, rStrokeAttribute);
- rTarget.push_back(pNew);
+ rPolygon, rLineAttribute, rStrokeAttribute) );
}
}
}
@@ -614,11 +609,10 @@ namespace
aStrokePrimitiveSequence[b] = drawinglayer::primitive2d::Primitive2DReference(aStrokePrimitives[b]);
}
- drawinglayer::primitive2d::UnifiedTransparencePrimitive2D* pNew2 =
+ aNewPrimitives.push_back(
new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(
aStrokePrimitiveSequence,
- static_cast<double>(rOutlineAttribute.getTransparence()) / 100.0);
- aNewPrimitives.push_back(pNew2);
+ static_cast<double>(rOutlineAttribute.getTransparence()) / 100.0) );
}
else
{