desktop/inc/lib/init.hxx | 2 - static/source/unoembindhelpers/PrimaryBindings.cxx | 34 +++++++++++++++++++++ sw/source/uibase/docvw/AnnotationWin2.cxx | 2 - unotest/source/embindtest/embindtest.cxx | 4 ++ unotest/source/embindtest/embindtest.idl | 2 + unotest/source/embindtest/embindtest.js | 6 +++ 6 files changed, 48 insertions(+), 2 deletions(-)
New commits: commit 2c3121adb9a53142a003ba668821e77e9555c629 Author: Stephan Bergmann <[email protected]> AuthorDate: Thu Feb 22 10:36:24 2024 +0100 Commit: Stephan Bergmann <[email protected]> CommitDate: Thu Feb 22 15:45:51 2024 +0100 Embind: Add UNO char support Change-Id: I4ced49774baafdf620ae167c53794932766aca86 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163741 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <[email protected]> diff --git a/static/source/unoembindhelpers/PrimaryBindings.cxx b/static/source/unoembindhelpers/PrimaryBindings.cxx index 0a27162c3ef1..a8e1000afd6f 100644 --- a/static/source/unoembindhelpers/PrimaryBindings.cxx +++ b/static/source/unoembindhelpers/PrimaryBindings.cxx @@ -23,6 +23,39 @@ using namespace emscripten; using namespace css::uno; +EM_JS(void, jsRegisterChar, (std::type_info const* raw), +// clang-format off +{ + Module.registerType(raw, { + name: 'rtl::OUString', + fromWireType(ptr) { + let str = String.fromCharCode(Module.HEAPU16[ptr >> 1]); + return str; + }, + toWireType(destructors, value) { + if (typeof value != 'string' || value.length !== 1) { + Module.throwBindingError( + 'Cannot pass anything but 1-element string to C++ char16_t'); + } + let data = Module._malloc(2); + Module.HEAPU16[data >> 1] = value.charCodeAt(0); + if (destructors !== null) { + destructors.push(Module._free, data); + } + return data; + }, + argPackAdvance: 8, + readValueFromPointer(pointer) { + return this.fromWireType(Module.HEAPU32[((pointer)>>2)]); + }, + destructorFunction(ptr) { + Module._free(ptr); + }, + }); +} +// clang-format on +); + #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-pp-token" EM_JS(void, jsRegisterString, (std::type_info const* raw), @@ -167,6 +200,7 @@ EMSCRIPTEN_BINDINGS(PrimaryBindings) function("rtl_uString_release", +[](std::uintptr_t ptr) { rtl_uString_release(reinterpret_cast<rtl_uString*>(ptr)); }); + jsRegisterChar(&typeid(char16_t)); jsRegisterString(&typeid(OUString)); } #endif diff --git a/unotest/source/embindtest/embindtest.cxx b/unotest/source/embindtest/embindtest.cxx index b1f819272931..9ab70656541d 100644 --- a/unotest/source/embindtest/embindtest.cxx +++ b/unotest/source/embindtest/embindtest.cxx @@ -68,6 +68,10 @@ public: sal_Bool SAL_CALL isDouble(double value) override { return value == 100.5; } + sal_Unicode SAL_CALL getChar() override { return u'Ö'; } + + sal_Bool SAL_CALL isChar(sal_Unicode value) override { return value == u'Ö'; } + OUString SAL_CALL getString() override { return u"hä"_ustr; } sal_Bool SAL_CALL isString(OUString const& value) override { return value == u"hä"; } diff --git a/unotest/source/embindtest/embindtest.idl b/unotest/source/embindtest/embindtest.idl index 913cde39e12b..09e5c4096c50 100644 --- a/unotest/source/embindtest/embindtest.idl +++ b/unotest/source/embindtest/embindtest.idl @@ -36,6 +36,8 @@ interface XTest { boolean isFloat([in] float value); double getDouble(); boolean isDouble([in] double value); + char getChar(); + boolean isChar([in] char value); string getString(); boolean isString([in] string value); Struct getStruct(); diff --git a/unotest/source/embindtest/embindtest.js b/unotest/source/embindtest/embindtest.js index 805dd16bfe99..9d0349ffe7f2 100644 --- a/unotest/source/embindtest/embindtest.js +++ b/unotest/source/embindtest/embindtest.js @@ -73,6 +73,12 @@ Module.addOnPostRun(function() { console.assert(v === 100.5); console.assert(test.isDouble(v)); } + { + let v = test.getChar(); + console.log(v); + console.assert(v === 'Ö'); + console.assert(test.isChar(v)); + } { let v = test.getString(); console.log(v); commit b3bca02d58f71d2413b673ff113a346e237ef92f Author: Stephan Bergmann <[email protected]> AuthorDate: Thu Feb 22 13:22:55 2024 +0100 Commit: Stephan Bergmann <[email protected]> CommitDate: Thu Feb 22 15:45:30 2024 +0100 Fix UBSan build's RTTI needs ...after 3ba92b5f1eaf7d4447a0943ea260db515ca799dc "hide more symbols" had caused CppunitTest_desktop_lib to fail with > DynamicLibraryManagerException: "Failed to load dynamic library: workdir/LinkTarget/CppunitTest/libtest_desktop_lib.so > workdir/LinkTarget/CppunitTest/libtest_desktop_lib.so: undefined symbol: _ZTIN7desktop20CallbackFlushHandlerE" Change-Id: I051e1a233757a6ccb7cf9ea564ab6b510d6df571 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163742 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <[email protected]> diff --git a/desktop/inc/lib/init.hxx b/desktop/inc/lib/init.hxx index f6ff4bea75f9..614ef404ddd2 100644 --- a/desktop/inc/lib/init.hxx +++ b/desktop/inc/lib/init.hxx @@ -93,7 +93,7 @@ namespace desktop { }; /// One instance of this per view, handles flushing callbacks - class CallbackFlushHandler final : public Idle, public SfxLokCallbackInterface + class SAL_DLLPUBLIC_RTTI CallbackFlushHandler final : public Idle, public SfxLokCallbackInterface { public: DESKTOP_DLLPUBLIC explicit CallbackFlushHandler(LibreOfficeKitDocument* pDocument, LibreOfficeKitCallback pCallback, void* pData); commit 48d400ef4970582fb4c401c63e7afec1b198d6ff Author: Xisco Fauli <[email protected]> AuthorDate: Thu Feb 22 12:09:10 2024 +0100 Commit: Xisco Fauli <[email protected]> CommitDate: Thu Feb 22 15:38:14 2024 +0100 tdf#157158: always paint the arrow black The background doesn't change so do not change the arrow color either Change-Id: I7a5f80e639570e94975b7e033619783d24c95a6f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163737 Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Jenkins Reviewed-by: Xisco Fauli <[email protected]> diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx index 5588b9cc2644..e831ed55f182 100644 --- a/sw/source/uibase/docvw/AnnotationWin2.cxx +++ b/sw/source/uibase/docvw/AnnotationWin2.cxx @@ -505,7 +505,7 @@ void SwAnnotationWin::SetMenuButtonColors() const tools::Long nBorderDistanceBottom = ((aSymbolRect.GetHeight() * 150) + 500) / 1000; aSymbolRect.AdjustBottom( -nBorderDistanceBottom ); DecorationView aDecoView(xVirDev.get()); - aDecoView.DrawSymbol(aSymbolRect, SymbolType::SPIN_DOWN, GetTextColor(), + aDecoView.DrawSymbol(aSymbolRect, SymbolType::SPIN_DOWN, COL_BLACK, DrawSymbolFlags::NONE); mxMenuButton->set_image(xVirDev); mxMenuButton->set_size_request(aSize.Width() + 4, aSize.Height() + 4);
