forms/source/component/scrollbar.hxx  |    4 ++-
 forms/source/component/spinbutton.hxx |    4 ++-
 forms/source/inc/FormComponent.hxx    |    6 -----
 forms/source/xforms/datatypes.cxx     |   35 +++++++++++++++++++++++++++-------
 forms/source/xforms/datatypes.hxx     |   30 +++++++++--------------------
 5 files changed, 44 insertions(+), 35 deletions(-)

New commits:
commit a2222061223af8946a9ddb6d52f62c912f892356
Author:     Julien Nabet <serval2...@yahoo.fr>
AuthorDate: Sun Nov 7 10:25:04 2021 +0100
Commit:     Julien Nabet <serval2...@yahoo.fr>
CommitDate: Sun Nov 7 11:17:48 2021 +0100

    Replace some macros in forms part 13
    
    Remove DECLARE_DEFAULT_CLONING + IMPLEMENT_DEFAULT_TYPED_CLONING + 
DECLARE_XPERSISTOBJECT
    
    Change-Id: Ib874cadcfd30c3ac9e2d12036482868c19a2d98b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124807
    Tested-by: Jenkins
    Reviewed-by: Julien Nabet <serval2...@yahoo.fr>

diff --git a/forms/source/component/scrollbar.hxx 
b/forms/source/component/scrollbar.hxx
index 356d101be40e..574faaff38c7 100644
--- a/forms/source/component/scrollbar.hxx
+++ b/forms/source/component/scrollbar.hxx
@@ -39,7 +39,9 @@ namespace frm
         virtual ::css::uno::Sequence< OUString > SAL_CALL 
getSupportedServiceNames() override;
 
         // XPersistObject
-        DECLARE_XPERSISTOBJECT()
+        virtual OUString SAL_CALL getServiceName() override;
+        virtual void SAL_CALL write(const css::uno::Reference< 
css::io::XObjectOutputStream>& _rxOutStream) override;
+        virtual void SAL_CALL read(const css::uno::Reference< 
css::io::XObjectInputStream>& _rxInStream) override;
 
         // XCloneable
         virtual css::uno::Reference< css::util::XCloneable > SAL_CALL 
createClone(  ) override;
diff --git a/forms/source/component/spinbutton.hxx 
b/forms/source/component/spinbutton.hxx
index 2579c322d733..debbfc72d286 100644
--- a/forms/source/component/spinbutton.hxx
+++ b/forms/source/component/spinbutton.hxx
@@ -40,7 +40,9 @@ namespace frm
         virtual ::css::uno::Sequence< OUString > SAL_CALL 
getSupportedServiceNames(  ) override;
 
         // XPersistObject
-        DECLARE_XPERSISTOBJECT()
+        virtual OUString SAL_CALL getServiceName() override;
+        virtual void SAL_CALL write(const css::uno::Reference< 
css::io::XObjectOutputStream>& _rxOutStream) override;
+        virtual void SAL_CALL read(const css::uno::Reference< 
css::io::XObjectInputStream>& _rxInStream) override;
 
         // XCloneable
         virtual css::uno::Reference< css::util::XCloneable > SAL_CALL 
createClone(  ) override;
diff --git a/forms/source/inc/FormComponent.hxx 
b/forms/source/inc/FormComponent.hxx
index 0310e3455a02..8d1f97154cce 100644
--- a/forms/source/inc/FormComponent.hxx
+++ b/forms/source/inc/FormComponent.hxx
@@ -70,12 +70,6 @@ namespace frm
     // default tab index for components
     const sal_Int16 FRM_DEFAULT_TABINDEX = 0;
 
-    // macros for quickly declaring/implementing XServiceInfo
-    #define DECLARE_XPERSISTOBJECT() \
-    virtual OUString SAL_CALL getServiceName() override;    \
-    virtual void SAL_CALL write(const css::uno::Reference< 
css::io::XObjectOutputStream>& _rxOutStream) override;    \
-    virtual void SAL_CALL read(const css::uno::Reference< 
css::io::XObjectInputStream>& _rxInStream) override;
-
     class OControlModel;
 
 
diff --git a/forms/source/xforms/datatypes.cxx 
b/forms/source/xforms/datatypes.cxx
index 464b1c1adbbf..ae7b9d79ca71 100644
--- a/forms/source/xforms/datatypes.cxx
+++ b/forms/source/xforms/datatypes.cxx
@@ -474,7 +474,16 @@ namespace xforms
     }
 
 
-    IMPLEMENT_DEFAULT_TYPED_CLONING( OStringType, OStringType_Base )
+    rtl::Reference<OXSDDataType> OStringType::createClone( const OUString& 
_rName ) const
+    {
+        return new OStringType( _rName, getTypeClass() );
+    }
+    void OStringType::initializeClone( const OXSDDataType& _rCloneSource ) \
+    {
+        OStringType_Base::initializeClone( _rCloneSource );
+        initializeTypedClone( static_cast< const OStringType& >( _rCloneSource 
) );
+    }
+
 
 
     void OStringType::initializeTypedClone( const OStringType& _rCloneSource )
@@ -598,9 +607,15 @@ namespace xforms
     {
     }
 
