diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-06-03 21:38:37 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-06-07 08:58:49 +0100 |
commit | fd7b4908ead77c7f0fb8894cf78401468c5160a9 (patch) | |
tree | 12675a84af01c2c7737b9fa1f6e4bed30e979b3d | |
parent | rend() on a non-const container is a non-const iterator (diff) | |
download | core-fd7b4908ead77c7f0fb8894cf78401468c5160a9.tar.gz core-fd7b4908ead77c7f0fb8894cf78401468c5160a9.zip |
use the standard template for this
-rw-r--r-- | editeng/source/accessibility/AccessibleContextBase.cxx | 21 | ||||
-rw-r--r-- | editeng/source/uno/unofield.cxx | 17 | ||||
-rw-r--r-- | editeng/source/uno/unonrule.cxx | 2 | ||||
-rw-r--r-- | editeng/source/uno/unopracc.cxx | 14 | ||||
-rw-r--r-- | editeng/source/uno/unotext.cxx | 78 | ||||
-rw-r--r-- | editeng/source/uno/unotext2.cxx | 32 |
6 files changed, 65 insertions, 99 deletions
diff --git a/editeng/source/accessibility/AccessibleContextBase.cxx b/editeng/source/accessibility/AccessibleContextBase.cxx index 508728d17125..2ca74c6cb2cd 100644 --- a/editeng/source/accessibility/AccessibleContextBase.cxx +++ b/editeng/source/accessibility/AccessibleContextBase.cxx @@ -41,7 +41,7 @@ #include <unotools/accessiblestatesethelper.hxx> #include <unotools/accessiblerelationsethelper.hxx> #include <comphelper/accessibleeventnotifier.hxx> -#include <rtl/uuid.h> +#include <comphelper/servicehelper.hxx> #include <osl/mutex.hxx> #include <utility> @@ -545,27 +545,18 @@ uno::Sequence< ::com::sun::star::uno::Type> return BaseClass::getTypes(); } - - +namespace +{ + class theAccessibleContextBaseImplementationId : public rtl::Static< UnoTunnelIdInit, theAccessibleContextBaseImplementationId > {}; +} uno::Sequence<sal_Int8> SAL_CALL AccessibleContextBase::getImplementationId (void) throw (::com::sun::star::uno::RuntimeException) { - ThrowIfDisposed (); - static uno::Sequence<sal_Int8> aId; - if (aId.getLength() == 0) - { - ::osl::MutexGuard aGuard (maMutex); - aId.realloc (16); - rtl_createUuid ((sal_uInt8 *)aId.getArray(), 0, sal_True); - } - return aId; + return theAccessibleContextBaseImplementationId::get().getSeq(); } - - - //===== internal ============================================================ void SAL_CALL AccessibleContextBase::disposing (void) diff --git a/editeng/source/uno/unofield.cxx b/editeng/source/uno/unofield.cxx index 83e7f14a5b21..d18c2992003e 100644 --- a/editeng/source/uno/unofield.cxx +++ b/editeng/source/uno/unofield.cxx @@ -35,15 +35,13 @@ #include <vcl/svapp.hxx> #include <osl/mutex.hxx> -#include <rtl/uuid.h> -#include <rtl/memory.h> - #include <editeng/eeitem.hxx> #include <editeng/flditem.hxx> #include <editeng/measfld.hxx> #include <editeng/unofield.hxx> #include <editeng/unotext.hxx> #include <comphelper/serviceinfohelper.hxx> +#include <comphelper/servicehelper.hxx> using namespace ::rtl; using namespace ::cppu; @@ -572,16 +570,15 @@ uno::Sequence< uno::Type > SAL_CALL SvxUnoTextField::getTypes() return maTypeSequence; } +namespace +{ + class theSvxUnoTextFieldImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxUnoTextFieldImplementationId > {}; +} + uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextField::getImplementationId() throw (uno::RuntimeException) { - static uno::Sequence< sal_Int8 > aId; - if( aId.getLength() == 0 ) - { - aId.realloc( 16 ); - rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True ); - } - return aId; + return theSvxUnoTextFieldImplementationId::get().getSeq(); } uno::Any SAL_CALL SvxUnoTextField::queryInterface( const uno::Type & rType ) diff --git a/editeng/source/uno/unonrule.cxx b/editeng/source/uno/unonrule.cxx index b2d3ff1e45a7..8861b6ca125a 100644 --- a/editeng/source/uno/unonrule.cxx +++ b/editeng/source/uno/unonrule.cxx @@ -39,8 +39,6 @@ #include <vcl/graph.hxx> #include <svtools/grfmgr.hxx> #include <toolkit/unohlp.hxx> -#include <rtl/uuid.h> -#include <rtl/memory.h> #include <editeng/brshitem.hxx> #include <editeng/unoprnms.hxx> diff --git a/editeng/source/uno/unopracc.cxx b/editeng/source/uno/unopracc.cxx index 6a0ebeede6a0..088cdbbc3ff7 100644 --- a/editeng/source/uno/unopracc.cxx +++ b/editeng/source/uno/unopracc.cxx @@ -40,6 +40,7 @@ #include <cppuhelper/weakref.hxx> #include <com/sun/star/lang/XComponent.hpp> #include <cppuhelper/typeprovider.hxx> +#include <comphelper/servicehelper.hxx> //------------------------------------------------------------------------ @@ -127,16 +128,15 @@ uno::Sequence< uno::Type > SAL_CALL SvxAccessibleTextPropertySet::getTypes() thr return pTypeCollection->getTypes() ; } +namespace +{ + class theSvxAccessibleTextPropertySetImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxAccessibleTextPropertySetImplementationId > {}; +} + uno::Sequence< sal_Int8 > SAL_CALL SvxAccessibleTextPropertySet::getImplementationId() throw (uno::RuntimeException) { - static uno::Sequence< sal_Int8 > aId; - if( aId.getLength() == 0 ) - { - aId.realloc( 16 ); - rtl_createUuid( reinterpret_cast< sal_uInt8* > (aId.getArray()), 0, sal_True ); - } - return aId; + return theSvxAccessibleTextPropertySetImplementationId::get().getSeq(); } // XServiceInfo diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx index 66ce712b08d0..0d097884b588 100644 --- a/editeng/source/uno/unotext.cxx +++ b/editeng/source/uno/unotext.cxx @@ -38,8 +38,6 @@ #include <svl/itempool.hxx> #include <svl/intitem.hxx> #include <svl/eitem.hxx> -#include <rtl/uuid.h> -#include <rtl/memory.h> #include <rtl/instance.hxx> #include <editeng/fontitem.hxx> @@ -56,6 +54,7 @@ #include <editeng/outliner.hxx> #include <editeng/unoipset.hxx> #include <comphelper/serviceinfohelper.hxx> +#include <comphelper/servicehelper.hxx> using namespace ::rtl; using namespace ::cppu; @@ -1618,16 +1617,15 @@ uno::Sequence< uno::Type > SAL_CALL SvxUnoTextRange::getTypes() return theSvxUnoTextRangeTypes::get(); } +namespace +{ + class theSvxUnoTextRangeImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxUnoTextRangeImplementationId > {}; +} + uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextRange::getImplementationId() throw (uno::RuntimeException) { - static uno::Sequence< sal_Int8 > aId; - if( aId.getLength() == 0 ) - { - aId.realloc( 16 ); - rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True ); - } - return aId; + return theSvxUnoTextRangeImplementationId::get().getSeq(); } // XTextRange @@ -1782,16 +1780,15 @@ uno::Sequence< uno::Type > SAL_CALL SvxUnoTextBase::getTypes() return getStaticTypes(); } +namespace +{ + class theSvxUnoTextBaseImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxUnoTextBaseImplementationId > {}; +} + uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextBase::getImplementationId() throw (uno::RuntimeException) { - static uno::Sequence< sal_Int8 > aId; - if( aId.getLength() == 0 ) - { - aId.realloc( 16 ); - rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True ); - } - return aId; + return theSvxUnoTextBaseImplementationId::get().getSeq(); } uno::Reference< text::XTextCursor > SvxUnoTextBase::createTextCursorBySelection( const ESelection& rSel ) @@ -2296,20 +2293,14 @@ uno::Sequence< OUString > SAL_CALL SvxUnoTextBase::getSupportedServiceNames_Stat return aSeq; } +namespace +{ + class theSvxUnoTextBaseUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSvxUnoTextBaseUnoTunnelId > {}; +} + const uno::Sequence< sal_Int8 > & SvxUnoTextBase::getUnoTunnelId() throw() { - static uno::Sequence< sal_Int8 > * pSeq = 0; - if( !pSeq ) - { - ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ); - if( !pSeq ) - { - static uno::Sequence< sal_Int8 > aSeq( 16 ); - rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); - pSeq = &aSeq; - } - } - return *pSeq; + return theSvxUnoTextBaseUnoTunnelId::get().getSeq(); } SvxUnoTextBase* SvxUnoTextBase::getImplementation( const uno::Reference< uno::XInterface >& xInt ) @@ -2396,15 +2387,14 @@ uno::Sequence< uno::Type > SAL_CALL SvxUnoText::getTypes( ) throw( uno::Runtime return SvxUnoTextBase::getTypes(); } +namespace +{ + class theSvxUnoTextImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxUnoTextImplementationId > {}; +} + uno::Sequence< sal_Int8 > SAL_CALL SvxUnoText::getImplementationId( ) throw( uno::RuntimeException ) { - static uno::Sequence< sal_Int8 > aId; - if( aId.getLength() == 0 ) - { - aId.realloc( 16 ); - rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True ); - } - return aId; + return theSvxUnoTextImplementationId::get().getSeq(); } SvxUnoText* SvxUnoText::getImplementation( const uno::Reference< uno::XInterface >& xInt ) @@ -2416,20 +2406,14 @@ SvxUnoText* SvxUnoText::getImplementation( const uno::Reference< uno::XInterface return NULL; } +namespace +{ + class theSvxUnoTextUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSvxUnoTextUnoTunnelId > {}; +} + const uno::Sequence< sal_Int8 > & SvxUnoText::getUnoTunnelId() throw() { - static uno::Sequence< sal_Int8 > * pSeq = 0; - if( !pSeq ) - { - ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ); - if( !pSeq ) - { - static uno::Sequence< sal_Int8 > aSeq( 16 ); - rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); - pSeq = &aSeq; - } - } - return *pSeq; + return theSvxUnoTextUnoTunnelId::get().getSeq(); } sal_Int64 SAL_CALL SvxUnoText::getSomething( const uno::Sequence< sal_Int8 >& rId ) throw(uno::RuntimeException) \ diff --git a/editeng/source/uno/unotext2.cxx b/editeng/source/uno/unotext2.cxx index ade10370dc88..af227be6b673 100644 --- a/editeng/source/uno/unotext2.cxx +++ b/editeng/source/uno/unotext2.cxx @@ -30,19 +30,17 @@ #include "precompiled_editeng.hxx" #include <vcl/svapp.hxx> #include <osl/mutex.hxx> +#include <rtl/instance.hxx> #define _SVSTDARR_sal_uIt16S #include <svl/svstdarr.hxx> -#include <rtl/uuid.h> -#include <rtl/memory.h> -#include <rtl/instance.hxx> - #include <editeng/eeitem.hxx> #include <editeng/flditem.hxx> #include <editeng/unofield.hxx> #include <editeng/unotext.hxx> #include <comphelper/serviceinfohelper.hxx> +#include <comphelper/servicehelper.hxx> using namespace ::rtl; using namespace ::cppu; @@ -235,16 +233,15 @@ uno::Sequence< uno::Type > SAL_CALL SvxUnoTextContent::getTypes() return theSvxUnoTextContentTypes::get(); } +namespace +{ + class theSvxUnoTextContentImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxUnoTextContentImplementationId > {}; +} + uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextContent::getImplementationId() throw (uno::RuntimeException) { - static uno::Sequence< sal_Int8 > aId; - if( aId.getLength() == 0 ) - { - aId.realloc( 16 ); - rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True ); - } - return aId; + return theSvxUnoTextContentImplementationId::get().getSeq(); } // text::XTextRange @@ -598,16 +595,15 @@ uno::Sequence< uno::Type > SAL_CALL SvxUnoTextCursor::getTypes() return theSvxUnoTextCursorTypes::get(); } +namespace +{ + class theSvxUnoTextCursorImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxUnoTextCursorImplementationId > {}; +} + uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextCursor::getImplementationId() throw (uno::RuntimeException) { - static uno::Sequence< sal_Int8 > aId; - if( aId.getLength() == 0 ) - { - aId.realloc( 16 ); - rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True ); - } - return aId; + return theSvxUnoTextCursorImplementationId::get().getSeq(); } // text::XTextCursor |