use tunnel pattern here

This commit is contained in:
Caolán McNamara 2011-06-01 12:04:53 +01:00
parent 9a95e67472
commit a6969adc72
3 changed files with 16 additions and 30 deletions

View file

@ -36,7 +36,6 @@
#define _SVSTDARR_BYTESTRINGS
#define _SVSTDARR_BYTESTRINGSSORTDTOR
#include <rtl/uuid.h>
#include <tools/tenccvt.hxx>
#include <comphelper/processfactory.hxx>
#include <unotools/intlwrapper.hxx>
@ -51,6 +50,7 @@
#include <svl/svstdarr.hxx>
#include <unotools/syslocale.hxx>
#include <algorithm>
#include <comphelper/servicehelper.hxx>
#define STYLESTREAM "SfxStyleSheets"
#define STYLESTREAM_VERSION sal_uInt16(50)
@ -1379,20 +1379,14 @@ SfxUnoStyleSheet* SfxUnoStyleSheet::getUnoStyleSheet( const ::com::sun::star::un
// --------------------------------------------------------------------
namespace
{
class theSfxUnoStyleSheetIdentifier : public rtl::Static< UnoTunnelIdInit, theSfxUnoStyleSheetIdentifier > {};
}
const ::com::sun::star::uno::Sequence< ::sal_Int8 >& SfxUnoStyleSheet::getIdentifier()
{
static ::com::sun::star::uno::Sequence< sal_Int8 > * pSeq = 0;
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 theSfxUnoStyleSheetIdentifier::get().getSeq();
}
// --------------------------------------------------------------------

View file

@ -33,9 +33,7 @@
#include <tools/color.hxx>
#include <tools/debug.hxx>
#include <osl/mutex.hxx>
#include <osl/mutex.hxx>
#include <rtl/uuid.h>
#include <comphelper/servicehelper.hxx>
#include <svl/numuno.hxx>
#include "numfmuno.hxx"
@ -131,21 +129,15 @@ sal_Int64 SAL_CALL SvNumberFormatsSupplierObj::getSomething(
return 0;
}
namespace
{
class theSvNumberFormatsSupplierObjUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSvNumberFormatsSupplierObjUnoTunnelId > {};
}
// static
const uno::Sequence<sal_Int8>& SvNumberFormatsSupplierObj::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 theSvNumberFormatsSupplierObjUnoTunnelId::get().getSeq();
}
// static

View file

@ -1321,8 +1321,8 @@ short SvNumberformat::ImpNextSymbol(String& rString,
break;
default:
{
static const String aNatNum( RTL_CONSTASCII_USTRINGPARAM( "NATNUM" ) );
static const String aDBNum( RTL_CONSTASCII_USTRINGPARAM( "DBNUM" ) );
const String aNatNum(RTL_CONSTASCII_USTRINGPARAM("NATNUM"));
const String aDBNum(RTL_CONSTASCII_USTRINGPARAM("DBNUM"));
String aUpperNatNum( rChrCls().toUpper( rString, nPos-1, aNatNum.Len() ) );
String aUpperDBNum( rChrCls().toUpper( rString, nPos-1, aDBNum.Len() ) );
sal_Unicode cUpper = aUpperNatNum.GetChar(0);