summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-06-01 10:02:08 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-06-01 15:21:54 +0100
commitd248451ca3e7599145103be6c79c2b78699f12c9 (patch)
treedf3ee19a784c41344297c569d56dd851d1652de0
parentd3050b7e9ff741dec96f374a71f33774f32274b1 (diff)
use tunnel pattern here
-rw-r--r--svtools/source/control/valueacc.cxx37
-rw-r--r--svtools/source/control/valueimp.hxx1
-rw-r--r--svtools/source/graphic/descriptor.cxx18
-rw-r--r--svtools/source/graphic/graphic.cxx18
-rw-r--r--svtools/source/graphic/provider.cxx18
-rw-r--r--svtools/source/graphic/renderer.cxx18
-rw-r--r--svtools/source/graphic/transformer.cxx1
-rw-r--r--svtools/source/misc/chartprettypainter.cxx23
-rw-r--r--svtools/source/misc/transfer.cxx21
-rw-r--r--svtools/source/uno/unoimap.cxx16
10 files changed, 55 insertions, 116 deletions
diff --git a/svtools/source/control/valueacc.cxx b/svtools/source/control/valueacc.cxx
index e558a72ae33a..69e90935dbad 100644
--- a/svtools/source/control/valueacc.cxx
+++ b/svtools/source/control/valueacc.cxx
@@ -35,6 +35,7 @@
#include <vcl/svapp.hxx>
#include <svtools/valueset.hxx>
#include "valueimp.hxx"
+#include <comphelper/servicehelper.hxx>
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
#include <com/sun/star/accessibility/AccessibleRole.hpp>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
@@ -133,22 +134,14 @@ void ValueSetAcc::FireAccessibleEvent( short nEventId, const uno::Any& rOldValue
}
}
-// -----------------------------------------------------------------------------
+namespace
+{
+ class theValueSetAccUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theValueSetAccUnoTunnelId > {};
+}
const uno::Sequence< sal_Int8 >& ValueSetAcc::getUnoTunnelId()
{
- static uno::Sequence< sal_Int8 > aSeq;
-
- if( !aSeq.getLength() )
- {
- static osl::Mutex aCreateMutex;
- osl::Guard< osl::Mutex > aGuard( aCreateMutex );
-
- aSeq.realloc( 16 );
- rtl_createUuid( reinterpret_cast< sal_uInt8* >( aSeq.getArray() ), 0, sal_True );
- }
-
- return aSeq;
+ return theValueSetAccUnoTunnelId::get().getSeq();
}
// -----------------------------------------------------------------------------
@@ -851,22 +844,14 @@ void ValueItemAcc::ParentDestroyed()
mpParent = NULL;
}
-// -----------------------------------------------------------------------------
+namespace
+{
+ class theValueItemAccUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theValueItemAccUnoTunnelId > {};
+}
const uno::Sequence< sal_Int8 >& ValueItemAcc::getUnoTunnelId()
{
- static uno::Sequence< sal_Int8 > aSeq;
-
- if( !aSeq.getLength() )
- {
- static osl::Mutex aCreateMutex;
- osl::Guard< osl::Mutex > aGuard( aCreateMutex );
-
- aSeq.realloc( 16 );
- rtl_createUuid( reinterpret_cast< sal_uInt8* >( aSeq.getArray() ), 0, sal_True );
- }
-
- return aSeq;
+ return theValueItemAccUnoTunnelId::get().getSeq();
}
// -----------------------------------------------------------------------------
diff --git a/svtools/source/control/valueimp.hxx b/svtools/source/control/valueimp.hxx
index a077e42f2905..57bb5fae0650 100644
--- a/svtools/source/control/valueimp.hxx
+++ b/svtools/source/control/valueimp.hxx
@@ -30,7 +30,6 @@
#include <tools/color.hxx>
#include <tools/string.hxx>
#include <vcl/image.hxx>
-#include <rtl/uuid.h>
#include <cppuhelper/implbase5.hxx>
#include <cppuhelper/compbase6.hxx>
#include <comphelper/broadcasthelper.hxx>
diff --git a/svtools/source/graphic/descriptor.cxx b/svtools/source/graphic/descriptor.cxx
index 623c698bcae8..d76b50b54a01 100644
--- a/svtools/source/graphic/descriptor.cxx
+++ b/svtools/source/graphic/descriptor.cxx
@@ -31,11 +31,11 @@
#include "descriptor.hxx"
-#include <rtl/uuid.h>
#include <osl/mutex.hxx>
#include <unotools/ucbstreamhelper.hxx>
#include <svtools/filter.hxx>
#include <svl/itemprop.hxx>
+#include <comphelper/servicehelper.hxx>
#include <com/sun/star/beans/PropertyState.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
@@ -305,21 +305,15 @@ uno::Sequence< uno::Type > SAL_CALL GraphicDescriptor::getTypes()
return aTypes;
}
-// ------------------------------------------------------------------------------
+namespace
+{
+ class theGraphicDescriptorUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theGraphicDescriptorUnoTunnelId > {};
+}
uno::Sequence< sal_Int8 > SAL_CALL GraphicDescriptor::getImplementationId()
throw( uno::RuntimeException )
{
- 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 theGraphicDescriptorUnoTunnelId::get().getSeq();
}
// ------------------------------------------------------------------------------
diff --git a/svtools/source/graphic/graphic.cxx b/svtools/source/graphic/graphic.cxx
index 19c8d904b3d9..cf212d9d8fce 100644
--- a/svtools/source/graphic/graphic.cxx
+++ b/svtools/source/graphic/graphic.cxx
@@ -29,13 +29,13 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svtools.hxx"
-#include <rtl/uuid.h>
#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
#include <com/sun/star/graphic/GraphicType.hpp>
#include <com/sun/star/graphic/XGraphicTransformer.hpp>
#include <vcl/graph.hxx>
#include "graphic.hxx"
+#include <comphelper/servicehelper.hxx>
using namespace com::sun::star;
@@ -114,19 +114,15 @@ void SAL_CALL Graphic::release() throw()
// ------------------------------------------------------------------------------
+namespace
+{
+ class theGraphicUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theGraphicUnoTunnelId > {};
+}
+
uno::Sequence< sal_Int8 > SAL_CALL Graphic::getImplementationId_Static()
throw(uno::RuntimeException)
{
- 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 theGraphicUnoTunnelId::get().getSeq();
}
// ------------------------------------------------------------------------------
diff --git a/svtools/source/graphic/provider.cxx b/svtools/source/graphic/provider.cxx
index b08c1eab2035..a8785a5381b1 100644
--- a/svtools/source/graphic/provider.cxx
+++ b/svtools/source/graphic/provider.cxx
@@ -29,7 +29,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svtools.hxx"
-#include <rtl/uuid.h>
#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
#include <vcl/image.hxx>
@@ -46,6 +45,7 @@
#include <vcl/virdev.hxx>
#include <com/sun/star/io/XStream.hpp>
#include <com/sun/star/text/GraphicCrop.hpp>
+#include <comphelper/servicehelper.hxx>
#include "descriptor.hxx"
#include "graphic.hxx"
@@ -143,21 +143,15 @@ uno::Sequence< uno::Type > SAL_CALL GraphicProvider::getTypes()
return aTypes;
}
-// ------------------------------------------------------------------------------
+namespace
+{
+ class theGraphicProviderUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theGraphicProviderUnoTunnelId > {};
+}
uno::Sequence< sal_Int8 > SAL_CALL GraphicProvider::getImplementationId()
throw(uno::RuntimeException)
{
- 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 theGraphicProviderUnoTunnelId::get().getSeq();
}
// ------------------------------------------------------------------------------
diff --git a/svtools/source/graphic/renderer.cxx b/svtools/source/graphic/renderer.cxx
index d955fca30cac..ef6385c1298c 100644
--- a/svtools/source/graphic/renderer.cxx
+++ b/svtools/source/graphic/renderer.cxx
@@ -32,13 +32,13 @@
#include <com/sun/star/beans/PropertyState.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/awt/Rectangle.hpp>
-#include <rtl/uuid.h>
#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <comphelper/propertysetinfo.hxx>
#include <svl/itemprop.hxx>
#include <svtools/grfmgr.hxx>
+#include <comphelper/servicehelper.hxx>
#include "graphic.hxx"
#include "renderer.hxx"
@@ -192,21 +192,15 @@ uno::Sequence< uno::Type > SAL_CALL GraphicRendererVCL::getTypes()
return aTypes;
}
-// ------------------------------------------------------------------------------
+namespace
+{
+ class theGraphicRendererVCLUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theGraphicRendererVCLUnoTunnelId > {};
+}
uno::Sequence< sal_Int8 > SAL_CALL GraphicRendererVCL::getImplementationId()
throw( uno::RuntimeException )
{
- 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 theGraphicRendererVCLUnoTunnelId::get().getSeq();
}
// ------------------------------------------------------------------------------
diff --git a/svtools/source/graphic/transformer.cxx b/svtools/source/graphic/transformer.cxx
index 3a0d3c8e2fd4..03c470d2ac69 100644
--- a/svtools/source/graphic/transformer.cxx
+++ b/svtools/source/graphic/transformer.cxx
@@ -29,7 +29,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svtools.hxx"
-#include <rtl/uuid.h>
#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
#include <vcl/image.hxx>
diff --git a/svtools/source/misc/chartprettypainter.cxx b/svtools/source/misc/chartprettypainter.cxx
index ab51d32bd64e..ff461a17ada2 100644
--- a/svtools/source/misc/chartprettypainter.cxx
+++ b/svtools/source/misc/chartprettypainter.cxx
@@ -33,10 +33,8 @@
#include <tools/globname.hxx>
#include <sot/clsids.hxx>
-// header for function rtl_createUuid
-#include <rtl/uuid.h>
#include <vcl/pdfextoutdevdata.hxx>
-
+#include <comphelper/servicehelper.hxx>
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <svtools/embedhlp.hxx>
@@ -56,21 +54,14 @@ bool ChartPrettyPainter::DoPaint(OutputDevice* /*pOutDev*/, const Rectangle& /*r
return false;
}
-//static
+namespace
+{
+ class theChartPrettyPainterUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theChartPrettyPainterUnoTunnelId > {};
+}
+
const uno::Sequence<sal_Int8>& ChartPrettyPainter::getUnoTunnelId()
{
- 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 theChartPrettyPainterUnoTunnelId::get().getSeq();
}
bool ChartPrettyPainter::IsChart( const svt::EmbeddedObjectRef& xObjRef )
diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx
index 215414a2d968..4b24ed4330fd 100644
--- a/svtools/source/misc/transfer.cxx
+++ b/svtools/source/misc/transfer.cxx
@@ -35,7 +35,6 @@
#endif
#include <osl/mutex.hxx>
#include <rtl/memory.h>
-#include <rtl/uuid.h>
#include <rtl/uri.hxx>
#include <tools/debug.hxx>
#include <tools/urlobj.hxx>
@@ -49,6 +48,7 @@
#include <vcl/svapp.hxx>
#include <vcl/window.hxx>
#include <comphelper/processfactory.hxx>
+#include <comphelper/servicehelper.hxx>
#include <sot/filelist.hxx>
#include <cppuhelper/implbase1.hxx>
@@ -1207,23 +1207,14 @@ Reference< XClipboard> TransferableHelper::GetSystemClipboard()
return Reference< XClipboard > ();
}
-// -----------------------------------------------------------------------------
+namespace
+{
+ class theTransferableHelperUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theTransferableHelperUnoTunnelId > {};
+}
const Sequence< sal_Int8 >& TransferableHelper::getUnoTunnelId()
{
- static Sequence< sal_Int8 > aSeq;
-
- if( !aSeq.getLength() )
- {
- static osl::Mutex aCreateMutex;
- osl::Guard< osl::Mutex > aGuard( aCreateMutex );
-
- aSeq.realloc( 16 );
- rtl_createUuid( reinterpret_cast< sal_uInt8* >( aSeq.getArray() ), 0, sal_True );
- }
-
-
- return aSeq;
+ return theTransferableHelperUnoTunnelId::get().getSeq();
}
// ---------------------------------
diff --git a/svtools/source/uno/unoimap.cxx b/svtools/source/uno/unoimap.cxx
index 4c20ca232902..6c8527ffedc7 100644
--- a/svtools/source/uno/unoimap.cxx
+++ b/svtools/source/uno/unoimap.cxx
@@ -43,7 +43,6 @@
#include <cppuhelper/weakagg.hxx>
#include <cppuhelper/implbase3.hxx>
#include <list>
-#include <rtl/uuid.h>
#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
#include <svtools/unoevent.hxx>
@@ -383,18 +382,15 @@ uno::Sequence< uno::Type > SAL_CALL SvUnoImageMapObject::getTypes()
return aTypes;
}
+namespace
+{
+ class theSvUnoImageMapObjectImplementationId : public rtl::Static< UnoTunnelIdInit, theSvUnoImageMapObjectImplementationId > {};
+}
+
uno::Sequence< sal_Int8 > SAL_CALL SvUnoImageMapObject::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 theSvUnoImageMapObjectImplementationId::get().getSeq();
}
// XServiceInfo