summaryrefslogtreecommitdiff
path: root/svtools/source/misc
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 /svtools/source/misc
parentd3050b7e9ff741dec96f374a71f33774f32274b1 (diff)
use tunnel pattern here
Diffstat (limited to 'svtools/source/misc')
-rw-r--r--svtools/source/misc/chartprettypainter.cxx23
-rw-r--r--svtools/source/misc/transfer.cxx21
2 files changed, 13 insertions, 31 deletions
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();
}
// ---------------------------------