from __future__ import annotations
from typing import Any, TYPE_CHECKING
from com.sun.star.awt import XCurrencyField
from ooodev.exceptions import ex as mEx
from ooodev.loader import lo as mLo
if TYPE_CHECKING:
from ooodev.utils.type_var import UnoInterface
[docs]class CurrencyFieldPartial:
"""
Partial class for XCurrencyField.
"""
[docs] def __init__(self, component: XCurrencyField, interface: UnoInterface | None = XCurrencyField) -> None:
"""
Constructor
Args:
component (XCurrencyField): UNO Component that implements ``com.sun.star.awt.XCurrencyField`` interface.
interface (UnoInterface, optional): The interface to be validated. Defaults to ``XCurrencyField``.
"""
def validate(comp: Any, obj_type: Any) -> None:
if obj_type is None:
return
if not mLo.Lo.is_uno_interfaces(comp, obj_type):
raise mEx.MissingInterfaceError(obj_type)
validate(component, interface)
self.__component = component
# region XCurrencyField
[docs] def get_decimal_digits(self) -> int:
"""
Gets the currently set number of decimals.
"""
return self.__component.getDecimalDigits()
[docs] def get_first(self) -> float:
"""
Gets the currently set first value which is set on POS1 key.
"""
return self.__component.getFirst()
[docs] def get_last(self) -> float:
"""
Gets the currently set last value which is set on END key.
"""
return self.__component.getLast()
[docs] def get_max(self) -> float:
"""
Gets the currently set maximum value that can be entered by the user.
"""
return self.__component.getMax()
[docs] def get_min(self) -> float:
"""
Gets the currently set minimum value that can be entered by the user.
"""
return self.__component.getMin()
[docs] def get_spin_size(self) -> float:
"""
Gets the currently set increment value for the spin button.
"""
return self.__component.getSpinSize()
[docs] def get_value(self) -> float:
"""
Gets the value which is currently displayed in the currency field.
"""
return self.__component.getValue()
[docs] def set_decimal_digits(self, digits: int) -> None:
"""
Sets the number of decimals.
"""
self.__component.setDecimalDigits(digits)
[docs] def set_first(self, value: float) -> None:
"""
sets the first value to be set on POS1 key.
"""
self.__component.setFirst(value)
[docs] def set_last(self, value: float) -> None:
"""
Sets the last value to be set on END key.
"""
self.__component.setLast(value)
[docs] def set_max(self, value: float) -> None:
"""
Sets the maximum value that can be entered by the user.
"""
self.__component.setMax(value)
[docs] def set_min(self, value: float) -> None:
"""
Sets the minimum value that can be entered by the user.
"""
self.__component.setMin(value)
[docs] def set_spin_size(self, value: float) -> None:
"""
sets the increment value for the spin button.
"""
self.__component.setSpinSize(value)
[docs] def set_value(self, value: float) -> None:
"""
Sets the value which is displayed in the currency field.
"""
self.__component.setValue(value)
# endregion XCurrencyField