diff options
-rw-r--r-- | static/emscripten/uno.js | 17 | ||||
-rw-r--r-- | static/source/embindmaker/embindmaker.cxx | 32 | ||||
-rw-r--r-- | unotest/source/embindtest/embindtest.js | 13 |
3 files changed, 47 insertions, 15 deletions
diff --git a/static/emscripten/uno.js b/static/emscripten/uno.js index fd3b77192d03..2398dee76da7 100644 --- a/static/emscripten/uno.js +++ b/static/emscripten/uno.js @@ -17,11 +17,6 @@ Module.unoObject = function(interfaces, obj) { Module.initUno(); interfaces = ['com.sun.star.lang.XTypeProvider'].concat(interfaces); obj.impl_refcount = 0; - obj.impl_types = new Module.uno_Sequence_type(interfaces.length, Module.uno_Sequence.FromSize); - for (let i = 0; i !== interfaces.length; ++i) { - obj.impl_types.set(i, Module.uno_Type.Interface(interfaces[i])); - } - obj.impl_implementationId = new Module.uno_Sequence_byte([]); obj.queryInterface = function(type) { for (const i in obj.impl_typemap) { if (i === type.toString()) { @@ -39,12 +34,16 @@ Module.unoObject = function(interfaces, obj) { for (const i in obj.impl_interfaces) { obj.impl_interfaces[i].delete(); } - obj.impl_types.delete(); - obj.impl_implementationId.delete(); } }; - obj.getTypes = function() { return obj.impl_types; }; - obj.getImplementationId = function() { return obj.impl_implementationId; }; + obj.getTypes = function() { + const types = new Module.uno_Sequence_type(interfaces.length, Module.uno_Sequence.FromSize); + for (let i = 0; i !== interfaces.length; ++i) { + types.set(i, Module.uno_Type.Interface(interfaces[i])); + } + return types; + }; + obj.getImplementationId = function() { return new Module.uno_Sequence_byte([]) }; obj.impl_interfaces = {}; interfaces.forEach((i) => { obj.impl_interfaces[i] = Module['uno_Type_' + i.replace(/\./g, '$')].implement(obj); diff --git a/static/source/embindmaker/embindmaker.cxx b/static/source/embindmaker/embindmaker.cxx index b8184a03e0a9..c40b8db6fa24 100644 --- a/static/source/embindmaker/embindmaker.cxx +++ b/static/source/embindmaker/embindmaker.cxx @@ -795,14 +795,34 @@ void dumpWrapperClassMembers(std::ostream& out, rtl::Reference<TypeManager> cons } out << " " << param.name; } - out << ") override { return call<"; - dumpType(out, manager, meth.returnType); - out << ">(\"" << meth.name << "\""; - for (auto const& param : meth.parameters) + out << ") override {"; + if (meth.returnType == "any" || meth.returnType.startsWith("[]")) { - out << ", " << param.name; + out << "\n" + " auto & the_ptr = call<"; + dumpType(out, manager, meth.returnType); + out << " const &>(\"" << meth.name << "\""; + for (auto const& param : meth.parameters) + { + out << ", " << param.name; + } + out << ");\n" + " auto const the_copy(the_ptr);\n" + " delete &the_ptr;\n" + " return the_copy;\n" + " }\n"; + } + else + { + out << " return call<"; + dumpType(out, manager, meth.returnType); + out << ">(\"" << meth.name << "\""; + for (auto const& param : meth.parameters) + { + out << ", " << param.name; + } + out << "); }\n"; } - out << "); }\n"; } } diff --git a/unotest/source/embindtest/embindtest.js b/unotest/source/embindtest/embindtest.js index 37a83fba9f4e..355463844da8 100644 --- a/unotest/source/embindtest/embindtest.js +++ b/unotest/source/embindtest/embindtest.js @@ -658,6 +658,19 @@ Module.addOnPostRun(function() { }, trigger(event) { console.log('Ola ' + event); } }); + { + const s = css.lang.XTypeProvider.query(obj).getTypes(); + console.assert(s.size() === 3); + console.assert(s.get(0).toString() === 'com.sun.star.lang.XTypeProvider'); + console.assert(s.get(1).toString() === 'com.sun.star.task.XJob'); + console.assert(s.get(2).toString() === 'com.sun.star.task.XJobExecutor'); + s.delete(); + } + { + const s = css.lang.XTypeProvider.query(obj).getImplementationId(); + console.assert(s.size() === 0); + s.delete(); + } test.passJob(css.task.XJob.query(obj)); test.passJobExecutor(css.task.XJobExecutor.query(obj)); test.passInterface(obj); |