Mathias Bauer ha scritto:
> news.gmane.org wrote:
>
>> XModel oModel =
>>
(XModel)UnoRuntime.queryInterface(XModel.class,oEvent.Source
);
>> if (oModel!=null) {
>> System.out.println("Document URL is: "
+ oModel.getURL());
>> }
>> }
>
> You should be aware that getURL() will return an empty
string if the
> document is an untitled one and as you can have more
than of untitled
> document it doesn't qualify as an identifier.
>
> You could use the document (reference) itself as a
unique identifier.
> You then must register as a listener so you get a
notification when the
> document is disposed so that you can release your
reference.
The problem is: how do I get the document refernce from the
EventObject?
I've tried this:
OfficeDocument oDocument =
(OfficeDocument)UnoRuntime.queryInterface(OfficeDocument.cla
ss,oEvent.Source);
but I'm getting a ClassCastException.
And what about releasing the reference? Do you mean the
document
reference passed to the listener when constructing it?
Thank you
------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribe api.openoffice.org
For additional commands, e-mail: dev-help api.openoffice.org
|