[Libreoffice-commits] .: 3 commits - editeng/source svx/source

Caolán McNamara caolan at kemper.freedesktop.org
Tue Jun 7 03:34:06 PDT 2011


 editeng/source/accessibility/AccessibleContextBase.cxx  |   21 +---
 editeng/source/uno/unofield.cxx                         |   17 +--
 editeng/source/uno/unonrule.cxx                         |    2 
 editeng/source/uno/unopracc.cxx                         |   14 +-
 editeng/source/uno/unotext.cxx                          |   78 ++++++----------
 editeng/source/uno/unotext2.cxx                         |   32 ++----
 svx/source/accessibility/AccessibleShape.cxx            |   26 +----
 svx/source/accessibility/GraphCtlAccessibleContext.cxx  |    1 
 svx/source/accessibility/svxrectctaccessiblecontext.cxx |    1 
 svx/source/fmcomp/fmgridif.cxx                          |   22 +---
 svx/source/fmcomp/gridcell.cxx                          |   20 +---
 svx/source/inc/charmapacc.hxx                           |    1 
 svx/source/svdraw/svdmodel.cxx                          |   20 +---
 svx/source/svdraw/svdpage.cxx                           |   11 --
 svx/source/unodraw/unomod.cxx                           |   14 +-
 svx/source/unodraw/unopage.cxx                          |    1 
 svx/source/unodraw/unopool.cxx                          |   17 +--
 svx/source/unodraw/unoshap2.cxx                         |   55 +++++------
 svx/source/unodraw/unoshap3.cxx                         |   15 +--
 svx/source/unodraw/unoshape.cxx                         |   26 +----
 svx/source/unogallery/unogalitem.cxx                    |   18 +--
 svx/source/unogallery/unogaltheme.cxx                   |   18 +--
 svx/source/unogallery/unogalthemeprovider.cxx           |   18 +--
 23 files changed, 168 insertions(+), 280 deletions(-)

New commits:
commit 9ffbafe01c66ef4c6336b744a5a3a15b0c227f0c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jun 7 09:26:44 2011 +0100

    WaE: pPrinter unused, so don't fetch it

diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx
index b9908af..920f42d 100644
--- a/svx/source/svdraw/svdpage.cxx
+++ b/svx/source/svdraw/svdpage.cxx
@@ -686,17 +686,6 @@ void SdrObjList::NbcReformatAllTextObjects()
     sal_uIntPtr nAnz=GetObjCount();
     sal_uIntPtr nNum=0;
 
-    Printer* pPrinter = NULL;
-
-    if (pModel)
-    {
-        if (pModel->GetRefDevice() && pModel->GetRefDevice()->GetOutDevType() == OUTDEV_PRINTER)
-        {
-            // Kein RefDevice oder RefDevice kein Printer
-            pPrinter = (Printer*) pModel->GetRefDevice();
-        }
-    }
-
     while (nNum<nAnz)
     {
         SdrObject* pObj = GetObj(nNum);
commit c89302d660ee1f0c7affed047b02db608e2bbf1c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Jun 5 16:18:15 2011 +0100

    use standard pattern for this

diff --git a/svx/source/accessibility/AccessibleShape.cxx b/svx/source/accessibility/AccessibleShape.cxx
index 230705a..73372c7 100644
--- a/svx/source/accessibility/AccessibleShape.cxx
+++ b/svx/source/accessibility/AccessibleShape.cxx
@@ -32,7 +32,6 @@
 #include "svx/DescriptionGenerator.hxx"
 #include <svx/AccessibleShapeInfo.hxx>
 #include <com/sun/star/view/XSelectionSupplier.hpp>
-#include <rtl/uuid.h>
 #include <com/sun/star/accessibility/AccessibleRole.hpp>
 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
@@ -59,6 +58,7 @@
 #include <vcl/svapp.hxx>
 #include <unotools/accessiblestatesethelper.hxx>
 #include <svx/svdview.hxx>
+#include <comphelper/servicehelper.hxx>
 #include "AccessibleEmptyEditSource.hxx"
 
 using namespace ::com::sun::star;
@@ -907,30 +907,18 @@ void SAL_CALL
     }
 }
 
-
-
-
 //=====  lang::XUnoTunnel  ================================================
 
