Kaydet (Commit) bb6939cc authored tarafından Katarina Behrens's avatar Katarina Behrens Kaydeden (comit) Stephan Bergmann

tdf#86784: Pass custom options to Java bootstrap

Reviewed-on: https://gerrit.libreoffice.org/20720Reviewed-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
Tested-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
(cherry picked from commit 02002f83)

Change-Id: I9e9c78387627e173dea8062e4a3f16bc396e8115
Reviewed-on: https://gerrit.libreoffice.org/20802Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
Tested-by: 's avatarStephan Bergmann <sbergman@redhat.com>
üst 01ef568c
......@@ -90,6 +90,34 @@ public class Bootstrap {
"com.sun.star.comp.connections.Acceptor", null, null, null ) );
}
/**
* Returns an array of default commandline options to start bootstrapped
* instance of soffice with. You may use it in connection with bootstrap
* method for example like this:
* <pre>
* List list = Arrays.asList( Bootstrap.getDefaultOptions() );
* list.remove("--nologo");
* list.remove("--nodefault");
* list.add("--invisible");
*
* Bootstrap.bootstrap( list.toArray( new String[list.size()] );
* </pre>
*
* @return an array of default commandline options
* @see #bootstrap( String[] )
* @since LibreOffice 5.1
*/
public static final String[] getDefaultOptions()
{
return new String[]
{
"--nologo",
"--nodefault",
"--norestore",
"--nolockcheck"
};
}
/**
* backwards compatibility stub.
*/
......@@ -247,6 +275,24 @@ public class Bootstrap {
public static final XComponentContext bootstrap()
throws BootstrapException {
String[] defaultArgArray = getDefaultOptions();
return bootstrap( defaultArgArray );
}
/**
* Bootstraps the component context from a UNO installation.
*
* @param argArray
* an array of strings - commandline options to start instance of
* soffice with
* @see #getDefaultOptions()
* @return a bootstrapped component context.
*
* @since LibreOffice 5.1
*/
public static final XComponentContext bootstrap( String[] argArray )
throws BootstrapException {
XComponentContext xContext = null;
try {
......@@ -270,13 +316,11 @@ public class Bootstrap {
Long.toString( (new Random()).nextLong() & 0x7fffffffffffffffL );
// create call with arguments
String[] cmdArray = new String[] {
fOffice.getPath(),
"--nologo",
"--nodefault",
"--norestore",
"--nolockcheck",
"--accept=pipe,name=" + sPipeName + ";urp;" };
String[] cmdArray = new String[ argArray.length + 2 ];
cmdArray[0] = fOffice.getPath();
cmdArray[1] = ( "--accept=pipe,name=" + sPipeName + ";urp;" );
System.arraycopy( argArray, 0, cmdArray, 2, argArray.length );
// start office process
Process p = Runtime.getRuntime().exec( cmdArray );
......
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