Rebased ref, commits from common ancestor:
commit d78960d442ae16d453ef09e000df754a8073e940
Author: TheRock Builder <libo@therock>
AuthorDate: Thu Apr 28 14:19:46 2022 +0000
Commit: TheRock Builder <libo@therock>
CommitDate: Thu Apr 28 14:42:15 2022 +0000
Hack lokit API to be useable from JS
So LOWA users/embeddings can call uno slots
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 2086f531b6a8..aa7abbf64d32 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1031,7 +1031,7 @@ static void
doc_postWindowGestureEvent(LibreOfficeKitDocument* pThis,
int nX,
int nY,
int nOffset);
-static void doc_postUnoCommand(LibreOfficeKitDocument* pThis,
+void doc_postUnoCommand(LibreOfficeKitDocument* pThis,
const char* pCommand,
const char* pArguments,
bool bNotifyWhenFinished);
@@ -4123,7 +4123,7 @@ static void lo_setOption(LibreOfficeKit* /*pThis*/, const
char *pOption, const c
}
}
-static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char*
pCommand, const char* pArguments, bool bNotifyWhenFinished)
+void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pCommand,
const char* pArguments, bool bNotifyWhenFinished)
{
comphelper::ProfileZone aZone("doc_postUnoCommand");
@@ -6804,9 +6804,19 @@ LibreOfficeKit *libreofficekit_hook_2(const char*
install_path, const char* user
}
SAL_JNI_EXPORT
-LibreOfficeKit *libreofficekit_hook(const char* install_path)
+LibreOfficeKitDocument *libreofficekit_hook(const char*)
{
- return libreofficekit_hook_2(install_path, nullptr);
+ if (!gImpl)
+ {
+ gImpl = new LibLibreOffice_Impl();
+ xContext.set( ::comphelper::getProcessComponentContext(),
uno::UNO_SET_THROW );
+ }
+
+ uno::Reference<frame::XDesktop> xDesktop =
frame::Desktop::create(xContext);
+ uno::Reference<lang::XComponent> xComponent =
xDesktop->getCurrentComponent();
+ LibLODocument_Impl* pDocument = new LibLODocument_Impl(xComponent, 0);
+
+ return pDocument;
}
SAL_JNI_EXPORT
commit fc8d54cd011e17c03f39229c3c2ddf161c874bee
Author: TheRock Builder <libo@therock>
AuthorDate: Thu Apr 28 14:19:22 2022 +0000
Commit: TheRock Builder <libo@therock>
CommitDate: Thu Apr 28 14:42:14 2022 +0000
Add more functions to export for LOWA
diff --git a/desktop/Executable_soffice_bin.mk
b/desktop/Executable_soffice_bin.mk
index b0711af84952..4e321fa932e9 100644
--- a/desktop/Executable_soffice_bin.mk
+++ b/desktop/Executable_soffice_bin.mk
@@ -50,7 +50,7 @@ endif
ifeq ($(OS),EMSCRIPTEN)
$(eval $(call gb_Executable_add_ldflags,soffice_bin,\
- -s
EXPORTED_FUNCTIONS=["_main"$(COMMA)"_libreofficekit_hook"$(COMMA)"_libreofficekit_hook_2"$(COMMA)"_lok_preinit"$(COMMA)"_lok_preinit_2"]
\
+ -s
EXPORTED_FUNCTIONS=["_main"$(COMMA)"_libreofficekit_hook"$(COMMA)"_libreofficekit_hook_2"$(COMMA)"_lok_preinit"$(COMMA)"_lok_preinit_2"$(COMMA)"_doc_postUnoCommand"]
\
))
endif
diff --git a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
index f4ec28673142..19ad9b86c887 100644
--- a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
+++ b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
@@ -27,7 +27,7 @@ gb_EMSCRIPTEN_LDFLAGS += -s TOTAL_MEMORY=1GB -s
PTHREAD_POOL_SIZE=4
# To keep the link time (and memory) down, prevent all rewriting options from
wasm-emscripten-finalize
# See emscripten.py, finalize_wasm, modify_wasm = True
# So we need WASM_BIGINT=1 and ASSERTIONS=1 (2 implies STACK_OVERFLOW_CHECK)
-gb_EMSCRIPTEN_LDFLAGS += --bind -s FORCE_FILESYSTEM=1 -s WASM_BIGINT=1 -s
ERROR_ON_UNDEFINED_SYMBOLS=1 -s FETCH=1 -s ASSERTIONS=1 -s EXIT_RUNTIME=0 -s
EXPORTED_RUNTIME_METHODS=["UTF16ToString","stringToUTF16","printErr","ccall","cwrap"]
+gb_EMSCRIPTEN_LDFLAGS += --bind -s FORCE_FILESYSTEM=1 -s WASM_BIGINT=1 -s
ERROR_ON_UNDEFINED_SYMBOLS=1 -s FETCH=1 -s ASSERTIONS=1 -s EXIT_RUNTIME=0 -s
EXPORTED_RUNTIME_METHODS=["UTF16ToString","stringToUTF16","UTF8ToString","allocateUTF8","printErr","ccall","cwrap"]
gb_EMSCRIPTEN_QTDEFS := -DQT_NO_LINKED_LIST -DQT_NO_JAVA_STYLE_ITERATORS
-DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG
-DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB
gb_Executable_EXT := .html
commit 2fdbec41960cded5872e972360af6c24ac03bcca
Author: TheRock Builder <libo@therock>
AuthorDate: Wed Apr 27 17:01:53 2022 +0000
Commit: TheRock Builder <libo@therock>
CommitDate: Thu Apr 28 14:42:13 2022 +0000
Revert "Hack / temp"
This reverts commit 66263d549caf2bf2892e9d6c6ca3c2423df38164.
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index ceadb47896d9..2086f531b6a8 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -9,9 +9,6 @@
#include <config_features.h>
-#include <emscripten.h>
-
-
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -1319,7 +1316,7 @@ static OUString getGenerator()
return sGenerator.replaceFirst("%1", os);
}
-//extern "C" {
+extern "C" {
CallbackFlushHandler::TimeoutIdle::TimeoutIdle( CallbackFlushHandler* handler )
: Timer( "lokit timer callback" )
@@ -6783,9 +6780,7 @@ static int lo_initialize(LibreOfficeKit* pThis, const
char* pAppPath, const char
return bInitialized;
}
-extern "C" {
-
-EMSCRIPTEN_KEEPALIVE
+SAL_JNI_EXPORT
LibreOfficeKit *libreofficekit_hook_2(const char* install_path, const char*
user_profile_url)
{
static bool alreadyCalled = false;
@@ -6808,7 +6803,7 @@ LibreOfficeKit *libreofficekit_hook_2(const char*
install_path, const char* user
return static_cast<LibreOfficeKit*>(gImpl);
}
-EMSCRIPTEN_KEEPALIVE
+SAL_JNI_EXPORT
LibreOfficeKit *libreofficekit_hook(const char* install_path)
{
return libreofficekit_hook_2(install_path, nullptr);
commit de543be67f0b6072015cf7f57d9c30e24a5a5a8c
Author: TheRock Builder <libo@therock>
AuthorDate: Wed Apr 27 17:01:34 2022 +0000
Commit: TheRock Builder <libo@therock>
CommitDate: Thu Apr 28 14:42:11 2022 +0000
Hack / temp
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 2086f531b6a8..ceadb47896d9 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -9,6 +9,9 @@
#include <config_features.h>
+#include <emscripten.h>
+
+
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -1316,7 +1319,7 @@ static OUString getGenerator()
return sGenerator.replaceFirst("%1", os);
}
-extern "C" {
+//extern "C" {
CallbackFlushHandler::TimeoutIdle::TimeoutIdle( CallbackFlushHandler* handler )
: Timer( "lokit timer callback" )
@@ -6780,7 +6783,9 @@ static int lo_initialize(LibreOfficeKit* pThis, const
char* pAppPath, const char
return bInitialized;
}
-SAL_JNI_EXPORT
+extern "C" {
+
+EMSCRIPTEN_KEEPALIVE
LibreOfficeKit *libreofficekit_hook_2(const char* install_path, const char*
user_profile_url)
{
static bool alreadyCalled = false;
@@ -6803,7 +6808,7 @@ LibreOfficeKit *libreofficekit_hook_2(const char*
install_path, const char* user
return static_cast<LibreOfficeKit*>(gImpl);
}
-SAL_JNI_EXPORT
+EMSCRIPTEN_KEEPALIVE
LibreOfficeKit *libreofficekit_hook(const char* install_path)
{
return libreofficekit_hook_2(install_path, nullptr);
commit e0ec44d4f683d7adc7f50e5f0da6128274375c39
Author: TheRock Builder <libo@therock>
AuthorDate: Wed Apr 27 16:51:46 2022 +0000
Commit: TheRock Builder <libo@therock>
CommitDate: Thu Apr 28 14:42:10 2022 +0000
More fixup of gbuild
diff --git a/desktop/Executable_soffice_bin.mk
b/desktop/Executable_soffice_bin.mk
index c5e9587d516e..b0711af84952 100644
--- a/desktop/Executable_soffice_bin.mk
+++ b/desktop/Executable_soffice_bin.mk
@@ -45,14 +45,14 @@ $(eval $(call gb_Executable_add_ldflags,soffice_bin,\
endif
+endif
+
ifeq ($(OS),EMSCRIPTEN)
$(eval $(call gb_Executable_add_ldflags,soffice_bin,\
-
-sEXPORTED_FUNCTIONS=_main,_libreofficekit_hook,_libreofficekit_hook_2,_lok_preinit,_lok_preinit_2
\
+ -s
EXPORTED_FUNCTIONS=["_main"$(COMMA)"_libreofficekit_hook"$(COMMA)"_libreofficekit_hook_2"$(COMMA)"_lok_preinit"$(COMMA)"_lok_preinit_2"]
\
))
endif
-endif
-
# vim: set ts=4 sw=4 et:
diff --git a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
index 5d0ef59d8360..f4ec28673142 100644
--- a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
+++ b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
@@ -24,13 +24,10 @@ gb_EMSCRIPTEN_LDFLAGS := $(gb_EMSCRIPTEN_CPPFLAGS)
# Initial memory size and worker thread pool
gb_EMSCRIPTEN_LDFLAGS += -s TOTAL_MEMORY=1GB -s PTHREAD_POOL_SIZE=4
-# add a few critical functions to export
-gb_EMSCRIPTEN_LDFLAGS += -sEXPORTED_RUNTIME_METHODS=ccall,cwrap
-
# To keep the link time (and memory) down, prevent all rewriting options from
wasm-emscripten-finalize
# See emscripten.py, finalize_wasm, modify_wasm = True
# So we need WASM_BIGINT=1 and ASSERTIONS=1 (2 implies STACK_OVERFLOW_CHECK)
-gb_EMSCRIPTEN_LDFLAGS += --bind -s FORCE_FILESYSTEM=1 -s WASM_BIGINT=1 -s
ERROR_ON_UNDEFINED_SYMBOLS=1 -s FETCH=1 -s ASSERTIONS=1 -s EXIT_RUNTIME=0 -s
EXPORTED_RUNTIME_METHODS=["UTF16ToString","stringToUTF16","printErr"]
+gb_EMSCRIPTEN_LDFLAGS += --bind -s FORCE_FILESYSTEM=1 -s WASM_BIGINT=1 -s
ERROR_ON_UNDEFINED_SYMBOLS=1 -s FETCH=1 -s ASSERTIONS=1 -s EXIT_RUNTIME=0 -s
EXPORTED_RUNTIME_METHODS=["UTF16ToString","stringToUTF16","printErr","ccall","cwrap"]
gb_EMSCRIPTEN_QTDEFS := -DQT_NO_LINKED_LIST -DQT_NO_JAVA_STYLE_ITERATORS
-DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG
-DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB
gb_Executable_EXT := .html
commit 48f029e72ab167918c10174caf88aa3d134a6b42
Author: TheRock Builder <libo@therock>
AuthorDate: Wed Apr 27 16:19:59 2022 +0000
Commit: TheRock Builder <libo@therock>
CommitDate: Thu Apr 28 14:42:08 2022 +0000
Fix logic
diff --git a/desktop/Executable_soffice_bin.mk
b/desktop/Executable_soffice_bin.mk
index d9489bdad098..c5e9587d516e 100644
--- a/desktop/Executable_soffice_bin.mk
+++ b/desktop/Executable_soffice_bin.mk
@@ -45,7 +45,7 @@ $(eval $(call gb_Executable_add_ldflags,soffice_bin,\
endif
-ifeq (TRUE,$(EMSCRIPTEN))
+ifeq ($(OS),EMSCRIPTEN)
$(eval $(call gb_Executable_add_ldflags,soffice_bin,\
-sEXPORTED_FUNCTIONS=_main,_libreofficekit_hook,_libreofficekit_hook_2,_lok_preinit,_lok_preinit_2
\
diff --git a/desktop/Library_sofficeapp.mk b/desktop/Library_sofficeapp.mk
index efc117424098..c315a113ca89 100644
--- a/desktop/Library_sofficeapp.mk
+++ b/desktop/Library_sofficeapp.mk
@@ -137,7 +137,7 @@ $(eval $(call gb_Library_add_exception_objects,sofficeapp,\
desktop/source/lib/lokandroid) \
))
else
-ifeq ($(filter TRUE,$(USING_X11) $(DISABLE_GUI) $(EMSCRIPTEN)),)
+ifneq ($(filter TRUE,$(USING_X11) $(DISABLE_GUI))($filter EMSCRIPTEN,$(OS)),)
$(eval $(call gb_Library_add_exception_objects,sofficeapp,\
desktop/source/lib/init \
desktop/source/lib/lokinteractionhandler \
commit 747c349052b6e63a3528b25fc861ab7d6e4d5cc3
Author: TheRock Builder <libo@therock>
AuthorDate: Wed Apr 27 15:36:25 2022 +0000
Commit: TheRock Builder <libo@therock>
CommitDate: Thu Apr 28 14:42:07 2022 +0000
Add LOKit functions and whitelist export for it to WASM
For calling into LOWA from native JS, make lokit functions available
diff --git a/desktop/Executable_soffice_bin.mk
b/desktop/Executable_soffice_bin.mk
index a3c3ff258613..d9489bdad098 100644
--- a/desktop/Executable_soffice_bin.mk
+++ b/desktop/Executable_soffice_bin.mk
@@ -45,6 +45,14 @@ $(eval $(call gb_Executable_add_ldflags,soffice_bin,\
endif
+ifeq (TRUE,$(EMSCRIPTEN))
+
+$(eval $(call gb_Executable_add_ldflags,soffice_bin,\
+
-sEXPORTED_FUNCTIONS=_main,_libreofficekit_hook,_libreofficekit_hook_2,_lok_preinit,_lok_preinit_2
\
+))
+
+endif
+
endif
# vim: set ts=4 sw=4 et:
diff --git a/desktop/Library_sofficeapp.mk b/desktop/Library_sofficeapp.mk
index 70f4b07ea045..efc117424098 100644
--- a/desktop/Library_sofficeapp.mk
+++ b/desktop/Library_sofficeapp.mk
@@ -137,20 +137,13 @@ $(eval $(call
gb_Library_add_exception_objects,sofficeapp,\
desktop/source/lib/lokandroid) \
))
else
-ifeq ($(USING_X11),TRUE)
+ifeq ($(filter TRUE,$(USING_X11) $(DISABLE_GUI) $(EMSCRIPTEN)),)
$(eval $(call gb_Library_add_exception_objects,sofficeapp,\
desktop/source/lib/init \
desktop/source/lib/lokinteractionhandler \
desktop/source/lib/lokclipboard \
))
endif
-ifeq ($(DISABLE_GUI),TRUE)
-$(eval $(call gb_Library_add_exception_objects,sofficeapp,\
- desktop/source/lib/init \
- desktop/source/lib/lokinteractionhandler \
- desktop/source/lib/lokclipboard \
-))
-endif
endif
# vim: set ts=4 sw=4 et:
diff --git a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
index 61424f72c44f..5d0ef59d8360 100644
--- a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
+++ b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
@@ -24,6 +24,9 @@ gb_EMSCRIPTEN_LDFLAGS := $(gb_EMSCRIPTEN_CPPFLAGS)
# Initial memory size and worker thread pool
gb_EMSCRIPTEN_LDFLAGS += -s TOTAL_MEMORY=1GB -s PTHREAD_POOL_SIZE=4
+# add a few critical functions to export
+gb_EMSCRIPTEN_LDFLAGS += -sEXPORTED_RUNTIME_METHODS=ccall,cwrap
+
# To keep the link time (and memory) down, prevent all rewriting options from
wasm-emscripten-finalize
# See emscripten.py, finalize_wasm, modify_wasm = True
# So we need WASM_BIGINT=1 and ASSERTIONS=1 (2 implies STACK_OVERFLOW_CHECK)
commit 9aa0f451f71aacde47ee410399a7c730bd1e4670
Author: Jan-Marek Glogowski <[email protected]>
AuthorDate: Tue Apr 26 18:11:55 2022 +0200
Commit: TheRock Builder <libo@therock>
CommitDate: Thu Apr 28 14:42:06 2022 +0000
WASM HACK fix NEH build
Workaround a toolchain bug. Also see comment in ~Desktop().
Change-Id: I158877b78794d81ccdc74e4d5fc023e2061c1d96
diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx
index 3372e751dbf1..8eb71d3b13b5 100644
--- a/desktop/inc/app.hxx
+++ b/desktop/inc/app.hxx
@@ -166,7 +166,7 @@ class Desktop final : public Application
BootstrapStatus m_aBootstrapStatus;
std::unique_ptr<Lockfile> m_xLockfile;
- Timer m_firstRunTimer;
+ Timer *m_firstRunTimer;
std::thread m_aUpdateThread;
};
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index a45ce9f82a51..e61ee9653697 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -426,14 +426,16 @@ Desktop::Desktop()
, m_bServicesRegistered(false)
, m_aBootstrapError(BE_OK)
, m_aBootstrapStatus(BS_OK)
- , m_firstRunTimer( "desktop::Desktop m_firstRunTimer" )
+ , m_firstRunTimer(new Timer("desktop::Desktop m_firstRunTimer"))
{
- m_firstRunTimer.SetTimeout(3000); // 3 sec.
- m_firstRunTimer.SetInvokeHandler(LINK(this, Desktop, AsyncInitFirstRun));
+ m_firstRunTimer->SetTimeout(3000); // 3 sec.
+ m_firstRunTimer->SetInvokeHandler(LINK(this, Desktop, AsyncInitFirstRun));
}
Desktop::~Desktop()
{
+// Uncommenting this delete breaks the WASM output with a runtime error
+// delete m_firstRunTimer;
}
void Desktop::Init()
@@ -2556,7 +2558,7 @@ void Desktop::CheckFirstRun( )
// use VCL timer, which won't trigger during shutdown if the
// application exits before timeout
- m_firstRunTimer.Start();
+ m_firstRunTimer->Start();
#ifdef _WIN32
// Check if Quickstarter should be started (on Windows only)
diff --git a/external/redland/ExternalProject_raptor.mk
b/external/redland/ExternalProject_raptor.mk
index 324d231c5073..b3ae74c10b61 100644
--- a/external/redland/ExternalProject_raptor.mk
+++ b/external/redland/ExternalProject_raptor.mk
@@ -26,7 +26,7 @@ $(call gb_ExternalProject_get_state_target,raptor,build):
LDFLAGS=" \
$(if $(filter LINUX
FREEBSD,$(OS)),-Wl$(COMMA)-z$(COMMA)origin
-Wl$(COMMA)-rpath$(COMMA)\\"\$$\$$ORIGIN") \
$(if $(SYSBASE),$(if $(filter LINUX
SOLARIS,$(OS)),-L$(SYSBASE)/lib -L$(SYSBASE)/usr/lib -lpthread -ldl))" \
- CPPFLAGS="$(if $(SYSBASE),-I$(SYSBASE)/usr/include)" \
+ CPPFLAGS="$(if $(SYSBASE),-I$(SYSBASE)/usr/include)
$(gb_EMSCRIPTEN_CPPFLAGS)" \
$(gb_RUN_CONFIGURE) ./configure --disable-gtk-doc \
--enable-parsers="rdfxml ntriples turtle trig guess
rss-tag-soup" \
--with-www=xml \
diff --git a/external/redland/ExternalProject_rasqal.mk
b/external/redland/ExternalProject_rasqal.mk
index dd8887c669c8..e7d1fdb1195d 100644
--- a/external/redland/ExternalProject_rasqal.mk
+++ b/external/redland/ExternalProject_rasqal.mk
@@ -22,7 +22,7 @@ $(eval $(call gb_ExternalProject_register_targets,rasqal,\
$(call gb_ExternalProject_get_state_target,rasqal,build):
$(call gb_Trace_StartRange,rasqal,EXTERNAL)
$(call gb_ExternalProject_run,build,\
- CFLAGS="$(CFLAGS) $(if $(filter
TRUE,$(DISABLE_DYNLOADING)),-fvisibility=hidden) $(call
gb_ExternalProject_get_build_flags,rasqal)" \
+ CFLAGS="$(CFLAGS) $(if $(filter
TRUE,$(DISABLE_DYNLOADING)),-fvisibility=hidden) $(call
gb_ExternalProject_get_build_flags,rasqal) $(gb_EMSCRIPTEN_CPPFLAGS)" \
LDFLAGS=" \
$(if $(filter LINUX
FREEBSD,$(OS)),-Wl$(COMMA)-z$(COMMA)origin
-Wl$(COMMA)-rpath$(COMMA)\\"\$$\$$ORIGIN") \
$(if $(SYSBASE),$(if $(filter LINUX
SOLARIS,$(OS)),-L$(SYSBASE)/lib -L$(SYSBASE)/usr/lib -lpthread -ldl))" \
diff --git a/external/redland/ExternalProject_redland.mk
b/external/redland/ExternalProject_redland.mk
index d4dd34519670..d92c642b9cd1 100644
--- a/external/redland/ExternalProject_redland.mk
+++ b/external/redland/ExternalProject_redland.mk
@@ -23,7 +23,7 @@ $(eval $(call gb_ExternalProject_register_targets,redland,\
$(call gb_ExternalProject_get_state_target,redland,build):
$(call gb_Trace_StartRange,redland,EXTERNAL)
$(call gb_ExternalProject_run,build,\
- CFLAGS="$(CFLAGS) $(if $(filter
TRUE,$(DISABLE_DYNLOADING)),-fvisibility=hidden) $(call
gb_ExternalProject_get_build_flags,redland)" \
+ CFLAGS="$(CFLAGS) $(if $(filter
TRUE,$(DISABLE_DYNLOADING)),-fvisibility=hidden) $(call
gb_ExternalProject_get_build_flags,redland) $(gb_EMSCRIPTEN_CPPFLAGS)" \
LDFLAGS=" \
$(if $(filter LINUX
FREEBSD,$(OS)),-Wl$(COMMA)-z$(COMMA)origin
-Wl$(COMMA)-rpath$(COMMA)\\"\$$\$$ORIGIN") \
$(if $(SYSBASE),$(if $(filter LINUX
SOLARIS,$(OS)),-L$(SYSBASE)/lib -L$(SYSBASE)/usr/lib -lpthread -ldl))" \
commit be47e2c1f5267961694c92f2b6ab08662da36c3d
Author: Jan-Marek Glogowski <[email protected]>
AuthorDate: Sun Feb 20 14:06:54 2022 +0100
Commit: TheRock Builder <libo@therock>
CommitDate: Thu Apr 28 14:42:05 2022 +0000
fixme static tests
Change-Id: I2aaffa032bd531272257ca40d6f9b9d25c4de5aa
diff --git a/sal/cppunittester/cppunittester.cxx
b/sal/cppunittester/cppunittester.cxx
index 18773b2a67b6..63bc435cac99 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -244,6 +244,7 @@ public:
, protectors(protectors_)
, result(result_)
{
+ (void) args_;
}
ProtectedFixtureFunctor(const ProtectedFixtureFunctor&) = delete;
ProtectedFixtureFunctor& operator=(const ProtectedFixtureFunctor&) =
delete;
commit aab61bc251f90a9bdf42c9ed58f333b2aa22b865
Author: Jan-Marek Glogowski <[email protected]>
AuthorDate: Sun Jan 9 14:49:28 2022 +0100
Commit: TheRock Builder <libo@therock>
CommitDate: Thu Apr 28 14:42:03 2022 +0000
Add a larger Writer example document
Change-Id: I4bc9a82c7f99563af8da62f889b51d1b583df760
diff --git a/android/default-document/example_larger.odt
b/android/default-document/example_larger.odt
new file mode 100644
index 000000000000..1b3a1dfb877a
Binary files /dev/null and b/android/default-document/example_larger.odt differ
diff --git a/static/CustomTarget_emscripten_fs_image.mk
b/static/CustomTarget_emscripten_fs_image.mk
index 8166802858e5..8c347de38d5a 100644
--- a/static/CustomTarget_emscripten_fs_image.mk
+++ b/static/CustomTarget_emscripten_fs_image.mk
@@ -1131,6 +1131,7 @@ gb_emscripten_fs_image_files := \
$(INSTROOT)/$(LIBO_SHARE_RESOURCE_FOLDER)/common/fonts/opens___.ttf \
$(INSTROOT)/$(LIBO_URE_ETC_FOLDER)/$(call gb_Helper_get_rcfile,uno) \
$(INSTROOT)/$(LIBO_URE_MISC_FOLDER)/services.rdb \
+ $(SRCDIR)/android/default-document/example_larger.odt \
$(SRCDIR)/android/default-document/example.odt \
ifneq ($(ENABLE_WASM_STRIP_CHART),TRUE)
diff --git a/static/emscripten/soffice_args.js
b/static/emscripten/soffice_args.js
index 7ecf7e8988e8..fa5e9dd4164d 100644
--- a/static/emscripten/soffice_args.js
+++ b/static/emscripten/soffice_args.js
@@ -2,5 +2,5 @@ Module['arguments'] = [
'--norestore',
'--nologo',
'--writer',
- '/android/default-document/example.odt'
+ '/android/default-document/example_larger.odt'
];
commit c2fc859a6ced97ab236ef50aedcaac720ab8fd4d
Author: Jan-Marek Glogowski <[email protected]>
AuthorDate: Wed Nov 17 01:57:33 2021 +0100
Commit: TheRock Builder <libo@therock>
CommitDate: Thu Apr 28 14:42:02 2022 +0000
WIP: async popup menus
A first patch to get some feedback. Asnyc LO popup menus are still
buggy, as I'm not sure where to call the PopupMenu::Finish for
them.
Also the XDialogClosedListener is currently just for convenience
and might want some separate notifier.
Fun fact, that ImplExecute / ImplPopup is called for submenu, but
then doesn't execute. And generally the naming of some variables
is IMHO wrong; I might also prefix Menu members with "m_" for
easier readability.
Change-Id: Id8b413aa6b4699201e58db0113649c6b224d33b6
diff --git a/include/sfx2/dispatch.hxx b/include/sfx2/dispatch.hxx
index ee445710b9c0..a1c0f9aa5ad2 100644
--- a/include/sfx2/dispatch.hxx
+++ b/include/sfx2/dispatch.hxx
@@ -20,6 +20,7 @@
#define INCLUDED_SFX2_DISPATCH_HXX
#include <memory>
+#include <functional>
#include <sal/config.h>
#include <sfx2/dllapi.h>
#include <sfx2/toolbarids.hxx>
@@ -42,6 +43,7 @@ struct SfxDispatcher_Impl;
namespace com::sun::star::awt { class XPopupMenu; }
namespace vcl { class Window; }
+namespace com::sun::star::ui::dialogs { struct DialogClosedEvent; }
enum class SfxDispatcherPopFlags
{
@@ -136,8 +138,14 @@ public:
SfxViewFrame* GetFrame() const;
SfxModule* GetModule() const;
- void ExecutePopup( const OUString &rResName, vcl::Window
*pWin = nullptr, const Point *pPos = nullptr );
- static void ExecutePopup( vcl::Window *pWin = nullptr, const Point
*pPosPixel = nullptr );
+ /**
+ * @param rCloseFunc
+ * If this is !nullptr, the popup will be just shown / run async and
rCloseFunc will be called on close.
+ */
+ void ExecutePopup(const OUString &rResName, vcl::Window *pWin = nullptr,
const Point *pPos = nullptr,
+ const std::function<void(sal_Int16)>& rCloseFunc =
nullptr);
+ static void ExecutePopup(vcl::Window *pWin = nullptr, const Point
*pPosPixel = nullptr,
+ const std::function<void(sal_Int16)>& rCloseFunc
= nullptr);
bool IsAppDispatcher() const;
bool IsFlushed() const;
diff --git a/include/toolkit/awt/vclxmenu.hxx b/include/toolkit/awt/vclxmenu.hxx
index 096c370bce82..ffa89e9a8511 100644
--- a/include/toolkit/awt/vclxmenu.hxx
+++ b/include/toolkit/awt/vclxmenu.hxx
@@ -25,10 +25,11 @@
#include <toolkit/helper/listenermultiplexer.hxx>
#include <com/sun/star/awt/XMenuBar.hpp>
-#include <com/sun/star/awt/XPopupMenu.hpp>
+#include <com/sun/star/awt/XPopupMenuAsync.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XTypeProvider.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/ui/dialogs/XDialogClosedListener.hpp>
#include <comphelper/servicehelper.hxx>
#include <cppuhelper/weak.hxx>
@@ -39,6 +40,7 @@
#include <vector>
+struct DialogClosedEvent;
class Menu;
class MenuBar;
class PopupMenu;
@@ -51,10 +53,11 @@ typedef ::std::vector<
typedef void (*MenuUserDataReleaseFunction)(void*);
class TOOLKIT_DLLPUBLIC VCLXMenu : public css::awt::XMenuBar,
- public css::awt::XPopupMenu,
+ public css::awt::XPopupMenuAsync,
public css::lang::XServiceInfo,
public css::lang::XTypeProvider,
public css::lang::XUnoTunnel,
+ public
css::ui::dialogs::XDialogClosedListener,
public ::cppu::OWeakObject
{
private:
@@ -76,7 +79,6 @@ public:
VCLXMenu( Menu* pMenu );
virtual ~VCLXMenu() override;
-
Menu* GetMenu() const { return mpMenu; }
bool IsPopupMenu() const;
void setUserValue(sal_uInt16 nItemId, void* nUserValue,
MenuUserDataReleaseFunction aFunc);
@@ -137,10 +139,20 @@ public:
virtual void SAL_CALL setItemImage( ::sal_Int16 nItemId, const
css::uno::Reference< css::graphic::XGraphic >& xGraphic, sal_Bool bScale )
override;
virtual css::uno::Reference< css::graphic::XGraphic > SAL_CALL
getItemImage( ::sal_Int16 nItemId ) override;
+ // css::awt::XPopupMenuAsync
+ virtual sal_Bool SAL_CALL popup(const css::uno::Reference<
css::awt::XWindowPeer >& Parent, const css::awt::Rectangle& Position,
+ ::sal_Int16 Direction, const
css::uno::Reference<css::ui::dialogs::XDialogClosedListener>& xListener)
override;
+
// css::lang::XServiceInfo
virtual OUString SAL_CALL getImplementationName( ) override;
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
override;
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(
) override;
+
+ // css::ui::dialogs::XDialogClosedListener
+ virtual void SAL_CALL dialogClosed(const
css::ui::dialogs::DialogClosedEvent& aEvent) override;
+
+ // XEventListener (base of XDialogClosedListener)
+ virtual void SAL_CALL disposing(css::lang::EventObject const & Source)
override;
};
class UNLESS_MERGELIBS(TOOLKIT_DLLPUBLIC) VCLXMenuBar final : public VCLXMenu
diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx
index abad985775e4..4c91ac68d8f4 100644
--- a/include/vcl/menu.hxx
+++ b/include/vcl/menu.hxx
@@ -44,6 +44,7 @@ class Menu;
class MenuItemList;
class Image;
class PopupMenu;
+struct PopupMenuFinishState;
class KeyEvent;
class MenuFloatingWindow;
class SalMenu;
@@ -54,6 +55,7 @@ enum class FloatWinPopupFlags;
enum class VclEventId;
namespace com::sun::star::awt { class XPopupMenu; }
+namespace com::sun::star::ui::dialogs { class XDialogClosedListener; }
namespace com::sun::star::accessibility { class XAccessible; }
namespace vcl
@@ -492,11 +494,16 @@ class VCL_DLLPUBLIC PopupMenu final : public Menu
friend struct MenuItemData;
private:
+ struct PopupMenuFinishState* m_pState;
+
SAL_DLLPRIVATE MenuFloatingWindow * ImplGetFloatingWindow() const;
SAL_DLLPRIVATE bool PrepareRun(const VclPtr<vcl::Window>& pParentWin,
tools::Rectangle& rRect, FloatWinPopupFlags& nPopupModeFlags, Menu* pSFrom,
bool& bRealExecute, VclPtr<MenuFloatingWindow>&);
- SAL_DLLPRIVATE bool Run(const VclPtr<MenuFloatingWindow>&, bool
bRealExecute, bool bPreSelectFirst, FloatWinPopupFlags nPopupModeFlags, Menu*
pSFrom, const tools::Rectangle& rRect);
+ SAL_DLLPRIVATE bool Run(const VclPtr<MenuFloatingWindow>&, bool
bRealExecute, bool bPreSelectFirst, FloatWinPopupFlags nPopupModeFlags, Menu*
pSFrom, const tools::Rectangle& rRect,
+ const
css::uno::Reference<css::ui::dialogs::XDialogClosedListener>* xListener);
SAL_DLLPRIVATE void FinishRun(const VclPtr<MenuFloatingWindow>&, const
VclPtr<vcl::Window>& pParentWin, bool bRealExecute, bool bIsNativeMenu);
SAL_DLLPRIVATE sal_uInt16 ImplExecute(const VclPtr<vcl::Window>&
pParentWin, const tools::Rectangle& rRect, FloatWinPopupFlags nPopupModeFlags,
Menu* pSFrom, bool bPreSelectFirst);
+ SAL_DLLPRIVATE bool ImplPopup(const VclPtr<vcl::Window>& pParentWin, const
tools::Rectangle& rRect, FloatWinPopupFlags nPopupModeFlags, Menu* pSFrom, bool
bPreSelectFirst,
+ const
css::uno::Reference<css::ui::dialogs::XDialogClosedListener>&);
SAL_DLLPRIVATE void ImplFlushPendingSelect();
SAL_DLLPRIVATE tools::Long ImplCalcHeight( sal_uInt16 nEntries ) const;
SAL_DLLPRIVATE sal_uInt16 ImplCalcVisEntries( tools::Long nMaxHeight,
sal_uInt16 nStartEntry, sal_uInt16* pLastVisible = nullptr ) const;
@@ -519,6 +526,12 @@ public:
sal_uInt16 Execute( vcl::Window* pWindow, const Point& rPopupPos );
sal_uInt16 Execute( vcl::Window* pWindow, const tools::Rectangle& rRect,
PopupMenuFlags nFlags = PopupMenuFlags::NONE );
+ bool Popup(vcl::Window* pParentWin, const Point& rPopupPos,
+ const
css::uno::Reference<css::ui::dialogs::XDialogClosedListener>&);
+ bool Popup(vcl::Window* pParentWin, const tools::Rectangle& rRect,
+ const
css::uno::Reference<css::ui::dialogs::XDialogClosedListener>&, PopupMenuFlags =
PopupMenuFlags::NONE);
+ void Finish();
+
// for the TestTool
void EndExecute();
virtual void SelectItem(sal_uInt16 nId) override;
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index a9b92639a667..7a77b02e98a7 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -1858,6 +1858,7 @@ $(eval $(call
gb_UnoApi_add_idlfiles,offapi,com/sun/star/awt,\
XPatternField \
XPointer \
XPopupMenu \
+ XPopupMenuAsync \
XPrinter \
XPrinterPropertySet \
XPrinterServer \
diff --git a/offapi/com/sun/star/awt/XPopupMenuAsync.idl
b/offapi/com/sun/star/awt/XPopupMenuAsync.idl
new file mode 100644
index 000000000000..d3f7b317f086
--- /dev/null
+++ b/offapi/com/sun/star/awt/XPopupMenuAsync.idl
@@ -0,0 +1,51 @@
+/* -*- 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/.
+ *
+ */
+#ifndef __com_sun_star_awt_XPopupMenuAsync_idl__
+#define __com_sun_star_awt_XPopupMenuAsync_idl__
+
+#include <com/sun/star/awt/XPopupMenu.idl>
+#include <com/sun/star/ui/dialogs/XDialogClosedListener.idl>
+
+module com { module sun { module star { module awt {
+
+/** shows a pop-up menu without blocking.
+ */
+interface XPopupMenuAsync: XPopupMenu
+{
+ /** just shows the popup menu without blocking and calls the
+ XDialogClosedListener when closed,
+
+ @param Parent
+ the parent window.
+
+ @param Position
+ a Rectangle representing the coordinates system
+ where the popup menu should be executed.
+
+ @param Direction
+ the direction in which a popup menu will grow, as specified
+ by one of the PopupMenuDirection constants.
+
+ @param xListener
+ notified, if the popup is closed.
+
+ @return
+ returns true, if the popup has started to run async.
+ May fail, if the native backend doesn't implement async popups.
+ */
+ boolean popup([in] XWindowPeer Parent, [in] Rectangle Position, [in] short
Direction,
+ [in] ::com::sun::star::ui::dialogs::XDialogClosedListener
xListener);
+};
+
+}; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/drviews4.cxx b/sd/source/ui/view/drviews4.cxx
index b07279844265..548504af7746 100644
--- a/sd/source/ui/view/drviews4.cxx
+++ b/sd/source/ui/view/drviews4.cxx
@@ -800,7 +800,7 @@ void DrawViewShell::Command(const CommandEvent& rCEvt,
::sd::Window* pWin)
bool bShouldDisableEditHyperlink = ShouldDisableEditHyperlink();
if(rCEvt.IsMouseEvent())
- GetViewFrame()->GetDispatcher()->ExecutePopup( aPopupId );
+ GetViewFrame()->GetDispatcher()->ExecutePopup(aPopupId,
nullptr, nullptr, [](sal_Int16){});
else
{
//don't open contextmenu at mouse position if not opened via
mouse
diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx
index 17edf97cc16d..cce1d7d9ec19 100644
--- a/sfx2/source/control/dispatch.cxx
+++ b/sfx2/source/control/dispatch.cxx
@@ -60,6 +60,7 @@
#include <svl/eitem.hxx>
#include <svl/itemiter.hxx>
#include <svl/itempool.hxx>
+#include <svtools/dialogclosedlistener.hxx>
#include <toolkit/awt/vclxmenu.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <tools/debug.hxx>
@@ -137,8 +138,12 @@ struct SfxDispatcher_Impl
SfxDisableFlags nDisableFlags;
bool bFlushed;
std::deque< std::deque<SfxToDo_Impl> > aToDoCopyStack;
+
+ static css::uno::Reference<css::frame::XPopupMenuController>*
m_pActivePopupController;
};
+css::uno::Reference<css::frame::XPopupMenuController>*
SfxDispatcher_Impl::m_pActivePopupController = nullptr;
+
/** This method checks if the stack of the SfxDispatchers is flushed, or if
push- or pop- commands are pending.
*/
@@ -1685,7 +1690,52 @@ bool SfxDispatcher::FillState_(const SfxSlotServer&
rSvr, SfxItemSet& rState,
return false;
}
-void SfxDispatcher::ExecutePopup( vcl::Window *pWin, const Point *pPos )
+namespace {
+
+static void
lcl_FinishPopupDispatch(css::uno::Reference<css::frame::XPopupMenuController>
xPopupController)
+{
+ css::uno::Reference<css::lang::XComponent> xComponent(xPopupController,
css::uno::UNO_QUERY);
+ if (xComponent.is())
+ xComponent->dispose();
+ SfxDispatcher_Impl::m_pActivePopupController = nullptr;
+}
+
+struct SfxDispatcherPopupFinish final
+{
+ css::uno::Reference<css::frame::XPopupMenuController> m_xPopupController;
+ std::function<void(sal_Int16)> m_aCloseFunc;
+ rtl::Reference<::svt::DialogClosedListener> m_xDialogListener;
+ css::uno::Reference<css::awt::XPopupMenu> m_xPopupMenu;
+
+ DECL_LINK(PopupClosedHdl, css::ui::dialogs::DialogClosedEvent*, void);
+
+
SfxDispatcherPopupFinish(css::uno::Reference<css::frame::XPopupMenuController>
xPopupController,
+ const std::function<void(sal_Int16)>& rCloseFunc,
+ css::uno::Reference<css::awt::XPopupMenu>
xPopupMenu)
+ : m_xPopupController(xPopupController)
+ , m_aCloseFunc(rCloseFunc)
+ , m_xDialogListener(new ::svt::DialogClosedListener())
+ , m_xPopupMenu(xPopupMenu)
+ {
+ m_xDialogListener->SetDialogClosedLink(LINK(this,
SfxDispatcherPopupFinish, PopupClosedHdl));
+ }
+};
+
+IMPL_LINK(SfxDispatcherPopupFinish, PopupClosedHdl,
css::ui::dialogs::DialogClosedEvent*, pEvt, void)
+{
+ assert(m_xPopupController.is());
+ if (!comphelper::LibreOfficeKit::isActive())
+ assert(SfxDispatcher_Impl::m_pActivePopupController ==
&m_xPopupController);
+ if (m_aCloseFunc)
+ m_aCloseFunc(pEvt ? pEvt->DialogResult : 0);
+ lcl_FinishPopupDispatch(m_xPopupController);
+ delete this;
+}
+
+} // anon namespace
+
+void SfxDispatcher::ExecutePopup(vcl::Window *pWin, const Point *pPos,
+ const std::function<void(sal_Int16)>& rCloseFunc)
{
SfxDispatcher &rDisp = *SfxGetpApp()->GetDispatcher_Impl();
sal_uInt16 nShLevel = 0;
@@ -1699,7 +1749,7 @@ void SfxDispatcher::ExecutePopup( vcl::Window *pWin,
const Point *pPos )
const OUString& rResName = pSh->GetInterface()->GetPopupMenuName();
if ( !rResName.isEmpty() )
{
- rDisp.ExecutePopup( rResName, pWin, pPos );
+ rDisp.ExecutePopup(rResName, pWin, pPos, rCloseFunc);
return;
}
}
@@ -1808,7 +1858,8 @@ boost::property_tree::ptree
SfxDispatcher::fillPopupMenu(const css::uno::Referen
return ::fillPopupMenu(pVCLMenu);
}
-void SfxDispatcher::ExecutePopup( const OUString& rResName, vcl::Window* pWin,
const Point* pPos )
+void SfxDispatcher::ExecutePopup( const OUString& rResName, vcl::Window* pWin,
const Point* pPos,
+ const std::function<void(sal_Int16)>& rCloseFunc)
{
css::uno::Sequence< css::uno::Any > aArgs{
css::uno::Any(comphelper::makePropertyValue( "Value", rResName )),
@@ -1817,16 +1868,29 @@ void SfxDispatcher::ExecutePopup( const OUString&
rResName, vcl::Window* pWin, c
};
css::uno::Reference< css::uno::XComponentContext > xContext =
comphelper::getProcessComponentContext();
- css::uno::Reference< css::frame::XPopupMenuController > xPopupController(
- xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
- "com.sun.star.comp.framework.ResourceMenuController", aArgs, xContext
), css::uno::UNO_QUERY );
+
+ if (!comphelper::LibreOfficeKit::isActive())
+ assert(!xImp->m_pActivePopupController);
+ if (!comphelper::LibreOfficeKit::isActive() &&
xImp->m_pActivePopupController)
+ return;
+
+ css::uno::Reference<css::frame::XPopupMenuController> xPopupController =
+ css::uno::Reference<css::frame::XPopupMenuController>(
+
xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
+ "com.sun.star.comp.framework.ResourceMenuController", aArgs,
xContext), css::uno::UNO_QUERY);
+ if (!xPopupController.is())
+ return;
+ SfxDispatcher_Impl::m_pActivePopupController = &xPopupController;
css::uno::Reference< css::awt::XPopupMenu > xPopupMenu(
xContext->getServiceManager()->createInstanceWithContext(
"com.sun.star.awt.PopupMenu", xContext ), css::uno::UNO_QUERY );
-
- if ( !xPopupController.is() || !xPopupMenu.is() )
+ if (!xPopupMenu.is())
+ {
+ lcl_FinishPopupDispatch(xPopupController);
return;
+ }
+ struct SfxDispatcherPopupFinish* pFin = nullptr;
vcl::Window* pWindow = pWin ? pWin :
xImp->pFrame->GetFrame().GetWorkWindow_Impl()->GetWindow();
Point aPos = pPos ? *pPos : pWindow->GetPointerPosPixel();
@@ -1852,14 +1916,22 @@ void SfxDispatcher::ExecutePopup( const OUString&
rResName, vcl::Window* pWin, c
OUString aMenuURL = "private:resource/popupmenu/" + rResName;
if (GetFrame()->GetViewShell()->TryContextMenuInterception(xPopupMenu,
aMenuURL, aEvent))
{
+ const sal_Int16 nFlags =
css::awt::PopupMenuDirection::EXECUTE_DOWN;
+ const css::awt::Rectangle aRect(aPos.X(), aPos.Y(), 1, 1);
css::uno::Reference<css::awt::XWindowPeer>
xParent(aEvent.SourceWindow, css::uno::UNO_QUERY);
- xPopupMenu->execute(xParent, css::awt::Rectangle(aPos.X(),
aPos.Y(), 1, 1), css::awt::PopupMenuDirection::EXECUTE_DOWN);
+ css::uno::Reference<css::awt::XPopupMenuAsync>
xAsyncPopup(xPopupMenu, css::uno::UNO_QUERY);
+ pFin = new SfxDispatcherPopupFinish(xPopupController, rCloseFunc,
xPopupMenu);
+ if (!rCloseFunc || !xAsyncPopup.is() ||
!xAsyncPopup->popup(xParent, aRect, nFlags, pFin->m_xDialogListener))
+ {
+ delete pFin;
+ pFin = nullptr;
+ xPopupMenu->execute(xParent, aRect, nFlags);
+ }
}
}
- css::uno::Reference< css::lang::XComponent > xComponent( xPopupController,
css::uno::UNO_QUERY );
- if ( xComponent.is() )
- xComponent->dispose();
+ if (!pFin)
+ lcl_FinishPopupDispatch(xPopupController);
}
/** With this method the SfxDispatcher can be locked and released. A locked
diff --git a/sw/source/uibase/docvw/edtwin.cxx
b/sw/source/uibase/docvw/edtwin.cxx
index eeb8554ccfcc..65c220f6eeb1 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -5457,7 +5457,7 @@ void SwEditWin::Command( const CommandEvent& rCEvt )
}
}
else if ( !m_rView.ExecSpellPopup( aDocPos ) )
- SfxDispatcher::ExecutePopup(this, &aPixPos);
+ SfxDispatcher::ExecutePopup(this, &aPixPos,
[](sal_Int16){});
}
else if (m_pApplyTempl->nUndo <
rSh.GetDoc()->GetIDocumentUndoRedo().GetUndoActionCount())
{
diff --git a/toolkit/inc/helper/unowrapper.hxx
b/toolkit/inc/helper/unowrapper.hxx
index 03a9b525cc18..fdc65988bb62 100644
--- a/toolkit/inc/helper/unowrapper.hxx
+++ b/toolkit/inc/helper/unowrapper.hxx
@@ -56,7 +56,7 @@ public:
virtual VclPtr<vcl::Window> GetWindow(const
css::uno::Reference<css::awt::XWindow>& rxWindow) override;
// Menu
- virtual css::uno::Reference<css::awt::XPopupMenu> CreateMenuInterface(
PopupMenu* pPopupMenu ) override;
+ virtual css::uno::Reference<css::awt::XPopupMenu>
CreateMenuInterface(PopupMenu* pPopupMenu) override;
void WindowDestroyed( vcl::Window* pWindow ) override;
diff --git a/toolkit/source/awt/vclxmenu.cxx b/toolkit/source/awt/vclxmenu.cxx
index b17f32c2aebc..e2f78a2528ed 100644
--- a/toolkit/source/awt/vclxmenu.cxx
+++ b/toolkit/source/awt/vclxmenu.cxx
@@ -35,6 +35,7 @@
#include <vcl/window.hxx>
#include <com/sun/star/awt/KeyModifier.hpp>
+#include <com/sun/star/ui/dialogs/DialogClosedEvent.hpp>
VCLXMenu::VCLXMenu()
: maMenuListeners( *this )
@@ -491,6 +492,33 @@ sal_Int16 VCLXMenu::execute(
static_cast<PopupMenuFlags>(nFlags) |
PopupMenuFlags::NoMouseUpClose );
}
+sal_Bool VCLXMenu::popup(
+ const css::uno::Reference< css::awt::XWindowPeer >& rxWindowPeer,
+ const css::awt::Rectangle& rPos, sal_Int16 nFlags,
+ const css::uno::Reference<css::ui::dialogs::XDialogClosedListener>&
xListener)
+{
+ SolarMutexGuard aSolarGuard;
+ std::unique_lock aGuard( maMutex );
+
+ if (!mpMenu || !IsPopupMenu())
+ return false;
+
+ return
static_cast<PopupMenu*>(mpMenu.get())->Popup(VCLUnoHelper::GetWindow(rxWindowPeer),
+ VCLRectangle(rPos), xListener.is() ?
xListener : this,
+ static_cast<PopupMenuFlags>(nFlags) |
PopupMenuFlags::NoMouseUpClose);
+}
+
+void SAL_CALL VCLXMenu::dialogClosed(const
css::ui::dialogs::DialogClosedEvent&)
+{
+ SolarMutexGuard aSolarGuard;
+ std::unique_lock aGuard( maMutex );
+
+ assert(mpMenu && IsPopupMenu());
+ if (mpMenu && IsPopupMenu())
+ static_cast<PopupMenu*>(mpMenu.get())->Finish();
+}
+
+void SAL_CALL VCLXMenu::disposing(css::lang::EventObject const&) {}
void SAL_CALL VCLXMenu::setCommand(
sal_Int16 nItemId,
diff --git a/toolkit/source/helper/unowrapper.cxx
b/toolkit/source/helper/unowrapper.cxx
index 6a12b915b4aa..ccd7e1213816 100644
--- a/toolkit/source/helper/unowrapper.cxx
+++ b/toolkit/source/helper/unowrapper.cxx
@@ -189,7 +189,7 @@ void UnoWrapper::SetWindowInterface( vcl::Window* pWindow,
const css::uno::Refer
}
}
-css::uno::Reference<css::awt::XPopupMenu> UnoWrapper::CreateMenuInterface(
PopupMenu* pPopupMenu )
+css::uno::Reference<css::awt::XPopupMenu>
UnoWrapper::CreateMenuInterface(PopupMenu* pPopupMenu)
{
return new VCLXPopupMenu(pPopupMenu);
}
diff --git a/vcl/inc/osx/salmenu.h b/vcl/inc/osx/salmenu.h
index 597180cc1ac3..dae1a1035cae 100644
--- a/vcl/inc/osx/salmenu.h
+++ b/vcl/inc/osx/salmenu.h
@@ -67,7 +67,9 @@ public:
virtual void SetItemImage( unsigned nPos, SalMenuItem* pSalMenuItem, const
Image& rImage) override;
virtual void SetAccelerator( unsigned nPos, SalMenuItem* pSalMenuItem,
const vcl::KeyCode& rKeyCode, const OUString& rKeyName ) override;
virtual void GetSystemMenuData( SystemMenuData* pData ) override;
- virtual bool ShowNativePopupMenu(FloatingWindow * pWin, const
tools::Rectangle& rRect, FloatWinPopupFlags nFlags) override;
+ virtual bool ShowNativePopupMenu(
+ FloatingWindow*, const tools::Rectangle&, FloatWinPopupFlags,
+ const css::uno::Reference<css::ui::dialogs::XDialogClosedListener>* =
nullptr) override;
virtual bool AddMenuBarButton( const SalMenuButtonItem& ) override;
virtual void RemoveMenuBarButton( sal_uInt16 nId ) override;
virtual tools::Rectangle GetMenuBarButtonRectPixel( sal_uInt16 i_nItemId,
SalFrame* i_pReferenceFrame ) override;
diff --git a/vcl/inc/qt5/QtMenu.hxx b/vcl/inc/qt5/QtMenu.hxx
index 11f3f00c5aa6..037f24ae62f5 100644
--- a/vcl/inc/qt5/QtMenu.hxx
+++ b/vcl/inc/qt5/QtMenu.hxx
@@ -38,7 +38,7 @@ class QtFrame;
class QtMenu : public QObject, public SalMenu
{
Q_OBJECT
-private:
+
std::vector<QtMenuItem*> maItems;
VclPtr<Menu> mpVCLMenu;
QtMenu* mpParentSalMenu;
@@ -50,6 +50,9 @@ private:
// pointer to QMenu owned by the corresponding QtMenuItem or self (->
mpOwnedQMenu)
QMenu* mpQMenu;
+ css::uno::Reference<css::ui::dialogs::XDialogClosedListener> m_xListener;
+ FloatingWindow* m_pWin;
+
void DoFullMenuUpdate(Menu* pMenuBar);
static void NativeItemText(OUString& rItemText);
@@ -71,8 +74,9 @@ public:
virtual void SetFrame(const SalFrame* pFrame) override;
const QtFrame* GetFrame() const;
virtual void ShowMenuBar(bool bVisible) override;
- virtual bool ShowNativePopupMenu(FloatingWindow* pWin, const
tools::Rectangle& rRect,
- FloatWinPopupFlags nFlags) override;
+ virtual bool ShowNativePopupMenu(
+ FloatingWindow*, const tools::Rectangle&, FloatWinPopupFlags,
+ const css::uno::Reference<css::ui::dialogs::XDialogClosedListener>* =
nullptr) override;
QtMenu* GetTopLevel();
virtual void SetItemBits(unsigned nPos, MenuItemBits nBits) override;
virtual void CheckItem(unsigned nPos, bool bCheck) override;
diff --git a/vcl/inc/salmenu.hxx b/vcl/inc/salmenu.hxx
index 79254d9f5fd5..6da1dae5f9e7 100644
--- a/vcl/inc/salmenu.hxx
+++ b/vcl/inc/salmenu.hxx
@@ -22,6 +22,7 @@
#include <vcl/menu.hxx>
#include <vcl/image.hxx>
+#include <com/sun/star/ui/dialogs/XDialogClosedListener.hpp>
struct SystemMenuData;
class FloatingWindow;
@@ -73,7 +74,17 @@ public:
virtual void SetItemImage( unsigned nPos, SalMenuItem* pSalMenuItem, const
Image& rImage ) = 0;
virtual void SetAccelerator( unsigned nPos, SalMenuItem* pSalMenuItem,
const vcl::KeyCode& rKeyCode, const OUString& rKeyName ) = 0;
virtual void GetSystemMenuData( SystemMenuData* pData ) = 0;
- virtual bool ShowNativePopupMenu(FloatingWindow * pWin, const
tools::Rectangle& rRect, FloatWinPopupFlags nFlags);
+ /**
+ * @param pListener
+ * if !nullptr, the menu is supposed to be only shown and it'll run
async.
+ * Mainly means, when the menu is hidden, it must call the listener's
+ * dialogClosed. The listener will destroy the SalMenu!
+ *
+ * @return
+ * true, if the feature is implemented and was successful.
+ */
+ virtual bool ShowNativePopupMenu(FloatingWindow * pWin, const
tools::Rectangle& rRect, FloatWinPopupFlags nFlags,
+ const
css::uno::Reference<css::ui::dialogs::XDialogClosedListener>* pListener =
nullptr);
virtual void ShowCloseButton(bool bShow);
virtual bool AddMenuBarButton( const SalMenuButtonItem& ); // return false
if not implemented or failure
virtual void RemoveMenuBarButton( sal_uInt16 nId );
diff --git a/vcl/inc/unx/gtk/gtksalmenu.hxx b/vcl/inc/unx/gtk/gtksalmenu.hxx
index 85c0f5d3d893..5d5a487df8f1 100644
--- a/vcl/inc/unx/gtk/gtksalmenu.hxx
+++ b/vcl/inc/unx/gtk/gtksalmenu.hxx
@@ -132,7 +132,8 @@ public:
#endif
void ReturnFocus();
- virtual bool ShowNativePopupMenu(FloatingWindow * pWin, const
tools::Rectangle& rRect, FloatWinPopupFlags nFlags) override;
+ virtual bool ShowNativePopupMenu(FloatingWindow * pWin, const
tools::Rectangle& rRect, FloatWinPopupFlags nFlags,
+ const
css::uno::Reference<css::ui::dialogs::XDialogClosedListener>* = nullptr)
override;
virtual void ShowCloseButton(bool bShow) override;
virtual bool AddMenuBarButton( const SalMenuButtonItem& rNewItem )
override;
virtual void RemoveMenuBarButton( sal_uInt16 nId ) override;
diff --git a/vcl/osx/salmenu.cxx b/vcl/osx/salmenu.cxx
index 3164ba873bae..0a91ab88cc36 100644
--- a/vcl/osx/salmenu.cxx
+++ b/vcl/osx/salmenu.cxx
@@ -281,8 +281,13 @@ AquaSalMenu::~AquaSalMenu()
}
}
-bool AquaSalMenu::ShowNativePopupMenu(FloatingWindow * pWin, const
tools::Rectangle& rRect, FloatWinPopupFlags nFlags)
+bool AquaSalMenu::ShowNativePopupMenu(
+ FloatingWindow* pWin, const tools::Rectangle& rRect, FloatWinPopupFlags
nFlags,
+ const css::uno::Reference<css::ui::dialogs::XDialogClosedListener>*
pListener)
{
+ if (pListener)
+ return false;
+
// set offsets for positioning
const float offset = 9.0;
diff --git a/vcl/qt5/QtMenu.cxx b/vcl/qt5/QtMenu.cxx
index fd38a0380000..61beac5d0968 100644
--- a/vcl/qt5/QtMenu.cxx
+++ b/vcl/qt5/QtMenu.cxx
@@ -92,6 +92,16 @@ void QtMenu::InsertMenuItem(QtMenuItem* pSalMenuItem,
unsigned nPos)
// no QMenu set, instantiate own one
mpOwnedQMenu.reset(new QMenu);
mpQMenu = mpOwnedQMenu.get();
+
+ connect(mpQMenu, &QMenu::aboutToHide, this, [this] {
+ if (m_pWin && m_xListener.is())
+ {
+ QMenu* pMenu = mpOwnedQMenu.release();
+ css::ui::dialogs::DialogClosedEvent
aEvent(m_pWin->GetComponentInterface(), 0);
+ m_xListener->dialogClosed(aEvent);
+ pMenu->deleteLater();
+ }
+ });
}
if (pSalMenuItem->mpSubMenu)
@@ -676,15 +686,27 @@ void QtMenu::ShowCloseButton(bool bShow)
pButton->hide();
}
-bool QtMenu::ShowNativePopupMenu(FloatingWindow*, const tools::Rectangle&,
- FloatWinPopupFlags nFlags)
+bool QtMenu::ShowNativePopupMenu(
+ FloatingWindow* pWin, const tools::Rectangle&, FloatWinPopupFlags nFlags,
+ const css::uno::Reference<css::ui::dialogs::XDialogClosedListener>*
pListener)
{
assert(mpQMenu);
DoFullMenuUpdate(mpVCLMenu);
mpQMenu->setTearOffEnabled(bool(nFlags &
FloatWinPopupFlags::AllowTearOff));
const QPoint aPos = QCursor::pos();
- mpQMenu->exec(aPos);
+ if (pListener)
+ {
+ m_xListener = *pListener;
+ m_pWin = pWin;
+ mpQMenu->popup(aPos);
+ }
+ else
+ {
+ m_xListener = nullptr;
+ m_pWin = nullptr;
+ mpQMenu->exec(aPos);
+ }
return true;
}
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index a8fdaf2a7978..b107bb0ca607 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -193,7 +193,9 @@ SalObject::~SalObject() {}
SalMenu::~SalMenu() {}
-bool SalMenu::ShowNativePopupMenu(FloatingWindow*, const tools::Rectangle&,
FloatWinPopupFlags)
+bool SalMenu::ShowNativePopupMenu(
+ FloatingWindow*, const tools::Rectangle&, FloatWinPopupFlags,
+ const css::uno::Reference<css::ui::dialogs::XDialogClosedListener>*)
{
return false;
}
diff --git a/vcl/source/control/managedmenubutton.cxx
b/vcl/source/control/managedmenubutton.cxx
index 880730721ce2..f671cdd9c695 100644
--- a/vcl/source/control/managedmenubutton.cxx
+++ b/vcl/source/control/managedmenubutton.cxx
@@ -13,6 +13,7 @@
#include <managedmenubutton.hxx>
#include <vcl/menu.hxx>
+#include <com/sun/star/awt/XPopupMenuAsync.hpp>
#include <com/sun/star/frame/ModuleManager.hpp>
#include <com/sun/star/frame/theDesktop.hpp>
#include <com/sun/star/frame/thePopupMenuControllerFactory.hpp>
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 46b899c14374..43f57eee0c6f 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -2660,6 +2660,7 @@ MenuFloatingWindow * PopupMenu::ImplGetFloatingWindow()
const {
}
PopupMenu::PopupMenu()
+ : m_pState(nullptr)
{
mpSalMenu = ImplGetSVData()->mpDefInst->CreateMenu(false, this);
}
@@ -2672,6 +2673,7 @@ PopupMenu::PopupMenu( const PopupMenu& rMenu )
PopupMenu::~PopupMenu()
{
+ assert(!m_pState);
disposeOnce();
}
@@ -2769,6 +2771,36 @@ sal_uInt16 PopupMenu::Execute( vcl::Window* pExecWindow,
const tools::Rectangle&
return ImplExecute( pExecWindow, rRect, lcl_TranslateFlags(nFlags),
nullptr, false );
}
+struct PopupMenuFinishState final
+{
+ VclPtr<PopupMenu> pSelf;
+ VclPtr<vcl::Window> pParentWin;
+ VclPtr<MenuFloatingWindow> pWin;
+ bool bRealExecute;
+ bool bIsNativeMenu;
+
+ void clean()
+ {
+ pWin = nullptr;
+ pParentWin = nullptr;
+ pSelf = nullptr;
+ }
+};
+
+bool PopupMenu::Popup(vcl::Window* pExecWindow, const Point& rPopupPos,
+ const
css::uno::Reference<css::ui::dialogs::XDialogClosedListener>& listener)
+{
+ return Popup(pExecWindow, tools::Rectangle(rPopupPos, rPopupPos),
listener, PopupMenuFlags::ExecuteDown);
+}
+
+bool PopupMenu::Popup(vcl::Window* pExecWindow, const tools::Rectangle& rRect,
+ const
css::uno::Reference<css::ui::dialogs::XDialogClosedListener>& listener,
PopupMenuFlags nFlags)
+{
+ assert(!m_pState);
+ ENSURE_OR_RETURN(pExecWindow, "PopupMenu::Popup: need a non-NULL window!",
false);
+ return ImplPopup(pExecWindow, rRect, lcl_TranslateFlags(nFlags), nullptr,
false, listener);
+}
+
void PopupMenu::ImplFlushPendingSelect()
{
// is there still Select?
@@ -2920,7 +2952,7 @@ bool PopupMenu::PrepareRun(const VclPtr<vcl::Window>&
pParentWin, tools::Rectang
if (pStartedFrom && pStartedFrom->IsMenuBar())
nMaxHeight -= pParentWin->GetSizePixel().Height();
sal_Int32 nLeft, nTop, nRight, nBottom;
- pWindow->GetBorder( nLeft, nTop, nRight, nBottom );
+ pWindow->GetBorder(nLeft, nTop, nRight, nBottom);
nMaxHeight -= nTop+nBottom;
if ( aSz.Height() > nMaxHeight )
{
@@ -2936,10 +2968,11 @@ bool PopupMenu::PrepareRun(const VclPtr<vcl::Window>&
pParentWin, tools::Rectang
}
bool PopupMenu::Run(const VclPtr<MenuFloatingWindow>& pWin, const bool
bRealExecute, const bool bPreSelectFirst,
- const FloatWinPopupFlags nPopupModeFlags, Menu* pSFrom,
const tools::Rectangle& rRect)
+ const FloatWinPopupFlags nPopupModeFlags, Menu* pSFrom,
const tools::Rectangle& rRect,
+ const
css::uno::Reference<css::ui::dialogs::XDialogClosedListener>* xListener)
{
SalMenu* pMenu = ImplGetSalMenu();
- if (pMenu && bRealExecute && pMenu->ShowNativePopupMenu(pWin, rRect,
nPopupModeFlags))
+ if (pMenu && bRealExecute && pMenu->ShowNativePopupMenu(pWin, rRect,
nPopupModeFlags, xListener))
return true;
pWin->StartPopupMode(rRect, nPopupModeFlags);
@@ -2975,7 +3008,12 @@ bool PopupMenu::Run(const VclPtr<MenuFloatingWindow>&
pWin, const bool bRealExec
}
if (bRealExecute)
- pWin->Execute();
+ {
+ if (!xListener)
+ pWin->Execute();
+ else
+ pWin->Popup(*xListener);
+ }
return false;
}
@@ -3020,11 +3058,42 @@ sal_uInt16 PopupMenu::ImplExecute(const
VclPtr<vcl::Window>& pParentWin, const t
VclPtr<MenuFloatingWindow> pWin;
if (!PrepareRun(pParentWin, aRect, nPopupModeFlags, pSFrom, bRealExecute,
pWin))
return 0;
- const bool bNative = Run(pWin, bRealExecute, bPreSelectFirst,
nPopupModeFlags, pSFrom, aRect);
+ const bool bNative = Run(pWin, bRealExecute, bPreSelectFirst,
nPopupModeFlags, pSFrom, aRect, nullptr);
FinishRun(pWin, pParentWin, bRealExecute, bNative);
return nSelectedId;
}
+bool PopupMenu::ImplPopup(const VclPtr<vcl::Window>& pParentWin, const
tools::Rectangle& rRect,
+ FloatWinPopupFlags nPopupModeFlags, Menu* pSFrom,
bool bPreSelectFirst,
+ const
css::uno::Reference<css::ui::dialogs::XDialogClosedListener>& xListener)
+{
+ // tdf#126054 hold this until after function completes
+ VclPtr<PopupMenu> xThis(this);
+ bool bRealExecute = false;
+ tools::Rectangle aRect(rRect);
+ VclPtr<MenuFloatingWindow> pWin;
+ if (!PrepareRun(pParentWin, aRect, nPopupModeFlags, pSFrom, bRealExecute,
pWin))
+ return false;
+ assert(!m_pState);
+ m_pState = new PopupMenuFinishState;
+ m_pState->bIsNativeMenu = Run(pWin, bRealExecute, bPreSelectFirst,
nPopupModeFlags, pSFrom, aRect, &xListener);
+ m_pState->pWin = pWin;
+ m_pState->pParentWin = pParentWin;
+ m_pState->bRealExecute = bRealExecute;
+ m_pState->pSelf = xThis;
+ return true;
+}
+
+void PopupMenu::Finish()
+{
+ if (!m_pState)
+ return;
+ FinishRun(m_pState->pWin, m_pState->pParentWin, m_pState->bRealExecute,
m_pState->bIsNativeMenu);
+ m_pState->clean();
+ delete m_pState;
+ m_pState = nullptr;
+}
+
sal_uInt16 PopupMenu::ImplCalcVisEntries( tools::Long nMaxHeight, sal_uInt16
nStartEntry, sal_uInt16* pLastVisible ) const
{
nMaxHeight -= 2 * ImplGetFloatingWindow()->GetScrollerHeight();
diff --git a/vcl/source/window/menufloatingwindow.cxx
b/vcl/source/window/menufloatingwindow.cxx
index cfd6a6ae190e..075fb97f5632 100644
--- a/vcl/source/window/menufloatingwindow.cxx
+++ b/vcl/source/window/menufloatingwindow.cxx
@@ -308,8 +308,15 @@ IMPL_LINK_NOARG(MenuFloatingWindow, PopupEnd,
FloatingWindow*, void)
pMenu->pStartedFrom->ClosePopup(pMenu);
}
- if ( pM )
+ if (pM)
+ {
pM->pStartedFrom = nullptr;
+ if (m_xListener.is())
+ {
+ css::ui::dialogs::DialogClosedEvent
aEvent(GetComponentInterface(), pM->GetCurItemId());
+ m_xListener->dialogClosed(aEvent);
+ }
+ }
}
IMPL_LINK_NOARG(MenuFloatingWindow, AutoScroll, Timer *, void)
@@ -443,21 +450,31 @@ void MenuFloatingWindow::End()
Window::EndSaveFocus(xFocusId);
}
+ Finish();
+
bInExecute = false;
}
-void MenuFloatingWindow::Execute()
+void MenuFloatingWindow::Popup(const
css::uno::Reference<css::ui::dialogs::XDialogClosedListener>& xListener)
{
ImplSVData* pSVData = ImplGetSVData();
-
pSVData->maAppData.mpActivePopupMenu =
static_cast<PopupMenu*>(pMenu.get());
-
+ m_xListener = xListener;
Start();
+}
+void MenuFloatingWindow::Finish()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ pSVData->maAppData.mpActivePopupMenu = nullptr;
+}
+
+void MenuFloatingWindow::Execute()
+{
+ Popup();
while (bInExecute && !Application::IsQuit())
Application::Yield();
-
- pSVData->maAppData.mpActivePopupMenu = nullptr;
+ Finish();
}
void MenuFloatingWindow::StopExecute()
@@ -474,6 +491,7 @@ void MenuFloatingWindow::StopExecute()
// notify parent, needed for accessibility
if( pMenu && pMenu->pStartedFrom )
pMenu->pStartedFrom->ImplCallEventListeners(
VclEventId::MenuSubmenuDeactivate, nPosInParent );
+ Finish();
}
void MenuFloatingWindow::KillActivePopup( PopupMenu* pThisOnly )
@@ -502,6 +520,7 @@ void MenuFloatingWindow::KillActivePopup( PopupMenu*
pThisOnly )
PaintImmediately();
}
+ pPopup->Finish();
}
void MenuFloatingWindow::EndExecute()
diff --git a/vcl/source/window/menufloatingwindow.hxx
b/vcl/source/window/menufloatingwindow.hxx
index f26fb50373ca..b6c8b54738ce 100644
--- a/vcl/source/window/menufloatingwindow.hxx
+++ b/vcl/source/window/menufloatingwindow.hxx
@@ -46,6 +46,7 @@ private:
sal_uInt16 nScrollerHeight;
sal_uInt16 nFirstEntry;
sal_uInt16 nPosInParent;
+ css::uno::Reference<css::ui::dialogs::XDialogClosedListener> m_xListener;
bool bInExecute : 1;
bool bScrollMenu : 1;
@@ -67,6 +68,7 @@ private:
void Start();
void End();
+ static void Finish();
protected:
vcl::Region ImplCalcClipRegion() const;
@@ -107,6 +109,8 @@ public:
bool IsScrollMenu() const { return bScrollMenu; }
sal_uInt16 GetScrollerHeight() const { return nScrollerHeight; }
+ void Popup(const
css::uno::Reference<css::ui::dialogs::XDialogClosedListener>& xListener =
nullptr);
+
void Execute();
void StopExecute();
void EndExecute();
diff --git a/vcl/unx/gtk3/gtksalmenu.cxx b/vcl/unx/gtk3/gtksalmenu.cxx
index ac71e3390d87..0ccda0b66fb8 100644
--- a/vcl/unx/gtk3/gtksalmenu.cxx
+++ b/vcl/unx/gtk3/gtksalmenu.cxx
@@ -422,9 +422,13 @@ static void MenuClosed(GtkPopover* pWidget, GMainLoop*
pLoop)
g_main_loop_quit(pLoop);
}
-bool GtkSalMenu::ShowNativePopupMenu(FloatingWindow* pWin, const
tools::Rectangle& rRect,
- FloatWinPopupFlags nFlags)
+bool GtkSalMenu::ShowNativePopupMenu
+ (FloatingWindow* pWin, const tools::Rectangle& rRect, FloatWinPopupFlags
nFlags,
+ const css::uno::Reference<css::ui::dialogs::XDialogClosedListener>*
pListener)
{
+ if (pListener)
+ return false;
+
VclPtr<vcl::Window> xParent = pWin->ImplGetWindowImpl()->mpRealParent;
mpFrame = static_cast<GtkSalFrame*>(xParent->ImplGetFrame());
commit 3cb70046b8543f5c8b3fe34e16d9a115083148e2
Author: Jan-Marek Glogowski <[email protected]>
AuthorDate: Sat Nov 20 15:06:35 2021 +0100
Commit: TheRock Builder <libo@therock>
CommitDate: Thu Apr 28 14:42:01 2022 +0000
Refactor PopupMenu::ImplExecute for async support
Splits ImplExecute into PrepareRun, Run and FinishRun.
Change-Id: Ifddb1e968b468c9757eeece0bb19513cc26a9c8d
diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx
index 54df7ee66631..abad985775e4 100644
--- a/include/vcl/menu.hxx
+++ b/include/vcl/menu.hxx
@@ -493,7 +493,10 @@ class VCL_DLLPUBLIC PopupMenu final : public Menu
private:
SAL_DLLPRIVATE MenuFloatingWindow * ImplGetFloatingWindow() const;
- SAL_DLLPRIVATE sal_uInt16 ImplExecute( const VclPtr<vcl::Window>& pW,
const tools::Rectangle& rRect, FloatWinPopupFlags nPopupModeFlags, Menu*
pSFrom, bool bPreSelectFirst );
+ SAL_DLLPRIVATE bool PrepareRun(const VclPtr<vcl::Window>& pParentWin,
tools::Rectangle& rRect, FloatWinPopupFlags& nPopupModeFlags, Menu* pSFrom,
bool& bRealExecute, VclPtr<MenuFloatingWindow>&);
+ SAL_DLLPRIVATE bool Run(const VclPtr<MenuFloatingWindow>&, bool
bRealExecute, bool bPreSelectFirst, FloatWinPopupFlags nPopupModeFlags, Menu*
pSFrom, const tools::Rectangle& rRect);
+ SAL_DLLPRIVATE void FinishRun(const VclPtr<MenuFloatingWindow>&, const
VclPtr<vcl::Window>& pParentWin, bool bRealExecute, bool bIsNativeMenu);
+ SAL_DLLPRIVATE sal_uInt16 ImplExecute(const VclPtr<vcl::Window>&
pParentWin, const tools::Rectangle& rRect, FloatWinPopupFlags nPopupModeFlags,
Menu* pSFrom, bool bPreSelectFirst);
SAL_DLLPRIVATE void ImplFlushPendingSelect();
SAL_DLLPRIVATE tools::Long ImplCalcHeight( sal_uInt16 nEntries ) const;
SAL_DLLPRIVATE sal_uInt16 ImplCalcVisEntries( tools::Long nMaxHeight,
sal_uInt16 nStartEntry, sal_uInt16* pLastVisible = nullptr ) const;
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 89bd5672088b..46b899c14374 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -2745,10 +2745,8 @@ sal_uInt16 PopupMenu::Execute( vcl::Window* pExecWindow,
const Point& rPopupPos
return Execute( pExecWindow, tools::Rectangle( rPopupPos, rPopupPos ),
PopupMenuFlags::ExecuteDown );
}
-sal_uInt16 PopupMenu::Execute( vcl::Window* pExecWindow, const
tools::Rectangle& rRect, PopupMenuFlags nFlags )
+static FloatWinPopupFlags lcl_TranslateFlags(PopupMenuFlags nFlags)
{
- ENSURE_OR_RETURN( pExecWindow, "PopupMenu::Execute: need a non-NULL
window!", 0 );
-
FloatWinPopupFlags nPopupModeFlags = FloatWinPopupFlags::NONE;
if ( nFlags & PopupMenuFlags::ExecuteDown )
nPopupModeFlags = FloatWinPopupFlags::Down;
@@ -2762,7 +2760,13 @@ sal_uInt16 PopupMenu::Execute( vcl::Window* pExecWindow,
const tools::Rectangle&
if (nFlags & PopupMenuFlags::NoMouseUpClose ) //
allow popup menus to stay open on mouse button up
nPopupModeFlags |= FloatWinPopupFlags::NoMouseUpClose; // useful if
the menu was opened on mousebutton down (eg toolbox configuration)
- return ImplExecute( pExecWindow, rRect, nPopupModeFlags, nullptr, false );
+ return nPopupModeFlags;
+}
+
+sal_uInt16 PopupMenu::Execute( vcl::Window* pExecWindow, const
tools::Rectangle& rRect, PopupMenuFlags nFlags )
+{
+ ENSURE_OR_RETURN( pExecWindow, "PopupMenu::Execute: need a non-NULL
window!", 0 );
+ return ImplExecute( pExecWindow, rRect, lcl_TranslateFlags(nFlags),
nullptr, false );
}
void PopupMenu::ImplFlushPendingSelect()
@@ -2778,10 +2782,14 @@ void PopupMenu::ImplFlushPendingSelect()
}
}
-sal_uInt16 PopupMenu::ImplExecute( const VclPtr<vcl::Window>& pW, const
tools::Rectangle& rRect, FloatWinPopupFlags nPopupModeFlags, Menu* pSFrom, bool
bPreSelectFirst )
+bool PopupMenu::PrepareRun(const VclPtr<vcl::Window>& pParentWin,
tools::Rectangle& rRect,
+ FloatWinPopupFlags& nPopupModeFlags, Menu* pSFrom,
+ bool& bRealExecute, VclPtr<MenuFloatingWindow>&
pWin)
{
- if ( !pSFrom && ( vcl::IsInPopupMenuExecute() || !GetItemCount() ) )
- return 0;
+ bRealExecute = false;
+ const sal_uInt16 nItemCount = GetItemCount();
+ if (!pSFrom && (vcl::IsInPopupMenuExecute() || !nItemCount))
+ return false;
mpLayoutData.reset();
@@ -2793,7 +2801,6 @@ sal_uInt16 PopupMenu::ImplExecute( const
VclPtr<vcl::Window>& pW, const tools::R
bCanceled = false;
VclPtr<vcl::Window> xFocusId;
- bool bRealExecute = false;
if ( !pStartedFrom )
{
pSVData->mpWinData->mbNoDeactivate = true;
@@ -2809,25 +2816,24 @@ sal_uInt16 PopupMenu::ImplExecute( const
VclPtr<vcl::Window>& pW, const tools::R
}
SAL_WARN_IF( ImplGetWindow(), "vcl", "Win?!" );
- tools::Rectangle aRect( rRect );
- aRect.SetPos( pW->OutputToScreenPixel( aRect.TopLeft() ) );
+ rRect.SetPos(pParentWin->OutputToScreenPixel(rRect.TopLeft()));
+ nPopupModeFlags |= FloatWinPopupFlags::NoKeyClose |
FloatWinPopupFlags::AllMouseButtonClose | FloatWinPopupFlags::GrabFocus;
if (bRealExecute)
nPopupModeFlags |= FloatWinPopupFlags::NewLevel;
- nPopupModeFlags |= FloatWinPopupFlags::NoKeyClose |
FloatWinPopupFlags::AllMouseButtonClose;
bInCallback = true; // set it here, if Activate overridden
Activate();
bInCallback = false;
- if ( pW->isDisposed() )
- return 0; // Error
+ if (pParentWin->isDisposed())
+ return false;
if ( bCanceled || bKilled )
- return 0;
+ return false;
- if ( !GetItemCount() )
- return 0;
+ if (!nItemCount)
+ return false;
// The flag MenuFlags::HideDisabledEntries is inherited.
if ( pSFrom )
@@ -2857,10 +2863,10 @@ sal_uInt16 PopupMenu::ImplExecute( const
VclPtr<vcl::Window>& pW, const tools::R
ImplCallEventListeners(VclEventId::MenuSubmenuChanged, nPos);
}
- VclPtrInstance<MenuFloatingWindow> pWin( this, pW, WB_BORDER |
WB_SYSTEMWINDOW );
+ pWin = VclPtrInstance<MenuFloatingWindow>(this, pParentWin, WB_BORDER |
WB_SYSTEMWINDOW);
if (comphelper::LibreOfficeKit::isActive() && get_id() ==
"editviewspellmenu")
{
- VclPtr<vcl::Window> xNotifierParent = pW->GetParentWithLOKNotifier();
+ VclPtr<vcl::Window> xNotifierParent =
pParentWin->GetParentWithLOKNotifier();
assert(xNotifierParent && xNotifierParent->GetLOKNotifier() &&
"editview menu without LOKNotifier");
pWin->SetLOKNotifier(xNotifierParent->GetLOKNotifier());
}
@@ -2879,9 +2885,9 @@ sal_uInt16 PopupMenu::ImplExecute( const
VclPtr<vcl::Window>& pW, const tools::R
vcl::Window* pDeskW = pWindow->GetWindow( GetWindowType::RealParent );
if( ! pDeskW )
pDeskW = pWindow;
- Point aDesktopTL( pDeskW->OutputToAbsoluteScreenPixel( aRect.TopLeft()
) );
+ Point aDesktopTL(pDeskW->OutputToAbsoluteScreenPixel(rRect.TopLeft()));
aDesktopRect = Application::GetScreenPosSizePixel(
- Application::GetBestScreen( tools::Rectangle( aDesktopTL,
aRect.GetSize() ) ));
+ Application::GetBestScreen(tools::Rectangle(aDesktopTL,
rRect.GetSize())));
}
tools::Long nMaxHeight = aDesktopRect.GetHeight();
@@ -2896,8 +2902,8 @@ sal_uInt16 PopupMenu::ImplExecute( const
VclPtr<vcl::Window>& pW, const tools::R
if ( pRef->GetParent() )
pRef = pRef->GetParent();
- tools::Rectangle devRect( pRef->OutputToAbsoluteScreenPixel(
aRect.TopLeft() ),
- pRef->OutputToAbsoluteScreenPixel(
aRect.BottomRight() ) );
+ tools::Rectangle
devRect(pRef->OutputToAbsoluteScreenPixel(rRect.TopLeft()),
+
pRef->OutputToAbsoluteScreenPixel(rRect.BottomRight()));
tools::Long nHeightAbove = devRect.Top() - aDesktopRect.Top();
tools::Long nHeightBelow = aDesktopRect.Bottom() - devRect.Bottom();
@@ -2912,7 +2918,7 @@ sal_uInt16 PopupMenu::ImplExecute( const
VclPtr<vcl::Window>& pW, const tools::R
nMaxHeight = std::max(nMaxHeight, tools::Long(768));
if (pStartedFrom && pStartedFrom->IsMenuBar())
- nMaxHeight -= pW->GetSizePixel().Height();
+ nMaxHeight -= pParentWin->GetSizePixel().Height();
sal_Int32 nLeft, nTop, nRight, nBottom;
pWindow->GetBorder( nLeft, nTop, nRight, nBottom );
nMaxHeight -= nTop+nBottom;
@@ -2924,43 +2930,34 @@ sal_uInt16 PopupMenu::ImplExecute( const
VclPtr<vcl::Window>& pW, const tools::R
aSz.setHeight( ImplCalcHeight( nEntries ) );
}
- // tdf#126054 hold this until after function completes
- VclPtr<PopupMenu> xThis(this);
-
pWin->SetFocusId( xFocusId );
pWin->SetOutputSizePixel( aSz );
- if ( GetItemCount() )
+ return true;
+}
+
+bool PopupMenu::Run(const VclPtr<MenuFloatingWindow>& pWin, const bool
bRealExecute, const bool bPreSelectFirst,
+ const FloatWinPopupFlags nPopupModeFlags, Menu* pSFrom,
const tools::Rectangle& rRect)
+{
+ SalMenu* pMenu = ImplGetSalMenu();
+ if (pMenu && bRealExecute && pMenu->ShowNativePopupMenu(pWin, rRect,
nPopupModeFlags))
+ return true;
+
+ pWin->StartPopupMode(rRect, nPopupModeFlags);
+ if (pSFrom)
{
- SalMenu* pMenu = ImplGetSalMenu();
- if( pMenu && bRealExecute && pMenu->ShowNativePopupMenu( pWin, aRect,
nPopupModeFlags | FloatWinPopupFlags::GrabFocus ) )
- {
- pWin->StopExecute();
- pWin->doShutdown();
- pWindow.disposeAndClear();
- ImplClosePopupToolBox(pW);
- ImplFlushPendingSelect();
- return nSelectedId;
- }
+ sal_uInt16 aPos;
+ if (pSFrom->IsMenuBar())
+ aPos = static_cast<MenuBarWindow
*>(pSFrom->pWindow.get())->GetHighlightedItem();
else
- {
- pWin->StartPopupMode( aRect, nPopupModeFlags |
FloatWinPopupFlags::GrabFocus );
- }
- if( pSFrom )
- {
- sal_uInt16 aPos;
- if (pSFrom->IsMenuBar())
- aPos = static_cast<MenuBarWindow
*>(pSFrom->pWindow.get())->GetHighlightedItem();
- else
- aPos = static_cast<MenuFloatingWindow
*>(pSFrom->pWindow.get())->GetHighlightedItem();
+ aPos = static_cast<MenuFloatingWindow
*>(pSFrom->pWindow.get())->GetHighlightedItem();
- pWin->SetPosInParent( aPos ); // store position to be sent in
SUBMENUDEACTIVATE
- pSFrom->ImplCallEventListeners( VclEventId::MenuSubmenuActivate,
aPos );
- }
+ pWin->SetPosInParent(aPos); // store position to be sent in
SUBMENUDEACTIVATE
+ pSFrom->ImplCallEventListeners(VclEventId::MenuSubmenuActivate, aPos);
}
+
if ( bPreSelectFirst )
{
- size_t nCount = pItemList->size();
- for ( size_t n = 0; n < nCount; n++ )
+ for (size_t n = 0; n < static_cast<size_t>(GetItemCount()); n++)
{
MenuItemData* pData = pItemList->GetDataFromPos( n );
if ( ( pData->bEnabled
@@ -2971,22 +2968,30 @@ sal_uInt16 PopupMenu::ImplExecute( const
VclPtr<vcl::Window>& pW, const tools::R
&& ImplIsSelectable( n )
)
{
- pWin->ChangeHighlightItem( n, false );
+ pWin->ChangeHighlightItem(n, false);
break;
}
}
}
- if ( bRealExecute )
- {
+
+ if (bRealExecute)
pWin->Execute();
- if (pWin->isDisposed())
- return 0;
- xFocusId = pWin->GetFocusId();
+ return false;
+}
+
+void PopupMenu::FinishRun(const VclPtr<MenuFloatingWindow>& pWin, const
VclPtr<vcl::Window>& pParentWin, const bool bRealExecute, const bool
bIsNativeMenu)
+{
+ if (!bRealExecute || pWin->isDisposed())
+ return;
+
+ if (!bIsNativeMenu)
+ {
+ VclPtr<vcl::Window> xFocusId = pWin->GetFocusId();
assert(xFocusId == nullptr && "Focus should already be restored by
MenuFloatingWindow::End");
pWin->ImplEndPopupMode(FloatWinPopupEndFlags::NONE, xFocusId);
- if ( nSelectedId ) // then clean up .. ( otherwise done by TH )
+ if (nSelectedId) // then clean up .. ( otherwise done by TH )
{
PopupMenu* pSub = pWin->GetActivePopup();
while ( pSub )
@@ -2995,13 +3000,29 @@ sal_uInt16 PopupMenu::ImplExecute( const
VclPtr<vcl::Window>& pW, const tools::R
pSub = pSub->ImplGetFloatingWindow()->GetActivePopup();
}
}
- pWin->doShutdown();
- pWindow.disposeAndClear();
- ImplClosePopupToolBox(pW);
- ImplFlushPendingSelect();
}
+ else
+ pWin->StopExecute();
- return bRealExecute ? nSelectedId : 0;
+ pWin->doShutdown();
+ pWindow.disposeAndClear();
+ ImplClosePopupToolBox(pParentWin);
+ ImplFlushPendingSelect();
+}
+
+sal_uInt16 PopupMenu::ImplExecute(const VclPtr<vcl::Window>& pParentWin, const
tools::Rectangle& rRect,
+ FloatWinPopupFlags nPopupModeFlags, Menu*
pSFrom, bool bPreSelectFirst)
+{
+ // tdf#126054 hold this until after function completes
+ VclPtr<PopupMenu> xThis(this);
+ bool bRealExecute = false;
+ tools::Rectangle aRect(rRect);
+ VclPtr<MenuFloatingWindow> pWin;
+ if (!PrepareRun(pParentWin, aRect, nPopupModeFlags, pSFrom, bRealExecute,
pWin))
+ return 0;
+ const bool bNative = Run(pWin, bRealExecute, bPreSelectFirst,
nPopupModeFlags, pSFrom, aRect);
+ FinishRun(pWin, pParentWin, bRealExecute, bNative);
+ return nSelectedId;
}
sal_uInt16 PopupMenu::ImplCalcVisEntries( tools::Long nMaxHeight, sal_uInt16
nStartEntry, sal_uInt16* pLastVisible ) const
commit a2772237fb79e10ffaa645582013ff6d8b1ece5f
Author: Thorsten Behrens <[email protected]>
AuthorDate: Sat Nov 13 23:12:58 2021 +0100
Commit: TheRock Builder <libo@therock>
CommitDate: Thu Apr 28 14:41:59 2022 +0000
WASM default to notebookbar
..and use the full, desktop variant..
Change-Id: Ib00aad8cd130b4a3433209c540fe82970c45c98e
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 462e2e5d25af..2086f531b6a8 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -6417,7 +6417,11 @@ static void activateNotebookbar(std::u16string_view rApp)
if (aAppNode.isValid())
{
+#ifdef EMSCRIPTEN
+ aAppNode.setNodeValue("Active", makeAny(OUString("notebookbar.ui")));
+#else
aAppNode.setNodeValue("Active",
makeAny(OUString("notebookbar_online.ui")));
+#endif
aAppNode.commit();
}
}
@@ -6456,7 +6460,11 @@ static int lo_initialize(LibreOfficeKit* pThis, const
char* pAppPath, const char
static bool bPreInited = false;
static bool bUnipoll = false;
static bool bProfileZones = false;
+#ifdef EMSCRIPTEN
+ static bool bNotebookbar = true;
+#else
static bool bNotebookbar = false;
+#endif
{ // cf. string lifetime for preinit
std::vector<OUString> aOpts;
commit aa22ee2b306b0c4160f6ead3a5749f43f6a25f9a
Author: Jan-Marek Glogowski <[email protected]>
AuthorDate: Mon Dec 6 09:24:50 2021 +0100
Commit: TheRock Builder <libo@therock>
CommitDate: Thu Apr 28 14:41:58 2022 +0000
gbuild: build static unit tests
While this generally works, the setup is not very practical. The
unit tests become all very large, if they use components. The best
static solution I can imagine is either just somehow linking them
on demand, or create a single huge liblibreoffice.so, so keeping
everthing almost static.
Change-Id: If00f9ac3b3f63b915e3b5dcd931d233681a58006
diff --git a/Repository.mk b/Repository.mk
index 5532b993dfde..f0f6b51584ac 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -32,7 +32,7 @@ $(eval $(call gb_Helper_register_executables,NONE, \
cfgex \
concat-deps \
cpp \
- cppunittester \
+ $(call gb_CondCppunitMainLibOrExe,,cppunittester) \
gbuildtojson \
$(if $(filter MSC,$(COM)), \
gcc-wrapper \
@@ -582,6 +582,7 @@ $(eval $(call gb_Helper_register_libraries,PLAINLIBS_NONE, \
$(if $(filter MSC,$(COM)),cli_cppuhelper) \
$(if $(filter $(OS),ANDROID),lo-bootstrap) \
$(if $(filter $(OS),MACOSX),OOoSpotlightImporter) \
+ $(call gb_CondCppunitMainLibOrExe,cppunitmain) \
))
$(eval $(call gb_Helper_register_libraries_for_install,PLAINLIBS_URE,ure, \
diff --git a/sal/Library_cppunitmain.mk b/sal/Library_cppunitmain.mk
new file mode 100644
index 000000000000..07f51e0c4821
--- /dev/null
+++ b/sal/Library_cppunitmain.mk
@@ -0,0 +1,42 @@
+# -*- 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_Library_Library,cppunitmain))
+
+$(eval $(call gb_Library_set_include,cppunitmain,\
+ $$(INCLUDE) \
+ -I$(SRCDIR)/sal/inc \
+))
+
+$(eval $(call gb_Library_use_libraries,cppunitmain,\
+ sal \
+ unoexceptionprotector \
+ unobootstrapprotector \
+ vclbootstrapprotector \
+))
+
+$(eval $(call gb_Library_use_externals,cppunitmain,\
+ boost_headers \
+ cppunit \
+))
+
+$(eval $(call gb_Library_add_exception_objects,cppunitmain,\
+ sal/cppunittester/cppunittester \
+))
+
+ifeq ($(COM),MSC)
+
+$(eval $(call gb_Library_add_ldflags,cppunitmain,\
+ /STACK:10000000 \
+))
+
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/sal/Module_sal.mk b/sal/Module_sal.mk
index e0448a5085bf..6c18d6282977 100644
--- a/sal/Module_sal.mk
+++ b/sal/Module_sal.mk
@@ -10,7 +10,7 @@
$(eval $(call gb_Module_Module,sal))
$(eval $(call gb_Module_add_targets,sal,\
- $(if $(CROSS_COMPILING),,$(if $(filter
TRUE,$(DISABLE_DYNLOADING)),,Executable_cppunittester)) \
+ $(call
gb_CondCppunitMainLibOrExe,Library_cppunitmain,Executable_cppunittester) \
$(if $(filter $(OS),ANDROID), \
Library_lo-bootstrap) \
Library_sal \
diff --git a/sal/cppunittester/cppunittester.cxx
b/sal/cppunittester/cppunittester.cxx
index fec62c261260..18773b2a67b6 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -230,13 +230,17 @@ class CPPUNIT_API ProtectedFixtureFunctor
{
private:
const std::string &testlib;
+#ifndef DISABLE_DYNLOADING
const std::string &args;
+#endif
std::vector<CppUnit::Protector *> &protectors;
CppUnit::TestResult &result;
public:
ProtectedFixtureFunctor(const std::string& testlib_, const std::string
&args_, std::vector<CppUnit::Protector*> &protectors_, CppUnit::TestResult
&result_)
: testlib(testlib_)
+#ifndef DISABLE_DYNLOADING
, args(args_)
+#endif
, protectors(protectors_)
, result(result_)
{
diff --git a/solenv/gbuild/Conditions.mk b/solenv/gbuild/Conditions.mk
index 0a7b88969557..4cb5688997e9 100644
--- a/solenv/gbuild/Conditions.mk
+++ b/solenv/gbuild/Conditions.mk
@@ -12,6 +12,10 @@
# just end in two (!) braces, otherwise you may need to use either the $(1)
# or the $(2) multiple times.
+define gb_CondCppunitMainLibOrExe
+$(if $(or $(CROSS_COMPILING),$(DISABLE_DYNLOADING)),$(1),$(2))
+endef
+
define gb_CondExeLockfile
$(if $(and $(filter-out ANDROID MACOSX iOS WNT,$(OS))),$(1),$(2))
endef
diff --git a/solenv/gbuild/CppunitTest.mk b/solenv/gbuild/CppunitTest.mk
index 995910cfbd0c..8e9392e5c397 100644
--- a/solenv/gbuild/CppunitTest.mk
+++ b/solenv/gbuild/CppunitTest.mk
@@ -21,6 +21,7 @@
gb_CppunitTest_UNITTESTFAILED ?=
$(GBUILDDIR)/platform/unittest-failed-default.sh
gb_CppunitTest_PYTHONDEPS ?= $(call gb_Library_get_target,pyuno_wrapper) $(if
$(SYSTEM_PYTHON),,$(call gb_Package_get_target,python3))
+gb_CppunitTest_KNOWN :=
ifneq ($(strip $(CPPUNITTRACE)),)
ifneq ($(filter gdb,$(CPPUNITTRACE)),)
@@ -70,8 +71,13 @@ endif
# defined by platform
# gb_CppunitTest_get_filename
+ifeq (,$(DISABLE_DYNLOADING))
gb_CppunitTest_RUNTIMEDEPS := $(call
gb_Executable_get_runtime_dependencies,cppunittester)
gb_CppunitTest_CPPTESTCOMMAND := $(call
gb_Executable_get_target_for_build,cppunittester)
+else
+gb_CppunitTest_RUNTIMEDEPS :=
+gb_CppunitTest_CPPTESTCOMMAND :=
+endif
# i18npool dlopens localedata_* libraries.
gb_CppunitTest_RUNTIMEDEPS += \
@@ -198,6 +204,11 @@ $(call gb_CppunitTest_get_target,$(1)) : HEADLESS :=
--headless
$(call gb_CppunitTest_get_target,$(1)) : EXTRA_ENV_VARS :=
$$(eval $$(call gb_Module_register_target,$(call
gb_CppunitTest_get_target,$(1)),$(call gb_CppunitTest_get_clean_target,$(1))))
$(call gb_Helper_make_userfriendly_targets,$(1),CppunitTest)
+ifeq ($(DISABLE_DYNLOADING),TRUE)
+$$(eval $$(call gb_CppunitTest_use_libraries,$(1),cppunitmain))
+$$(eval $$(call gb_CppunitTest_add_defs,$(1),-D__EMSCRIPTEN__))
+endif
+$(if $(filter $(1),$(gb_CppunitTest_KNOWN)),,gb_CppunitTest_KNOWN += $(1))
endef
diff --git a/solenv/gbuild/TargetLocations.mk b/solenv/gbuild/TargetLocations.mk
index 32d7eed72ec0..253e01acf5fd 100644
--- a/solenv/gbuild/TargetLocations.mk
+++ b/solenv/gbuild/TargetLocations.mk
@@ -53,6 +53,7 @@ gb_CompilerTest_get_target = $(WORKDIR)/CompilerTest/$(1)
gb_ComponentTarget_get_target = $(WORKDIR)/ComponentTarget/$(1).component
gb_ComponentTarget_get_target_for_build =
$(WORKDIR_FOR_BUILD)/ComponentTarget/$(1).component
gb_Configuration_get_preparation_target =
$(WORKDIR)/Configuration/$(1).prepared
+gb_CppunitTest_get_linktargetfile = $(call gb_LinkTarget_get_target,$(call
gb_CppunitTest_get_linktarget,$1))
gb_CppunitTest_get_target = $(WORKDIR)/CppunitTest/$(1).test
gb_CustomPackage_get_target = $(WORKDIR)/CustomPackage/$(1).filelist
gb_CustomTarget_get_repo_target = $(WORKDIR)/CustomTarget/$(2)_$(1).done
diff --git a/solenv/gbuild/extensions/post_SpeedUpTargets.mk
b/solenv/gbuild/extensions/post_SpeedUpTargets.mk
index 3db6355ab90d..6fcbe243a01f 100644
--- a/solenv/gbuild/extensions/post_SpeedUpTargets.mk
+++ b/solenv/gbuild/extensions/post_SpeedUpTargets.mk
@@ -52,7 +52,6 @@ endif
endif
-
ifneq (,$(filter build,$(gb_Module_SKIPTARGETS)))
gb_Module_add_target =
endif
diff --git a/solenv/gbuild/gbuild.mk b/solenv/gbuild/gbuild.mk
index 075c029b095d..c07ade7b4b18 100644
--- a/solenv/gbuild/gbuild.mk
+++ b/solenv/gbuild/gbuild.mk
@@ -292,6 +292,7 @@ gb_TEST_ENV_VARS +=
SAL_DISABLE_SYNCHRONOUS_PRINTER_DETECTION=1
ifeq (,$(SAL_USE_VCLPLUGIN))
gb_TEST_ENV_VARS += SAL_USE_VCLPLUGIN=svp
endif
+gb_TEST_ENV_VARS += STATIC_UNO_HOME=file://$$I/program
# This is used to detect whether LibreOffice is being built (as opposed to
building
# 3rd-party code). Used for tag deprecation for API we want to
diff --git a/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk
index b98732030b32..037f462d2795 100644
--- a/solenv/gbuild/platform/unxgcc.mk
+++ b/solenv/gbuild/platform/unxgcc.mk
@@ -312,12 +312,18 @@ endef
gb_CppunitTest_CPPTESTPRECOMMAND := \
$(call
gb_Helper_extend_ld_path,$(WORKDIR)/UnpackedTarball/cppunit/src/cppunit/.libs)
-gb_CppunitTest_get_filename = libtest_$(1).so
+ifeq (,$(DISABLE_DYNLOADING))
+gb_CppunitTest_get_filename = libtest_$(1)$(gb_Library_PLAINEXT)
+else
+gb_CppunitTest_get_filename = test_$(1)$(gb_Executable_EXT)
+endif
gb_CppunitTest_get_ilibfilename = $(gb_CppunitTest_get_filename)
gb_CppunitTest_malloc_check := -ex 'set environment MALLOC_CHECK_=2; set
environment MALLOC_PERTURB_=153'
define gb_CppunitTest_CppunitTest_platform
+ifeq (,$(DISABLE_DYNLOADING))
$(call gb_LinkTarget_get_target,$(2)) : RPATH := $(call
gb_Library__get_rpath,$(call gb_LinkTarget__get_rpath_for_layer,NONE))
+endif
endef
diff --git a/solenv/gbuild/static.mk b/solenv/gbuild/static.mk
index faa9a73db516..1b7f0214900a 100644
--- a/solenv/gbuild/static.mk
+++ b/solenv/gbuild/static.mk
@@ -198,6 +198,8 @@ $(foreach lib,$(gb_Library_KNOWNLIBS), \
$(eval $(call gb_LinkTarget__fill_all_deps,$(call
gb_Library_get_linktarget,$(lib)))))
$(foreach exec,$(gb_Executable_KNOWN), \
$(eval $(call gb_LinkTarget__expand_executable,$(call
gb_Executable_get_linktarget,$(exec)))))
+$(foreach cppunit,$(gb_CppunitTest_KNOWN), \
+ $(eval $(call gb_LinkTarget__expand_executable,$(call
gb_CppunitTest_get_linktarget,$(cppunit)))))
$(foreach workdir_linktargetname,$(gb_LinkTarget__ALL_TOUCHED), \
$(eval $(call gb_LinkTarget__remove_touch,$(workdir_linktargetname))))
@@ -235,11 +237,14 @@ endef
endef # gb_LinkTarget__expand_executable_template
ifneq (,$(gb_DEBUG_STATIC))
+$(info $(call gb_LinkTarget__expand_executable_template,CppunitTest))
$(info $(call gb_LinkTarget__expand_executable_template,Executable))
endif
+$(eval $(call gb_LinkTarget__expand_executable_template,CppunitTest))
$(eval $(call gb_LinkTarget__expand_executable_template,Executable))
$(foreach exec,$(gb_Executable_KNOWN),$(eval $(call
gb_Executable__expand_deps,$(exec))))
+$(foreach cppunit,$(gb_CppunitTest_KNOWN),$(eval $(call
gb_CppunitTest__expand_deps,$(cppunit))))
endif # gb_PARTIAL_BUILD
endif # gb_FULLDEPS
commit 346722b731422d5bd98e96e396c12aafaf827060
Author: Jan-Marek Glogowski <[email protected]>
AuthorDate: Sat Jan 8 22:53:29 2022 +0100
Commit: TheRock Builder <libo@therock>
CommitDate: Thu Apr 28 14:41:56 2022 +0000
gbuild: set unorc lookup dir via environment
UNO tries hard to find the path of the executable to look at that
place for its unorc / uno.ini. All these approaches don't work for
static binaries, so just override the lookup with the environment
variable STATIC_UNO_HOME.
Change-Id: I0d80c91e474d9f869475ba752d708b77c99f8a56
diff --git a/Makefile.in b/Makefile.in
index afccbb9ef460..e081949efe31 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -7,6 +7,8 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
+unexport STATIC_UNO_HOME
+
gb_Top_MODULE_CHECK_TARGETS := slowcheck unitcheck subsequentcheck perfcheck
uicheck screenshot
.PHONY : check-if-root bootstrap gbuild build build-non-l10n-only
build-l10n-only check clean clean-build clean-host test-install distclean
distro-pack-install docs download etags fetch get-submodules id install
install-gdb-printers install-strip tags debugrun help showmodules translations
packageinfo internal.clean $(gb_Top_MODULE_CHECK_TARGETS)
diff --git a/bin/run b/bin/run
index 523da3c0e178..f812c2baadbb 100755
--- a/bin/run
+++ b/bin/run
@@ -67,6 +67,8 @@ else
fi
+test "${STATIC_UNO_HOME+set}" = set || export
STATIC_UNO_HOME="file://${dir}/instdir/program"
+
# echo "setting URE_BOOTSTRAP to: ${URE_BOOTSTRAP}"
# echo "setting search path to: ${SEARCH_PATH}"
# echo "execing: ${exedir}/$1"
diff --git a/cppuhelper/source/paths.cxx b/cppuhelper/source/paths.cxx
index ece7650ded4c..0c0a3fbd5580 100644
--- a/cppuhelper/source/paths.cxx
+++ b/cppuhelper/source/paths.cxx
@@ -20,12 +20,14 @@
#include <config_folders.h>
#include <sal/config.h>
+#include <sal/log.hxx>
#include <cassert>
#include <com/sun/star/uno/DeploymentException.hpp>
#include <osl/file.hxx>
#include <osl/module.hxx>
+#include <osl/thread.h>
#include <rtl/ustring.hxx>
#include <sal/types.h>
#include <o3tl/string_view.hxx>
@@ -65,7 +67,16 @@ OUString cppu::getUnoIniUri() {
#elif defined(EMSCRIPTEN)
OUString uri("file:///instdir/program");
#else
- OUString uri(get_this_libpath());
+
+ OUString uri;
+#ifdef DISABLE_DYNLOADING
+ static const char* uno_home = getenv("STATIC_UNO_HOME");
+ if (uno_home)
+ uri = OStringToOUString(uno_home, osl_getThreadTextEncoding());
+ else
+#endif
+ uri = get_this_libpath();
+
#ifdef MACOSX
// We keep the URE dylibs directly in "Frameworks" (that is,
LIBO_LIB_FOLDER) and unorc in
// "Resources/ure/etc" (LIBO_URE_ETC_FOLDER).
@@ -75,7 +86,9 @@ OUString cppu::getUnoIniUri() {
}
#endif
#endif
- return uri + "/" SAL_CONFIGFILE("uno");
+ uri += "/" SAL_CONFIGFILE("uno");
+ SAL_INFO("cppuhelper", "expected uno config: " << uri);
+ return uri;
}
bool cppu::nextDirectoryItem(osl::Directory & directory, OUString * url) {
diff --git a/desktop/scripts/soffice.sh b/desktop/scripts/soffice.sh
index 67cc0b89751f..1bfb60682648 100755
--- a/desktop/scripts/soffice.sh
+++ b/desktop/scripts/soffice.sh
@@ -176,6 +176,8 @@ else
unset LC_ALL
fi
+test "${STATIC_UNO_HOME+set}" = set || export
STATIC_UNO_HOME="file://${sd_prog}"
+
# run soffice.bin directly when you want to get the backtrace
if [ -n "$GDBTRACECHECK" ] ; then
exec $GDBTRACECHECK "$sd_prog/soffice.bin" "$@"
commit 34b3c66da2e5a300930f4ea47661b0e38a459565
Author: Luboš Luňák <[email protected]>
AuthorDate: Thu Apr 28 12:32:18 2022 +0200
Commit: Luboš Luňák <[email protected]>
CommitDate: Thu Apr 28 15:28:26 2022 +0200
add a hack to SalLayoutGlyphsImpl::cloneCharRange() for a strange glyph
Change-Id: Id4859982079f5f156b5e2d85598940ec8c936475
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133547
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <[email protected]>
diff --git a/vcl/source/gdi/impglyphitem.cxx b/vcl/source/gdi/impglyphitem.cxx
index 6f0c3f3db5fd..d6c59e5decfa 100644
--- a/vcl/source/gdi/impglyphitem.cxx
+++ b/vcl/source/gdi/impglyphitem.cxx
@@ -147,6 +147,11 @@ SalLayoutGlyphsImpl*
SalLayoutGlyphsImpl::cloneCharRange(sal_Int32 index, sal_In
{
if (pos->IsRTLGlyph() != rtl)
return nullptr; // Don't mix RTL and non-RTL runs.
+ // HACK: When running CppunitTest_sw_uiwriter3's testTdf104649 on Mac
there's glyph
+ // with id 1232 that has 0 charCount, 0 origWidth and inconsistent
xOffset (sometimes 0,
+ // but sometimes not). Possibly font or Harfbuzz bug? It's extremely
rare, so simply bail out.
+ if (pos->charCount() == 0 && pos->origWidth() == 0)
+ return nullptr;
copy->push_back(*pos);
copy->back().setLinearPos(copy->back().linearPos() - zeroPoint);
++pos;
commit f4d51b6fc1f4e0457efc0d513bd74c64d5697938
Author: Luboš Luňák <[email protected]>
AuthorDate: Thu Apr 28 12:02:29 2022 +0200
Commit: Luboš Luňák <[email protected]>
CommitDate: Thu Apr 28 14:34:33 2022 +0200
use the same TextLayoutCache for the verifying call
Apparently not using it makes the ImplLayout() call treat everything
as one run, which changes whether a glyph may get ALLOW_KASHIDA.
Change-Id: I1a951dbc4242d1fe8e4ee5074d9f9ad1d80480be
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133546
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <[email protected]>
diff --git a/vcl/source/gdi/impglyphitem.cxx b/vcl/source/gdi/impglyphitem.cxx
index bffa490065c6..6f0c3f3db5fd 100644
--- a/vcl/source/gdi/impglyphitem.cxx
+++ b/vcl/source/gdi/impglyphitem.cxx
@@ -302,6 +302,12 @@ SalLayoutGlyphsCache::GetLayoutGlyphs(VclPtr<const
OutputDevice> outputDevice, c
{
mLastTemporaryKey = std::move(key);
#ifdef DBG_UTIL
+ std::shared_ptr<const vcl::text::TextLayoutCache>
tmpLayoutCache;
+ if (layoutCache == nullptr)
+ {
+ tmpLayoutCache = vcl::text::TextLayoutCache::Create(text);
+ layoutCache = tmpLayoutCache.get();
+ }
// Check if the subset result really matches what we would get
normally,
// to make sure corner cases are handled well (see
SalLayoutGlyphsImpl::cloneCharRange()).
std::unique_ptr<SalLayout> layout
commit 825102492a04752c4cebf6c84e2c8639de983e9b
Author: Luboš Luňák <[email protected]>
AuthorDate: Thu Apr 28 12:00:00 2022 +0200
Commit: Luboš Luňák <[email protected]>
CommitDate: Thu Apr 28 14:34:00 2022 +0200
don't cut a glyph subset inside a composed glyph #2
This is basically the same like 7b7d2f4a3e96e771e125c95a7d262b20f6dc9ecc,
triggered by CppunitTest_sw_uiwriter3's testTdf104649 on Mac.
Change-Id: Ibb3c33dd6924e8f0c8856185fc7fb7aeaaf72177
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133545
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <[email protected]>
diff --git a/vcl/source/gdi/impglyphitem.cxx b/vcl/source/gdi/impglyphitem.cxx
index 93f70a853a74..bffa490065c6 100644
--- a/vcl/source/gdi/impglyphitem.cxx
+++ b/vcl/source/gdi/impglyphitem.cxx
@@ -123,6 +123,10 @@ SalLayoutGlyphsImpl*
SalLayoutGlyphsImpl::cloneCharRange(sal_Int32 index, sal_In
// Require a start at the exact position given, otherwise bail out.
if (pos->charPos() != beginPos)
return nullptr;
+ // For RTL make sure we're not cutting in the middle of a multi-character
glyph
+ // (for non-RTL charPos is always the start of a multi-character glyph).
+ if (rtl && pos->charPos() + pos->charCount() > beginPos + 1)
+ return nullptr;
// Don't create a subset if it's not safe to break at the beginning or end
of the sequence
// (https://harfbuzz.github.io/harfbuzz-hb-buffer.html#hb-glyph-flags-t).
if (pos->IsUnsafeToBreak() || (pos->IsInCluster() &&
!pos->IsClusterStart()))
@@ -149,7 +153,7 @@ SalLayoutGlyphsImpl*
SalLayoutGlyphsImpl::cloneCharRange(sal_Int32 index, sal_In
}
if (pos != end())
{
- // Fail if the next character is at the expected past-end position.
For RTL check
+ // Fail if the next character is not at the expected past-end
position. For RTL check
// that we're not cutting in the middle of a multi-character glyph.
if (rtl ? pos->charPos() + pos->charCount() != endPos + 1 :
pos->charPos() != endPos)
return nullptr;
commit 450b9630c8352667b69d238b7ccd73fafcfa1cb3
Author: Seth Chaiklin <[email protected]>
AuthorDate: Thu Apr 28 13:08:47 2022 +0100
Commit: Gerrit Code Review <[email protected]>
CommitDate: Thu Apr 28 14:08:47 2022 +0200
Update git submodules
* Update helpcontent2 from branch 'master'
to d4e7c6e6e119fe3fab827753bbb8d27caff195c2
- tdf#148797 improve explanation of multiple selection in add to list
Some of the options for using the Add to List command are not
available when the Ctrl key is pressed. The existing description of
how to use the Ctrl key may have contributed to confusion about
how to use the command. This patch aims to improve the
description of the workflow with multiple selection.
Also the order of the two procedures were switched, on the
assumption that the most typical use was to add some consecutive
items to a list, so now that explanation comes first.
Change-Id: I4e7c57dba4b6060fcd87eb1046b9e0788dd50b1c
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/133483
Tested-by: Jenkins
Reviewed-by: Seth Chaiklin <[email protected]>
diff --git a/helpcontent2 b/helpcontent2
index b6accc5eaf8d..d4e7c6e6e119 160000
--- a/helpcontent2
+++ b/helpcontent2
@@ -1 +1 @@
-Subproject commit b6accc5eaf8d547bc9721118caaa9edbc998a333
+Subproject commit d4e7c6e6e119fe3fab827753bbb8d27caff195c2
commit b1148c31ed2786396f0b018a988fce8288f1797d
Author: Noel Grandin <[email protected]>
AuthorDate: Wed Apr 27 16:47:53 2022 +0200
Commit: Noel Grandin <[email protected]>
CommitDate: Thu Apr 28 13:40:36 2022 +0200
use more string_view in comphelper
Change-Id: I1544da756d8da074787bc19a98d2740058e36479
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133520
Tested-by: Jenkins
Reviewed-by: Noel Grandin <[email protected]>
diff --git a/basctl/source/basicide/baside2.hxx
b/basctl/source/basicide/baside2.hxx
index f43ee79d2c4f..2c9822610d64 100644
--- a/basctl/source/basicide/baside2.hxx
+++ b/basctl/source/basicide/baside2.hxx
@@ -153,7 +153,7 @@ public:
void ChangeFontColor( Color aColor );
void UpdateSyntaxHighlighting ();
- bool GetProcedureName(OUString const & rLine, OUString&
rProcType, OUString& rProcName) const;
+ bool GetProcedureName(std::u16string_view rLine, OUString&
rProcType, OUString& rProcName) const;
FactoryFunction GetUITestFactory() const override;
};
diff --git a/basctl/source/basicide/baside2b.cxx
b/basctl/source/basicide/baside2b.cxx
index 262f9e49a248..c080ea325807 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -40,6 +40,7 @@
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
#include <com/sun/star/script/XLibraryContainer2.hpp>
#include <comphelper/string.hxx>
+#include <o3tl/string_view.hxx>
#include <officecfg/Office/Common.hxx>
#include <sfx2/dispatch.hxx>
#include <sfx2/progress.hxx>
@@ -811,7 +812,7 @@ void EditorWindow::HandleProcedureCompletion()
}
}
-bool EditorWindow::GetProcedureName(OUString const & rLine, OUString&
rProcType, OUString& rProcName) const
+bool EditorWindow::GetProcedureName(std::u16string_view rLine, OUString&
rProcType, OUString& rProcName) const
{
std::vector<HighlightPortion> aPortions;
aHighlighter.getHighlightPortions(rLine, aPortions);
@@ -824,10 +825,10 @@ bool EditorWindow::GetProcedureName(OUString const &
rLine, OUString& rProcType,
for (auto const& portion : aPortions)
{
- OUString sTokStr = rLine.copy(portion.nBegin, portion.nEnd -
portion.nBegin);
+ std::u16string_view sTokStr = rLine.substr(portion.nBegin,
portion.nEnd - portion.nBegin);
- if( portion.tokenType == TokenType::Keywords && (
sTokStr.equalsIgnoreAsciiCase("sub")
- || sTokStr.equalsIgnoreAsciiCase("function")) )
+ if( portion.tokenType == TokenType::Keywords && (
o3tl::equalsIgnoreAsciiCase(sTokStr, u"sub")
+ || o3tl::equalsIgnoreAsciiCase(sTokStr, u"function")) )
{
rProcType = sTokStr;
bFoundType = true;
diff --git a/comphelper/qa/unit/syntaxhighlighttest.cxx
b/comphelper/qa/unit/syntaxhighlighttest.cxx
index c28941339085..eab382b85a65 100644
--- a/comphelper/qa/unit/syntaxhighlighttest.cxx
+++ b/comphelper/qa/unit/syntaxhighlighttest.cxx
@@ -38,7 +38,7 @@ public:
void SyntaxHighlightTest::testBasicString() {
std::vector<HighlightPortion> ps;
-
SyntaxHighlighter(HighlighterLanguage::Basic).getHighlightPortions("\"foo\"",
ps);
+
SyntaxHighlighter(HighlighterLanguage::Basic).getHighlightPortions(u"\"foo\"",
ps);
CPPUNIT_ASSERT_EQUAL(
static_cast<std::vector<HighlightPortion>::size_type>(1), ps.size());
CPPUNIT_ASSERT_EQUAL(sal_Int32(0), ps[0].nBegin);
... etc. - the rest is truncated