[Libreoffice-commits] .: 17 commits - comphelper/inc comphelper/source i18npool/qa i18npool/source svl/source svtools/source toolkit/inc unotools/inc unotools/Package_inc.mk unotools/source vcl/source vcl/unx
Caolán McNamara
caolan at kemper.freedesktop.org
Wed Jun 1 07:42:05 PDT 2011
comphelper/inc/comphelper/servicehelper.hxx | 1
comphelper/source/misc/namedvaluecollection.cxx | 11
comphelper/source/property/propstate.cxx | 20 -
i18npool/qa/cppunit/test_breakiterator.cxx | 1
i18npool/source/transliteration/transliteration_commonclass.cxx | 2
svl/source/items/style.cxx | 20 -
svl/source/numbers/numuno.cxx | 22 -
svl/source/numbers/zformat.cxx | 4
svtools/source/config/miscopt.cxx | 35 -
svtools/source/config/optionsdrawinglayer.cxx | 6
svtools/source/contnr/fileview.cxx | 4
svtools/source/contnr/svtabbx.cxx | 4
svtools/source/control/valueacc.cxx | 37 -
svtools/source/control/valueimp.hxx | 1
svtools/source/graphic/descriptor.cxx | 18
svtools/source/graphic/graphic.cxx | 20 -
svtools/source/graphic/provider.cxx | 18
svtools/source/graphic/renderer.cxx | 18
svtools/source/graphic/transformer.cxx | 1
svtools/source/misc/chartprettypainter.cxx | 23 -
svtools/source/misc/transfer.cxx | 21 -
svtools/source/uno/unoimap.cxx | 16
toolkit/inc/toolkit/helper/macros.hxx | 36 -
unotools/Package_inc.mk | 1
unotools/inc/unotools/fontcfg.hxx | 4
unotools/inc/unotools/unotunnelhelper.hxx | 195 ----------
unotools/source/accessibility/accessiblerelationsethelper.cxx | 16
unotools/source/accessibility/accessiblestatesethelper.cxx | 16
unotools/source/config/cacheoptions.cxx | 9
unotools/source/config/extendedsecurityoptions.cxx | 6
unotools/source/config/fontcfg.cxx | 24 +
unotools/source/config/fontoptions.cxx | 6
unotools/source/config/lingucfg.cxx | 74 +--
unotools/source/config/localisationoptions.cxx | 7
unotools/source/config/misccfg.cxx | 48 +-
unotools/source/config/printwarningoptions.cxx | 6
unotools/source/config/securityoptions.cxx | 4
unotools/source/config/startoptions.cxx | 6
unotools/source/config/syslocaleoptions.cxx | 4
unotools/source/config/workingsetoptions.cxx | 6
vcl/source/components/display.cxx | 13
vcl/source/components/dtranscomp.cxx | 10
vcl/unx/generic/gdi/gcach_xpeer.cxx | 8
vcl/unx/headless/svptext.cxx | 44 +-
44 files changed, 283 insertions(+), 563 deletions(-)
New commits:
commit c7472621b892bfdffeefe44c24642260c4c186ed
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Jun 1 12:17:55 2011 +0100
overly static
diff --git a/comphelper/source/property/propstate.cxx b/comphelper/source/property/propstate.cxx
index bb04dd3..dc3b7f5 100644
--- a/comphelper/source/property/propstate.cxx
+++ b/comphelper/source/property/propstate.cxx
@@ -68,18 +68,14 @@ namespace comphelper
//---------------------------------------------------------------------
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> OPropertyStateHelper::getTypes() throw( ::com::sun::star::uno::RuntimeException)
{
- static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> aTypes;
- if (!aTypes.getLength())
- {
- aTypes.realloc(4);
- ::com::sun::star::uno::Type* pTypes = aTypes.getArray();
- // base class types
- pTypes[0] = getCppuType(( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>*)NULL);
- pTypes[1] = getCppuType(( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet>*)NULL);
- pTypes[2] = getCppuType(( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet>*)NULL);
- // my own type
- pTypes[3] = getCppuType(( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState>*)NULL);
- }
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> aTypes(4);
+ ::com::sun::star::uno::Type* pTypes = aTypes.getArray();
+ // base class types
+ pTypes[0] = getCppuType(( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>*)NULL);
+ pTypes[1] = getCppuType(( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet>*)NULL);
+ pTypes[2] = getCppuType(( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet>*)NULL);
+ // my own type
+ pTypes[3] = getCppuType(( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState>*)NULL);
return aTypes;
}
commit ba9d1b345bb7cf20e4181c01aa137fe486a50e79
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Jun 1 12:17:33 2011 +0100
overly static
diff --git a/svtools/source/config/optionsdrawinglayer.cxx b/svtools/source/config/optionsdrawinglayer.cxx
index 388535b..3709166 100644
--- a/svtools/source/config/optionsdrawinglayer.cxx
+++ b/svtools/source/config/optionsdrawinglayer.cxx
@@ -1188,8 +1188,8 @@ sal_uInt16 SvtOptionsDrawinglayer_Impl::GetSelectionMaximumLuminancePercent() co
//*****************************************************************************************************************
Sequence< OUString > SvtOptionsDrawinglayer_Impl::impl_GetPropertyNames()
{
- // Build static list of configuration key names.
- static const OUString pProperties[] =
+ // Build list of configuration key names.
+ const OUString pProperties[] =
{
PROPERTYNAME_OVERLAYBUFFER ,
PROPERTYNAME_PAINTBUFFER ,
@@ -1231,7 +1231,7 @@ Sequence< OUString > SvtOptionsDrawinglayer_Impl::impl_GetPropertyNames()
};
// Initialize return sequence with these list ...
- static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
+ const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
// ... and return it.
return seqPropertyNames;
}
diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx
index 1cdf90c..09401d9 100644
--- a/svtools/source/contnr/fileview.cxx
+++ b/svtools/source/contnr/fileview.cxx
@@ -1164,8 +1164,8 @@ sal_Bool ViewTabListBox_Impl::DoubleClickHdl()
SvtContentEntry* pData = (SvtContentEntry*)pEntry->GetUserData();
if ( pData )
{
- static const String sVar1( RTL_CONSTASCII_USTRINGPARAM( "%1" ) );
- static const String sVar2( RTL_CONSTASCII_USTRINGPARAM( "%2" ) );
+ const String sVar1( RTL_CONSTASCII_USTRINGPARAM( "%1" ) );
+ const String sVar2( RTL_CONSTASCII_USTRINGPARAM( "%2" ) );
String aText( msAccessibleDescText );
aText.SearchAndReplace( sVar1, pData->mbIsFolder ? msFolder : msFile );
aText.SearchAndReplace( sVar2, pData->maURL );
diff --git a/svtools/source/contnr/svtabbx.cxx b/svtools/source/contnr/svtabbx.cxx
index 839c449..8a85a93 100644
--- a/svtools/source/contnr/svtabbx.cxx
+++ b/svtools/source/contnr/svtabbx.cxx
@@ -1126,8 +1126,8 @@ sal_Bool SvHeaderTabListBox::ConvertPointToColumnHeader( sal_uInt16&, const Poin
if( _eType == ::svt::BBTYPE_TABLECELL && _nPos != -1 )
{
- static const String sVar1( RTL_CONSTASCII_USTRINGPARAM( "%1" ) );
- static const String sVar2( RTL_CONSTASCII_USTRINGPARAM( "%2" ) );
+ const String sVar1( RTL_CONSTASCII_USTRINGPARAM( "%1" ) );
+ const String sVar2( RTL_CONSTASCII_USTRINGPARAM( "%2" ) );
sal_uInt16 nColumnCount = GetColumnCount();
if (nColumnCount > 0)
commit 87e18662c78e4ea588e0dda48fb68388439f3efb
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Jun 1 12:04:53 2011 +0100
use tunnel pattern here
diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx
index f22f044..d078897 100644
--- a/svl/source/items/style.cxx
+++ b/svl/source/items/style.cxx
@@ -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();
}
// --------------------------------------------------------------------
diff --git a/svl/source/numbers/numuno.cxx b/svl/source/numbers/numuno.cxx
index a2f332e..097cdc4 100644
--- a/svl/source/numbers/numuno.cxx
+++ b/svl/source/numbers/numuno.cxx
@@ -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
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index 1f8e8a5..16fc5ec 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -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);
commit 20f6eb8e92344f45ab6f44f4f084c4e9b5064a56
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Jun 1 11:58:30 2011 +0100
use a well-behaved singleton here
diff --git a/unotools/source/config/lingucfg.cxx b/unotools/source/config/lingucfg.cxx
index 358c79a..da685ec 100644
--- a/unotools/source/config/lingucfg.cxx
+++ b/unotools/source/config/lingucfg.cxx
@@ -39,6 +39,7 @@
#include "com/sun/star/util/XMacroExpander.hpp"
#include "com/sun/star/beans/XPropertySet.hpp"
#include <rtl/uri.hxx>
+#include <rtl/instance.hxx>
#include <osl/mutex.hxx>
#include <i18npool/mslangid.hxx>
#include <tools/debug.hxx>
@@ -62,17 +63,14 @@ using ::rtl::Uri;
///////////////////////////////////////////////////////////////////////////
-
-static osl::Mutex & GetOwnMutex()
+namespace
{
- static osl::Mutex aMutex;
- return aMutex;
+ class theSvtLinguConfigItemMutex :
+ public rtl::Static< osl::Mutex, theSvtLinguConfigItemMutex > {};
}
-
///////////////////////////////////////////////////////////////////////////
-
static sal_Bool lcl_SetLocale( sal_Int16 &rLanguage, const uno::Any &rVal )
{
sal_Bool bSucc = sal_False;
@@ -348,7 +346,7 @@ sal_Bool SvtLinguConfigItem::GetHdlByName(
uno::Any SvtLinguConfigItem::GetProperty( const OUString &rPropertyName ) const
{
- osl::MutexGuard aGuard( GetOwnMutex() );
+ osl::MutexGuard aGuard(theSvtLinguConfigItemMutex::get());
sal_Int32 nHdl;
return GetHdlByName( nHdl, rPropertyName ) ? GetProperty( nHdl ) : uno::Any();
@@ -357,7 +355,7 @@ uno::Any SvtLinguConfigItem::GetProperty( const OUString &rPropertyName ) const
uno::Any SvtLinguConfigItem::GetProperty( sal_Int32 nPropertyHandle ) const
{
- osl::MutexGuard aGuard( GetOwnMutex() );
+ osl::MutexGuard aGuard(theSvtLinguConfigItemMutex::get());
uno::Any aRes;
@@ -440,7 +438,7 @@ uno::Any SvtLinguConfigItem::GetProperty( sal_Int32 nPropertyHandle ) const
sal_Bool SvtLinguConfigItem::SetProperty( const OUString &rPropertyName, const uno::Any &rValue )
{
- osl::MutexGuard aGuard( GetOwnMutex() );
+ osl::MutexGuard aGuard(theSvtLinguConfigItemMutex::get());
sal_Bool bSucc = sal_False;
sal_Int32 nHdl;
@@ -452,7 +450,7 @@ sal_Bool SvtLinguConfigItem::SetProperty( const OUString &rPropertyName, const u
sal_Bool SvtLinguConfigItem::SetProperty( sal_Int32 nPropertyHandle, const uno::Any &rValue )
{
- osl::MutexGuard aGuard( GetOwnMutex() );
+ osl::MutexGuard aGuard(theSvtLinguConfigItemMutex::get());
sal_Bool bSucc = sal_False;
if (!rValue.hasValue())
@@ -578,7 +576,7 @@ sal_Bool SvtLinguConfigItem::SetProperty( sal_Int32 nPropertyHandle, const uno::
sal_Bool SvtLinguConfigItem::GetOptions( SvtLinguOptions &rOptions ) const
{
- osl::MutexGuard aGuard( GetOwnMutex() );
+ osl::MutexGuard aGuard(theSvtLinguConfigItemMutex::get());
rOptions = aOpt;
return sal_True;
@@ -587,7 +585,7 @@ sal_Bool SvtLinguConfigItem::GetOptions( SvtLinguOptions &rOptions ) const
sal_Bool SvtLinguConfigItem::SetOptions( const SvtLinguOptions &rOptions )
{
- osl::MutexGuard aGuard( GetOwnMutex() );
+ osl::MutexGuard aGuard(theSvtLinguConfigItemMutex::get());
aOpt = rOptions;
SetModified();
@@ -598,7 +596,7 @@ sal_Bool SvtLinguConfigItem::SetOptions( const SvtLinguOptions &rOptions )
sal_Bool SvtLinguConfigItem::LoadOptions( const uno::Sequence< OUString > &rProperyNames )
{
- osl::MutexGuard aGuard( GetOwnMutex() );
+ osl::MutexGuard aGuard(theSvtLinguConfigItemMutex::get());
sal_Bool bRes = sal_False;
@@ -721,7 +719,7 @@ sal_Bool SvtLinguConfigItem::SaveOptions( const uno::Sequence< OUString > &rProp
if (!IsModified())
return sal_True;
- osl::MutexGuard aGuard( GetOwnMutex() );
+ osl::MutexGuard aGuard(theSvtLinguConfigItemMutex::get());
sal_Bool bRet = sal_False;
const uno::Type &rBOOL = ::getBooleanCppuType();
@@ -786,7 +784,7 @@ sal_Bool SvtLinguConfigItem::SaveOptions( const uno::Sequence< OUString > &rProp
sal_Bool SvtLinguConfigItem::IsReadOnly( const rtl::OUString &rPropertyName ) const
{
- osl::MutexGuard aGuard( GetOwnMutex() );
+ osl::MutexGuard aGuard(theSvtLinguConfigItemMutex::get());
sal_Bool bReadOnly = sal_False;
sal_Int32 nHdl;
@@ -797,7 +795,7 @@ sal_Bool SvtLinguConfigItem::IsReadOnly( const rtl::OUString &rPropertyName ) co
sal_Bool SvtLinguConfigItem::IsReadOnly( sal_Int32 nPropertyHandle ) const
{
- osl::MutexGuard aGuard( GetOwnMutex() );
+ osl::MutexGuard aGuard(theSvtLinguConfigItemMutex::get());
sal_Bool bReadOnly = sal_False;
@@ -856,14 +854,14 @@ static const rtl::OUString aG_LastActiveDictionaries(RTL_CONSTASCII_USTRINGPARAM
SvtLinguConfig::SvtLinguConfig()
{
// Global access, must be guarded (multithreading)
- osl::MutexGuard aGuard( GetOwnMutex() );
+ osl::MutexGuard aGuard(theSvtLinguConfigItemMutex::get());
++nCfgItemRefCount;
}
SvtLinguConfig::~SvtLinguConfig()
{
- osl::MutexGuard aGuard( GetOwnMutex() );
+ osl::MutexGuard aGuard(theSvtLinguConfigItemMutex::get());
if (pCfgItem && pCfgItem->IsModified())
pCfgItem->Commit();
@@ -880,7 +878,7 @@ SvtLinguConfig::~SvtLinguConfig()
SvtLinguConfigItem & SvtLinguConfig::GetConfigItem()
{
// Global access, must be guarded (multithreading)
- osl::MutexGuard aGuard( GetOwnMutex() );
+ osl::MutexGuard aGuard(theSvtLinguConfigItemMutex::get());
if (!pCfgItem)
{
pCfgItem = new SvtLinguConfigItem;
commit 5d4d142e18f0eef412fa07e2cd646c21693d2906
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Jun 1 11:49:47 2011 +0100
tidy this up
diff --git a/svtools/source/config/miscopt.cxx b/svtools/source/config/miscopt.cxx
index 2a0a507..cc3e022 100644
--- a/svtools/source/config/miscopt.cxx
+++ b/svtools/source/config/miscopt.cxx
@@ -43,6 +43,7 @@
#include <tools/urlobj.hxx>
#include <rtl/logfile.hxx>
+#include <rtl/instance.hxx>
#include "itemholder2.hxx"
#include <svtools/imgdef.hxx>
@@ -760,8 +761,8 @@ void SvtMiscOptions_Impl::Commit()
//*****************************************************************************************************************
Sequence< OUString > SvtMiscOptions_Impl::GetPropertyNames()
{
- // Build static list of configuration key names.
- static const OUString pProperties[] =
+ // Build list of configuration key names.
+ const OUString pProperties[] =
{
PROPERTYNAME_PLUGINSENABLED,
PROPERTYNAME_SYMBOLSET,
@@ -777,7 +778,7 @@ Sequence< OUString > SvtMiscOptions_Impl::GetPropertyNames()
};
// Initialize return sequence with these list ...
- static const Sequence< OUString > seqPropertyNames( pProperties, SAL_N_ELEMENTS( pProperties ) );
+ const Sequence< OUString > seqPropertyNames( pProperties, SAL_N_ELEMENTS( pProperties ) );
// ... and return it.
return seqPropertyNames;
}
@@ -999,29 +1000,15 @@ sal_Bool SvtMiscOptions::IsExperimentalMode() const
return m_pDataContainer->IsExperimentalMode();
}
-//*****************************************************************************************************************
-// private method
-//*****************************************************************************************************************
+namespace
+{
+ class theSvtMiscOptionsMutex :
+ public rtl::Static< osl::Mutex, theSvtMiscOptionsMutex > {};
+}
+
Mutex & SvtMiscOptions::GetInitMutex()
{
- // Initialize static mutex only for one time!
- static Mutex* pMutex = NULL;
- // If these method first called (Mutex not already exist!) ...
- if( pMutex == NULL )
- {
- // ... we must create a new one. Protect follow code with the global mutex -
- // It must be - we create a static variable!
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these!
- if( pMutex == NULL )
- {
- // Create the new mutex and set it for return on static variable.
- static Mutex aMutex;
- pMutex = &aMutex;
- }
- }
- // Return new created or already existing mutex object.
- return *pMutex;
+ return theSvtMiscOptionsMutex::get();
}
void SvtMiscOptions::AddListenerLink( const Link& rLink )
commit db2b6e1994803102793450425b04dd76cbec02be
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Jun 1 11:42:07 2011 +0100
overly static
diff --git a/vcl/source/components/display.cxx b/vcl/source/components/display.cxx
index 7e15020..49f48f3 100644
--- a/vcl/source/components/display.cxx
+++ b/vcl/source/components/display.cxx
@@ -157,8 +157,7 @@ Property SAL_CALL DisplayInfo::getPropertyByName( const OUString& aName ) throw
// XServiceInfo
OUString SAL_CALL DisplayInfo::getImplementationName( ) throw (RuntimeException)
{
- static OUString aImplementationName( RTL_CONSTASCII_USTRINGPARAM( "vcl::DisplayInfo" ) );
- return aImplementationName;
+ return OUString(RTL_CONSTASCII_USTRINGPARAM("vcl::DisplayInfo"));
}
::sal_Bool SAL_CALL DisplayInfo::supportsService( const OUString& ServiceName ) throw (RuntimeException)
@@ -174,9 +173,8 @@ OUString SAL_CALL DisplayInfo::getImplementationName( ) throw (RuntimeException
Sequence< OUString > SAL_CALL DisplayInfo::getSupportedServiceNames( ) throw (RuntimeException)
{
- static OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.DisplayInfo" ) );
- static Sequence< OUString > aServiceNames( &aServiceName, 1 );
- return aServiceNames;
+ OUString aServiceName(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.DisplayInfo"));
+ return Sequence< OUString >(&aServiceName, 1);
}
// ====================================================================
@@ -216,9 +214,8 @@ public:
Sequence< OUString > DisplayAccess_getSupportedServiceNames()
{
- static OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.DisplayAccess" ) );
- static Sequence< OUString > aServiceNames( &aServiceName, 1 );
- return aServiceNames;
+ OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.DisplayAccess" ) );
+ return Sequence< OUString >( &aServiceName, 1 );
}
OUString DisplayAccess_getImplementationName()
diff --git a/vcl/source/components/dtranscomp.cxx b/vcl/source/components/dtranscomp.cxx
index b69afdd..ec8edb4 100644
--- a/vcl/source/components/dtranscomp.cxx
+++ b/vcl/source/components/dtranscomp.cxx
@@ -380,15 +380,14 @@ void GenericDragSource::initialize( const Sequence< Any >& ) throw( Exception )
Sequence< OUString > SAL_CALL DragSource_getSupportedServiceNames()
{
#if defined UNX
- static OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM(
+ OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM(
#if ! defined QUARTZ
"com.sun.star.datatransfer.dnd.X11DragSource"
#else
"com.sun.star.datatransfer.dnd.OleDragSource"
#endif
) );
- static Sequence< OUString > aServiceNames( &aServiceName, 1 );
- return aServiceNames;
+ return Sequence< OUString >(&aServiceName, 1);
#else
return GenericDragSource::getSupportedServiceNames_static();
#endif
@@ -495,15 +494,14 @@ void GenericDropTarget::setDefaultActions( sal_Int8) throw()
Sequence< OUString > SAL_CALL DropTarget_getSupportedServiceNames()
{
#if defined UNX
- static OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM(
+ OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM(
#if ! defined QUARTZ
"com.sun.star.datatransfer.dnd.X11DropTarget"
#else
"com.sun.star.datatransfer.dnd.OleDropTarget"
#endif
) );
- static Sequence< OUString > aServiceNames( &aServiceName, 1 );
- return aServiceNames;
+ return Sequence< OUString >(&aServiceName, 1);
#else
return GenericDropTarget::getSupportedServiceNames_static();
#endif
commit 95fe636ce4c19b0f8e9d5b2f8a2cdd5a43e23530
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Jun 1 10:02:38 2011 +0100
overly static
diff --git a/i18npool/source/transliteration/transliteration_commonclass.cxx b/i18npool/source/transliteration/transliteration_commonclass.cxx
index 4dd5cf4..83f90bd 100644
--- a/i18npool/source/transliteration/transliteration_commonclass.cxx
+++ b/i18npool/source/transliteration/transliteration_commonclass.cxx
@@ -130,7 +130,7 @@ transliteration_commonclass::compareString( const OUString& str1, const OUString
OUString SAL_CALL
transliteration_commonclass::transliterateString2String( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount ) throw(RuntimeException)
{
- static Sequence < sal_Int32 > dummy_offset;
+ Sequence < sal_Int32 > dummy_offset;
useOffset = sal_False;
OUString tmpStr = transliterate(inStr, startPos, nCount, dummy_offset);
useOffset = sal_True;
commit f5ff4c73ac06098e8bd4acad68cc018b70fce0e5
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Jun 1 10:02:08 2011 +0100
use tunnel pattern here
diff --git a/svtools/source/control/valueacc.cxx b/svtools/source/control/valueacc.cxx
index 9c32008..3be7dc6 100644
--- a/svtools/source/control/valueacc.cxx
+++ b/svtools/source/control/valueacc.cxx
@@ -35,6 +35,7 @@
#include <vcl/svapp.hxx>
#include <svtools/valueset.hxx>
#include "valueimp.hxx"
+#include <comphelper/servicehelper.hxx>
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
#include <com/sun/star/accessibility/AccessibleRole.hpp>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
@@ -133,22 +134,14 @@ void ValueSetAcc::FireAccessibleEvent( short nEventId, const uno::Any& rOldValue
}
}
-// -----------------------------------------------------------------------------
+namespace
+{
+ class theValueSetAccUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theValueSetAccUnoTunnelId > {};
+}
const uno::Sequence< sal_Int8 >& ValueSetAcc::getUnoTunnelId()
{
- static uno::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 theValueSetAccUnoTunnelId::get().getSeq();
}
// -----------------------------------------------------------------------------
@@ -851,22 +844,14 @@ void ValueItemAcc::ParentDestroyed()
mpParent = NULL;
}
-// -----------------------------------------------------------------------------
+namespace
+{
+ class theValueItemAccUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theValueItemAccUnoTunnelId > {};
+}
const uno::Sequence< sal_Int8 >& ValueItemAcc::getUnoTunnelId()
{
- static uno::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 theValueItemAccUnoTunnelId::get().getSeq();
}
// -----------------------------------------------------------------------------
diff --git a/svtools/source/control/valueimp.hxx b/svtools/source/control/valueimp.hxx
index 865e0ac..bc42db9 100644
--- a/svtools/source/control/valueimp.hxx
+++ b/svtools/source/control/valueimp.hxx
@@ -30,7 +30,6 @@
#include <tools/color.hxx>
#include <tools/string.hxx>
#include <vcl/image.hxx>
-#include <rtl/uuid.h>
#include <cppuhelper/implbase5.hxx>
#include <cppuhelper/compbase6.hxx>
#include <comphelper/broadcasthelper.hxx>
diff --git a/svtools/source/graphic/descriptor.cxx b/svtools/source/graphic/descriptor.cxx
index 7379c41..cbce3b4 100644
--- a/svtools/source/graphic/descriptor.cxx
+++ b/svtools/source/graphic/descriptor.cxx
@@ -31,11 +31,11 @@
#include "descriptor.hxx"
-#include <rtl/uuid.h>
#include <osl/mutex.hxx>
#include <unotools/ucbstreamhelper.hxx>
#include <svtools/filter.hxx>
#include <svl/itemprop.hxx>
+#include <comphelper/servicehelper.hxx>
#include <com/sun/star/beans/PropertyState.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
@@ -305,21 +305,15 @@ uno::Sequence< uno::Type > SAL_CALL GraphicDescriptor::getTypes()
return aTypes;
}
-// ------------------------------------------------------------------------------
+namespace
+{
+ class theGraphicDescriptorUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theGraphicDescriptorUnoTunnelId > {};
+}
uno::Sequence< sal_Int8 > SAL_CALL GraphicDescriptor::getImplementationId()
throw( uno::RuntimeException )
{
- SolarMutexGuard aGuard;
- static uno::Sequence< sal_Int8 > aId;
-
- if( aId.getLength() == 0 )
- {
- aId.realloc( 16 );
- rtl_createUuid( reinterpret_cast< sal_uInt8* >( aId.getArray() ), 0, sal_True );
- }
-
- return aId;
+ return theGraphicDescriptorUnoTunnelId::get().getSeq();
}
// ------------------------------------------------------------------------------
diff --git a/svtools/source/graphic/graphic.cxx b/svtools/source/graphic/graphic.cxx
index 0c73949..f2703ab 100644
--- a/svtools/source/graphic/graphic.cxx
+++ b/svtools/source/graphic/graphic.cxx
@@ -29,13 +29,13 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svtools.hxx"
-#include <rtl/uuid.h>
#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
#include <com/sun/star/graphic/GraphicType.hpp>
#include <com/sun/star/graphic/XGraphicTransformer.hpp>
#include <vcl/graph.hxx>
#include "graphic.hxx"
+#include <comphelper/servicehelper.hxx>
using namespace com::sun::star;
@@ -113,20 +113,16 @@ void SAL_CALL Graphic::release() throw()
}
// ------------------------------------------------------------------------------
-
+
+namespace
+{
+ class theGraphicUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theGraphicUnoTunnelId > {};
+}
+
uno::Sequence< sal_Int8 > SAL_CALL Graphic::getImplementationId_Static()
throw(uno::RuntimeException)
{
- SolarMutexGuard aGuard;
- static uno::Sequence< sal_Int8 > aId;
-
- if( aId.getLength() == 0 )
- {
- aId.realloc( 16 );
- rtl_createUuid( reinterpret_cast< sal_uInt8* >( aId.getArray() ), 0, sal_True );
- }
-
- return aId;
+ return theGraphicUnoTunnelId::get().getSeq();
}
// ------------------------------------------------------------------------------
diff --git a/svtools/source/graphic/provider.cxx b/svtools/source/graphic/provider.cxx
index 9f5e471..bd09178 100644
--- a/svtools/source/graphic/provider.cxx
+++ b/svtools/source/graphic/provider.cxx
@@ -29,7 +29,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svtools.hxx"
-#include <rtl/uuid.h>
#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
#include <vcl/image.hxx>
@@ -46,6 +45,7 @@
#include <vcl/virdev.hxx>
#include <com/sun/star/io/XStream.hpp>
#include <com/sun/star/text/GraphicCrop.hpp>
+#include <comphelper/servicehelper.hxx>
#include "descriptor.hxx"
#include "graphic.hxx"
@@ -143,21 +143,15 @@ uno::Sequence< uno::Type > SAL_CALL GraphicProvider::getTypes()
return aTypes;
}
-// ------------------------------------------------------------------------------
+namespace
+{
+ class theGraphicProviderUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theGraphicProviderUnoTunnelId > {};
+}
uno::Sequence< sal_Int8 > SAL_CALL GraphicProvider::getImplementationId()
throw(uno::RuntimeException)
{
- SolarMutexGuard aGuard;
- static uno::Sequence< sal_Int8 > aId;
-
- if( aId.getLength() == 0 )
- {
- aId.realloc( 16 );
- rtl_createUuid( reinterpret_cast< sal_uInt8* >( aId.getArray() ), 0, sal_True );
- }
-
- return aId;
+ return theGraphicProviderUnoTunnelId::get().getSeq();
}
// ------------------------------------------------------------------------------
diff --git a/svtools/source/graphic/renderer.cxx b/svtools/source/graphic/renderer.cxx
index 3ac3248..51cc016 100644
--- a/svtools/source/graphic/renderer.cxx
+++ b/svtools/source/graphic/renderer.cxx
@@ -32,13 +32,13 @@
#include <com/sun/star/beans/PropertyState.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/awt/Rectangle.hpp>
-#include <rtl/uuid.h>
#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <comphelper/propertysetinfo.hxx>
#include <svl/itemprop.hxx>
#include <svtools/grfmgr.hxx>
+#include <comphelper/servicehelper.hxx>
#include "graphic.hxx"
#include "renderer.hxx"
@@ -192,21 +192,15 @@ uno::Sequence< uno::Type > SAL_CALL GraphicRendererVCL::getTypes()
return aTypes;
}
-// ------------------------------------------------------------------------------
+namespace
+{
+ class theGraphicRendererVCLUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theGraphicRendererVCLUnoTunnelId > {};
+}
uno::Sequence< sal_Int8 > SAL_CALL GraphicRendererVCL::getImplementationId()
throw( uno::RuntimeException )
{
- SolarMutexGuard aGuard;
- static uno::Sequence< sal_Int8 > aId;
-
- if( aId.getLength() == 0 )
- {
- aId.realloc( 16 );
- rtl_createUuid( reinterpret_cast< sal_uInt8* >( aId.getArray() ), 0, sal_True );
- }
-
- return aId;
+ return theGraphicRendererVCLUnoTunnelId::get().getSeq();
}
// ------------------------------------------------------------------------------
diff --git a/svtools/source/graphic/transformer.cxx b/svtools/source/graphic/transformer.cxx
index 226fd3a..73a073a 100644
--- a/svtools/source/graphic/transformer.cxx
+++ b/svtools/source/graphic/transformer.cxx
@@ -29,7 +29,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svtools.hxx"
-#include <rtl/uuid.h>
#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
#include <vcl/image.hxx>
diff --git a/svtools/source/misc/chartprettypainter.cxx b/svtools/source/misc/chartprettypainter.cxx
index 26a251a..9b68e0b 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 9e0a655..84d103f 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();
}
// ---------------------------------
diff --git a/svtools/source/uno/unoimap.cxx b/svtools/source/uno/unoimap.cxx
index 3597dd3..3ff3b8a 100644
--- a/svtools/source/uno/unoimap.cxx
+++ b/svtools/source/uno/unoimap.cxx
@@ -43,7 +43,6 @@
#include <cppuhelper/weakagg.hxx>
#include <cppuhelper/implbase3.hxx>
#include <list>
-#include <rtl/uuid.h>
#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
#include <svtools/unoevent.hxx>
@@ -383,18 +382,15 @@ uno::Sequence< uno::Type > SAL_CALL SvUnoImageMapObject::getTypes()
return aTypes;
}
+namespace
+{
+ class theSvUnoImageMapObjectImplementationId : public rtl::Static< UnoTunnelIdInit, theSvUnoImageMapObjectImplementationId > {};
+}
+
uno::Sequence< sal_Int8 > SAL_CALL SvUnoImageMapObject::getImplementationId()
throw (uno::RuntimeException)
{
- SolarMutexGuard aGuard;
-
- 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 theSvUnoImageMapObjectImplementationId::get().getSeq();
}
// XServiceInfo
commit 6e01a8615699bd1d3d91b35fba84a1b0d8123a2b
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Jun 1 09:36:11 2011 +0100
use tunnel pattern here
diff --git a/unotools/source/accessibility/accessiblerelationsethelper.cxx b/unotools/source/accessibility/accessiblerelationsethelper.cxx
index 904947f..3143615 100644
--- a/unotools/source/accessibility/accessiblerelationsethelper.cxx
+++ b/unotools/source/accessibility/accessiblerelationsethelper.cxx
@@ -31,9 +31,9 @@
#include "unotools/accessiblerelationsethelper.hxx"
-#include <rtl/uuid.h>
#include <vector>
#include <comphelper/sequence.hxx>
+#include <comphelper/servicehelper.hxx>
using namespace ::utl;
using namespace ::rtl;
@@ -258,18 +258,16 @@ uno::Sequence< ::com::sun::star::uno::Type>
return aTypeSequence;
}
+namespace
+{
+ class theAccessibleRelationSetHelperUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theAccessibleRelationSetHelperUnoTunnelId > {};
+}
+
uno::Sequence<sal_Int8> SAL_CALL
AccessibleRelationSetHelper::getImplementationId (void)
throw (::com::sun::star::uno::RuntimeException)
{
- osl::MutexGuard aGuard (maMutex);
- 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 theAccessibleRelationSetHelperUnoTunnelId::get().getSeq();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/accessibility/accessiblestatesethelper.cxx b/unotools/source/accessibility/accessiblestatesethelper.cxx
index 3ff7f28..1eee619 100644
--- a/unotools/source/accessibility/accessiblestatesethelper.cxx
+++ b/unotools/source/accessibility/accessiblestatesethelper.cxx
@@ -31,8 +31,8 @@
#include "unotools/accessiblestatesethelper.hxx"
-#include <rtl/uuid.h>
#include <tools/debug.hxx>
+#include <comphelper/servicehelper.hxx>
// defines how many states the bitfield can contain
// it has the size of 64 because I use a uInt64
@@ -310,18 +310,16 @@ uno::Sequence< ::com::sun::star::uno::Type>
return aTypeSequence;
}
+namespace
+{
+ class theAccessibleStateSetHelperUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theAccessibleStateSetHelperUnoTunnelId > {};
+}
+
uno::Sequence<sal_Int8> SAL_CALL
AccessibleStateSetHelper::getImplementationId (void)
throw (::com::sun::star::uno::RuntimeException)
{
- osl::MutexGuard aGuard (maMutex);
- 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 theAccessibleStateSetHelperUnoTunnelId::get().getSeq();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 7582174d94986db63775a0aba5b4955915f80c47
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Jun 1 09:31:57 2011 +0100
unotunnelhelper.hxx unused
diff --git a/unotools/Package_inc.mk b/unotools/Package_inc.mk
index 13a8165..a483061 100644
--- a/unotools/Package_inc.mk
+++ b/unotools/Package_inc.mk
@@ -108,7 +108,6 @@ $(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/ucblockbytes.hxx,uno
$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/ucbstreamhelper.hxx,unotools/ucbstreamhelper.hxx))
$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/undoopt.hxx,unotools/undoopt.hxx))
$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/unotoolsdllapi.h,unotools/unotoolsdllapi.h))
-$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/unotunnelhelper.hxx,unotools/unotunnelhelper.hxx))
$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/useroptions_const.hxx,unotools/useroptions_const.hxx))
$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/useroptions.hxx,unotools/useroptions.hxx))
$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/viewoptions.hxx,unotools/viewoptions.hxx))
diff --git a/unotools/inc/unotools/unotunnelhelper.hxx b/unotools/inc/unotools/unotunnelhelper.hxx
deleted file mode 100644
index e318bef..0000000
--- a/unotools/inc/unotools/unotunnelhelper.hxx
+++ /dev/null
@@ -1,195 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _UNOTOOLS_UNOTUNNELHLP_HXX
-#define _UNOTOOLS_UNOTUNNELHLP_HXX
-
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <com/sun/star/lang/XUnoTunnel.hpp>
-#include <rtl/uuid.h>
-#include <rtl/memory.h>
-#include <comphelper/extract.hxx>
-
-namespace utl
-{
-namespace staruno = ::com::sun::star::uno;
-namespace starlang = ::com::sun::star::lang;
-
-//-----------------------------------------------------------------------------------------------------------
-// to use the following, define
-// sal_Bool getTunneledImplementation(Classname*& pObjImpl, staruno::Reference<starlang::XUnoTunnel> const& xObj);
-
-template <class Classname>
-sal_Bool getImplementation(Classname*& pImpl, staruno::Reference<starlang::XUnoTunnel> const& xTunnel)
- throw(staruno::RuntimeException)
-{
- if (xTunnel.is())
- return getTunneledImplementation(pImpl, xTunnel);
-
- pImpl = 0;
- return sal_False;
-}
-
-template <class Classname>
-sal_Bool getImplementation(Classname*& pImpl, staruno::Reference<staruno::XInterface> const& xObj)
- throw(staruno::RuntimeException)
-{
- staruno::Reference<starlang::XUnoTunnel> xTunnel(xObj,staruno::UNO_QUERY);
- if (xTunnel.is())
- return getTunneledImplementation(pImpl, xTunnel);
-
- pImpl = 0;
- return sal_False;
-}
-
-template <class Classname>
-sal_Bool getImplementation(Classname*& pImpl, staruno::Any const& aObj)
- throw(staruno::RuntimeException)
-{
- staruno::Reference<starlang::XUnoTunnel> xTunnel;
- if (cppu::extractInterface(xTunnel, aObj))
- getTunneledImplementation(pImpl, xTunnel);
-
- pImpl = 0;
- return sal_False;
-}
-
-template <class Classname>
-sal_Bool getImplementation(Classname*& pImpl, starlang::XUnoTunnel* pObj)
- throw(staruno::RuntimeException)
-{
- if (pObj)
- {
- staruno::Reference<starlang::XUnoTunnel> xTunnel(pObj);
- return getTunneledImplementation(pImpl, xTunnel);
- }
-
- pImpl = 0;
- return sal_False;
-}
-
-//-----------------------------------------------------------------------------------------------------------
-
-class UnoTunnelId
-{
- sal_Int8 tunnelId[16];
-public:
- UnoTunnelId(sal_Bool bUseMAC = sal_True) throw()
- {
- rtl_createUuid(reinterpret_cast<sal_uInt8*>(tunnelId),0,bUseMAC);
- }
-
- staruno::Sequence<sal_Int8> getId() const throw(staruno::RuntimeException)
- {
- return staruno::Sequence<sal_Int8>(tunnelId, sizeof(tunnelId));
- }
-
- sal_Bool equalTo(staruno::Sequence<sal_Int8> const& rIdentifier) throw()
- {
- return rIdentifier.getLength() == sizeof(tunnelId) &&
- rtl_compareMemory(tunnelId, rIdentifier.getConstArray(), sizeof(tunnelId)) == 0;
- }
-
- sal_Int8 const (&getIdBytes() const)[16] { return tunnelId; }
-};
-
-//-----------------------------------------------------------------------------------------------------------
-template<class Classname>
-class UnoTunnelImplBase
-{
-protected:
- Classname* ThisImplementation() throw() { return static_cast<Classname*>(this); }
-
- sal_Int64 makeUnoSomething() throw()
- {
- return reinterpret_cast<sal_Int64>(static_cast<void*>(ThisImplementation()));
- }
-
- static Classname* extractUnoSomething(sal_Int64 nSomething) throw()
- {
- if (nSomething != sal_Int64())
- return static_cast<Classname*>(reinterpret_cast<void*>(nSomething));
-
- return NULL;
- }
-#ifdef LINUX
-public:
-#endif
- static Classname*
- extractUnoSomething(
- staruno::Reference<starlang::XUnoTunnel> const& xObj,
- staruno::Sequence<sal_Int8> const& rMyTunnelId
- )
- throw(staruno::RuntimeException)
- {
- return xObj.is() ? extractUnoSomething(xObj->getSomething(rMyTunnelId)) : NULL;
- }
-};
-//-----------------------------------------------------------------------------------------------------------
-
-
-template<class Classname>
-class UnoTunnelHelper : public UnoTunnelImplBase<Classname>
-{
-protected:
- static UnoTunnelId s_aTunnelId;
-
- sal_Int64 getSomething(staruno::Sequence<sal_Int8> const& rTunnelId) throw()
- {
- if (s_aTunnelId.equalTo(rTunnelId))
- return this->makeUnoSomething();
- else
- return sal_Int64();
- }
-public:
- static staruno::Sequence<sal_Int8> getImplementationTunnelId()
- throw(staruno::RuntimeException)
- {
- return s_aTunnelId.getId();
- }
-#ifndef LINUX
- friend sal_Bool getTunneledImplementation(Classname*& pImpl, staruno::Reference<starlang::XUnoTunnel> const& xObj)
- throw(staruno::RuntimeException)
- {
- pImpl = UnoTunnelHelper<Classname>::UnoTunnelHelper<Classname>::extractUnoSomething( xObj, UnoTunnelHelper<Classname>::getImplementationTunnelId() );
-
- return pImpl != 0;
- }
-#endif
-};
-template<class Classname>
-UnoTunnelId UnoTunnelHelper<Classname>::s_aTunnelId;
-
-
-//-----------------------------------------------------------------------------------------------------------
-} // namespace utl
-
-#endif // _UNOTOOLS_UNOTUNNELHLP_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 69bca6a1aadc60f0204c25bf3f403fc37bf29e86
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Jun 1 09:23:41 2011 +0100
this is overly static for little gain
diff --git a/unotools/source/config/cacheoptions.cxx b/unotools/source/config/cacheoptions.cxx
index 3525777..c228cef 100644
--- a/unotools/source/config/cacheoptions.cxx
+++ b/unotools/source/config/cacheoptions.cxx
@@ -330,13 +330,10 @@ void SvtCacheOptions_Impl::SetGraphicManagerObjectReleaseTime( sal_Int32 nGrfMgr
SetModified();
}
-//*****************************************************************************************************************
-// private method
-//*****************************************************************************************************************
Sequence< OUString > SvtCacheOptions_Impl::impl_GetPropertyNames()
{
- // Build static list of configuration key names.
- static const OUString pProperties[] =
+ // Build list of configuration key names.
+ const OUString pProperties[] =
{
PROPERTYNAME_WRITEROLE,
PROPERTYNAME_DRAWINGOLE,
@@ -345,7 +342,7 @@ Sequence< OUString > SvtCacheOptions_Impl::impl_GetPropertyNames()
PROPERTYNAME_GRFMGR_OBJECTRELEASE
};
// Initialize return sequence with these list ...
- static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
+ const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
// ... and return it.
return seqPropertyNames;
}
diff --git a/unotools/source/config/extendedsecurityoptions.cxx b/unotools/source/config/extendedsecurityoptions.cxx
index 926f32d..550d2d2 100644
--- a/unotools/source/config/extendedsecurityoptions.cxx
+++ b/unotools/source/config/extendedsecurityoptions.cxx
@@ -412,13 +412,13 @@ void SvtExtendedSecurityOptions_Impl::FillExtensionHashMap( ExtensionHashMap& aH
//*****************************************************************************************************************
Sequence< OUString > SvtExtendedSecurityOptions_Impl::GetPropertyNames()
{
- // Build static list of configuration key names.
- static const OUString pProperties[] =
+ // Build list of configuration key names.
+ const OUString pProperties[] =
{
PROPERTYNAME_HYPERLINKS_OPEN
};
// Initialize return sequence with these list ...
- static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
+ const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
// ... and return it.
return seqPropertyNames;
}
diff --git a/unotools/source/config/fontoptions.cxx b/unotools/source/config/fontoptions.cxx
index 514927a..028cb7a 100644
--- a/unotools/source/config/fontoptions.cxx
+++ b/unotools/source/config/fontoptions.cxx
@@ -369,15 +369,15 @@ void SvtFontOptions_Impl::EnableFontWYSIWYG( sal_Bool bState )
//*****************************************************************************************************************
Sequence< OUString > SvtFontOptions_Impl::impl_GetPropertyNames()
{
- // Build static list of configuration key names.
- static const OUString pProperties[] =
+ // Build list of configuration key names.
+ const OUString pProperties[] =
{
PROPERTYNAME_REPLACEMENTTABLE ,
PROPERTYNAME_FONTHISTORY ,
PROPERTYNAME_FONTWYSIWYG ,
};
// Initialize return sequence with these list ...
- static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
+ const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
// ... and return it.
return seqPropertyNames;
}
diff --git a/unotools/source/config/lingucfg.cxx b/unotools/source/config/lingucfg.cxx
index f6e24b7..358c79a 100644
--- a/unotools/source/config/lingucfg.cxx
+++ b/unotools/source/config/lingucfg.cxx
@@ -171,7 +171,7 @@ class SvtLinguConfigItem : public utl::ConfigItem
SvtLinguConfigItem & operator = ( const SvtLinguConfigItem & );
static sal_Bool GetHdlByName( sal_Int32 &rnHdl, const OUString &rPropertyName, sal_Bool bFullPropName = sal_False );
- static const uno::Sequence< OUString > & GetPropertyNames();
+ static const uno::Sequence< OUString > GetPropertyNames();
sal_Bool LoadOptions( const uno::Sequence< OUString > &rProperyNames );
sal_Bool SaveOptions( const uno::Sequence< OUString > &rProperyNames );
@@ -213,11 +213,12 @@ public:
SvtLinguConfigItem::SvtLinguConfigItem() :
utl::ConfigItem( String::CreateFromAscii( "Office.Linguistic" ) )
{
- LoadOptions( GetPropertyNames() );
+ const uno::Sequence< OUString > &rPropertyNames = GetPropertyNames();
+ LoadOptions( rPropertyNames );
ClearModified();
// request notify events when properties change
- EnableNotification( GetPropertyNames() );
+ EnableNotification( rPropertyNames );
}
@@ -289,31 +290,26 @@ static struct NamesToHdl
};
-const uno::Sequence< OUString > & SvtLinguConfigItem::GetPropertyNames()
+const uno::Sequence< OUString > SvtLinguConfigItem::GetPropertyNames()
{
- static uno::Sequence< OUString > aNames;
- static sal_Bool bInitialized = sal_False;
+ uno::Sequence< OUString > aNames;
- if (!bInitialized)
- {
- sal_Int32 nMax = SAL_N_ELEMENTS(aNamesToHdl);
+ sal_Int32 nMax = SAL_N_ELEMENTS(aNamesToHdl);
- aNames.realloc( nMax );
- OUString *pNames = aNames.getArray();
- sal_Int32 nIdx = 0;
- for (sal_Int32 i = 0; i < nMax; ++i)
- {
- const sal_Char *pFullPropName = aNamesToHdl[i].pFullPropName;
- if (pFullPropName)
- pNames[ nIdx++ ] = ::rtl::OUString::createFromAscii( pFullPropName );
- }
- aNames.realloc( nIdx );
- bInitialized = sal_True;
+ aNames.realloc( nMax );
+ OUString *pNames = aNames.getArray();
+ sal_Int32 nIdx = 0;
+ for (sal_Int32 i = 0; i < nMax; ++i)
+ {
+ const sal_Char *pFullPropName = aNamesToHdl[i].pFullPropName;
+ if (pFullPropName)
+ pNames[ nIdx++ ] = ::rtl::OUString::createFromAscii( pFullPropName );
}
+ aNames.realloc( nIdx );
+
return aNames;
}
-
sal_Bool SvtLinguConfigItem::GetHdlByName(
sal_Int32 &rnHdl,
const OUString &rPropertyName,
diff --git a/unotools/source/config/localisationoptions.cxx b/unotools/source/config/localisationoptions.cxx
index 8c1be26..a8f1bf8 100644
--- a/unotools/source/config/localisationoptions.cxx
+++ b/unotools/source/config/localisationoptions.cxx
@@ -329,19 +329,16 @@ void SvtLocalisationOptions_Impl::SetDialogScale( sal_Int32 nScale )
SetModified();
}
-//*****************************************************************************************************************
-// private method
-//*****************************************************************************************************************
Sequence< OUString > SvtLocalisationOptions_Impl::GetPropertyNames()
{
// Build static list of configuration key names.
- static const OUString pProperties[] =
+ const OUString aProperties[] =
{
PROPERTYNAME_AUTOMNEMONIC ,
PROPERTYNAME_DIALOGSCALE ,
};
// Initialize return sequence with these list ...
- static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
+ Sequence< OUString > seqPropertyNames(aProperties, PROPERTYCOUNT);
// ... and return it.
return seqPropertyNames;
}
diff --git a/unotools/source/config/misccfg.cxx b/unotools/source/config/misccfg.cxx
index d25f1fd..4e345e9 100644
--- a/unotools/source/config/misccfg.cxx
+++ b/unotools/source/config/misccfg.cxx
@@ -63,7 +63,7 @@ class SfxMiscCfg : public utl::ConfigItem
sal_Bool bNotFound;
sal_Int32 nYear2000; // two digit year representation
- const com::sun::star::uno::Sequence<rtl::OUString>& GetPropertyNames();
+ const com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames();
void Load();
public:
@@ -132,37 +132,29 @@ void SfxMiscCfg::SetYear2000( sal_Int32 nSet )
nYear2000 = nSet;
}
-const Sequence<OUString>& SfxMiscCfg::GetPropertyNames()
+const Sequence<OUString> SfxMiscCfg::GetPropertyNames()
{
- static Sequence<OUString> aNames;
- if(!aNames.getLength())
+ const OUString pProperties[] =
{
- static const char* aPropNames[] =
- {
- "Print/Warning/PaperSize", // 0
- "Print/Warning/PaperOrientation", // 1
- "Print/Warning/NotFound", // 2
- "DateFormat/TwoDigitYear", // 3
- };
- const int nCount = 4;
- aNames.realloc(nCount);
- OUString* pNames = aNames.getArray();
- for(int i = 0; i < nCount; i++)
- pNames[i] = OUString::createFromAscii(aPropNames[i]);
- }
- return aNames;
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Print/Warning/PaperSize")),
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Print/Warning/PaperOrientation")),
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Print/Warning/NotFound")),
+ OUString(RTL_CONSTASCII_USTRINGPARAM("DateFormat/TwoDigitYear"))
+ };
+ const Sequence< OUString > seqPropertyNames( pProperties, 4 );
+ return seqPropertyNames;
}
void SfxMiscCfg::Load()
{
- const Sequence<OUString>& aNames = GetPropertyNames();
- Sequence<Any> aValues = GetProperties(aNames);
- EnableNotification(aNames);
+ const Sequence<OUString>& rNames = GetPropertyNames();
+ Sequence<Any> aValues = GetProperties(rNames);
+ EnableNotification(rNames);
const Any* pValues = aValues.getConstArray();
- DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
- if(aValues.getLength() == aNames.getLength())
+ DBG_ASSERT(aValues.getLength() == rNames.getLength(), "GetProperties failed");
+ if(aValues.getLength() == rNames.getLength())
{
- for(int nProp = 0; nProp < aNames.getLength(); nProp++)
+ for(int nProp = 0; nProp < rNames.getLength(); nProp++)
{
if(pValues[nProp].hasValue())
{
@@ -185,12 +177,12 @@ void SfxMiscCfg::Notify( const com::sun::star::uno::Sequence<rtl::OUString>& )
void SfxMiscCfg::Commit()
{
- const Sequence<OUString>& aNames = GetPropertyNames();
- Sequence<Any> aValues(aNames.getLength());
+ const Sequence<OUString>& rNames = GetPropertyNames();
+ Sequence<Any> aValues(rNames.getLength());
Any* pValues = aValues.getArray();
const Type& rType = ::getBooleanCppuType();
- for(int nProp = 0; nProp < aNames.getLength(); nProp++)
+ for(int nProp = 0; nProp < rNames.getLength(); nProp++)
{
switch(nProp)
{
@@ -200,7 +192,7 @@ void SfxMiscCfg::Commit()
case 3: pValues[nProp] <<= nYear2000;break; //"DateFormat/TwoDigitYear",
}
}
- PutProperties(aNames, aValues);
+ PutProperties(rNames, aValues);
}
// -----------------------------------------------------------------------
namespace
diff --git a/unotools/source/config/printwarningoptions.cxx b/unotools/source/config/printwarningoptions.cxx
index abc55f5..64cc55d 100644
--- a/unotools/source/config/printwarningoptions.cxx
+++ b/unotools/source/config/printwarningoptions.cxx
@@ -244,8 +244,8 @@ void SvtPrintWarningOptions_Impl::Notify( const Sequence< rtl::OUString >& )
//*****************************************************************************************************************
Sequence< OUString > SvtPrintWarningOptions_Impl::impl_GetPropertyNames()
{
- // Build static list of configuration key names.
- static const OUString pProperties[] =
+ // Build list of configuration key names.
+ const OUString pProperties[] =
{
PROPERTYNAME_PAPERSIZE,
PROPERTYNAME_PAPERORIENTATION,
@@ -255,7 +255,7 @@ Sequence< OUString > SvtPrintWarningOptions_Impl::impl_GetPropertyNames()
};
// Initialize return sequence with these list ...
- static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
+ const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
return seqPropertyNames;
}
diff --git a/unotools/source/config/securityoptions.cxx b/unotools/source/config/securityoptions.cxx
index 8d2fe8a..1b213ad 100644
--- a/unotools/source/config/securityoptions.cxx
+++ b/unotools/source/config/securityoptions.cxx
@@ -1024,7 +1024,7 @@ sal_Bool SvtSecurityOptions_Impl::IsOptionEnabled( SvtSecurityOptions::EOption e
Sequence< OUString > SvtSecurityOptions_Impl::GetPropertyNames()
{
// Build static list of configuration key names.
- static const OUString pProperties[] =
+ const OUString pProperties[] =
{
PROPERTYNAME_SECUREURL,
PROPERTYNAME_STAROFFICEBASIC,
@@ -1043,7 +1043,7 @@ Sequence< OUString > SvtSecurityOptions_Impl::GetPropertyNames()
PROPERTYNAME_MACRO_DISABLE
};
// Initialize return sequence with these list ...
- static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
+ const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
// ... and return it.
return seqPropertyNames;
}
diff --git a/unotools/source/config/startoptions.cxx b/unotools/source/config/startoptions.cxx
index 44b6959..8817712 100644
--- a/unotools/source/config/startoptions.cxx
+++ b/unotools/source/config/startoptions.cxx
@@ -334,14 +334,14 @@ void SvtStartOptions_Impl::SetConnectionURL( const OUString& sURL )
//*****************************************************************************************************************
Sequence< OUString > SvtStartOptions_Impl::impl_GetPropertyNames()
{
- // Build static list of configuration key names.
- static const OUString pProperties[] =
+ // Build list of configuration key names.
+ const OUString pProperties[] =
{
PROPERTYNAME_SHOWINTRO ,
PROPERTYNAME_CONNECTIONURL ,
};
// Initialize return sequence with these list ...
- static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
+ const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
// ... and return it.
return seqPropertyNames;
}
diff --git a/unotools/source/config/syslocaleoptions.cxx b/unotools/source/config/syslocaleoptions.cxx
index 0697942..e92f8af 100644
--- a/unotools/source/config/syslocaleoptions.cxx
+++ b/unotools/source/config/syslocaleoptions.cxx
@@ -147,14 +147,14 @@ public:
const Sequence< OUString > SvtSysLocaleOptions_Impl::GetPropertyNames()
{
- static const OUString pProperties[] =
+ const OUString pProperties[] =
{
PROPERTYNAME_LOCALE,
PROPERTYNAME_UILOCALE,
PROPERTYNAME_CURRENCY,
PROPERTYNAME_DECIMALSEPARATOR
};
- static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
+ const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
return seqPropertyNames;
}
diff --git a/unotools/source/config/workingsetoptions.cxx b/unotools/source/config/workingsetoptions.cxx
index 8e5e421..d90d413 100644
--- a/unotools/source/config/workingsetoptions.cxx
+++ b/unotools/source/config/workingsetoptions.cxx
@@ -290,13 +290,13 @@ void SvtWorkingSetOptions_Impl::SetWindowList( const Sequence< OUString >& seqWi
//*****************************************************************************************************************
Sequence< OUString > SvtWorkingSetOptions_Impl::GetPropertyNames()
{
- // Build static list of configuration key names.
- static const OUString pProperties[] =
+ // Build list of configuration key names.
+ const OUString pProperties[] =
{
PROPERTYNAME_WINDOWLIST ,
};
// Initialize return sequence with these list ...
- static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
+ const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
// ... and return it.
return seqPropertyNames;
}
commit 6f994f373b733d6b3a52bd110e7c0862672e3636
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue May 31 22:22:58 2011 +0100
use comphelper pattern here
diff --git a/toolkit/inc/toolkit/helper/macros.hxx b/toolkit/inc/toolkit/helper/macros.hxx
index 087c2d9..0ed4fbf 100644
--- a/toolkit/inc/toolkit/helper/macros.hxx
+++ b/toolkit/inc/toolkit/helper/macros.hxx
@@ -29,7 +29,7 @@
#ifndef _TOOLKIT_HELPER_MACROS_HXX_
#define _TOOLKIT_HELPER_MACROS_HXX_
-// -------------------------------------------------------------------------------------
+#include <comphelper/servicehelper.hxx>
#define IMPL_XUNOTUNNEL( ClassName ) \
sal_Int64 ClassName::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException) \
@@ -40,20 +40,13 @@ sal_Int64 ClassName::getSomething( const ::com::sun::star::uno::Sequence< sal_In
} \
return 0; \
} \
+namespace \
+{ \
+ class the##ClassName##UnoTunnelId : public rtl::Static< UnoTunnelIdInit, the##ClassName##UnoTunnelId> {}; \
+} \
const ::com::sun::star::uno::Sequence< sal_Int8 >& ClassName::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 the##ClassName##UnoTunnelId::get().getSeq(); \
} \
ClassName* ClassName::GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw() \
{ \
@@ -70,20 +63,13 @@ sal_Int64 ClassName::getSomething( const ::com::sun::star::uno::Sequence< sal_In
} \
return BaseClass::getSomething( rIdentifier ); \
} \
+namespace \
+{ \
+ class the##ClassName##UnoTunnelId : public rtl::Static< UnoTunnelIdInit, the##ClassName##UnoTunnelId> {}; \
+} \
const ::com::sun::star::uno::Sequence< sal_Int8 >& ClassName::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 the##ClassName##UnoTunnelId::get().getSeq(); \
} \
ClassName* ClassName::GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw() \
{ \
commit 9d82e25024c173a5d45be7d2d69a8d6f68f017c7
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue May 31 22:21:44 2011 +0100
add Sequence header
diff --git a/comphelper/inc/comphelper/servicehelper.hxx b/comphelper/inc/comphelper/servicehelper.hxx
index 81b0050..9879b5c 100644
--- a/comphelper/inc/comphelper/servicehelper.hxx
+++ b/comphelper/inc/comphelper/servicehelper.hxx
@@ -31,6 +31,7 @@
#include <rtl/uuid.h>
#include <rtl/instance.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
class UnoTunnelIdInit
{
commit 7b10d3db22eab3d53497383e12a7920e198bca44
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue May 31 15:59:03 2011 +0100
make this a well-behaved singleton
diff --git a/comphelper/source/misc/namedvaluecollection.cxx b/comphelper/source/misc/namedvaluecollection.cxx
index 4c08f8d..a22a461 100644
--- a/comphelper/source/misc/namedvaluecollection.cxx
+++ b/comphelper/source/misc/namedvaluecollection.cxx
@@ -30,14 +30,13 @@
#include "precompiled_comphelper.hxx"
#include <comphelper/namedvaluecollection.hxx>
-/** === begin UNO includes === **/
#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <com/sun/star/beans/PropertyState.hpp>
-/** === end UNO includes === **/
#include <rtl/ustrbuf.hxx>
#include <rtl/strbuf.hxx>
+#include <rtl/instance.hxx>
#include <osl/diagnose.h>
#include <boost/unordered_map.hpp>
@@ -277,6 +276,11 @@ namespace comphelper
return false;
}
+ namespace
+ {
+ class theEmptyDefault : public rtl::Static<Any, theEmptyDefault> {};
+ }
+
//--------------------------------------------------------------------
const Any& NamedValueCollection::impl_get( const ::rtl::OUString& _rValueName ) const
{
@@ -284,8 +288,7 @@ namespace comphelper
if ( pos != m_pImpl->aValues.end() )
return pos->second;
- static Any aEmptyDefault;
- return aEmptyDefault;
+ return theEmptyDefault::get();
}
//--------------------------------------------------------------------
commit 49c6f65db90deb2316ea5725b0c62507886ea130
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue May 31 15:00:54 2011 +0100
extend this to headless plugin as well
diff --git a/vcl/unx/generic/gdi/gcach_xpeer.cxx b/vcl/unx/generic/gdi/gcach_xpeer.cxx
index 30104af..2625750 100644
--- a/vcl/unx/generic/gdi/gcach_xpeer.cxx
+++ b/vcl/unx/generic/gdi/gcach_xpeer.cxx
@@ -679,11 +679,11 @@ namespace
release();
}
};
-}
-struct theGlyphCacheHolder :
- public rtl::Static<GlyphCacheHolder, theGlyphCacheHolder>
-{};
+ struct theGlyphCacheHolder :
+ public rtl::Static<GlyphCacheHolder, theGlyphCacheHolder>
+ {};
+}
X11GlyphCache& X11GlyphCache::GetInstance()
{
diff --git a/vcl/unx/headless/svptext.cxx b/vcl/unx/headless/svptext.cxx
index c4b6efc..981dc34 100644
--- a/vcl/unx/headless/svptext.cxx
+++ b/vcl/unx/headless/svptext.cxx
@@ -77,19 +77,49 @@ protected:
class SvpGlyphCache : public GlyphCache
{
public:
- SvpGlyphPeer& GetPeer() { return reinterpret_cast<SvpGlyphPeer&>( mrPeer ); }
-static SvpGlyphCache& GetInstance();
-private:
SvpGlyphCache( SvpGlyphPeer& rPeer ) : GlyphCache( rPeer) {}
+ SvpGlyphPeer& GetPeer() { return reinterpret_cast<SvpGlyphPeer&>( mrPeer ); }
+ static SvpGlyphCache& GetInstance();
};
-//--------------------------------------------------------------------------
+namespace
+{
+ struct GlyphCacheHolder
+ {
+ private:
+ SvpGlyphPeer* m_pSvpGlyphPeer;
+ SvpGlyphCache* m_pSvpGlyphCache;
+ public:
+ GlyphCacheHolder()
+ {
+ m_pSvpGlyphPeer = new SvpGlyphPeer();
+ m_pSvpGlyphCache = new SvpGlyphCache( *m_pSvpGlyphPeer );
+ }
+ void release()
+ {
+ delete m_pSvpGlyphCache;
+ delete m_pSvpGlyphPeer;
+ m_pSvpGlyphCache = NULL;
+ m_pSvpGlyphPeer = NULL;
+ }
+ SvpGlyphCache& getGlyphCache()
+ {
+ return *m_pSvpGlyphCache;
+ }
+ ~GlyphCacheHolder()
+ {
+ release();
+ }
+ };
+
+ struct theGlyphCacheHolder :
+ public rtl::Static<GlyphCacheHolder, theGlyphCacheHolder>
+ {};
+}
SvpGlyphCache& SvpGlyphCache::GetInstance()
{
- static SvpGlyphPeer aSvpGlyphPeer;
- static SvpGlyphCache aGC( aSvpGlyphPeer );
- return aGC;
+ return theGlyphCacheHolder::get().getGlyphCache();
}
// ===========================================================================
commit 546a90a202b6603ad25533bd7187751b251d5495
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon May 30 15:31:27 2011 +0100
use well behaved singletons
diff --git a/unotools/inc/unotools/fontcfg.hxx b/unotools/inc/unotools/fontcfg.hxx
index 75b23a4..784d03e 100644
--- a/unotools/inc/unotools/fontcfg.hxx
+++ b/unotools/inc/unotools/fontcfg.hxx
@@ -93,8 +93,8 @@ class UNOTOOLS_DLLPUBLIC DefaultFontConfiguration
rtl::OUString tryLocale( const com::sun::star::lang::Locale& rLocale, const rtl::OUString& rType ) const;
- DefaultFontConfiguration();
public:
+ DefaultFontConfiguration();
~DefaultFontConfiguration();
static DefaultFontConfiguration& get();
@@ -207,8 +207,8 @@ private:
unsigned long getSubstType( const com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > xFont,
const rtl::OUString& rType ) const;
void readLocaleSubst( const com::sun::star::lang::Locale& rLocale ) const;
- FontSubstConfiguration();
public:
+ FontSubstConfiguration();
~FontSubstConfiguration();
static FontSubstConfiguration& get();
diff --git a/unotools/source/config/fontcfg.cxx b/unotools/source/config/fontcfg.cxx
index e8749cb..809c5ba 100644
--- a/unotools/source/config/fontcfg.cxx
+++ b/unotools/source/config/fontcfg.cxx
@@ -37,6 +37,7 @@
#include <unotools/configpathes.hxx>
#include <unotools/syslocale.hxx>
#include <rtl/ustrbuf.hxx>
+#include <rtl/instance.hxx>
#include <sal/macros.h>
#include <tools/debug.hxx>
@@ -96,10 +97,18 @@ static const char* getKeyType( int nKeyType )
}
}
+namespace
+{
+ class theDefaultFontConfiguration
+ : public rtl::Static<DefaultFontConfiguration,
+ theDefaultFontConfiguration>
+ {
+ };
+}
+
DefaultFontConfiguration& DefaultFontConfiguration::get()
{
- static DefaultFontConfiguration aDefaultFontConfiguration;
- return aDefaultFontConfiguration;
+ return theDefaultFontConfiguration::get();
}
DefaultFontConfiguration::DefaultFontConfiguration()
@@ -370,10 +379,17 @@ OUString DefaultFontConfiguration::getUserInterfaceFont( const Locale& rLocale )
* FontSubstConfigItem::get
*/
+namespace
+{
+ class theFontSubstConfiguration
+ : public rtl::Static<FontSubstConfiguration, theFontSubstConfiguration>
+ {
+ };
+}
+
FontSubstConfiguration& FontSubstConfiguration::get()
{
- static FontSubstConfiguration aFontSubstConfiguration;
- return aFontSubstConfiguration;
+ return theFontSubstConfiguration::get();
}
/*
commit f5f7b0d021560cda5e54f4a9d2f1174e247d0d54
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon May 30 11:40:19 2011 +0100
call dispose
diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx
index 0f42fe7..fc81cc9 100644
--- a/i18npool/qa/cppunit/test_breakiterator.cxx
+++ b/i18npool/qa/cppunit/test_breakiterator.cxx
@@ -200,6 +200,7 @@ void TestBreakIterator::setUp()
TestBreakIterator::~TestBreakIterator()
{
+ uno::Reference< lang::XComponent >(m_xContext, uno::UNO_QUERY_THROW)->dispose();
}
void TestBreakIterator::tearDown()
More information about the Libreoffice-commits
mailing list