ooodev.adapter.reflection.enum_type_description_comp module
- class ooodev.adapter.reflection.enum_type_description_comp.EnumTypeDescriptionComp(component)[source]
Bases:
ComponentProp
,EnumTypeDescriptionPartial
Class for managing XEnumTypeDescription.
- Parameters:
component (XEnumTypeDescription) –
- __init__(component)[source]
Constructor
- Parameters:
component (XEnumTypeDescription) – UNO Component that implements
com.sun.star.reflection.XEnumTypeDescription
interface.- Return type:
None
- create_dynamic_enum(name)[source]
Returns a dynamic python enum from the current enum names and values.
- Parameters:
name (str) – The name of the dynamic enum.
- Returns:
The dynamic python enum.
- Return type:
Enum
Example
This example is when the enum is info is for
com.sun.star.awt.FontSlant
. Any valid code name can be used for the dynamic enum.>>> my_enum = info.create_dynamic_enum("com.sun.star.awt.FontSlant") >>> print(my_enum) <enum 'com.sun.star.awt.FontSlant'> >>> for e in my_enum: ... print(e.name, e.value) NONE NONE OBLIQUE OBLIQUE ITALIC ITALIC DONTKNOW DONTKNOW REVERSE_OBLIQUE REVERSE_OBLIQUE REVERSE_ITALIC REVERSE_ITALIC
- create_dynamic_name_value_enum(name)[source]
Returns a dynamic python enum from the current enum names and values.
- Parameters:
name (str) – The name of the dynamic enum.
- Returns:
The dynamic python enum.
- Return type:
Enum
Example
This example is when the enum is info is for
com.sun.star.awt.FontSlant
. Any valid code name can be used for the dynamic enum.>>> my_enum = info.create_dynamic_enum("com.sun.star.awt.FontSlant") >>> print(my_enum) <enum 'com.sun.star.awt.FontSlant'> >>> for e in my_enum: ... print(e.name, e.value) NONE 0 OBLIQUE 1 ITALIC 2 DONTKNOW 3 REVERSE_OBLIQUE 4 REVERSE_ITALIC 5
- get_name_from_value(value)[source]
Returns the enum member name from the value.
- Parameters:
value (int) – The enum member value.
- Returns:
The enum member name, or an empty string if not found.
- Return type:
str
- get_name_value_dict()[source]
Returns the enum member names and values as a dictionary.
- Return type:
dict[str, int]
- get_value_name_dict()[source]
Returns the enum member values and names as a dictionary.
- Return type:
dict[int, str]
- property component: com.sun.star.reflection.XEnumTypeDescription
XEnumTypeDescription Component
- Return type:
XEnumTypeDescription