Skip to content

Form Properties

Classes for form properties, “form:properties”, “form:property”, …

Classes:

Name Description
FormListProperty

A container for “form:list-value” elements, “form:list-property”.

FormListValue

Contains value attributes for the value type given in the containing

FormProperties

A container for “form:property” and “form:list-property” elements.

FormProperty

Defines the name, type and value of a property, “form:property”.

FormListProperty

Bases: Element

A container for “form:list-value” elements, “form:list-property”.

The “form:list-property” element is used to represent a property that can have a list of values.

Attributes:

Name Type Description
property_name str

The name of the property.

value_type str

The type of the values in the list (e.g., “boolean”, “currency”, “date”, “float”, “percentage”, “string”, “time”).

Methods:

Name Description
__init__

Create a FormListProperty, “form:list-property”.

Source code in odfdo/form_properties.py
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
class FormListProperty(Element):
    """A container for "form:list-value" elements, "form:list-property".

    The "form:list-property" element is used to represent a property that
    can have a list of values.

    Attributes:
        property_name (str): The name of the property.
        value_type (str): The type of the values in the list (e.g., "boolean",
                          "currency", "date", "float", "percentage", "string",
                          "time").
    """

    _tag = "form:list-property"
    _properties: tuple[PropDef | PropDefBool, ...] = (
        PropDef("property_name", "form:property-name"),
        PropDef("value_type", "office:value-type"),
    )

    def __init__(
        self,
        property_name: str | None = None,
        value_type: str | None = None,
        **kwargs: Any,
    ) -> None:
        """Create a FormListProperty, "form:list-property".

        The "form:list-property" element is usable within the "form:properties"
        element.

        Args:
            property_name: The name of the property.
            value_type: The type of the values in the list.
        """
        super().__init__(**kwargs)
        if self._do_init:
            if property_name is not None:
                self.property_name = property_name
            if value_type is not None:
                self.value_type = value_type

_properties class-attribute instance-attribute

_properties: tuple[PropDef | PropDefBool, ...] = (
    PropDef("property_name", "form:property-name"),
    PropDef("value_type", "office:value-type"),
)

_tag class-attribute instance-attribute

_tag = 'form:list-property'

property_name instance-attribute

property_name = property_name

value_type instance-attribute

value_type = value_type

__init__

__init__(
    property_name: str | None = None,
    value_type: str | None = None,
    **kwargs: Any,
) -> None

Create a FormListProperty, “form:list-property”.

The “form:list-property” element is usable within the “form:properties” element.

Parameters:

Name Type Description Default
property_name str | None

The name of the property.

None
value_type str | None

The type of the values in the list.

None
Source code in odfdo/form_properties.py
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
def __init__(
    self,
    property_name: str | None = None,
    value_type: str | None = None,
    **kwargs: Any,
) -> None:
    """Create a FormListProperty, "form:list-property".

    The "form:list-property" element is usable within the "form:properties"
    element.

    Args:
        property_name: The name of the property.
        value_type: The type of the values in the list.
    """
    super().__init__(**kwargs)
    if self._do_init:
        if property_name is not None:
            self.property_name = property_name
        if value_type is not None:
            self.value_type = value_type

FormListValue

Bases: Element

Contains value attributes for the value type given in the containing “form:list-property” element, “form:list-value”.

The “form:list-value” element represents a single value within a list property of a form.

The type of the value is determined by the “office:value-type” attribute of the parent “form:list-property” element.

Attributes:

Name Type Description
boolean_value bool

The boolean value of the list item.

currency str

The currency unit for the value.

date_value str

The date value of the list item.

string_value str

The string value of the list item.

time_value str

The time value of the list item.

value str

The value of the list item.

Methods:

Name Description
__init__

Create a FormListValue, “form:list-value”.

