Source code for ooodev.adapter.util.number_formats_supplier_partial

from __future__ import annotations
from typing import Any, TYPE_CHECKING
import uno

from import XNumberFormatsSupplier
from ooodev.exceptions import ex as mEx
from ooodev.loader import lo as mLo

    from ooodev.utils.type_var import UnoInterface
    from import XPropertySet
    from import XNumberFormats

[docs]class NumberFormatsSupplierPartial: """ Partial class for XNumberFormatsSupplier. """
[docs] def __init__( self, component: XNumberFormatsSupplier, interface: UnoInterface | None = XNumberFormatsSupplier ) -> None: """ Constructor Args: component (XNumberFormatsSupplier): UNO Component that implements ```` interface. interface (UnoInterface, optional): The interface to be validated. Defaults to ``XNumberFormatsSupplier``. """ self.__interface = interface self.__validate(component) self.__component = component
def __validate(self, component: Any) -> None: """ Validates the component. Args: component (Any): The component to be validated. """ if self.__interface is None: return if not mLo.Lo.is_uno_interfaces(component, self.__interface): raise mEx.MissingInterfaceError(self.__interface) # region XNumberFormatsSupplier
[docs] def get_number_format_settings(self) -> XPropertySet: """ Gets the number format settings. """ return self.__component.getNumberFormatSettings()
[docs] def get_number_formats(self) -> XNumberFormats: """ Gets the number formats. """ return self.__component.getNumberFormats()
# endregion XNumberFormatsSupplier