Move OXSDDataType to use OPropertyImplHelper

Simplifies the implementation, removing boilerplate.

Change-Id: I56942a0b847995d680f65387b314c6eb27199198
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/241
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit dbb5e6bcd8e8edb3ed3346fb331cb6d38f1f5252)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205666
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
Mike Kaganski
2026-05-25 14:32:41 +02:00
committed by Xisco Fauli
parent f6af0683df
commit 38ad50ebf4
3 changed files with 17 additions and 74 deletions
+4 -51
View File
@@ -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<std::mutex>& rGuard, Any& _rConvertedValue, Any& _rOldValue, sal_Int32 _nHandle, const Any& _rValue )
bool OXSDDataType::convertFastPropertyValue( std::unique_lock<std::mutex>& /*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<std::mutex>& rGuard, sal_Int32 _nHandle, const Any& _rValue )
void OXSDDataType::setFastPropertyValue_NoBroadcast( std::unique_lock<std::mutex>& /*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()
{
+12 -22
View File
@@ -24,10 +24,10 @@
#include <com/sun/star/util/Time.hpp>
#include <com/sun/star/util/DateTime.hpp>
#include <com/sun/star/xsd/XDataType.hpp>
#include <comphelper/compbase.hxx>
#include <comphelper/uno3.hxx>
#include <comphelper/propertycontainer2.hxx>
#include <comphelper/proparrhlp.hxx>
#include <comphelper/propertycontainerhelper.hxx>
#include <comphelper/propimplhelper.hxx>
#include <rtl/ref.hxx>
#include <unotools/resmgr.hxx>
@@ -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<comphelper::WeakImplHelper<css::xsd::XDataType>>,
public comphelper::OPropertyContainerHelper
{
private:
// <properties>
@@ -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<OXSDDataType> 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<std::mutex>&, 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<css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override;
virtual ::cppu::IPropertyArrayHelper& getInfoHelper() override;
};
+1 -1
View File
@@ -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
*