[Libreoffice-commits] core.git: 12 commits - connectivity/Library_dbtools.mk connectivity/source dbaccess/source extensions/CppunitTest_extensions_test_update.mk extensions/Library_updchk.mk extensions/source forms/source fpicker/Library_fps_office.mk fpicker/source framework/inc framework/source include/connectivity include/dbaccess include/svx sot/Library_sot.mk sot/source store/Library_store.mk store/source store/workben svx/source vcl/inc vcl/osx

Noel Grandin noel at peralex.com
Thu Jul 10 02:06:44 PDT 2014


 connectivity/Library_dbtools.mk                              |    1 
 connectivity/source/simpledbt/charset_s.cxx                  |   12 --
 connectivity/source/simpledbt/charset_s.hxx                  |    9 -
 connectivity/source/simpledbt/dbtfactory.cxx                 |   12 --
 connectivity/source/simpledbt/dbtfactory.hxx                 |    9 -
 connectivity/source/simpledbt/parsenode_s.cxx                |   13 --
 connectivity/source/simpledbt/parsenode_s.hxx                |    9 -
 connectivity/source/simpledbt/parser_s.cxx                   |   12 --
 connectivity/source/simpledbt/parser_s.hxx                   |    9 -
 connectivity/source/simpledbt/refbase.cxx                    |   55 -----------
 connectivity/source/simpledbt/refbase.hxx                    |   54 ----------
 connectivity/source/simpledbt/staticdbtools_s.cxx            |   12 --
 connectivity/source/simpledbt/staticdbtools_s.hxx            |    7 -
 dbaccess/source/core/api/RowSetRow.hxx                       |   18 ---
 dbaccess/source/core/recovery/settingsimport.cxx             |   14 --
 dbaccess/source/core/recovery/settingsimport.hxx             |   10 --
 extensions/CppunitTest_extensions_test_update.mk             |    1 
 extensions/Library_updchk.mk                                 |    1 
 extensions/source/propctrlr/enumrepresentation.hxx           |    3 
 extensions/source/propctrlr/formcomponenthandler.cxx         |   19 ---
 extensions/source/propctrlr/formmetadata.cxx                 |   20 ----
 extensions/source/propctrlr/formmetadata.hxx                 |    5 -
 extensions/source/propctrlr/genericpropertyhandler.cxx       |   23 ----
 extensions/source/propctrlr/sqlcommanddesign.hxx             |    3 
 extensions/source/propctrlr/xsddatatypes.cxx                 |   18 ---
 extensions/source/propctrlr/xsddatatypes.hxx                 |   10 --
 extensions/source/update/check/actionlistener.hxx            |    5 -
 extensions/source/update/check/download.hxx                  |    5 -
 extensions/source/update/check/updatecheck.cxx               |   16 ---
 extensions/source/update/check/updatecheck.hxx               |    5 -
 extensions/source/update/check/updatecheckconfiglistener.hxx |    9 +
 forms/source/richtext/rtattributehandler.cxx                 |   31 ------
 forms/source/richtext/rtattributehandler.hxx                 |   26 -----
 forms/source/xforms/propertysetbase.cxx                      |   15 ---
 forms/source/xforms/propertysetbase.hxx                      |   10 --
 fpicker/Library_fps_office.mk                                |    1 
 fpicker/source/office/asyncfilepicker.cxx                    |   20 ----
 fpicker/source/office/asyncfilepicker.hxx                    |    8 -
 framework/inc/helper/shareablemutex.hxx                      |   10 +-
 framework/source/fwi/helper/shareablemutex.cxx               |   29 +----
 include/connectivity/virtualdbtools.hxx                      |   25 ++---
 include/dbaccess/IController.hxx                             |    6 -
 include/dbaccess/IReference.hxx                              |   40 --------
 include/svx/sdr/overlay/overlaymanager.hxx                   |    8 -
 sot/Library_sot.mk                                           |    1 
 sot/source/sdstor/stgcache.cxx                               |    3 
 sot/source/sdstor/stgcache.hxx                               |   18 ---
 store/Library_store.mk                                       |    1 
 store/source/lockbyte.cxx                                    |   45 ---------
 store/source/lockbyte.hxx                                    |    5 -
 store/source/object.cxx                                      |   55 -----------
 store/source/object.hxx                                      |   21 +---
 store/source/storbase.cxx                                    |   11 --
 store/source/storbase.hxx                                    |    5 -
 store/source/storcach.cxx                                    |   14 --
 store/source/storcach.hxx                                    |    4 
 store/workben/t_page.cxx                                     |    2 
 svx/source/sdr/overlay/overlaymanager.cxx                    |   14 --
 vcl/inc/osx/keyboardfocuslistener.hxx                        |    3 
 vcl/osx/a11yfocuslistener.cxx                                |   12 --
 vcl/osx/a11yfocuslistener.hxx                                |   10 --
 61 files changed, 103 insertions(+), 749 deletions(-)

New commits:
commit 4789eab61c60466e5b6b7d7fad14b128fb851e6f
Author: Noel Grandin <noel at peralex.com>
Date:   Wed Jul 9 13:49:17 2014 +0200

    use SimpleReferenceObject in vcl/osx module
    
    to replace hand-rolled version
    
    Change-Id: Idf3f2dd20bacd3cb3de64931027ef62d9116200f

diff --git a/vcl/inc/osx/keyboardfocuslistener.hxx b/vcl/inc/osx/keyboardfocuslistener.hxx
index d31ac31..e9b652a 100644
--- a/vcl/inc/osx/keyboardfocuslistener.hxx
+++ b/vcl/inc/osx/keyboardfocuslistener.hxx
@@ -23,10 +23,11 @@
 #include <com/sun/star/accessibility/XAccessible.hpp>
 
 #include <rtl/ref.hxx>
+#include <salhelper/simplereferenceobject.hxx>
 
 // - KeyboardFocusListener -
 
-class KeyboardFocusListener : public rtl::IReference
+class KeyboardFocusListener : public salhelper::SimpleReferenceObject
 {
 public:
     virtual void SAL_CALL focusedObjectChanged(const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& xAccessible) = 0;
diff --git a/vcl/osx/a11yfocuslistener.cxx b/vcl/osx/a11yfocuslistener.cxx
index 878d4c8..398a5a2 100644
--- a/vcl/osx/a11yfocuslistener.cxx
+++ b/vcl/osx/a11yfocuslistener.cxx
@@ -81,16 +81,4 @@ AquaA11yFocusListener::focusedObjectChanged(const Reference< XAccessible >& xAcc
     }
 }
 