Source code in odfdo/form_properties.py
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
class FormListValue(Element):
    """Contains value attributes for the value type given in the containing
    "form:list-property" element, "form:list-value".

    The "form:list-value" element represents a single value within a list
    property of a form.

    The type of the value is determined by the "office:value-type" attribute
    of the parent "form:list-property" element.

    Attributes:
        boolean_value (bool): The boolean value of the list item.
        currency (str): The currency unit for the value.
        date_value (str): The date value of the list item.
        string_value (str): The string value of the list item.
        time_value (str): The time value of the list item.
        value (str): The value of the list item.
    """

    _tag = "form:list-value"
    _properties: tuple[PropDef | PropDefBool, ...] = (
        PropDef("boolean_value", "office:boolean-value"),
        PropDef("currency", "office:currency"),
        PropDef("date_value", "office:date-value"),
        PropDef("string_value", "office:string-value"),
        PropDef("time_value", "office:time-value"),
        PropDef("value", "office:value"),
    )

    def __init__(
        self,
        boolean_value: bool | None = None,
        currency: str | None = None,
        date_value: str | None = None,
        string_value: str | None = None,
        time_value: str | None = None,
        value: str | None = None,
        **kwargs: Any,
    ) -> None:
        """Create a FormListValue, "form:list-value".

        The "form:list-value" element is usable within the "form:list-property"
        element.

        Args:
            boolean_value: The boolean value.
            currency: The currency unit.
            date_value: The date value.
            string_value: The string value.
            time_value: The time value.
            value: The numeric or str value.
        """
        super().__init__(**kwargs)
        if self._do_init:
            if boolean_value is not None:
                self.boolean_value = boolean_value
            if currency is not None:
                self.currency = currency
            if date_value is not None:
                self.date_value = date_value
            if string_value is not None:
                self.string_value = string_value
            if time_value is not None:
                self.time_value = time_value
            if value is not None:
                self.value = value

_properties class-attribute instance-attribute

_properties: tuple[PropDef | PropDefBool, ...] = (
    PropDef("boolean_value", "office:boolean-value"),
    PropDef("currency", "office:currency"),
    PropDef("date_value", "office:date-value"),
    PropDef("string_value", "office:string-value"),
    PropDef("time_value", "office:time-value"),
    PropDef("value", "office:value"),
)

_tag class-attribute instance-attribute

_tag = 'form:list-value'

boolean_value instance-attribute

boolean_value = boolean_value

currency instance-attribute

currency = currency

date_value instance-attribute

date_value = date_value

string_value instance-attribute

string_value = string_value

time_value instance-attribute

time_value = time_value

value instance-attribute

value = value

__init__

__init__(
    boolean_value: bool | None = None,
    currency: str | None = None,
    date_value: str | None = None,
    string_value: str | None = None,
    time_value: str | None = None,
    value: str | None = None,
    **kwargs: Any,
) -> None

Create a FormListValue, “form:list-value”.

The “form:list-value” element is usable within the “form:list-property” element.

Parameters:

Name Type Description Default
boolean_value bool | None

The boolean value.

None
currency str | None

The currency unit.

None
date_value str | None

The date value.

None
string_value str | None

The string value.

None
time_value str | None

The time value.

None
value str | None

The numeric or str value.

None
Source code in odfdo/form_properties.py
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
def __init__(
    self,
    boolean_value: bool | None = None,
    currency: str | None = None,
    date_value: str | None = None,
    string_value: str | None = None,
    time_value: str | None = None,
    value: str | None = None,
    **kwargs: Any,
) -> None:
    """Create a FormListValue, "form:list-value".

    The "form:list-value" element is usable within the "form:list-property"
    element.

    Args:
        boolean_value: The boolean value.
        currency: The currency unit.
        date_value: The date value.
        string_value: The string value.
        time_value: The time value.
        value: The numeric or str value.
    """
    super().__init__(**kwargs)
    if self._do_init:
        if boolean_value is not None:
            self.boolean_value = boolean_value
        if currency is not None:
            self.currency = currency
        if date_value is not None:
            self.date_value = date_value
        if string_value is not None:
            self.string_value = string_value
        if time_value is not None:
            self.time_value = time_value
        if value is not None:
            self.value = value

FormProperties

Bases: Element

A container for “form:property” and “form:list-property” elements.

The “form:properties” element has no attributes.

