summaryrefslogtreecommitdiff
path: root/static
diff options
context:
space:
mode:
authorStephan Bergmann <stephan.bergmann@allotropia.de>2024-07-25 16:59:33 +0200
committerStephan Bergmann <stephan.bergmann@allotropia.de>2024-07-25 18:37:58 +0200
commitdd332f72ce68d2a6109e390b8e45e84143d10960 (patch)
tree117a30c595e4eecab9f0f3cf17c80fea1fff780d /static
parent33ea719d6c6ad23dfca088853d95d5688782da2d (diff)
Enable start center in Emscripten build
...and let it open with that instead of with a hard-coded example.odt. (But keep that example.odt in CustomTarget,static_emscripten_fs_image and adapt the example code in static/README.wasm.md to explicitly load it now.) Change-Id: Ie43e3795e44542acba5a8e755f65acc56fa753f8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171019 Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de> Tested-by: Jenkins
Diffstat (limited to 'static')
-rw-r--r--static/README.wasm.md20
-rw-r--r--static/emscripten/soffice_args.js4
2 files changed, 19 insertions, 5 deletions
diff --git a/static/README.wasm.md b/static/README.wasm.md
index a28a23efac67..4cf0688d0796 100644
--- a/static/README.wasm.md
+++ b/static/README.wasm.md
@@ -182,7 +182,15 @@ Some usage examples through javascript of the current implementation:
// inserts a string at the start of the Writer document.
Module.uno_init.then(function() {
const css = Module.uno.com.sun.star;
- const xModel = Module.getCurrentModelFromViewSh();
+ let xModel = Module.getCurrentModelFromViewSh();
+ if (xModel === null || !css.text.XTextDocument.query(xModel)) {
+ const desktop = css.frame.Desktop.create(Module.getUnoComponentContext());
+ const args = new Module.uno_Sequence_com$sun$star$beans$PropertyValue(
+ 0, Module.uno_Sequence.FromSize);
+ xModel = css.frame.XComponentLoader.query(desktop).loadComponentFromURL(
+ 'file:///android/default-document/example.odt', '_default', 0, args);
+ args.delete();
+ }
const xTextDocument = css.text.XTextDocument.query(xModel);
const xText = xTextDocument.getText();
const xTextCursor = xText.createTextCursor();
@@ -194,7 +202,15 @@ Module.uno_init.then(function() {
// changes each paragraph of the Writer document to a random color.
Module.uno_init.then(function() {
const css = Module.uno.com.sun.star;
- const xModel = Module.getCurrentModelFromViewSh();
+ let xModel = Module.getCurrentModelFromViewSh();
+ if (xModel === null || !css.text.XTextDocument.query(xModel)) {
+ const desktop = css.frame.Desktop.create(Module.getUnoComponentContext());
+ const args = new Module.uno_Sequence_com$sun$star$beans$PropertyValue(
+ 0, Module.uno_Sequence.FromSize);
+ xModel = css.frame.XComponentLoader.query(desktop).loadComponentFromURL(
+ 'file:///android/default-document/example.odt', '_default', 0, args);
+ args.delete();
+ }
const xTextDocument = css.text.XTextDocument.query(xModel);
const xText = xTextDocument.getText();
const xEnumAccess = css.container.XEnumerationAccess.query(xText);
diff --git a/static/emscripten/soffice_args.js b/static/emscripten/soffice_args.js
index 6881741bdf0b..7656c7edee7e 100644
--- a/static/emscripten/soffice_args.js
+++ b/static/emscripten/soffice_args.js
@@ -2,7 +2,5 @@
Module['arguments'] = [
'--norestore',
- '--nologo',
- '--writer',
- '/android/default-document/example.odt'
+ '--nologo'
];