diff options
author | Stephan Bergmann <stephan.bergmann@allotropia.de> | 2024-03-07 17:10:25 +0100 |
---|---|---|
committer | Stephan Bergmann <stephan.bergmann@allotropia.de> | 2024-03-07 23:13:31 +0100 |
commit | da49e5edb2fba9e99ed7d58952dc761b0804e7fc (patch) | |
tree | 9deb1e34a60a999196dff43ff6a71b6a43cea03b /unotest | |
parent | dbb05dc818afb08b3e05ac62bd92389a5cf90fa7 (diff) |
Add Embind'ing of UNO Any getter for interfaces
Change-Id: Ia56439e0e99c193c7cc56676677df2c671278e24
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164554
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
Diffstat (limited to 'unotest')
-rw-r--r-- | unotest/source/embindtest/embindtest.cxx | 14 | ||||
-rw-r--r-- | unotest/source/embindtest/embindtest.js | 10 |
2 files changed, 24 insertions, 0 deletions
diff --git a/unotest/source/embindtest/embindtest.cxx b/unotest/source/embindtest/embindtest.cxx index 1f8b916fbbf1..d437f3907e3a 100644 --- a/unotest/source/embindtest/embindtest.cxx +++ b/unotest/source/embindtest/embindtest.cxx @@ -10,6 +10,7 @@ #include <sal/config.h> #include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/uno/Type.hxx> #include <cppu/unotype.hxx> @@ -283,6 +284,19 @@ class Test : public cppu::WeakImplHelper<org::libreoffice::embindtest::XTest> && e.m3 == u"hä"; } + css::uno::Any SAL_CALL getAnyInterface() override + { + return css::uno::Any(css::uno::Reference<org::libreoffice::embindtest::XTest>(this)); + } + + sal_Bool SAL_CALL isAnyInterface(css::uno::Any const& value) override + { + return value.getValueType() == cppu::UnoType<org::libreoffice::embindtest::XTest>::get() + && *o3tl::forceAccess<css::uno::Reference<org::libreoffice::embindtest::XTest>>( + value) + == static_cast<OWeakObject*>(this); + } + css::uno::Sequence<sal_Bool> SAL_CALL getSequenceBoolean() override { return { true, true, false }; diff --git a/unotest/source/embindtest/embindtest.js b/unotest/source/embindtest/embindtest.js index c661589683f6..e238af32c003 100644 --- a/unotest/source/embindtest/embindtest.js +++ b/unotest/source/embindtest/embindtest.js @@ -303,6 +303,16 @@ Module.addOnPostRun(function() { //TODO: a.delete(); } { + let v = test.getAnyInterface(); + console.log(v); + console.assert(v.get().$equals(test.$query())); + console.assert(test.isAnyInterface(v)); + v.delete(); + //TODO: let a = new Module.Any(test, css.uno.TypeClass.INTERFACE); + //TODO: console.assert(test.isAnyInterface(a)); + //TODO: a.delete(); + } + { let v = test.getSequenceBoolean(); console.log(v); console.assert(v.size() === 3); |