Kaydet (Commit) e8ec8ac4 authored tarafından Caolán McNamara's avatar Caolán McNamara

use standard template for this

üst 8f417441
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#include <vcl/msgbox.hxx> #include <vcl/msgbox.hxx>
// header for class OImplementationId // header for class OImplementationId
#include <cppuhelper/typeprovider.hxx> #include <cppuhelper/typeprovider.hxx>
#include <comphelper/servicehelper.hxx>
#include <com/sun/star/awt/Point.hpp> #include <com/sun/star/awt/Point.hpp>
#include <com/sun/star/awt/Size.hpp> #include <com/sun/star/awt/Size.hpp>
#include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/PropertyValue.hpp>
...@@ -162,15 +163,15 @@ uno::Sequence< uno::Type > CreationWizardUnoDlg::getTypes() throw(uno::RuntimeEx ...@@ -162,15 +163,15 @@ uno::Sequence< uno::Type > CreationWizardUnoDlg::getTypes() throw(uno::RuntimeEx
return aTypeList; return aTypeList;
} }
namespace
{
class theCreationWizardUnoDlgImplementationId : public rtl::Static< UnoTunnelIdInit, theCreationWizardUnoDlgImplementationId > {};
}
uno::Sequence< sal_Int8 > SAL_CALL CreationWizardUnoDlg::getImplementationId( void ) throw( uno::RuntimeException ) uno::Sequence< sal_Int8 > SAL_CALL CreationWizardUnoDlg::getImplementationId( void ) throw( uno::RuntimeException )
{ {
static uno::Sequence< sal_Int8 > aId; return theCreationWizardUnoDlgImplementationId::get().getSeq();
if( aId.getLength() == 0 )
{
aId.realloc( 16 );
rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True );
}
return aId;
} }
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
......
...@@ -119,30 +119,6 @@ static ::com::sun::star::uno::Reference< \ ...@@ -119,30 +119,6 @@ static ::com::sun::star::uno::Reference< \
return (::cppu::OWeakObject *)new Class( xContext ); \ 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 }//end namespace apphelper
#endif #endif
......
...@@ -31,8 +31,8 @@ ...@@ -31,8 +31,8 @@
#include "OPropertySet.hxx" #include "OPropertySet.hxx"
#include "ImplOPropertySet.hxx" #include "ImplOPropertySet.hxx"
#include "ContainerHelper.hxx" #include "ContainerHelper.hxx"
#include <rtl/uuid.h>
#include <cppuhelper/queryinterface.hxx> #include <cppuhelper/queryinterface.hxx>
#include <comphelper/servicehelper.hxx>
#include <vector> #include <vector>
#include <algorithm> #include <algorithm>
...@@ -133,20 +133,18 @@ Sequence< uno::Type > SAL_CALL ...@@ -133,20 +133,18 @@ Sequence< uno::Type > SAL_CALL
return aTypeList; return aTypeList;
} }
namespace
{
class theOPropertySetImplementationId : public rtl::Static< UnoTunnelIdInit, theOPropertySetImplementationId > {};
}
Sequence< sal_Int8 > SAL_CALL Sequence< sal_Int8 > SAL_CALL
OPropertySet::getImplementationId() OPropertySet::getImplementationId()
throw (uno::RuntimeException) throw (uno::RuntimeException)
{ {
static uno::Sequence< sal_Int8 > aId; return theOPropertySetImplementationId::get().getSeq();
if( aId.getLength() == 0 )
{
aId.realloc( 16 );
rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True );
}
return aId;
} }
// ____ XPropertyState ____ // ____ XPropertyState ____
beans::PropertyState SAL_CALL beans::PropertyState SAL_CALL
OPropertySet::getPropertyState( const OUString& PropertyName ) OPropertySet::getPropertyState( const OUString& PropertyName )
......
...@@ -61,6 +61,7 @@ ...@@ -61,6 +61,7 @@
#include "DateHelper.hxx" #include "DateHelper.hxx"
#include <comphelper/scopeguard.hxx> #include <comphelper/scopeguard.hxx>
#include <comphelper/servicehelper.hxx>
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include <unotools/streamwrap.hxx> #include <unotools/streamwrap.hxx>
// header for class LocaleDataWrapper // header for class LocaleDataWrapper
...@@ -119,20 +120,14 @@ using ::com::sun::star::uno::Sequence; ...@@ -119,20 +120,14 @@ using ::com::sun::star::uno::Sequence;
using ::com::sun::star::uno::Any; using ::com::sun::star::uno::Any;
using rtl::OUString; using rtl::OUString;
namespace
{
class theExplicitValueProviderUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theExplicitValueProviderUnoTunnelId > {};
}
const uno::Sequence<sal_Int8>& ExplicitValueProvider::getUnoTunnelId() const uno::Sequence<sal_Int8>& ExplicitValueProvider::getUnoTunnelId()
{ {
static uno::Sequence<sal_Int8> * pSeq = 0; return theExplicitValueProviderUnoTunnelId::get().getSeq();
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;
} }
ExplicitValueProvider* ExplicitValueProvider::getExplicitValueProvider( ExplicitValueProvider* ExplicitValueProvider::getExplicitValueProvider(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment