this.xMSF = xMSF;
Object oInterface = xMSF.createInstance(
"com.sun.star.frame.Desktop");
XDesktop oDesktop = (XDesktop) UnoRuntime.queryInterface(
XDesktop.class, oInterface);
XComponentLoader oCLoader = (XComponentLoader)
UnoRuntime.queryInterface(
XComponentLoader.class, oDesktop);
// load BasicBridge with MarcoEceutionMode = Always-no warn
//PropertyValue[] DocArgs = null;
PropertyValue[] DocArgs = new PropertyValue[1];
PropertyValue DocArg = new PropertyValue();
DocArg.Name = "MacroExecutionMode";
DocArg.Value = new Short(
com.sun.star.document.MacroExecMode.ALWAYS_EXECUTE_NO_WARN);
DocArgs[0] = DocArg;
// configure Office to allow to execute macos
PropertyValue [] ProvArgs = new PropertyValue [1];
PropertyValue Arg = new PropertyValue();
Arg.Name = "nodepath";
Arg.Value = "/org.openoffice.Office.Common/Security";
ProvArgs[0] = Arg;
Object oProvider = xMSF.createInstance(
"com.sun.star.configuration.ConfigurationProvider");
XMultiServiceFactory oProviderMSF = (XMultiServiceFactory)
UnoRuntime.queryInterface(
XMultiServiceFactory.class, oProvider);
Object oSecure = oProviderMSF.createInstanceWithArguments(
"com.sun.star.configuration.ConfigurationUpdateAccess",
ProvArgs);
XPropertySet oSecureProps = (XPropertySet)
UnoRuntime.queryInterface(XPropertySet.class, oSecure);
Object oScripting = oSecureProps.getPropertyValue("Scripting");
XPropertySet oScriptingSettings = (XPropertySet)
UnoRuntime.queryInterface(XPropertySet.class, oScripting);
oScriptingSettings.setPropertyValue("Warning", Boolean.FALSE);
oScriptingSettings.setPropertyValue("OfficeBasic", new Integer(2));
XChangesBatch oSecureChange = (XChangesBatch)
UnoRuntime.queryInterface(XChangesBatch.class, oSecure);
oSecureChange.commitChanges();
// As we want to have some information about a debugFile
// BEFORE connection is established
// we pass the information about it in frame name.
String sFrameName = (String)tParam.get(
"soapi.test.basic.debugFile");
if (sFrameName == null) sFrameName = "BasicRunner";
oHandlerDoc = oCLoader.loadComponentFromURL(sBasicBridgeURL,
sFrameName, 40, DocArgs);
do {
respFlag = false ;
wait(10000); // waiting for basic response for 10 seconds.