Page 1 of 1

Specify names of documents loaded as private:stream?

PostPosted: Tue Jun 03, 2014 11:09 am
by juergenk
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",, 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?


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

PostPosted: Wed Oct 29, 2014 10:19 pm
by kwalcock
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.

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

PostPosted: Thu Oct 30, 2014 3:55 am
by kwalcock
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);

This will get "Title" into some of the dialogs, although not yet into the Properties dialog.