From 38ad50ebf48ded180b6bee2a41b10a2bd62d0ff1 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Thu, 26 Mar 2026 01:57:03 +0500 Subject: [PATCH] Move OXSDDataType to use OPropertyImplHelper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Simplifies the implementation, removing boilerplate. Change-Id: I56942a0b847995d680f65387b314c6eb27199198 Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/241 Reviewed-by: Caolán McNamara Tested-by: Jenkins CPCI (cherry picked from commit dbb5e6bcd8e8edb3ed3346fb331cb6d38f1f5252) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205666 Reviewed-by: Xisco Fauli Tested-by: Xisco Fauli --- forms/source/xforms/datatypes.cxx | 55 ++------------------------- forms/source/xforms/datatypes.hxx | 34 ++++++----------- include/comphelper/propimplhelper.hxx | 2 +- 3 files changed, 17 insertions(+), 74 deletions(-) diff --git a/forms/source/xforms/datatypes.cxx b/forms/source/xforms/datatypes.cxx index 4739c1ead758..c5126fbb6bdf 100644 --- a/forms/source/xforms/datatypes.cxx +++ b/forms/source/xforms/datatypes.cxx @@ -98,11 +98,6 @@ namespace xforms } - IMPLEMENT_FORWARD_XINTERFACE2( OXSDDataType, OXSDDataType_Base, ::comphelper::OPropertyContainer2 ) - - - IMPLEMENT_FORWARD_XTYPEPROVIDER2( OXSDDataType, OXSDDataType_Base, ::comphelper::OPropertyContainer2 ) - OUString SAL_CALL OXSDDataType::getName( ) { return m_sName; @@ -232,10 +227,10 @@ namespace xforms } - bool OXSDDataType::convertFastPropertyValue( std::unique_lock& rGuard, Any& _rConvertedValue, Any& _rOldValue, sal_Int32 _nHandle, const Any& _rValue ) + bool OXSDDataType::convertFastPropertyValue( std::unique_lock& /*rGuard*/, Any& _rConvertedValue, Any& _rOldValue, sal_Int32 _nHandle, const Any& _rValue ) { // let the base class do the conversion - if ( !::comphelper::OPropertyContainer2::convertFastPropertyValue( rGuard, _rConvertedValue, _rOldValue, _nHandle, _rValue ) ) + if ( !OPropertyContainerHelper::convertFastPropertyValue( _rConvertedValue, _rOldValue, _nHandle, _rValue ) ) return false; // sanity checks @@ -249,9 +244,9 @@ namespace xforms } - void OXSDDataType::setFastPropertyValue_NoBroadcast( std::unique_lock& rGuard, sal_Int32 _nHandle, const Any& _rValue ) + void OXSDDataType::setFastPropertyValue_NoBroadcast( std::unique_lock& /*rGuard*/, sal_Int32 _nHandle, const Any& _rValue ) { - ::comphelper::OPropertyContainer2::setFastPropertyValue_NoBroadcast( rGuard, _nHandle, _rValue ); + OPropertyContainerHelper::setFastPropertyValue( _nHandle, _rValue ); if ( _nHandle == PROPERTY_ID_XSD_PATTERN ) m_bPatternMatcherDirty = true; } @@ -277,41 +272,6 @@ namespace xforms } - void SAL_CALL OXSDDataType::setPropertyValue( const OUString& aPropertyName, const Any& aValue ) - { - ::comphelper::OPropertyContainer2::setPropertyValue( aPropertyName, aValue ); - } - - - Any SAL_CALL OXSDDataType::getPropertyValue( const OUString& PropertyName ) - { - return ::comphelper::OPropertyContainer2::getPropertyValue( PropertyName ); - } - - - void SAL_CALL OXSDDataType::addPropertyChangeListener( const OUString& aPropertyName, const Reference< XPropertyChangeListener >& xListener ) - { - ::comphelper::OPropertyContainer2::addPropertyChangeListener( aPropertyName, xListener ); - } - - - void SAL_CALL OXSDDataType::removePropertyChangeListener( const OUString& aPropertyName, const Reference< XPropertyChangeListener >& aListener ) - { - ::comphelper::OPropertyContainer2::removePropertyChangeListener( aPropertyName, aListener ); - } - - - void SAL_CALL OXSDDataType::addVetoableChangeListener( const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener ) - { - ::comphelper::OPropertyContainer2::addVetoableChangeListener( PropertyName, aListener ); - } - - - void SAL_CALL OXSDDataType::removeVetoableChangeListener( const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener ) - { - ::comphelper::OPropertyContainer2::removeVetoableChangeListener( PropertyName, aListener ); - } - OValueLimitedType_Base::OValueLimitedType_Base( const OUString& _rName, sal_Int16 _nTypeClass ) :OXSDDataType( _rName, _nTypeClass ) ,m_fCachedMaxInclusive( 0 ) @@ -1165,13 +1125,6 @@ template< typename CONCRETE_DATA_TYPE_IMPL, typename SUPERCLASS > } -template< typename CONCRETE_DATA_TYPE_IMPL, typename SUPERCLASS > -css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL ODerivedDataType< CONCRETE_DATA_TYPE_IMPL, SUPERCLASS >::getPropertySetInfo() -{ - return ::cppu::OPropertySetHelper::createPropertySetInfo( getInfoHelper() ); -} - - template< typename CONCRETE_DATA_TYPE_IMPL, typename SUPERCLASS > ::cppu::IPropertyArrayHelper& ODerivedDataType< CONCRETE_DATA_TYPE_IMPL, SUPERCLASS >::getInfoHelper() { diff --git a/forms/source/xforms/datatypes.hxx b/forms/source/xforms/datatypes.hxx index bc1428ab7bab..a6bbb9846755 100644 --- a/forms/source/xforms/datatypes.hxx +++ b/forms/source/xforms/datatypes.hxx @@ -24,10 +24,10 @@ #include #include #include -#include -#include -#include + #include +#include +#include #include #include @@ -44,11 +44,9 @@ namespace xforms //= OXSDDataType - typedef ::comphelper::WeakImplHelper < css::xsd::XDataType - > OXSDDataType_Base; - - class OXSDDataType :public OXSDDataType_Base - ,public ::comphelper::OPropertyContainer2 + class OXSDDataType + : public comphelper::OPropertyImplHelper>, + public comphelper::OPropertyContainerHelper { private: // @@ -76,9 +74,6 @@ namespace xforms virtual ~OXSDDataType() override; public: - DECLARE_XINTERFACE() - DECLARE_XTYPEPROVIDER() - virtual OUString SAL_CALL getName( ) override; virtual void SAL_CALL setName( const OUString& aName ) override; virtual OUString SAL_CALL getPattern() override; @@ -91,14 +86,6 @@ namespace xforms virtual sal_Bool SAL_CALL validate( const OUString& value ) override; virtual OUString SAL_CALL explainInvalid( const OUString& value ) override; - // XPropertySet - is a base of XDataType and needs to be disambiguated - virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; - virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; - virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; - virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; - virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; - virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; - public: rtl::Reference clone( const OUString& _rNewName ) const; @@ -110,6 +97,12 @@ namespace xforms sal_Int32 nHandle, const css::uno::Any& rValue ) override; + using OPropertyImplHelper::setFastPropertyValue; + using OPropertyImplHelper::getFastPropertyValue; + virtual void getFastPropertyValue( std::unique_lock&, css::uno::Any& rValue, sal_Int32 nHandle ) const override + { + OPropertyContainerHelper::getFastPropertyValue( rValue, nHandle ); + } // --- own overridables --- // helper for implementing cloning of data types @@ -213,9 +206,6 @@ namespace xforms protected: // OPropertyArrayUsageHelper virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override; - - // XPropertySet - virtual css::uno::Reference SAL_CALL getPropertySetInfo() override; virtual ::cppu::IPropertyArrayHelper& getInfoHelper() override; }; diff --git a/include/comphelper/propimplhelper.hxx b/include/comphelper/propimplhelper.hxx index 952fcd3ace1d..484a5d5a7767 100644 --- a/include/comphelper/propimplhelper.hxx +++ b/include/comphelper/propimplhelper.hxx @@ -1,6 +1,6 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* - * Copyright the Collabora Office contributors. + * Copyright the LibreOffice contributors. * * SPDX-License-Identifier: MPL-2.0 *