+namespace
+{
+    class theAccessibleShapeImplementationId : public rtl::Static< UnoTunnelIdInit, theAccessibleShapeImplementationId > {};
+}
+
 const uno::Sequence< sal_Int8 >&
     AccessibleShape::getUnoTunnelImplementationId()
     throw()
 {
-    static uno::Sequence< sal_Int8 >* pSeq = 0;
-
-    if( !pSeq )
-    {
-        ::osl::MutexGuard 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 theAccessibleShapeImplementationId::get().getSeq();
 }
 
 //------------------------------------------------------------------------------
diff --git a/svx/source/accessibility/GraphCtlAccessibleContext.cxx b/svx/source/accessibility/GraphCtlAccessibleContext.cxx
index 5e76aa8..8dd6d3a 100644
--- a/svx/source/accessibility/GraphCtlAccessibleContext.cxx
+++ b/svx/source/accessibility/GraphCtlAccessibleContext.cxx
@@ -39,7 +39,6 @@
 #include <toolkit/helper/vclunohelper.hxx>
 #include <vcl/svapp.hxx>
 #include <osl/mutex.hxx>
-#include <rtl/uuid.h>
 #include <tools/debug.hxx>
 #include <tools/gen.hxx>
 #include <svl/smplhint.hxx>
diff --git a/svx/source/accessibility/svxrectctaccessiblecontext.cxx b/svx/source/accessibility/svxrectctaccessiblecontext.cxx
index 781280f..34cccc7 100644
--- a/svx/source/accessibility/svxrectctaccessiblecontext.cxx
+++ b/svx/source/accessibility/svxrectctaccessiblecontext.cxx
@@ -42,7 +42,6 @@
 #include <toolkit/helper/convert.hxx>
 #include <vcl/svapp.hxx>
 #include <osl/mutex.hxx>
-#include <rtl/uuid.h>
 #include <tools/debug.hxx>
 #include <tools/gen.hxx>
 
diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx
index 3080d77..5d73f4a 100644
--- a/svx/source/fmcomp/fmgridif.cxx
+++ b/svx/source/fmcomp/fmgridif.cxx
@@ -61,6 +61,7 @@
 #include <comphelper/processfactory.hxx>
 #include <comphelper/property.hxx>
 #include <comphelper/sequence.hxx>
+#include <comphelper/servicehelper.hxx>
 #include <comphelper/types.hxx>
 #include <cppuhelper/typeprovider.hxx>
 #include <toolkit/helper/vclunohelper.hxx>
@@ -1182,21 +1183,14 @@ FmXGridPeer::~FmXGridPeer()
     delete m_pGridListener;
 }
 
-//------------------------------------------------------------------------------
-const Sequence< sal_Int8 >&	FmXGridPeer::getUnoTunnelImplementationId() throw()
+namespace
 {
-    static Sequence< sal_Int8 > * pSeq = 0;
-    if( !pSeq )
-    {
-        ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
-        if( !pSeq )
-        {
-            static Sequence< sal_Int8 > aSeq( 16 );
-            rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
-            pSeq = &aSeq;
-        }
-    }
-    return *pSeq;
+    class theFmXGridPeerImplementationId : public rtl::Static< UnoTunnelIdInit, theFmXGridPeerImplementationId > {};
+}
+
+const Sequence< sal_Int8 >& FmXGridPeer::getUnoTunnelImplementationId() throw()
+{
+    return theFmXGridPeerImplementationId::get().getSeq();
 }
 
 //------------------------------------------------------------------------------
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index 9dd9245..6022981 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -59,6 +59,7 @@
 #include <comphelper/extract.hxx>
 #include <comphelper/numbers.hxx>
 #include <comphelper/property.hxx>
+#include <comphelper/servicehelper.hxx>
 #include <connectivity/formattedcolumnvalue.hxx>
 #include <cppuhelper/typeprovider.hxx>
 #include <i18npool/lang.h>
@@ -4691,21 +4692,14 @@ sal_Int64 SAL_CALL FmXFilterCell::getSomething( const Sequence< sal_Int8 >& _rId
     return nReturn;
 }
 
