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.bergmann@allotropia.de>
diff --git a/static/README.wasm.md b/static/README.wasm.md
index 3cfe5f6..69176bb 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 07214c2..6d89f5a 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(); })\n"
                      "        .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); })\n"
                      "        .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 749488c..67c0d2b 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(