Methods:

Name Description
__init__

Create a FormProperties, “form:properties”.

Source code in odfdo/form_properties.py
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
class FormProperties(Element):
    """A container for "form:property" and "form:list-property" elements.

    The "form:properties" element has no attributes.
    """

    _tag = "form:properties"

    def __init__(self, **kwargs: Any) -> None:
        """Create a FormProperties, "form:properties".

        The "form:properties" element is usable within the following elements:
        "draw:control", "form:button", "form:checkbox", "form:combobox",
        "form:date", "form:file", "form:formatted-text", "form:generic-control",
        "form:grid", "form:hidden", "form:image-frame", "form:listbox",
        "form:number", "form:password", "form:radio", "form:text", "form:textarea",
        "form:time", and "form:value-range".
        """
        super().__init__(**kwargs)

_tag class-attribute instance-attribute

_tag = 'form:properties'

__init__

__init__(**kwargs: Any) -> None

Create a FormProperties, “form:properties”.

The “form:properties” element is usable within the following elements: “draw:control”, “form:button”, “form:checkbox”, “form:combobox”, “form:date”, “form:file”, “form:formatted-text”, “form:generic-control”, “form:grid”, “form:hidden”, “form:image-frame”, “form:listbox”, “form:number”, “form:password”, “form:radio”, “form:text”, “form:textarea”, “form:time”, and “form:value-range”.

Source code in odfdo/form_properties.py
38
39
40
41
42
43
44
45
46
47
48
def __init__(self, **kwargs: Any) -> None:
    """Create a FormProperties, "form:properties".

    The "form:properties" element is usable within the following elements:
    "draw:control", "form:button", "form:checkbox", "form:combobox",
    "form:date", "form:file", "form:formatted-text", "form:generic-control",
    "form:grid", "form:hidden", "form:image-frame", "form:listbox",
    "form:number", "form:password", "form:radio", "form:text", "form:textarea",
    "form:time", and "form:value-range".
    """
    super().__init__(**kwargs)

FormProperty

Bases: Element

Defines the name, type and value of a property, “form:property”.

The “form:property” element specifies a single property within a form.

It can represent various types of data, such as boolean, currency, date, string, time, or a numeric value.

Attributes:

Name Type Description
property_name str

The name of the property.

boolean_value bool

The boolean value of the property.

currency str

The currency unit for the value.

date_value str

The date value of the property.

string_value str

The string value of the property.

time_value str

The time value of the property.

value (Decimal, int, float, None)

The numeric value of the property.

value_type str

The type of the property’s value (e.g., “boolean”, “currency”, “date”, “float”, “percentage”, “string”, “time”).

Methods:

Name Description
__init__

Create a FormProperty, “form:property”.

Source code in odfdo/form_properties.py
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
class FormProperty(Element):
    """Defines the name, type and value of a property, "form:property".

    The "form:property" element specifies a single property within a form.

    It can represent various types of data, such as boolean, currency, date,
    string, time, or a numeric value.

    Attributes:
        property_name (str): The name of the property.
        boolean_value (bool): The boolean value of the property.
        currency (str): The currency unit for the value.
        date_value (str): The date value of the property.
        string_value (str): The string value of the property.
        time_value (str): The time value of the property.
        value (Decimal, int, float, None): The numeric value of the property.
        value_type (str): The type of the property's value (e.g., "boolean",
                          "currency", "date", "float", "percentage", "string", "time").
    """

    _tag = "form:property"
    _properties: tuple[PropDef | PropDefBool, ...] = (
        PropDef("property_name", "form:property-name"),
        PropDef("boolean_value", "office:boolean-value"),
        PropDef("currency", "office:currency"),
        PropDef("date_value", "office:date-value"),
        PropDef("string_value", "office:string-value"),
        PropDef("time_value", "office:time-value"),
        PropDef("value_type", "office:value-type"),
    )

    def __init__(
        self,
        property_name: str | None = None,
        boolean_value: bool | None = None,
        currency: str | None = None,
        date_value: str | None = None,
        string_value: str | None = None,
        time_value: str | None = None,
        value: Decimal | int | float | None = None,
        value_type: str | None = None,
        **kwargs: Any,
    ) -> None:
        """Create a FormProperty, "form:property".

        The "form:property" element is usable within the "form:properties"
        element.

        Args:
            property_name: The name of the property.
            boolean_value: The boolean value.
            currency: The currency unit.
            date_value: The date value.
            string_value: The string value.
            time_value: The time value.
            value: The numeric value.
            value_type: The type of the value.
        """
        super().__init__(**kwargs)
        if self._do_init:
            if property_name is not None:
                self.property_name = property_name
            if boolean_value is not None:
                self.boolean_value = boolean_value
            if currency is not None:
                self.currency = currency
            if date_value is not None:
                self.date_value = date_value
            if string_value is not None:
                self.string_value = string_value
            if time_value is not None:
                self.time_value = time_value
            if value is not None:
                self.value = value
            if value_type is not None:
                self.value_type = value_type

    @property
    def value(self) -> Decimal | int | None:
        return self.get_attribute_number("office:value")

    @value.setter
    def value(self, current_value: Decimal | int | float | None) -> None:
        self._set_attribute_number_default("office:value", current_value, None)

