Ines Pfauch wrote:
On 09.03.2005, at 13:20, Aidan Butler wrote:

[...]
desktop = ctx.ServiceManager.createInstanceWithContext( \
           "com.sun.star.frame.Desktop", ctx )
document = desktop.getCurrentComponent()
print document.URL
Alternatively a document.getPropertyValue("URL") should do the trick


Maybe I so something wrong but this does not work, when I try to convert it to java.

I can understand the whole thing unto here:

// XComponentContext ctx ...
// XMultiComponentFactory f ...
XDesktop desktop = (XDesktop)f.createInstanceWithContext("com.sun.star.frame.Desktop", ctx);
XComponent document = (XComponent)desktop.getCurrentComponent();


But a document.getPropertyValue("URL") method does not exist.
Please help me.

the "Component"-Service implements the Interface "XPropertySet". To access the property "URL" use (add) the following lines:


XPropertySet documentProps = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, document);
String url = (String) documentProps.getPropertyValue("URL");


(not tested...)


http://api.openoffice.org/docs/DevelopersGuide/FirstSteps/FirstSteps.htm provides more information about this concept...

regards,
Christoph Lutz

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to