use SimpleReferenceObject in forms module

to replace hand-rolled version

Change-Id: Ic95f4dfd1ae5ab414c68c52ad58c738f4ac1d9d1
This commit is contained in:
Noel Grandin
2014-07-08 16:23:20 +02:00
parent ba6781f8cb
commit df906cf2ac
4 changed files with 7 additions and 75 deletions

View File

@@ -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();

View File

@@ -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();
};

View File

@@ -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 )
{

View File

@@ -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;