diff options
author | Noel Grandin <noel@peralex.com> | 2013-03-20 09:16:19 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-04-08 13:53:02 +0200 |
commit | 3cfecf8427c529c7c1d32be2b361934b63fa6933 (patch) | |
tree | 0eed4fbb77434a558dd48234a95b099a9ada534b /comphelper/source | |
parent | fdo#46808, convert sdb::tools::ConnectionTools to new style (diff) | |
download | core-3cfecf8427c529c7c1d32be2b361934b63fa6933.tar.gz core-3cfecf8427c529c7c1d32be2b361934b63fa6933.zip |
fdo#46808, Convert beans::PropertyBag to new style
Change-Id: Ibb2466af4c9289cba93b8330d10db033d296bfc1
Diffstat (limited to 'comphelper/source')
-rw-r--r-- | comphelper/source/property/opropertybag.cxx | 30 | ||||
-rw-r--r-- | comphelper/source/property/opropertybag.hxx | 21 |
2 files changed, 38 insertions, 13 deletions
diff --git a/comphelper/source/property/opropertybag.cxx b/comphelper/source/property/opropertybag.cxx index a3d3a64d501e..d54fdf3c2559 100644 --- a/comphelper/source/property/opropertybag.cxx +++ b/comphelper/source/property/opropertybag.cxx @@ -88,20 +88,36 @@ namespace comphelper //-------------------------------------------------------------------- void SAL_CALL OPropertyBag::initialize( const Sequence< Any >& _rArguments ) throw (Exception, RuntimeException) { - ::comphelper::NamedValueCollection aArguments( _rArguments ); - Sequence< Type > aTypes; - if ( aArguments.get_ensureType( "AllowedTypes", aTypes ) ) + bool AllowEmptyPropertyName(false); + bool AutomaticAddition(false); + + if (_rArguments.getLength() == 3 + && (_rArguments[0] >>= aTypes) + && (_rArguments[1] >>= AllowEmptyPropertyName) + && (_rArguments[2] >>= AutomaticAddition)) + { ::std::copy( aTypes.getConstArray(), aTypes.getConstArray() + aTypes.getLength(), ::std::insert_iterator< TypeBag >( m_aAllowedTypes, m_aAllowedTypes.begin() ) ); + m_bAutoAddProperties = AutomaticAddition; - aArguments.get_ensureType( "AutomaticAddition", m_bAutoAddProperties ); - bool AllowEmptyPropertyName(false); - aArguments.get_ensureType( "AllowEmptyPropertyName", - AllowEmptyPropertyName ); + } else { + ::comphelper::NamedValueCollection aArguments( _rArguments ); + + if ( aArguments.get_ensureType( "AllowedTypes", aTypes ) ) + ::std::copy( + aTypes.getConstArray(), + aTypes.getConstArray() + aTypes.getLength(), + ::std::insert_iterator< TypeBag >( m_aAllowedTypes, m_aAllowedTypes.begin() ) + ); + + aArguments.get_ensureType( "AutomaticAddition", m_bAutoAddProperties ); + aArguments.get_ensureType( "AllowEmptyPropertyName", + AllowEmptyPropertyName ); + } if (AllowEmptyPropertyName) { m_aDynamicProperties.setAllowEmptyPropertyName( AllowEmptyPropertyName); diff --git a/comphelper/source/property/opropertybag.hxx b/comphelper/source/property/opropertybag.hxx index 93fa44510921..4e463fd49273 100644 --- a/comphelper/source/property/opropertybag.hxx +++ b/comphelper/source/property/opropertybag.hxx @@ -24,14 +24,12 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/util/XModifiable.hpp> -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/beans/XPropertyContainer.hpp> -#include <com/sun/star/beans/XPropertyAccess.hpp> +#include <com/sun/star/beans/XPropertyBag.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/container/XSet.hpp> #include <boost/noncopyable.hpp> -#include <cppuhelper/implbase6.hxx> +#include <cppuhelper/implbase5.hxx> #include <comphelper/propstate.hxx> #include <comphelper/broadcasthelper.hxx> #include <comphelper/propertybag.hxx> @@ -63,8 +61,7 @@ namespace comphelper //==================================================================== //= OPropertyBag //==================================================================== - typedef ::cppu::WeakAggImplHelper6 < ::com::sun::star::beans::XPropertyContainer - , ::com::sun::star::beans::XPropertyAccess + typedef ::cppu::WeakAggImplHelper5 < ::com::sun::star::beans::XPropertyBag , ::com::sun::star::util::XModifiable , ::com::sun::star::lang::XServiceInfo , ::com::sun::star::lang::XInitialization @@ -143,6 +140,18 @@ namespace comphelper // XPropertySet virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + virtual void setPropertyValue(const rtl::OUString& p1, const com::sun::star::uno::Any& p2) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) + { OPropertyBag_PBase::setPropertyValue(p1, p2); } + virtual com::sun::star::uno::Any getPropertyValue(const rtl::OUString& p1) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) + { return OPropertyBag_PBase::getPropertyValue(p1); } + virtual void addPropertyChangeListener(const rtl::OUString& p1, const com::sun::star::uno::Reference<com::sun::star::beans::XPropertyChangeListener>& p2) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) + { OPropertyBag_PBase::addPropertyChangeListener(p1, p2); } + virtual void removePropertyChangeListener(const rtl::OUString& p1, const com::sun::star::uno::Reference<com::sun::star::beans::XPropertyChangeListener>& p2) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) + { OPropertyBag_PBase::removePropertyChangeListener(p1, p2); } + virtual void addVetoableChangeListener(const rtl::OUString& p1, const com::sun::star::uno::Reference<com::sun::star::beans::XVetoableChangeListener>& p2) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) + { OPropertyBag_PBase::addVetoableChangeListener(p1, p2); } + virtual void removeVetoableChangeListener(const rtl::OUString& p1, const com::sun::star::uno::Reference<com::sun::star::beans::XVetoableChangeListener>& p2) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) + { OPropertyBag_PBase::removeVetoableChangeListener(p1, p2); } // XSet virtual ::sal_Bool SAL_CALL has( const ::com::sun::star::uno::Any& aElement ) throw (::com::sun::star::uno::RuntimeException); |