forms/source/component/navigationbar.cxx | 11 +--- forms/source/xforms/binding.cxx | 68 ++++++++++++++++---------- forms/source/xforms/datatyperepository.cxx | 75 +++++++++++++++++++++-------- forms/source/xforms/datatypes.cxx | 18 +++++- forms/source/xforms/datatypes.hxx | 4 - forms/source/xforms/model.cxx | 28 ++++------ forms/source/xforms/propertysetbase.hxx | 2 forms/source/xforms/submission.cxx | 71 ++++++++++++++++++--------- 8 files changed, 174 insertions(+), 103 deletions(-)
New commits: commit f63cf9e83a944306ad8564e4ce9b98f92fae666e Author: Julien Nabet <serval2...@yahoo.fr> AuthorDate: Sun Nov 7 12:53:24 2021 +0100 Commit: Julien Nabet <serval2...@yahoo.fr> CommitDate: Sun Nov 7 15:29:02 2021 +0100 Replace some macros in forms part 15 Remove REGISTER_VOID_PROP + REGISTER_BOOL_PROPERTY_RO + REGISTER_PROPERTY_RO + REGISTER_PROPERTY + PROPERTY_RO + PROPERTY + REGISTER_PROPERTY_BOOL + REGISTER_BOOL_PROPERTY + REGISTER_PROPERTY_API Change-Id: Ia38d75e89aafc5788bc143aae864eac9ad5bb86d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124815 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2...@yahoo.fr> diff --git a/forms/source/component/navigationbar.cxx b/forms/source/component/navigationbar.cxx index 788bd1223425..12491dc975a8 100644 --- a/forms/source/component/navigationbar.cxx +++ b/forms/source/component/navigationbar.cxx @@ -44,10 +44,6 @@ namespace frm namespace WritingMode2 = ::com::sun::star::text::WritingMode2; -#define REGISTER_VOID_PROP( prop, memberAny, type ) \ - registerMayBeVoidProperty( PROPERTY_##prop, PROPERTY_ID_##prop, PropertyAttribute::BOUND | PropertyAttribute::MAYBEDEFAULT | PropertyAttribute::MAYBEVOID, \ - &memberAny, cppu::UnoType<type>::get() ); - ONavigationBarModel::ONavigationBarModel( const Reference< XComponentContext >& _rxFactory ) :OControlModel( _rxFactory, OUString() ) ,FontControlModel( true ) @@ -129,8 +125,11 @@ namespace frm registerProperty( PROPERTY_CONTEXT_WRITING_MODE, PROPERTY_ID_CONTEXT_WRITING_MODE, PropertyAttribute::BOUND | PropertyAttribute::MAYBEDEFAULT | PropertyAttribute::TRANSIENT, &m_nContextWritingMode, cppu::UnoType<decltype(m_nContextWritingMode)>::get() ); - REGISTER_VOID_PROP( TABSTOP, m_aTabStop, sal_Bool ); - REGISTER_VOID_PROP( BACKGROUNDCOLOR, m_aBackgroundColor, sal_Int32 ); + registerMayBeVoidProperty( PROPERTY_TABSTOP, PROPERTY_ID_TABSTOP, PropertyAttribute::BOUND | PropertyAttribute::MAYBEDEFAULT | PropertyAttribute::MAYBEVOID, + &m_aTabStop, cppu::UnoType<sal_Bool>::get() ); + + registerMayBeVoidProperty( PROPERTY_BACKGROUNDCOLOR, PROPERTY_ID_BACKGROUNDCOLOR, PropertyAttribute::BOUND | PropertyAttribute::MAYBEDEFAULT | PropertyAttribute::MAYBEVOID, + &m_aBackgroundColor, cppu::UnoType<sal_Int32>::get() ); } diff --git a/forms/source/xforms/binding.cxx b/forms/source/xforms/binding.cxx index 6d8735f6366c..0f176ddabc8f 100644 --- a/forms/source/xforms/binding.cxx +++ b/forms/source/xforms/binding.cxx @@ -1191,36 +1191,52 @@ css::uno::Reference<css::util::XCloneable> SAL_CALL Binding::createClone() // property set implementations +void Binding::initializePropertySet() +{ + registerProperty( PROPERTY_FLAGS( BindingID, OUString, css::beans::PropertyAttribute::BOUND ), + new DirectPropertyAccessor< Binding, OUString >(this, &Binding::setBindingID, &Binding::getBindingID)); -#define REGISTER_PROPERTY( property, type ) \ - registerProperty( PROPERTY( property, type ), \ - new DirectPropertyAccessor< Binding, type >( this, &Binding::set##property, &Binding::get##property ) ); + registerProperty( PROPERTY_FLAGS( BindingExpression, OUString, css::beans::PropertyAttribute::BOUND ), + new DirectPropertyAccessor< Binding, OUString >(this, &Binding::setBindingExpression, &Binding::getBindingExpression)); -#define REGISTER_PROPERTY_RO( property, type ) \ - registerProperty( PROPERTY_RO( property, type ), \ - new DirectPropertyAccessor< Binding, type >( this, nullptr, &Binding::get##property ) ); + registerProperty( PROPERTY_FLAGS( Model, css::uno::Reference<css::xforms::XModel>, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::READONLY ), + new DirectPropertyAccessor< Binding, css::uno::Reference<css::xforms::XModel> >(this, nullptr, &Binding::getModel)); -#define REGISTER_BOOL_PROPERTY_RO( property ) \ - registerProperty( PROPERTY_RO( property, sal_Bool ), \ - new BooleanPropertyAccessor< Binding >( this, nullptr, &Binding::get##property ) ); + registerProperty( PROPERTY_FLAGS( BindingNamespaces, css::uno::Reference<css::container::XNameContainer>, css::beans::PropertyAttribute::BOUND ), + new DirectPropertyAccessor< Binding, css::uno::Reference<css::container::XNameContainer> >(this, &Binding::setBindingNamespaces, &Binding::getBindingNamespaces)); -void Binding::initializePropertySet() -{ - REGISTER_PROPERTY ( BindingID, OUString ); - REGISTER_PROPERTY ( BindingExpression, OUString ); - REGISTER_PROPERTY_RO ( Model, css::uno::Reference<css::xforms::XModel> ); - REGISTER_PROPERTY ( BindingNamespaces, css::uno::Reference<css::container::XNameContainer> ); - REGISTER_PROPERTY ( ModelNamespaces, css::uno::Reference<css::container::XNameContainer> ); - REGISTER_PROPERTY_RO ( ModelID, OUString ); - REGISTER_PROPERTY ( ReadonlyExpression, OUString ); - REGISTER_PROPERTY ( RelevantExpression, OUString ); - REGISTER_PROPERTY ( RequiredExpression, OUString ); - REGISTER_PROPERTY ( ConstraintExpression, OUString ); - REGISTER_PROPERTY ( CalculateExpression, OUString ); - REGISTER_PROPERTY ( Type, OUString ); - REGISTER_PROPERTY_RO ( ReadOnly, bool ); - REGISTER_PROPERTY_RO ( Relevant, bool ); - REGISTER_BOOL_PROPERTY_RO( ExternalData ); + registerProperty( PROPERTY_FLAGS( ModelNamespaces, css::uno::Reference<css::container::XNameContainer>, css::beans::PropertyAttribute::BOUND ), + new DirectPropertyAccessor< Binding, css::uno::Reference<css::container::XNameContainer> >(this, &Binding::setModelNamespaces, &Binding::getModelNamespaces)); + + registerProperty( PROPERTY_FLAGS( ModelID, OUString, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::READONLY ), + new DirectPropertyAccessor< Binding, OUString >(this, nullptr, &Binding::getModelID)); + + registerProperty( PROPERTY_FLAGS( ReadonlyExpression, OUString, css::beans::PropertyAttribute::BOUND ), + new DirectPropertyAccessor< Binding, OUString >(this, &Binding::setReadonlyExpression, &Binding::getReadonlyExpression)); + + registerProperty( PROPERTY_FLAGS( RelevantExpression, OUString, css::beans::PropertyAttribute::BOUND ), + new DirectPropertyAccessor< Binding, OUString >(this, &Binding::setRelevantExpression, &Binding::getRelevantExpression)); + + registerProperty( PROPERTY_FLAGS( RequiredExpression, OUString, css::beans::PropertyAttribute::BOUND ), + new DirectPropertyAccessor< Binding, OUString >(this, &Binding::setRequiredExpression, &Binding::getRequiredExpression)); + + registerProperty( PROPERTY_FLAGS( ConstraintExpression, OUString, css::beans::PropertyAttribute::BOUND ), + new DirectPropertyAccessor< Binding, OUString >(this, &Binding::setConstraintExpression, &Binding::getConstraintExpression)); + + registerProperty( PROPERTY_FLAGS( CalculateExpression, OUString, css::beans::PropertyAttribute::BOUND ), + new DirectPropertyAccessor< Binding, OUString >(this, &Binding::setCalculateExpression, &Binding::getCalculateExpression)); + + registerProperty( PROPERTY_FLAGS( Type, OUString, css::beans::PropertyAttribute::BOUND ), + new DirectPropertyAccessor< Binding, OUString >(this, &Binding::setType, &Binding::getType)); + + registerProperty( PROPERTY_FLAGS( ReadOnly, bool, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::READONLY ), + new DirectPropertyAccessor< Binding, bool >(this, nullptr, &Binding::getReadOnly)); + + registerProperty( PROPERTY_FLAGS( Relevant, bool, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::READONLY ), + new DirectPropertyAccessor< Binding, bool >(this, nullptr, &Binding::getRelevant)); + + registerProperty( PROPERTY_FLAGS( ExternalData, sal_Bool, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::READONLY ), + new BooleanPropertyAccessor< Binding >(this, nullptr, &Binding::getExternalData)); initializePropertyValueCache( HANDLE_ReadOnly ); initializePropertyValueCache( HANDLE_Relevant ); diff --git a/forms/source/xforms/datatyperepository.cxx b/forms/source/xforms/datatyperepository.cxx index 22a56ce545ee..64b37b1a981e 100644 --- a/forms/source/xforms/datatyperepository.cxx +++ b/forms/source/xforms/datatyperepository.cxx @@ -205,10 +205,17 @@ namespace xforms { OValueLimitedType_Base::registerProperties(); - REGISTER_VOID_PROP( XSD_MAX_INCLUSIVE_DATE, m_aMaxInclusive, ValueType ); - REGISTER_VOID_PROP( XSD_MAX_EXCLUSIVE_DATE, m_aMaxExclusive, ValueType ); - REGISTER_VOID_PROP( XSD_MIN_INCLUSIVE_DATE, m_aMinInclusive, ValueType ); - REGISTER_VOID_PROP( XSD_MIN_EXCLUSIVE_DATE, m_aMinExclusive, ValueType ); + registerMayBeVoidProperty( PROPERTY_XSD_MAX_INCLUSIVE_DATE, PROPERTY_ID_XSD_MAX_INCLUSIVE_DATE, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEVOID, + &m_aMaxInclusive, cppu::UnoType<ValueType>::get() ); + + registerMayBeVoidProperty( PROPERTY_XSD_MAX_EXCLUSIVE_DATE, PROPERTY_ID_XSD_MAX_EXCLUSIVE_DATE, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEVOID, + &m_aMaxExclusive, cppu::UnoType<ValueType>::get() ); + + registerMayBeVoidProperty( PROPERTY_XSD_MIN_INCLUSIVE_DATE, PROPERTY_ID_XSD_MIN_INCLUSIVE_DATE, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEVOID, + &m_aMinInclusive, cppu::UnoType<ValueType>::get() ); + + registerMayBeVoidProperty( PROPERTY_XSD_MIN_EXCLUSIVE_DATE, PROPERTY_ID_XSD_MIN_EXCLUSIVE_DATE, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEVOID, + &m_aMinExclusive, cppu::UnoType<ValueType>::get() ); } template<> @@ -216,10 +223,17 @@ namespace xforms { OValueLimitedType_Base::registerProperties(); - REGISTER_VOID_PROP( XSD_MAX_INCLUSIVE_TIME, m_aMaxInclusive, ValueType ); - REGISTER_VOID_PROP( XSD_MAX_EXCLUSIVE_TIME, m_aMaxExclusive, ValueType ); - REGISTER_VOID_PROP( XSD_MIN_INCLUSIVE_TIME, m_aMinInclusive, ValueType ); - REGISTER_VOID_PROP( XSD_MIN_EXCLUSIVE_TIME, m_aMinExclusive, ValueType ); + registerMayBeVoidProperty( PROPERTY_XSD_MAX_INCLUSIVE_TIME, PROPERTY_ID_XSD_MAX_INCLUSIVE_TIME, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEVOID, + &m_aMaxInclusive, cppu::UnoType<ValueType>::get() ); + + registerMayBeVoidProperty( PROPERTY_XSD_MAX_EXCLUSIVE_TIME, PROPERTY_ID_XSD_MAX_EXCLUSIVE_TIME, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEVOID, + &m_aMaxExclusive, cppu::UnoType<ValueType>::get() ); + + registerMayBeVoidProperty( PROPERTY_XSD_MIN_INCLUSIVE_TIME, PROPERTY_ID_XSD_MIN_INCLUSIVE_TIME, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEVOID, + &m_aMinInclusive, cppu::UnoType<ValueType>::get() ); + + registerMayBeVoidProperty( PROPERTY_XSD_MIN_EXCLUSIVE_TIME, PROPERTY_ID_XSD_MIN_EXCLUSIVE_TIME, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEVOID, + &m_aMinExclusive, cppu::UnoType<ValueType>::get() ); } template<> @@ -227,10 +241,17 @@ namespace xforms { OValueLimitedType_Base::registerProperties(); - REGISTER_VOID_PROP( XSD_MAX_INCLUSIVE_DATE_TIME, m_aMaxInclusive, ValueType ); - REGISTER_VOID_PROP( XSD_MAX_EXCLUSIVE_DATE_TIME, m_aMaxExclusive, ValueType ); - REGISTER_VOID_PROP( XSD_MIN_INCLUSIVE_DATE_TIME, m_aMinInclusive, ValueType ); - REGISTER_VOID_PROP( XSD_MIN_EXCLUSIVE_DATE_TIME, m_aMinExclusive, ValueType ); + registerMayBeVoidProperty( PROPERTY_XSD_MAX_INCLUSIVE_DATE_TIME, PROPERTY_ID_XSD_MAX_INCLUSIVE_DATE_TIME, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEVOID, + &m_aMaxInclusive, cppu::UnoType<ValueType>::get() ); + + registerMayBeVoidProperty( PROPERTY_XSD_MAX_EXCLUSIVE_DATE_TIME, PROPERTY_ID_XSD_MAX_EXCLUSIVE_DATE_TIME, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEVOID, + &m_aMaxExclusive, cppu::UnoType<ValueType>::get() ); + + registerMayBeVoidProperty( PROPERTY_XSD_MIN_INCLUSIVE_DATE_TIME, PROPERTY_ID_XSD_MIN_INCLUSIVE_DATE_TIME, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEVOID, + &m_aMinInclusive, cppu::UnoType<ValueType>::get() ); + + registerMayBeVoidProperty( PROPERTY_XSD_MIN_EXCLUSIVE_DATE_TIME, PROPERTY_ID_XSD_MIN_EXCLUSIVE_DATE_TIME, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEVOID, + &m_aMinExclusive, cppu::UnoType<ValueType>::get() ); } template<> @@ -238,10 +259,17 @@ namespace xforms { OValueLimitedType_Base::registerProperties(); - REGISTER_VOID_PROP( XSD_MAX_INCLUSIVE_DOUBLE, m_aMaxInclusive, ValueType ); - REGISTER_VOID_PROP( XSD_MAX_EXCLUSIVE_DOUBLE, m_aMaxExclusive, ValueType ); - REGISTER_VOID_PROP( XSD_MIN_INCLUSIVE_DOUBLE, m_aMinInclusive, ValueType ); - REGISTER_VOID_PROP( XSD_MIN_EXCLUSIVE_DOUBLE, m_aMinExclusive, ValueType ); + registerMayBeVoidProperty( PROPERTY_XSD_MAX_INCLUSIVE_DOUBLE, PROPERTY_ID_XSD_MAX_INCLUSIVE_DOUBLE, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEVOID, + &m_aMaxInclusive, cppu::UnoType<ValueType>::get() ); + + registerMayBeVoidProperty( PROPERTY_XSD_MAX_EXCLUSIVE_DOUBLE, PROPERTY_ID_XSD_MAX_EXCLUSIVE_DOUBLE, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEVOID, + &m_aMaxExclusive, cppu::UnoType<ValueType>::get() ); + + registerMayBeVoidProperty( PROPERTY_XSD_MIN_INCLUSIVE_DOUBLE, PROPERTY_ID_XSD_MIN_INCLUSIVE_DOUBLE, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEVOID, + &m_aMinInclusive, cppu::UnoType<ValueType>::get() ); + + registerMayBeVoidProperty( PROPERTY_XSD_MIN_EXCLUSIVE_DOUBLE, PROPERTY_ID_XSD_MIN_EXCLUSIVE_DOUBLE, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEVOID, + &m_aMinExclusive, cppu::UnoType<ValueType>::get() ); } template<> @@ -249,10 +277,17 @@ namespace xforms { OValueLimitedType_Base::registerProperties(); - REGISTER_VOID_PROP( XSD_MAX_INCLUSIVE_INT, m_aMaxInclusive, ValueType ); - REGISTER_VOID_PROP( XSD_MAX_EXCLUSIVE_INT, m_aMaxExclusive, ValueType ); - REGISTER_VOID_PROP( XSD_MIN_INCLUSIVE_INT, m_aMinInclusive, ValueType ); - REGISTER_VOID_PROP( XSD_MIN_EXCLUSIVE_INT, m_aMinExclusive, ValueType ); + registerMayBeVoidProperty( PROPERTY_XSD_MAX_INCLUSIVE_INT, PROPERTY_ID_XSD_MAX_INCLUSIVE_INT, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEVOID, + &m_aMaxInclusive, cppu::UnoType<ValueType>::get() ); + + registerMayBeVoidProperty( PROPERTY_XSD_MAX_EXCLUSIVE_INT, PROPERTY_ID_XSD_MAX_EXCLUSIVE_INT, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEVOID, + &m_aMaxExclusive, cppu::UnoType<ValueType>::get() ); + + registerMayBeVoidProperty( PROPERTY_XSD_MIN_INCLUSIVE_INT, PROPERTY_ID_XSD_MIN_INCLUSIVE_INT, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEVOID, + &m_aMinInclusive, cppu::UnoType<ValueType>::get() ); + + registerMayBeVoidProperty( PROPERTY_XSD_MIN_EXCLUSIVE_INT, PROPERTY_ID_XSD_MIN_EXCLUSIVE_INT, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEVOID, + &m_aMinExclusive, cppu::UnoType<ValueType>::get() ); } } // namespace xforms diff --git a/forms/source/xforms/datatypes.cxx b/forms/source/xforms/datatypes.cxx index 1f934937364a..2f78df49b747 100644 --- a/forms/source/xforms/datatypes.cxx +++ b/forms/source/xforms/datatypes.cxx @@ -466,9 +466,14 @@ namespace xforms { OStringType_Base::registerProperties(); - REGISTER_VOID_PROP( XSD_LENGTH, m_aLength, sal_Int32 ); - REGISTER_VOID_PROP( XSD_MIN_LENGTH, m_aMinLength, sal_Int32 ); - REGISTER_VOID_PROP( XSD_MAX_LENGTH, m_aMaxLength, sal_Int32 ); + registerMayBeVoidProperty( PROPERTY_XSD_LENGTH, PROPERTY_ID_XSD_LENGTH, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEVOID, + &m_aLength, cppu::UnoType<sal_Int32>::get() ); + + registerMayBeVoidProperty( PROPERTY_XSD_MIN_LENGTH, PROPERTY_ID_XSD_MIN_LENGTH, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEVOID, + &m_aMinLength, cppu::UnoType<sal_Int32>::get() ); + + registerMayBeVoidProperty( PROPERTY_XSD_MAX_LENGTH, PROPERTY_ID_XSD_MAX_LENGTH, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEVOID, + &m_aMaxLength, cppu::UnoType<sal_Int32>::get() ); } @@ -626,8 +631,11 @@ namespace xforms { ODecimalType_Base::registerProperties(); - REGISTER_VOID_PROP( XSD_TOTAL_DIGITS, m_aTotalDigits, sal_Int32 ); - REGISTER_VOID_PROP( XSD_FRACTION_DIGITS, m_aFractionDigits, sal_Int32 ); + registerMayBeVoidProperty( PROPERTY_XSD_TOTAL_DIGITS, PROPERTY_ID_XSD_TOTAL_DIGITS, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEVOID, + &m_aTotalDigits, cppu::UnoType<sal_Int32>::get() ); + + registerMayBeVoidProperty( PROPERTY_XSD_FRACTION_DIGITS, PROPERTY_ID_XSD_FRACTION_DIGITS, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEVOID, + &m_aFractionDigits, cppu::UnoType<sal_Int32>::get() ); } diff --git a/forms/source/xforms/datatypes.hxx b/forms/source/xforms/datatypes.hxx index 119d9bff2f71..055ca566fe24 100644 --- a/forms/source/xforms/datatypes.hxx +++ b/forms/source/xforms/datatypes.hxx @@ -131,10 +131,6 @@ namespace xforms //= helper for deriving from OXSDDataType -#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() ); - class OValueLimitedType_Base : public OXSDDataType { protected: diff --git a/forms/source/xforms/model.cxx b/forms/source/xforms/model.cxx index d5bf2182abe7..eb52f06e0a9d 100644 --- a/forms/source/xforms/model.cxx +++ b/forms/source/xforms/model.cxx @@ -560,25 +560,21 @@ css::uno::Reference<css::container::XSet> Model::getSubmissions() #define HANDLE_Namespaces 5 #define HANDLE_ExternalData 6 -#define REGISTER_PROPERTY( property, type ) \ - registerProperty( PROPERTY( property, type ), \ - new DirectPropertyAccessor< Model, type >( this, &Model::set##property, &Model::get##property ) ); +void Model::initializePropertySet() +{ + registerProperty( PROPERTY_FLAGS( ID, OUString, css::beans::PropertyAttribute::BOUND ), + new APIPropertyAccessor< Model, OUString >(this, &Model::setID, &Model::getID) ); + registerProperty( PROPERTY_FLAGS( ForeignSchema, css::uno::Reference<css::xml::dom::XDocument>, css::beans::PropertyAttribute::BOUND ), + new DirectPropertyAccessor< Model, css::uno::Reference<css::xml::dom::XDocument> >( this, &Model::setForeignSchema, &Model::getForeignSchema) ); -#define REGISTER_PROPERTY_API( property, type ) \ - registerProperty( PROPERTY( property, type ), \ - new APIPropertyAccessor< Model, type >( this, &Model::set##property, &Model::get##property ) ); + registerProperty( PROPERTY_FLAGS( SchemaRef, OUString, css::beans::PropertyAttribute::BOUND ), + new DirectPropertyAccessor< Model, OUString >( this, &Model::setSchemaRef, &Model::getSchemaRef) ); -#define REGISTER_BOOL_PROPERTY( property ) \ - registerProperty( PROPERTY( property, sal_Bool ), \ - new BooleanPropertyAccessor< Model >( this, &Model::set##property, &Model::get##property ) ); + registerProperty( PROPERTY_FLAGS( Namespaces, css::uno::Reference<css::container::XNameContainer>, css::beans::PropertyAttribute::BOUND ), + new DirectPropertyAccessor< Model, css::uno::Reference<css::container::XNameContainer> >( this, &Model::setNamespaces, &Model::getNamespaces) ); -void Model::initializePropertySet() -{ - REGISTER_PROPERTY_API ( ID, OUString ); - REGISTER_PROPERTY ( ForeignSchema, css::uno::Reference<css::xml::dom::XDocument> ); - REGISTER_PROPERTY ( SchemaRef, OUString ); - REGISTER_PROPERTY ( Namespaces, css::uno::Reference<css::container::XNameContainer> ); - REGISTER_BOOL_PROPERTY( ExternalData ); + registerProperty( PROPERTY_FLAGS( ExternalData, sal_Bool, css::beans::PropertyAttribute::BOUND ), + new BooleanPropertyAccessor< Model >( this, &Model::setExternalData, &Model::getExternalData ) ); } void Model::update() diff --git a/forms/source/xforms/propertysetbase.hxx b/forms/source/xforms/propertysetbase.hxx index 969253a04d62..4d5a719582a7 100644 --- a/forms/source/xforms/propertysetbase.hxx +++ b/forms/source/xforms/propertysetbase.hxx @@ -341,7 +341,5 @@ public: #define PROPERTY_FLAGS( NAME, TYPE, FLAG ) css::beans::Property( \ #NAME, \ HANDLE_##NAME, cppu::UnoType<TYPE>::get(), FLAG ) -#define PROPERTY( NAME, TYPE ) PROPERTY_FLAGS( NAME, TYPE, css::beans::PropertyAttribute::BOUND ) -#define PROPERTY_RO( NAME, TYPE ) PROPERTY_FLAGS( NAME, TYPE, css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::READONLY ) /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/forms/source/xforms/submission.cxx b/forms/source/xforms/submission.cxx index c33f1fc39f58..3e582514bd7e 100644 --- a/forms/source/xforms/submission.cxx +++ b/forms/source/xforms/submission.cxx @@ -297,32 +297,55 @@ Model* Submission::getModelImpl() const #define HANDLE_IncludeNamespacePrefixes 14 #define HANDLE_Model 15 -#define REGISTER_PROPERTY( property, type ) \ - registerProperty( PROPERTY( property, type ), \ - new DirectPropertyAccessor< Submission, type >( this, &Submission::set##property, &Submission::get##property ) ); - -#define REGISTER_PROPERTY_BOOL( property ) \ - registerProperty( PROPERTY( property, bool ), \ - new BooleanPropertyAccessor< Submission >( this, &Submission::set##property, &Submission::get##property ) ); - void Submission::initializePropertySet() { - REGISTER_PROPERTY ( ID, OUString ); - REGISTER_PROPERTY ( Bind, OUString ); - REGISTER_PROPERTY ( Ref, OUString ); - REGISTER_PROPERTY ( Action, OUString ); - REGISTER_PROPERTY ( Method, OUString ); - REGISTER_PROPERTY ( Version, OUString ); - REGISTER_PROPERTY_BOOL( Indent ); - REGISTER_PROPERTY ( MediaType, OUString ); - REGISTER_PROPERTY ( Encoding, OUString ); - REGISTER_PROPERTY_BOOL( OmitXmlDeclaration ); - REGISTER_PROPERTY_BOOL( Standalone ); - REGISTER_PROPERTY ( CDataSectionElement, OUString ); - REGISTER_PROPERTY ( Replace, OUString ); - REGISTER_PROPERTY ( Separator, OUString ); - REGISTER_PROPERTY ( IncludeNamespacePrefixes, Sequence< OUString > ); - REGISTER_PROPERTY ( Model, Reference<XModel> ); + registerProperty( PROPERTY_FLAGS( ID, OUString, css::beans::PropertyAttribute::BOUND ), + new DirectPropertyAccessor< Submission, OUString >(this, &Submission::setID, &Submission::getID) ); + + registerProperty( PROPERTY_FLAGS( Bind, OUString, css::beans::PropertyAttribute::BOUND ), + new DirectPropertyAccessor< Submission, OUString >(this, &Submission::setBind, &Submission::getBind) ); + + registerProperty( PROPERTY_FLAGS( Ref, OUString, css::beans::PropertyAttribute::BOUND ), + new DirectPropertyAccessor< Submission, OUString >(this, &Submission::setRef, &Submission::getRef) ); + + registerProperty( PROPERTY_FLAGS( Action, OUString, css::beans::PropertyAttribute::BOUND ), + new DirectPropertyAccessor< Submission, OUString >(this, &Submission::setAction, &Submission::getAction) ); + + registerProperty( PROPERTY_FLAGS( Method, OUString, css::beans::PropertyAttribute::BOUND ), + new DirectPropertyAccessor< Submission, OUString >(this, &Submission::setMethod, &Submission::getMethod) ); + + registerProperty( PROPERTY_FLAGS( Version, OUString, css::beans::PropertyAttribute::BOUND ), + new DirectPropertyAccessor< Submission, OUString >(this, &Submission::setVersion, &Submission::getVersion) ); + + registerProperty( PROPERTY_FLAGS( Indent, bool, css::beans::PropertyAttribute::BOUND ), + new BooleanPropertyAccessor< Submission >(this, &Submission::setIndent, &Submission::getIndent)); + + registerProperty( PROPERTY_FLAGS( MediaType, OUString, css::beans::PropertyAttribute::BOUND ), + new DirectPropertyAccessor< Submission, OUString >(this, &Submission::setMediaType, &Submission::getMediaType) ); + + registerProperty( PROPERTY_FLAGS( Encoding, OUString, css::beans::PropertyAttribute::BOUND ), + new DirectPropertyAccessor< Submission, OUString >(this, &Submission::setEncoding, &Submission::getEncoding) ); + + registerProperty( PROPERTY_FLAGS( OmitXmlDeclaration, bool, css::beans::PropertyAttribute::BOUND ), + new BooleanPropertyAccessor< Submission >(this, &Submission::setOmitXmlDeclaration, &Submission::getOmitXmlDeclaration)); + + registerProperty( PROPERTY_FLAGS( Standalone, bool, css::beans::PropertyAttribute::BOUND ), + new BooleanPropertyAccessor< Submission >(this, &Submission::setStandalone, &Submission::getStandalone)); + + registerProperty( PROPERTY_FLAGS( CDataSectionElement, OUString, css::beans::PropertyAttribute::BOUND ), + new DirectPropertyAccessor< Submission, OUString >(this, &Submission::setCDataSectionElement, &Submission::getCDataSectionElement) ); + + registerProperty( PROPERTY_FLAGS( Replace, OUString, css::beans::PropertyAttribute::BOUND ), + new DirectPropertyAccessor< Submission, OUString >(this, &Submission::setReplace, &Submission::getReplace) ); + + registerProperty( PROPERTY_FLAGS( Separator, OUString, css::beans::PropertyAttribute::BOUND ), + new DirectPropertyAccessor< Submission, OUString >(this, &Submission::setSeparator, &Submission::getSeparator) ); + + registerProperty( PROPERTY_FLAGS( IncludeNamespacePrefixes, Sequence<OUString>, css::beans::PropertyAttribute::BOUND ), + new DirectPropertyAccessor< Submission, Sequence<OUString> >(this, &Submission::setIncludeNamespacePrefixes, &Submission::getIncludeNamespacePrefixes) ); + + registerProperty( PROPERTY_FLAGS( Model, Reference<XModel>, css::beans::PropertyAttribute::BOUND ), + new DirectPropertyAccessor< Submission, Reference<XModel> >(this, &Submission::setModel, &Submission::getModel) ); initializePropertyValueCache( HANDLE_Indent ); initializePropertyValueCache( HANDLE_OmitXmlDeclaration );