-//------------------------------------------------------------------------------
+namespace
+{
+    class theFmXFilterCellUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theFmXFilterCellUnoTunnelId > {};
+}
+
 const Sequence<sal_Int8>& FmXFilterCell::getUnoTunnelId()
 {
-    static Sequence< sal_Int8 > * pSeq = 0;
-    if( !pSeq )
-    {
-        ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
-        if( !pSeq )
-        {
-            static Sequence< sal_Int8 > aSeq( 16 );
-            rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
-            pSeq = &aSeq;
-        }
-    }
-    return *pSeq;
+    return theFmXFilterCellUnoTunnelId::get().getSeq();
 }
 
 //------------------------------------------------------------------------------
diff --git a/svx/source/inc/charmapacc.hxx b/svx/source/inc/charmapacc.hxx
index 9d5b981..81e5255 100644
--- a/svx/source/inc/charmapacc.hxx
+++ b/svx/source/inc/charmapacc.hxx
@@ -30,7 +30,6 @@
 #include <tools/color.hxx>
 #include <tools/string.hxx>
 #include <vcl/image.hxx>
-#include <rtl/uuid.h>
 #include <comphelper/accessibleselectionhelper.hxx>
 #include <com/sun/star/accessibility/XAccessibleTable.hpp>
 
diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx
index 82d124c..30dea42 100644
--- a/svx/source/svdraw/svdmodel.cxx
+++ b/svx/source/svdraw/svdmodel.cxx
@@ -31,7 +31,6 @@
 
 #include <svx/svdmodel.hxx>
 
-#include <rtl/uuid.h>
 #include <com/sun/star/lang/XComponent.hpp>
 #include <osl/endian.h>
 #include <rtl/logfile.hxx>
@@ -83,6 +82,7 @@
 #include "editeng/forbiddencharacterstable.hxx"
 #include <svl/zforlist.hxx>
 #include <comphelper/processfactory.hxx>
+#include <comphelper/servicehelper.hxx>
 
 // #90477#
 #include <tools/tenccvt.hxx>
@@ -2146,20 +2146,14 @@ void SdrModel::SetAllowShapePropertyChangeListener( bool bAllow )
     }
 }
 
+namespace
+{
+    class theSdrModelUnoTunnelImplementationId : public rtl::Static< UnoTunnelIdInit, theSdrModelUnoTunnelImplementationId > {};
+}
+
 const ::com::sun::star::uno::Sequence< sal_Int8 >& SdrModel::getUnoTunnelImplementationId()
 {
-    static ::com::sun::star::uno::Sequence< sal_Int8 > * pSeq = 0;
-    if( !pSeq )
-    {
-        ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
-        if( !pSeq )
-        {
-            static Sequence< sal_Int8 > aSeq( 16 );
-            rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
-            pSeq = &aSeq;
-        }
-    }
-    return *pSeq;
+    return theSdrModelUnoTunnelImplementationId::get().getSeq();
 }
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/svx/source/unodraw/unomod.cxx b/svx/source/unodraw/unomod.cxx
index 7945934..2998909 100644
--- a/svx/source/unodraw/unomod.cxx
+++ b/svx/source/unodraw/unomod.cxx
@@ -38,6 +38,7 @@
 #include <svl/itemprop.hxx>
 #include <svtools/unoevent.hxx>
 #include <comphelper/sequence.hxx>
+#include <comphelper/servicehelper.hxx>
 #include <comphelper/serviceinfohelper.hxx>
 
 #include <cppuhelper/implbase2.hxx>
@@ -302,15 +303,14 @@ uno::Sequence< uno::Type > SAL_CALL SvxUnoDrawingModel::getTypes(  ) throw(uno::
     return maTypeSequence;
 }
 
+namespace
+{
+    class theSvxUnoDrawingModelImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxUnoDrawingModelImplementationId > {};
+}
+
 uno::Sequence< sal_Int8 > SAL_CALL SvxUnoDrawingModel::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 theSvxUnoDrawingModelImplementationId::get().getSeq();
 }
 
 void SAL_CALL SvxUnoDrawingModel::lockControllers(  )
diff --git a/svx/source/unodraw/unopage.cxx b/svx/source/unodraw/unopage.cxx
index efe7836..26d559c 100644
--- a/svx/source/unodraw/unopage.cxx
+++ b/svx/source/unodraw/unopage.cxx
@@ -38,7 +38,6 @@
 #include <sot/clsids.hxx>
 #include <comphelper/serviceinfohelper.hxx>
 
