[Libreoffice-commits] core.git: Branch 'feature/wasm' - 117 commits - accessibility/Library_acc.mk accessibility/source autogen.sh avmedia/source basctl/inc basctl/source bridges/Module_bridges.mk bridges/source chart2/inc chart2/qa chart2/source config_host.mk.in configure.ac connectivity/inc connectivity/source cppcanvas/inc cppu/source cui/inc cui/qa cui/source dbaccess/inc dbaccess/source desktop/inc dictionaries drawinglayer/source editeng/inc editeng/source editeng/uiconfig emfio/inc extensions/Module_extensions.mk extensions/source external/boost external/cairo external/fontconfig external/icu external/liblangtag external/libxml2 external/openssl external/pdfium external/poppler filter/source helpcontent2 icon-themes/colibre icon-themes/elementary icon-themes/elementary_svg include/oox include/osl include/sal include/sax include/sfx2 include/svx include/vcl include/xmloff Makefile.in oox/qa oox/source README.wasm reportdesign/inc reportdesign/source Repository.mk sal/osl sax/source sc/inc scp2/source sc/qa scripting/Module_scripting.mk sc/source sd/inc sd/qa sd/source setup_native/source sfx2/inc sfx2/source sfx2/uiconfig shell/Module_shell.mk solenv/bin solenv/clang-format solenv/gbuild starmath/inc starmath/source svl/inc svl/Library_svl.mk svtools/inc svx/inc svx/Module_svx.mk svx/qa svx/source svx/UITest_svx_table.mk sw/CppunitTest_sw_ooxmlexport16.mk sw/inc sw/Module_sw.mk sw/qa sw/source tools/source translations uitest/impress_tests uitest/uitest unoidl/Executable_unoidl-read.mk unoxml/inc vcl/CustomTarget_wasm_native.mk vcl/Executable_ui-previewer.mk vcl/inc vcl/Library_vcl.mk vcl/Library_vclplug_qt5.mk vcl/Module_vcl.mk vcl/qa vcl/qt5 vcl/skia vcl/source vcl/unx vcl/wasm vcl/win .vscode/vs-code-template.code-workspace.in winaccessibility/source wizards/Package_sfdocuments.mk wizards/source writerfilter/inc writerfilter/source xmloff/inc xmloff/source xmlsecurity/inc

Jan-Marek Glogowski (via logerrit) logerrit at kemper.freedesktop.org
Fri Dec 18 16:09:46 UTC 2020


Rebased ref, commits from common ancestor:
commit 49a8faf3fd7980b2b6f12e05bc44a69514918db4
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Fri Dec 18 16:44:29 2020 +0100
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Fri Dec 18 16:51:03 2020 +0100

    Next catchall
    
    Before my rebase, this used to link a ui-previewer "executable".
    I have this major problem with the static linkage of the binary,
    which now has to list ~150 dependencies.
    
    While it linked withhout any more symbol errors, it (obviously)
    won't run, because the LO mainloop can't drive the browser
    mainloop.
    
    It currently fails in cairo with pthread detection, which did
    somehow work before. Also exception handling isn't yet correctly
    supported in the build - I think of providing an emscripten
    settings.js instead of adding the info to all external builds.
    
    Change-Id: I757634bb2f819022e537f3f4dd55ddabdc742454

diff --git a/README.wasm b/README.wasm
index 401ad6a345ef..d6180cab09da 100644
--- a/README.wasm
+++ b/README.wasm
@@ -1,3 +1,11 @@
+= Status =
+
+$ make cross-toolset
+$ make vcl.all
+
+> instdir/program/ui-previewer.html
+
+
 = Setup for the LO WASM build (with Qt) =
 
 We're using Qt 5.15 with the officially supported emscripten v1.39.8.
@@ -20,6 +28,50 @@ EMSDK_ENV=$HOME/Development/libreoffice/git_emsdk/emsdk_env.sh
 [ -f "$EMSDK_ENV" ] && \. "$EMSDK_ENV" 1>/dev/null 2>&1
 
 
+== Setup Qt ==
+
+https://doc.qt.io/qt-5/wasm.html
+
+I originally build the Qt 5.15 branch, but probably better to build a tag like v5.15.2.
+
+./configure -xplatform wasm-emscripten -feature-thread -compile-examples -prefix $PWD/qtbase
+make -j<CORES> module-qtbase module-qtdeclarative
+
+Building with examples will break with some of them, but at that point Qt already works.
+
+If you get a configure failure for Qt:
+
+Checking for target architecture... Project ERROR: target architecture detection binary not found.
+
+Edit git_emsdk/upstream/emscripten/emcc.py:
+@@ -760,8 +760,8 @@
+     only_object = '-c' in cmd
+     for i in reversed(range(len(cmd) - 1)): # Last -o directive should take precedence, if multiple are specified
+       if cmd[i] == '-o':
+-        if not only_object:
+-          cmd[i + 1] += '.js'
++#        if not only_object:
++#          cmd[i + 1] += '.js'
+         target = cmd[i + 1]
+         break
+     if not target:
+
+The previous suggestion, which was to edit qtbase/config.tests/arch/write_info.pri
+-     ext = .wasm
++     ext = .js.wasm
+
+produces errors when loading the generated html, because it can't find the wasm now.
+
+Current Qt fails to start the demo webserver: https://bugreports.qt.io/browse/QTCREATORBUG-24072
+Use: emrun --serve_after_close to run Qt WASM demos
+
+Enabling multi-thread support in Firefox is a bit of work with older versions:
+- https://bugzilla.mozilla.org/show_bug.cgi?id=1477743#c7
+- https://wiki.qt.io/Qt_for_WebAssembly#Multithreading_Support
+- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer
+
+
+
 == Setup LO ==
 
 Currently autogen.sh is patched to use emconfigure. That basically sets various environment vars,
@@ -42,6 +94,7 @@ QT5DIR=/dir/of/git_qt5/qtbase
 --disable-gio
 --disable-gstreamer-1-0
 --disable-gtk3
+--disable-ldap
 --disable-lpsolve
 --disable-mariadb-sdbc
 --disable-nss
@@ -66,29 +119,6 @@ QT5DIR=/dir/of/git_qt5/qtbase
 Will also be encoded in configure.ac at some point, some already is.
 
 
-== Setup Qt ==
-
-https://doc.qt.io/qt-5/wasm.html
-
-I originally build the Qt 5.15 branch, but probably better to build a tag like v5.15.2.
-
-./configure -xplatform wasm-emscripten -feature-thread -compile-examples -prefix $PWD/qtbase
-make -j<CORES> module-qtbase module-qtdeclarative
-
-Building with examples will break with some of them, but at that point Qt already works.
-
-If you get a configure failure for Qt:
-
-Checking for target architecture... Project ERROR: target architecture detection binary not found.
-
-Edit qtbase/config.tests/arch/write_info.pri
--     ext = .wasm
-+     ext = .js.wasm
-
-Current Qt fails to start the demo webserver: https://bugreports.qt.io/browse/QTCREATORBUG-24072
-Use: emrun --serve_after_close to run Qt WASM demos
-
-
 = Mixed information, links, problems, TODO =
 
 More info on Qt WASM emscripten pthreads: https://wiki.qt.io/Qt_for_WebAssembly#Multithreading_Support
@@ -141,6 +171,10 @@ This will be interesting: https://emscripten.org/docs/getting_started/FAQ.html#h
 
 This didn't help much yet: https://github.com/emscripten-ports
 
+Emscripten supports standalone WASI binaries: https://github.com/emscripten-core/emscripten/wiki/WebAssembly-Standalone
+WASM dynamic dispatch: https://fitzgeraldnick.com/2018/04/26/how-does-dynamic-dispatch-work-in-wasm.html
+WASM dlload: https://iandouglasscott.com/2019/07/18/experimenting-with-webassembly-dynamic-linking-with-clang/
+
 https://www.qt.io/qt-examples-for-webassembly
 http://qtandeverything.blogspot.com/2017/06/qt-for-web-assembly.html
 http://qtandeverything.blogspot.com/2020/
diff --git a/bridges/Module_bridges.mk b/bridges/Module_bridges.mk
index 126e43b1cd31..1c7fb1789b8e 100644
--- a/bridges/Module_bridges.mk
+++ b/bridges/Module_bridges.mk
@@ -9,6 +9,7 @@
 
 $(eval $(call gb_Module_Module,bridges))
 
+ifneq ($(OS),EMSCRIPTEN)
 $(eval $(call gb_Module_add_targets,bridges,\
 	Library_cpp_uno \
 	$(if $(ENABLE_JAVA),\
@@ -22,7 +23,6 @@ $(eval $(call gb_Module_add_targets,bridges,\
 	) \
 ))
 
-ifneq ($(OS), EMSCRIPTEN)
 ifeq (,$(filter build,$(gb_Module_SKIPTARGETS)))
 ifeq ($(strip $(bridges_SELECTED_BRIDGE)),)
 $(call gb_Output_error,no bridge selected for build: bailing out)
diff --git a/config_host.mk.in b/config_host.mk.in
index 791f88f964b2..8afb776a9c32 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -477,6 +477,16 @@ export PERL=@PERL@
 export PKGFORMAT=@PKGFORMAT@
 export PKGMK=@PKGMK@
 export PKG_CONFIG=@PKG_CONFIG@
+ifneq (@PKG_CONFIG_PATH@,)
+export PKG_CONFIG_PATH=@PKG_CONFIG_PATH@
+else
+unexport PKG_CONFIG_PATH
+endif
+ifneq (@PKG_CONFIG_LIBDIR@,)
+export PKG_CONFIG_LIBDIR=@PKG_CONFIG_LIBDIR@
+else
+unexport PKG_CONFIG_LIBDIR
+endif
 export PLATFORMID=@PLATFORMID@
 export POPPLER_CFLAGS=$(gb_SPACE)@POPPLER_CFLAGS@
 export POPPLER_LIBS=$(gb_SPACE)@POPPLER_LIBS@
diff --git a/configure.ac b/configure.ac
index a7fc818da3f8..cf5054a5cc44 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6102,6 +6102,8 @@ AC_SUBST(LD)
 AC_SUBST(NM)
 AC_SUBST(OBJDUMP)
 AC_SUBST(PKG_CONFIG)
+AC_SUBST(PKG_CONFIG_PATH)
+AC_SUBST(PKG_CONFIG_LIBDIR)
 AC_SUBST(RANLIB)
 AC_SUBST(READELF)
 AC_SUBST(STRIP)
@@ -12497,6 +12499,9 @@ then
     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
+    if test "$_os" = "Emscripten"; then
+        QT5_LIBS="$QT5_LIBS -lqtpcre2"
+    fi
 
     if test "$USING_X11" = TRUE; then
         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx
index 93a6a1bb588f..161dde10c5a9 100644
--- a/cppu/source/uno/lbenv.cxx
+++ b/cppu/source/uno/lbenv.cxx
@@ -1012,6 +1012,7 @@ void EnvironmentsData::getRegisteredEnvironments(
 bool loadEnv(OUString const  & cLibStem,
                     uno_Environment * pEnv)
 {
+#ifndef __EMSCRIPTEN__
 #ifdef DISABLE_DYNLOADING
     uno_initEnvironmentFunc fpInit;
 
@@ -1051,6 +1052,11 @@ bool loadEnv(OUString const  & cLibStem,
 
     (*fpInit)( pEnv ); // init of environment
     return true;
+#else
+    (void)cLibStem;
+    (void)pEnv;
+    return false;
+#endif
 }
 
 }
diff --git a/cppu/source/uno/lbmap.cxx b/cppu/source/uno/lbmap.cxx
index 1e8655a99b58..937db9b882fd 100644
--- a/cppu/source/uno/lbmap.cxx
+++ b/cppu/source/uno/lbmap.cxx
@@ -328,12 +328,14 @@ static void setNegativeBridge( const OUString & rBridgeName )
 
 static uno_ext_getMappingFunc selectMapFunc( const OUString & rBridgeName )
 {
+#if 0
     if (rBridgeName.equalsAscii( CPPU_CURRENT_LANGUAGE_BINDING_NAME "_uno" ))
         return CPPU_ENV_uno_ext_getMapping;
 #if HAVE_FEATURE_JAVA
     if (rBridgeName.equalsAscii( "java" "_uno" ))
         return java_uno_ext_getMapping;
 #endif
+#endif
 
 #if 0
     // I don't think the affine or log bridges will be needed on any
diff --git a/extensions/Module_extensions.mk b/extensions/Module_extensions.mk
index 43a32560e64c..c3f87aca815c 100644
--- a/extensions/Module_extensions.mk
+++ b/extensions/Module_extensions.mk
@@ -13,7 +13,7 @@ $(eval $(call gb_Module_add_l10n_targets,extensions,\
 	AllLangMoTarget_pcr \
 ))
 
-ifneq ($(filter-out iOS ANDROID,$(OS)),)
+ifneq ($(filter-out EMSCRIPTEN iOS ANDROID,$(OS)),)
 $(eval $(call gb_Module_add_targets,extensions,\
 	Library_abp \
 	Library_scn \
diff --git a/external/cairo/ExternalProject_cairo.mk b/external/cairo/ExternalProject_cairo.mk
index c8d4ac05d858..08e83086a1cc 100644
--- a/external/cairo/ExternalProject_cairo.mk
+++ b/external/cairo/ExternalProject_cairo.mk
@@ -64,10 +64,11 @@ else
 $(call gb_ExternalProject_get_state_target,cairo,build) :
 	$(call gb_Trace_StartRange,cairo,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
-	./configure \
+	env | sort && \
+	dash -x ./configure \
 		$(if $(debug),STRIP=" ") \
 		$(if $(filter ANDROID iOS,$(OS)),CFLAGS="$(if $(debug),-g) $(ZLIB_CFLAGS) $(gb_VISIBILITY_FLAGS)") \
-		$(if $(filter EMSCRIPTEN,$(OS)),CFLAGS=" $(ZLIB_CFLAGS) -pthread") \
+		$(if $(filter EMSCRIPTEN,$(OS)),CFLAGS=" $(ZLIB_CFLAGS)" --enable-pthread=yes PTHREAD_LIBS="" EMMAKEN_JUST_CONFIGURE=1) \
 		$(if $(filter-out EMSCRIPTEN ANDROID iOS,$(OS)),CFLAGS="$(if $(debug),-g) $(ZLIB_CFLAGS)" ) \
 		$(if $(filter ANDROID iOS,$(OS)),PKG_CONFIG=./dummy_pkg_config) \
 		LIBS="$(ZLIB_LIBS)" \
diff --git a/external/icu/icu4c-emscripten-cross.patch.1 b/external/icu/icu4c-emscripten-cross.patch.1
index 2462a1fb93fe..84c88a68a87d 100644
--- a/external/icu/icu4c-emscripten-cross.patch.1
+++ b/external/icu/icu4c-emscripten-cross.patch.1
@@ -10,7 +10,7 @@
  		]
 --- /dev/null
 +++ icu/source/config/mh-emscripten	2015-10-06 12:01:00.497972406 +0200
-@@ -0,0 +1,85 @@
+@@ -0,0 +1,86 @@
 +## Emscripten-specific setup
 +## Copyright (c) 1999-2013, International Business Machines Corporation and
 +## others. All Rights Reserved.
diff --git a/external/poppler/StaticLibrary_poppler.mk b/external/poppler/StaticLibrary_poppler.mk
index 8bf9f528ee9e..97de6db76b1d 100644
--- a/external/poppler/StaticLibrary_poppler.mk
+++ b/external/poppler/StaticLibrary_poppler.mk
@@ -11,7 +11,10 @@ $(eval $(call gb_StaticLibrary_StaticLibrary,poppler))
 
 $(eval $(call gb_StaticLibrary_use_unpacked,poppler,poppler))
 
-$(eval $(call gb_StaticLibrary_use_external,poppler,libjpeg))
+$(eval $(call gb_StaticLibrary_use_externals,poppler,\
+    fontconfig \
+    libjpeg \
+))
 
 $(eval $(call gb_StaticLibrary_set_warnings_disabled,poppler))
 
diff --git a/sal/osl/unx/system.hxx b/sal/osl/unx/system.hxx
index fb0e0aa47282..8b1f1dccced4 100644
--- a/sal/osl/unx/system.hxx
+++ b/sal/osl/unx/system.hxx
@@ -286,6 +286,7 @@ int macxp_resolveAlias(char *path, int buflen);
 #   define  IOCHANNEL_TRANSFER_BSD_RENO
 #   define  pthread_testcancel()
 #   define  NO_PTHREAD_PRIORITY
+#   define INIT_GROUPS(name, gid) false
 #endif
 
 #if !defined(_WIN32)  && \
diff --git a/shell/Module_shell.mk b/shell/Module_shell.mk
index e6d66355c27e..d5279665e8ff 100644
--- a/shell/Module_shell.mk
+++ b/shell/Module_shell.mk
@@ -9,11 +9,13 @@
 
 $(eval $(call gb_Module_Module,shell))
 
+ifneq (EMSCRIPTEN,$(OS))
 ifeq ($(filter DESKTOP,$(BUILD_TYPE)),DESKTOP)
 $(eval $(call gb_Module_add_targets,shell,\
 	Executable_lngconvex \
 ))
 endif
+endif
 
 ifeq ($(gb_Side),host)
 
diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index 2cfccbfa705b..27b8a7b12fc1 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -320,18 +320,6 @@ core_constructor_list = [
     "com_sun_star_comp_uri_UriReferenceFactory_get_implementation",
     "com_sun_star_comp_uri_UriSchemeParser_vndDOTsunDOTstarDOTexpand_get_implementation",
     "com_sun_star_comp_uri_UriSchemeParser_vndDOTsunDOTstarDOTscript_get_implementation",
-# starmath/util/sm.component
-    "Math_FormulaDocument_get_implementation",
-    "Math_XMLContentExporter_get_implementation",
-    "Math_XMLExporter_get_implementation",
-    "Math_XMLImporter_get_implementation",
-    "Math_XMLMetaExporter_get_implementation",
-    "Math_XMLOasisMetaExporter_get_implementation",
-    "Math_XMLOasisMetaImporter_get_implementation",
-    "Math_XMLOasisSettingsExporter_get_implementation",
-    "Math_XMLOasisSettingsImporter_get_implementation",
-    "Math_XMLSettingsExporter_get_implementation",
-    "com_sun_star_comp_Math_MathTypeFilter_get_implementation",
 # svl/source/fsstor/fsstorage.component
     "svl_FSStorageFactory_get_implementation",
 # svtools/util/svt.component
@@ -567,6 +555,17 @@ math_constructor_list = [
 # starmath/util/sm.component
     "Math_XMLOasisMetaExporter_get_implementation",
     "Math_XMLOasisSettingsExporter_get_implementation",
+    "Math_FormulaDocument_get_implementation",
+    "Math_XMLContentExporter_get_implementation",
+    "Math_XMLExporter_get_implementation",
+    "Math_XMLImporter_get_implementation",
+    "Math_XMLMetaExporter_get_implementation",
+    "Math_XMLOasisMetaExporter_get_implementation",
+    "Math_XMLOasisMetaImporter_get_implementation",
+    "Math_XMLOasisSettingsExporter_get_implementation",
+    "Math_XMLOasisSettingsImporter_get_implementation",
+    "Math_XMLSettingsExporter_get_implementation",
+    "com_sun_star_comp_Math_MathTypeFilter_get_implementation",
     ]
 
 calc_factory_list = [
diff --git a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
index a1d2813edaf9..23b12f64c723 100644
--- a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
+++ b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
@@ -13,12 +13,17 @@ else
 gb_UnoApiHeadersTarget_select_variant = $(2)
 endif
 
-gb_LinkTarget_LDFLAGS += -s TOTAL_MEMORY=1GB
 
 include $(GBUILDDIR)/platform/unxgcc.mk
 
-gb_CFLAGS += -pthread -s TOTAL_MEMORY=1GB -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=4
-gb_CXXFLAGS += -pthread -s TOTAL_MEMORY=1GB -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=4
-gb_CXX_LINKFLAGS += -pthread -s TOTAL_MEMORY=1GB -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=4
+emscripten_CPPFLAGS := -pthread -s TOTAL_MEMORY=1GB -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=4
+
+gb_Executable_EXT := .html
+
+gb_CFLAGS += $(emscripten_CPPFLAGS)
+gb_CXXFLAGS += $(emscripten_CPPFLAGS) -s DISABLE_EXCEPTION_CATCHING=0
+gb_LinkTarget_LDFLAGS += $(emscripten_CPPFLAGS) --bind
+
+#gb_CXX_LINKFLAGS += -pthread -s TOTAL_MEMORY=1GB -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=4
 
 # vim: set noet sw=4 ts=4
diff --git a/vcl/CustomTarget_wasm_native.mk b/vcl/CustomTarget_wasm_native.mk
new file mode 100644
index 000000000000..1bd829634030
--- /dev/null
+++ b/vcl/CustomTarget_wasm_native.mk
@@ -0,0 +1,24 @@
+# vim: set noet sw=4 ts=4:
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_CustomTarget_CustomTarget,vcl/wasm))
+
+wasm_WORKDIR := $(call gb_CustomTarget_get_workdir,vcl/wasm)
+
+$(call gb_CustomTarget_get_target,vcl/wasm): \
+	$(wasm_WORKDIR)/native-code.cxx
+
+$(wasm_WORKDIR)/native-code.cxx: \
+	    $(SRCDIR)/solenv/bin/native-code.py \
+	    | $(wasm_WORKDIR)/.dir
+	$(call gb_Output_announce,$(subst $(BUILDDIR)/,,$@),$(true),GEN,2)
+	$(call gb_Helper_abbreviate_dirs,$(call gb_ExternalExecutable_get_command,python) $< -g core) > $@
+
+# vim: set noet sw=4:
diff --git a/vcl/Executable_ui-previewer.mk b/vcl/Executable_ui-previewer.mk
index acee26cd15d3..c766365d87ea 100644
--- a/vcl/Executable_ui-previewer.mk
+++ b/vcl/Executable_ui-previewer.mk
@@ -12,30 +12,37 @@ $(eval $(call gb_Executable_Executable,ui-previewer))
 $(eval $(call gb_Executable_use_externals,ui-previewer,\
     boost_headers \
     $(if $(filter TRUE,$(DISABLE_DYNLOADING)),\
+        boost_filesystem \
+        boost_iostreams \
+        boost_system \
+        cairo \
         dtoa \
-        icuuc \
-        icui18n \
+        expat \
+        fontconfig \
+        freetype \
+        graphite \
+        harfbuzz \
+        hunspell \
+        hyphen \
         icudata \
-        libpng \
+        icui18n \
+        icuuc \
+        lcms2 \
+        libexttextcat \
         libjpeg \
-        harfbuzz \
-        libxml2 \
-        graphite \
         liblangtag \
-        qt5 \
-        cairo \
-        fontconfig \
-        lcms2 \
-        freetype \
+        libnumbertext \
+        libpng \
+        librdf \
+        libxml2 \
+        libxslt \
+        mdds_headers \
+        mythes \
         openssl \
-        expat \
-        orcus-parser \
         orcus \
+        orcus-parser \
         qrcodegen \
-        boost_filesystem \
-        boost_iostreams \
-        boost_system \
-        mdds_headers \
+        qt5 \
     ) \
 ))
 
@@ -45,7 +52,10 @@ $(eval $(call gb_Executable_use_api,ui-previewer,\
 ))
 
 $(eval $(call gb_Executable_use_static_libraries,ui-previewer,\
-    $(if $(filter TRUE,$(DISABLE_DYNLOADING)),boost_locale) \
+    $(if $(filter TRUE,$(DISABLE_DYNLOADING)),\
+        boost_locale \
+        ulingu \
+    ) \
     vclmain \
 ))
 
@@ -61,36 +71,112 @@ $(eval $(call gb_Executable_use_libraries,ui-previewer,\
         acc \
         avmedia \
         basegfx \
+        bib \
+        bootstrap \
+        cairocanvas \
+        canvasfactory \
+        canvastools \
+        chartcontroller \
+        chartcore \
+        collator_data \
+        configmgr \
+        cppcanvas \
+        ctl \
         cui \
+        dba \
         dbtools \
+        dict_ja \
+        dict_zh \
         drawinglayer \
         editeng \
+        embobj \
         emfio \
         epoxy \
+        evtatt \
+        expwrap \
+        filterconfig \
+        frm \
+        fsstorage \
         fwk \
-        gcc3_uno \
+        gie \
         gie \
         graphicfilter \
+        graphicfilter \
+        guesslang \
+        hyphen \
         i18nlangtag \
+        i18npool \
+        i18npool \
+        i18nsearch \
         i18nutil \
+        icg \
+        index_data \
+        introspection \
+        invocadapt \
+        invocation \
         lng \
+        lnth \
+        localebe1 \
+        localedata_en \
+        localedata_es \
+        localedata_euro \
+        localedata_others \
+        msfilter \
+        mtfrenderer \
+        namingservice \
+        numbertext \
+        odfflatxml \
+        oox \
+        package2 \
+        pdffilter \
+        proxyfac \
+        reflection \
         reg \
         salhelper \
         sax \
+        sax \
+        sb \
         sfx \
+        simplecanvas \
         sot \
+        spell \
+        srtrs1 \
+        stocservices \
+        storagefd \
         store \
+        svgfilter \
+        svgio \
         svl \
         svt \
         svx \
         svxcore \
+        t602filter \
+        textconv_dict \
+        textfd \
         tk \
+        ucb1 \
         ucbhelper \
+        ucpdav1 \
+        ucpfile1 \
+        ucphier1 \
+        ucppkg1 \
+        ucptdoc1 \
         unoidl \
+        unordf \
+        unoxml \
         utl \
+        uui \
+        vclcanvas \
+        xmlfa \
+        xmlfd \
         xmlreader \
+        xmlscript \
         xo \
         xof \
+        xsltdlg \
+        xsltfilter \
+        xsltfilter \
+        xstor \
         $(if $(filter EMSCRIPTEN,$(OS)),vclplug_qt5) \
     ) \
 ))
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 69bba379be42..2066dfe5a3ea 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -579,6 +579,10 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
     $(vcl_headless_freetype_code) \
 ))
 
+$(eval $(call gb_Library_add_generated_exception_objects,vcl,\
+    CustomTarget/vcl/wasm/native-code \
+))
+
 $(eval $(call gb_Library_use_externals,vcl,\
     cairo \
     expat \
diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk
index 2a910a9ced3f..220e69dfaeeb 100644
--- a/vcl/Module_vcl.mk
+++ b/vcl/Module_vcl.mk
@@ -123,6 +123,12 @@ $(eval $(call gb_Module_add_targets,vcl,\
 ))
 endif
 
+ifeq ($(OS),EMSCRIPTEN)
+$(eval $(call gb_Module_add_targets,vcl,\
+    CustomTarget_wasm_native \
+))
+endif
+
 ifneq ($(ENABLE_FUZZERS),)
 $(eval $(call gb_Module_add_targets,vcl,\
     CustomTarget_nativecore \
commit 41f7a6579197ed743fd4ee35271999e0e869e824
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Wed Dec 16 02:08:15 2020 +0100
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Thu Dec 17 21:00:13 2020 +0100

    Next catchall
    
    This is the "fail to link vcl/Executable_ui-previewer" commit. I
    was hoping to link this executable this evening, but there are
    some remaining mysteries to solve.
    
    I'm missing bridge functions, pcre2 (seems to be from boost regex,
    somehow?), the constructor lists from native-code.py and generally
    still broken dependencies.
    
    What does work is the linking of the Qt5 WASM library, after I
    re-build it inside my chroot, as my Debian has glibc 2.28, while
    my Ubuntu 18.04 chroot has 2.27, so all the native tooling
    wouldn't work. But no new build failures, so just some time.
    
    One main problem is the static linking of executables. For so,
    you have rpath and dependencies, which will get all the correct
    dependencies, but this exists for static archives. I still had
    to fix many externals with -pthread, so growing that list took
    a while anyway, but eventually this should and could be done
    by gbuild. Question is, how hard is it to implement.
    
    I don't know if sal/osl/unx/system.hxx is correct at all, but
    at least it compiles.
    
    I tried to update the REAME with all new infos I find.
    
    Change-Id: I64ecd4f923296eb4aeb42ff4b114c87b58503962

diff --git a/README.wasm b/README.wasm
index be6cc4ff0ecf..401ad6a345ef 100644
--- a/README.wasm
+++ b/README.wasm
@@ -26,36 +26,42 @@ Currently autogen.sh is patched to use emconfigure. That basically sets various
 especially EMMAKEN_JUST_CONFIGURE, which will create the correct output file names, checked by
 configure (a.out).
 
+QT5DIR=/dir/of/git_qt5/qtbase
+
 --host=wasm64-local-emscripten
+--disable-ccache
+--disable-coinmp
 --disable-cups
+--disable-dbus
 --disable-dconf
+--disable-dynamic-loading
+--disable-extension-integration
+--disable-extensions
+--disable-extension-update
+--disable-firebird-sdbc
 --disable-gio
---disable-dbus
---disable-sdremote-bluetooth
 --disable-gstreamer-1-0
---disable-odk
---disable-postgresql-sdbc
---disable-firebird-sdbc
+--disable-gtk3
+--disable-lpsolve
 --disable-mariadb-sdbc
 --disable-nss
+--disable-odk
+--disable-online-update
+--disable-opencl
+--disable-pdfimport
+--disable-postgresql-sdbc
 --disable-python
 --disable-randr
---disable-pdfimport
 --disable-report-builder
---disable-lpsolve
---disable-coinmp
+--disable-scripting
+--disable-sdremote-bluetooth
+--enable-qt5
 --without-fonts
+--without-helppack-integration
 --without-java
 --without-junit
---without-helppack-integration
 --without-system-dicts
 --with-theme=no
---disable-cairo-canvas
---disable-scripting
---disable-dynamic-loading
---disable-ccache
---disable-gtk3
---enable-qt5
 
 Will also be encoded in configure.ac at some point, some already is.
 
@@ -87,10 +93,19 @@ Use: emrun --serve_after_close to run Qt WASM demos
 
 More info on Qt WASM emscripten pthreads: https://wiki.qt.io/Qt_for_WebAssembly#Multithreading_Support
 
+WASM needs -pthread at compile, not just link time for atomics support. Alternativel< you can provide
+-s USE_PTHREADS=1, but both don't seem to work relyable, so best provide both.
+https://github.com/emscripten-core/emscripten/issues/10370
+
+The output file must have the prefix .o, otherwise the WASM files will get a
+node.js shebang (!) and ranlib won't be able to index the library (link errors).
+
 Qt with threads has further memory limit. From Qt configure:
 Project MESSAGE: Setting PTHREAD_POOL_SIZE to 4
 Project MESSAGE: Setting TOTAL_MEMORY to 1GB
 
+You can actually allocate 4GB: https://bugzilla.mozilla.org/show_bug.cgi?id=1392234
+
 LO uses a nested event loop to run dialogs in general, but that won't work, because you can't drive
 the browser event loop. like VCL does with the system event loop in the various VCL backends.
 Changing this will need some major work (basically dropping Application::Execute).
diff --git a/Repository.mk b/Repository.mk
index 5311a5d1b84b..c3872fa9369d 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -470,6 +470,7 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
 	$(if $(filter iOS MACOSX,$(OS)), \
 		MacOSXSpell \
 	) \
+	$(if $(filter $(OS),EMSCRIPTEN),vclplug_qt5) \
 ))
 
 $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,postgresqlsdbc, \
@@ -916,7 +917,7 @@ $(eval $(call gb_Helper_register_packages_for_install,ooo,\
 		$(if $(ENABLE_SCRIPTING_BEANSHELL),scripting_ScriptsBeanShell) \
 		$(if $(ENABLE_SCRIPTING_JAVASCRIPT),scripting_ScriptsJavaScript) \
 	) \
-	$(if $(DISABLE_SCRIPTING),,scripting_scriptbindinglib) \
+	$(if $(filter SCRIPTING,$(BUILD_TYPE)),scripting_scriptbindinglib) \
 	$(if $(filter $(OS),MACOSX),sysui_osxicons) \
 	wizards_basicshare \
 	wizards_basicsrvaccess2base \
diff --git a/accessibility/Library_acc.mk b/accessibility/Library_acc.mk
index caf3d612330b..6e4c90eba50d 100644
--- a/accessibility/Library_acc.mk
+++ b/accessibility/Library_acc.mk
@@ -63,10 +63,6 @@ $(eval $(call gb_Library_add_exception_objects,acc,\
     accessibility/source/extended/accessibleiconchoicectrlentry \
     accessibility/source/extended/accessiblelistbox \
     accessibility/source/extended/accessiblelistboxentry \
-    accessibility/source/extended/accessibletabbar \
-    accessibility/source/extended/accessibletabbarbase \
-    accessibility/source/extended/accessibletabbarpage \
-    accessibility/source/extended/accessibletabbarpagelist \
     accessibility/source/extended/accessibletablistbox \
     accessibility/source/extended/accessibletablistboxtable \
     accessibility/source/extended/textwindowaccessibility \
@@ -110,4 +106,13 @@ $(eval $(call gb_Library_add_exception_objects,acc,\
     accessibility/source/standard/vclxaccessibletoolboxitem \
 ))
 
+ifneq ($(filter SCRIPTING,$(BUILD_TYPE)),)
+$(eval $(call gb_Library_add_exception_objects,acc,\
+    accessibility/source/extended/accessibletabbar \
+    accessibility/source/extended/accessibletabbarbase \
+    accessibility/source/extended/accessibletabbarpage \
+    accessibility/source/extended/accessibletabbarpagelist \
+))
+endif
+
 # vim:set noet sw=4 ts=4:
diff --git a/accessibility/source/helper/acc_factory.cxx b/accessibility/source/helper/acc_factory.cxx
index a4648485c2dc..f1249d47f99c 100644
--- a/accessibility/source/helper/acc_factory.cxx
+++ b/accessibility/source/helper/acc_factory.cxx
@@ -378,7 +378,11 @@ Reference< XAccessible > AccessibleFactory::createAccessibleIconChoiceCtrl(
 
 Reference< XAccessible > AccessibleFactory::createAccessibleTabBar( TabBar& _rTabBar ) const
 {
+#if HAVE_FEATURE_SCRIPTING
     return new AccessibleTabBar( &_rTabBar );
+#else
+    return nullptr;
+#endif
 }
 
 Reference< XAccessibleContext > AccessibleFactory::createAccessibleTextWindowContext(
diff --git a/configure.ac b/configure.ac
index 7500307f87dd..a7fc818da3f8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -807,6 +807,8 @@ dnl Sequential to keep the logic very simple
 dnl These values may be checked and reset later.
 dnl ===================================================================
 #defaults unless the os test overrides this:
+test_cmis=yes
+test_curl=yes
 test_randr=yes
 test_xrender=yes
 test_cups=yes
@@ -960,6 +962,7 @@ darwin*|macos*) # macOS
 ;;
 
 ios*) # iOS
+    test_cmis=no
     test_randr=no
     test_xrender=no
     test_freetype=no
@@ -1114,12 +1117,13 @@ emscripten*)
     enable_lpsolve=no
     enable_report_builder=no
     with_theme="breeze"
+    test_cmis=no
     test_cups=no
+    test_curl=no
     test_dbus=no
     test_fontconfig=no
     test_freetype=no
     test_gtk=no
-    test_kde4=no
     test_randr=no
     test_xrender=no
     enable_postgresql_sdbc=no
@@ -5212,7 +5216,7 @@ if test "$cross_compiling" = "yes"; then
     (
     unset COM USING_X11 OS CPUNAME
     unset CC CXX SYSBASE CFLAGS
-    unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
+    unset AR LD NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC
     unset PKG_CONFIG_LIBDIR PKG_CONFIG_PATH
@@ -5501,6 +5505,11 @@ if test "$USING_X11" != TRUE; then
     enable_cairo_canvas=no
 fi
 
+if test "$OS" = "EMSCRIPTEN"; then
+    enable_cairo_canvas=yes
+    test_qt5=yes
+fi
+
 if test "$OS" = "HAIKU"; then
     enable_cairo_canvas=yes
     test_kf5=yes
@@ -7081,7 +7090,7 @@ dnl ===================================================================
 dnl Check for system libcmis
 dnl ===================================================================
 # libcmis requires curl and we can't build curl for iOS
-if test $_os != iOS; then
+if test "$test_cmis" = "yes"; then
     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.2])
     ENABLE_LIBCMIS=TRUE
 else
@@ -9989,7 +9998,7 @@ if test "$with_system_curl" = "auto"; then
     with_system_curl="$with_system_libs"
 fi
 
-if test "$with_system_curl" = "yes"; then
+if test "$test_curl" = "yes" -a "$with_system_curl" = "yes"; then
     AC_MSG_RESULT([external])
     SYSTEM_CURL=TRUE
 
@@ -10021,6 +10030,8 @@ if test "$with_system_curl" = "yes"; then
     fi
 
     ENABLE_CURL=TRUE
+elif test "$test_curl" = "no"; then
+    AC_MSG_RESULT([none])
 else
     AC_MSG_RESULT([internal])
     SYSTEM_CURL=
@@ -12422,7 +12433,11 @@ then
     fi
 
     qt5_test_include="QtWidgets/qapplication.h"
-    qt5_test_library="libQt5Widgets.so"
+    if test "$_os" = "Emscripten"; then
+        qt5_test_library="libQt5Widgets.a"
+    else
+        qt5_test_library="libQt5Widgets.so"
+    fi
 
     dnl Check for qmake5
     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH])
diff --git a/cui/source/dialogs/AdditionsDialog.cxx b/cui/source/dialogs/AdditionsDialog.cxx
index 832a7314b440..56fc111beef4 100644
--- a/cui/source/dialogs/AdditionsDialog.cxx
+++ b/cui/source/dialogs/AdditionsDialog.cxx
@@ -53,6 +53,9 @@
 #include <orcus/config.hpp>
 #include <orcus/pstring.hpp>
 
+#ifdef PAGE_SIZE
+#undef PAGE_SIZE
+#endif
 #define PAGE_SIZE 30
 
 using namespace css;
diff --git a/external/boost/UnpackedTarball_boost.mk b/external/boost/UnpackedTarball_boost.mk
index 046f7e6da1b2..adae48e37b3f 100644
--- a/external/boost/UnpackedTarball_boost.mk
+++ b/external/boost/UnpackedTarball_boost.mk
@@ -49,6 +49,7 @@ $(eval $(call gb_UnpackedTarball_set_patchlevel,boost,3))
 
 $(eval $(call gb_UnpackedTarball_add_patches,boost,\
 	$(foreach patch,$(boost_patches),external/boost/$(patch)) \
+    external/boost/boost-emscripten-noshm.patch.0 \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/external/boost/boost-emscripten-noshm.patch.0 b/external/boost/boost-emscripten-noshm.patch.0
new file mode 100644
index 000000000000..f9d27b0b6e11
--- /dev/null
+++ b/external/boost/boost-emscripten-noshm.patch.0
@@ -0,0 +1,11 @@
+--- boost/interprocess/detail/workaround.hpp.orig	2020-12-15 06:31:51.037665526 +0100
++++ boost/interprocess/detail/workaround.hpp	2020-12-15 06:32:39.741281893 +0100
+@@ -31,7 +31,7 @@
+    //////////////////////////////////////////////////////
+    //Check for XSI shared memory objects. They are available in nearly all UNIX platforms
+    //////////////////////////////////////////////////////
+-   #if !defined(__QNXNTO__) && !defined(__ANDROID__) && !defined(__HAIKU__) && !(__VXWORKS__)
++   #if !defined(__QNXNTO__) && !defined(__ANDROID__) && !defined(__HAIKU__) && !(__VXWORKS__) && !defined(__EMSCRIPTEN__)
+       #define BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS
+    #endif
+ 
diff --git a/external/cairo/ExternalProject_cairo.mk b/external/cairo/ExternalProject_cairo.mk
index 41e7621c789f..c8d4ac05d858 100644
--- a/external/cairo/ExternalProject_cairo.mk
+++ b/external/cairo/ExternalProject_cairo.mk
@@ -67,11 +67,12 @@ $(call gb_ExternalProject_get_state_target,cairo,build) :
 	./configure \
 		$(if $(debug),STRIP=" ") \
 		$(if $(filter ANDROID iOS,$(OS)),CFLAGS="$(if $(debug),-g) $(ZLIB_CFLAGS) $(gb_VISIBILITY_FLAGS)") \
-		$(if $(filter-out ANDROID iOS,$(OS)),CFLAGS="$(if $(debug),-g) $(ZLIB_CFLAGS)" ) \
+		$(if $(filter EMSCRIPTEN,$(OS)),CFLAGS=" $(ZLIB_CFLAGS) -pthread") \
+		$(if $(filter-out EMSCRIPTEN ANDROID iOS,$(OS)),CFLAGS="$(if $(debug),-g) $(ZLIB_CFLAGS)" ) \
 		$(if $(filter ANDROID iOS,$(OS)),PKG_CONFIG=./dummy_pkg_config) \
 		LIBS="$(ZLIB_LIBS)" \
 		$(if $(filter -fsanitize=%,$(LDFLAGS)),LDFLAGS="$(LDFLAGS) -fuse-ld=bfd") \
-		pixman_CFLAGS="-I$(call gb_UnpackedTarball_get_dir,pixman)/pixman" \
+		pixman_CFLAGS="-I$(call gb_UnpackedTarball_get_dir,pixman)/pixman -pthread" \
 		pixman_LIBS="-L$(call gb_UnpackedTarball_get_dir,pixman)/pixman/.libs -lpixman-1 \
 			$(if $(filter LINUX,$(OS)),-Wl$(COMMA)-z$(COMMA)origin \
 					-Wl$(COMMA)-rpath$(COMMA)\\\$$\$$ORIGIN) \
@@ -84,7 +85,7 @@ $(call gb_ExternalProject_get_state_target,cairo,build) :
 		$(if $(SYSTEM_FONTCONFIG),,FONTCONFIG_CFLAGS="-I$(call gb_UnpackedTarball_get_dir,fontconfig)") \
 		$(if $(verbose),--disable-silent-rules,--enable-silent-rules) \
 		$(if $(filter TRUE,$(DISABLE_DYNLOADING)),--disable-shared,$(if $(filter ANDROID,$(OS)),--disable-shared,--disable-static)) \
-		$(if $(filter ANDROID iOS,$(OS)),--disable-xlib --disable-xcb,$(if $(filter TRUE,$(DISABLE_GUI)),--disable-xlib --disable-xcb,--enable-xlib --enable-xcb)) \
+		$(if $(filter EMSCRIPTEN ANDROID iOS,$(OS)),--disable-xlib --disable-xcb,$(if $(filter TRUE,$(DISABLE_GUI)),--disable-xlib --disable-xcb,--enable-xlib --enable-xcb)) \
 		$(if $(filter iOS,$(OS)),--enable-quartz --enable-quartz-font) \
 		--disable-valgrind \
 		$(if $(filter iOS,$(OS)),--disable-ft,--enable-ft --enable-fc) \
diff --git a/external/cairo/ExternalProject_pixman.mk b/external/cairo/ExternalProject_pixman.mk
index fec943762df8..00b61170ff77 100644
--- a/external/cairo/ExternalProject_pixman.mk
+++ b/external/cairo/ExternalProject_pixman.mk
@@ -39,6 +39,7 @@ $(call gb_ExternalProject_get_state_target,pixman,build) :
 		$(if $(filter ANDROID,$(OS)),--disable-arm-simd --disable-arm-neon --disable-arm-iwmmxt) \
 		$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) \
 		$(if $(filter INTEL ARM,$(CPUNAME)),ac_cv_c_bigendian=no)) \
+		$(if $(filter EMSCRIPTEN,$(OS)),CFLAGS="-pthread") \
 		&& $(MAKE) \
 	)
 	$(call gb_Trace_EndRange,pixman,EXTERNAL)
diff --git a/external/fontconfig/ExternalProject_fontconfig.mk b/external/fontconfig/ExternalProject_fontconfig.mk
index b82c7657395b..14190675427a 100644
--- a/external/fontconfig/ExternalProject_fontconfig.mk
+++ b/external/fontconfig/ExternalProject_fontconfig.mk
@@ -21,7 +21,7 @@ $(eval $(call gb_ExternalProject_register_targets,fontconfig,\
 $(call gb_ExternalProject_get_state_target,fontconfig,build) :
 	$(call gb_Trace_StartRange,fontconfig,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
-		CFLAGS="$(if $(debug),-g) $(gb_VISIBILITY_FLAGS)" $(if $(filter ANDROID,$(OS)),LIBS="-lm") \
+		CFLAGS="$(if $(debug),-g) $(gb_VISIBILITY_FLAGS) $(if $(filter EMSCRIPTEN,$(OS)),-pthread)" $(if $(filter ANDROID,$(OS)),LIBS="-lm") \
 		./configure \
 			--disable-shared \
 			--disable-silent-rules \
@@ -29,6 +29,7 @@ $(call gb_ExternalProject_get_state_target,fontconfig,build) :
 			--with-expat-includes=$(call gb_UnpackedTarball_get_dir,expat)/lib \
 			--with-expat-lib=$(gb_StaticLibrary_WORKDIR) \
 			--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) \
+			$(if $(filter EMSCRIPTEN,$(OS)),ac_cv_func_fstatfs=no ac_cv_func_fstatvfs=no) \
 		&& $(MAKE) -C src \
 	)
 	$(call gb_Trace_EndRange,fontconfig,EXTERNAL)
diff --git a/external/icu/ExternalProject_icu.mk b/external/icu/ExternalProject_icu.mk
index 015d286b1414..0c8a7047ec01 100644
--- a/external/icu/ExternalProject_icu.mk
+++ b/external/icu/ExternalProject_icu.mk
@@ -73,7 +73,7 @@ $(call gb_ExternalProject_get_state_target,icu,build) :
 		./configure \
 			--disable-layout --disable-samples \
 			$(if $(filter FUZZERS,$(BUILD_TYPE)),--disable-release) \
-			$(if $(filter ENSCRIPTEN ANDROID,$(OS)),--disable-strict ac_cv_c_bigendian=no) \
+			$(if $(filter EMSCRIPTEN ANDROID,$(OS)),--disable-strict ac_cv_c_bigendian=no) \
 			$(if $(filter SOLARIS AIX,$(OS)),--disable-64bit-libs) \
 			$(if $(filter TRUE,$(DISABLE_DYNLOADING)),\
 				--with-data-packaging=static --enable-static --disable-shared --disable-dyload,\
@@ -81,6 +81,7 @@ $(call gb_ExternalProject_get_state_target,icu,build) :
 			$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)\
 				--with-cross-build=$(WORKDIR_FOR_BUILD)/UnpackedTarball/icu/source \
 				--disable-tools --disable-extras) \
+			AR="$(AR)" RANLIB="$(RANLIB)" \
 		&& $(MAKE) $(if $(CROSS_COMPILING),DATASUBDIR=data) $(if $(verbose),VERBOSE=1) \
 		$(if $(filter MACOSX,$(OS)), \
 			&& $(PERL) $(SRCDIR)/solenv/bin/macosx-change-install-names.pl shl \
diff --git a/external/icu/icu4c-emscripten-cross.patch.1 b/external/icu/icu4c-emscripten-cross.patch.1
index 5935a0169f53..2462a1fb93fe 100644
--- a/external/icu/icu4c-emscripten-cross.patch.1
+++ b/external/icu/icu4c-emscripten-cross.patch.1
@@ -10,7 +10,7 @@
  		]
 --- /dev/null
 +++ icu/source/config/mh-emscripten	2015-10-06 12:01:00.497972406 +0200
-@@ -0,0 +1,89 @@
+@@ -0,0 +1,85 @@
 +## Emscripten-specific setup
 +## Copyright (c) 1999-2013, International Business Machines Corporation and
 +## others. All Rights Reserved.
@@ -52,18 +52,15 @@
 +## Shared object suffix
 +SO = so
 +## Non-shared intermediate object suffix
-+STATIC_O = ao
++STATIC_O = o
 +
 +## Compilation rules
++# WASM needs -pthread for atomics support
 +%.$(STATIC_O): $(srcdir)/%.c
-+	$(call SILENT_COMPILE,$(strip $(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS)) -o $@ $<)
-+%.o: $(srcdir)/%.c
-+	$(call SILENT_COMPILE,$(strip $(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS)) -o $@ $<)
++	$(call SILENT_COMPILE,$(strip $(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS)) -pthread -o $@ $<)
 +
 +%.$(STATIC_O): $(srcdir)/%.cpp
-+	$(call SILENT_COMPILE,$(strip $(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS)) -o $@ $<)
-+%.o: $(srcdir)/%.cpp
-+	$(call SILENT_COMPILE,$(strip $(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS)) -o $@ $<)
++	$(call SILENT_COMPILE,$(strip $(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS)) -pthread -o $@ $<)
 +
 +
 +## Dependency rules
diff --git a/external/liblangtag/ExternalProject_liblangtag.mk b/external/liblangtag/ExternalProject_liblangtag.mk
index 51dc4f4b0c68..b45615e86ff0 100644
--- a/external/liblangtag/ExternalProject_liblangtag.mk
+++ b/external/liblangtag/ExternalProject_liblangtag.mk
@@ -29,7 +29,7 @@ $(call gb_ExternalProject_get_state_target,liblangtag,build):
 			--enable-shared --disable-static) \
 		$(if $(verbose),--disable-silent-rules,--enable-silent-rules) \
 		$(if $(filter TRUE,$(HAVE_GCC_BUILTIN_ATOMIC)),"lt_cv_has_atomic=yes","lt_cv_has_atomic=no") \
-		CFLAGS='$(CFLAGS) \
+		CFLAGS='$(CFLAGS) -pthread \
 				$(if $(ENABLE_OPTIMIZED), \
 					$(gb_COMPILEROPTFLAGS),$(gb_COMPILERNOOPTFLAGS)) \
 				$(if $(call gb_Module__symbols_enabled,liblangtag),$(gb_DEBUGINFO_FLAGS))' \
diff --git a/include/sal/alloca.h b/include/sal/alloca.h
index bb4c3e0e0c05..05fe1b715f33 100644
--- a/include/sal/alloca.h
+++ b/include/sal/alloca.h
@@ -21,7 +21,7 @@
 #define INCLUDED_SAL_ALLOCA_H
 
 #if defined(__sun) || defined(LINUX) || defined(AIX) || defined(ANDROID) || defined(HAIKU)         \
-    || defined(MACOSX) || defined(IOS)
+    || defined(MACOSX) || defined(IOS) || defined(EMSCRIPTEN)
 
 #ifndef INCLUDED_ALLOCA_H
 #include <alloca.h>
diff --git a/sal/osl/unx/system.hxx b/sal/osl/unx/system.hxx
index a8b0e10cd163..fb0e0aa47282 100644
--- a/sal/osl/unx/system.hxx
+++ b/sal/osl/unx/system.hxx
@@ -269,13 +269,32 @@ int macxp_resolveAlias(char *path, int buflen);
 #   define  NO_PTHREAD_RTL
 #endif
 
+#ifdef EMSCRIPTEN
+#   ifndef ETIME
+#       define  ETIME ETIMEDOUT
+#   endif
+#   include <pthread.h>
+#   include <sys/file.h>
+#   include <sys/ioctl.h>
+#   include <sys/uio.h>
+#   include <sys/un.h>
+#   include <netinet/tcp.h>
+#   include <dlfcn.h>
+#   include <endian.h>
+#   include <sys/time.h>
+#   define  IORESOURCE_TRANSFER_BSD
+#   define  IOCHANNEL_TRANSFER_BSD_RENO
+#   define  pthread_testcancel()
+#   define  NO_PTHREAD_PRIORITY
+#endif
+
 #if !defined(_WIN32)  && \
     !defined(LINUX)   && !defined(NETBSD) && !defined(FREEBSD) && \
     !defined(AIX)     && \
     !defined(__sun) && !defined(MACOSX) && \
     !defined(OPENBSD) && !defined(DRAGONFLY) && \
     !defined(IOS) && !defined(ANDROID) && \
-    !defined(HAIKU)
+    !defined(HAIKU) && !defined(EMSCRIPTEN)
 #   error "Target platform not specified!"
 #endif
 
diff --git a/scripting/Module_scripting.mk b/scripting/Module_scripting.mk
index 1d603d585a11..1d974e8e7c26 100644
--- a/scripting/Module_scripting.mk
+++ b/scripting/Module_scripting.mk
@@ -31,7 +31,7 @@ $(eval $(call gb_Module_add_targets,scripting,\
 		$(if $(ENABLE_SCRIPTING_BEANSHELL),Package_ScriptsBeanShell) \
 		$(if $(ENABLE_SCRIPTING_JAVASCRIPT),Package_ScriptsJavaScript) \
 	) \
-	$(if $(DISABLE_SCRIPTING),,Package_scriptbindinglib) \
+	Package_scriptbindinglib \
 	$(if $(DISABLE_PYTHON),,\
 		Package_scriptproviderforpython \
 		Package_ScriptsPython \
diff --git a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
index 7495a32626aa..a1d2813edaf9 100644
--- a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
+++ b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
@@ -13,6 +13,12 @@ else
 gb_UnoApiHeadersTarget_select_variant = $(2)
 endif
 
+gb_LinkTarget_LDFLAGS += -s TOTAL_MEMORY=1GB
+
 include $(GBUILDDIR)/platform/unxgcc.mk
 
+gb_CFLAGS += -pthread -s TOTAL_MEMORY=1GB -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=4
+gb_CXXFLAGS += -pthread -s TOTAL_MEMORY=1GB -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=4
+gb_CXX_LINKFLAGS += -pthread -s TOTAL_MEMORY=1GB -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=4
+
 # vim: set noet sw=4 ts=4
diff --git a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_emcc.mk b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_emcc.mk
deleted file mode 100644
index 7495a32626aa..000000000000
--- a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_emcc.mk
+++ /dev/null
@@ -1,18 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-
-ifeq ($(DISABLE_DYNLOADING),TRUE)
-gb_UnoApiHeadersTarget_select_variant = $(if $(filter udkapi,$(1)),comprehensive,$(2))
-else
-gb_UnoApiHeadersTarget_select_variant = $(2)
-endif
-
-include $(GBUILDDIR)/platform/unxgcc.mk
-
-# vim: set noet sw=4 ts=4
diff --git a/solenv/gbuild/platform/com_GCC_defs.mk b/solenv/gbuild/platform/com_GCC_defs.mk
index 5f4a06445225..d5b23ae31875 100644
--- a/solenv/gbuild/platform/com_GCC_defs.mk
+++ b/solenv/gbuild/platform/com_GCC_defs.mk
@@ -140,7 +140,7 @@ endif
 gb_VISIBILITY_FLAGS_CXX := -fvisibility-inlines-hidden
 gb_CXXFLAGS_COMMON += $(gb_VISIBILITY_FLAGS_CXX)
 
-gb_LinkTarget_LDFLAGS += -fstack-protector-strong
+gb_LinkTarget_LDFLAGS += $(if $(filter EMSCRIPTEN,$(OS)),-fno-stack-protector,-fstack-protector-strong)
 
 ifneq ($(gb_ENABLE_PCH),)
 ifeq ($(COM_IS_CLANG),TRUE)
diff --git a/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk
index 7ef9d0b4015e..bde5c0fe0a76 100644
--- a/solenv/gbuild/platform/unxgcc.mk
+++ b/solenv/gbuild/platform/unxgcc.mk
@@ -135,7 +135,7 @@ $(call gb_Helper_abbreviate_dirs,\
 		    $(T_LIBS) \
 		    $(if $(CXXOBJECTS)$(GENCXXOBJECTS)$(EXTRAOBJECTLISTS)$(filter-out XTRUE,X$(ENABLE_RUNTIME_OPTIMIZATIONS)),$(T_STDLIBS_CXX)) \
 		    -Wl$(COMMA)--end-group \
-		    , \
+		, \
 		    -Wl$(COMMA)--start-group \
 		    $(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_target,$(lib))) \
 		    $(T_LIBS) \
diff --git a/svx/Module_svx.mk b/svx/Module_svx.mk
index 20339da7c58e..fed54a9185ca 100644
--- a/svx/Module_svx.mk
+++ b/svx/Module_svx.mk
@@ -47,7 +47,7 @@ $(eval $(call gb_Module_add_screenshot_targets,svx,\
 
 ifneq (,$(filter DESKTOP,$(BUILD_TYPE)))
 $(eval $(call gb_Module_add_targets,svx,\
-    Executable_gengal \
+    $(if $(filter-out EMSCRIPTEN,$(OS)),Executable_gengal) \
     $(if $(filter-out MACOSX WNT,$(OS)), \
 		Package_gengal) \
 ))
diff --git a/unoidl/Executable_unoidl-read.mk b/unoidl/Executable_unoidl-read.mk
index b134c30b1a72..037097df1ba6 100644
--- a/unoidl/Executable_unoidl-read.mk
+++ b/unoidl/Executable_unoidl-read.mk
@@ -21,4 +21,8 @@ $(eval $(call gb_Executable_use_libraries,unoidl-read, \
     sal \
 ))
 
+ifeq ($(DISABLE_DYNLOADING),TRUE)
+$(eval $(call gb_Executable_use_external,unoidl-read,dtoa))
+endif
+
 # vim: set noet sw=4 ts=4:
diff --git a/vcl/Executable_ui-previewer.mk b/vcl/Executable_ui-previewer.mk
index bee97cbac14b..acee26cd15d3 100644
--- a/vcl/Executable_ui-previewer.mk
+++ b/vcl/Executable_ui-previewer.mk
@@ -9,7 +9,35 @@
 
 $(eval $(call gb_Executable_Executable,ui-previewer))
 
-$(eval $(call gb_Executable_use_external,ui-previewer,boost_headers))
+$(eval $(call gb_Executable_use_externals,ui-previewer,\
+    boost_headers \
+    $(if $(filter TRUE,$(DISABLE_DYNLOADING)),\
+        dtoa \
+        icuuc \
+        icui18n \
+        icudata \
+        libpng \
+        libjpeg \
+        harfbuzz \
+        libxml2 \
+        graphite \
+        liblangtag \
+        qt5 \
+        cairo \
+        fontconfig \
+        lcms2 \
+        freetype \
+        openssl \
+        expat \
+        orcus-parser \
+        orcus \
+        qrcodegen \
+        boost_filesystem \
+        boost_iostreams \
+        boost_system \
+        mdds_headers \
+    ) \
+))
 
 $(eval $(call gb_Executable_use_api,ui-previewer,\
     offapi \
@@ -17,17 +45,54 @@ $(eval $(call gb_Executable_use_api,ui-previewer,\
 ))
 
 $(eval $(call gb_Executable_use_static_libraries,ui-previewer,\
+    $(if $(filter TRUE,$(DISABLE_DYNLOADING)),boost_locale) \
     vclmain \
 ))
 
 $(eval $(call gb_Executable_use_libraries,ui-previewer,\
-	comphelper \
-	cppu \
-	cppuhelper \
-	sal \
+    comphelper \
+    cppu \
+    cppuhelper \
+    sal \
     tl \
     ucbhelper \
     vcl \
+    $(if $(filter TRUE,$(DISABLE_DYNLOADING)), \
+        acc \
+        avmedia \
+        basegfx \
+        cui \
+        dbtools \
+        drawinglayer \
+        editeng \
+        emfio \
+        epoxy \
+        fwk \
+        gcc3_uno \
+        gie \
+        graphicfilter \
+        i18nlangtag \
+        i18nutil \
+        lng \
+        reg \
+        salhelper \
+        sax \
+        sfx \
+        sot \
+        store \
+        svl \
+        svt \
+        svx \
+        svxcore \
+        tk \
+        ucbhelper \
+        unoidl \
+        utl \
+        xmlreader \
+        xo \
+        xof \
+        $(if $(filter EMSCRIPTEN,$(OS)),vclplug_qt5) \
+    ) \
 ))
 
 $(eval $(call gb_Executable_add_exception_objects,ui-previewer,\
@@ -40,12 +105,12 @@ $(eval $(call gb_Executable_add_defs,ui-previewer,\
 
 ifeq ($(OS), $(filter LINUX %BSD SOLARIS, $(OS)))
 $(eval $(call gb_Executable_add_libs,ui-previewer,\
-	-lm $(DLOPEN_LIBS) \
+    -lm $(DLOPEN_LIBS) \
     -lX11 \
 ))
 
 $(eval $(call gb_Executable_use_static_libraries,ui-previewer,\
-	glxtest \
+    glxtest \
 ))
 endif
 
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index ff8c4182af2f..69bba379be42 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -569,6 +569,24 @@ $(eval $(call gb_Library_use_externals,vcl,\
 ))
 endif
 
+ifeq ($(OS),EMSCRIPTEN)
+$(eval $(call gb_Library_add_exception_objects,vcl,\
+    vcl/unx/generic/printer/jobdata \
+    vcl/unx/generic/printer/ppdparser \
+    vcl/null/printerinfomanager \
+    vcl/wasm/salplug \
+    $(vcl_headless_code) \
+    $(vcl_headless_freetype_code) \
+))
+
+$(eval $(call gb_Library_use_externals,vcl,\
+    cairo \
+    expat \
+    fontconfig \
+    freetype \
+))
+endif
+
 ifeq ($(OS), $(filter LINUX %BSD SOLARIS, $(OS)))
 $(eval $(call gb_Library_add_libs,vcl,\
     -lm $(DLOPEN_LIBS) \
diff --git a/vcl/Library_vclplug_qt5.mk b/vcl/Library_vclplug_qt5.mk
index 25cbfe9f60ba..3aad76800ad6 100644
--- a/vcl/Library_vclplug_qt5.mk
+++ b/vcl/Library_vclplug_qt5.mk
@@ -80,8 +80,6 @@ $(eval $(call gb_Library_add_libs,vclplug_qt5,\
 endif
 
 $(eval $(call gb_Library_add_exception_objects,vclplug_qt5,\
-    vcl/qt5/Qt5AccessibleEventListener \
-    vcl/qt5/Qt5AccessibleWidget \
     vcl/qt5/Qt5Bitmap \
     vcl/qt5/Qt5Clipboard \
     vcl/qt5/Qt5Data \
@@ -110,8 +108,15 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt5,\
     vcl/qt5/Qt5Transferable \
     vcl/qt5/Qt5VirtualDevice \
     vcl/qt5/Qt5Widget \
+))
+
+ifneq ($(OS),EMSCRIPTEN)
+$(eval $(call gb_Library_add_exception_objects,vclplug_qt5,\
+    vcl/qt5/Qt5AccessibleEventListener \
+    vcl/qt5/Qt5AccessibleWidget \
     vcl/qt5/Qt5XAccessible \
 ))
+endif
 
 ifeq ($(OS),LINUX)
 $(eval $(call gb_Library_add_libs,vclplug_qt5,\
diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk
index 8bfc67c1e2ef..2a910a9ced3f 100644
--- a/vcl/Module_vcl.mk
+++ b/vcl/Module_vcl.mk
@@ -78,12 +78,6 @@ $(eval $(call gb_Module_add_targets,vcl,\
     Library_vclplug_kf5 \
 ))
 endif
-ifneq ($(ENABLE_QT5),)
-$(eval $(call gb_Module_add_targets,vcl,\
-    CustomTarget_qt5_moc \
-    Library_vclplug_qt5 \
-))
-endif
 ifneq ($(ENABLE_GTK3_KDE5),)
 $(eval $(call gb_Module_add_targets,vcl,\
     CustomTarget_gtk3_kde5_moc \
@@ -122,6 +116,13 @@ $(eval $(call gb_Module_add_targets,vcl,\
 endif
 endif
 
+ifneq ($(ENABLE_QT5),)
+$(eval $(call gb_Module_add_targets,vcl,\
+    CustomTarget_qt5_moc \
+    Library_vclplug_qt5 \
+))
+endif
+
 ifneq ($(ENABLE_FUZZERS),)
 $(eval $(call gb_Module_add_targets,vcl,\
     CustomTarget_nativecore \
diff --git a/vcl/qt5/Qt5Instance.cxx b/vcl/qt5/Qt5Instance.cxx
index 97eff04fe77a..2f6bfb4b5fcd 100644
--- a/vcl/qt5/Qt5Instance.cxx
+++ b/vcl/qt5/Qt5Instance.cxx
@@ -562,7 +562,7 @@ void* Qt5Instance::CreateGStreamerSink(const SystemChildWindow* pWindow)
 
     return pVideosink;
 #else
-    (void*)pWindow;
+    Q_UNUSED(pWindow);
     return nullptr;
 #endif
 }
diff --git a/vcl/qt5/Qt5MainWindow.cxx b/vcl/qt5/Qt5MainWindow.cxx
index 45d726ba22be..89879864a9bc 100644
--- a/vcl/qt5/Qt5MainWindow.cxx
+++ b/vcl/qt5/Qt5MainWindow.cxx
@@ -19,7 +19,9 @@ Qt5MainWindow::Qt5MainWindow(Qt5Frame& rFrame, Qt::WindowFlags f)
     : QMainWindow(nullptr, f)
     , m_rFrame(rFrame)
 {
+#ifndef EMSCRIPTEN
     QAccessible::installFactory(Qt5AccessibleWidget::customFactory);
+#endif
 }
 
 void Qt5MainWindow::closeEvent(QCloseEvent* pEvent)
diff --git a/vcl/wasm/salplug.cxx b/vcl/wasm/salplug.cxx
new file mode 100644
index 000000000000..b5ba480dd104
--- /dev/null
+++ b/vcl/wasm/salplug.cxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "saldatabasic.hxx"
+#include "printerinfomanager.hxx"
+
+extern "C" SalInstance* create_SalInstance();
+
+void SalAbort(const OUString& /* rErrorText */, bool /* bDumpCore */)
+{
+    //    NSLog(@"SalAbort: %s", OUStringToOString(rErrorText, osl_getThreadTextEncoding()).getStr() );
+}
+
+const OUString& SalGetDesktopEnvironment()
+{
+    static OUString aEnv("wasm");
+    return aEnv;
+}
+
+SalInstance* CreateSalInstance() { return create_SalInstance(); }
+
+void DestroySalInstance(SalInstance* pInst)
+{
+    pInst->ReleaseYieldMutexAll();
+    delete pInst;
+}
+
+SalData::SalData()
+    : m_pInstance(nullptr)
+    , m_pPIManager(nullptr)
+{
+}
+
+SalData::~SalData() COVERITY_NOEXCEPT_FALSE { psp::PrinterInfoManager::release(); }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 247fbf99042fcb7777accbe0c46d2754caf9558d
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Fri Dec 11 17:27:59 2020 +0100
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Thu Dec 17 21:00:13 2020 +0100

    WASM catchall commit
    
    The current state is incompatible with upstream, especially the
    emconfigure change.
    
    Please also read README.wasm
    
    Change-Id: I668b4128491c467b94ea1c13ee695b08dce32968

diff --git a/README.wasm b/README.wasm
new file mode 100644
index 000000000000..be6cc4ff0ecf
--- /dev/null
+++ b/README.wasm
@@ -0,0 +1,144 @@
+= Setup for the LO WASM build (with Qt) =
+
+We're using Qt 5.15 with the officially supported emscripten v1.39.8.
+But there are several potential problems with threads and exceptions, so this will likely
+change later zo a newer emscripten.
+
+Qt WASM is not yet used with LO, just if you're wondering!
+
+== Setup emscripten ==
+
+https://emscripten.org/docs/getting_started/index.html
+
+git clone https://github.com/emscripten-core/emsdk.git
+./emsdk install 1.39.8
+./emsdk activate --embedded 1.39.8
+
+Example bashrc scriptlet:
+
+EMSDK_ENV=$HOME/Development/libreoffice/git_emsdk/emsdk_env.sh
+[ -f "$EMSDK_ENV" ] && \. "$EMSDK_ENV" 1>/dev/null 2>&1
+
+
+== Setup LO ==
+
+Currently autogen.sh is patched to use emconfigure. That basically sets various environment vars,
+especially EMMAKEN_JUST_CONFIGURE, which will create the correct output file names, checked by
+configure (a.out).
+
+--host=wasm64-local-emscripten
+--disable-cups
+--disable-dconf
+--disable-gio
+--disable-dbus
+--disable-sdremote-bluetooth
+--disable-gstreamer-1-0
+--disable-odk
+--disable-postgresql-sdbc
+--disable-firebird-sdbc
+--disable-mariadb-sdbc
+--disable-nss
+--disable-python
+--disable-randr
+--disable-pdfimport
+--disable-report-builder
+--disable-lpsolve
+--disable-coinmp
+--without-fonts
+--without-java
+--without-junit
+--without-helppack-integration
+--without-system-dicts
+--with-theme=no
+--disable-cairo-canvas
+--disable-scripting
+--disable-dynamic-loading
+--disable-ccache
+--disable-gtk3
+--enable-qt5
+
+Will also be encoded in configure.ac at some point, some already is.
+
+
+== Setup Qt ==
+
+https://doc.qt.io/qt-5/wasm.html
+
+I originally build the Qt 5.15 branch, but probably better to build a tag like v5.15.2.
+
+./configure -xplatform wasm-emscripten -feature-thread -compile-examples -prefix $PWD/qtbase
+make -j<CORES> module-qtbase module-qtdeclarative
+
+Building with examples will break with some of them, but at that point Qt already works.
+
+If you get a configure failure for Qt:
+
+Checking for target architecture... Project ERROR: target architecture detection binary not found.
+
+Edit qtbase/config.tests/arch/write_info.pri
+-     ext = .wasm
++     ext = .js.wasm
+
+Current Qt fails to start the demo webserver: https://bugreports.qt.io/browse/QTCREATORBUG-24072
+Use: emrun --serve_after_close to run Qt WASM demos
+
+
+= Mixed information, links, problems, TODO =
+
+More info on Qt WASM emscripten pthreads: https://wiki.qt.io/Qt_for_WebAssembly#Multithreading_Support
+
+Qt with threads has further memory limit. From Qt configure:
+Project MESSAGE: Setting PTHREAD_POOL_SIZE to 4
+Project MESSAGE: Setting TOTAL_MEMORY to 1GB
+
+LO uses a nested event loop to run dialogs in general, but that won't work, because you can't drive
+the browser event loop. like VCL does with the system event loop in the various VCL backends.
+Changing this will need some major work (basically dropping Application::Execute).
+
+But with the know problems with exceptions and threads, this might change:
+- https://github.com/emscripten-core/emscripten/pull/11518
+- https://github.com/emscripten-core/emscripten/issues/11503
+- https://github.com/emscripten-core/emscripten/issues/11233
+- https://github.com/emscripten-core/emscripten/issues/12035
+
+We're also using emconfigure at the moment. Originally I patched emscripten, because it
+woulden't create the correct a.out file for C++ configure tests. Later I found that
+the emconfigure sets EMMAKEN_JUST_CONFIGURE to work around the problem.
+
+But it sets many more environment variables with "em<tool>" variants. This can all be moved
+into LO configure later.
+
+ICU bug: https://github.com/emscripten-core/emscripten/issues/10129
+Alternative, probably: https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Intl
+
+There is a wasm64, but that still uses 32bit pointers!
+
+Old outdated docs: https://wiki.documentfoundation.org/Development/Emscripten
+Reverted patch: https://cgit.freedesktop.org/libreoffice/core/commit/?id=0e21f6619c72f1e17a7b0a52b6317810973d8a3e
+
+Generally https://emscripten.org/docs/porting:
+- https://emscripten.org/docs/porting/guidelines/api_limitations.html#api-limitations
+- https://emscripten.org/docs/porting/files/file_systems_overview.html#file-system-overview
+- https://emscripten.org/docs/porting/pthreads.html
+- https://emscripten.org/docs/porting/emscripten-runtime-environment.html
+
+This will be interesting: https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-an-event-loop
+
+This didn't help much yet: https://github.com/emscripten-ports
+
+https://www.qt.io/qt-examples-for-webassembly
+http://qtandeverything.blogspot.com/2017/06/qt-for-web-assembly.html
+http://qtandeverything.blogspot.com/2020/
+https://emscripten.org/docs/api_reference/Filesystem-API.html
+https://discuss.python.org/t/add-a-webassembly-wasm-runtime/3957/12
+http://git.savannah.gnu.org/cgit/config.git
+https://webassembly.org/specs/
+https://developer.chrome.com/docs/native-client/
+https://emscripten.org/docs/getting_started/downloads.html
+https://github.com/openpgpjs/openpgpjs/blob/master/README.md#getting-started
+https://developer.mozilla.org/en-US/docs/WebAssembly/Using_the_JavaScript_API
+https://github.com/bytecodealliance/wasmtime/blob/main/docs/WASI-intro.md
+https://www.ip6.li/de/security/x.509_kochbuch/openssl-fuer-webassembly-compilieren
+https://emscripten.org/docs/introducing_emscripten/about_emscripten.html#about-emscripten-porting-code
+https://emscripten.org/docs/compiling/Building-Projects.html
+
diff --git a/autogen.sh b/autogen.sh
index 1779de77e6f3..54cc7e6262c8 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -313,7 +313,7 @@ if (defined $ENV{NOCONFIGURE}) {
         $ENV{"PROGRAMFILESX86"} = $ENV{"ProgramFiles(x86)"};
     }
 
-    system ("./configure", @args) && die "Error running configure";
+    system ("emconfigure", "./configure", @args) && die "Error running configure";
 }
 
 # Local Variables:
diff --git a/bridges/Module_bridges.mk b/bridges/Module_bridges.mk
index 3016bf2c404f..126e43b1cd31 100644
--- a/bridges/Module_bridges.mk
+++ b/bridges/Module_bridges.mk
@@ -22,6 +22,7 @@ $(eval $(call gb_Module_add_targets,bridges,\
 	) \
 ))
 
+ifneq ($(OS), EMSCRIPTEN)
 ifeq (,$(filter build,$(gb_Module_SKIPTARGETS)))
 ifeq ($(strip $(bridges_SELECTED_BRIDGE)),)
 $(call gb_Output_error,no bridge selected for build: bailing out)
@@ -29,5 +30,6 @@ else ifneq ($(words $(bridges_SELECTED_BRIDGE)),1)
 $(call gb_Output_error,multiple bridges selected for build: $(bridges_SELECTED_BRIDGE))
 endif
 endif
+endif
 
 # vim: set noet sw=4 ts=4:
diff --git a/config_host.mk.in b/config_host.mk.in
index add0c176ebc6..791f88f964b2 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -328,6 +328,7 @@ export KF5_LIBS=$(gb_SPACE)@KF5_LIBS@
 export KRB5_LIBS=@KRB5_LIBS@
 export LCMS2_CFLAGS=$(gb_SPACE)@LCMS2_CFLAGS@
 export LCMS2_LIBS=$(gb_SPACE)@LCMS2_LIBS@
+export LD=@LD@
 export LD_GC_SECTIONS=@LD_GC_SECTIONS@
 export LD_PLUGIN=@LD_PLUGIN@
 @x_LDFLAGS@ export LDFLAGS=@LDFLAGS@
@@ -640,6 +641,7 @@ export USE_XINERAMA=@USE_XINERAMA@
 export UPDATE_CONFIG=@UPDATE_CONFIG@
 export UUIDGEN=@UUIDGEN@
 export VALGRIND_CFLAGS=$(gb_SPACE)@VALGRIND_CFLAGS@
+export VCL_PLUGIN_INFO=@VCL_PLUGIN_INFO@
 export VCVER=@VCVER@
 export DEVENV=@DEVENV@
 export VISIO_CFLAGS=$(gb_SPACE)@VISIO_CFLAGS@
diff --git a/configure.ac b/configure.ac
index 1458c394c9fc..7500307f87dd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1108,6 +1108,27 @@ haiku*)
     _os=Haiku
     ;;
 
+emscripten*)
+    build_gstreamer_1_0=no
+    enable_coinmp=yes
+    enable_lpsolve=no
+    enable_report_builder=no
+    with_theme="breeze"
+    test_cups=no
+    test_dbus=no
+    test_fontconfig=no
+    test_freetype=no
+    test_gtk=no
+    test_kde4=no
+    test_randr=no
+    test_xrender=no
+    enable_postgresql_sdbc=no
+    enable_firebird_sdbc=no
+    enable_mariadb_sdbc=no
+    with_system_zlib=no
+    _os=Emscripten
+    ;;
+
 *)
     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
     ;;
@@ -1806,6 +1827,13 @@ libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
          Requires --enable-openssl.]))
 
+AC_ARG_ENABLE(nss,
+    AS_HELP_STRING([--disable-nss],
+        [Disable using NSS. If disabled,
+         components will either use GNUTLS or openssl. Work in progress,
+         use only if you are hacking on it.]),
+,enable_nss=yes)
+
 AC_ARG_ENABLE(library-bin-tar,
     AS_HELP_STRING([--enable-library-bin-tar],
         [Enable the building and reused of tarball of binary build for some 'external' libraries.
@@ -4093,6 +4121,8 @@ if test "$COM_IS_CLANG" = TRUE; then
         [my_apple_clang=yes],[my_apple_clang=])
     if test "$my_apple_clang" = yes; then
         AC_MSG_RESULT([assumed yes (Apple Clang)])
+    elif test "$_os" = Emscripten; then
+        AC_MSG_RESULT([assumed yes (Emscripten Clang)])
     else
         if test "$_os" = WINNT; then
             dnl In which case, assume clang-cl:
@@ -5041,6 +5071,25 @@ solaris*)
     SOLARINC="$SOLARINC -I/usr/local/include"
     ;;
 
+emscripten*)
+    COM=GCC
+    USING_X11=
+    OS=EMSCRIPTEN
+    RTL_OS=Emscripten
+    P_SEP=:
+
+    case "$host_cpu" in
+    wasm32|wasm64)
+        ;;
+    *)
+        AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
+        ;;
+    esac
+    CPUNAME=INTEL
+    RTL_ARCH=x86
+    PLATFORMID=linux_x86
+    ;;
+
 *)
     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
     ;;
@@ -5165,7 +5214,8 @@ if test "$cross_compiling" = "yes"; then
     unset CC CXX SYSBASE CFLAGS
     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
-    unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
+    unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC
+    unset PKG_CONFIG_LIBDIR PKG_CONFIG_PATH
     if test -n "$CC_FOR_BUILD"; then
         export CC="$CC_FOR_BUILD"
         CC_BASE=`first_arg_basename "$CC"`
@@ -5210,6 +5260,7 @@ if test "$cross_compiling" = "yes"; then
         --disable-gstreamer-1-0 \
         --disable-gtk3 \
         --disable-mariadb-sdbc \
+        --disable-nss \
         --disable-online-update \
         --disable-opencl \
         --disable-pdfimport \
@@ -5230,7 +5281,9 @@ if test "$cross_compiling" = "yes"; then
     PERMITTED_BUILD_TARGETS="
         AVMEDIA
         BOOST
+        CAIRO
         CLUCENE
+        CURL
         DBCONNECTIVITY
         DESKTOP
         DYNLOADING
@@ -6036,6 +6089,7 @@ if test "$_os" != "WINNT"; then
 fi
 AC_SUBST(AR)
 AC_SUBST(DLLTOOL)
+AC_SUBST(LD)
 AC_SUBST(NM)
 AC_SUBST(OBJDUMP)
 AC_SUBST(PKG_CONFIG)
@@ -9120,6 +9174,9 @@ if test "$with_system_libxml" = "auto"; then
     WINNT|iOS|Android)
         with_system_libxml="$with_system_libs"
         ;;
+    Emscripten)
+        with_system_libxml=no
+        ;;
     *)
         if test "$enable_fuzzers" != "yes"; then
             with_system_libxml=yes
@@ -10106,7 +10163,7 @@ AC_SUBST(SYSTEM_OPENLDAP)
 dnl ===================================================================
 dnl Check for system NSS
 dnl ===================================================================
-if test "$enable_fuzzers" != "yes"; then
+if test "$enable_fuzzers" != "yes" -a "$enable_nss" = "yes"; then
     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
     AC_DEFINE(HAVE_FEATURE_NSS)
     ENABLE_NSS="TRUE"
@@ -11271,6 +11328,8 @@ if test -z "$build_vcl_plugins"; then
     build_vcl_plugins="none"
 fi
 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
+VCL_PLUGIN_INFO=$R
+AC_SUBST([VCL_PLUGIN_INFO])
 
 dnl ===================================================================
 dnl check for dbus support
diff --git a/external/icu/ExternalProject_icu.mk b/external/icu/ExternalProject_icu.mk
index 3ded08562211..015d286b1414 100644
--- a/external/icu/ExternalProject_icu.mk
+++ b/external/icu/ExternalProject_icu.mk
@@ -73,8 +73,7 @@ $(call gb_ExternalProject_get_state_target,icu,build) :
 		./configure \
 			--disable-layout --disable-samples \
 			$(if $(filter FUZZERS,$(BUILD_TYPE)),--disable-release) \
-			$(if $(filter iOS ANDROID,$(OS)),--disable-dyload) \
-			$(if $(filter ANDROID,$(OS)),--disable-strict ac_cv_c_bigendian=no) \
+			$(if $(filter ENSCRIPTEN ANDROID,$(OS)),--disable-strict ac_cv_c_bigendian=no) \
 			$(if $(filter SOLARIS AIX,$(OS)),--disable-64bit-libs) \
 			$(if $(filter TRUE,$(DISABLE_DYNLOADING)),\
 				--with-data-packaging=static --enable-static --disable-shared --disable-dyload,\
diff --git a/external/icu/UnpackedTarball_icu.mk b/external/icu/UnpackedTarball_icu.mk
index 435382fa7988..a59d6e8b97d7 100644
--- a/external/icu/UnpackedTarball_icu.mk
+++ b/external/icu/UnpackedTarball_icu.mk
@@ -41,6 +41,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,icu,\
 	external/icu/icu4c-windows-cygwin-cross.patch.1 \
 	external/icu/icu4c-$(if $(filter ANDROID,$(OS)),android,rpath).patch.1 \
 	$(if $(filter-out ANDROID,$(OS)),external/icu/icu4c-icudata-stdlibs.patch.1) \
+	external/icu/icu4c-emscripten-cross.patch.1 \
 ))
 
 $(eval $(call gb_UnpackedTarball_add_file,icu,source/data/brkitr/khmerdict.dict,external/icu/khmerdict.dict))
diff --git a/external/icu/icu4c-emscripten-cross.patch.1 b/external/icu/icu4c-emscripten-cross.patch.1
new file mode 100644
index 000000000000..5935a0169f53
--- /dev/null
+++ b/external/icu/icu4c-emscripten-cross.patch.1
@@ -0,0 +1,102 @@
+--- icu/source/acinclude.m4.orig	2020-04-22 22:04:20.000000000 +0200
++++ icu/source/acinclude.m4	2020-11-04 06:10:29.993070072 +0100
+@@ -84,6 +84,7 @@
+ *-dec-osf*) icu_cv_host_frag=mh-alpha-osf ;;
+ *-*-nto*)	icu_cv_host_frag=mh-qnx ;;
+ *-ncr-*)	icu_cv_host_frag=mh-mpras ;;
++wasm*-*-emscripten*)	icu_cv_host_frag=mh-emscripten ;;
+ *) 		icu_cv_host_frag=mh-unknown ;;
+ esac
+ 		]
+--- /dev/null
++++ icu/source/config/mh-emscripten	2015-10-06 12:01:00.497972406 +0200
+@@ -0,0 +1,89 @@
++## Emscripten-specific setup
++## Copyright (c) 1999-2013, International Business Machines Corporation and
++## others. All Rights Reserved.
++## Commands to generate dependency files
++GEN_DEPS.c=  $(CC) -E -MM $(DEFS) $(CPPFLAGS)
++GEN_DEPS.cc= $(CXX) -E -MM $(DEFS) $(CPPFLAGS) $(CXXFLAGS)
++ 
++## Flags for position independent code
++SHAREDLIBCFLAGS = -fPIC
++SHAREDLIBCXXFLAGS = -fPIC
++SHAREDLIBCPPFLAGS = -DPIC
++
++## Additional flags when building libraries and with threads
++THREADSCPPFLAGS = -D_REENTRANT
++LIBCPPFLAGS =
++
++## Compiler switch to embed a runtime search path
++LD_RPATH= -Wl,-zorigin,-rpath,'$$'ORIGIN
++LD_RPATH_PRE = -Wl,-rpath,
++
++## Force RPATH=$ORIGIN to locate own dependencies w/o need for LD_LIBRARY_PATH:
++ENABLE_RPATH=YES
++RPATHLDFLAGS=${LD_RPATH_PRE}'$$ORIGIN'
++
++## These are the library specific LDFLAGS
++#LDFLAGSICUDT=-nodefaultlibs -nostdlib
++# Debian change: linking icudata as data only causes too many problems.
++LDFLAGSICUDT=
++
++## Compiler switch to embed a library name
++# The initial tab in the next line is to prevent icu-config from reading it.
++	LD_SONAME = -Wl,-soname -Wl,$(notdir $(MIDDLE_SO_TARGET))
++#SH# # We can't depend on MIDDLE_SO_TARGET being set.
++#SH# LD_SONAME=
++
++## Shared library options
++LD_SOOPTIONS= -Wl,-Bsymbolic-functions
++
++## Shared object suffix
++SO = so
++## Non-shared intermediate object suffix
++STATIC_O = ao
++
++## Compilation rules
++%.$(STATIC_O): $(srcdir)/%.c
++	$(call SILENT_COMPILE,$(strip $(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS)) -o $@ $<)
++%.o: $(srcdir)/%.c
++	$(call SILENT_COMPILE,$(strip $(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS)) -o $@ $<)
++
++%.$(STATIC_O): $(srcdir)/%.cpp
++	$(call SILENT_COMPILE,$(strip $(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS)) -o $@ $<)
++%.o: $(srcdir)/%.cpp
++	$(call SILENT_COMPILE,$(strip $(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS)) -o $@ $<)
++
++
++## Dependency rules
++%.d: $(srcdir)/%.c
++	$(call ICU_MSG,(deps)) $<
++	@$(SHELL) -ec '$(GEN_DEPS.c) $< \
++		| sed '\''s%\($*\)\.o[ :]*%\1.o $@ : %g'\'' > $@; \
++		[ -s $@ ] || rm -f $@'
++
++%.d: $(srcdir)/%.cpp
++	$(call ICU_MSG,(deps)) $<
++	@$(SHELL) -ec '$(GEN_DEPS.cc) $< \
++		| sed '\''s%\($*\)\.o[ :]*%\1.o $@ : %g'\'' > $@; \
++		[ -s $@ ] || rm -f $@'
++
++## Versioned libraries rules
++
++%.$(SO).$(SO_TARGET_VERSION_MAJOR): %.$(SO).$(SO_TARGET_VERSION)
++	$(RM) $@ && ln -s ${<F} $@
++%.$(SO): %.$(SO).$(SO_TARGET_VERSION_MAJOR)
++	$(RM) $@ && ln -s ${*F}.$(SO).$(SO_TARGET_VERSION) $@
++
++##  Bind internal references
++
++# LDflags that pkgdata will use
++BIR_LDFLAGS= -Wl,-Bsymbolic
++
++# Dependencies [i.e. map files] for the final library
++BIR_DEPS=
++
++## Remove shared library 's'
++STATIC_PREFIX_WHEN_USED =
++STATIC_PREFIX =
++
++## without assembly
++PKGDATA_OPTS = -O $(top_builddir)/data/icupkg.inc -w
diff --git a/external/libxml2/ExternalProject_libxml2.mk b/external/libxml2/ExternalProject_libxml2.mk
index 778befade47f..5f19036983ac 100644
--- a/external/libxml2/ExternalProject_libxml2.mk
+++ b/external/libxml2/ExternalProject_libxml2.mk
@@ -13,6 +13,10 @@ $(eval $(call gb_ExternalProject_register_targets,libxml2,\
 	build \
 ))
 
+ifeq ($(OS),EMSCRIPTEN)
+$(call gb_ExternalProject_use_external_project,libxml2,icu)
+endif
+
 ifeq ($(OS),WNT)
 $(call gb_ExternalProject_use_external_project,libxml2,icu)
 
diff --git a/external/openssl/ExternalProject_openssl.mk b/external/openssl/ExternalProject_openssl.mk
index d0790e5e5b7b..0bb2ac7fef77 100644
--- a/external/openssl/ExternalProject_openssl.mk
+++ b/external/openssl/ExternalProject_openssl.mk
@@ -49,6 +49,8 @@ OPENSSL_PLATFORM := \
           $(if $(filter MACOSX,$(OS)),\
             $(if $(filter X86_64,$(CPUNAME)),darwin64-x86_64-cc)\
             $(if $(filter AARCH64,$(CPUNAME)),darwin64-arm64-cc)\
+	  ,\
+	    $(if $(filter EMSCRIPTEN,$(OS)),no-engine no-dso no-dgram no-sock no-srtp no-stdio no-err no-ocsp no-psk no-stdio no-ts no-asm) \
           )\
         )\
       )\
