Kaydet (Commit) dacfe05b authored tarafından Tomas O'Connor's avatar Tomas O'Connor

IssueZilla 10518 - Add BeanShell scripting support

üst 3dd0fb60
......@@ -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;
}
}
}
}
......
......@@ -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(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment