summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-06-01 11:46:40 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-06-01 15:21:18 +0100
commit054c7e4a4c0f20eeedee9b69d3012592cbd1bf30 (patch)
treee3b7864f5f2b0bb2a121935d66e36fed3d8b0c69 /framework
parent8d1aeb01ea025f6644401c3a9e01cb36a8ae367c (diff)
use tunnel pattern here
Diffstat (limited to 'framework')
-rw-r--r--framework/source/fwi/uielement/constitemcontainer.cxx28
-rw-r--r--framework/source/fwi/uielement/itemcontainer.cxx19
-rw-r--r--framework/source/fwi/uielement/rootitemcontainer.cxx27
3 files changed, 21 insertions, 53 deletions
diff --git a/framework/source/fwi/uielement/constitemcontainer.cxx b/framework/source/fwi/uielement/constitemcontainer.cxx
index 9d834ca119e5..285a7fe8f3f8 100644
--- a/framework/source/fwi/uielement/constitemcontainer.cxx
+++ b/framework/source/fwi/uielement/constitemcontainer.cxx
@@ -28,23 +28,15 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_framework.hxx"
-//_________________________________________________________________________________________________________________
-// my own includes
-//_________________________________________________________________________________________________________________
#include <uielement/constitemcontainer.hxx>
#include <uielement/rootitemcontainer.hxx>
#include <uielement/itemcontainer.hxx>
#include <threadhelp/resetableguard.hxx>
-//_________________________________________________________________________________________________________________
-// interface includes
-//_________________________________________________________________________________________________________________
#include <com/sun/star/beans/PropertyAttribute.hpp>
-//_________________________________________________________________________________________________________________
-// other includes
-//_________________________________________________________________________________________________________________
#include <cppuhelper/implbase1.hxx>
+#include <comphelper/servicehelper.hxx>
using namespace cppu;
using namespace com::sun::star::uno;
@@ -299,20 +291,14 @@ sal_Int64 ConstItemContainer::getSomething( const ::com::sun::star::uno::Sequenc
return 0;
}
+namespace
+{
+ class theConstItemContainerUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theConstItemContainerUnoTunnelId > {};
+}
+
const Sequence< sal_Int8 >& ConstItemContainer::GetUnoTunnelId() throw()
{
- static ::com::sun::star::uno::Sequence< sal_Int8 > * pSeq = NULL;
- 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 theConstItemContainerUnoTunnelId::get().getSeq();
}
ConstItemContainer* ConstItemContainer::GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw()
diff --git a/framework/source/fwi/uielement/itemcontainer.cxx b/framework/source/fwi/uielement/itemcontainer.cxx
index dca5d23da86d..42dc8c2ea507 100644
--- a/framework/source/fwi/uielement/itemcontainer.cxx
+++ b/framework/source/fwi/uielement/itemcontainer.cxx
@@ -34,6 +34,7 @@
#include <uielement/itemcontainer.hxx>
#include <uielement/constitemcontainer.hxx>
#include <threadhelp/resetableguard.hxx>
+#include <comphelper/servicehelper.hxx>
//_________________________________________________________________________________________________________________
// other includes
@@ -159,20 +160,14 @@ sal_Int64 ItemContainer::getSomething( const ::com::sun::star::uno::Sequence< sa
return 0;
}
+namespace
+{
+ class theItemContainerUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theItemContainerUnoTunnelId > {};
+}
+
const Sequence< sal_Int8 >& ItemContainer::GetUnoTunnelId() throw()
{
- static ::com::sun::star::uno::Sequence< sal_Int8 > * pSeq = NULL;
- 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 theItemContainerUnoTunnelId::get().getSeq();
}
ItemContainer* ItemContainer::GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw()
diff --git a/framework/source/fwi/uielement/rootitemcontainer.cxx b/framework/source/fwi/uielement/rootitemcontainer.cxx
index 7f44c8c947d5..b00a61805799 100644
--- a/framework/source/fwi/uielement/rootitemcontainer.cxx
+++ b/framework/source/fwi/uielement/rootitemcontainer.cxx
@@ -28,21 +28,14 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_framework.hxx"
-//_________________________________________________________________________________________________________________
-// my own includes
-//_________________________________________________________________________________________________________________
+#include <comphelper/servicehelper.hxx>
#include <uielement/rootitemcontainer.hxx>
-
#include <uielement/itemcontainer.hxx>
-
#include <uielement/constitemcontainer.hxx>
#include <threadhelp/resetableguard.hxx>
#include <general.h>
#include <properties.h>
-//_________________________________________________________________________________________________________________
-// interface includes
-//_________________________________________________________________________________________________________________
#include <com/sun/star/beans/PropertyAttribute.hpp>
//_________________________________________________________________________________________________________________
@@ -222,20 +215,14 @@ sal_Int64 RootItemContainer::getSomething( const ::com::sun::star::uno::Sequence
return 0;
}
+namespace
+{
+ class theRootItemContainerUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theRootItemContainerUnoTunnelId > {};
+}
+
const Sequence< sal_Int8 >& RootItemContainer::GetUnoTunnelId() throw()
{
- static ::com::sun::star::uno::Sequence< sal_Int8 > * pSeq = NULL;
- 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 theRootItemContainerUnoTunnelId::get().getSeq();
}
RootItemContainer* RootItemContainer::GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw()