@unieai/libreoffice-kit-wasm 0.0.0-stage → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +7 -2
  2. package/assets/dsoffice.cjs +26 -0
  3. package/assets/dsoffice.data +0 -0
  4. package/assets/dsoffice.data.js.metadata +1 -0
  5. package/assets/dsoffice.wasm +4 -0
  6. package/assets/manifest.json +1888 -0
  7. package/licenses/LICENSE +4666 -0
  8. package/licenses/NOTICE +63 -0
  9. package/licenses/Rabi-Harness-MIT.txt +28 -0
  10. package/package.json +22 -4
  11. package/prebuilds.json +128 -0
  12. package/sources/build-autogen.input +35 -0
  13. package/sources/core-source.json +4 -0
  14. package/sources/docs/ui-resources.md +123 -0
  15. package/sources/engine/build-identity.mjs +49 -0
  16. package/sources/engine/core-source.mjs +27 -0
  17. package/sources/engine/document-operations.hxx +51 -0
  18. package/sources/engine/ui-resource-policy.mjs +33 -0
  19. package/sources/engine/wasm-source/autogen.input +33 -0
  20. package/sources/engine/wasm-source/build.mjs +300 -0
  21. package/sources/engine/wasm-source/lok.cxx +428 -0
  22. package/sources/engine/wasm-source/patches/0001-macos-build-tools.patch +87 -0
  23. package/sources/engine/wasm-source/patches/0002-system-font-demand.patch +322 -0
  24. package/sources/engine/wasm-source/patches/0003-node-runtime.patch +99 -0
  25. package/sources/engine/wasm-source/patches/0004-system-fonts-only.patch +10 -0
  26. package/sources/engine/wasm-source/patches/0005-cross-build-rules.patch +46 -0
  27. package/sources/engine/wasm-source/patches/0006-wasm-external-platforms.patch +55 -0
  28. package/sources/engine/wasm-source/patches/0008-disable-link-updates.patch +30 -0
  29. package/sources/engine/wasm-source/patches/0009-disable-optional-curl.patch +11 -0
  30. package/sources/engine/wasm-source/patches/0010-refresh-component-registry.patch +11 -0
  31. package/sources/engine/wasm-source/patches/0011-preserve-optimization-with-prefix-maps.patch +21 -0
  32. package/sources/engine/wasm-source/patches/0012-anonymize-explicit-source-paths.patch +39 -0
  33. package/sources/engine/wasm-source/patches/0023-pdfium-for-embedded-graphics.patch +14 -0
  34. package/sources/engine/wasm-source/patches/0024-pdfium-emscripten-platform.patch +11 -0
  35. package/sources/engine/wasm-source/patches/0025-browser-editing.patch +18 -0
  36. package/sources/engine/wasm-source/patches/0028-synchronous-workbook-calculation.patch +64 -0
  37. package/sources/engine/wasm-source/patches/0029-unloaded-external-blip.patch +21 -0
  38. package/sources/engine/wasm-source/patches/0030-no-password-strength-ui.patch +117 -0
  39. package/sources/engine/wasm-source/patches/0031-size-optimization-lto.patch +26 -0
  40. package/sources/engine/wasm-source/patches/0047-defer-offscreen-canvas-output.patch +59 -0
  41. package/sources/engine/wasm-source/slim.mjs +74 -0
  42. package/sources/engine/wasm-source/source.json +16 -0
  43. package/sources/engine/wasm-source/source.mjs +12 -0
  44. package/sources/engine/wasm-source/stage.mjs +91 -0
  45. package/sources/scripts/checkout-wasm.mjs +24 -0
  46. package/sources/scripts/core-checkout.mjs +39 -0
  47. package/sources/scripts/minimize-ui-resources.py +198 -0
  48. package/sources/scripts/pack-utils.mjs +69 -0
  49. package/sources/scripts/platform-matrix.mjs +122 -0
  50. package/sources/scripts/verify-artifacts.mjs +261 -0
  51. package/sources/source-changes.patch +1081 -0