-#include <rtl/uuid.h>
 #include <rtl/memory.h>
 #include <sfx2/objsh.hxx>
 #include <svx/svdpool.hxx>
diff --git a/svx/source/unodraw/unopool.cxx b/svx/source/unodraw/unopool.cxx
index da4a6ba..bcfe630 100644
--- a/svx/source/unodraw/unopool.cxx
+++ b/svx/source/unodraw/unopool.cxx
@@ -32,7 +32,7 @@
 #include <com/sun/star/beans/PropertyState.hpp>
 
 #include <comphelper/propertysetinfo.hxx>
-#include <rtl/uuid.h>
+#include <comphelper/servicehelper.hxx>
 #include <osl/mutex.hxx>
 #include <vcl/svapp.hxx>
 #include "svx/unopool.hxx"
@@ -387,18 +387,15 @@ uno::Sequence< uno::Type > SAL_CALL SvxUnoDrawPool::getTypes()
     return aTypes;
 }
 
+namespace
+{
+    class theSvxUnoDrawPoolImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxUnoDrawPoolImplementationId > {};
+}
+
 uno::Sequence< sal_Int8 > SAL_CALL SvxUnoDrawPool::getImplementationId()
     throw (uno::RuntimeException)
 {
-    SolarMutexGuard aGuard;
-
-    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 theSvxUnoDrawPoolImplementationId::get().getSeq();
 }
 
 // XServiceInfo
diff --git a/svx/source/unodraw/unoshap2.cxx b/svx/source/unodraw/unoshap2.cxx
index 6774d2f..f838a95 100644
--- a/svx/source/unodraw/unoshap2.cxx
+++ b/svx/source/unodraw/unoshap2.cxx
@@ -49,7 +49,6 @@
 
 #include <boost/scoped_ptr.hpp>
 #include <svx/svdpool.hxx>
-#include <rtl/uuid.h>
 #include <rtl/memory.h>
 #include <tools/urlobj.hxx>
 
@@ -73,6 +72,8 @@
 #include <basegfx/point/b2dpoint.hxx>
 #include <basegfx/polygon/b2dpolygontools.hxx>
 
+#include <comphelper/servicehelper.hxx>
+
 using ::rtl::OUString;
 using namespace ::osl;
 using namespace ::cppu;
@@ -152,16 +153,15 @@ uno::Sequence< uno::Type > SAL_CALL SvxShapeGroup::getTypes()
     return SvxShape::getTypes();
 }
 
+namespace
+{
+    class theSvxShapeGroupImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxShapeGroupImplementationId > {};
+}
+
 uno::Sequence< sal_Int8 > SAL_CALL SvxShapeGroup::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 theSvxShapeGroupImplementationId::get().getSeq();
 }
 
 // ::com::sun::star::drawing::XShape
@@ -426,16 +426,15 @@ uno::Sequence< uno::Type > SAL_CALL SvxShapeConnector::getTypes()
     return SvxShape::getTypes();
 }
 
+namespace
+{
+    class theSvxShapeConnectorImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxShapeConnectorImplementationId > {};
+}
+
 uno::Sequence< sal_Int8 > SAL_CALL SvxShapeConnector::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 theSvxShapeConnectorImplementationId::get().getSeq();
 }
 
 // ::com::sun::star::drawing::XShape
@@ -594,16 +593,15 @@ uno::Sequence< uno::Type > SAL_CALL SvxShapeControl::getTypes()
     return SvxShape::getTypes();
 }
 
+namespace
+{
+    class theSvxShapeControlImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxShapeControlImplementationId > {};
+}
+
 uno::Sequence< sal_Int8 > SAL_CALL SvxShapeControl::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 theSvxShapeControlImplementationId::get().getSeq();
 }
 
 // ::com::sun::star::drawing::XShape
@@ -1939,16 +1937,15 @@ uno::Sequence< uno::Type > SAL_CALL SvxCustomShape::getTypes()
     return SvxShapeText::getTypes();
 }
 
+namespace
+{
+    class theSvxCustomShapeImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxCustomShapeImplementationId > {};
+}
+
 uno::Sequence< sal_Int8 > SAL_CALL SvxCustomShape::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 theSvxCustomShapeImplementationId::get().getSeq();
 }
 
 // ::com::sun::star::drawing::XShape
