diff options
author | Noel <noel.grandin@collabora.co.uk> | 2021-02-19 11:25:58 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-02-19 11:29:21 +0100 |
commit | 3f95cbcda193c2e87159ba3e8c137f8a12643c84 (patch) | |
tree | 840aca6d924a02384bbc9735e12261684df7acbd /vbahelper | |
parent | ea42fc20b9bf904ad5be1f5a362d9c3d46549362 (diff) |
loplugin:refcounting in vbahelper
Change-Id: I91c4ce6529e18a309e7b6d4432b612f7d38f817e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111197
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vbahelper')
-rw-r--r-- | vbahelper/source/vbahelper/vbacommandbarcontrols.cxx | 7 | ||||
-rw-r--r-- | vbahelper/source/vbahelper/vbashapes.cxx | 9 |
2 files changed, 9 insertions, 7 deletions
diff --git a/vbahelper/source/vbahelper/vbacommandbarcontrols.cxx b/vbahelper/source/vbahelper/vbacommandbarcontrols.cxx index 643c4aa71445..1b35964446b0 100644 --- a/vbahelper/source/vbahelper/vbacommandbarcontrols.cxx +++ b/vbahelper/source/vbahelper/vbacommandbarcontrols.cxx @@ -19,6 +19,7 @@ #include "vbacommandbarcontrols.hxx" #include "vbacommandbarcontrol.hxx" #include <com/sun/star/lang/XSingleComponentFactory.hpp> +#include <rtl/ref.hxx> using namespace com::sun::star; using namespace ooo::vba; @@ -132,7 +133,7 @@ ScVbaCommandBarControls::createCollectionObject( const uno::Any& aSource ) m_xIndexAccess->getByIndex( nPosition ) >>= aProps; uno::Reference< container::XIndexAccess > xSubMenu; getPropertyValue( aProps, ITEM_DESCRIPTOR_CONTAINER ) >>= xSubMenu; - ScVbaCommandBarControl* pNewCommandBarControl = nullptr; + rtl::Reference<ScVbaCommandBarControl> pNewCommandBarControl; if( xSubMenu.is() ) pNewCommandBarControl = new ScVbaCommandBarPopup( this, mxContext, m_xIndexAccess, pCBarHelper, m_xBarSettings, m_sResourceUrl, nPosition ); else @@ -220,13 +221,13 @@ ScVbaCommandBarControls::Add( const uno::Any& Type, const uno::Any& Id, const un pCBarHelper->ApplyTempChange( m_sResourceUrl, m_xBarSettings ); - ScVbaCommandBarControl* pNewCommandBarControl = nullptr; + rtl::Reference<ScVbaCommandBarControl> pNewCommandBarControl; if( nType == office::MsoControlType::msoControlPopup ) pNewCommandBarControl = new ScVbaCommandBarPopup( this, mxContext, m_xIndexAccess, pCBarHelper, m_xBarSettings, m_sResourceUrl, nPosition ); else pNewCommandBarControl = new ScVbaCommandBarButton( this, mxContext, m_xIndexAccess, pCBarHelper, m_xBarSettings, m_sResourceUrl, nPosition ); - return uno::Reference< XCommandBarControl >( pNewCommandBarControl ); + return pNewCommandBarControl; } // XHelperInterface diff --git a/vbahelper/source/vbahelper/vbashapes.cxx b/vbahelper/source/vbahelper/vbashapes.cxx index 118082fa9667..c14f81791f95 100644 --- a/vbahelper/source/vbahelper/vbashapes.cxx +++ b/vbahelper/source/vbahelper/vbashapes.cxx @@ -42,6 +42,7 @@ #include <vbahelper/vbashape.hxx> #include <vbahelper/vbashapes.hxx> #include <vbahelper/vbashaperange.hxx> +#include <rtl/ref.hxx> using namespace ::ooo::vba; using namespace ::com::sun::star; @@ -238,7 +239,7 @@ ScVbaShapes::AddRectangle(sal_Int32 startX, sal_Int32 startY, sal_Int32 nLineWid size.Width = nWidth; xShape->setSize( size ); - ScVbaShape *pScVbaShape = new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, m_xModel, ScVbaShape::getType( xShape ) ); + rtl::Reference<ScVbaShape> pScVbaShape = new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, m_xModel, ScVbaShape::getType( xShape ) ); return uno::makeAny( uno::Reference< msforms::XShape > ( pScVbaShape ) ); } @@ -280,7 +281,7 @@ ScVbaShapes::AddEllipse(sal_Int32 startX, sal_Int32 startY, sal_Int32 nLineWidth size.Width = nWidth; xShape->setSize(size); - ScVbaShape *pScVbaShape = new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, m_xModel, ScVbaShape::getType( xShape ) ); + rtl::Reference<ScVbaShape> pScVbaShape = new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, m_xModel, ScVbaShape::getType( xShape ) ); return uno::makeAny( uno::Reference< msforms::XShape > ( pScVbaShape ) ); } @@ -315,7 +316,7 @@ ScVbaShapes::AddLine( sal_Int32 StartX, sal_Int32 StartY, sal_Int32 endX, sal_In size.Width = nWidth; xShape->setSize(size); - ScVbaShape *pScVbaShape = new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, m_xModel, ScVbaShape::getType( xShape ) ); + rtl::Reference<ScVbaShape> pScVbaShape = new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, m_xModel, ScVbaShape::getType( xShape ) ); return uno::makeAny( uno::Reference< msforms::XShape > ( pScVbaShape ) ); } @@ -382,7 +383,7 @@ ScVbaShapes::AddTextboxInWriter( sal_Int32 _nLeft, sal_Int32 _nTop, sal_Int32 _n xShapeProps->setPropertyValue( "LayerName", uno::makeAny( OUString("Heaven") ) ); - ScVbaShape *pScVbaShape = new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, m_xModel, ScVbaShape::getType( xShape ) ); + rtl::Reference<ScVbaShape> pScVbaShape = new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, m_xModel, ScVbaShape::getType( xShape ) ); return uno::makeAny( uno::Reference< msforms::XShape > ( pScVbaShape ) ); } |