Hi Christian,

yes, you're right. It works okay in 680m79. IIRC I experienced the problem I mentioned with an early OOo2 milestone. Strange.

 Sorry,
Kai.

Christian Junker wrote:

Hi Kai,
I tested this SB script...
<code>
Sub Main
odoc = thisComponent
odoc.storeAsURL("file:///C:/file1.sxw", Array())
msgbox odoc.getURL()
odoc.storeAsURL("file:///C:/file2.sxw", Array())
msgbox odoc.getURL()
End Sub
</code>

and it does return the correct filenames.

On Fri, 11 Mar 2005 16:44:13 +0100, Kai Sommerfeld
<[EMAIL PROTECTED]> wrote:

Hi,

 just a comment based on my personal experience with
css.frame.XModel.getURL() implementation:

 The returned URL gets not updated after storing the document to a
different name/location. I was told that it is best to use
css.frame.XStorable.getLocation() in order to obtain the document's URL.
XStorable is implemented by every OOo doc instance.

 Maybe somebody from the Framework team can comment on this.

- Kai.

Christian Junker wrote:

Hi Tom, you don't need the line:
XPropertySet documentProps = (XPropertySet)
UnoRuntime.queryInterface(XPropertySet.class, document);

Thus the import of XPropertySet can be omitted, too.

On Fri, 11 Mar 2005 13:27:44 +0100, Tom Schindl <[EMAIL PROTECTED]> wrote:


Ines Pfauch wrote:


On 11.03.2005, at 11:10, Tom Schindl wrote:



It would be great if you would summerize this small thread which
showed us not to use the MediaDescriptor.html#URL to retrieve the URL
form a document but instead the XModel in a small and tiny codesnippet.

It's worth the time you saved by people helping to your solve problem ;-)


OK. That is no problem. And thanks again for the help! :)
Here is the codesnippet for getting the url of a current opened document:

<-- snip -->
// XMultiComponentFactory xmcf = ...
// XComponentContext ctx = ...
Object desktop =
xmcf.createInstanceWithContext("com.sun.star.frame.Desktop", ctx);
XDesktop xDesktop =
(XDesktop)UnoRuntime.queryInterface(com.sun.star.frame.XDesktop.class,
desktop);
XComponent document = xDesktop.getCurrentComponent();
XPropertySet documentProps =
(XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,document);
XModel xmodel = (XModel)UnoRuntime.queryInterface(XModel.class,document);
if (xmodel != null) String url = xmodel.getURL();
<-- snap -->

I meant something like this :-)
http://codesnippets.services.openoffice.org/Office/Office.GetDocumentURL.snip





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



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





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







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



Reply via email to