Package writer2latex.office

# Class ControlReader

java.lang.Object
writer2latex.office.ControlReader

public class ControlReader extends Object

This class reads a form control in an OOo document (a form:control node). A control always has an owner form. Properties and events are ignored.

## Constructor Summary

Constructors
Constructor
Description
`ControlReader(Element control, FormReader ownerForm)`
The constructor reads the content of a control element

## Method Summary

Modifier and Type
Method
Description
`String`
`getAttribute(String sName)`
Get an attribute of the control.
`String`
`getControlType()`
The type of the control is identified by a name, eg. form:submit
`String`
`getId()`
A control in OOo is identified by id (`form:control-id` attribute.
`String`
`getItemAttribute(int nIndex, String sName)`
Get an attribute of an option/item.
`int`
`getItemCount()`
Return the number of options/items in this control.
`String`
`getItemValue(int nIndex)`
Get the value of an option/item.
`FormReader`
`getOwnerForm()`
A control in OOo belongs to a form.
`String`
`getTypeAttribute(String sName)`
Get an attribute specific to this type of control.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### ControlReader

public ControlReader(Element control, FormReader ownerForm)

The constructor reads the content of a control element

The representation in OpenDocument differs slightly from OOo 1.x.

Parameters:
  `control` - a DOM element, which must be control node

## Method Details

### getId

public String getId()

A control in OOo is identified by id (`form:control-id` attribute. The id is accessed by this method.

Returns:
  the id of the control

### getOwnerForm

public FormReader getOwnerForm()

A control in OOo belongs to a form.

Returns:
  the form containing this control

### getAttribute

public String getAttribute(String sName)

Get an attribute of the control. If the attribute does not exist, this method returns `null`.

Parameters:
  `sName` - the name of the attribute
Returns:
  the value of the attribute, or `null`

### getControlType

public String getControlType()

The type of the control is identified by a name, eg. form:submit

Returns:
  the type of this control

### getTypeAttribute

public String getTypeAttribute(String sName)

Get an attribute specific to this type of control. If the attribute does not exist, this method returns `null`.

Parameters:
  `sName` - the name of the attribute
Returns:
  the value of the attribute, or `null`

### getItemCount

public int getItemCount()

Return the number of options/items in this control. Only listbox (options) and combobox (items) controls can have these, for other controls this will return 0.

Returns:
  the number of options/items

### getItemAttribute

public String getItemAttribute(int nIndex, String sName)

Get an attribute of an option/item. If the index and/or the attribute does not exist, this method returns `null`.

Parameters:
  `nIndex` - the index of the option/item
  `sName` - the name of the attribute
Returns:
  the value of the attribute, or `null`

### getItemValue

public String getItemValue(int nIndex)

Get the value of an option/item. If the index does not exist, this method returns `null`.

Parameters:
  `nIndex` - the index of the option/item
Returns:
  the value of the option/item, or `null`