[Libreoffice-commits] .: sd/source

Caolán McNamara caolan at kemper.freedesktop.org
Fri Jun 3 01:41:41 PDT 2011


 sd/source/ui/app/sdxfer.cxx               |   19 +++++----------
 sd/source/ui/dlg/sdtreelb.cxx             |   19 +++++----------
 sd/source/ui/framework/factories/Pane.cxx |   23 +++++--------------
 sd/source/ui/unoidl/unomodel.cxx          |   20 ++++++----------
 sd/source/ui/unoidl/unopage.cxx           |   36 ++++++++++--------------------
 sd/source/ui/unoidl/unopback.cxx          |    1 
 sd/source/ui/unoidl/unosrch.cxx           |    1 
 sd/source/ui/view/ViewTabBar.cxx          |   22 +++++-------------
 8 files changed, 47 insertions(+), 94 deletions(-)

New commits:
commit b3423ebc1c38d8853b2b370abbc667eea4a53073
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jun 3 08:49:45 2011 +0100

    use standard template for this here

diff --git a/sd/source/ui/app/sdxfer.cxx b/sd/source/ui/app/sdxfer.cxx
index 5e90762..27f4e6f 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 44086e1..bd6e2fa 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 5cba063..81ad115 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 130f289..3a8d4dc 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 1193081..487401c 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 be98f8e..6342074 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 2b2d4c4..58b8f22 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 820a9ef..661440d 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)


More information about the Libreoffice-commits mailing list