Hi Florian,

> I'm trying to find a way to uniquely identify form controls in a
> document. OpenDocument has the XML attribute form:id for form controls,
> but this doesn't seem to be accessible through the API.
> It might be possible to use the index of XIndexAccess, but I guess then
> I would run into trouble if another control is inserted in the document
> afterwards.
> 
> Is there any way to get a unique identifier for a form control?

Depends on whether your form is designed for uniqueness :)

In general, there's no such thing as a unique identifier. However, form
components are organized in a name hierarchy. That is, the forms
collection in a document is an XNameContainer, providing access to the
top level logical forms by name. Those forms themself support
XNameContainer, too, again providing named access to their child elements.

So, if you design your form that all elements in a given hierarchy level
(look into the form navigator for this) have a unique name, then
"name_on_level_1/name_on_level_2/..." is some kind of unique identifier.

(Unfortunately, form components do not support XHierachicalNameAccess,
which would ease using such an identifier. ATM, you have to manually
split it.)

Of course, this "identifier" does not work anymore if you move a
component into another container (say, another logical form), or rename
it. In this sense, it's not really an identifier - but it should be
sufficient for most cases.

Ciao
Frank

-- 
- Frank Schönheit, Software Engineer         [EMAIL PROTECTED] -
- Sun Microsystems                      http://www.sun.com/staroffice -
- OpenOffice.org Database                   http://dba.openoffice.org -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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

Reply via email to