diff --git a/svx/source/unodraw/unoshap3.cxx b/svx/source/unodraw/unoshap3.cxx
index d9d3007..21a7f7f 100644
--- a/svx/source/unodraw/unoshap3.cxx
+++ b/svx/source/unodraw/unoshap3.cxx
@@ -37,9 +37,9 @@
 #include <com/sun/star/drawing/CameraGeometry.hpp>
 #include <vcl/svapp.hxx>
 #include <osl/mutex.hxx>
+#include <comphelper/servicehelper.hxx>
 #include <comphelper/serviceinfohelper.hxx>
 
-#include <rtl/uuid.h>
 #include <rtl/memory.h>
 #include <svx/svdpool.hxx>
 #include <svx/unoshape.hxx>
@@ -135,16 +135,15 @@ uno::Sequence< uno::Type > SAL_CALL Svx3DSceneObject::getTypes()
     return SvxShape::getTypes();
 }
 
+namespace
+{
+    class theSvx3DSceneObjectImplementationId : public rtl::Static< UnoTunnelIdInit, theSvx3DSceneObjectImplementationId > {};
+}
+
 uno::Sequence< sal_Int8 > SAL_CALL Svx3DSceneObject::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 theSvx3DSceneObjectImplementationId::get().getSeq();
 }
 
 //----------------------------------------------------------------------
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index 7a24224..8f2984f 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -43,12 +43,12 @@
 #include <svx/svdobj.hxx>
 #include <svx/svdoole2.hxx>
 #include <osl/mutex.hxx>
-#include <comphelper/extract.hxx>
 #include "svx/shapepropertynotifier.hxx"
+#include <comphelper/extract.hxx>
+#include <comphelper/scopeguard.hxx>
+#include <comphelper/servicehelper.hxx>
 #include <comphelper/serviceinfohelper.hxx>
 #include <toolkit/unohlp.hxx>
-#include <comphelper/serviceinfohelper.hxx>
-#include <rtl/uuid.h>
 #include <rtl/memory.h>
 #include <vcl/gfxlink.hxx>
 #include <vcl/virdev.hxx>
@@ -106,7 +106,6 @@
 #include "svx/extrud3d.hxx"
 #include "unopolyhelper.hxx"
 
-#include <comphelper/scopeguard.hxx>
 #include <boost/bind.hpp>
 
 using ::rtl::OUString;
@@ -341,21 +340,14 @@ uno::Any SAL_CALL SvxShape::queryAggregation( const uno::Type& rType ) throw (un
     return SvxShape_UnoImplHelper::queryAggregation(rType);
 }
 
-//----------------------------------------------------------------------
+namespace
+{
+    class theSvxShapeUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSvxShapeUnoTunnelId > {};
+}
+
 const ::com::sun::star::uno::Sequence< sal_Int8 > & SvxShape::getUnoTunnelId() throw()
 {
-    static ::com::sun::star::uno::Sequence< sal_Int8 > * pSeq = 0;
-    if( !pSeq )
-    {
-        ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() );
-        if( !pSeq )
-        {
-            static ::com::sun::star::uno::Sequence< sal_Int8 > aSeq( 16 );
-            rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
-            pSeq = &aSeq;
-        }
-    }
-    return *pSeq;
+    return theSvxShapeUnoTunnelId::get().getSeq();
 }
 
 //----------------------------------------------------------------------
diff --git a/svx/source/unogallery/unogalitem.cxx b/svx/source/unogallery/unogalitem.cxx
index ad78ee4..8214361 100644
--- a/svx/source/unogallery/unogalitem.cxx
+++ b/svx/source/unogallery/unogalitem.cxx
@@ -34,12 +34,12 @@
 #include "svx/galtheme.hxx"	
 #include "svx/galmisc.hxx"	
 #include <svx/fmmodel.hxx>
-#include <rtl/uuid.h>
 #include <osl/mutex.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/graph.hxx>
 #include <svl/itemprop.hxx>
 #include <svl/itempool.hxx>
+#include <comphelper/servicehelper.hxx>
 #include "galobj.hxx"
 
 #include <com/sun/star/beans/PropertyState.hpp>
