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

use SimpleReferenceObject in extensions module

to replace hand-rolled version

Change-Id: Ia983f5b87c55d8e5cce6f388e0f77077b6415745
üst df906cf2
......@@ -23,6 +23,7 @@
#include <com/sun/star/uno/Any.hxx>
#include <rtl/ref.hxx>
#include <rtl/ustring.hxx>
#include <salhelper/simplereferenceobject.hxx>
#include <vector>
......@@ -34,7 +35,7 @@ namespace pcr
//= IPropertyEnumRepresentation
class SAL_NO_VTABLE IPropertyEnumRepresentation : public ::rtl::IReference
class SAL_NO_VTABLE IPropertyEnumRepresentation : public salhelper::SimpleReferenceObject
{
public:
/** retrieves all descriptions of all possible values of the enumeration property
......
......@@ -2968,32 +2968,13 @@ namespace pcr
protected:
SQLCommandPropertyUI( const Reference< XPropertySet >& _rxObject )
: m_xObject(_rxObject)
, m_refCount(0)
{
if ( !m_xObject.is() )
throw NullPointerException();
}
virtual oslInterlockedCount SAL_CALL acquire() SAL_OVERRIDE
{
return osl_atomic_increment( &m_refCount );
}
virtual oslInterlockedCount SAL_CALL release() SAL_OVERRIDE
{
if ( 0 == osl_atomic_decrement( &m_refCount ) )
{
delete this;
return 0;
}
return m_refCount;
}
protected:
Reference< XPropertySet > m_xObject;
private:
oslInterlockedCount m_refCount;
};
......
......@@ -580,8 +580,7 @@ namespace pcr
DefaultEnumRepresentation::DefaultEnumRepresentation( const IPropertyInfoService& _rInfo, const Type& _rType, sal_Int32 _nPropertyId )
:m_refCount( 0 )
,m_rMetaData( _rInfo )
:m_rMetaData( _rInfo )
,m_aType( _rType )
,m_nPropertyId( _nPropertyId )
{
......@@ -666,23 +665,6 @@ namespace pcr
}
oslInterlockedCount SAL_CALL DefaultEnumRepresentation::acquire()
{
return osl_atomic_increment( &m_refCount );
}
oslInterlockedCount SAL_CALL DefaultEnumRepresentation::release()
{
if ( 0 == osl_atomic_decrement( &m_refCount ) )
{
delete this;
return 0;
}
return m_refCount;
}
} // namespace pcr
......
......@@ -72,7 +72,6 @@ namespace pcr
class DefaultEnumRepresentation : public IPropertyEnumRepresentation
{
private:
oslInterlockedCount m_refCount;
const IPropertyInfoService& m_rMetaData;
::com::sun::star::uno::Type m_aType;
const sal_Int32 m_nPropertyId;
......@@ -96,10 +95,6 @@ namespace pcr
virtual void SAL_CALL getValueFromDescription( const OUString& _rDescription, ::com::sun::star::uno::Any& _out_rValue ) const SAL_OVERRIDE;
virtual OUString SAL_CALL getDescriptionForValue( const ::com::sun::star::uno::Any& _rEnumValue ) const SAL_OVERRIDE;
// IReference implementqation
virtual oslInterlockedCount SAL_CALL acquire() SAL_OVERRIDE;
virtual oslInterlockedCount SAL_CALL release() SAL_OVERRIDE;
private:
DefaultEnumRepresentation(); // never implemented
DefaultEnumRepresentation( const DefaultEnumRepresentation& ); // never implemented
......
......@@ -66,7 +66,6 @@ namespace pcr
public IPropertyEnumRepresentation, private boost::noncopyable
{
private:
oslInterlockedCount m_refCount;
Reference< XEnumTypeDescription > m_xTypeDescription;
Type m_aEnumType;
......@@ -79,17 +78,12 @@ namespace pcr
virtual void SAL_CALL getValueFromDescription( const OUString& _rDescription, ::com::sun::star::uno::Any& _out_rValue ) const SAL_OVERRIDE;
virtual OUString SAL_CALL getDescriptionForValue( const ::com::sun::star::uno::Any& _rEnumValue ) const SAL_OVERRIDE;
// IReference implementqation
virtual oslInterlockedCount SAL_CALL acquire() SAL_OVERRIDE;
virtual oslInterlockedCount SAL_CALL release() SAL_OVERRIDE;
private:
void impl_getValues( Sequence< sal_Int32 >& _out_rValues ) const;
};
EnumRepresentation::EnumRepresentation( const Reference< XComponentContext >& _rxContext, const Type& _rEnumType )
:m_refCount( 0 )
,m_aEnumType( _rEnumType )
:m_aEnumType( _rEnumType )
{
try
{
......@@ -180,21 +174,6 @@ namespace pcr
return sDescription;
}
oslInterlockedCount SAL_CALL EnumRepresentation::acquire()
{
return osl_atomic_increment( &m_refCount );
}
oslInterlockedCount SAL_CALL EnumRepresentation::release()
{
if ( 0 == osl_atomic_decrement( &m_refCount ) )
{
delete this;
return 0;
}
return m_refCount;
}
typedef ::cppu::WeakImplHelper1 < XActionListener
> UrlClickHandler_Base;
class UrlClickHandler : public UrlClickHandler_Base
......
......@@ -31,6 +31,7 @@
#include <tools/link.hxx>
#include <cppuhelper/implbase1.hxx>
#include <rtl/ref.hxx>
#include <salhelper/simplereferenceobject.hxx>
namespace pcr
......@@ -189,7 +190,7 @@ namespace pcr
/** an adapter to forward changed SQL command property values to a component
*/
class ISQLCommandAdapter : public ::rtl::IReference
class ISQLCommandAdapter : public salhelper::SimpleReferenceObject
{
public:
/// retrieves the current SQL command of the component
......
......@@ -51,7 +51,6 @@ namespace pcr
XSDDataType::XSDDataType( const Reference< XDataType >& _rxDataType )
:m_xDataType( _rxDataType )
,m_refCount( 0 )
{
DBG_ASSERT( m_xDataType.is(), "XSDDataType::XSDDataType: invalid UNO object!" );
if ( m_xDataType.is() )
......@@ -59,23 +58,6 @@ namespace pcr
}
oslInterlockedCount SAL_CALL XSDDataType::acquire()
{
return osl_atomic_increment( &m_refCount );
}
oslInterlockedCount SAL_CALL XSDDataType::release()
{
if ( 0 == osl_atomic_decrement( &m_refCount ) )
{
delete this;
return 0;
}
return m_refCount;
}
XSDDataType::~XSDDataType()
{
}
......
......@@ -22,6 +22,7 @@
#include <com/sun/star/uno/Reference.hxx>
#include <rtl/ref.hxx>
#include <salhelper/simplereferenceobject.hxx>
namespace com { namespace sun { namespace star {
namespace xsd {
......@@ -40,7 +41,7 @@ namespace pcr
//= XSDDataType
class XSDDataType : public ::rtl::IReference
class XSDDataType : public salhelper::SimpleReferenceObject
{
private:
::com::sun::star::uno::Reference< ::com::sun::star::xsd::XDataType >
......@@ -48,9 +49,6 @@ namespace pcr
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
m_xFacetInfo;
protected:
oslInterlockedCount m_refCount;
protected:
inline ::com::sun::star::xsd::XDataType* getDataTypeInterface() const { return m_xDataType.get(); }
......@@ -59,10 +57,6 @@ namespace pcr
const ::com::sun::star::uno::Reference< ::com::sun::star::xsd::XDataType >& _rxDataType
);
// IReference
virtual oslInterlockedCount SAL_CALL acquire() SAL_OVERRIDE;
virtual oslInterlockedCount SAL_CALL release() SAL_OVERRIDE;
/// retrieves the underlying UNO component
inline const ::com::sun::star::uno::Reference< ::com::sun::star::xsd::XDataType >&
getUnoDataType() const { return m_xDataType; }
......
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