-oslInterlockedCount SAL_CALL
-AquaA11yFocusListener::acquire()
-{
-    return ReferenceObject::acquire();
-}
-
-oslInterlockedCount SAL_CALL
-AquaA11yFocusListener::release()
-{
-    return ReferenceObject::release();
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/osx/a11yfocuslistener.hxx b/vcl/osx/a11yfocuslistener.hxx
index 1f70430..3b9ff0e 100644
--- a/vcl/osx/a11yfocuslistener.hxx
+++ b/vcl/osx/a11yfocuslistener.hxx
@@ -20,14 +20,10 @@
 #ifndef INCLUDED_VCL_OSX_A11YFOCUSLISTENER_HXX
 #define INCLUDED_VCL_OSX_A11YFOCUSLISTENER_HXX
 
-#include <salhelper/refobj.hxx>
-
 #include "osx/keyboardfocuslistener.hxx"
 #include "osx/osxvcltypes.h"
 
-class AquaA11yFocusListener :
-    public KeyboardFocusListener,
-    public salhelper::ReferenceObject
+class AquaA11yFocusListener : public KeyboardFocusListener
 {
     id m_focusedObject;
 
@@ -43,10 +39,6 @@ public:
 
     // KeyboardFocusListener
     virtual void SAL_CALL focusedObjectChanged(const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& xAccessible) SAL_OVERRIDE;
-
-    // rtl::IReference
-    virtual oslInterlockedCount SAL_CALL acquire() SAL_OVERRIDE;
-    virtual oslInterlockedCount SAL_CALL release() SAL_OVERRIDE;
 };
 
 #endif // INCLUDED_VCL_OSX_A11YFOCUSLISTENER_HXX
commit bc30f938c0d27ee1ae20b0c10d3d8840557b2e93
Author: Noel Grandin <noel at peralex.com>
Date:   Wed Jul 9 13:43:30 2014 +0200

    use SimpleReferenceObject in stoc module
    
    to replace hand-rolled version
    
    Change-Id: I30635aec81313e4e0d1b67b30c8992fd63bb1f67

diff --git a/store/Library_store.mk b/store/Library_store.mk
index 85d9f0e..d5b02c0 100644
--- a/store/Library_store.mk
+++ b/store/Library_store.mk
@@ -18,6 +18,7 @@ $(eval $(call gb_Library_add_defs,store,\
 
 $(eval $(call gb_Library_use_libraries,store,\
 	sal \
+	salhelper \
 	$(gb_UWINAPI) \
 ))
 
diff --git a/store/source/lockbyte.cxx b/store/source/lockbyte.cxx
index fff1999..1fd9a0d 100644
--- a/store/source/lockbyte.cxx
+++ b/store/source/lockbyte.cxx
@@ -308,11 +308,6 @@ public:
      */
     explicit FileLockBytes (FileHandle & rFile);
 
-    /** Delegate multiple inherited IReference.
-     */
-    virtual oslInterlockedCount SAL_CALL acquire() SAL_OVERRIDE;
-    virtual oslInterlockedCount SAL_CALL release() SAL_OVERRIDE;
-
 protected:
     /** Destruction.
      */
@@ -331,16 +326,6 @@ FileLockBytes::~FileLockBytes()
     FileHandle::closeFile (m_hFile);
 }
 
-oslInterlockedCount SAL_CALL FileLockBytes::acquire()
-{
-    return OStoreObject::acquire();
-}
-
-oslInterlockedCount SAL_CALL FileLockBytes::release()
-{
-    return OStoreObject::release();
-}
-
 storeError FileLockBytes::initSize_Impl (sal_uInt32 & rnSize)
 {
     /* osl_getFileSize() uses slow 'fstat(h, &size)',
@@ -548,11 +533,6 @@ public:
      */
     explicit MappedLockBytes (FileMapping & rMapping);
 
-    /** Delegate multiple inherited IReference.
-     */
-    virtual oslInterlockedCount SAL_CALL acquire() SAL_OVERRIDE;
-    virtual oslInterlockedCount SAL_CALL release() SAL_OVERRIDE;
-
 protected:
     /* Destruction.
      */
@@ -571,16 +551,6 @@ MappedLockBytes::~MappedLockBytes()
     FileMapping::unmapFile (m_hFile, m_pData, m_nSize);
 }
 
-oslInterlockedCount SAL_CALL MappedLockBytes::acquire()
-{
-    return OStoreObject::acquire();
-}
-
-oslInterlockedCount SAL_CALL MappedLockBytes::release()
-{
-    return OStoreObject::release();
-}
-
 void MappedLockBytes::allocate_Impl (void ** ppPage, sal_uInt16 * pnSize)
 {
     OSL_PRECOND((ppPage != 0) && (pnSize != 0), "contract violation");
@@ -696,11 +666,6 @@ public:
      */
     MemoryLockBytes();
 
-    /** Delegate multiple inherited IReference.
-     */
-    virtual oslInterlockedCount SAL_CALL acquire() SAL_OVERRIDE;
-    virtual oslInterlockedCount SAL_CALL release() SAL_OVERRIDE;
-
 protected:
     /** Destruction.
      */
@@ -718,16 +683,6 @@ MemoryLockBytes::~MemoryLockBytes()
     rtl_freeMemory (m_pData);
 }
 
-oslInterlockedCount SAL_CALL MemoryLockBytes::acquire (void)
-{
-    return OStoreObject::acquire();
-}
-
-oslInterlockedCount SAL_CALL MemoryLockBytes::release (void)
-{
-    return OStoreObject::release();
-}
-
 storeError MemoryLockBytes::initialize_Impl (rtl::Reference< PageData::Allocator > & rxAllocator, sal_uInt16 nPageSize)
 {
     storeError result = PageData::Allocator::createInstance (rxAllocator, nPageSize);
diff --git a/store/source/lockbyte.hxx b/store/source/lockbyte.hxx
index 5918218..c9aa2a5 100644
--- a/store/source/lockbyte.hxx
+++ b/store/source/lockbyte.hxx
@@ -24,6 +24,7 @@
 
 #include "rtl/ref.hxx"
 #include "rtl/ustring.h"
+#include "salhelper/simplereferenceobject.hxx"
 
 #include "store/types.h"
 #include "storbase.hxx"
@@ -36,7 +37,7 @@ namespace store
  * ILockBytes interface.
  *
  *======================================================================*/
-class ILockBytes : public rtl::IReference
+class ILockBytes : public virtual salhelper::SimpleReferenceObject
 {
 public:
     /**
@@ -103,7 +104,7 @@ public:
     storeError flush();
 
 protected:
-    ~ILockBytes() {}
+    virtual ~ILockBytes() {}
 
 private:
     /** Implementation (abstract).
diff --git a/store/source/object.cxx b/store/source/object.cxx
index 1cac71d..53d1c08 100644
--- a/store/source/object.cxx
+++ b/store/source/object.cxx
@@ -36,38 +36,6 @@ namespace store
 const sal_uInt32 OStoreObject::m_nTypeId = sal_uInt32(0x58190322);
 
 /*
- * OStoreObject.
- */
-OStoreObject::OStoreObject (void)
-    : m_nRefCount (0)
-{
-}
-
-/*
- * ~OStoreObject.
- */
-OStoreObject::~OStoreObject (void)
-{
-    OSL_ASSERT(m_nRefCount == 0);
-}
-
-/*
- * operator new.
- */
-void* OStoreObject::operator new (size_t n)
-{
-    return rtl_allocateMemory (n);
-}
-
-/*
- * operator delete.
- */
-void OStoreObject::operator delete (void *p)
-{
-    rtl_freeMemory (p);
-}
-
-/*
  * isKindOf.
  */
 bool OStoreObject::isKindOf (sal_uInt32 nTypeId)
@@ -75,29 +43,6 @@ bool OStoreObject::isKindOf (sal_uInt32 nTypeId)
     return (nTypeId == m_nTypeId);
 }
 
-/*
- * acquire.
- */
-oslInterlockedCount SAL_CALL OStoreObject::acquire (void)
-{
-    oslInterlockedCount result = osl_atomic_increment (&m_nRefCount);
-    return (result);
-}
-
-/*
- * release.
- */
-oslInterlockedCount SAL_CALL OStoreObject::release (void)
-{
-    oslInterlockedCount result = osl_atomic_decrement (&m_nRefCount);
-    if (result == 0)
-    {
-        // Last reference released.
-        delete this;
-    }
-    return (result);
-}
-
 } // namespace store
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/store/source/object.hxx b/store/source/object.hxx
index 2743bfd..2b93a6f 100644
--- a/store/source/object.hxx
+++ b/store/source/object.hxx
@@ -21,10 +21,9 @@
 #define INCLUDED_STORE_SOURCE_OBJECT_HXX
 
 #include "sal/types.h"
-
 #include "rtl/ref.hxx"
-
 #include "osl/interlck.h"
+#include "salhelper/simplereferenceobject.hxx"
 
 namespace store
 {
@@ -34,7 +33,7 @@ namespace store
  * IStoreHandle interface.
  *
  *======================================================================*/
-class IStoreHandle : public rtl::IReference
+class IStoreHandle : public virtual salhelper::SimpleReferenceObject
 {
 public:
     /** Replaces dynamic_cast type checking.
@@ -42,7 +41,7 @@ public:
     virtual bool isKindOf (sal_uInt32 nTypeId) = 0;
 
 protected:
-    ~IStoreHandle() {}
+    virtual ~IStoreHandle() {}
 };
 
 /** Template helper function as dynamic_cast replacement.
@@ -66,26 +65,16 @@ class OStoreObject : public store::IStoreHandle
 public:
     /** Construction.
      */
-    OStoreObject (void);
-
-    /** Allocation.
-     */
-    static void* operator new (size_t n);
-    static void  operator delete (void *p);
+    OStoreObject() {}
 
     /** IStoreHandle.
      */
     virtual bool isKindOf (sal_uInt32 nTypeId) SAL_OVERRIDE;
 
-    /** IReference.
-     */
-    virtual oslInterlockedCount SAL_CALL acquire (void) SAL_OVERRIDE;
-    virtual oslInterlockedCount SAL_CALL release (void) SAL_OVERRIDE;
-
 protected:
     /** Destruction.
      */
-    virtual ~OStoreObject (void);
+    virtual ~OStoreObject() {}
 
 private:
     /** The IStoreHandle TypeId.
diff --git a/store/source/storbase.cxx b/store/source/storbase.cxx
index 0843098..fb14595 100644
--- a/store/source/storbase.cxx
+++ b/store/source/storbase.cxx
@@ -84,17 +84,6 @@ public:
 
     storeError initialize (sal_uInt16 nPageSize);
 
-    /** Delegate multiple inherited rtl::IReference.
-     */
-    virtual oslInterlockedCount SAL_CALL acquire() SAL_OVERRIDE
-    {
-        return OStoreObject::acquire();
-    }
-    virtual oslInterlockedCount SAL_CALL release() SAL_OVERRIDE
-    {
-        return OStoreObject::release();
-    }
-
 protected:
     /** Destruction.
      */
diff --git a/store/source/storbase.hxx b/store/source/storbase.hxx
index 1c6205c..2b74bf0 100644
--- a/store/source/storbase.hxx
+++ b/store/source/storbase.hxx
@@ -21,6 +21,7 @@
 #define INCLUDED_STORE_SOURCE_STORBASE_HXX
 
 #include "sal/config.h"
+#include "salhelper/simplereferenceobject.hxx"
 
 #include "boost/static_assert.hpp"
 #include "sal/types.h"
@@ -454,7 +455,7 @@ struct PageData
     /** Allocation.
      */
     class Allocator_Impl;
-    class Allocator : public rtl::IReference
+    class Allocator : public virtual salhelper::SimpleReferenceObject
     {
     public:
         template< class T > T * construct()
@@ -483,7 +484,7 @@ struct PageData
             rtl::Reference< PageData::Allocator > & rxAllocator, sal_uInt16 nPageSize);
 
     protected:
-        ~Allocator() {}
+        virtual ~Allocator() {}
 
     private:
         /** Implementation (abstract).
diff --git a/store/source/storcach.cxx b/store/source/storcach.cxx
index f7738f1..6ddb2db 100644
--- a/store/source/storcach.cxx
+++ b/store/source/storcach.cxx
@@ -274,10 +274,6 @@ public:
     // Construction
     explicit PageCache_Impl (sal_uInt16 nPageSize);
 
-    // Delegate multiple inherited IReference
-    virtual oslInterlockedCount SAL_CALL acquire() SAL_OVERRIDE;
-    virtual oslInterlockedCount SAL_CALL release() SAL_OVERRIDE;
-
 protected:
     // Destruction
     virtual ~PageCache_Impl (void);
@@ -330,16 +326,6 @@ PageCache_Impl::~PageCache_Impl()
     OSL_TRACE("Hits: %zu, Misses: %zu", m_nHit, m_nMissed);
 }
 
-oslInterlockedCount PageCache_Impl::acquire()
-{
-    return OStoreObject::acquire();
-}
-
-oslInterlockedCount PageCache_Impl::release()
-{
-    return OStoreObject::release();
-}
-
 void PageCache_Impl::rescale_Impl (sal_Size new_size)
 {
     sal_Size new_bytes = new_size * sizeof(Entry*);
diff --git a/store/source/storcach.hxx b/store/source/storcach.hxx
index a045a8b..511fbba 100644
--- a/store/source/storcach.hxx
+++ b/store/source/storcach.hxx
@@ -35,7 +35,7 @@ namespace store
  *
  *======================================================================*/
 
-class PageCache : public rtl::IReference
+class PageCache : public virtual salhelper::SimpleReferenceObject
 {
 public:
     /** load.
@@ -62,7 +62,7 @@ public:
         sal_uInt32 nOffset);
 
 protected:
-    ~PageCache() {}
+    virtual ~PageCache() {}
 
 private:
     /** Implementation (abstract).
diff --git a/store/workben/t_page.cxx b/store/workben/t_page.cxx
index 2bf4ebb..46ed2a9 100644
--- a/store/workben/t_page.cxx
+++ b/store/workben/t_page.cxx
@@ -176,7 +176,7 @@ struct PageData
 
     /** Allocation.
      */
-    class Allocator : public rtl::IReference
+    class Allocator : public salhelper::SimpleReferenceObject
     {
     public:
         template< class T > T * construct()
commit 0ae79a13686f2c17e6e4bda89b21fe78b5466201
Author: Noel Grandin <noel at peralex.com>
Date:   Wed Jul 9 11:22:00 2014 +0200

    use SimpleReferenceObject in StgPage
    
    to replace hand-rolled version
    
    Change-Id: I5301ef1df786b08b3c5d585a366d95722506f220

diff --git a/sot/Library_sot.mk b/sot/Library_sot.mk
index d741127..97381d0 100644
--- a/sot/Library_sot.mk
+++ b/sot/Library_sot.mk
@@ -36,6 +36,7 @@ $(eval $(call gb_Library_use_libraries,sot,\
     cppu \
     cppuhelper \
     sal \
+    salhelper \
 	i18nlangtag \
     tl \
     ucbhelper \
diff --git a/sot/source/sdstor/stgcache.cxx b/sot/source/sdstor/stgcache.cxx
index e82adf3..661f155 100644
--- a/sot/source/sdstor/stgcache.cxx
+++ b/sot/source/sdstor/stgcache.cxx
@@ -37,8 +37,7 @@
 // the correctness of the I/O.
 
 StgPage::StgPage( short nSize, sal_Int32 nPage )
-    : mnRefCount( 0 )
-    , mnPage( nPage )
+    : mnPage( nPage )
     , mpData( new sal_uInt8[ nSize ] )
     , mnSize( nSize )
 {
diff --git a/sot/source/sdstor/stgcache.hxx b/sot/source/sdstor/stgcache.hxx
index 79d2840..4a71279 100644
--- a/sot/source/sdstor/stgcache.hxx
+++ b/sot/source/sdstor/stgcache.hxx
@@ -27,6 +27,7 @@
 #include <stgelem.hxx>
 #include <boost/noncopyable.hpp>
 #include <boost/unordered_map.hpp>
+#include <salhelper/simplereferenceobject.hxx>
 
 class UCBStorageStream;
 class StgPage;
@@ -95,8 +96,8 @@ public:
     void Clear();                           // clear the cache
 };
 
-class StgPage : public rtl::IReference, private boost::noncopyable {
-    sal_uInt32      mnRefCount;
+class StgPage : public salhelper::SimpleReferenceObject, private boost::noncopyable
+{
     const sal_Int32 mnPage;                // page index
     sal_uInt8*      mpData;                // nSize bytes
     short           mnSize;                // size of this page
@@ -110,19 +111,6 @@ public:
     short     GetSize()  { return mnSize; }
 
 public:
-    virtual oslInterlockedCount SAL_CALL acquire() SAL_OVERRIDE
-    {
-        return ++mnRefCount;
-    }
-    virtual oslInterlockedCount SAL_CALL release() SAL_OVERRIDE
-    {
-        if ( --mnRefCount == 0)
-        {
-            delete this;
-            return 0;
-        }
-        return mnRefCount;
-    }
     static bool IsPageGreater( const StgPage *pA, const StgPage *pB );
 };
 
commit e656d583e7fd9b7d2b1bbe2d8716e75ab2023c2c
Author: Noel Grandin <noel at peralex.com>
Date:   Wed Jul 9 11:10:38 2014 +0200

    use SimpleReferenceObject in sdr::overlay::OverlayManager
    
    to replace hand-rolled version
    
    Change-Id: I3f47bf686ac07bba03acacace817767f2845af4f

diff --git a/include/svx/sdr/overlay/overlaymanager.hxx b/include/svx/sdr/overlay/overlaymanager.hxx
index b5c7c7b..fd7437a 100644
--- a/include/svx/sdr/overlay/overlaymanager.hxx
+++ b/include/svx/sdr/overlay/overlaymanager.hxx
@@ -30,6 +30,7 @@
 #include <svtools/optionsdrawinglayer.hxx>
 #include <basegfx/matrix/b2dhommatrix.hxx>
 #include <drawinglayer/geometry/viewinformation2d.hxx>
+#include <salhelper/simplereferenceobject.hxx>
 
 
 // predeclarations
@@ -54,10 +55,8 @@ namespace sdr
         class SVX_DLLPUBLIC OverlayManager
             : private boost::noncopyable
             , protected ::sdr::animation::Scheduler
-            , public rtl::IReference
+            , public salhelper::SimpleReferenceObject
         {
-        private:
-            oslInterlockedCount mnRefCount;
         protected:
             // the OutputDevice to work on, set on construction and not to be changed
             OutputDevice&                               rmOutputDevice;
@@ -137,9 +136,6 @@ namespace sdr
             const SvtOptionsDrawinglayer& getDrawinglayerOpt() const { return maDrawinglayerOpt; }
 
             void InsertEvent(sdr::animation::Event* pNew) { Scheduler::InsertEvent(pNew); }
-
-            virtual oslInterlockedCount SAL_CALL acquire() SAL_OVERRIDE;
-            virtual oslInterlockedCount SAL_CALL release() SAL_OVERRIDE;
         };
     } // end of namespace overlay
 } // end of namespace sdr
diff --git a/svx/source/sdr/overlay/overlaymanager.cxx b/svx/source/sdr/overlay/overlaymanager.cxx
index e2f2b2b..f843d5a 100644
--- a/svx/source/sdr/overlay/overlaymanager.cxx
+++ b/svx/source/sdr/overlay/overlaymanager.cxx
@@ -117,7 +117,6 @@ namespace sdr
 
         OverlayManager::OverlayManager(OutputDevice& rOutputDevice)
         :   Scheduler(),
-            mnRefCount(0),
             rmOutputDevice(rOutputDevice),
             maOverlayObjects(),
             maStripeColorA(Color(COL_BLACK)),
@@ -362,19 +361,6 @@ namespace sdr
             }
         }
 
-        oslInterlockedCount OverlayManager::acquire()
-        {
-            return osl_atomic_increment( &mnRefCount );
-        }
-
-        oslInterlockedCount OverlayManager::release()
-        {
-            oslInterlockedCount nCount( osl_atomic_decrement( &mnRefCount ) );
-            if ( nCount == 0 )
-                delete this;
-            return nCount;
-        }
-
     } // end of namespace overlay
 } // end of namespace sdr
 
commit 1dcef2a123fb54bfc1360c04f8e49783445c734c
Author: Noel Grandin <noel at peralex.com>
Date:   Wed Jul 9 10:40:50 2014 +0200

    fold dbaccess::IReference interface into the only place it is in use
    
    Change-Id: I978a528e1da6f73c94549c2ced95b244ad5b6147

diff --git a/include/dbaccess/IController.hxx b/include/dbaccess/IController.hxx
index 7b76dee..6bc22d9 100644
--- a/include/dbaccess/IController.hxx
+++ b/include/dbaccess/IController.hxx
@@ -22,7 +22,6 @@
 
 #include <com/sun/star/beans/PropertyValue.hpp>
 #include <com/sun/star/uno/Sequence.hxx>
-#include <dbaccess/IReference.hxx>
 #include <dbaccess/dbaccessdllapi.h>
 
 namespace com { namespace sun { namespace star {
@@ -39,7 +38,7 @@ class NotifyEvent;
 namespace dbaui
 {
     // interface for controller depended calls like commands
-    class DBACCESS_DLLPUBLIC IController : public IReference
+    class DBACCESS_DLLPUBLIC IController
     {
     public:
         /** executes the given command without checking if it is allowed
@@ -122,6 +121,9 @@ namespace dbaui
         */
         virtual bool interceptUserInput( const NotifyEvent& _rEvent ) = 0;
 
+        virtual void SAL_CALL acquire(  ) throw () = 0;
+        virtual void SAL_CALL release(  ) throw () = 0;
+
     protected:
         ~IController() {}
     };
diff --git a/include/dbaccess/IReference.hxx b/include/dbaccess/IReference.hxx
deleted file mode 100644
index 7da1fd9..0000000
--- a/include/dbaccess/IReference.hxx
+++ /dev/null
@@ -1,40 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#ifndef INCLUDED_DBACCESS_IREFERENCE_HXX
-#define INCLUDED_DBACCESS_IREFERENCE_HXX
-
-#include <dbaccess/dbaccessdllapi.h>
-
-namespace dbaui
-{
-    // interface for controller depended calls like commands
-    class DBACCESS_DLLPUBLIC SAL_NO_VTABLE IReference
-    {
-    public:
-        virtual void SAL_CALL acquire(  ) throw () = 0;
-        virtual void SAL_CALL release(  ) throw () = 0;
-
-    protected:
-        ~IReference() {}
-    };
-}
-#endif // INCLUDED_DBACCESS_IREFERENCE_HXX
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 06d18374deabe00712d80eaee291fc966ce6cd99
Author: Noel Grandin <noel at peralex.com>
Date:   Wed Jul 9 10:29:33 2014 +0200

    use SimpleReferenceObject in extensions/update module
    
    to replace hand-rolled version
    
    Change-Id: I4cd74b3e95a61c32d3aa52646d654ce306791fae

diff --git a/extensions/CppunitTest_extensions_test_update.mk b/extensions/CppunitTest_extensions_test_update.mk
index 3fb72f3..b6149b0 100644
--- a/extensions/CppunitTest_extensions_test_update.mk
+++ b/extensions/CppunitTest_extensions_test_update.mk
@@ -21,6 +21,7 @@ $(eval $(call gb_CppunitTest_use_libraries,extensions_test_update, \
 	cppu \
 	cppuhelper \
 	sal \
+	salhelper \
 	test \
 	unotest \
 	$(gb_UWINAPI) \
diff --git a/extensions/Library_updchk.mk b/extensions/Library_updchk.mk
index 4ef8bde..c7299d3 100644
--- a/extensions/Library_updchk.mk
+++ b/extensions/Library_updchk.mk
@@ -24,6 +24,7 @@ $(eval $(call gb_Library_use_libraries,updchk,\
 	cppuhelper \
 	cppu \
 	sal \
+	salhelper \
 ))
 
 ifeq ($(OS),WNT)
diff --git a/extensions/source/update/check/actionlistener.hxx b/extensions/source/update/check/actionlistener.hxx
index 97d92b9..25deba2 100644
--- a/extensions/source/update/check/actionlistener.hxx
+++ b/extensions/source/update/check/actionlistener.hxx
@@ -21,8 +21,9 @@
 #define INCLUDED_EXTENSIONS_SOURCE_UPDATE_CHECK_ACTIONLISTENER_HXX
 
 #include <rtl/ref.hxx>
+#include <salhelper/simplereferenceobject.hxx>
 
-class IActionListener : public rtl::IReference
+class IActionListener : public virtual salhelper::SimpleReferenceObject
 {
     public:
 
@@ -34,7 +35,7 @@ class IActionListener : public rtl::IReference
     virtual void            closeAfterFailure() = 0;
 
 protected:
-    ~IActionListener() {}
+    virtual ~IActionListener() {}
 };
 
 #endif // INCLUDED_EXTENSIONS_SOURCE_UPDATE_CHECK_ACTIONLISTENER_HXX
diff --git a/extensions/source/update/check/download.hxx b/extensions/source/update/check/download.hxx
index df12f48..db3968f 100644
--- a/extensions/source/update/check/download.hxx
+++ b/extensions/source/update/check/download.hxx
@@ -26,8 +26,9 @@
 #include <rtl/ustring.hxx>
 #include <osl/conditn.hxx>
 #include <osl/file.h>
+#include <salhelper/simplereferenceobject.hxx>
 
-struct DownloadInteractionHandler : public rtl::IReference
+struct DownloadInteractionHandler : public virtual salhelper::SimpleReferenceObject
 {
     virtual bool checkDownloadDestination(const OUString& rFileName) = 0;
 
@@ -47,7 +48,7 @@ struct DownloadInteractionHandler : public rtl::IReference
     virtual void downloadFinished(const OUString& rFileName) = 0;
 
 protected:
-    ~DownloadInteractionHandler() {}
+    virtual ~DownloadInteractionHandler() {}
 };
 
 
diff --git a/extensions/source/update/check/updatecheck.cxx b/extensions/source/update/check/updatecheck.cxx
index 3702f1f..e520c5a 100644
--- a/extensions/source/update/check/updatecheck.cxx
+++ b/extensions/source/update/check/updatecheck.cxx
@@ -1606,20 +1606,4 @@ UpdateCheck::autoCheckIntervalChanged()
     m_aCondition.set();
 };
 
-
-
-oslInterlockedCount SAL_CALL
-UpdateCheck::acquire()
-{
-    return ReferenceObject::acquire();
-}
-
-
-
-oslInterlockedCount SAL_CALL
-UpdateCheck::release()
-{
-    return ReferenceObject::release();
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/update/check/updatecheck.hxx b/extensions/source/update/check/updatecheck.hxx
index ac971db..bf27bb4 100644
--- a/extensions/source/update/check/updatecheck.hxx
+++ b/extensions/source/update/check/updatecheck.hxx
@@ -55,7 +55,6 @@ class UpdateCheck :
     public UpdateCheckConfigListener,
     public IActionListener,
     public DownloadInteractionHandler,
-    public salhelper::ReferenceObject,
     public rtl::StaticWithInit< rtl::Reference< UpdateCheck >, UpdateCheckInitData >
 {
     UpdateCheck();
@@ -120,10 +119,6 @@ public:
     void resume() SAL_OVERRIDE;
     void closeAfterFailure() SAL_OVERRIDE;
 
-    // rtl::IReference
-    virtual oslInterlockedCount SAL_CALL acquire() SAL_OVERRIDE;
-    virtual oslInterlockedCount SAL_CALL release() SAL_OVERRIDE;
-
 private:
 
     // Schedules or cancels next automatic check for updates
diff --git a/extensions/source/update/check/updatecheckconfiglistener.hxx b/extensions/source/update/check/updatecheckconfiglistener.hxx
index e6663b8..b96355a 100644
--- a/extensions/source/update/check/updatecheckconfiglistener.hxx
+++ b/extensions/source/update/check/updatecheckconfiglistener.hxx
@@ -17,22 +17,23 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include <rtl/ref.hxx>
-
 #ifndef INCLUDED_EXTENSIONS_SOURCE_UPDATE_CHECK_UPDATECHECKCONFIGLISTENER_HXX
 #define INCLUDED_EXTENSIONS_SOURCE_UPDATE_CHECK_UPDATECHECKCONFIGLISTENER_HXX
 
+#include <rtl/ref.hxx>
+#include <salhelper/simplereferenceobject.hxx>
+
 /* This interface should be implemented by classes acting
  * as controller (as in the MVC pattern).
  */
 
-struct UpdateCheckConfigListener : public rtl::IReference
+struct UpdateCheckConfigListener : public virtual salhelper::SimpleReferenceObject
 {
     virtual void autoCheckStatusChanged(bool enabled) = 0;
     virtual void autoCheckIntervalChanged() = 0;
 
 protected:
-    ~UpdateCheckConfigListener() {}
+    virtual ~UpdateCheckConfigListener() {}
 };
 
 #endif
commit 183e062e9f22d51e59054396ebb75e2148b067d7
Author: Noel Grandin <noel at peralex.com>
Date:   Wed Jul 9 09:20:52 2014 +0200

    use SimpleReferenceObject in connectivity module
    
    to replace hand-rolled version
    
    Change-Id: Ib415a6e78733277cbc1c0777d7263b65f404e6a4

diff --git a/connectivity/Library_dbtools.mk b/connectivity/Library_dbtools.mk
index 167cb69..7170dc0 100644
--- a/connectivity/Library_dbtools.mk
+++ b/connectivity/Library_dbtools.mk
@@ -52,7 +52,6 @@ endif
 #connectivity/source/commontools/RowFunctionParser.cxx disable optimization?
 
 $(eval $(call gb_Library_add_exception_objects,dbtools,\
-	connectivity/source/simpledbt/refbase \
 ))
 
 $(eval $(call gb_Library_add_grammars,dbtools,\
diff --git a/connectivity/source/simpledbt/charset_s.cxx b/connectivity/source/simpledbt/charset_s.cxx
index ea00094..2843b67 100644
--- a/connectivity/source/simpledbt/charset_s.cxx
+++ b/connectivity/source/simpledbt/charset_s.cxx
@@ -30,18 +30,6 @@ namespace connectivity
     //= ODataAccessCharSet
 
 
-    oslInterlockedCount SAL_CALL ODataAccessCharSet::acquire()
-    {
-        return ORefBase::acquire();
-    }
-
-
-    oslInterlockedCount SAL_CALL ODataAccessCharSet::release()
-    {
-        return ORefBase::release();
-    }
-
-
     sal_Int32 ODataAccessCharSet::getSupportedTextEncodings( ::std::vector< rtl_TextEncoding >& _rEncs ) const
     {
         _rEncs.clear();
diff --git a/connectivity/source/simpledbt/charset_s.hxx b/connectivity/source/simpledbt/charset_s.hxx
index 80c09d8..25aa2bf 100644
--- a/connectivity/source/simpledbt/charset_s.hxx
+++ b/connectivity/source/simpledbt/charset_s.hxx
@@ -21,7 +21,6 @@
 #define INCLUDED_CONNECTIVITY_SOURCE_SIMPLEDBT_CHARSET_S_HXX
 
 #include <connectivity/virtualdbtools.hxx>
-#include "refbase.hxx"
 #include <connectivity/dbcharset.hxx>
 
 
@@ -32,9 +31,7 @@ namespace connectivity
 
     //= ODataAccessCharSet
 
-    class ODataAccessCharSet
-            :public simple::IDataAccessCharSet
-            ,public ORefBase
+    class ODataAccessCharSet : public simple::IDataAccessCharSet
     {
     protected:
         ::dbtools::OCharsetMap      m_aCharsetInfo;
@@ -46,10 +43,6 @@ namespace connectivity
         sal_Int32   getSupportedTextEncodings(
             ::std::vector< rtl_TextEncoding >& /* [out] */ _rEncs
         ) const SAL_OVERRIDE;
-
-        // disambiguate IReference
-        virtual oslInterlockedCount SAL_CALL acquire() SAL_OVERRIDE;
-        virtual oslInterlockedCount SAL_CALL release() SAL_OVERRIDE;
     };
 
 
diff --git a/connectivity/source/simpledbt/dbtfactory.cxx b/connectivity/source/simpledbt/dbtfactory.cxx
index 5211b76..dfd5535 100644
--- a/connectivity/source/simpledbt/dbtfactory.cxx
+++ b/connectivity/source/simpledbt/dbtfactory.cxx
@@ -55,18 +55,6 @@ namespace connectivity
     }
 
 
-    oslInterlockedCount SAL_CALL ODataAccessToolsFactory::acquire()
-    {
-        return ORefBase::acquire();
-    }
-
-
-    oslInterlockedCount SAL_CALL ODataAccessToolsFactory::release()
-    {
-        return ORefBase::release();
-    }
-
-
     ::rtl::Reference< simple::IDataAccessTypeConversion > ODataAccessToolsFactory::getTypeConversionHelper()
     {
         return m_xTypeConversionHelper;
diff --git a/connectivity/source/simpledbt/dbtfactory.hxx b/connectivity/source/simpledbt/dbtfactory.hxx
index f4722b7..4ba0fe5 100644
--- a/connectivity/source/simpledbt/dbtfactory.hxx
+++ b/connectivity/source/simpledbt/dbtfactory.hxx
@@ -21,7 +21,6 @@
 #define INCLUDED_CONNECTIVITY_SOURCE_SIMPLEDBT_DBTFACTORY_HXX
 
 #include <connectivity/virtualdbtools.hxx>
-#include "refbase.hxx"
 
 
 namespace connectivity
@@ -31,9 +30,7 @@ namespace connectivity
 
     //= ODataAccessToolsFactory
 
-    class ODataAccessToolsFactory
-            :public simple::IDataAccessToolsFactory
-            ,public ORefBase
+    class ODataAccessToolsFactory : public simple::IDataAccessToolsFactory
     {
     protected:
         ::rtl::Reference< simple::IDataAccessTypeConversion >   m_xTypeConversionHelper;
@@ -41,6 +38,7 @@ namespace connectivity
 
     public:
         ODataAccessToolsFactory();
+        virtual ~ODataAccessToolsFactory() {}
 
         // IDataAccessToolsFactory
         virtual ::rtl::Reference< simple::ISQLParser >  createSQLParser(
@@ -60,9 +58,6 @@ namespace connectivity
             const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn
         ) SAL_OVERRIDE;
 
-        // IReference
-        virtual oslInterlockedCount SAL_CALL acquire() SAL_OVERRIDE;
-        virtual oslInterlockedCount SAL_CALL release() SAL_OVERRIDE;
     };
 
 
diff --git a/connectivity/source/simpledbt/parsenode_s.cxx b/connectivity/source/simpledbt/parsenode_s.cxx
index fc30c5f..07e1402 100644
--- a/connectivity/source/simpledbt/parsenode_s.cxx
+++ b/connectivity/source/simpledbt/parsenode_s.cxx
@@ -50,19 +50,6 @@ namespace connectivity
             delete m_pFullNode;
     }
 
-
-    oslInterlockedCount SAL_CALL OSimpleParseNode::acquire()
-    {
-        return ORefBase::acquire();
-    }
-
-
-    oslInterlockedCount SAL_CALL OSimpleParseNode::release()
-    {
-        return ORefBase::release();
-    }
-
-
     void OSimpleParseNode::parseNodeToStr(OUString& _rString, const Reference< XConnection >& _rxConnection,const IParseContext* _pContext) const
     {
         m_pFullNode->parseNodeToStr( _rString, _rxConnection, _pContext );
diff --git a/connectivity/source/simpledbt/parsenode_s.hxx b/connectivity/source/simpledbt/parsenode_s.hxx
index 6e5387d..42e47be 100644
--- a/connectivity/source/simpledbt/parsenode_s.hxx
+++ b/connectivity/source/simpledbt/parsenode_s.hxx
@@ -21,7 +21,6 @@
 #define INCLUDED_CONNECTIVITY_SOURCE_SIMPLEDBT_PARSENODE_S_HXX
 
 #include <connectivity/virtualdbtools.hxx>
-#include "refbase.hxx"
 
 
 namespace connectivity
@@ -32,9 +31,7 @@ namespace connectivity
 
     //= OSimpleParseNode
 
-    class OSimpleParseNode
-            :public simple::ISQLParseNode
-            ,public ORefBase
+    class OSimpleParseNode : public simple::ISQLParseNode
     {
     protected:
         const OSQLParseNode*    m_pFullNode;
@@ -59,10 +56,6 @@ namespace connectivity
             const sal_Char _cDecSeparator,
             const IParseContext* _pContext
         ) const SAL_OVERRIDE;
-
-        // disambiguate IReference
-        virtual oslInterlockedCount SAL_CALL acquire() SAL_OVERRIDE;
-        virtual oslInterlockedCount SAL_CALL release() SAL_OVERRIDE;
     };
 
 
diff --git a/connectivity/source/simpledbt/parser_s.cxx b/connectivity/source/simpledbt/parser_s.cxx
index e514abb..eddae29 100644
--- a/connectivity/source/simpledbt/parser_s.cxx
+++ b/connectivity/source/simpledbt/parser_s.cxx
@@ -41,18 +41,6 @@ namespace connectivity
     }
 
 
-    oslInterlockedCount SAL_CALL OSimpleSQLParser::acquire()
-    {
-        return ORefBase::acquire();
-    }
-
-
-    oslInterlockedCount SAL_CALL OSimpleSQLParser::release()
-    {
-        return ORefBase::release();
-    }
-
-
     const IParseContext& OSimpleSQLParser::getContext() const
     {
         return m_aFullParser.getContext();
diff --git a/connectivity/source/simpledbt/parser_s.hxx b/connectivity/source/simpledbt/parser_s.hxx
index 50994fe..359ab25 100644
--- a/connectivity/source/simpledbt/parser_s.hxx
+++ b/connectivity/source/simpledbt/parser_s.hxx
@@ -21,7 +21,6 @@
 #define INCLUDED_CONNECTIVITY_SOURCE_SIMPLEDBT_PARSER_S_HXX
 
 #include <connectivity/virtualdbtools.hxx>
-#include "refbase.hxx"
 #include <connectivity/sqlparse.hxx>
 
 
@@ -32,9 +31,7 @@ namespace connectivity
 
     //= OSimpleSQLParser
 
-    class OSimpleSQLParser
-            :public simple::ISQLParser
-            ,public ORefBase
+    class OSimpleSQLParser : public simple::ISQLParser
     {
     protected:
         OSQLParser      m_aFullParser;
@@ -51,10 +48,6 @@ namespace connectivity
         ) const SAL_OVERRIDE;
 
         virtual const IParseContext& getContext() const SAL_OVERRIDE;
-
-        // disambiguate IReference
-        virtual oslInterlockedCount SAL_CALL acquire() SAL_OVERRIDE;
-        virtual oslInterlockedCount SAL_CALL release() SAL_OVERRIDE;
     };
 
 
diff --git a/connectivity/source/simpledbt/refbase.cxx b/connectivity/source/simpledbt/refbase.cxx
deleted file mode 100644
index 6c86bc3..0000000
--- a/connectivity/source/simpledbt/refbase.cxx
+++ /dev/null
@@ -1,55 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include "refbase.hxx"
-
-
-namespace connectivity
-{
-
-
-
-    //= ORefBase
-
-
-    ORefBase::~ORefBase()
-    {
-    }
-
-
-    oslInterlockedCount SAL_CALL ORefBase::acquire()
-    {
-        return osl_atomic_increment(&m_refCount);
-    }
-
-
-    oslInterlockedCount SAL_CALL ORefBase::release()
-    {
-        oslInterlockedCount nNewRefCount = osl_atomic_decrement(&m_refCount);
-        if (0 == nNewRefCount)
-            delete this;
-
-        return nNewRefCount;
-    }
-
-
-}   // namespace connectivity
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/simpledbt/refbase.hxx b/connectivity/source/simpledbt/refbase.hxx
deleted file mode 100644
index 19c72c6..0000000
--- a/connectivity/source/simpledbt/refbase.hxx
+++ /dev/null
@@ -1,54 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_SIMPLEDBT_REFBASE_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_SIMPLEDBT_REFBASE_HXX
-
-#include <rtl/ref.hxx>
-
-
-namespace connectivity
-{
-
-
-
-    //= ORefBase
-
-    /// base class for all objects implementing the ::rtl::IReference interface
-    class ORefBase : public ::rtl::IReference
-    {
-    protected:
-        oslInterlockedCount     m_refCount;
-
-    protected:
-        ORefBase() : m_refCount(0) { }
-        virtual ~ORefBase();
-
-        virtual oslInterlockedCount SAL_CALL acquire() SAL_OVERRIDE;
-        virtual oslInterlockedCount SAL_CALL release() SAL_OVERRIDE;
-    };
-
-
-}   // namespace connectivity
-
-
-#endif // INCLUDED_CONNECTIVITY_SOURCE_SIMPLEDBT_REFBASE_HXX
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/simpledbt/staticdbtools_s.cxx b/connectivity/source/simpledbt/staticdbtools_s.cxx
index ce63c34..56c8401 100644
--- a/connectivity/source/simpledbt/staticdbtools_s.cxx
+++ b/connectivity/source/simpledbt/staticdbtools_s.cxx
@@ -71,18 +71,6 @@ namespace connectivity
     }
 
 
-    oslInterlockedCount SAL_CALL ODataAccessStaticTools::acquire()
-    {
-        return ORefBase::acquire();
-    }
-
-
-    oslInterlockedCount SAL_CALL ODataAccessStaticTools::release()
-    {
-        return ORefBase::release();
-    }
-
-
     Reference< XConnection> ODataAccessStaticTools::getConnection_withFeedback(const OUString& _rDataSourceName, const OUString& _rUser,
         const OUString& _rPwd, const Reference< XComponentContext>& _rxContext) const
     {
diff --git a/connectivity/source/simpledbt/staticdbtools_s.hxx b/connectivity/source/simpledbt/staticdbtools_s.hxx
index 9497131..7ad25ae 100644
--- a/connectivity/source/simpledbt/staticdbtools_s.hxx
+++ b/connectivity/source/simpledbt/staticdbtools_s.hxx
@@ -21,7 +21,6 @@
 #define INCLUDED_CONNECTIVITY_SOURCE_SIMPLEDBT_STATICDBTOOLS_S_HXX
 
 #include <connectivity/virtualdbtools.hxx>
-#include "refbase.hxx"
 
 
 namespace connectivity
@@ -34,7 +33,6 @@ namespace connectivity
     class ODataAccessStaticTools
             :public simple::IDataAccessTypeConversion
             ,public simple::IDataAccessTools
-            ,public ORefBase
     {
     public:
         ODataAccessStaticTools();
@@ -181,11 +179,6 @@ namespace connectivity
             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent,
             ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxActualConnection
         ) SAL_OVERRIDE;
-
-        // disambiguate IReference
-
-        virtual oslInterlockedCount SAL_CALL acquire() SAL_OVERRIDE;
-        virtual oslInterlockedCount SAL_CALL release() SAL_OVERRIDE;
     };
 
 
diff --git a/include/connectivity/virtualdbtools.hxx b/include/connectivity/virtualdbtools.hxx
index 21c6093..70e93c8 100644
--- a/include/connectivity/virtualdbtools.hxx
+++ b/include/connectivity/virtualdbtools.hxx
@@ -32,6 +32,7 @@
 #include <vector>
 #include <memory>
 #include <connectivity/dbtoolsdllapi.hxx>
+#include <salhelper/simplereferenceobject.hxx>
 
 
 //= forward declarations
@@ -112,7 +113,7 @@ namespace connectivity
 
         //= IDataAccessTools
 
-        class OOO_DLLPUBLIC_DBTOOLS IDataAccessTools : public ::rtl::IReference
+        class OOO_DLLPUBLIC_DBTOOLS IDataAccessTools : public virtual salhelper::SimpleReferenceObject
         {
         public:
             virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getConnection_withFeedback(
@@ -219,7 +220,7 @@ namespace connectivity
             ) = 0;
 
         protected:
-            ~IDataAccessTools() {}
+            virtual ~IDataAccessTools() {}
         };
 
 
@@ -228,7 +229,7 @@ namespace connectivity
         /** simple wrapper for the OCharsetMap
         */
         class OOO_DLLPUBLIC_DBTOOLS IDataAccessCharSet :
-            public ::rtl::IReference
+            public salhelper::SimpleReferenceObject
         {
             // to be extended if necessary ....
         public:
@@ -240,14 +241,14 @@ namespace connectivity
             ) const = 0;
 
         protected:
-            ~IDataAccessCharSet() {}
+            virtual ~IDataAccessCharSet() {}
         };
 
 
         //= IDataAccessTypeConversion
 
         class OOO_DLLPUBLIC_DBTOOLS IDataAccessTypeConversion :
-            public ::rtl::IReference
+            public virtual salhelper::SimpleReferenceObject
         {
         public:
             virtual ::com::sun::star::util::Date getStandardDate() const = 0;
@@ -271,7 +272,7 @@ namespace connectivity
             ) const = 0;
 
         protected:
-            ~IDataAccessTypeConversion() {}
+            virtual ~IDataAccessTypeConversion() {}
         };
 
 
@@ -279,7 +280,7 @@ namespace connectivity
 
         /** a simple version of the OSQLParseNode, with all methods being virtual
         */
-        class OOO_DLLPUBLIC_DBTOOLS ISQLParseNode : public ::rtl::IReference
+        class OOO_DLLPUBLIC_DBTOOLS ISQLParseNode : public salhelper::SimpleReferenceObject
         {
         public:
             virtual void parseNodeToStr(OUString& _rString,
@@ -298,7 +299,7 @@ namespace connectivity
             ) const = 0;
 
         protected:
-            ~ISQLParseNode() {}
+            virtual ~ISQLParseNode() {}
         };
 
 
@@ -306,7 +307,7 @@ namespace connectivity
 
         /** a simple version of the OSQLParser, with all methods being virtual
         */
-        class OOO_DLLPUBLIC_DBTOOLS ISQLParser : public ::rtl::IReference
+        class OOO_DLLPUBLIC_DBTOOLS ISQLParser : public salhelper::SimpleReferenceObject
         {
         public:
             virtual ::rtl::Reference< ISQLParseNode > predicateTree(
@@ -319,7 +320,7 @@ namespace connectivity
             virtual const IParseContext& getContext() const = 0;
 
         protected:
-            ~ISQLParser() {}
+            virtual ~ISQLParser() {}
         };
 
 
@@ -328,7 +329,7 @@ namespace connectivity
         /** the main factory for runtime-loadable tools in the DBTOOLS library
         */
         class OOO_DLLPUBLIC_DBTOOLS IDataAccessToolsFactory :
-            public ::rtl::IReference
+            public salhelper::SimpleReferenceObject
         {
         public:
             /// creates a simple version of the class OSQLParser
@@ -353,7 +354,7 @@ namespace connectivity
             ) = 0;
 
         protected:
-            ~IDataAccessToolsFactory() {}
+            virtual ~IDataAccessToolsFactory() {}
         };
 
 
commit ea8f32b61a51b6d9cef72bbd5ac701bef2975a39
Author: Noel Grandin <noel at peralex.com>
Date:   Tue Jul 8 16:49:46 2014 +0200

    use SimpleReferenceObject in dbaccess module
    
    to replace hand-rolled version
    
    Change-Id: Ie7b98c284d157521482b0f98915146133f32748e

diff --git a/dbaccess/source/core/api/RowSetRow.hxx b/dbaccess/source/core/api/RowSetRow.hxx
index 38b27f4..920d4f9 100644
--- a/dbaccess/source/core/api/RowSetRow.hxx
+++ b/dbaccess/source/core/api/RowSetRow.hxx
@@ -23,6 +23,7 @@
 #include <connectivity/CommonTools.hxx>
 #include "connectivity/FValue.hxx"
 #include <comphelper/types.hxx>
+#include <salhelper/simplereferenceobject.hxx>
 
 namespace dbaccess
 {
@@ -30,29 +31,18 @@ namespace dbaccess
     typedef ::rtl::Reference< ORowSetValueVector >                      ORowSetRow;
     typedef ::std::vector< ORowSetRow >                             ORowSetMatrix;
 
-    class ORowSetOldRowHelper
+    class ORowSetOldRowHelper : public salhelper::SimpleReferenceObject
     {
-        oslInterlockedCount         m_refCount;
         ORowSetRow                  m_aRow;
 
         ORowSetOldRowHelper& operator=(const ORowSetOldRowHelper& _rRH);
         ORowSetOldRowHelper(const ORowSetOldRowHelper& _rRh);
     public:
-        ORowSetOldRowHelper() : m_refCount(0){}
+        ORowSetOldRowHelper(){}
         ORowSetOldRowHelper(const ORowSetRow& _rRow)
-            : m_refCount(0)
-            , m_aRow(_rRow)
+            : m_aRow(_rRow)
         {}
 
-        void acquire()
-        {
-            osl_atomic_increment( &m_refCount );
-        }
-        void release()
-        {
-            if (! osl_atomic_decrement( &m_refCount ))
-                delete this;
-        }
         inline ORowSetRow getRow() const { return m_aRow; }
         inline void clearRow() { m_aRow = NULL; }
         inline void setRow(const ORowSetRow& _rRow) { m_aRow = _rRow; }
diff --git a/dbaccess/source/core/recovery/settingsimport.cxx b/dbaccess/source/core/recovery/settingsimport.cxx
index fc5cdc6..eda7eec 100644
--- a/dbaccess/source/core/recovery/settingsimport.cxx
+++ b/dbaccess/source/core/recovery/settingsimport.cxx
@@ -41,7 +41,6 @@ namespace dbaccess
 
     // SettingsImport
     SettingsImport::SettingsImport()
-        :m_refCount( 0 )
     {
     }
 
@@ -49,19 +48,6 @@ namespace dbaccess
     {
     }
 
-    oslInterlockedCount SAL_CALL SettingsImport::acquire()
-    {
-        return osl_atomic_increment( &m_refCount );
-    }
-
-    oslInterlockedCount SAL_CALL SettingsImport::release()
-    {
-        oslInterlockedCount newCount = osl_atomic_decrement( &m_refCount );
-        if ( newCount == 0 )
-            delete this;
-        return newCount;
-    }
-
     void SettingsImport::startElement( const Reference< XAttributeList >& i_rAttributes )
     {
         // find the name of the setting
diff --git a/dbaccess/source/core/recovery/settingsimport.hxx b/dbaccess/source/core/recovery/settingsimport.hxx
index 8ea1c2d..01089ab 100644
--- a/dbaccess/source/core/recovery/settingsimport.hxx
+++ b/dbaccess/source/core/recovery/settingsimport.hxx
@@ -25,6 +25,7 @@
 #include <comphelper/namedvaluecollection.hxx>
 #include <rtl/ref.hxx>
 #include <rtl/ustrbuf.hxx>
+#include <salhelper/simplereferenceobject.hxx>
 
 namespace dbaccess
 {
@@ -35,16 +36,12 @@ namespace dbaccess
         It would be nice if the DocumentSettingsContext would not be that tightly interwoven with the SvXMLImport
         class, so we could re-use it here ...
     */
-    class SettingsImport : public ::rtl::IReference
+    class SettingsImport : public salhelper::SimpleReferenceObject
     {
     public:
         SettingsImport();
 
-        // IReference
-        virtual oslInterlockedCount SAL_CALL acquire() SAL_OVERRIDE;
-        virtual oslInterlockedCount SAL_CALL release() SAL_OVERRIDE;
-
-        // own overriables
+        // own overridables
         virtual ::rtl::Reference< SettingsImport >  nextState(
             const OUString& i_rElementName
         ) = 0;
@@ -66,7 +63,6 @@ namespace dbaccess
         const OUStringBuffer&    getAccumulatedCharacters() const    { return m_aCharacters; }
 
     private:
-        oslInterlockedCount     m_refCount;
         // value of the config:name attribute, if any
         OUString         m_sItemName;
         // value of the config:type attribute, if any
commit a7470048bd5be5c1668bafc02d58dba97ff5a558
Author: Noel Grandin <noel at peralex.com>
Date:   Tue Jul 8 16:41:11 2014 +0200

    use SimpleReferenceObject in extensions module
    
    to replace hand-rolled version
    
    Change-Id: Ia983f5b87c55d8e5cce6f388e0f77077b6415745

diff --git a/extensions/source/propctrlr/enumrepresentation.hxx b/extensions/source/propctrlr/enumrepresentation.hxx
index 1d56c55..d2739f1 100644
--- a/extensions/source/propctrlr/enumrepresentation.hxx
+++ b/extensions/source/propctrlr/enumrepresentation.hxx
@@ -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
diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx
index 256317f..6c44f12 100644
--- a/extensions/source/propctrlr/formcomponenthandler.cxx
+++ b/extensions/source/propctrlr/formcomponenthandler.cxx
@@ -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;
         };
 
 
diff --git a/extensions/source/propctrlr/formmetadata.cxx b/extensions/source/propctrlr/formmetadata.cxx
index f727883..f9dca52 100644
--- a/extensions/source/propctrlr/formmetadata.cxx
+++ b/extensions/source/propctrlr/formmetadata.cxx
@@ -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
 
 
diff --git a/extensions/source/propctrlr/formmetadata.hxx b/extensions/source/propctrlr/formmetadata.hxx
index 3aed7fa..28d17ea 100644
--- a/extensions/source/propctrlr/formmetadata.hxx
+++ b/extensions/source/propctrlr/formmetadata.hxx
@@ -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
diff --git a/extensions/source/propctrlr/genericpropertyhandler.cxx b/extensions/source/propctrlr/genericpropertyhandler.cxx
index e29196b..1d15275 100644
--- a/extensions/source/propctrlr/genericpropertyhandler.cxx
+++ b/extensions/source/propctrlr/genericpropertyhandler.cxx
@@ -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
diff --git a/extensions/source/propctrlr/sqlcommanddesign.hxx b/extensions/source/propctrlr/sqlcommanddesign.hxx
index bfd8ba5..c80a7c7 100644
--- a/extensions/source/propctrlr/sqlcommanddesign.hxx
+++ b/extensions/source/propctrlr/sqlcommanddesign.hxx
@@ -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
diff --git a/extensions/source/propctrlr/xsddatatypes.cxx b/extensions/source/propctrlr/xsddatatypes.cxx
index 27c6027..1844162 100644
--- a/extensions/source/propctrlr/xsddatatypes.cxx
+++ b/extensions/source/propctrlr/xsddatatypes.cxx
@@ -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()
     {
     }
diff --git a/extensions/source/propctrlr/xsddatatypes.hxx b/extensions/source/propctrlr/xsddatatypes.hxx
index 1cd2ee3..431efbf 100644
--- a/extensions/source/propctrlr/xsddatatypes.hxx
+++ b/extensions/source/propctrlr/xsddatatypes.hxx
@@ -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 >
@@ -49,9 +50,6 @@ namespace pcr
                             m_xFacetInfo;
 
     protected:
-        oslInterlockedCount m_refCount;
-
-    protected:
         inline ::com::sun::star::xsd::XDataType* getDataTypeInterface() const { return m_xDataType.get(); }
 
     public:
@@ -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; }
commit df906cf2acffac4a4611f8b34724cdbcda068c74
Author: Noel Grandin <noel at peralex.com>
Date:   Tue Jul 8 16:23:20 2014 +0200

    use SimpleReferenceObject in forms module
    
    to replace hand-rolled version
    
    Change-Id: Ic95f4dfd1ae5ab414c68c52ad58c738f4ac1d9d1

diff --git a/forms/source/richtext/rtattributehandler.cxx b/forms/source/richtext/rtattributehandler.cxx
index 7a33556..03e257a 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 9cbc60e..881ec2d 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 2f2a4e1..647a5bc 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 3fb6aae..8b70d7a 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;
commit ba6781f8cba03933811fd2a420cf3d09daddfd56
Author: Noel Grandin <noel at peralex.com>
Date:   Tue Jul 8 16:09:31 2014 +0200

    use SimpleReferenceObject in fpicker module
    
    to replace hand-rolled version
    
    Change-Id: I0c1cbf6b0e70106f4ecc5b579e09acc17045a44e

diff --git a/fpicker/Library_fps_office.mk b/fpicker/Library_fps_office.mk
index d3781de..c109dce 100644
--- a/fpicker/Library_fps_office.mk
+++ b/fpicker/Library_fps_office.mk
@@ -25,6 +25,7 @@ $(eval $(call gb_Library_use_libraries,fps_office,\
 	cppu \
 	cppuhelper \
 	sal \
+	salhelper \
 	svl \
 	svt \
 	tk \
diff --git a/fpicker/source/office/asyncfilepicker.cxx b/fpicker/source/office/asyncfilepicker.cxx
index e1c2ebe..d9b18cb 100644
--- a/fpicker/source/office/asyncfilepicker.cxx
+++ b/fpicker/source/office/asyncfilepicker.cxx
@@ -29,8 +29,7 @@
 namespace svt
 {
     AsyncPickerAction::AsyncPickerAction( SvtFileDialog* _pDialog, SvtFileView* _pView, const Action _eAction )
-        :m_refCount ( 0        )
-        ,m_eAction  ( _eAction )
+        :m_eAction  ( _eAction )
         ,m_pView    ( _pView   )
         ,m_pDialog  ( _pDialog )
         ,m_bRunning ( false    )
@@ -45,23 +44,6 @@ namespace svt
     }
 
 
-    oslInterlockedCount SAL_CALL AsyncPickerAction::acquire()
-    {
-        return osl_atomic_increment( &m_refCount );
-    }
-
-
-    oslInterlockedCount SAL_CALL AsyncPickerAction::release()
-    {
-        if ( 0 == osl_atomic_decrement( &m_refCount ) )
-        {
-            delete this;
-            return 0;
-        }
-        return m_refCount;
-    }
-
-
     void AsyncPickerAction::cancel()
     {
         DBG_TESTSOLARMUTEX();
diff --git a/fpicker/source/office/asyncfilepicker.hxx b/fpicker/source/office/asyncfilepicker.hxx
index 77a93e6..cea8899 100644
--- a/fpicker/source/office/asyncfilepicker.hxx
+++ b/fpicker/source/office/asyncfilepicker.hxx
@@ -24,6 +24,7 @@
 #include <rtl/ref.hxx>
 #include <rtl/ustring.hxx>
 #include <com/sun/star/uno/Sequence.h>
+#include <salhelper/simplereferenceobject.hxx>
 
 class SvtFileView;
 class SvtFileDialog;
@@ -39,7 +40,7 @@ namespace svt
 
     //= AsyncPickerAction
 
-    class AsyncPickerAction : public ::rtl::IReference
+    class AsyncPickerAction : public salhelper::SimpleReferenceObject
     {
     public:
         enum Action
@@ -50,7 +51,6 @@ namespace svt
         };
 
     private:
-        mutable oslInterlockedCount m_refCount;
         Action                      m_eAction;
         SvtFileView*                m_pView;
         SvtFileDialog*              m_pDialog;
@@ -83,10 +83,6 @@ namespace svt
         /// cancels the running action
         void cancel();
 
-        // IReference overridables
-        virtual oslInterlockedCount SAL_CALL acquire() SAL_OVERRIDE;
-        virtual oslInterlockedCount SAL_CALL release() SAL_OVERRIDE;
-
     protected:
         virtual ~AsyncPickerAction();
 
commit 3a93809df9ace02da20fa5f91e4c72fa3b3f8a82
Author: Noel Grandin <noel at peralex.com>
Date:   Tue Jul 8 15:44:13 2014 +0200

    improvements to ShareableMutex
    
    - add some docs
    - remove unnecessary null checks
    - improve field name
    
    Change-Id: I8299ec0d56ee5d903f05f2790f97f90ca00663cb

diff --git a/framework/inc/helper/shareablemutex.hxx b/framework/inc/helper/shareablemutex.hxx
index 73c62ab..1a3b506 100644
--- a/framework/inc/helper/shareablemutex.hxx
+++ b/framework/inc/helper/shareablemutex.hxx
@@ -27,6 +27,9 @@
 namespace framework
 {
 
+/**
+ * This acts like a rtl::Reference<osl::Mutex>
+ */
 class FWI_DLLPUBLIC ShareableMutex
 {
     public:
@@ -34,12 +37,15 @@ class FWI_DLLPUBLIC ShareableMutex
         ShareableMutex( const ShareableMutex& rShareableMutex );
         const ShareableMutex& operator=( const ShareableMutex& rShareableMutex );
 
-        ~ShareableMutex();
+        ~ShareableMutex() { m_pMutexRef->release(); }
 
+        /** acquire the shared mutex */
         void acquire();
+        /** release the shared mutex */
         void release();
 
     private:
+        /* ShareableMutex::MutexRef will destroy itself when the last ShareableMutex pointing to it is destroyed */
         struct MutexRef
         {
             MutexRef() : m_refCount(0) {}
@@ -58,7 +64,7 @@ class FWI_DLLPUBLIC ShareableMutex
             osl::Mutex          m_oslMutex;
         };
 
-        MutexRef* pMutexRef;
+        MutexRef* m_pMutexRef;
 };
 
 class ShareGuard
diff --git a/framework/source/fwi/helper/shareablemutex.cxx b/framework/source/fwi/helper/shareablemutex.cxx
index 5699d8ad..4f674c9 100644
--- a/framework/source/fwi/helper/shareablemutex.cxx
+++ b/framework/source/fwi/helper/shareablemutex.cxx
@@ -24,43 +24,32 @@ namespace framework
 
 ShareableMutex::ShareableMutex()
 {
-    pMutexRef = new MutexRef;
-    pMutexRef->acquire();
+    m_pMutexRef = new MutexRef;
+    m_pMutexRef->acquire();
 }
 
 ShareableMutex::ShareableMutex( const ShareableMutex& rShareableMutex )
 {
-    pMutexRef = rShareableMutex.pMutexRef;
-    if ( pMutexRef )
-        pMutexRef->acquire();
+    m_pMutexRef = rShareableMutex.m_pMutexRef;
+    m_pMutexRef->acquire();
 }
 
 const ShareableMutex& ShareableMutex::operator=( const ShareableMutex& rShareableMutex )
 {
-    if ( rShareableMutex.pMutexRef )
-        rShareableMutex.pMutexRef->acquire();
-    if ( pMutexRef )
-        pMutexRef->release();
-    pMutexRef = rShareableMutex.pMutexRef;
+    rShareableMutex.m_pMutexRef->acquire();
+    m_pMutexRef->release();
+    m_pMutexRef = rShareableMutex.m_pMutexRef;
     return *this;
 }
 
-ShareableMutex::~ShareableMutex()
-{
-    if ( pMutexRef )
-        pMutexRef->release();
-}
-
 void ShareableMutex::acquire()
 {
-    if ( pMutexRef )
-        pMutexRef->m_oslMutex.acquire();
+    m_pMutexRef->m_oslMutex.acquire();
 }
 
 void ShareableMutex::release()
 {
-    if ( pMutexRef )
-        pMutexRef->m_oslMutex.release();
+    m_pMutexRef->m_oslMutex.release();
 }
 
 }


More information about the Libreoffice-commits mailing list