Kohei Yoshida wrote:
> Hi all,
> 
> I am developing a UNO component which needs to store its state, such
> as the values of input fields, radio boxes, list boxes etc. into a
> current document so that it can be saved with that file, and carried
> with that file.  My question is, is there an elegant way of doing it?
> 
> What I have in mind are:
> 
> 1) Put the values into some type of a XML structure, and inject it
> into the zipped file structure (if that's even possible).

You can add a subfolder to the documents' package and (important!) add a
MediaType to it (details can follow if you like this way). Then you can
put any content you like into this subfolder (text or binary streams,
other subfolders etc.). OOo then will preserve the complete subfolder on
every saving of the document.

Let me repeat that the preserving only works when a MediaType is set.
The MediaType string should follow the usual namespace conventions OOo
uses for other custom items like Interfaces, Service Names etc.

> 3) Put them into the document itself as a content.

You can assign document metadata to a document that OOo stores for you
along with the document (it will end in the meta.xml stream). This works
pretty well with OOo2.0. It only any allows to use data of any basic
type (integer, float, string etc.) and sequences of them, but I assume
that this will be enough for you.

The data can be inserted through a PropertyContainer interface of the
DocumentInfo object of a document and it can be read and written as the
"regular" MetaData through the PropertySet interface of the same object.

The tricky part will be that you must chose unique names for your new
"properties". Here again the usual name space magic is recommended.

Best regards,
Mathias

-- 
Mathias Bauer - OpenOffice.org Application Framework Project Lead
Please reply to the list only, [EMAIL PROTECTED] is a spam sink.


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

Reply via email to