diff options
author | Noel Grandin <noel@peralex.com> | 2014-07-08 16:23:20 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-07-10 11:04:11 +0200 |
commit | df906cf2acffac4a4611f8b34724cdbcda068c74 (patch) | |
tree | d28bb9588fe96d93159593ad1d6730c1b9f1481b | |
parent | use SimpleReferenceObject in fpicker module (diff) | |
download | core-df906cf2acffac4a4611f8b34724cdbcda068c74.tar.gz core-df906cf2acffac4a4611f8b34724cdbcda068c74.zip |
use SimpleReferenceObject in forms module
to replace hand-rolled version
Change-Id: Ic95f4dfd1ae5ab414c68c52ad58c738f4ac1d9d1
-rw-r--r-- | forms/source/richtext/rtattributehandler.cxx | 31 | ||||
-rw-r--r-- | forms/source/richtext/rtattributehandler.hxx | 26 | ||||
-rw-r--r-- | forms/source/xforms/propertysetbase.cxx | 15 | ||||
-rw-r--r-- | forms/source/xforms/propertysetbase.hxx | 10 |
4 files changed, 7 insertions, 75 deletions
diff --git a/forms/source/richtext/rtattributehandler.cxx b/forms/source/richtext/rtattributehandler.cxx index 7a335567eb4b..03e257aee571 100644 --- a/forms/source/richtext/rtattributehandler.cxx +++ b/forms/source/richtext/rtattributehandler.cxx @@ -40,25 +40,6 @@ namespace frm { - //= ReferenceBase - - - oslInterlockedCount SAL_CALL ReferenceBase::acquire() - { - return osl_atomic_increment( &m_refCount ); - } - - - oslInterlockedCount SAL_CALL ReferenceBase::release() - { - return osl_atomic_decrement( &m_refCount ); - } - - - ReferenceBase::~ReferenceBase() - { - } - AttributeHandler::AttributeHandler( AttributeId _nAttributeId, WhichId _nWhichId ) :m_nAttribute( _nAttributeId ) ,m_nWhich ( _nWhichId ) @@ -71,18 +52,6 @@ namespace frm } - oslInterlockedCount SAL_CALL AttributeHandler::acquire() - { - return ReferenceBase::acquire(); - } - - - oslInterlockedCount SAL_CALL AttributeHandler::release() - { - return ReferenceBase::release(); - } - - AttributeId AttributeHandler::getAttributeId( ) const { return getAttribute(); diff --git a/forms/source/richtext/rtattributehandler.hxx b/forms/source/richtext/rtattributehandler.hxx index 9cbc60e33bce..881ec2d2ed8f 100644 --- a/forms/source/richtext/rtattributehandler.hxx +++ b/forms/source/richtext/rtattributehandler.hxx @@ -24,6 +24,7 @@ #include <rtl/ref.hxx> #include <editeng/svxenum.hxx> #include <editeng/frmdir.hxx> +#include <salhelper/simplereferenceobject.hxx> class SfxItemSet; class SfxPoolItem; @@ -32,21 +33,7 @@ class SfxItemPool; namespace frm { - class ReferenceBase : public ::rtl::IReference - { - protected: - oslInterlockedCount m_refCount; - - public: - // IReference - virtual oslInterlockedCount SAL_CALL acquire() SAL_OVERRIDE; - virtual oslInterlockedCount SAL_CALL release() SAL_OVERRIDE; - - protected: - virtual ~ReferenceBase(); - }; - - class IAttributeHandler : public ::rtl::IReference + class IAttributeHandler : public salhelper::SimpleReferenceObject { public: virtual AttributeId getAttributeId( ) const = 0; @@ -54,11 +41,10 @@ namespace frm virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, ScriptType _nForScriptType ) const = 0; protected: - ~IAttributeHandler() {} + virtual ~IAttributeHandler() {} }; - class AttributeHandler :public ReferenceBase - ,public IAttributeHandler + class AttributeHandler : public IAttributeHandler { private: AttributeId m_nAttribute; @@ -86,10 +72,6 @@ namespace frm // pseudo-abstract virtual AttributeCheckState implGetCheckState( const SfxPoolItem& _rItem ) const; - // disambiguate IReference - virtual oslInterlockedCount SAL_CALL acquire() SAL_OVERRIDE; - virtual oslInterlockedCount SAL_CALL release() SAL_OVERRIDE; - protected: virtual ~AttributeHandler(); }; diff --git a/forms/source/xforms/propertysetbase.cxx b/forms/source/xforms/propertysetbase.cxx index 2f2a4e184259..647a5bcc3394 100644 --- a/forms/source/xforms/propertysetbase.cxx +++ b/forms/source/xforms/propertysetbase.cxx @@ -44,21 +44,6 @@ PropertyAccessorBase::~PropertyAccessorBase() { } -oslInterlockedCount SAL_CALL PropertyAccessorBase::acquire() -{ - return ++m_refCount; -} - -oslInterlockedCount SAL_CALL PropertyAccessorBase::release() -{ - if ( --m_refCount == 0 ) - { - delete this; - return 0; - } - return m_refCount; -} - PropertySetBase::PropertySetBase( ) :m_pProperties( NULL ) { diff --git a/forms/source/xforms/propertysetbase.hxx b/forms/source/xforms/propertysetbase.hxx index 3fb6aaef9542..8b70d7a41889 100644 --- a/forms/source/xforms/propertysetbase.hxx +++ b/forms/source/xforms/propertysetbase.hxx @@ -25,6 +25,7 @@ #include <comphelper/propertysetinfo.hxx> #include <comphelper/proparrhlp.hxx> #include <rtl/ref.hxx> +#include <salhelper/simplereferenceobject.hxx> // include for inlined helper function below #include <com/sun/star/lang/IllegalArgumentException.hpp> @@ -41,18 +42,13 @@ namespace com { namespace sun { namespace star { namespace uno { /** base class which encapsulates accessing (reading/writing) concrete property values */ -class PropertyAccessorBase : public ::rtl::IReference +class PropertyAccessorBase : public salhelper::SimpleReferenceObject { -private: - oslInterlockedCount m_refCount; - protected: - PropertyAccessorBase() : m_refCount( 0 ) { } + PropertyAccessorBase() { } virtual ~PropertyAccessorBase(); public: - virtual oslInterlockedCount SAL_CALL acquire() SAL_OVERRIDE; - virtual oslInterlockedCount SAL_CALL release() SAL_OVERRIDE; virtual bool approveValue( const com::sun::star::uno::Any& rValue ) const = 0; virtual void setValue( const com::sun::star::uno::Any& rValue ) = 0; |