Kaydet (Commit) df906cf2 authored tarafından Noel Grandin's avatar Noel Grandin

use SimpleReferenceObject in forms module

to replace hand-rolled version

Change-Id: Ic95f4dfd1ae5ab414c68c52ad58c738f4ac1d9d1
üst ba6781f8
...@@ -40,25 +40,6 @@ namespace frm ...@@ -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 ) AttributeHandler::AttributeHandler( AttributeId _nAttributeId, WhichId _nWhichId )
:m_nAttribute( _nAttributeId ) :m_nAttribute( _nAttributeId )
,m_nWhich ( _nWhichId ) ,m_nWhich ( _nWhichId )
...@@ -71,18 +52,6 @@ namespace frm ...@@ -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 AttributeId AttributeHandler::getAttributeId( ) const
{ {
return getAttribute(); return getAttribute();
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <rtl/ref.hxx> #include <rtl/ref.hxx>
#include <editeng/svxenum.hxx> #include <editeng/svxenum.hxx>
#include <editeng/frmdir.hxx> #include <editeng/frmdir.hxx>
#include <salhelper/simplereferenceobject.hxx>
class SfxItemSet; class SfxItemSet;
class SfxPoolItem; class SfxPoolItem;
...@@ -32,21 +33,7 @@ class SfxItemPool; ...@@ -32,21 +33,7 @@ class SfxItemPool;
namespace frm namespace frm
{ {
class ReferenceBase : public ::rtl::IReference class IAttributeHandler : public salhelper::SimpleReferenceObject
{
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
{ {
public: public:
virtual AttributeId getAttributeId( ) const = 0; virtual AttributeId getAttributeId( ) const = 0;
...@@ -54,11 +41,10 @@ namespace frm ...@@ -54,11 +41,10 @@ namespace frm
virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, ScriptType _nForScriptType ) const = 0; virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, ScriptType _nForScriptType ) const = 0;
protected: protected:
~IAttributeHandler() {} virtual ~IAttributeHandler() {}
}; };
class AttributeHandler :public ReferenceBase class AttributeHandler : public IAttributeHandler
,public IAttributeHandler
{ {
private: private:
AttributeId m_nAttribute; AttributeId m_nAttribute;
...@@ -86,10 +72,6 @@ namespace frm ...@@ -86,10 +72,6 @@ namespace frm
// pseudo-abstract // pseudo-abstract
virtual AttributeCheckState implGetCheckState( const SfxPoolItem& _rItem ) const; virtual AttributeCheckState implGetCheckState( const SfxPoolItem& _rItem ) const;
// disambiguate IReference
virtual oslInterlockedCount SAL_CALL acquire() SAL_OVERRIDE;
virtual oslInterlockedCount SAL_CALL release() SAL_OVERRIDE;
protected: protected:
virtual ~AttributeHandler(); virtual ~AttributeHandler();
}; };
......
...@@ -44,21 +44,6 @@ PropertyAccessorBase::~PropertyAccessorBase() ...@@ -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( ) PropertySetBase::PropertySetBase( )
:m_pProperties( NULL ) :m_pProperties( NULL )
{ {
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <comphelper/propertysetinfo.hxx> #include <comphelper/propertysetinfo.hxx>
#include <comphelper/proparrhlp.hxx> #include <comphelper/proparrhlp.hxx>
#include <rtl/ref.hxx> #include <rtl/ref.hxx>
#include <salhelper/simplereferenceobject.hxx>
// include for inlined helper function below // include for inlined helper function below
#include <com/sun/star/lang/IllegalArgumentException.hpp> #include <com/sun/star/lang/IllegalArgumentException.hpp>
...@@ -41,18 +42,13 @@ namespace com { namespace sun { namespace star { namespace uno { ...@@ -41,18 +42,13 @@ namespace com { namespace sun { namespace star { namespace uno {
/** base class which encapsulates accessing (reading/writing) concrete property values /** 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: protected:
PropertyAccessorBase() : m_refCount( 0 ) { } PropertyAccessorBase() { }
virtual ~PropertyAccessorBase(); virtual ~PropertyAccessorBase();
public: 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 bool approveValue( const com::sun::star::uno::Any& rValue ) const = 0;
virtual void setValue( const com::sun::star::uno::Any& rValue ) = 0; virtual void setValue( const com::sun::star::uno::Any& rValue ) = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment