diff options
author | Noel Grandin <noel@peralex.com> | 2015-07-13 16:17:00 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2015-08-03 06:37:16 +0000 |
commit | 2660d24a07866e083c5135ea263030f3e3a2e729 (patch) | |
tree | 0089d6018d4fc33a7fde955e585e77191cdd258b /svx | |
parent | baba1d14766282bd2c592bffd79ed69f9078cfe1 (diff) |
new loplugin: refcounting
This was a feature requested by mmeeks, as a result of
tdf#92611.
It validates that things that extend XInterface are not
directly heap/stack-allocated, but have their lifecycle managed
via css::uno::Reference or rtl::Reference.
Change-Id: I28e3b8b236f6a4a56d0a6d6f26ad54e44b36e692
Reviewed-on: https://gerrit.libreoffice.org/16924
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/sdr/contact/viewcontactofgraphic.cxx | 6 | ||||
-rw-r--r-- | svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx | 14 | ||||
-rw-r--r-- | svx/source/xml/xmlxtexp.cxx | 4 |
3 files changed, 12 insertions, 12 deletions
diff --git a/svx/source/sdr/contact/viewcontactofgraphic.cxx b/svx/source/sdr/contact/viewcontactofgraphic.cxx index 4f07fea76ec5..d59308a9b3c3 100644 --- a/svx/source/sdr/contact/viewcontactofgraphic.cxx +++ b/svx/source/sdr/contact/viewcontactofgraphic.cxx @@ -268,7 +268,7 @@ namespace sdr aScale, fShearX, fRotate, aTranslate)); // directly create temp SdrBlockTextPrimitive2D - drawinglayer::primitive2d::SdrBlockTextPrimitive2D aBlockTextPrimitive( + css::uno::Reference< drawinglayer::primitive2d::SdrBlockTextPrimitive2D > xBlockTextPrimitive(new drawinglayer::primitive2d::SdrBlockTextPrimitive2D( pSdrText, *pOPO, aTextRangeTransform, @@ -278,7 +278,7 @@ namespace sdr false, false, false, - false); + false)); // decompose immediately with neutral ViewInformation. This will // layout the text to more simple TextPrimitives from drawinglayer @@ -286,7 +286,7 @@ namespace sdr drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence( xRetval, - aBlockTextPrimitive.get2DDecomposition(aViewInformation2D)); + xBlockTextPrimitive->get2DDecomposition(aViewInformation2D)); } } diff --git a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx index 146bb629d7cd..fff348d45c4a 100644 --- a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx @@ -86,7 +86,7 @@ namespace drawinglayer Primitive2DSequence SdrMeasurePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const { Primitive2DSequence aRetval; - boost::scoped_ptr<SdrBlockTextPrimitive2D> pBlockText; + css::uno::Reference<SdrBlockTextPrimitive2D> xBlockText; basegfx::B2DRange aTextRange; double fTextX((getStart().getX() + getEnd().getX()) * 0.5); double fTextY((getStart().getX() + getEnd().getX()) * 0.5); @@ -125,7 +125,7 @@ namespace drawinglayer } // create primitive and get text range - pBlockText.reset(new SdrBlockTextPrimitive2D( + xBlockText = new SdrBlockTextPrimitive2D( &rTextAttribute.getSdrText(), rTextAttribute.getOutlinerParaObject(), aTextMatrix, @@ -135,9 +135,9 @@ namespace drawinglayer false, false, false, - false)); + false); - aTextRange = pBlockText->getB2DRange(aViewInformation); + aTextRange = xBlockText->getB2DRange(aViewInformation); } // prepare line attribute and result @@ -401,7 +401,7 @@ namespace drawinglayer aRetval = Primitive2DSequence(&xHiddenLines, 1); } - if(pBlockText) + if(xBlockText.is()) { // create transformation to text primitive end position basegfx::B2DHomMatrix aChange; @@ -419,9 +419,9 @@ namespace drawinglayer aChange *= aObjectMatrix; // apply to existing text primitive - SdrTextPrimitive2D* pNewBlockText = pBlockText->createTransformedClone(aChange); + SdrTextPrimitive2D* pNewBlockText = xBlockText->createTransformedClone(aChange); OSL_ENSURE(pNewBlockText, "SdrMeasurePrimitive2D::create2DDecomposition: Could not create transformed clone of text primitive (!)"); - pBlockText.reset(); + xBlockText.clear(); // add to local primitives appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(pNewBlockText)); diff --git a/svx/source/xml/xmlxtexp.cxx b/svx/source/xml/xmlxtexp.cxx index 83239424f13a..3e301f26ab91 100644 --- a/svx/source/xml/xmlxtexp.cxx +++ b/svx/source/xml/xmlxtexp.cxx @@ -299,8 +299,8 @@ bool SvxXMLXTableExportComponent::save( // Finally do the export const OUString aName; - SvxXMLXTableExportComponent aExporter( xContext, aName, xHandler, xTable, xGrfResolver ); - bRet = aExporter.exportTable(); + uno::Reference< SvxXMLXTableExportComponent > xExporter( new SvxXMLXTableExportComponent( xContext, aName, xHandler, xTable, xGrfResolver ) ); + bRet = xExporter->exportTable(); if( pGraphicHelper ) SvXMLGraphicHelper::Destroy( pGraphicHelper ); |