diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-06-05 15:23:14 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-06-07 08:56:50 +0100 |
commit | 8a962baff610ab0ba8adad42e54fda3524590952 (patch) | |
tree | da14e41c25ee4513182d9983433a3be8f40e790d | |
parent | 04e20ca11b74f7482e563c21f8c9b708158d577c (diff) |
use standard pattern for this
8 files changed, 43 insertions, 57 deletions
diff --git a/accessibility/inc/accessibility/extended/AccessibleBrowseBoxBase.hxx b/accessibility/inc/accessibility/extended/AccessibleBrowseBoxBase.hxx index 67f0574ab436..ccf0dc923e8c 100644 --- a/accessibility/inc/accessibility/extended/AccessibleBrowseBoxBase.hxx +++ b/accessibility/inc/accessibility/extended/AccessibleBrowseBoxBase.hxx @@ -353,11 +353,6 @@ protected: Rectangle getBoundingBoxOnScreen() throw ( ::com::sun::star::lang::DisposedException ); - /** Creates a new UUID, if rId is empty. - @attention This method requires locked global mutex to prevent double - creation of an UUID. */ - static void implCreateUuid( ::com::sun::star::uno::Sequence< sal_Int8 >& rId ); - ::comphelper::AccessibleEventNotifier::TClientId getClientId() const { return m_aClientId; } void setClientId(::comphelper::AccessibleEventNotifier::TClientId _aNewClientId) { m_aClientId = _aNewClientId; } diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControlBase.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControlBase.hxx index 383c6410eaeb..6c406b4fa0b5 100644 --- a/accessibility/inc/accessibility/extended/AccessibleGridControlBase.hxx +++ b/accessibility/inc/accessibility/extended/AccessibleGridControlBase.hxx @@ -322,11 +322,6 @@ protected: Rectangle getBoundingBoxOnScreen() throw ( ::com::sun::star::lang::DisposedException ); - /** Creates a new UUID, if rId is empty. - @attention This method requires locked global mutex to prevent double - creation of an UUID. */ - static void implCreateUuid( ::com::sun::star::uno::Sequence< sal_Int8 >& rId ); - ::comphelper::AccessibleEventNotifier::TClientId getClientId() const { return m_aClientId; } void setClientId(::comphelper::AccessibleEventNotifier::TClientId _aNewClientId) { m_aClientId = _aNewClientId; } diff --git a/accessibility/source/extended/AccessibleBrowseBoxBase.cxx b/accessibility/source/extended/AccessibleBrowseBoxBase.cxx index 24cc3ce52f2a..97baa20e5968 100644 --- a/accessibility/source/extended/AccessibleBrowseBoxBase.cxx +++ b/accessibility/source/extended/AccessibleBrowseBoxBase.cxx @@ -30,8 +30,8 @@ #include "precompiled_accessibility.hxx" #include "accessibility/extended/AccessibleBrowseBoxBase.hxx" #include <svtools/accessibletableprovider.hxx> -#include <rtl/uuid.h> -// +#include <comphelper/servicehelper.hxx> + #include <com/sun/star/accessibility/AccessibleEventId.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <unotools/accessiblerelationsethelper.hxx> @@ -344,13 +344,15 @@ void SAL_CALL AccessibleBrowseBoxBase::removeEventListener( // XTypeProvider -------------------------------------------------------------- +namespace +{ + class theAccessibleBrowseBoxBaseImplementationId : public rtl::Static< UnoTunnelIdInit, theAccessibleBrowseBoxBaseImplementationId > {}; +} + Sequence< sal_Int8 > SAL_CALL AccessibleBrowseBoxBase::getImplementationId() throw ( uno::RuntimeException ) { - ::osl::MutexGuard aGuard( getOslGlobalMutex() ); - static Sequence< sal_Int8 > aId; - implCreateUuid( aId ); - return aId; + return theAccessibleBrowseBoxBaseImplementationId::get().getSeq(); } // XServiceInfo --------------------------------------------------------------- @@ -508,17 +510,7 @@ void AccessibleBrowseBoxBase::commitEvent( AccessibleEventNotifier::addEvent( getClientId( ), aEvent ); } -// ----------------------------------------------------------------------------- -void AccessibleBrowseBoxBase::implCreateUuid( Sequence< sal_Int8 >& rId ) -{ - if( !rId.hasElements() ) - { - rId.realloc( 16 ); - rtl_createUuid( reinterpret_cast< sal_uInt8* >( rId.getArray() ), 0, sal_True ); - } -} -// ----------------------------------------------------------------------------- sal_Int16 SAL_CALL AccessibleBrowseBoxBase::getAccessibleRole() throw ( uno::RuntimeException ) { diff --git a/accessibility/source/extended/AccessibleBrowseBoxHeaderBar.cxx b/accessibility/source/extended/AccessibleBrowseBoxHeaderBar.cxx index b40253c2e100..33d50c053792 100644 --- a/accessibility/source/extended/AccessibleBrowseBoxHeaderBar.cxx +++ b/accessibility/source/extended/AccessibleBrowseBoxHeaderBar.cxx @@ -32,6 +32,7 @@ #include "accessibility/extended/AccessibleBrowseBoxHeaderBar.hxx" #include <svtools/accessibletableprovider.hxx> +#include <comphelper/servicehelper.hxx> // ============================================================================ @@ -344,13 +345,15 @@ OUString SAL_CALL AccessibleBrowseBoxHeaderBar::getImplementationName() return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svtools.AccessibleBrowseBoxHeaderBar" ) ); } +namespace +{ + class theAccessibleBrowseBoxHeaderBarImplementationId : public rtl::Static< UnoTunnelIdInit, theAccessibleBrowseBoxHeaderBarImplementationId > {}; +} + Sequence< sal_Int8 > SAL_CALL AccessibleBrowseBoxHeaderBar::getImplementationId() throw ( uno::RuntimeException ) { - ::osl::MutexGuard aGuard( getOslGlobalMutex() ); - static Sequence< sal_Int8 > aId; - implCreateUuid( aId ); - return aId; + return theAccessibleBrowseBoxHeaderBarImplementationId::get().getSeq(); } // internal virtual methods --------------------------------------------------- diff --git a/accessibility/source/extended/AccessibleBrowseBoxTableBase.cxx b/accessibility/source/extended/AccessibleBrowseBoxTableBase.cxx index 825689cf3185..6108672088b0 100644 --- a/accessibility/source/extended/AccessibleBrowseBoxTableBase.cxx +++ b/accessibility/source/extended/AccessibleBrowseBoxTableBase.cxx @@ -34,6 +34,7 @@ #include <svtools/accessibletableprovider.hxx> #include <tools/multisel.hxx> #include <comphelper/sequence.hxx> +#include <comphelper/servicehelper.hxx> // ============================================================================ @@ -206,13 +207,15 @@ Sequence< uno::Type > SAL_CALL AccessibleBrowseBoxTableBase::getTypes() AccessibleBrowseBoxTableImplHelper::getTypes() ); } +namespace +{ + class theAccessibleBrowseBoxTableBaseImplementationId : public rtl::Static< UnoTunnelIdInit, theAccessibleBrowseBoxTableBaseImplementationId > {}; +} + Sequence< sal_Int8 > SAL_CALL AccessibleBrowseBoxTableBase::getImplementationId() throw ( uno::RuntimeException ) { - ::osl::MutexGuard aGuard( getOslGlobalMutex() ); - static Sequence< sal_Int8 > aId; - implCreateUuid( aId ); - return aId; + return theAccessibleBrowseBoxTableBaseImplementationId::get().getSeq(); } // internal virtual methods --------------------------------------------------- diff --git a/accessibility/source/extended/AccessibleGridControlBase.cxx b/accessibility/source/extended/AccessibleGridControlBase.cxx index bf1fb2cca520..c3af90ec5606 100644 --- a/accessibility/source/extended/AccessibleGridControlBase.cxx +++ b/accessibility/source/extended/AccessibleGridControlBase.cxx @@ -30,7 +30,7 @@ #include "precompiled_accessibility.hxx" #include "accessibility/extended/AccessibleGridControlBase.hxx" #include <svtools/accessibletable.hxx> -#include <rtl/uuid.h> +#include <comphelper/servicehelper.hxx> // #include <com/sun/star/accessibility/AccessibleEventId.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> @@ -280,13 +280,15 @@ void SAL_CALL AccessibleGridControlBase::removeEventListener( // XTypeProvider -------------------------------------------------------------- +namespace +{ + class theAccessibleGridControlBaseImplementationId : public rtl::Static< UnoTunnelIdInit, theAccessibleGridControlBaseImplementationId > {}; +} + Sequence< sal_Int8 > SAL_CALL AccessibleGridControlBase::getImplementationId() throw ( uno::RuntimeException ) { - ::osl::MutexGuard aGuard( getOslGlobalMutex() ); - static Sequence< sal_Int8 > aId; - implCreateUuid( aId ); - return aId; + return theAccessibleGridControlBaseImplementationId::get().getSeq(); } // XServiceInfo --------------------------------------------------------------- @@ -409,17 +411,7 @@ void AccessibleGridControlBase::commitEvent( AccessibleEventNotifier::addEvent( getClientId( ), aEvent ); } -// ----------------------------------------------------------------------------- -void AccessibleGridControlBase::implCreateUuid( Sequence< sal_Int8 >& rId ) -{ - if( !rId.hasElements() ) - { - rId.realloc( 16 ); - rtl_createUuid( reinterpret_cast< sal_uInt8* >( rId.getArray() ), 0, sal_True ); - } -} -// ----------------------------------------------------------------------------- sal_Int16 SAL_CALL AccessibleGridControlBase::getAccessibleRole() throw ( uno::RuntimeException ) { diff --git a/accessibility/source/extended/AccessibleGridControlHeader.cxx b/accessibility/source/extended/AccessibleGridControlHeader.cxx index 464d5842163d..a46a3808f043 100644 --- a/accessibility/source/extended/AccessibleGridControlHeader.cxx +++ b/accessibility/source/extended/AccessibleGridControlHeader.cxx @@ -34,6 +34,7 @@ #include "accessibility/extended/AccessibleGridControlHeaderCell.hxx" #include "accessibility/extended/AccessibleGridControlTableCell.hxx" #include <svtools/accessibletable.hxx> +#include <comphelper/servicehelper.hxx> // ============================================================================ @@ -227,13 +228,15 @@ OUString SAL_CALL AccessibleGridControlHeader::getImplementationName() return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleGridControlHeader" ) ); } +namespace +{ + class theAccessibleGridControlHeaderImplementationId : public rtl::Static< UnoTunnelIdInit, theAccessibleGridControlHeaderImplementationId > {}; +} + Sequence< sal_Int8 > SAL_CALL AccessibleGridControlHeader::getImplementationId() throw ( uno::RuntimeException ) { - ::osl::MutexGuard aGuard( getOslGlobalMutex() ); - static Sequence< sal_Int8 > aId; - implCreateUuid( aId ); - return aId; + return theAccessibleGridControlHeaderImplementationId::get().getSeq(); } // internal virtual methods --------------------------------------------------- diff --git a/accessibility/source/extended/AccessibleGridControlTableBase.cxx b/accessibility/source/extended/AccessibleGridControlTableBase.cxx index 5dc6032eab7a..6b034b9e554c 100644 --- a/accessibility/source/extended/AccessibleGridControlTableBase.cxx +++ b/accessibility/source/extended/AccessibleGridControlTableBase.cxx @@ -34,6 +34,7 @@ #include <svtools/accessibletable.hxx> #include <tools/multisel.hxx> #include <comphelper/sequence.hxx> +#include <comphelper/servicehelper.hxx> // ============================================================================ @@ -210,13 +211,15 @@ Sequence< uno::Type > SAL_CALL AccessibleGridControlTableBase::getTypes() AccessibleGridControlTableImplHelper::getTypes() ); } +namespace +{ + class theAccessibleGridControlTableBaseImplementationId : public rtl::Static< UnoTunnelIdInit, theAccessibleGridControlTableBaseImplementationId > {}; +} + Sequence< sal_Int8 > SAL_CALL AccessibleGridControlTableBase::getImplementationId() throw ( uno::RuntimeException ) { - ::osl::MutexGuard aGuard( getOslGlobalMutex() ); - static Sequence< sal_Int8 > aId; - implCreateUuid( aId ); - return aId; + return theAccessibleGridControlTableBaseImplementationId::get().getSeq(); } // internal helper methods ---------------------------------------------------- |