Source code for

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

from import XDataReceiver

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

    from ooodev.utils.type_var import UnoInterface
    from import XDataProvider
    from import XNumberFormatsSupplier
    from import XRequestCallback
    from import XRangeHighlighter
    from import XDataSource
    from import PropertyValue

[docs]class DataReceiverPartial: """ Partial class for XDataReceiver. """
[docs] def __init__(self, component: XDataReceiver, interface: UnoInterface | None = XDataReceiver) -> None: """ Constructor Args: component (XDataReceiver): UNO Component that implements ```` interface. interface (UnoInterface, optional): The interface to be validated. Defaults to ``XDataReceiver``. """ 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 XDataReceiver
[docs] def attach_data_provider(self, provider: XDataProvider) -> None: """ attaches a component that provides data for the document. The previously set data provider will be released. """ self.__component.attachDataProvider(provider)
[docs] def attach_number_formats_supplier(self, supplier: XNumberFormatsSupplier) -> None: """ attaches an XNumberFormatsSupplier to this XDataReceiver. The given number formats will be used for display purposes. """ self.__component.attachNumberFormatsSupplier(supplier)
[docs] def get_popup_request(self) -> XRequestCallback: """ A callback object to execute a foreign popup menu window. **since** LibreOffice 5.4 """ return self.__component.getPopupRequest()
[docs] def get_range_highlighter(self) -> XRangeHighlighter: """ Returns a component at which a view representing the data of the attached data provider may listen for highlighting the data ranges used by the currently selected objects in the data receiver component. This is typically used by a spreadsheet to highlight the ranges used by the currently selected object in a chart. The range highlighter is optional, i.e., this method may return an empty object. """ return self.__component.getRangeHighlighter()
[docs] def get_used_data(self) -> XDataSource: """ Returns the data requested by the most recently attached data provider, that is still used. """ return self.__component.getUsedData()
[docs] def get_used_range_representations(self) -> Tuple[str, ...]: """ returns a list of all range strings for which data has been requested by the most recently attached data provider, and which is still used. This list may be used by the data provider to swap charts out of memory, but still get informed by changes of ranges while the chart is not loaded. """ return self.__component.getUsedRangeRepresentations()
[docs] def set_arguments(self, *args: PropertyValue) -> None: """ Raises: ``IllegalArgumentException`` """ return self.__component.setArguments(args)
# endregion XDataReceiver