diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-06-03 08:49:45 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-06-03 08:49:45 +0100 |
commit | 10ff4adcef1a4836245657d7c7ec41ce66f61e93 (patch) | |
tree | 3b1159eba07d3f0ca21cee8cf5c1cd40895b8510 | |
parent | 4f95f23d8b9e0c5fcea663d7477c4c8aef7e2049 (diff) |
use standard template for this here
-rw-r--r-- | sd/source/ui/app/sdxfer.cxx | 19 | ||||
-rw-r--r-- | sd/source/ui/dlg/sdtreelb.cxx | 19 | ||||
-rw-r--r-- | sd/source/ui/framework/factories/Pane.cxx | 23 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unomodel.cxx | 20 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unopage.cxx | 36 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unopback.cxx | 1 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unosrch.cxx | 1 | ||||
-rw-r--r-- | sd/source/ui/view/ViewTabBar.cxx | 22 |
8 files changed, 47 insertions, 94 deletions
diff --git a/sd/source/ui/app/sdxfer.cxx b/sd/source/ui/app/sdxfer.cxx index f40a6694a10e..7619e7d675a0 100644 --- a/sd/source/ui/app/sdxfer.cxx +++ b/sd/source/ui/app/sdxfer.cxx @@ -63,6 +63,7 @@ #include <svx/svditer.hxx> #include <sfx2/docfile.hxx> #include <comphelper/storagehelper.hxx> +#include <comphelper/servicehelper.hxx> #include <svtools/embedtransfer.hxx> #include "DrawDocShell.hxx" #include "View.hxx" @@ -777,22 +778,14 @@ sal_Int64 SAL_CALL SdTransferable::getSomething( const ::com::sun::star::uno::Se return nRet; } -// ----------------------------------------------------------------------------- +namespace +{ + class theSdTransferableUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSdTransferableUnoTunnelId > {}; +} const ::com::sun::star::uno::Sequence< sal_Int8 >& SdTransferable::getUnoTunnelId() { - static ::com::sun::star::uno::Sequence< sal_Int8 > aSeq; - - if( !aSeq.getLength() ) - { - static osl::Mutex aCreateMutex; - osl::MutexGuard aGuard( aCreateMutex ); - - aSeq.realloc( 16 ); - rtl_createUuid( reinterpret_cast< sal_uInt8* >( aSeq.getArray() ), 0, sal_True ); - } - - return aSeq; + return theSdTransferableUnoTunnelId::get().getSeq(); } // ----------------------------------------------------------------------------- diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx index a892577516c9..ae7f526848f2 100644 --- a/sd/source/ui/dlg/sdtreelb.cxx +++ b/sd/source/ui/dlg/sdtreelb.cxx @@ -56,6 +56,7 @@ #include <com/sun/star/embed/XEmbedPersist.hpp> #include <svtools/embedtransfer.hxx> #include <tools/diagnose_ex.h> +#include <comphelper/servicehelper.hxx> #include <ViewShell.hxx> using namespace com::sun::star; @@ -177,22 +178,14 @@ sal_Int64 SAL_CALL SdPageObjsTLB::SdPageObjsTransferable::getSomething( const :: return nRet; } -// ----------------------------------------------------------------------------- +namespace +{ + class theSdPageObjsTLBUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSdPageObjsTLBUnoTunnelId > {}; +} const ::com::sun::star::uno::Sequence< sal_Int8 >& SdPageObjsTLB::SdPageObjsTransferable::getUnoTunnelId() { - static ::com::sun::star::uno::Sequence< sal_Int8 > aSeq; - - if( !aSeq.getLength() ) - { - static osl::Mutex aCreateMutex; - osl::MutexGuard aGuard( aCreateMutex ); - - aSeq.realloc( 16 ); - rtl_createUuid( reinterpret_cast< sal_uInt8* >( aSeq.getArray() ), 0, sal_True ); - } - - return aSeq; + return theSdPageObjsTLBUnoTunnelId::get().getSeq(); } // ----------------------------------------------------------------------------- diff --git a/sd/source/ui/framework/factories/Pane.cxx b/sd/source/ui/framework/factories/Pane.cxx index 8d7ae216f527..3fbffaf284f0 100644 --- a/sd/source/ui/framework/factories/Pane.cxx +++ b/sd/source/ui/framework/factories/Pane.cxx @@ -30,12 +30,12 @@ #include "framework/Pane.hxx" -#include <rtl/uuid.h> #include <vcl/svapp.hxx> #include <osl/mutex.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <vcl/window.hxx> #include <cppcanvas/vclfactory.hxx> +#include <comphelper/servicehelper.hxx> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -195,24 +195,15 @@ sal_Bool SAL_CALL Pane::isAnchorOnly (void) //----- XUnoTunnel ------------------------------------------------------------ -const Sequence<sal_Int8>& Pane::getUnoTunnelId (void) +namespace { - static Sequence<sal_Int8>* pSequence = NULL; - if (pSequence == NULL) - { - const SolarMutexGuard aSolarGuard; - if (pSequence == NULL) - { - static ::com::sun::star::uno::Sequence<sal_Int8> aSequence (16); - rtl_createUuid((sal_uInt8*)aSequence.getArray(), 0, sal_True); - pSequence = &aSequence; - } - } - return *pSequence; + class thePaneUnoTunnelId : public rtl::Static< UnoTunnelIdInit, thePaneUnoTunnelId > {}; } - - +const Sequence<sal_Int8>& Pane::getUnoTunnelId (void) +{ + return thePaneUnoTunnelId::get().getSeq(); +} sal_Int64 SAL_CALL Pane::getSomething (const Sequence<sal_Int8>& rId) throw (RuntimeException) diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 660e6173b8df..a382a7aab057 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -41,11 +41,10 @@ #include <com/sun/star/presentation/XPresentation2.hpp> #include <osl/mutex.hxx> -#include <comphelper/serviceinfohelper.hxx> - #include <comphelper/sequence.hxx> +#include <comphelper/servicehelper.hxx> +#include <comphelper/serviceinfohelper.hxx> -#include <rtl/uuid.h> #include <rtl/memory.h> #include <editeng/unofield.hxx> #include <unomodel.hxx> @@ -388,17 +387,14 @@ uno::Sequence< uno::Type > SAL_CALL SdXImpressDocument::getTypes( ) throw(uno:: return maTypeSequence; } -uno::Sequence< sal_Int8 > SAL_CALL SdXImpressDocument::getImplementationId( ) throw(uno::RuntimeException) +namespace { - ::SolarMutexGuard aGuard; + class theSdXImpressDocumentImplementationId : public rtl::Static< UnoTunnelIdInit, theSdXImpressDocumentImplementationId > {}; +} - static uno::Sequence< sal_Int8 > aId; - if( aId.getLength() == 0 ) - { - aId.realloc( 16 ); - rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True ); - } - return aId; +uno::Sequence< sal_Int8 > SAL_CALL SdXImpressDocument::getImplementationId( ) throw(uno::RuntimeException) +{ + return theSdXImpressDocumentImplementationId::get().getSeq(); } /*********************************************************************** diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx index 6e5623564c44..a2eec92fcdc4 100644 --- a/sd/source/ui/unoidl/unopage.cxx +++ b/sd/source/ui/unoidl/unopage.cxx @@ -39,6 +39,7 @@ #include <com/sun/star/presentation/EffectNodeType.hpp> #include <com/sun/star/lang/DisposedException.hpp> #include <comphelper/processfactory.hxx> +#include <comphelper/servicehelper.hxx> #include <rtl/ustrbuf.hxx> #include <vcl/bitmapex.hxx> #include <vcl/metaact.hxx> @@ -61,7 +62,6 @@ #include <svx/svdorect.hxx> #include <osl/mutex.hxx> #include <svl/style.hxx> -#include <rtl/uuid.h> #include <rtl/memory.h> #include <comphelper/serviceinfohelper.hxx> @@ -2122,19 +2122,14 @@ Sequence< uno::Type > SAL_CALL SdDrawPage::getTypes() throw(uno::RuntimeExceptio return maTypeSequence; } -Sequence< sal_Int8 > SAL_CALL SdDrawPage::getImplementationId() throw(uno::RuntimeException) +namespace { - ::SolarMutexGuard aGuard; - - throwIfDisposed(); + class theSdDrawPageImplementationId : public rtl::Static< UnoTunnelIdInit, theSdDrawPageImplementationId > {}; +} - static Sequence< sal_Int8 > aId; - if( aId.getLength() == 0 ) - { - aId.realloc( 16 ); - rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True ); - } - return aId; +Sequence< sal_Int8 > SAL_CALL SdDrawPage::getImplementationId() throw(uno::RuntimeException) +{ + return theSdDrawPageImplementationId::get().getSeq(); } OUString SdDrawPage::getPageApiName( SdPage* pPage ) @@ -2781,19 +2776,14 @@ Sequence< uno::Type > SAL_CALL SdMasterPage::getTypes() throw(uno::RuntimeExcept return maTypeSequence; } -Sequence< sal_Int8 > SAL_CALL SdMasterPage::getImplementationId() throw(uno::RuntimeException) +namespace { - ::SolarMutexGuard aGuard; - - throwIfDisposed(); + class theSdMasterPageImplementationId : public rtl::Static< UnoTunnelIdInit, theSdMasterPageImplementationId > {}; +} - static Sequence< sal_Int8 > aId; - if( aId.getLength() == 0 ) - { - aId.realloc( 16 ); - rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True ); - } - return aId; +Sequence< sal_Int8 > SAL_CALL SdMasterPage::getImplementationId() throw(uno::RuntimeException) +{ + return theSdMasterPageImplementationId::get().getSeq(); } // XServiceInfo diff --git a/sd/source/ui/unoidl/unopback.cxx b/sd/source/ui/unoidl/unopback.cxx index 190a83a995b1..24472bee52fb 100644 --- a/sd/source/ui/unoidl/unopback.cxx +++ b/sd/source/ui/unoidl/unopback.cxx @@ -34,7 +34,6 @@ #include <svl/itemset.hxx> #include <svx/svdpool.hxx> #include <comphelper/extract.hxx> -#include <rtl/uuid.h> #include <rtl/memory.h> #include <svx/xflbstit.hxx> #include <svx/xflbmtit.hxx> diff --git a/sd/source/ui/unoidl/unosrch.cxx b/sd/source/ui/unoidl/unosrch.cxx index cb895b16b1f7..d43fec1e982b 100644 --- a/sd/source/ui/unoidl/unosrch.cxx +++ b/sd/source/ui/unoidl/unosrch.cxx @@ -37,7 +37,6 @@ #include <editeng/unotext.hxx> #include <comphelper/extract.hxx> -#include <rtl/uuid.h> #include <rtl/memory.h> #include "unohelp.hxx" diff --git a/sd/source/ui/view/ViewTabBar.cxx b/sd/source/ui/view/ViewTabBar.cxx index 49d3a6bd4baf..588fd65604a7 100644 --- a/sd/source/ui/view/ViewTabBar.cxx +++ b/sd/source/ui/view/ViewTabBar.cxx @@ -55,6 +55,7 @@ #include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/lang/DisposedException.hpp> #include <comphelper/processfactory.hxx> +#include <comphelper/servicehelper.hxx> #include <tools/diagnose_ex.h> using namespace ::com::sun::star; @@ -389,24 +390,15 @@ sal_Bool SAL_CALL ViewTabBar::isAnchorOnly (void) //----- XUnoTunnel ------------------------------------------------------------ -const Sequence<sal_Int8>& ViewTabBar::getUnoTunnelId (void) +namespace { - static Sequence<sal_Int8>* pSequence = NULL; - if (pSequence == NULL) - { - const SolarMutexGuard aSolarGuard; - if (pSequence == NULL) - { - static ::com::sun::star::uno::Sequence<sal_Int8> aSequence (16); - rtl_createUuid((sal_uInt8*)aSequence.getArray(), 0, sal_True); - pSequence = &aSequence; - } - } - return *pSequence; + class theViewTabBarUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theViewTabBarUnoTunnelId > {}; } - - +const Sequence<sal_Int8>& ViewTabBar::getUnoTunnelId (void) +{ + return theViewTabBarUnoTunnelId::get().getSeq(); +} sal_Int64 SAL_CALL ViewTabBar::getSomething (const Sequence<sal_Int8>& rId) throw (RuntimeException) |