bridges/source/cpp_uno/gcc3_wasm/uno2cpp.cxx |   18 +++++++++++++++++-
 offapi/org/libreoffice/embindtest/XTest.idl  |    1 +
 unotest/source/embindtest/embindtest.cxx     |    6 ++++++
 unotest/source/embindtest/embindtest.js      |    8 ++++++++
 4 files changed, 32 insertions(+), 1 deletion(-)

New commits:
commit e303b3bba8caaefd3a7897a773deb69643967047
Author:     Stephan Bergmann <stephan.bergm...@allotropia.de>
AuthorDate: Wed May 29 17:36:55 2024 +0200
Commit:     Stephan Bergmann <stephan.bergm...@allotropia.de>
CommitDate: Thu May 30 09:35:06 2024 +0200

    Implement attribute handling
    
    Change-Id: Ic30d2de582f952555ec672984da78a07a9319443
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168224
    Reviewed-by: Stephan Bergmann <stephan.bergm...@allotropia.de>
    Tested-by: Jenkins

diff --git a/bridges/source/cpp_uno/gcc3_wasm/uno2cpp.cxx 
b/bridges/source/cpp_uno/gcc3_wasm/uno2cpp.cxx
index 4b4cdb2bbadb..fcc978ab672e 100644
--- a/bridges/source/cpp_uno/gcc3_wasm/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_wasm/uno2cpp.cxx
@@ -18,7 +18,9 @@
 #include <com/sun/star/uno/Exception.hpp>
 #include <com/sun/star/uno/RuntimeException.hpp>
 #include <com/sun/star/uno/genfunc.hxx>
+#include <cppu/unotype.hxx>
 #include <o3tl/runtimetooustring.hxx>
+#include <o3tl/temporary.hxx>
 #include <o3tl/unreachable.hxx>
 #include <rtl/strbuf.hxx>
 #include <typelib/typeclass.h>
@@ -324,7 +326,21 @@ void unoInterfaceProxyDispatch(uno_Interface* pUnoI, const 
typelib_TypeDescripti
     {
         case typelib_TypeClass_INTERFACE_ATTRIBUTE:
         {
-            std::abort();
+            auto const atd
+                = reinterpret_cast<typelib_InterfaceAttributeTypeDescription 
const*>(pMemberDescr);
+            VtableSlot slot(getVtableSlot(atd));
+            if (pReturn == nullptr)
+            {
+                slot.index += 1;
+                call(pThis, slot, cppu::UnoType<void>::get().getTypeLibType(), 
1,
+                     &o3tl::temporary(
+                         typelib_MethodParameter{ nullptr, 
atd->pAttributeTypeRef, true, false }),
+                     pReturn, pArgs, ppException);
+            }
+            else
+            {
+                call(pThis, slot, atd->pAttributeTypeRef, 0, nullptr, pReturn, 
pArgs, ppException);
+            }
             break;
         }
         case typelib_TypeClass_INTERFACE_METHOD:
diff --git a/offapi/org/libreoffice/embindtest/XTest.idl 
b/offapi/org/libreoffice/embindtest/XTest.idl
index ac8549d05397..1f09c388e30a 100644
--- a/offapi/org/libreoffice/embindtest/XTest.idl
+++ b/offapi/org/libreoffice/embindtest/XTest.idl
@@ -129,6 +129,7 @@ interface XTest {
     void passJob([in] com::sun::star::task::XJob object);
     void passJobExecutor([in] com::sun::star::task::XJobExecutor object);
     void passInterface([in] com::sun::star::uno::XInterface object);
+    [attribute] string StringAttribute;
 };
 
 }; }; };
diff --git a/unotest/source/embindtest/embindtest.cxx 
b/unotest/source/embindtest/embindtest.cxx
index 7b65ed3ed776..929db82e8900 100644
--- a/unotest/source/embindtest/embindtest.cxx
+++ b/unotest/source/embindtest/embindtest.cxx
@@ -594,6 +594,12 @@ class Test : public 
cppu::WeakImplHelper<org::libreoffice::embindtest::XTest>
         css::uno::Reference<css::task::XJobExecutor>(object, 
css::uno::UNO_QUERY_THROW)
             ->trigger(u"queried executor"_ustr);
     }
+
+    OUString SAL_CALL getStringAttribute() override { return stringAttribute_; 
}
+
+    void SAL_CALL setStringAttribute(OUString const& value) override { 
stringAttribute_ = value; }
+
+    OUString stringAttribute_;
 };
 }
 
diff --git a/unotest/source/embindtest/embindtest.js 
b/unotest/source/embindtest/embindtest.js
index a98f828d9eba..c1670689cf2b 100644
--- a/unotest/source/embindtest/embindtest.js
+++ b/unotest/source/embindtest/embindtest.js
@@ -1113,6 +1113,14 @@ Module.addOnPostRun(function() {
         outparamindex.delete();
         outparam.delete();
     }
+    {
+        let a = new Module.uno_Any(Module.uno_Type.String(), 'hä');
+        invoke.setValue('StringAttribute', a);
+        a.delete();
+        const ret = invoke.getValue('StringAttribute');
+        console.assert(ret.get() === 'hä');
+        ret.delete();
+    }
 });
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */

Reply via email to