@@ -0,0 +1,322 @@
1
+ diff --git a/vcl/inc/font/PhysicalFontCollection.hxx b/vcl/inc/font/PhysicalFontCollection.hxx
2
+ index b5509b8f6..81e195a49 100644
3
+ --- a/vcl/inc/font/PhysicalFontCollection.hxx
4
+ +++ b/vcl/inc/font/PhysicalFontCollection.hxx
5
+ @@ -29,6 +29,10 @@
6
+
7
+ #include <array>
8
+ #include <string_view>
9
+ +#if defined __EMSCRIPTEN__
10
+ +#include <unordered_set>
11
+ +#include <vector>
12
+ +#endif
13
+
14
+ #define MAX_GLYPHFALLBACK 16
15
+
16
+ @@ -81,6 +85,12 @@ public:
17
+ SAL_DLLPRIVATE std::unique_ptr<vcl::font::PhysicalFontFaceCollection> GetFontFaceCollection() const;
18
+
19
+ private:
20
+ +#if defined __EMSCRIPTEN__
21
+ + mutable std::unordered_set<OUString> maDemandFontFiles;
22
+ + mutable std::unordered_set<OUString> maDemandFontFamilies;
23
+ + std::vector<OUString> EnsureSystemFonts(const vcl::font::FontSelectPattern&,
24
+ + const OUString& rMissingCodes, bool& rAdded) const;
25
+ +#endif
26
+ mutable bool mbMatchData; // true if matching attributes are initialized
27
+
28
+ typedef std::unordered_map<OUString, std::unique_ptr<vcl::font::PhysicalFontFamily>> PhysicalFontFamilies;
29
+ diff --git a/vcl/inc/unx/freetypetextrender.hxx b/vcl/inc/unx/freetypetextrender.hxx
30
+ index e3bba325c..4b0a1d624 100644
31
+ --- a/vcl/inc/unx/freetypetextrender.hxx
32
+ +++ b/vcl/inc/unx/freetypetextrender.hxx
33
+ @@ -49,6 +49,9 @@ public:
34
+ virtual bool AddTempDevFont( vcl::font::PhysicalFontCollection*, const OUString& rFileURL, const OUString& rFontName ) override;
35
+ virtual bool RemoveTempDevFont( const OUString& rFileURL, const OUString& rFontName ) override;
36
+
37
+ + static bool RegisterFontFile(vcl::font::PhysicalFontCollection*, const OUString& rFileURL,
38
+ + const OUString& rFontName);
39
+ +
40
+ virtual std::unique_ptr<GenericSalLayout>
41
+ GetTextLayout(int nFallbackLevel) override;
42
+ };
43
+ diff --git a/vcl/source/font/PhysicalFontCollection.cxx b/vcl/source/font/PhysicalFontCollection.cxx
44
+ index 5ce7a60cb..2f0a0d3ea 100644
45
+ --- a/vcl/source/font/PhysicalFontCollection.cxx
46
+ +++ b/vcl/source/font/PhysicalFontCollection.cxx
47
+ @@ -31,6 +31,15 @@
48
+ #include <font/PhysicalFontCollection.hxx>
49
+ #include <font/fontsubstitution.hxx>
50
+
51
+ +#if defined __EMSCRIPTEN__
52
+ +#include <cstdlib>
53
+ +#include <stdexcept>
54
+ +#include <emscripten.h>
55
+ +#include <osl/file.hxx>
56
+ +#include <rtl/ustrbuf.hxx>
57
+ +#include <unx/freetypetextrender.hxx>
58
+ +#endif
59
+ +
60
+ static ImplFontAttrs lcl_IsCJKFont( std::u16string_view rFontName )
61
+ {
62
+ // Test, if Fontname includes CJK characters --> In this case we
63
+ @@ -68,6 +77,110 @@ static ImplFontAttrs lcl_IsCJKFont( std::u16string_view rFontName )
64
+ namespace vcl::font
65
+ {
66
+
67
+ +#if defined __EMSCRIPTEN__
68
+ +std::vector<OUString> PhysicalFontCollection::EnsureSystemFonts(
69
+ + const FontSelectPattern& rPattern, const OUString& rMissingCodes, bool& rAdded) const
70
+ +{
71
+ + rAdded = false;
72
+ + const OUString aLanguage = LanguageTag(rPattern.meLanguage).getBcp47();
73
+ + char aError[4096] = {};
74
+ + int nFatal = 0;
75
+ + // The resolver runs on the runtime's JS thread, including when layout runs in a pthread.
76
+ + // It may read host files and write MEMFS, but must not reenter LibreOffice.
77
+ + auto* pPaths = static_cast<char*>(MAIN_THREAD_EM_ASM_PTR({
78
+ + try {
79
+ + const resolver = Module['rabiResolveSystemFonts'];
80
+ + const faceResolver = Module['rabiResolveSystemFontFaces'];
81
+ + if (typeof faceResolver !== 'function' && typeof resolver !== 'function')
82
+ + throw new Error('LibreOffice system font resolver is not configured');
83
+ + const request = ({
84
+ + family: UTF16ToString($0),
85
+ + style: UTF16ToString($1),
86
+ + weight: $2,
87
+ + italic: $3,
88
+ + width: $4,
89
+ + pitch: $5,
90
+ + language: UTF16ToString($6),
91
+ + codePoints: Array.from(UTF16ToString($7), char => char.codePointAt(0))
92
+ + });
93
+ + const faces = typeof faceResolver === 'function' ? faceResolver(request)
94
+ + : resolver(request).map(path => ({ path, family: "" }));
95
+ + const invalid = value => typeof value !== 'string' || ([0, 9, 10, 13]).some(code =>
96
+ + value.includes(String.fromCharCode(code)));
97
+ + if (!Array.isArray(faces) || faces.some(face => !face || invalid(face.path)
98
+ + || !face.path.startsWith('/') || invalid(face.family)))
99
+ + throw new TypeError('LibreOffice font resolver must return MEMFS face records synchronously');
100
+ + if (faces.length === 0)
101
+ + return 0;
102
+ + const records = faces.map(face => face.path + String.fromCharCode(9) + face.family);
103
+ + const bytes = new TextEncoder().encode(records.join(String.fromCharCode(10)) + String.fromCharCode(0));
104
+ + const pointer = Module['_malloc'](bytes.length);
105
+ + if (!pointer)
106
+ + throw new Error('LibreOffice system font response allocation failed');
107
+ + HEAPU8.set(bytes, pointer);
108
+ + return pointer;
109
+ + } catch (error) {
110
+ + if (error instanceof WebAssembly.RuntimeError) {
111
+ + if (typeof Module['onAbort'] === 'function')
112
+ + Module['onAbort'](error);
113
+ + HEAP32[$10 >> 2] = 1;
114
+ + return 0;
115
+ + }
116
+ + stringToUTF8('LibreOffice system font callback failed: ' + String(error), $8, $9);
117
+ + return 0;
118
+ + }
119
+ + }, rPattern.GetFamilyName().getStr(), rPattern.GetStyleName().getStr(),
120
+ + static_cast<int>(rPattern.GetWeight()), static_cast<int>(rPattern.GetItalic()),
121
+ + static_cast<int>(rPattern.GetWidthType()), static_cast<int>(rPattern.GetPitch()),
122
+ + aLanguage.getStr(), rMissingCodes.getStr(), aError, sizeof(aError), &nFatal));
123
+ + // WASM traps bypass C++ unwinding; an aborted engine cannot safely allocate an exception.
124
+ + if (nFatal)
125
+ + __builtin_trap();
126
+ + // EM_ASM imports are nothrow; construct the C++ exception only after returning from JS.
127
+ + if (aError[0] != '\0')
128
+ + throw std::runtime_error(aError);
129
+ + std::unique_ptr<char, decltype(&std::free)> aOwnedPaths(pPaths, std::free);
130
+ + if (!pPaths)
131
+ + return {};
132
+ +
133
+ + std::vector<OUString> aFamilies;
134
+ + const OUString aPaths = OUString::fromUtf8(pPaths);
135
+ + sal_Int32 nPosition = 0;
136
+ + do
137
+ + {
138
+ + const OUString aRecord = aPaths.getToken(0, '\n', nPosition);
139
+ + const sal_Int32 nSeparator = aRecord.indexOf('\t');
140
+ + if (nSeparator < 0)
141
+ + throw std::runtime_error("LibreOffice received an invalid font face record");
142
+ + const OUString aPath = aRecord.copy(0, nSeparator);
143
+ + const OUString aFamily = aRecord.copy(nSeparator + 1);
144
+ + if (!aFamily.isEmpty())
145
+ + {
146
+ + aFamilies.push_back(aFamily);
147
+ + maDemandFontFamilies.insert(GetEnglishSearchFontName(aFamily));
148
+ + }
149
+ + if (maDemandFontFiles.find(aPath) != maDemandFontFiles.end())
150
+ + continue;
151
+ + OUString aFileURL;
152
+ + if (osl::FileBase::getFileURLFromSystemPath(aPath, aFileURL) != osl::FileBase::E_None
153
+ + || !FreeTypeTextRenderImpl::RegisterFontFile(
154
+ + const_cast<PhysicalFontCollection*>(this), aFileURL, aFamily))
155
+ + throw std::runtime_error("LibreOffice could not register a supplied system font");
156
+ + maDemandFontFiles.insert(aPath);
157
+ + rAdded = true;
158
+ + } while (nPosition >= 0);
159
+ +
160
+ + if (rAdded)
161
+ + {
162
+ + // Active layout objects keep their font faces; only derived matching data becomes stale.
163
+ + mbMatchData = false;
164
+ + mpFallbackList.reset();
165
+ + mnFallbackCount = -1;
166
+ + }
167
+ + return aFamilies;
168
+ +}
169
+ +#endif
170
+ +
171
+ PhysicalFontCollection::PhysicalFontCollection()
172
+ : mbMatchData( false )
173
+ , mpPreMatchHook( nullptr )
174
+ @@ -92,6 +205,10 @@ void PhysicalFontCollection::SetFallbackHook(GlyphFallbackFontSubstitution* pHoo
175
+
176
+ void PhysicalFontCollection::Clear()
177
+ {
178
+ +#if defined __EMSCRIPTEN__
179
+ + maDemandFontFiles.clear();
180
+ + maDemandFontFamilies.clear();
181
+ +#endif
182
+ // remove fallback lists
183
+ mpFallbackList.reset();
184
+ mnFallbackCount = -1;
185
+ @@ -185,6 +302,60 @@ PhysicalFontFamily* PhysicalFontCollection::GetGlyphFallbackFont(FontSelectPatte
186
+ OUString& rMissingCodes,
187
+ int nFallbackLevel) const
188
+ {
189
+ +#if defined __EMSCRIPTEN__
190
+ + bool bAdded = false;
191
+ + const auto aFamilies = EnsureSystemFonts(rFontSelData, rMissingCodes, bAdded);
192
+ + if (bAdded)
193
+ + {
194
+ + for (sal_Int32 nIndex = 0; nIndex < rMissingCodes.getLength();)
195
+ + {
196
+ + const sal_UCS4 nCode = rMissingCodes.iterateCodePoints(&nIndex);
197
+ + OUString aFamily;
198
+ + bool bEmbolden;
199
+ + ItalicMatrix aMatrix;
200
+ + if (pFontInstance->GetFallbackForUnicode(nCode, rFontSelData.GetWeight(),
201
+ + &aFamily, &bEmbolden, &aMatrix))
202
+ + pFontInstance->IgnoreFallbackForUnicode(nCode, rFontSelData.GetWeight(), aFamily);
203
+ + }
204
+ + }
205
+ + // Script subsets have distinct families. Choose by cmap instead of asking
206
+ + // Fontconfig to choose among the original font's identically named files.
207
+ + for (const auto& rFamily : aFamilies)
208
+ + {
209
+ + auto* pFamily = FindFontFamily(rFamily);
210
+ + auto* pFace = pFamily ? pFamily->FindBestFontFace(rFontSelData) : nullptr;
211
+ + const FontCharMapRef pMap = pFace ? pFace->GetFontCharMap() : nullptr;
212
+ + if (!pMap)
213
+ + continue;
214
+ + const OUString aSearchName = GetEnglishSearchFontName(rFamily);
215
+ + OUStringBuffer aRemaining;
216
+ + bool bCovered = false;
217
+ + for (sal_Int32 nIndex = 0; nIndex < rMissingCodes.getLength();)
218
+ + {
219
+ + const sal_UCS4 nCode = rMissingCodes.iterateCodePoints(&nIndex);
220
+ + if (!pMap->HasChar(nCode))
221
+ + {
222
+ + aRemaining.appendUtf32(nCode);
223
+ + continue;
224
+ + }
225
+ + bCovered = true;
226
+ + OUString aOldFamily;
227
+ + bool bOldEmbolden;
228
+ + ItalicMatrix aOldMatrix;
229
+ + if (pFontInstance->GetFallbackForUnicode(nCode, rFontSelData.GetWeight(),
230
+ + &aOldFamily, &bOldEmbolden, &aOldMatrix))
231
+ + pFontInstance->IgnoreFallbackForUnicode(nCode, rFontSelData.GetWeight(), aOldFamily);
232
+ + pFontInstance->AddFallbackForUnicode(nCode, rFontSelData.GetWeight(), aSearchName,
233
+ + rFontSelData.mbEmbolden, rFontSelData.maItalicMatrix);
234
+ + }
235
+ + if (bCovered)
236
+ + {
237
+ + rFontSelData.maSearchName = aSearchName;
238
+ + rMissingCodes = aRemaining.makeStringAndClear();
239
+ + return pFamily;
240
+ + }
241
+ + }
242
+ +#endif
243
+ PhysicalFontFamily* pFallbackData = nullptr;
244
+
245
+ // find a matching font candidate for platform specific glyph fallback
246
+ @@ -941,6 +1112,10 @@ std::shared_ptr<PhysicalFontCollection> PhysicalFontCollection::Clone() const
247
+ auto xClonedCollection = std::make_shared<PhysicalFontCollection>();
248
+ xClonedCollection->mpPreMatchHook = mpPreMatchHook;
249
+ xClonedCollection->mpFallbackHook = mpFallbackHook;
250
+ +#if defined __EMSCRIPTEN__
251
+ + xClonedCollection->maDemandFontFiles = maDemandFontFiles;
252
+ + xClonedCollection->maDemandFontFamilies = maDemandFontFamilies;
253
+ +#endif
254
+
255
+ // TODO: clone the config-font attributes too?
256
+ xClonedCollection->mbMatchData = false;
257
+ @@ -1008,6 +1183,20 @@ static bool FindMetricCompatibleFont_impl(FontSelectPattern& rFontSelData)
258
+
259
+ PhysicalFontFamily* PhysicalFontCollection::FindFontFamily(FontSelectPattern& rFSD) const
260
+ {
261
+ +#if defined __EMSCRIPTEN__
262
+ + const OUString aRequested = GetEnglishSearchFontName(rFSD.GetFamilyName());
263
+ + if (maDemandFontFamilies.find(aRequested) != maDemandFontFamilies.end())
264
+ + return FindFontFamily(aRequested);
265
+ + bool bAdded = false;
266
+ + for (const auto& rFamily : EnsureSystemFonts(rFSD, OUString(), bAdded))
267
+ + {
268
+ + if (auto* pFamily = FindFontFamily(rFamily))
269
+ + {
270
+ + rFSD.maSearchName = GetEnglishSearchFontName(rFamily);
271
+ + return pFamily;
272
+ + }
273
+ + }
274
+ +#endif
275
+ // give up if no fonts are available
276
+ if( !Count() )
277
+ return nullptr;
278
+ diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
279
+ index 8a71a2ef0..bdc2dbacf 100644
280
+ --- a/vcl/source/outdev/font.cxx
281
+ +++ b/vcl/source/outdev/font.cxx
282
+ @@ -50,6 +50,7 @@
283
+ #include <font/PhysicalFontFaceCollection.hxx>
284
+ #include <font/PhysicalFontCollection.hxx>
285
+ #include <font/FeatureCollector.hxx>
286
+ +#include <font/FontSelectPattern.hxx>
287
+ #include <impglyphitem.hxx>
288
+ #include <sallayout.hxx>
289
+ #include <salgdi.hxx>
290
+ @@ -650,6 +651,15 @@ void OutputDevice::ImplInitFontList() const
291
+ SAL_INFO( "vcl.gdi", "OutputDevice::ImplInitFontList()" );
292
+ mpGraphics->GetDevFontList(mxFontCollection.get());
293
+
294
+ +#ifdef __EMSCRIPTEN__
295
+ + if (!mxFontCollection->Count())
296
+ + {
297
+ + vcl::font::FontSelectPattern aPattern(maFont, maFont.GetFamilyName(), maFont.GetFontSize(),
298
+ + static_cast<float>(maFont.GetFontSize().Height()));
299
+ + mxFontCollection->FindFontFamily(aPattern);
300
+ + }
301
+ +#endif
302
+ +
303
+ // There is absolutely no way there should be no fonts available on the device
304
+ if( !mxFontCollection->Count() )
305
+ {
306
+ diff --git a/vcl/unx/generic/gdi/freetypetextrender.cxx b/vcl/unx/generic/gdi/freetypetextrender.cxx
307
+ index 2af043a48..4786ce5cc 100644
308
+ --- a/vcl/unx/generic/gdi/freetypetextrender.cxx
309
+ +++ b/vcl/unx/generic/gdi/freetypetextrender.cxx
310
+ @@ -95,6 +95,12 @@ FreeTypeTextRenderImpl::SetTextColor( Color nColor )
311
+
312
+ bool FreeTypeTextRenderImpl::AddTempDevFont(vcl::font::PhysicalFontCollection* pFontCollection,
313
+ const OUString& rFileURL, const OUString& rFontName)
314
+ +{
315
+ + return RegisterFontFile(pFontCollection, rFileURL, rFontName);
316
+ +}
317
+ +
318
+ +bool FreeTypeTextRenderImpl::RegisterFontFile(vcl::font::PhysicalFontCollection* pFontCollection,
319
+ + const OUString& rFileURL, const OUString& rFontName)
320
+ {
321
+ // inform PSP font manager
322
+ psp::PrintFontManager& rMgr = psp::PrintFontManager::get();
@@ -0,0 +1,99 @@
1
+ --- a/desktop/Executable_soffice_bin.mk
2
+ +++ b/desktop/Executable_soffice_bin.mk
3
+ @@ -29,6 +29,17 @@
4
+ ))
5
+
6
+ ifeq ($(OS),EMSCRIPTEN)
7
+ +$(eval $(call gb_Executable_add_ldflags,soffice_bin, \
8
+ + -sMODULARIZE=1 \
9
+ + -sEXPORT_NAME=createLibreOfficeModule \
10
+ + -sENVIRONMENT=web$(COMMA)node$(COMMA)worker \
11
+ + -sSTACK_SIZE=1048576 \
12
+ + -sSTACK_OVERFLOW_CHECK=2 \
13
+ + -sALLOW_MEMORY_GROWTH=1 \
14
+ + -sINITIAL_MEMORY=402653184 \
15
+ + -sMAXIMUM_MEMORY=4294967296 \
16
+ +))
17
+ +
18
+ $(call gb_LinkTarget_get_target,$(call gb_Executable_get_linktarget,soffice_bin)) : $(gb_CustomTarget_workdir)/static/emscripten_fs_image/soffice.data.js.link
19
+
20
+ # don't sort; later can override previous settings!
21
+ --- a/desktop/Library_sofficeapp.mk
22
+ +++ b/desktop/Library_sofficeapp.mk
23
+ @@ -155,4 +155,11 @@
24
+ endif
25
+ endif
26
+
27
+ +ifeq ($(OS),EMSCRIPTEN)
28
+ +$(eval $(call gb_Library_add_defs,sofficeapp,-DDSH_LOK_HEADLESS))
29
+ +$(eval $(call gb_Library_add_exception_objects,sofficeapp, \
30
+ + desktop/source/lib/rabi_wasm \
31
+ +))
32
+ +endif
33
+ +
34
+ # vim: set ts=4 sw=4 et:
35
+ --- a/desktop/source/lib/init.cxx
36
+ +++ b/desktop/source/lib/init.cxx
37
+ @@ -7689,7 +7689,7 @@
38
+ xSFactory.set(xFactory, uno::UNO_QUERY_THROW);
39
+ comphelper::setProcessServiceFactory(xSFactory);
40
+
41
+ -#if defined __EMSCRIPTEN__
42
+ +#if defined __EMSCRIPTEN__ && !defined RABI_LOK_HEADLESS
43
+ initJsUnoScripting();
44
+ #endif
45
+
46
+ --- a/desktop/util/Executable_soffice_bin-emscripten-exports
47
+ +++ b/desktop/util/Executable_soffice_bin-emscripten-exports
48
+ @@ -12,3 +12,40 @@
49
+ _lok_preinit_2
50
+ _malloc
51
+ _free
52
+ +_rabi_lok_initialize
53
+ +_rabi_lok_document_load
54
+ +_rabi_lok_document_save_pdf
55
+ +_rabi_lok_document_export
56
+ +_rabi_lok_document_destroy
57
+ +_rabi_lok_error
58
+ +_rabi_lok_destroy
59
+ +_rabi_lok_document_initialize_rendering
60
+ +_rabi_lok_document_type
61
+ +_rabi_lok_document_parts
62
+ +_rabi_lok_document_page_rectangles
63
+ +_rabi_lok_document_size
64
+ +_rabi_lok_document_tile_mode
65
+ +_rabi_lok_document_paint
66
+ +_rabi_lok_document_save
67
+ +_rabi_lok_document_listen
68
+ +_rabi_lok_document_key
69
+ +_rabi_lok_document_mouse
70
+ +_rabi_lok_document_composition
71
+ +_rabi_lok_document_command
72
+ +_rabi_lok_document_command_values
73
+ +_rabi_lok_document_paste
74
+ +_rabi_lok_document_selection
75
+ +_rabi_lok_document_part
76
+ +_rabi_lok_document_part_name
77
+ +_rabi_lok_document_viewport
78
+ +_rabi_lok_pump
79
+ +_rabi_lok_document_part_info
80
+ +_rabi_lok_document_create_view
81
+ +_rabi_lok_document_get_view
82
+ +_rabi_lok_document_set_view
83
+ +_rabi_lok_document_destroy_view
84
+ +_rabi_pdf_open
85
+ +_rabi_pdf_page_count
86
+ +_rabi_pdf_page_size
87
+ +_rabi_pdf_paint
88
+ +_rabi_pdf_destroy
89
+ --- a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
90
+ +++ b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
91
+ @@ -27,7 +27,7 @@
92
+ # To keep the link time (and memory) down, prevent all rewriting options from wasm-emscripten-finalize
93
+ # See emscripten.py, finalize_wasm, modify_wasm = True
94
+ # So we need WASM_BIGINT=1 and ASSERTIONS=1 (2 implies STACK_OVERFLOW_CHECK)
95
+ -gb_EMSCRIPTEN_LDFLAGS += --bind -s FORCE_FILESYSTEM=1 -s WASM_BIGINT=1 -s ERROR_ON_UNDEFINED_SYMBOLS=1 -s FETCH=1 -s ASSERTIONS=1 -s EXIT_RUNTIME=0 -s EXPORTED_RUNTIME_METHODS=["UTF16ToString","stringToUTF16","UTF8ToString","ccall","cwrap","addOnPreMain","addOnPostRun","registerType","throwBindingError","ClassHandle","HEAPU16","HEAPU32"$(if $(ENABLE_QT6),$(COMMA)"FS"$(COMMA)"callMain"$(COMMA)"specialHTMLTargets")]
96
+ +gb_EMSCRIPTEN_LDFLAGS += --bind -s FORCE_FILESYSTEM=1 -s WASM_BIGINT=1 -s ERROR_ON_UNDEFINED_SYMBOLS=1 -s FETCH=1 -s ASSERTIONS=1 -s EXIT_RUNTIME=0 -s EXPORTED_RUNTIME_METHODS=["UTF16ToString","stringToUTF16","UTF8ToString","ccall","cwrap","addOnPreMain","addOnPostRun","registerType","throwBindingError","ClassHandle","HEAPU16","HEAPU32","FS","ENV","PThread"$(if $(ENABLE_QT6),$(COMMA)"FS"$(COMMA)"callMain"$(COMMA)"specialHTMLTargets")]
97
+ gb_EMSCRIPTEN_QTDEFS := -DQT_NO_LINKED_LIST -DQT_NO_JAVA_STYLE_ITERATORS -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB
98
+
99
+ ifeq ($(ENABLE_EMSCRIPTEN_JSPI),TRUE)
@@ -0,0 +1,10 @@
1
+ --- a/static/CustomTarget_emscripten_fs_image.mk
2
+ +++ b/static/CustomTarget_emscripten_fs_image.mk
3
+ @@ -1703,7 +1703,6 @@
4
+ $(INSTROOT)/$(LIBO_SHARE_PRESETS_FOLDER)/config/autotbl.fmt \
5
+ $(INSTROOT)/$(LIBO_SHARE_PRESETS_FOLDER)/gallery/sg30.sdv \
6
+ $(INSTROOT)/$(LIBO_SHARE_PRESETS_FOLDER)/gallery/sg30.thm \
7
+ - $(INSTROOT)/$(LIBO_SHARE_RESOURCE_FOLDER)/common/fonts/opens___.ttf \
8
+ $(INSTROOT)/$(LIBO_URE_ETC_FOLDER)/$(call gb_Helper_get_rcfile,uno) \
9
+ $(INSTROOT)/$(LIBO_URE_MISC_FOLDER)/services.rdb \
10
+ $(SRCDIR)/android/default-document/example.odt \
@@ -0,0 +1,46 @@
1
+ --- a/solenv/bin/concat-deps.c
2
+ +++ b/solenv/bin/concat-deps.c
3
+ @@ -1091,7 +1091,7 @@
4
+ created_line = generate_phony_line(src_relative, "o");
5
+ rc = generate_phony_file(fn, created_line);
6
+ }
7
+ - else if(strncmp(src_relative, "GenAsmObject/", 14) == 0)
8
+ + else if(strncmp(src_relative, "GenAsmObject/", 13) == 0)
9
+ {
10
+ created_line = generate_phony_line(src_relative, "o");
11
+ rc = generate_phony_file(fn, created_line);
12
+ --- a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
13
+ +++ b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
14
+ @@ -8,6 +8,10 @@
15
+ #
16
+
17
+ include $(GBUILDDIR)/platform/unxgcc.mk
18
+ +
19
+ +ifeq ($(OS_FOR_BUILD),MACOSX)
20
+ +gb_Library_PLAINEXT_FOR_BUILD := .dylib
21
+ +endif
22
+
23
+ gb_RUN_CONFIGURE := $(SRCDIR)/solenv/bin/run-configure
24
+ # avoid -s SAFE_HEAP=1 - c.f. gh#8584 this breaks source maps
25
+ --- a/solenv/gbuild/LinkTarget.mk
26
+ +++ b/solenv/gbuild/LinkTarget.mk
27
+ @@ -646,7 +646,7 @@
28
+ gb_GenAsmObject_get_source = $(call gb_AsmObject_get_source,$(WORKDIR),$(1))
29
+
30
+ $(call gb_GenAsmObject_get_target,%) :
31
+ - $(call gb_AsmObject__command,$@,$*,$<,$(call gb_GenAsmObject_get_dep_target,$*))
32
+ + $(call gb_AsmObject__command,$@,$*,$(call gb_GenAsmObject_get_source,$*),$(call gb_GenAsmObject_get_dep_target,$*))
33
+
34
+ ifeq ($(gb_FULLDEPS),$(true))
35
+ $(dir $(call gb_GenAsmObject_get_dep_target,%)).dir :
36
+ --- a/solenv/gbuild/Conditions.mk
37
+ +++ b/solenv/gbuild/Conditions.mk
38
+ @@ -13,7 +13,7 @@
39
+ # or the $(2) multiple times.
40
+
41
+ define gb_CondExeLockfile
42
+ -$(if $(and $(filter-out ANDROID MACOSX iOS WNT,$(OS))),$(1),$(2))
43
+ +$(if $(or $(filter-out ANDROID MACOSX iOS WNT,$(OS)),$(and $(filter MACOSX,$(OS)),$(filter EMSCRIPTEN,$(BUILD_TYPE_FOR_HOST)))),$(1),$(2))
44
+ endef
45
+
46
+ define gb_CondExeRegistryTools
@@ -0,0 +1,55 @@
1
+ --- a/external/openssl/ExternalProject_openssl.mk
2
+ +++ b/external/openssl/ExternalProject_openssl.mk
3
+ @@ -52,7 +52,7 @@
4
+ $(if $(filter X86_64,$(CPUNAME)),darwin64-x86_64-cc)\
5
+ $(if $(filter AARCH64,$(CPUNAME)),darwin64-arm64-cc)\
6
+ ,\
7
+ - $(if $(filter EMSCRIPTEN,$(OS)),no-engine no-dso no-dgram no-srtp no-err no-ocsp no-psk no-ts no-asm) \
8
+ + $(if $(filter EMSCRIPTEN,$(OS)),gcc -pthread no-engine no-dso no-dgram no-srtp no-err no-ocsp no-psk no-ts no-asm) \
9
+ )\
10
+ )\
11
+ )\
12
+ @@ -79,7 +79,7 @@
13
+ $(call gb_Trace_StartRange,openssl,EXTERNAL)
14
+ $(call gb_ExternalProject_run,build,\
15
+ unset MAKEFLAGS && \
16
+ - $(if $(filter LINUX MACOSX FREEBSD ANDROID SOLARIS iOS,$(OS)), \
17
+ + $(if $(filter LINUX MACOSX FREEBSD ANDROID SOLARIS iOS EMSCRIPTEN,$(OS)), \
18
+ ./Configure, \
19
+ $(if $(filter WNT,$(OS)), \
20
+ $(PERL) Configure, \
21
+ --- a/external/argon2/ExternalProject_argon2.mk
22
+ +++ b/external/argon2/ExternalProject_argon2.mk
23
+ @@ -43,7 +43,7 @@
24
+ $(call gb_Trace_StartRange,argon2,EXTERNAL)
25
+ $(call gb_ExternalProject_run,build,\
26
+ CFLAGS="$(CFLAGS) $(if $(filter-out WNT MACOSX,$(OS)),-fvisibility=hidden) -fPIC" \
27
+ - MAKEFLAGS= $(MAKE) \
28
+ + MAKEFLAGS= $(MAKE) $(if $(filter EMSCRIPTEN,$(OS)),libargon2.a) \
29
+ OPTTARGET=$(if $(filter X86_64,$(CPUNAME)),x86-64,forcefail) \
30
+ $(if $(CROSS_COMPILING),,&& $(MAKE) test) \
31
+ )
32
+ --- a/external/argon2/UnpackedTarball_argon2.mk
33
+ +++ b/external/argon2/UnpackedTarball_argon2.mk
34
+ @@ -15,6 +15,7 @@
35
+ external/argon2/0001-Fix-possible-compiler-error-due-to-undefined-_MSC_VE.patch \
36
+ $(if $(filter WNT_AARCH64,$(OS)_$(CPUNAME)),external/argon2/0002-Add-WinARM64-vcxproj-config.patch) \
37
+ external/argon2/private-symbols.patch.0 \
38
+ + external/argon2/use-configured-archiver.patch.0 \
39
+ ))
40
+
41
+ # vim: set noet sw=4 ts=4:
42
+ --- /dev/null
43
+ +++ b/external/argon2/use-configured-archiver.patch.0
44
+ @@ -0,0 +1,11 @@
45
+ +--- Makefile
46
+ ++++ Makefile
47
+ +@@ -182,7 +182,7 @@
48
+ + $(CC) $(CFLAGS) $(LIB_CFLAGS) $(LDFLAGS) $(SO_LDFLAGS) $^ -o $@
49
+ +
50
+ + $(LIB_ST): $(OBJ)
51
+ +- ar rcs $@ $^
52
+ ++ $(AR) rcs $@ $^
53
+ +
54
+ + .PHONY: clean
55
+ + clean:
@@ -0,0 +1,30 @@
1
+ diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
2
+ index a605030eb..7a89e6f85 100644
3
+ --- a/desktop/source/lib/init.cxx
4
+ +++ b/desktop/source/lib/init.cxx
5
+ @@ -98,6 +98,7 @@
6
+
7
+ #include <com/sun/star/connection/XConnection.hpp>
8
+ #include <com/sun/star/document/MacroExecMode.hpp>
9
+ +#include <com/sun/star/document/UpdateDocMode.hpp>
10
+ #include <com/sun/star/beans/XPropertySet.hpp>
11
+ #include <com/sun/star/container/XNameAccess.hpp>
12
+ #include <com/sun/star/document/XTypeDetection.hpp>
13
+ @@ -2947,16 +2948,11 @@ static LibreOfficeKitDocument* lo_documentLoadWithOptions(LibreOfficeKit* pThis,
14
+ comphelper::makePropertyValue(u"FilterOptions"_ustr, aOptions),
15
+ comphelper::makePropertyValue(u"InteractionHandler"_ustr, uno::Reference<task::XInteractionHandler2>(pInteraction)),
16
+ comphelper::makePropertyValue(u"MacroExecutionMode"_ustr, nMacroExecMode),
17
+ + comphelper::makePropertyValue(u"UpdateDocMode"_ustr, sal_Int16(document::UpdateDocMode::NO_UPDATE)),
18
+ comphelper::makePropertyValue(u"AsTemplate"_ustr, false),
19
+ comphelper::makePropertyValue(u"Silent"_ustr, !aBatch.isEmpty())
20
+ };
21
+
22
+ - /* TODO
23
+ - sal_Int16 nUpdateDoc = document::UpdateDocMode::ACCORDING_TO_CONFIG;
24
+ - aFilterOptions[3].Name = "UpdateDocMode";
25
+ - aFilterOptions[3].Value <<= nUpdateDoc;
26
+ - */
27
+ -
28
+ OutputDevice::StartTrackingFontMappingUse();
29
+
30
+ if (const char* pExemptVerifyHost = ::getenv("LOK_EXEMPT_VERIFY_HOST"))
@@ -0,0 +1,11 @@
1
+ --- a/uui/Library_uui.mk
2
+ +++ b/uui/Library_uui.mk
3
+ @@ -17,7 +17,7 @@
4
+ $(eval $(call gb_Library_set_componentfile,uui,uui/util/uui,services))
5
+
6
+ $(eval $(call gb_Library_use_external,uui,boost_headers))
7
+ -$(eval $(call gb_Library_use_external,uui,curl))
8
+ +$(if $(ENABLE_CURL),$(eval $(call gb_Library_use_external,uui,curl)))
9
+
10
+ $(eval $(call gb_Library_use_custom_headers,uui,\
11
+ officecfg/registry \
@@ -0,0 +1,11 @@
1
+ --- a/solenv/gbuild/Rdb.mk
2
+ +++ b/solenv/gbuild/Rdb.mk
3
+ @@ -42,7 +42,7 @@
4
+ # specific even in the corner case of an empty Rdb with no gb_Rdb_add_component calls, so that the
5
+ # use of $(COMPONENTS) in gb_Rdb__command would not accidentally pick a global COMPONENTS variable:
6
+ $(call gb_Rdb_get_target,$(1)) : COMPONENTS ?=
7
+ -$(call gb_Rdb_get_target,$(1)) : $(gb_Module_CURRENTMAKEFILE)
8
+ +$(call gb_Rdb_get_target,$(1)) : $(gb_Module_CURRENTMAKEFILE) $(BUILDDIR)/config_host.mk
9
+ $$(eval $$(call gb_Module_register_target,$(2),$(call gb_Rdb_get_clean_target,$(1))))
10
+ $(call gb_Helper_make_userfriendly_targets,$(1),Rdb,$(2))
11
+
@@ -0,0 +1,21 @@
1
+ diff --git a/solenv/gbuild/LinkTarget.mk b/solenv/gbuild/LinkTarget.mk
2
+ --- a/solenv/gbuild/LinkTarget.mk
3
+ +++ b/solenv/gbuild/LinkTarget.mk
4
+ @@ -62,11 +62,13 @@
5
+
6
+ # generic cflags/cxxflags to use (optimization flags, debug flags)
7
+ # user supplied CFLAGS/CXXFLAGS override default debug/optimization flags
8
+ +# Prefix maps change build metadata, not optimization or debug policy.
9
+ +gb_LinkTarget__get_userflags=$(if $(strip $(filter-out -ffile-prefix-map=% -fdebug-prefix-map=% /pathmap:% /experimental:deterministic,$(1))),$(1),$(call gb_LinkTarget__get_debugflags,$(2)) $(1))
10
+ # call gb_LinkTarget__get_cflags,linktargetmakefilename
11
+ -gb_LinkTarget__get_cflags=$(if $(CFLAGS),$(CFLAGS),$(call gb_LinkTarget__get_debugflags,$(1)))
12
+ -gb_LinkTarget__get_objcflags=$(if $(OBJCFLAGS),$(OBJCFLAGS),$(call gb_LinkTarget__get_debugflags,$(1)))
13
+ -gb_LinkTarget__get_cxxflags=$(if $(CXXFLAGS),$(CXXFLAGS),$(call gb_LinkTarget__get_debugflags,$(1)))
14
+ -gb_LinkTarget__get_objcxxflags=$(if $(OBJCXXFLAGS),$(OBJCXXFLAGS),$(call gb_LinkTarget__get_debugflags,$(1)))
15
+ +gb_LinkTarget__get_cflags=$(call gb_LinkTarget__get_userflags,$(CFLAGS),$(1))
16
+ +gb_LinkTarget__get_objcflags=$(call gb_LinkTarget__get_userflags,$(OBJCFLAGS),$(1))
17
+ +gb_LinkTarget__get_cxxflags=$(call gb_LinkTarget__get_userflags,$(CXXFLAGS),$(1))
18
+ +gb_LinkTarget__get_objcxxflags=$(call gb_LinkTarget__get_userflags,$(OBJCXXFLAGS),$(1))
19
+ gb_LinkTarget__get_cxxclrflags=$(call gb_LinkTarget__get_debugflags,$(1))
20
+ # call gb_LinkTarget__get_ldflags,linktargetmakefilename
21
+ gb_LinkTarget__get_ldflags=$(if $(LDFLAGS),$(LDFLAGS),$(call gb_LinkTarget__get_debugldflags,$(1)))
@@ -0,0 +1,39 @@
1
+ diff --git a/sal/Library_sal.mk b/sal/Library_sal.mk
2
+ --- a/sal/Library_sal.mk
3
+ +++ b/sal/Library_sal.mk
4
+ @@ -32,7 +32,7 @@
5
+ -DSAL_DLLIMPLEMENTATION \
6
+ -DRTL_OS="\"$(RTL_OS)\"" \
7
+ -DRTL_ARCH="\"$(RTL_ARCH)\"" \
8
+ - -DSRCDIR="\"$(SRCDIR)\"" \
9
+ + -DSRCDIR="\"/build/libreoffice-kit/source\"" \
10
+ $(call gb_CondLibSalTextenc,-DCOND_LIB_SAL_TEXTENC) \
11
+ ))
12
+
13
+ diff --git a/vcl/source/image/ImplImageTree.cxx b/vcl/source/image/ImplImageTree.cxx
14
+ --- a/vcl/source/image/ImplImageTree.cxx
15
+ +++ b/vcl/source/image/ImplImageTree.cxx
16
+ @@ -499,9 +499,9 @@
17
+ if (isVclDemo())
18
+ {
19
+ if (maCurrentStyle == "default")
20
+ - sThemeUrl = "file://" SRC_ROOT "/icon-themes/colibre-svg";
21
+ + sThemeUrl = "file:///build/libreoffice-kit/source/icon-themes/colibre-svg";
22
+ else
23
+ - sThemeUrl = "file://" SRC_ROOT "/icon-themes/" + maCurrentStyle;
24
+ + sThemeUrl = "file:///build/libreoffice-kit/source/icon-themes/" + maCurrentStyle;
25
+ }
26
+ else if (maCurrentStyle != "default")
27
+ {
28
+ diff --git a/external/libcdr/ExternalProject_libcdr.mk b/external/libcdr/ExternalProject_libcdr.mk
29
+ --- a/external/libcdr/ExternalProject_libcdr.mk
30
+ +++ b/external/libcdr/ExternalProject_libcdr.mk
31
+ @@ -38,7 +38,7 @@
32
+ --disable-weffc \
33
+ $(if $(gb_FULLDEPS),,--disable-dependency-tracking) \
34
+ $(if $(verbose),--disable-silent-rules,--enable-silent-rules) \
35
+ - CXXFLAGS="$(gb_CXXFLAGS) $(call gb_ExternalProject_get_build_flags,libcdr)" \
36
+ + CXXFLAGS="$(CXXFLAGS) $(gb_CXXFLAGS) $(call gb_ExternalProject_get_build_flags,libcdr)" \
37
+ CPPFLAGS="$(CPPFLAGS) $(BOOST_CPPFLAGS)" \
38
+ LDFLAGS="$(call gb_ExternalProject_get_link_flags,libcdr)" \
39
+ $(gb_CONFIGURE_PLATFORMS) \
@@ -0,0 +1,14 @@
1
+ --- a/configure.ac
2
+ +++ b/configure.ac
3
+ @@ -13213,8 +13213,9 @@
4
+ AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
5
+ fi
6
+
7
+ -if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
8
+ - AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
9
+ +# PDFium also renders PDF graphics embedded in OOXML/EMF without the desktop PDF import filters.
10
+ +if test "$ENABLE_PDFIMPORT" != "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
11
+ + AC_MSG_ERROR([Cannot enable Poppler when PDF importing is disabled; please enable PDF import first.])
12
+ fi
13
+
14
+ if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then