_properties class-attribute instance-attribute

_properties: tuple[PropDef | PropDefBool, ...] = (
    PropDef("property_name", "form:property-name"),
    PropDef("boolean_value", "office:boolean-value"),
    PropDef("currency", "office:currency"),
    PropDef("date_value", "office:date-value"),
    PropDef("string_value", "office:string-value"),
    PropDef("time_value", "office:time-value"),
    PropDef("value_type", "office:value-type"),
)

_tag class-attribute instance-attribute

_tag = 'form:property'

boolean_value instance-attribute

boolean_value = boolean_value

currency instance-attribute

currency = currency

date_value instance-attribute

date_value = date_value

property_name instance-attribute

property_name = property_name

string_value instance-attribute

string_value = string_value

time_value instance-attribute

time_value = time_value

value property writable

value: Decimal | int | None

value_type instance-attribute

value_type = value_type

__init__

__init__(
    property_name: str | None = None,
    boolean_value: bool | None = None,
    currency: str | None = None,
    date_value: str | None = None,
    string_value: str | None = None,
    time_value: str | None = None,
    value: Decimal | int | float | None = None,
    value_type: str | None = None,
    **kwargs: Any,
) -> None

Create a FormProperty, “form:property”.

The “form:property” element is usable within the “form:properties” element.

Parameters:

Name Type Description Default
property_name str | None

The name of the property.

None
boolean_value bool | None

The boolean value.

None
currency str | None

The currency unit.

None
date_value str | None

The date value.

None
string_value str | None

The string value.

None
time_value str | None

The time value.

None
value Decimal | int | float | None

The numeric value.

None
value_type str | None

The type of the value.

None
Source code in odfdo/form_properties.py
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
def __init__(
    self,
    property_name: str | None = None,
    boolean_value: bool | None = None,
    currency: str | None = None,
    date_value: str | None = None,
    string_value: str | None = None,
    time_value: str | None = None,
    value: Decimal | int | float | None = None,
    value_type: str | None = None,
    **kwargs: Any,
) -> None:
    """Create a FormProperty, "form:property".

    The "form:property" element is usable within the "form:properties"
    element.

    Args:
        property_name: The name of the property.
        boolean_value: The boolean value.
        currency: The currency unit.
        date_value: The date value.
        string_value: The string value.
        time_value: The time value.
        value: The numeric value.
        value_type: The type of the value.
    """
    super().__init__(**kwargs)
    if self._do_init:
        if property_name is not None:
            self.property_name = property_name
        if boolean_value is not None:
            self.boolean_value = boolean_value
        if currency is not None:
            self.currency = currency
        if date_value is not None:
            self.date_value = date_value
        if string_value is not None:
            self.string_value = string_value
        if time_value is not None:
            self.time_value = time_value
        if value is not None:
            self.value = value
        if value_type is not None:
            self.value_type = value_type