0
:反射返回com.sun.star.uno.XInterface類型的<code>getType</code>方法應該返回其表示傳遞到方法的項的類型的對象中的所有對象
var serviceManager = new ActiveXObject('com.sun.star.ServiceManager');
var desktop = serviceManager.createInstance("com.sun.star.frame.Desktop");
var document = desktop.loadComponentFromURL("private:factory/swriter", "_blank", 0, []);
var coreReflection = serviceManager.createInstance("com.sun.star.reflection.CoreReflection");
// should return a type representing the com.sun.star.frame.Desktop type
var classInfo = coreReflection.getType(desktop);
然而,classInfo
似乎總是包含com.sun.star.uno.XInterface
類型:
// outputs com.sun.star.uno.XInterface
WScript.Echo(classInfo.getName());
即使我通過在其他物體,輸出是一樣的:
classInfo = coreReflection.getType(document);
WScript.Echo(classInfo.getName());
如何找出實際類型?
(最初發佈於ask.libreoffice)
這些問題在LibreOffice開發人員郵件列表中最有可能是最好的問題。最有可能的唯一能回答這樣的問題並就如何實施一個好的uno橋樑提供建議的人是Stephan Bergmann,他是一名付費的LibreOffice開發人員。 – moggi
@moggi我還沒有興趣實施一個uno橋;我有興趣使用[現有的自動化橋樑](https://wiki.openoffice.org/wiki/Documentation/DevGuide/ProUNO/Bridge/Automation_Bridge);但非常感謝。 –
即使在這種情況下,Stephan和郵件列表可能是最好的方法。例如。 com.sun.star.frame.Desktop是一種服務,而不是一種類型,但只有Stephan或可能Michael會知道爲什麼getType返回XInterface而不是其他接口之一的細節。 – moggi