Specify names of documents loaded as private:stream?

The Application Programming Interface and the OASIS Open Document Format

Specify names of documents loaded as private:stream?

Postby juergenk » Tue Jun 03, 2014 11:09 am

I load documents from streams using the URL "private:stream":

Code: Select all   Expand viewCollapse view
XComponentLoader xLoader = ...;
byte[] bytes = ...;
ByteArrayToXInputStreamAdapter batxisa = new ByteArrayToXInputStreamAdapter(bytes);
PropertyValue[] properties = new PropertyValue[2];
properties[0] = new PropertyValue();
properties[0].Name = "InputStream";
properties[0].Value = batxisa;
      
properties[1] = new PropertyValue();
properties[1].Name = "FilterName";
properties[1].Value = "writer8";
xComponent = xLoader.loadComponentFromURL("private:stream", "some XFrame name", com.sun.star.frame.FrameSearchFlag.CHILDREN, someProperties);
...


Unfortuanately, these documents are not represented with sensible 'names' in the GUI.
In File -> Recent Documents they are shown as 'private:' and in the Windows menu an empty row is shown.

Is it possible to specify a more meaningful name for the document, e.g. in analogy to documents loaded from the file system?

Thanks
LibreOffice 4.1, Windows 8.1
juergenk
 
Posts: 1
Joined: Tue Jun 03, 2014 10:53 am

Re: Specify names of documents loaded as private:stream?

Postby kwalcock » Wed Oct 29, 2014 10:19 pm

If you figured this out, please share your wisdom. I'm trying to do the same thing with loadComponentFromURL and private:factory/swriter to get an empty document that I would like to name in advance. I've tried adding properties of "DocumentTitle", "FileName", and "URL" before the load as well as adding to the URL and setting the Name of the frame and title of the window. Whatever I do, various parts of the UI display "Untitled" or "Untitled2" or "Untitled 2" for the properties or when I try to close with unsaved modifications. I can't figure out where these are coming from and how to automatically set them to my name in advance.
Apache OpenOffice 4.0.1
Windows, Linux, MacOS
kwalcock
 
Posts: 24
Joined: Thu Oct 09, 2014 11:54 am

Re: Specify names of documents loaded as private:stream?

Postby kwalcock » Thu Oct 30, 2014 3:55 am

If loadFromURL returns Reference<XComponent> xComponent,

then in C++ do this to it:

Reference<XModel> xModel(xComponent, UNO_QUERY);
Reference<XTitle> xTitle(xModel, UNO_QUERY);
xTitle->setTitle(constOUString("Title"));

This will get "Title" into some of the dialogs, although not yet into the Properties dialog.
Apache OpenOffice 4.0.1
Windows, Linux, MacOS
kwalcock
 
Posts: 24
Joined: Thu Oct 09, 2014 11:54 am


Return to UNO API and ODF

Who is online

Users browsing this forum: No registered users and 1 guest