@@ -203,21 +203,15 @@ uno::Sequence< uno::Type > SAL_CALL GalleryItem::getTypes()
     return aTypes;
 }
 
-// ------------------------------------------------------------------------------
+namespace
+{
+    class theGalleryItemImplementationId : public rtl::Static< UnoTunnelIdInit, theGalleryItemImplementationId > {};
+}
 
 uno::Sequence< sal_Int8 > SAL_CALL GalleryItem::getImplementationId() 
     throw(uno::RuntimeException)
 {
-    const SolarMutexGuard aGuard;
-    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 theGalleryItemImplementationId::get().getSeq();
 }
 
 // ------------------------------------------------------------------------------
diff --git a/svx/source/unogallery/unogaltheme.cxx b/svx/source/unogallery/unogaltheme.cxx
index a1ec703..8ca6acd 100644
--- a/svx/source/unogallery/unogaltheme.cxx
+++ b/svx/source/unogallery/unogaltheme.cxx
@@ -40,10 +40,10 @@
 #include <svx/svdpage.hxx>
 #include <svx/unopage.hxx>
 #include <svl/itempool.hxx>
-#include <rtl/uuid.h>
 #include <osl/mutex.hxx>
 #include <vcl/svapp.hxx>
 #include <unotools/pathoptions.hxx>
+#include <comphelper/servicehelper.hxx>
 
 using namespace ::com::sun::star;
 
@@ -149,21 +149,15 @@ uno::Sequence< uno::Type > SAL_CALL GalleryTheme::getTypes()
     return aTypes;
 }
 
-// ------------------------------------------------------------------------------
+namespace
+{
+    class theGalleryThemeImplementationId : public rtl::Static< UnoTunnelIdInit, theGalleryThemeImplementationId > {};
+}
 
 uno::Sequence< sal_Int8 > SAL_CALL GalleryTheme::getImplementationId()
     throw(uno::RuntimeException)
 {
-    const SolarMutexGuard aGuard;
-    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 theGalleryThemeImplementationId::get().getSeq();
 }
 
 // ------------------------------------------------------------------------------
diff --git a/svx/source/unogallery/unogalthemeprovider.cxx b/svx/source/unogallery/unogalthemeprovider.cxx
index ac50cb3..ec9d4d7 100644
--- a/svx/source/unogallery/unogalthemeprovider.cxx
+++ b/svx/source/unogallery/unogalthemeprovider.cxx
@@ -32,10 +32,10 @@
 #include "unogalthemeprovider.hxx"
 #include "unogaltheme.hxx"
 #include "svx/gallery1.hxx"
-#include <rtl/uuid.h>
 #include <osl/mutex.hxx>
 #include <vcl/svapp.hxx>
 #include <unotools/pathoptions.hxx>
+#include <comphelper/servicehelper.hxx>
 #include <com/sun/star/gallery/XGalleryTheme.hpp>
 #include <com/sun/star/beans/PropertyValue.hpp>
 
@@ -155,21 +155,15 @@ uno::Sequence< uno::Type > SAL_CALL GalleryThemeProvider::getTypes()
     return aTypes;
 }
 
-// ------------------------------------------------------------------------------
+namespace
+{
+    class theGalleryThemeProviderImplementationId : public rtl::Static< UnoTunnelIdInit, theGalleryThemeProviderImplementationId > {};
+}
 
 uno::Sequence< sal_Int8 > SAL_CALL GalleryThemeProvider::getImplementationId()
     throw(uno::RuntimeException)
 {
-    const SolarMutexGuard aGuard;
-    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 theGalleryThemeProviderImplementationId::get().getSeq();
 }
 
 // ------------------------------------------------------------------------------
commit 362c73e5b78676fed4ca43a9ffaa738707c75412
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jun 3 21:38:37 2011 +0100

    use the standard template for this

diff --git a/editeng/source/accessibility/AccessibleContextBase.cxx b/editeng/source/accessibility/AccessibleContextBase.cxx
index 37650fb..0c6e470 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 85e4ff9..6fd51ed 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 6513fab..d78f71f 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 759c8c6..1762620 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 0291681..9b1f2ae 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 f715c8e..7c2d598 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


More information about the Libreoffice-commits mailing list