diff options
-rw-r--r-- | basic/source/basmgr/basmgr.cxx | 12 | ||||
-rw-r--r-- | basic/source/classes/sb.cxx | 5 | ||||
-rw-r--r-- | include/basic/basmgr.hxx | 4 | ||||
-rw-r--r-- | include/basic/sbstar.hxx | 2 | ||||
-rw-r--r-- | sfx2/source/doc/objxtor.cxx | 18 |
5 files changed, 19 insertions, 22 deletions
diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx index 533fb0cd78ab..4ac855666ff2 100644 --- a/basic/source/basmgr/basmgr.cxx +++ b/basic/source/basmgr/basmgr.cxx @@ -1458,17 +1458,17 @@ bool BasicManager::IsBasicModified() const } -bool BasicManager::GetGlobalUNOConstant( const sal_Char* _pAsciiName, uno::Any& aOut ) +bool BasicManager::GetGlobalUNOConstant( const OUString& rName, uno::Any& aOut ) { bool bRes = false; StarBASIC* pStandardLib = GetStdLib(); OSL_PRECOND( pStandardLib, "BasicManager::GetGlobalUNOConstant: no lib to read from!" ); if ( pStandardLib ) - bRes = pStandardLib->GetUNOConstant( _pAsciiName, aOut ); + bRes = pStandardLib->GetUNOConstant( rName, aOut ); return bRes; } -uno::Any BasicManager::SetGlobalUNOConstant( const sal_Char* _pAsciiName, const uno::Any& _rValue ) +uno::Any BasicManager::SetGlobalUNOConstant( const OUString& rName, const uno::Any& _rValue ) { uno::Any aOldValue; @@ -1477,14 +1477,12 @@ uno::Any BasicManager::SetGlobalUNOConstant( const sal_Char* _pAsciiName, const if ( !pStandardLib ) return aOldValue; - OUString sVarName( OUString::createFromAscii( _pAsciiName ) ); - // obtain the old value - SbxVariable* pVariable = pStandardLib->Find( sVarName, SbxCLASS_OBJECT ); + SbxVariable* pVariable = pStandardLib->Find( rName, SbxCLASS_OBJECT ); if ( pVariable ) aOldValue = sbxToUnoValue( pVariable ); - SbxObjectRef xUnoObj = GetSbUnoObject( sVarName, _rValue ); + SbxObjectRef xUnoObj = GetSbUnoObject( rName, _rValue ); xUnoObj->SetFlag( SbxFlagBits::DontStore ); pStandardLib->Insert( xUnoObj ); diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx index 7e4323ae5917..a470547d192a 100644 --- a/basic/source/classes/sb.cxx +++ b/basic/source/classes/sb.cxx @@ -1921,11 +1921,10 @@ bool StarBASIC::StoreData( SvStream& r ) const return true; } -bool StarBASIC::GetUNOConstant( const sal_Char* _pAsciiName, css::uno::Any& aOut ) +bool StarBASIC::GetUNOConstant( const OUString& rName, css::uno::Any& aOut ) { bool bRes = false; - OUString sVarName( OUString::createFromAscii( _pAsciiName ) ); - SbUnoObject* pGlobs = dynamic_cast<SbUnoObject*>( Find( sVarName, SbxCLASS_DONTCARE ) ); + SbUnoObject* pGlobs = dynamic_cast<SbUnoObject*>( Find( rName, SbxCLASS_DONTCARE ) ); if ( pGlobs ) { aOut = pGlobs->getUnoAny(); diff --git a/include/basic/basmgr.hxx b/include/basic/basmgr.hxx index 7277585dccf2..8b65beff4e27 100644 --- a/include/basic/basmgr.hxx +++ b/include/basic/basmgr.hxx @@ -185,10 +185,10 @@ public: returned. If it does not yet exist, it is newly created, and inserted into the basic library. */ css::uno::Any - SetGlobalUNOConstant( const sal_Char* _pAsciiName, const css::uno::Any& _rValue ); + SetGlobalUNOConstant( const OUString& rName, const css::uno::Any& _rValue ); /** retrieves a global constant in the basic library, referring to some UNO object, returns true if a value is found ( value is in aOut ) false otherwise. */ - bool GetGlobalUNOConstant( const sal_Char* _pAsciiName, css::uno::Any& aOut ); + bool GetGlobalUNOConstant( const OUString& rName, css::uno::Any& aOut ); /** determines whether there are password-protected modules whose size exceedes the legacy module size @param _out_rModuleNames diff --git a/include/basic/sbstar.hxx b/include/basic/sbstar.hxx index 670e597b4ecc..a0e23453ba8a 100644 --- a/include/basic/sbstar.hxx +++ b/include/basic/sbstar.hxx @@ -155,7 +155,7 @@ public: SbxObjectRef getRTL() { return pRtl; } bool IsDocBasic() { return bDocBasic; } SbxVariable* VBAFind( const OUString& rName, SbxClassType t ); - bool GetUNOConstant( const sal_Char* _pAsciiName, css::uno::Any& aOut ); + bool GetUNOConstant( const OUString& rName, css::uno::Any& aOut ); void QuitAndExitApplication(); bool IsQuitApplication() { return bQuit; }; diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index 6f6963080a32..5f2ff89adc0b 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -118,10 +118,10 @@ class theCurrentComponent : public rtl::Static< WeakReference< XInterface >, the #if HAVE_FEATURE_SCRIPTING // remember all registered components for VBA compatibility, to be able to remove them on disposing the model -typedef ::std::map< XInterface*, OString > VBAConstantNameMap; +typedef ::std::map< XInterface*, OUString > VBAConstantNameMap; static VBAConstantNameMap s_aRegisteredVBAConstants; -OString lclGetVBAGlobalConstName( const Reference< XInterface >& rxComponent ) +OUString lclGetVBAGlobalConstName( const Reference< XInterface >& rxComponent ) { OSL_ENSURE( rxComponent.is(), "lclGetVBAGlobalConstName - missing component" ); @@ -134,12 +134,12 @@ OString lclGetVBAGlobalConstName( const Reference< XInterface >& rxComponent ) { OUString aConstName; xProps->getPropertyValue("VBAGlobalConstantName") >>= aConstName; - return OUStringToOString( aConstName, RTL_TEXTENCODING_ASCII_US ); + return aConstName; } catch (const uno::Exception&) // not supported { } - return OString(); + return OUString(); } #endif @@ -190,7 +190,7 @@ void SAL_CALL SfxModelListener_Impl::disposing( const css::lang::EventObject& _r if ( aIt != s_aRegisteredVBAConstants.end() ) { if ( BasicManager* pAppMgr = SfxApplication::GetBasicManager() ) - pAppMgr->SetGlobalUNOConstant( aIt->second.getStr(), Any( Reference< XInterface >() ) ); + pAppMgr->SetGlobalUNOConstant( aIt->second, Any( Reference< XInterface >() ) ); s_aRegisteredVBAConstants.erase( aIt ); } } @@ -933,20 +933,20 @@ void SfxObjectShell::SetCurrentComponent( const Reference< XInterface >& _rxComp // set new current component for VBA compatibility if ( _rxComponent.is() ) { - OString aVBAConstName = lclGetVBAGlobalConstName( _rxComponent ); + OUString aVBAConstName = lclGetVBAGlobalConstName( _rxComponent ); if ( !aVBAConstName.isEmpty() ) { - pAppMgr->SetGlobalUNOConstant( aVBAConstName.getStr(), Any( _rxComponent ) ); + pAppMgr->SetGlobalUNOConstant( aVBAConstName, Any( _rxComponent ) ); s_aRegisteredVBAConstants[ _rxComponent.get() ] = aVBAConstName; } } // no new component passed -> remove last registered VBA component else if ( xOldCurrentComp.is() ) { - OString aVBAConstName = lclGetVBAGlobalConstName( xOldCurrentComp ); + OUString aVBAConstName = lclGetVBAGlobalConstName( xOldCurrentComp ); if ( !aVBAConstName.isEmpty() ) { - pAppMgr->SetGlobalUNOConstant( aVBAConstName.getStr(), Any( Reference< XInterface >() ) ); + pAppMgr->SetGlobalUNOConstant( aVBAConstName, Any( Reference< XInterface >() ) ); s_aRegisteredVBAConstants.erase( xOldCurrentComp.get() ); } } |