diff options
-rw-r--r-- | basic/inc/basic/sbstar.hxx | 2 | ||||
-rw-r--r-- | basic/source/classes/sb.cxx | 16 | ||||
-rw-r--r-- | basic/source/classes/sbunoobj.cxx | 20 | ||||
-rw-r--r-- | basic/source/runtime/step0.cxx | 20 | ||||
-rw-r--r-- | sfx2/source/doc/objxtor.cxx | 12 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/databases.cxx | 31 |
6 files changed, 50 insertions, 51 deletions
diff --git a/basic/inc/basic/sbstar.hxx b/basic/inc/basic/sbstar.hxx index 1b0cd71972c4..6a75304ee9f2 100644 --- a/basic/inc/basic/sbstar.hxx +++ b/basic/inc/basic/sbstar.hxx @@ -172,7 +172,7 @@ public: SbxObjectRef getRTL( void ) { return pRtl; } sal_Bool IsDocBasic() { return bDocBasic; } - SbxVariable* VBAFind( const String& rName, SbxClassType t ); + SbxVariable* VBAFind( const rtl::OUString& rName, SbxClassType t ); bool GetUNOConstant( const sal_Char* _pAsciiName, ::com::sun::star::uno::Any& aOut ); void QuitAndExitApplication(); sal_Bool IsQuitApplication() { return bQuit; }; diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx index 85358089e665..1a625bdb9a75 100644 --- a/basic/source/classes/sb.cxx +++ b/basic/source/classes/sb.cxx @@ -230,10 +230,9 @@ SbxObject* StarBASIC::getVBAGlobals( ) } // i#i68894# -SbxVariable* StarBASIC::VBAFind( const String& rName, SbxClassType t ) +SbxVariable* StarBASIC::VBAFind( const rtl::OUString& rName, SbxClassType t ) { - const static String aThisComponent( RTL_CONSTASCII_USTRINGPARAM("ThisComponent") ); - if( rName == aThisComponent ) + if( rName == "ThisComponent" ) return NULL; // rename to init globals if ( getVBAGlobals( ) ) @@ -778,15 +777,13 @@ SbxVariable* SbClassModuleObject::Find( const rtl::OUString& rName, SbxClassType void SbClassModuleObject::triggerInitializeEvent( void ) { - static String aInitMethodName( RTL_CONSTASCII_USTRINGPARAM("Class_Initialize") ); - if( mbInitializeEventDone ) return; mbInitializeEventDone = true; // Search method - SbxVariable* pMeth = SbxObject::Find( aInitMethodName, SbxCLASS_METHOD ); + SbxVariable* pMeth = SbxObject::Find(rtl::OUString("Class_Initialize"), SbxCLASS_METHOD); if( pMeth ) { SbxValues aVals; @@ -796,13 +793,11 @@ void SbClassModuleObject::triggerInitializeEvent( void ) void SbClassModuleObject::triggerTerminateEvent( void ) { - static String aTermMethodName( RTL_CONSTASCII_USTRINGPARAM("Class_Terminate") ); - if( !mbInitializeEventDone || GetSbData()->bRunInit ) return; // Search method - SbxVariable* pMeth = SbxObject::Find( aTermMethodName, SbxCLASS_METHOD ); + SbxVariable* pMeth = SbxObject::Find( rtl::OUString("Class_Terminate"), SbxCLASS_METHOD ); if( pMeth ) { SbxValues aVals; @@ -1264,8 +1259,6 @@ void StarBASIC::DeInitAllModules( void ) // If this fails again a conventional search over objects is performend. SbxVariable* StarBASIC::Find( const rtl::OUString& rName, SbxClassType t ) { - static String aMainStr( RTL_CONSTASCII_USTRINGPARAM("Main") ); - SbxVariable* pRes = NULL; SbModule* pNamed = NULL; // "Extended" search in Runtime Lib @@ -1314,6 +1307,7 @@ SbxVariable* StarBASIC::Find( const rtl::OUString& rName, SbxClassType t ) break; } } + rtl::OUString aMainStr("Main"); if( !pRes && pNamed && ( t == SbxCLASS_METHOD || t == SbxCLASS_DONTCARE ) && !pNamed->GetName().EqualsIgnoreCaseAscii( aMainStr ) ) pRes = pNamed->Find( aMainStr, SbxCLASS_METHOD ); diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index 4a8a8f73a9f1..b9ec529876b2 100644 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -30,8 +30,9 @@ #include <comphelper/extract.hxx> #include <comphelper/processfactory.hxx> -#include <rtl/ustrbuf.hxx> +#include <rtl/instance.hxx> #include <rtl/strbuf.hxx> +#include <rtl/ustrbuf.hxx> #include <com/sun/star/script/ArrayWrapper.hpp> #include <com/sun/star/script/NativeObjectWrapper.hpp> @@ -530,32 +531,35 @@ struct ObjectItem : m_xNativeObj( pNativeObj ) {} }; -static std::vector< ObjectItem > GaNativeObjectWrapperVector; + +typedef std::vector< ObjectItem > NativeObjectWrapperVector; +class GaNativeObjectWrapperVector : public rtl::Static<NativeObjectWrapperVector, GaNativeObjectWrapperVector> {}; void clearNativeObjectWrapperVector( void ) { - GaNativeObjectWrapperVector.clear(); + GaNativeObjectWrapperVector::get().clear(); } sal_uInt32 lcl_registerNativeObjectWrapper( SbxObject* pNativeObj ) { - sal_uInt32 nIndex = GaNativeObjectWrapperVector.size(); - GaNativeObjectWrapperVector.push_back( ObjectItem( pNativeObj ) ); + NativeObjectWrapperVector &rNativeObjectWrapperVector = GaNativeObjectWrapperVector::get(); + sal_uInt32 nIndex = rNativeObjectWrapperVector.size(); + rNativeObjectWrapperVector.push_back( ObjectItem( pNativeObj ) ); return nIndex; } SbxObject* lcl_getNativeObject( sal_uInt32 nIndex ) { SbxObjectRef xRetObj; - if( nIndex < GaNativeObjectWrapperVector.size() ) + NativeObjectWrapperVector &rNativeObjectWrapperVector = GaNativeObjectWrapperVector::get(); + if( nIndex < rNativeObjectWrapperVector.size() ) { - ObjectItem& rItem = GaNativeObjectWrapperVector[ nIndex ]; + ObjectItem& rItem = rNativeObjectWrapperVector[ nIndex ]; xRetObj = rItem.m_xNativeObj; } return xRetObj; } - // convert from Uno to Sbx SbxDataType unoToSbxType( TypeClass eType ) { diff --git a/basic/source/runtime/step0.cxx b/basic/source/runtime/step0.cxx index d2bc2d5b4669..9a48a9beafbb 100644 --- a/basic/source/runtime/step0.cxx +++ b/basic/source/runtime/step0.cxx @@ -30,6 +30,7 @@ #include "image.hxx" #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/util/SearchOptions.hpp> +#include <rtl/instance.hxx> #include <vcl/svapp.hxx> #include <unotools/textsearch.hxx> @@ -459,13 +460,14 @@ struct SbxVariablePtrHash typedef boost::unordered_map< SbxVariable*, DimAsNewRecoverItem, SbxVariablePtrHash > DimAsNewRecoverHash; -static DimAsNewRecoverHash GaDimAsNewRecoverHash; +class GaDimAsNewRecoverHash : public rtl::Static<DimAsNewRecoverHash, GaDimAsNewRecoverHash> {}; void removeDimAsNewRecoverItem( SbxVariable* pVar ) { - DimAsNewRecoverHash::iterator it = GaDimAsNewRecoverHash.find( pVar ); - if( it != GaDimAsNewRecoverHash.end() ) - GaDimAsNewRecoverHash.erase( it ); + DimAsNewRecoverHash &rDimAsNewRecoverHash = GaDimAsNewRecoverHash::get(); + DimAsNewRecoverHash::iterator it = rDimAsNewRecoverHash.find( pVar ); + if( it != rDimAsNewRecoverHash.end() ) + rDimAsNewRecoverHash.erase( it ); } @@ -620,8 +622,9 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b if( xPrevVarObj.Is() ) { // Object is overwritten with NULL, instantiate init object - DimAsNewRecoverHash::iterator it = GaDimAsNewRecoverHash.find( refVar ); - if( it != GaDimAsNewRecoverHash.end() ) + DimAsNewRecoverHash &rDimAsNewRecoverHash = GaDimAsNewRecoverHash::get(); + DimAsNewRecoverHash::iterator it = rDimAsNewRecoverHash.find( refVar ); + if( it != rDimAsNewRecoverHash.end() ) { const DimAsNewRecoverItem& rItem = it->second; if( rItem.m_pClassModule != NULL ) @@ -654,15 +657,16 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b String aObjClass = pValObj->GetClassName(); SbClassModuleObject* pClassModuleObj = PTR_CAST(SbClassModuleObject,pValObjBase); + DimAsNewRecoverHash &rDimAsNewRecoverHash = GaDimAsNewRecoverHash::get(); if( pClassModuleObj != NULL ) { SbModule* pClassModule = pClassModuleObj->getClassModule(); - GaDimAsNewRecoverHash[refVar] = + rDimAsNewRecoverHash[refVar] = DimAsNewRecoverItem( aObjClass, pValObj->GetName(), pValObj->GetParent(), pClassModule ); } else if( aObjClass.EqualsIgnoreCaseAscii( "Collection" ) ) { - GaDimAsNewRecoverHash[refVar] = + rDimAsNewRecoverHash[refVar] = DimAsNewRecoverItem( aObjClass, pValObj->GetName(), pValObj->GetParent(), NULL ); } } diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index c6e3acdfa98e..a9bb168863c6 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -31,7 +31,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/frame/XTitle.hpp> #include <osl/mutex.hxx> - +#include <rtl/instance.hxx> #include <vcl/msgbox.hxx> #include <vcl/wrkwin.hxx> #include <vcl/svapp.hxx> @@ -115,7 +115,7 @@ DBG_NAME(SfxObjectShell) namespace { -static WeakReference< XInterface > s_xCurrentComponent; +class theCurrentComponent : public rtl::Static< WeakReference< XInterface >, theCurrentComponent > {}; #ifndef DISABLE_SCRIPTING @@ -932,7 +932,9 @@ sal_uInt16 SfxObjectShell::GetAutoStyleFilterIndex() void SfxObjectShell::SetCurrentComponent( const Reference< XInterface >& _rxComponent ) { - Reference< XInterface > xOldCurrentComp(s_xCurrentComponent); + WeakReference< XInterface >& rTheCurrentComponent = theCurrentComponent::get(); + + Reference< XInterface > xOldCurrentComp(rTheCurrentComponent); if ( _rxComponent == xOldCurrentComp ) // nothing to do return; @@ -943,7 +945,7 @@ void SfxObjectShell::SetCurrentComponent( const Reference< XInterface >& _rxComp #ifndef DISABLE_SCRIPTING BasicManager* pAppMgr = SFX_APP()->GetBasicManager(); - s_xCurrentComponent = _rxComponent; + rTheCurrentComponent = _rxComponent; if ( pAppMgr ) { // set "ThisComponent" for Basic @@ -975,7 +977,7 @@ void SfxObjectShell::SetCurrentComponent( const Reference< XInterface >& _rxComp Reference< XInterface > SfxObjectShell::GetCurrentComponent() { - return s_xCurrentComponent; + return theCurrentComponent::get(); } diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx index 51ef2cb2ebce..69f02c10869d 100644 --- a/xmlhelp/source/cxxhelp/provider/databases.cxx +++ b/xmlhelp/source/cxxhelp/provider/databases.cxx @@ -82,8 +82,6 @@ using namespace com::sun::star::deployment; using namespace com::sun::star::beans; -static rtl::OUString aSlash("/"); - rtl::OUString Databases::expandURL( const rtl::OUString& aURL ) { osl::MutexGuard aGuard( m_aMutex ); @@ -600,7 +598,7 @@ Db* Databases::getBerkeley( const rtl::OUString& Database, rtl::OUString aFileExt( helpText ? rtl::OUString(".ht") : rtl::OUString(".db") ); - rtl::OUString dbFileName = aSlash + Database + aFileExt; + rtl::OUString dbFileName = rtl::OUStringBuffer().append('/').append(Database).append(aFileExt).makeStringAndClear(); rtl::OUString key; if( pExtensionPath == NULL ) key = processLang( Language ) + dbFileName; @@ -1027,7 +1025,7 @@ Reference< XHierarchicalNameAccess > Databases::jarFile( const rtl::OUString& ja { return Reference< XHierarchicalNameAccess >( 0 ); } - rtl::OUString key = processLang(Language) + aSlash + jar; + rtl::OUString key = rtl::OUStringBuffer(processLang(Language)).append('/').append(jar).makeStringAndClear(); osl::MutexGuard aGuard( m_aMutex ); @@ -1049,7 +1047,7 @@ Reference< XHierarchicalNameAccess > Databases::jarFile( const rtl::OUString& ja rtl::OUStringBuffer aStrBuf; aStrBuf.append( aExtensionPath ); - aStrBuf.append( aSlash ); + aStrBuf.append( '/' ); aStrBuf.append( aPureJar ); zipFile = expandURL( aStrBuf.makeStringAndClear() ); @@ -1618,11 +1616,11 @@ rtl::OUString ExtensionIteratorBase::implGetFileFromPackage( { rtl::OUStringBuffer aStrBuf; aStrBuf.append( xPackage->getRegistrationDataURL().Value); - aStrBuf.append( aSlash ); + aStrBuf.append( '/' ); aStrBuf.append( aLanguage ); if( !bLangFolderOnly ) { - aStrBuf.append( aSlash ); + aStrBuf.append( '/' ); aStrBuf.append( "help" ); aStrBuf.append( rFileExtension ); } @@ -1765,8 +1763,7 @@ Db* DataBaseIterator::implGetDbFromPackage( Reference< deployment::XPackage > xP Db* pRetDb = NULL; if (optRegData.IsPresent && !optRegData.Value.isEmpty()) { - rtl::OUString aRegDataUrl(optRegData.Value); - aRegDataUrl += aSlash; + rtl::OUString aRegDataUrl = rtl::OUStringBuffer(optRegData.Value).append('/').makeStringAndClear(); rtl::OUString aHelpFilesBaseName("help"); @@ -1798,7 +1795,7 @@ Db* DataBaseIterator::implGetDbFromPackage( Reference< deployment::XPackage > xP *o_pExtensionPath = aRegDataUrl + aUsedLanguage; if( o_pExtensionRegistryPath ) - *o_pExtensionRegistryPath = xPackage->getURL() + aSlash + aUsedLanguage; + *o_pExtensionRegistryPath = rtl::OUStringBuffer(xPackage->getURL()).append('/').append(aUsedLanguage).makeStringAndClear(); } return pRetDb; @@ -1818,10 +1815,9 @@ rtl::OUString KeyDataBaseFileIterator::nextDbFile( bool& o_rbExtension ) switch( m_eState ) { case INITIAL_MODULE: - aRetFile = - m_rDatabases.getInstallPathAsURL() + - m_rDatabases.processLang( m_aLanguage ) + aSlash + m_aInitialModule + - rtl::OUString( ".key" ); + aRetFile = rtl::OUStringBuffer(m_rDatabases.getInstallPathAsURL()). + append(m_rDatabases.processLang(m_aLanguage)).append('/'). + append(m_aInitialModule).append(".key").makeStringAndClear(); o_rbExtension = false; @@ -2022,10 +2018,9 @@ rtl::OUString IndexFolderIterator::nextIndexFolder( bool& o_rbExtension, bool& o switch( m_eState ) { case INITIAL_MODULE: - aIndexFolder = - m_rDatabases.getInstallPathAsURL() + - m_rDatabases.processLang( m_aLanguage ) + aSlash + m_aInitialModule + - rtl::OUString( ".idxl" ); + aIndexFolder = rtl::OUStringBuffer(m_rDatabases.getInstallPathAsURL()). + append(m_rDatabases.processLang(m_aLanguage)).append('/'). + append(m_aInitialModule).append(".idxl").makeStringAndClear(); o_rbTemporary = false; o_rbExtension = false; |