diff --git a/include/osl/endian.h b/include/osl/endian.h
index 766178a7eefc..4eb43c9011be 100644
--- a/include/osl/endian.h
+++ b/include/osl/endian.h
@@ -70,6 +70,8 @@ extern "C" {
 #   elif defined _BIG_ENDIAN
 #       define OSL_BIGENDIAN
 #   endif
+#elif defined EMSCRIPTEN
+#   define OSL_LITENDIAN
 #else
 #   error "Target platform not specified !"
 #endif
diff --git a/include/sal/config.h b/include/sal/config.h
index f8504b3c1129..01fef82dd89a 100644
--- a/include/sal/config.h
+++ b/include/sal/config.h
@@ -79,6 +79,17 @@
 #define SAL_CONFIGFILE(name) name "rc"
 #endif
 
+#ifdef EMSCRIPTEN
+#define SAL_UNX
+#define SAL_DLLEXTENSION ".bc"
+#define SAL_EXEEXTENSION ""
+#define SAL_DLLPREFIX "lib"
+#define SAL_PATHSEPARATOR ':'
+#define SAL_PATHDELIMITER '/'
+#define SAL_NEWLINE_STRING "\n"
+#define SAL_CONFIGFILE( name ) name "rc"
+#endif
+
 /* The following spell is for Solaris and its descendants.
  * See the "Solaris" section of
  * <http://sourceforge.net/p/predef/wiki/OperatingSystems/>, and
diff --git a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
new file mode 100644
index 000000000000..7495a32626aa
--- /dev/null
+++ b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
@@ -0,0 +1,18 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+ifeq ($(DISABLE_DYNLOADING),TRUE)
+gb_UnoApiHeadersTarget_select_variant = $(if $(filter udkapi,$(1)),comprehensive,$(2))
+else
+gb_UnoApiHeadersTarget_select_variant = $(2)
+endif
+
+include $(GBUILDDIR)/platform/unxgcc.mk
+
+# vim: set noet sw=4 ts=4
diff --git a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_emcc.mk b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_emcc.mk
new file mode 100644
index 000000000000..7495a32626aa
--- /dev/null
+++ b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_emcc.mk
@@ -0,0 +1,18 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+ifeq ($(DISABLE_DYNLOADING),TRUE)
+gb_UnoApiHeadersTarget_select_variant = $(if $(filter udkapi,$(1)),comprehensive,$(2))
+else
+gb_UnoApiHeadersTarget_select_variant = $(2)
+endif
+
+include $(GBUILDDIR)/platform/unxgcc.mk
+
+# vim: set noet sw=4 ts=4
diff --git a/solenv/gbuild/platform/com_GCC_defs.mk b/solenv/gbuild/platform/com_GCC_defs.mk
index 047f121106de..5f4a06445225 100644
--- a/solenv/gbuild/platform/com_GCC_defs.mk
+++ b/solenv/gbuild/platform/com_GCC_defs.mk
@@ -49,6 +49,7 @@ gb_COMPILERDEFS := \
 	-DBOOST_ERROR_CODE_HEADER_ONLY \
 	-DBOOST_SYSTEM_NO_DEPRECATED \
 	-DCPPU_ENV=$(gb_CPPU_ENV) \
+	$(if $(filter EMSCRIPTEN,$(OS)),-U_FORTIFY_SOURCE) \
 
 gb_CFLAGS_COMMON := \
 	-Wall \
@@ -63,7 +64,7 @@ gb_CFLAGS_COMMON := \
 	-fmessage-length=0 \
 	-fno-common \
 	-pipe \
-	-fstack-protector-strong \
+	$(if $(filter EMSCRIPTEN,$(OS)),-fno-stack-protector,-fstack-protector-strong) \
 	$(if $(gb_COLOR),-fdiagnostics-color=always) \
 
 gb_CXXFLAGS_COMMON := \
@@ -80,7 +81,7 @@ gb_CXXFLAGS_COMMON := \
 	-fmessage-length=0 \
 	-fno-common \
 	-pipe \
-	-fstack-protector-strong \
+	$(if $(filter EMSCRIPTEN,$(OS)),-fno-stack-protector,-fstack-protector-strong) \
 	$(if $(gb_COLOR),-fdiagnostics-color=always) \
 
 ifeq ($(HAVE_WDEPRECATED_COPY_DTOR),TRUE)
diff --git a/svl/Library_svl.mk b/svl/Library_svl.mk
index 291e2557638c..ea1ac49001bd 100644
--- a/svl/Library_svl.mk
+++ b/svl/Library_svl.mk
@@ -105,6 +105,7 @@ $(eval $(call gb_Library_use_system_win32_libs,svl,\
 ))
 else
 ifneq (,$(filter DESKTOP,$(BUILD_TYPE))$(filter ANDROID iOS,$(OS)))
+ifneq (,$(ENABLE_NSS))
 $(eval $(call gb_Library_add_defs,svl,\
     -DSVL_CRYPTO_NSS \
 ))
@@ -112,6 +113,7 @@ $(eval $(call gb_Library_use_externals,svl,\
     nss3 \
     plc4 \
 ))
+endif # !ENABLE_NSS
 endif # BUILD_TYPE=DESKTOP
 endif
 
commit 172373c4a2c4a66b8abbe26dbe07fd621c971ed0
Author:     László Németh <nemeth at numbertext.org>
AuthorDate: Wed Dec 16 12:23:22 2020 +0100
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Thu Dec 17 20:36:56 2020 +0100

    sw ChangesInMargin: fix crash at Undo of deletion of paragraph break
    
    Deletion of the paragraph break by pressing Delete results
    an empty hidden redline, too, which caused a problem during Undo
    (if there were other tracked redlines, too).
    
    Change-Id: I64968688688be72d4e501631244b4c57ab634585
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107830
    Tested-by: Jenkins
    Reviewed-by: László Németh <nemeth at numbertext.org>

diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx
index c3d4d71d6b5c..496b9b8602bc 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -2084,6 +2084,47 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf137771)
     CPPUNIT_ASSERT(!pWrtShell->GetViewOptions()->IsShowChangesInMargin());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testJoinParaChangesInMargin)
+{
+    load(DATA_DIRECTORY, "tdf54819.fodt");
+
+    SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+    CPPUNIT_ASSERT(pTextDoc);
+
+    // switch on "Show changes in margin" mode
+    dispatchCommand(mxComponent, ".uno:ShowChangesInMargin", {});
+
+    SwWrtShell* const pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+    CPPUNIT_ASSERT(pWrtShell->GetViewOptions()->IsShowChangesInMargin());
+
+    // turn on red-lining and show changes
+    SwDoc* pDoc = pWrtShell->GetDoc();
+    pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | RedlineFlags::ShowInsert
+                                                      | RedlineFlags::ShowDelete);
+    CPPUNIT_ASSERT_MESSAGE("redlining should be on",
+                           pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+    CPPUNIT_ASSERT_MESSAGE(
+        "redlines should be visible",
+        IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
+
+    // delete a character and the paragraph break at the end of the paragraph
+    dispatchCommand(mxComponent, ".uno:GotoEndOfPara", {});
+    pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/true, 1, /*bBasicCall=*/false);
+    dispatchCommand(mxComponent, ".uno:Delete", {});
+    dispatchCommand(mxComponent, ".uno:Delete", {});
+    CPPUNIT_ASSERT_EQUAL(OUString("Lorem ipsudolor sit amet."), getParagraph(1)->getString());
+
+    // Undo
+    dispatchCommand(mxComponent, ".uno:Undo", {});
+    // this would crash due to bad redline range
+    dispatchCommand(mxComponent, ".uno:Undo", {});
+    CPPUNIT_ASSERT_EQUAL(OUString("Lorem ipsum"), getParagraph(1)->getString());
+
+    // switch off "Show changes in margin" mode
+    dispatchCommand(mxComponent, ".uno:ShowChangesInMargin", {});
+    CPPUNIT_ASSERT(!pWrtShell->GetViewOptions()->IsShowChangesInMargin());
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf138479)
 {
     SwDoc* const pDoc = createDoc();
diff --git a/sw/source/core/undo/unredln.cxx b/sw/source/core/undo/unredln.cxx
index a737863c3835..38caba313d8d 100644
--- a/sw/source/core/undo/unredln.cxx
+++ b/sw/source/core/undo/unredln.cxx
@@ -108,7 +108,7 @@ void SwUndoRedline::UndoImpl(::sw::UndoRedoContext & rContext)
             for( SwRedlineTable::size_type n = 1; n < rTable.size(); ++n )
             {
                 SwRangeRedline *pRed(rTable[n]);
-                if ( pRedline->GetId() < pRed->GetId() && pRed->GetId() < nMaxId )
+                if ( !pRed->HasMark() && pRedline->GetId() < pRed->GetId() && pRed->GetId() < nMaxId )
                 {
                     nCurRedlinePos = n;
                     pRedline = pRed;
@@ -117,7 +117,7 @@ void SwUndoRedline::UndoImpl(::sw::UndoRedoContext & rContext)
 
             nMaxId = pRedline->GetId();
 
-            if ( !pRedline->IsVisible() )
+            if ( !pRedline->IsVisible() && !pRedline->HasMark() )
             {
                 // set it visible
                 pRedline->Show(0, rTable.GetPos(pRedline), /*bForced=*/true);
commit a66a6f4cc8efbca282d39e8dd48709ec82bbc26b
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Wed Dec 16 11:07:02 2020 +0100
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Thu Dec 17 20:36:43 2020 +0100

    prefetch graphics also for page before and after in slidesorter
    
    The idea is that this will make them preloaded for when the user
    scrolls e.g. using PageDown.
    
    Change-Id: Icac9b6e88b25e9b0434c5ab7a152f47866dfadc5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107823
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>

diff --git a/sd/source/ui/slidesorter/view/SlideSorterView.cxx b/sd/source/ui/slidesorter/view/SlideSorterView.cxx
index a531943096f1..f13aa1b7eb09 100644
--- a/sd/source/ui/slidesorter/view/SlideSorterView.cxx
+++ b/sd/source/ui/slidesorter/view/SlideSorterView.cxx
@@ -654,6 +654,14 @@ void SlideSorterView::Paint (
             continue;
         pDescriptor->GetPage()->getGraphicsForPrefetch(graphics);
     }
+    // Handle also one page before and after to have those in advance on scrolling.
+    for (::tools::Long nIndex : { aRange.Min() - 1, aRange.Max() + 1 })
+    {
+        model::SharedPageDescriptor pDescriptor (mrModel.GetPageDescriptor(nIndex));
+        if (!pDescriptor)
+            continue;
+        pDescriptor->GetPage()->getGraphicsForPrefetch(graphics);
+    }
     if(graphics.size() > 1) // threading does not help with loading just one
         GraphicFilter::GetGraphicFilter().MakeGraphicsAvailableThreaded(graphics);
 
commit 0c37e164dbbff89ecac843e1b182fdbce70cda34
Author:     Justin Luth <justin.luth at collabora.com>
AuthorDate: Sat Dec 5 19:48:36 2020 +0300
Commit:     Justin Luth <justin_luth at sil.org>
CommitDate: Thu Dec 17 18:41:51 2020 +0100

    tdf#137729 sd UI: unique hatch names in slide/page area dlg
    
    A custom hatch on a page background was not getting a name,
    so it was exported referring to an empty string, which was
    implemented as using the first available hatch.
    
    Ensuring that a name exists causes the hatch to be exported
    in the styles, and thus can be referred to in content.xml
    
    All praise goes to Katarina since this just copies her
    similar fix for grandients in tdf#125449.
    Too bad it took me a whole day to find that.
    
    Unfortunately, Katarina didn't provide any unit tests
    for me to copycat as well.
    
    Change-Id: If2be0830b521946fb1b88b247319a7e6c2c61c3c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107258
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
    Reviewed-by: Justin Luth <justin_luth at sil.org>

diff --git a/sd/source/ui/func/fupage.cxx b/sd/source/ui/func/fupage.cxx
index 3779feec3f82..6d44b70d5a9d 100644
--- a/sd/source/ui/func/fupage.cxx
+++ b/sd/source/ui/func/fupage.cxx
@@ -37,6 +37,7 @@
 #include <svx/xflbstit.hxx>
 #include <svx/xflbmtit.hxx>
 #include <svx/xflgrit.hxx>
+#include <svx/xflhtit.hxx>
 #include <editeng/ulspitem.hxx>
 #include <editeng/lrspitem.hxx>
 #include <svx/sdr/properties/properties.hxx>
@@ -394,6 +395,15 @@ const SfxItemSet* FuPage::ExecuteDialog(weld::Window* pParent, const SfxRequest&
                 SdrModel::MigrateItemSet( &aMigrateSet, pTempSet.get(), mpDoc);
             }
 
+            const XFillHatchItem* pTempHatchItem = pTempSet->GetItem<XFillHatchItem>(XATTR_FILLHATCH);
+            if (pTempHatchItem && pTempHatchItem->GetName().isEmpty())
+            {
+                // MigrateItemSet guarantees unique hatch names
+                SfxItemSet aMigrateSet( mpDoc->GetPool(), svl::Items<XATTR_FILLHATCH, XATTR_FILLHATCH>{} );
+                aMigrateSet.Put( XFillHatchItem("hatch", pTempHatchItem->GetHatchValue()) );
+                SdrModel::MigrateItemSet( &aMigrateSet, pTempSet.get(), mpDoc);
+            }
+
             if( !mbMasterPage && bChanges && mbPageBckgrdDeleted )
             {
                  mpBackgroundObjUndoAction.reset( new SdBackgroundObjUndoAction(
commit 554949d5cacaff2d0080b3e4f6124f8c5b045d6e
Author:     Jean-Pierre Ledure <jp at ledure.be>
AuthorDate: Thu Dec 17 17:20:45 2020 +0100
Commit:     Jean-Pierre Ledure <jp at ledure.be>
CommitDate: Thu Dec 17 18:39:46 2020 +0100

    ScriptForge - (SFDocuments) new Activate() method in SF_Form class
    
    Activate
    - the parent document if Writer
    - the parent sheet if Calc
    - the parent form document if Base
    
    Change-Id: Idf2af0184111467d0a94fb27709fd6bb289c6414
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107888
    Tested-by: Jean-Pierre Ledure <jp at ledure.be>
    Tested-by: Jenkins
    Reviewed-by: Jean-Pierre Ledure <jp at ledure.be>

diff --git a/wizards/source/sfdocuments/SF_Base.xba b/wizards/source/sfdocuments/SF_Base.xba
index 8ab19d5cf103..d0900849255f 100644
--- a/wizards/source/sfdocuments/SF_Base.xba
+++ b/wizards/source/sfdocuments/SF_Base.xba
@@ -67,7 +67,7 @@ Private _FormDocuments			As Object
 
 REM ============================================================ MODULE CONSTANTS
 
-Const ISBASEFORM = 2				'	Form is stored in a Base document
+Const ISBASEFORM = 3				'	Form is stored in a Base document
 Const cstToken = "//"				'	Form names accept special characters but not slashes
 
 REM ====================================================== CONSTRUCTOR/DESTRUCTOR
@@ -238,7 +238,7 @@ Try:
 			Set .[Me] = oForm
 			Set .[_Parent] = [Me]
 			._DrawPage = cstDrawPage
-			._UsualName = FormDocument & " : " & ._Name
+			._FormDocumentName = FormDocument
 			Set ._MainForm = oMainForm
 			._FormType = ISBASEFORM
 			Set ._Form = oXForm
@@ -710,4 +710,4 @@ Private Function _Repr() As String
 End Function	'	SFDocuments.SF_Base._Repr
 
 REM ============================================ END OF SFDOCUMENTS.SF_BASE
-</script:module>
+</script:module>
\ No newline at end of file
diff --git a/wizards/source/sfdocuments/SF_Calc.xba b/wizards/source/sfdocuments/SF_Calc.xba
index 86825961630c..aeb19ffed9c7 100644
--- a/wizards/source/sfdocuments/SF_Calc.xba
+++ b/wizards/source/sfdocuments/SF_Calc.xba
@@ -869,8 +869,8 @@ Public Function Forms(Optional ByVal SheetName As Variant _
 '''		An instance of the SF_Form class if Form exists
 '''	Example:
 '''			Dim myForm As Object, myList As Variant
-'''				myList = oDoc.Forms()
-'''				Set myForm = oDoc.Forms("myForm")
+'''				myList = oDoc.Forms("ThisSheet")
+'''				Set myForm = oDoc.Forms("ThisSheet", 0)
 
 Dim oForm As Object					'	The new Form class instance
 Dim oMainForm As Object				'	com.sun.star.comp.sdb.Content
@@ -914,7 +914,7 @@ Try:
 			Set .[Me] = oForm
 			Set .[_Parent] = [Me]
 			._DrawPage = cstDrawPage
-			._UsualName = SheetName & " : " & ._Name
+			._SheetName = SheetName
 			Set ._MainForm = Nothing
 			._FormType = ISCALCFORM
 			Set ._Form = oXForm
diff --git a/wizards/source/sfdocuments/SF_Form.xba b/wizards/source/sfdocuments/SF_Form.xba
index ef83da999582..0b9303fae9b6 100644
--- a/wizards/source/sfdocuments/SF_Form.xba
+++ b/wizards/source/sfdocuments/SF_Form.xba
@@ -76,14 +76,15 @@ Private ServiceName			As String
 '	Form location
 Private _Name				As String		' Internal name of the form
 Private _DrawPage			As Long			' Index in DrawPages collection
-Private _UsualName			As String		' Name as known by user
+Private _SheetName			As String		' Name as the sheet containing the form (Calc only)
+Private _FormDocumentName	As String		' The hierarchical name of the containing form document (Base only)
 Private _FormType			As Integer		' One of the ISxxxFORM constants
 
 '	Form UNO references
 '		The forms container found in a Base document
 '		Vital for Base forms and subforms
 Private _MainForm			As Object		' com.sun.star.comp.sdb.Content
-'		The entry to the interactions with the form. Set by the _IsStillAlive() method
+'		The entry to the interactions with the form. Validity checked by the _IsStillAlive() method
 '		Each method or property requiring that the form is opened should first invoke that method
 Private _Form				As Object		' com.sun.star.form.XForm or com.sun.star.comp.forms.ODatabaseForm
 Private _Database			As Object		' Database class instance
@@ -110,6 +111,8 @@ Private Sub Class_Initialize()
 	ServiceName = "SFDocuments.Form"
 	_Name = ""
 	_DrawPage = -1
+	_SheetName = ""
+	_FormDocumentName = ""
 	_FormType = 0
 	Set _MainForm = Nothing
 	Set _Form = Nothing
@@ -124,6 +127,9 @@ End Sub		'	SFDocuments.SF_Form Destructor
 
 REM -----------------------------------------------------------------------------
 Public Function Dispose() As Variant
+	If Not IsNull(_Database) And (_FormType = ISDOCFORM Or _FormType = ISCALCFORM) Then
+		Set _Database = _Database.Dispose()
+	End If
 	Call Class_Terminate()
 	Set Dispose = Nothing
 End Function	'	SFDocuments.SF_Form Explicit Destructor
@@ -201,16 +207,19 @@ REM ===================================================================== METHOD
 REM -----------------------------------------------------------------------------
 Public Function Activate() As Boolean
 '''	Set the focus on the current Form instance
-'''	Probably called from after an event occurrence or to focus on an open fForm
+'''	Probably called from after an event occurrence or to focus on an open Base form document
+'''	If the parent document is ...
+'''		Calc		Activate the corresponding sheet
+'''		Writer		Activate the parent document
+'''		Base		Activate the parent form document
 '''	Args:
 '''	Returns:
 '''		True if focusing is successful
 '''	Example:
-'''		Dim oDlg As Object
-'''			Set oDlg = CreateScriptService(,, "myForm")	'	Form stored in current document's standard library
-'''			oDlg.Activate()
+'''			myForm.Activate()
 
 Dim bActivate As Boolean		'	Return value
+Dim oContainer As Object		'	com.sun.star.awt.XWindow
 Const cstThisSub = "SFDocuments.Form.Activate"
 Const cstSubArgs = ""
 
@@ -222,6 +231,20 @@ Check:
 		If Not _IsStillAlive() Then GoTo Finally
 	End If
 Try:
+	Select Case _FormType
+		Case ISDOCFORM		:	bActivate = [_Parent].Activate()
+		Case ISCALCFORM		:	bActivate = [_Parent].Activate(_SheetName)
+		Case ISBASEFORM
+			Set oContainer = _MainForm.Component.CurrentController.Frame.ContainerWindow
+			With oContainer
+				If .isVisible() = False Then .setVisible(True)
+				.IsMinimized = False
+				.setFocus()
+				.toFront()				'	Force window change in Linux
+				Wait 1					'	Bypass desynchro issue in Linux
+			End With
+			bActivate = True
+	End Select
 
 Finally:
 	Activate = bActivate
@@ -520,12 +543,14 @@ End Function	'	SFDocuments.SF_Form._GetListener
 REM -----------------------------------------------------------------------------
 Private Function _IsStillAlive(Optional ByVal pbError As Boolean) As Boolean
 '''	Return True if the Form is still open
-'''	If dead the actual instance is partially (part related to open forms) disposed
+'''	If dead the actual instance is disposed
 '''	and the execution is cancelled when pbError = True (default)
 '''	Args:
 '''		pbError: if True (default), raise a fatal error
 
 Dim bAlive As Boolean		'	Return value
+Dim sName As String			'	Alias of _Name
+Dim sId As String			'	Alias of FileIdent
 
 Check:
 	On Local Error GoTo Catch		'	Anticipate DisposedException errors or alike
@@ -551,12 +576,14 @@ Finally:
 Catch:
 	bAlive = False
 	On Error GoTo 0
-	'	Dispose the properties related to *open* forms
-	Set _Form = Nothing
-	If Not IsNull(_Database) And _FormType = ISDOCFORM Then Set _Database = _Database.Dispose()
-	Set _ControlCache = Nothing
+	'	Keep error message elements before disposing the instance
+	sName = _SheetName & _FormDocumentName		'	At least one of them is a zero-length string
+	sName = Iif(Len(sName) > 0, "[" & sName & "].", "") & _Name
+	sId = [_Parent]._FileIdent()
+	'	Dispose the actual forms instance
+	Dispose()
 	'	Display error message
-	If pbError Then ScriptForge.SF_Exception.RaiseFatal(FORMDEADERROR, _Name, [_Parent]._FileIdent())
+	If pbError Then ScriptForge.SF_Exception.RaiseFatal(FORMDEADERROR, sName, sId)
 	GoTo Finally
 End Function	'	SFDocuments.SF_Form._IsStillAlive
 
@@ -644,9 +671,12 @@ Private Function _Repr() As String
 '''	Return:
 '''		"[Form]: Name"
 
-	_Repr = "[Form]: " & _UsualName
+Dim sParent As String		'	To recognize the parent
+
+	sParent = _SheetName & _FormDocumentName		'	At least one of them is a zero-length string
+	_Repr = "[Form]: " & Iif(Len(sParent) > 0, sParent & "...", "") & _Name
 
 End Function	'	SFDocuments.SF_Form._Repr
 
 REM ============================================ END OF SFDOCUMENTS.SF_FORM
-</script:module>
+</script:module>
\ No newline at end of file
commit 668525eeeb4a84bafb90b1d920e68a1cc3e8dfaf
Author:     Andrea Gelmini <andrea.gelmini at gelma.net>
AuthorDate: Wed Dec 16 20:52:10 2020 +0100
Commit:     Julien Nabet <serval2412 at yahoo.fr>
CommitDate: Thu Dec 17 18:37:08 2020 +0100

    Removed executable bits on fodt file
    
    Change-Id: I6abb926efe745e27190cd36e249d2b8845c348f0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107855
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
    Tested-by: Jenkins

diff --git a/sw/qa/extras/layout/data/tdf137819.fodt b/sw/qa/extras/layout/data/tdf137819.fodt
old mode 100755
new mode 100644
commit 5cf7d315891147ca20c57b2ced9193938160189b
Author:     Andrea Gelmini <andrea.gelmini at gelma.net>
AuthorDate: Wed Dec 16 20:51:59 2020 +0100
Commit:     Julien Nabet <serval2412 at yahoo.fr>
CommitDate: Thu Dec 17 18:36:48 2020 +0100

    Fix typo
    
    Change-Id: I1790f37a3d0a6d4921f819b27c29cc6ee59ce00c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107854
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
    Tested-by: Jenkins

diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index ebbc41744734..1402459297bb 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -711,7 +711,7 @@ void VclPixelProcessor2D::processControlPrimitive2D(
             // Tiled Rendering clients usually do *not* have real VCL-Windows for the controls, but
             // exactly that would be needed on each client displaying the tiles (what would be hard
             // to do but also would have advantages - the clients would have real controls in the
-            //  shape of their traget system which could be interacted with...). It is also what the
+            //  shape of their target system which could be interacted with...). It is also what the
             // office does.
             // For now, fallback to just render these controls when Tiled Rendering is active to just
             // have them displayed on all clients.
commit 22214e27c7b0a8ef5612326d85dd9b847819413d
Author:     Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
AuthorDate: Thu Dec 17 18:36:04 2020 +0100
Commit:     Gerrit Code Review <gerrit at gerrit.libreoffice.org>
CommitDate: Thu Dec 17 18:36:04 2020 +0100

    Update git submodules
    
    * Update translations from branch 'master'
      to 14f402c21427505066d2b5e093bdf48488ac5964
      - update translations for 7.1.0 rc1
    
        and force-fix errors usinc pocheck
    
        Change-Id: I302feb12a0180d134f32c450c15f2eae5cc6b19b

diff --git a/translations b/translations
index 0c5bce2255d6..14f402c21427 160000
--- a/translations
+++ b/translations
@@ -1 +1 @@
-Subproject commit 0c5bce2255d6cab360e066c391a14d85d7e7d115
+Subproject commit 14f402c21427505066d2b5e093bdf48488ac5964
commit 475422a4368b22df0418a2120ab2dec5d3440892
Author:     Georgy Litvinov <git at litvinovg.pro>
AuthorDate: Wed Dec 16 23:16:32 2020 +0100
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Dec 17 18:13:03 2020 +0100

    tdf#138818 Import full TIFF file
    
    Change-Id: I519c810b8e52f698884eb8feac6994140ce9ca25
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107859
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/filter/source/graphicfilter/itiff/itiff.cxx b/filter/source/graphicfilter/itiff/itiff.cxx
index 061d1a0ac73b..e7c571111e38 100644
--- a/filter/source/graphicfilter/itiff/itiff.cxx
+++ b/filter/source/graphicfilter/itiff/itiff.cxx
@@ -1695,7 +1695,7 @@ bool TIFFReader::ReadTIFF(SvStream & rTIFF, Graphic & rGraphic )
 
     // seek to end of TIFF if succeeded
     pTIFF->SetEndian( nOrigNumberFormat );
-    pTIFF->Seek(bStatus ? nMaxPos : nOrigPos);
+    pTIFF->Seek(bStatus ? STREAM_SEEK_TO_END: nOrigPos);
 
     if ( aAnimation.Count() )
     {
commit 5e636ec653ce798935ed85aeef96a6fcff893729
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Thu Dec 17 14:17:05 2020 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Thu Dec 17 15:47:51 2020 +0100

    Various minor loplugin fixes (macOS ARM64)
    
    Change-Id: I32276e3ceafa1e65671ba395de3f6fa587179d79
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107878
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/bridges/source/cpp_uno/gcc3_linux_aarch64/abi.cxx b/bridges/source/cpp_uno/gcc3_linux_aarch64/abi.cxx
index 0fce88db6749..8db8c37140e5 100644
--- a/bridges/source/cpp_uno/gcc3_linux_aarch64/abi.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_aarch64/abi.cxx
@@ -45,7 +45,7 @@
 namespace {
 
 OUString toUnoName(char const * name) {
-    assert(name != 0);
+    assert(name != nullptr);
     OUStringBuffer b;
     bool scoped = *name == 'N';
     if (scoped) {
@@ -74,7 +74,7 @@ OUString toUnoName(char const * name) {
 
 class Rtti {
 public:
-    Rtti(): app_(dlopen(0, RTLD_LAZY)) {}
+    Rtti(): app_(dlopen(nullptr, RTLD_LAZY)) {}
 
     ~Rtti() { dlclose(app_); }
 
@@ -107,7 +107,7 @@ std::type_info * Rtti::getRtti(typelib_TypeDescription const & type) {
         OString sym(b.makeStringAndClear());
         std::type_info * rtti = static_cast<std::type_info *>(
             dlsym(app_, sym.getStr()));
-        if (rtti == 0) {
+        if (rtti == nullptr) {
             char const * rttiName = strdup(sym.getStr() + std::strlen("_ZTI"));
             if (rttiName == nullptr) {
                 throw std::bad_alloc();
@@ -123,7 +123,7 @@ std::type_info * Rtti::getRtti(typelib_TypeDescription const & type) {

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list