From 9c1ec551524a75c20c1468a6fc0101eb2480e8e3 Mon Sep 17 00:00:00 2001 From: Noel Date: Thu, 25 Feb 2021 14:50:15 +0200 Subject: loplugin:refcounting in forms Change-Id: Idba46c8b30a3c44f12c0aaa8a00477865ecfb848 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111542 Tested-by: Jenkins Reviewed-by: Noel Grandin --- forms/source/xforms/datatyperepository.cxx | 2 +- forms/source/xforms/datatypes.cxx | 8 ++++---- forms/source/xforms/datatypes.hxx | 9 +++++---- 3 files changed, 10 insertions(+), 9 deletions(-) (limited to 'forms/source/xforms') diff --git a/forms/source/xforms/datatyperepository.cxx b/forms/source/xforms/datatyperepository.cxx index bb0bf4a34135..22a56ce545ee 100644 --- a/forms/source/xforms/datatyperepository.cxx +++ b/forms/source/xforms/datatyperepository.cxx @@ -131,7 +131,7 @@ namespace xforms throw ElementExistException( OUString(), *this ); aTypePos = implLocate( sourceName ); - OXSDDataType* pClone = aTypePos->second->clone( newName ); + rtl::Reference pClone = aTypePos->second->clone( newName ); m_aRepository[ newName ] = pClone; return pClone; diff --git a/forms/source/xforms/datatypes.cxx b/forms/source/xforms/datatypes.cxx index 91175dea907c..c4ce2d941bb4 100644 --- a/forms/source/xforms/datatypes.cxx +++ b/forms/source/xforms/datatypes.cxx @@ -89,9 +89,9 @@ namespace xforms } - OXSDDataType* OXSDDataType::clone( const OUString& _rNewName ) const + rtl::Reference OXSDDataType::clone( const OUString& _rNewName ) const { - OXSDDataType* pClone = createClone( _rNewName ); + rtl::Reference pClone = createClone( _rNewName ); pClone->initializeClone( *this ); return pClone; } @@ -568,7 +568,7 @@ namespace xforms { } - OXSDDataType* OBooleanType::createClone( const OUString& _rName ) const + rtl::Reference OBooleanType::createClone( const OUString& _rName ) const { return new OBooleanType( _rName ); } @@ -695,7 +695,7 @@ namespace xforms :classname##_Base( _rName, DataTypeClass::typeclass ) \ { \ } \ - OXSDDataType* classname::createClone( const OUString& _rName ) const \ + rtl::Reference classname::createClone( const OUString& _rName ) const \ { \ return new classname( _rName ); \ } \ diff --git a/forms/source/xforms/datatypes.hxx b/forms/source/xforms/datatypes.hxx index 18675d5f8959..9ccd85b7db95 100644 --- a/forms/source/xforms/datatypes.hxx +++ b/forms/source/xforms/datatypes.hxx @@ -30,6 +30,7 @@ #include #include #include +#include #include @@ -101,7 +102,7 @@ namespace xforms virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; public: - OXSDDataType* clone( const OUString& _rNewName ) const; + rtl::Reference clone( const OUString& _rNewName ) const; protected: // XPropertySet and friends @@ -113,7 +114,7 @@ namespace xforms // --- own overridables --- // helper for implementing cloning of data types - virtual OXSDDataType* createClone( const OUString& _rName ) const = 0; + virtual rtl::Reference createClone( const OUString& _rName ) const = 0; virtual void initializeClone( const OXSDDataType& _rCloneSource ); // helper method for validate and explainInvalid @@ -131,11 +132,11 @@ namespace xforms //= helper for deriving from OXSDDataType #define DECLARE_DEFAULT_CLONING( classname ) \ - virtual OXSDDataType* createClone( const OUString& _rName ) const override; \ + virtual rtl::Reference createClone( const OUString& _rName ) const override; \ virtual void initializeClone( const OXSDDataType& _rCloneSource ) override; #define IMPLEMENT_DEFAULT_TYPED_CLONING( classname, baseclass ) \ - OXSDDataType* classname::createClone( const OUString& _rName ) const \ + rtl::Reference classname::createClone( const OUString& _rName ) const \ { \ return new classname( _rName, getTypeClass() ); \ } \ -- cgit