[Libreoffice-commits] core.git: forms/source

Noel (via logerrit) logerrit at kemper.freedesktop.org
Fri Feb 26 09:00:55 UTC 2021


 forms/source/component/Columns.cxx         |    3 +--
 forms/source/component/Columns.hxx         |    7 ++++---
 forms/source/xforms/datatyperepository.cxx |    2 +-
 forms/source/xforms/datatypes.cxx          |    8 ++++----
 forms/source/xforms/datatypes.hxx          |    9 +++++----
 5 files changed, 15 insertions(+), 14 deletions(-)

New commits:
commit 9c1ec551524a75c20c1468a6fc0101eb2480e8e3
Author:     Noel <noel.grandin at collabora.co.uk>
AuthorDate: Thu Feb 25 14:50:15 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Feb 26 10:00:06 2021 +0100

    loplugin:refcounting in forms
    
    Change-Id: Idba46c8b30a3c44f12c0aaa8a00477865ecfb848
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111542
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/forms/source/component/Columns.cxx b/forms/source/component/Columns.cxx
index 95438dc86cbf..50a9e05875d6 100644
--- a/forms/source/component/Columns.cxx
+++ b/forms/source/component/Columns.cxx
@@ -455,8 +455,7 @@ Any OGridColumn::getPropertyDefaultByHandle( sal_Int32 nHandle ) const
 
 Reference< XCloneable > SAL_CALL OGridColumn::createClone(  )
 {
-    OGridColumn* pNewColumn = createCloneColumn();
-    return pNewColumn;
+    return createCloneColumn();
 }
 
 // XPersistObject
diff --git a/forms/source/component/Columns.hxx b/forms/source/component/Columns.hxx
index 010252615930..2f2bb3e846be 100644
--- a/forms/source/component/Columns.hxx
+++ b/forms/source/component/Columns.hxx
@@ -32,6 +32,7 @@
 #include <comphelper/uno3.hxx>
 #include <cppuhelper/basemutex.hxx>
 #include <cppuhelper/compbase2.hxx>
+#include <rtl/ref.hxx>
 
 using namespace comphelper;
 
@@ -106,7 +107,7 @@ protected:
     static void clearAggregateProperties(css::uno::Sequence< css::beans::Property>& seqProps, bool bAllowDropDown);
     static void setOwnProperties(css::uno::Sequence< css::beans::Property>& seqProps);
 
-    virtual OGridColumn* createCloneColumn() const = 0;
+    virtual rtl::Reference<OGridColumn> createCloneColumn() const = 0;
 };
 
 #define DECL_COLUMN(ClassName)                                                                              \
@@ -126,7 +127,7 @@ public:
         css::uno::Sequence< css::beans::Property >& /* [out] */ _rAggregateProps  \
         ) const override;                                                                                            \
                                                                                                             \
-    virtual OGridColumn* createCloneColumn() const override;                                                         \
+    virtual rtl::Reference<OGridColumn> createCloneColumn() const override;                                                         \
 };
 
 
@@ -160,7 +161,7 @@ void ClassName::fillProperties( \
         setOwnProperties(_rProps); \
     } \
 } \
-OGridColumn* ClassName::createCloneColumn() const \
+rtl::Reference<OGridColumn> ClassName::createCloneColumn() const \
 { \
     return new ClassName( this ); \
 } \
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<OXSDDataType> 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> OXSDDataType::clone( const OUString& _rNewName ) const
     {
-        OXSDDataType* pClone = createClone( _rNewName );
+        rtl::Reference<OXSDDataType> pClone = createClone( _rNewName );
         pClone->initializeClone( *this );
         return pClone;
     }
@@ -568,7 +568,7 @@ namespace xforms
     {
     }
 
-    OXSDDataType* OBooleanType::createClone( const OUString& _rName ) const
+    rtl::Reference<OXSDDataType> 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<OXSDDataType> 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 <comphelper/propertycontainer.hxx>
 #include <comphelper/proparrhlp.hxx>
 #include <comphelper/broadcasthelper.hxx>
+#include <rtl/ref.hxx>
 
 #include <unicode/regex.h>
 
@@ -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<OXSDDataType> 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<OXSDDataType> 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<OXSDDataType> 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<OXSDDataType> classname::createClone( const OUString& _rName ) const              \
     {                                                       \
         return new classname( _rName, getTypeClass() );     \
     }                                                       \


More information about the Libreoffice-commits mailing list