static/README.wasm.md                     |   10 +++++-----
 static/source/embindmaker/embindmaker.cxx |    5 -----
 unotest/source/embindtest/embindtest.js   |    2 +-
 3 files changed, 6 insertions(+), 11 deletions(-)

New commits:
commit 0957ee9f5d379c80fca4027c187b471118d0490d
Author:     Stephan Bergmann <stephan.bergm...@allotropia.de>
AuthorDate: Tue Apr 16 10:17:08 2024 +0200
Commit:     Stephan Bergmann <stephan.bergm...@allotropia.de>
CommitDate: Tue Apr 16 20:35:22 2024 +0200

    Embind: No need for $query
    
    ...to "upcast" from css::uno::Reference<T> to base
    css::uno::Reference<css::uno::XInterface>.  My understanding now is that 
due to
    the sharing_policy::INTRUSIVE we specify for
    emscripten::smart_ptr_trait<css::uno::Reference<T>>
    (include/static/unoembindhelpers/PrimaryBindings.hxx), Embind can internally
    "upcast" from a css::uno::Reference<T> to a base
    css::uno::Reference<css::uno::XInterface> by just treating the encapsulated 
raw
    pointer of type T* as a raw pointer of type css::uno::XInterface* (see the 
use
    of that sharingPolicy in genericPointerToWireType in Emscripten's
    src/embind/embind.js; though documentation of that Embind sharing_policy is
    rather poor).
    
    Change-Id: I6ed60a9c94af6aba6fc6119bf644da7f507a997f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166142
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <stephan.bergm...@allotropia.de>

diff --git a/static/README.wasm.md b/static/README.wasm.md
index 3cfe5f6c33c9..69176bb8acbc 100644
--- a/static/README.wasm.md
+++ b/static/README.wasm.md
@@ -228,11 +228,11 @@ Some usage examples through javascript of the current 
implementation:
 let uno = init_unoembind_uno(Module);
 let css = uno.com.sun.star;
 xModel = Module.getCurrentModelFromViewSh();
-xTextDocument = new css.text.XTextDocument(xModel.$query());
+xTextDocument = new css.text.XTextDocument(xModel);
 xText = xTextDocument.getText();
-xSimpleText = new css.text.XSimpleText(xText.$query());
+xSimpleText = new css.text.XSimpleText(xText);
 xTextCursor = xSimpleText.createTextCursor();
-xTextRange = new css.text.XTextRange(xTextCursor.$query());
+xTextRange = new css.text.XTextRange(xTextCursor);
 xTextRange.setString("string here!");
 xModel.delete(); xTextDocument.delete(); xText.delete(); xSimpleText.delete(); 
xTextCursor.delete(); xTextRange.delete();
 ```
@@ -242,13 +242,13 @@ xModel.delete(); xTextDocument.delete(); xText.delete(); 
xSimpleText.delete(); x
 let uno = init_unoembind_uno(Module);
 let css = uno.com.sun.star;
 xModel = Module.getCurrentModelFromViewSh();
-xEnumAccess = new css.container.XEnumerationAccess(xText.$query());
+xEnumAccess = new css.container.XEnumerationAccess(xText);
 xParaEnumeration = xEnumAccess.createEnumeration();
 
 while (xParaEnumeration.hasMoreElements()) {
     xParagraph = new css.text.XTextRange(xParaEnumeration.nextElement(), 
Module.uno_Reference.FromAny);
     if (xParagraph.$is()) {
-        xParaProps = new css.beans.XPropertySet(xParagraph.$query());
+        xParaProps = new css.beans.XPropertySet(xParagraph);
         let color = new Module.uno_Any(
             Module.uno_Type.Long(), Math.floor(Math.random() * 0xFFFFFF));
         xParaProps.setPropertyValue("CharColor", color);
diff --git a/static/source/embindmaker/embindmaker.cxx 
b/static/source/embindmaker/embindmaker.cxx
index 07214c289681..6d89f5a5ab10 100644
--- a/static/source/embindmaker/embindmaker.cxx
+++ b/static/source/embindmaker/embindmaker.cxx
@@ -1096,11 +1096,6 @@ SAL_IMPLEMENT_MAIN()
                       "        .function(\"$is\", 
+[](::com::sun::star::uno::Reference<"
                    << cppName(ifc)
                    << "> const & the_self) { return the_self.is(); })
"
-                      "        .function(\"$query\", 
+[](::com::sun::star::uno::Reference<"
-                   << cppName(ifc)
-                   << "> const & the_self) { return "
-                      
"::com::sun::star::uno::Reference<::com::sun::star::uno::XInterface>(the_"
-                      "self); })
"
                       "        .function(\"$equals\", 
+[](::com::sun::star::uno::Reference<"
                    << cppName(ifc)
                    << "> const & the_self, "
diff --git a/unotest/source/embindtest/embindtest.js 
b/unotest/source/embindtest/embindtest.js
index 749488cfa567..67c0d2b77c13 100644
--- a/unotest/source/embindtest/embindtest.js
+++ b/unotest/source/embindtest/embindtest.js
@@ -308,7 +308,7 @@ Module.addOnPostRun(function() {
     {
         let v = test.getAnyInterface();
         console.log(v);
-        console.assert(v.get().$equals(test.$query()));
+        console.assert(v.get().$equals(test));
         console.assert(test.isAnyInterface(v));
         v.delete();
         let a = new Module.uno_Any(

Reply via email to