diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-06-03 12:32:02 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-06-03 13:42:38 +0100 |
commit | e8ec8ac46394a433e494370769a22b73b383bdc9 (patch) | |
tree | 99f0a9ce1db881c3a07a9b19d5bdfff8bf35fe9d /chart2 | |
parent | 8f4174419d7eba92c2bb46da6d4621029e234023 (diff) |
use standard template for this
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx | 15 | ||||
-rw-r--r-- | chart2/source/inc/ServiceMacros.hxx | 24 | ||||
-rw-r--r-- | chart2/source/tools/OPropertySet.cxx | 16 | ||||
-rw-r--r-- | chart2/source/view/main/ChartView.cxx | 19 |
4 files changed, 22 insertions, 52 deletions
diff --git a/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx b/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx index ded21367da64..f08922bb0bc1 100644 --- a/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx +++ b/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx @@ -44,6 +44,7 @@ #include <vcl/msgbox.hxx> // header for class OImplementationId #include <cppuhelper/typeprovider.hxx> +#include <comphelper/servicehelper.hxx> #include <com/sun/star/awt/Point.hpp> #include <com/sun/star/awt/Size.hpp> #include <com/sun/star/beans/PropertyValue.hpp> @@ -162,15 +163,15 @@ uno::Sequence< uno::Type > CreationWizardUnoDlg::getTypes() throw(uno::RuntimeEx return aTypeList; } + +namespace +{ + class theCreationWizardUnoDlgImplementationId : public rtl::Static< UnoTunnelIdInit, theCreationWizardUnoDlgImplementationId > {}; +} + uno::Sequence< sal_Int8 > SAL_CALL CreationWizardUnoDlg::getImplementationId( void ) 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 theCreationWizardUnoDlgImplementationId::get().getSeq(); } //------------------------------------------------------------------------- diff --git a/chart2/source/inc/ServiceMacros.hxx b/chart2/source/inc/ServiceMacros.hxx index d8e8d4cb60b2..411e22a7ae09 100644 --- a/chart2/source/inc/ServiceMacros.hxx +++ b/chart2/source/inc/ServiceMacros.hxx @@ -119,30 +119,6 @@ static ::com::sun::star::uno::Reference< \ return (::cppu::OWeakObject *)new Class( xContext ); \ } -/** This macro contains the default implementation for getImplementationId(). - Note, that you have to include the header necessary for rtl_createUuid. - Insert the following into your file: - - <code> -#include <rtl/uuid.h> - </code> - - @param Class the Class-Name for which getImplementationId() should be - implemented - */ -#define APPHELPER_GETIMPLEMENTATIONID_IMPL(Class) \ -::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL Class::getImplementationId() \ - throw (::com::sun::star::uno::RuntimeException) \ -{ \ - static ::com::sun::star::uno::Sequence< sal_Int8 > aId; \ - if( aId.getLength() == 0 ) \ - { \ - aId.realloc( 16 ); \ - rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True ); \ - } \ - return aId; \ -} - }//end namespace apphelper #endif diff --git a/chart2/source/tools/OPropertySet.cxx b/chart2/source/tools/OPropertySet.cxx index 801fc608e864..a3db3d0b45e1 100644 --- a/chart2/source/tools/OPropertySet.cxx +++ b/chart2/source/tools/OPropertySet.cxx @@ -31,8 +31,8 @@ #include "OPropertySet.hxx" #include "ImplOPropertySet.hxx" #include "ContainerHelper.hxx" -#include <rtl/uuid.h> #include <cppuhelper/queryinterface.hxx> +#include <comphelper/servicehelper.hxx> #include <vector> #include <algorithm> @@ -133,20 +133,18 @@ Sequence< uno::Type > SAL_CALL return aTypeList; } +namespace +{ + class theOPropertySetImplementationId : public rtl::Static< UnoTunnelIdInit, theOPropertySetImplementationId > {}; +} + Sequence< sal_Int8 > SAL_CALL OPropertySet::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 theOPropertySetImplementationId::get().getSeq(); } - // ____ XPropertyState ____ beans::PropertyState SAL_CALL OPropertySet::getPropertyState( const OUString& PropertyName ) diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index 016001cd76b9..779c57498f90 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -61,6 +61,7 @@ #include "DateHelper.hxx" #include <comphelper/scopeguard.hxx> +#include <comphelper/servicehelper.hxx> #include <boost/bind.hpp> #include <unotools/streamwrap.hxx> // header for class LocaleDataWrapper @@ -119,20 +120,14 @@ using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Any; using rtl::OUString; +namespace +{ + class theExplicitValueProviderUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theExplicitValueProviderUnoTunnelId > {}; +} + const uno::Sequence<sal_Int8>& ExplicitValueProvider::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 theExplicitValueProviderUnoTunnelId::get().getSeq(); } ExplicitValueProvider* ExplicitValueProvider::getExplicitValueProvider( |