diff options
author | Tomas O'Connor <toconnor@openoffice.org> | 2003-01-21 14:40:49 +0000 |
---|---|---|
committer | Tomas O'Connor <toconnor@openoffice.org> | 2003-01-21 14:40:49 +0000 |
commit | dacfe05ba0be605908350be80f1558609aa31690 (patch) | |
tree | f250a3e2f43008ecfaf924e9e7a7ed9d839da4fa /scripting | |
parent | 3dd0fb60bc2c8d246bcabcb063955e077c04b6b6 (diff) |
IssueZilla 10518 - Add BeanShell scripting support
Diffstat (limited to 'scripting')
-rw-r--r-- | scripting/source/runtimemgr/ScriptNameResolverImpl.cxx | 18 | ||||
-rwxr-xr-x | scripting/source/runtimemgr/ScriptRuntimeManager.cxx | 16 |
2 files changed, 22 insertions, 12 deletions
diff --git a/scripting/source/runtimemgr/ScriptNameResolverImpl.cxx b/scripting/source/runtimemgr/ScriptNameResolverImpl.cxx index ed62cf89f7d0..f927b4bc1fab 100644 --- a/scripting/source/runtimemgr/ScriptNameResolverImpl.cxx +++ b/scripting/source/runtimemgr/ScriptNameResolverImpl.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ScriptNameResolverImpl.cxx,v $ * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * - * last change: $Author: dfoster $ $Date: 2002-11-06 16:26:30 $ + * last change: $Author: toconnor $ $Date: 2003-01-21 15:40:49 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -80,7 +80,7 @@ using namespace ::drafts::com::sun::star::script::framework; namespace scripting_runtimemgr { -const sal_Char* const LANGUAGE_TO_RESOLVE_ON = "Java"; // should be configurable +const sal_Char* const LANGUAGE_TO_RESOLVE_ON[] = { "Java", "BeanShell" }; // should be configurable OUString nrs_implName = OUString::createFromAscii( "drafts.com.sun.star.script.framework.DefaultScriptNameResolver" ); OUString nrs_serviceName = OUString::createFromAscii( @@ -348,11 +348,13 @@ SAL_THROW ( ( lang::IllegalArgumentException, RuntimeException ) ) // just choose first one that has language=LANGUAGE_TO_RESOLVE_ON ::rtl::OUString language( scriptInfo->getLanguage() ); - if ( ( language.compareToAscii( LANGUAGE_TO_RESOLVE_ON ) == 0 ) ) - { - OSL_TRACE( "Found desired language\n" ); - resolvedScriptInfo = scriptInfo; - break; + for ( sal_Int32 i = (sizeof LANGUAGE_TO_RESOLVE_ON / sizeof *LANGUAGE_TO_RESOLVE_ON); i--; ) { + if ( ( language.compareToAscii( LANGUAGE_TO_RESOLVE_ON[i] ) == 0 ) ) + { + OSL_TRACE( "Found desired language\n" ); + resolvedScriptInfo = scriptInfo; + break; + } } } } diff --git a/scripting/source/runtimemgr/ScriptRuntimeManager.cxx b/scripting/source/runtimemgr/ScriptRuntimeManager.cxx index f806b3ef3fbc..3c112266e2ec 100755 --- a/scripting/source/runtimemgr/ScriptRuntimeManager.cxx +++ b/scripting/source/runtimemgr/ScriptRuntimeManager.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ScriptRuntimeManager.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: dfoster $ $Date: 2002-11-06 16:26:31 $ + * last change: $Author: toconnor $ $Date: 2003-01-21 15:40:49 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -129,8 +129,16 @@ throw( RuntimeException ) try { Reference< XInterface > xInterface; - Any a = m_xContext->getValueByName( OUString::createFromAscii( - "/singletons/drafts.com.sun.star.script.framework.theScriptRuntimeForJava" ) ); + + Reference< storage::XScriptInfo > sinfo = + Reference< storage::XScriptInfo >( scriptInfo, UNO_QUERY_THROW ); + + OUStringBuffer *buf = new OUStringBuffer(80); + buf->appendAscii("/singletons/drafts.com.sun.star.script.framework.theScriptRuntimeFor"); + buf->append(sinfo->getLanguage()); + + Any a = m_xContext->getValueByName(buf->makeStringAndClear()); + if ( sal_False == ( a >>= xInterface ) ) { throw RuntimeException( |