-
-    IMPLEMENT_DEFAULT_TYPED_CLONING( ODecimalType, ODecimalType_Base )
-
+    rtl::Reference<OXSDDataType> ODecimalType::createClone( const OUString& 
_rName ) const
+    {
+        return new ODecimalType( _rName, getTypeClass() );
+    }
+    void ODecimalType::initializeClone( const OXSDDataType& _rCloneSource ) \
+    {
+        ODecimalType_Base::initializeClone( _rCloneSource );
+        initializeTypedClone( static_cast< const ODecimalType& >( 
_rCloneSource ) );
+    }
 
     void ODecimalType::initializeTypedClone( const ODecimalType& _rCloneSource 
)
     {
@@ -860,9 +875,15 @@ namespace xforms
     {
     }
 
-
-    IMPLEMENT_DEFAULT_TYPED_CLONING( OShortIntegerType, OShortIntegerType_Base 
)
-
+    rtl::Reference<OXSDDataType> OShortIntegerType::createClone( const 
OUString& _rName ) const
+    {
+        return new OShortIntegerType( _rName, getTypeClass() );
+    }
+    void OShortIntegerType::initializeClone( const OXSDDataType& _rCloneSource 
) \
+    {
+        OShortIntegerType_Base::initializeClone( _rCloneSource );
+        initializeTypedClone( static_cast< const OShortIntegerType& >( 
_rCloneSource ) );
+    }
 
     bool OShortIntegerType::_getValue( const OUString& value, double& fValue )
     {
diff --git a/forms/source/xforms/datatypes.hxx 
b/forms/source/xforms/datatypes.hxx
index 84ca5cfe9bdd..119d9bff2f71 100644
--- a/forms/source/xforms/datatypes.hxx
+++ b/forms/source/xforms/datatypes.hxx
@@ -131,21 +131,6 @@ namespace xforms
 
     //= helper for deriving from OXSDDataType
 
-#define DECLARE_DEFAULT_CLONING( classname )        \
-    virtual rtl::Reference<OXSDDataType> createClone( const OUString& _rName ) 
const override;    \
-    virtual void       initializeClone( const OXSDDataType& _rCloneSource ) 
override;
-
-#define IMPLEMENT_DEFAULT_TYPED_CLONING( classname, baseclass )   \
-    rtl::Reference<OXSDDataType> classname::createClone( const OUString& 
_rName ) const              \
-    {                                                       \
-        return new classname( _rName, getTypeClass() );     \
-    }                                                       \
-    void classname::initializeClone( const OXSDDataType& _rCloneSource ) \
-    { \
-        baseclass::initializeClone( _rCloneSource );        \
-        initializeTypedClone( static_cast< const classname& >( _rCloneSource ) 
); \
-    }
-
 #define REGISTER_VOID_PROP( prop, memberAny, type ) \
     registerMayBeVoidProperty( PROPERTY_##prop, PROPERTY_ID_##prop, 
css::beans::PropertyAttribute::BOUND | 
css::beans::PropertyAttribute::MAYBEVOID, \
         &memberAny, cppu::UnoType<type>::get() );
@@ -246,7 +231,8 @@ namespace xforms
         explicit OBooleanType( const OUString& _rName );
 
     protected:
-        DECLARE_DEFAULT_CLONING( OBooleanType )
+        virtual rtl::Reference<OXSDDataType> createClone(const OUString& 
_rName) const override;
+        virtual void initializeClone(const OXSDDataType& _rCloneSource) 
override;
 
         // OXSDDataType overridables
         virtual TranslateId _validate( const OUString& value ) override;
@@ -267,7 +253,8 @@ namespace xforms
         OStringType( const OUString& _rName, sal_Int16 _nTypeClass /* = 
css::xsd::DataTypeClass::STRING */ );
 
     protected:
-        DECLARE_DEFAULT_CLONING( OStringType )
+        virtual rtl::Reference<OXSDDataType> createClone(const OUString& 
_rName) const override;
+        virtual void initializeClone(const OXSDDataType& _rCloneSource) 
override;
         void       initializeTypedClone( const OStringType& _rCloneSource );
 
         // OXSDDataType overridables
@@ -288,7 +275,8 @@ namespace xforms
         ODecimalType( const OUString& _rName, sal_Int16 _nTypeClass /* = 
css::xsd::DataTypeClass::DECIMAL */ );
 
     protected:
-        DECLARE_DEFAULT_CLONING( ODecimalType )
+        virtual rtl::Reference<OXSDDataType> createClone(const OUString& 
_rName) const override;
+        virtual void initializeClone(const OXSDDataType& _rCloneSource) 
override;
         void       initializeTypedClone( const ODecimalType& _rCloneSource );
 
         // OXSDDataType overridables
@@ -316,7 +304,8 @@ namespace xforms
         explicit classname( const OUString& _rName );           \
                                                                 \
     protected:                                                  \
-        DECLARE_DEFAULT_CLONING( classname )                    \
+        virtual rtl::Reference<OXSDDataType> createClone(const OUString& 
_rName) const override; \
+        virtual void initializeClone(const OXSDDataType& _rCloneSource) 
override; \
                                                                 \
         /* OXSDDataType overridables */                         \
         virtual TranslateId         _validate( const OUString& value ) 
override;  \
@@ -353,7 +342,8 @@ namespace xforms
         OShortIntegerType( const OUString& _rName, sal_Int16 _nTypeClass );
 
     protected:
-        DECLARE_DEFAULT_CLONING( OShortIntegerType )
+        virtual rtl::Reference<OXSDDataType> createClone(const OUString& 
_rName) const override;
+        virtual void initializeClone(const OXSDDataType& _rCloneSource) 
override;
 
         // OXSDDataType overridables
         virtual bool            _getValue( const OUString& value, double& 
fValue ) override;

Reply via email to