LibreOffice Module extensions (master) 1
Public Member Functions | Private Member Functions | Private Attributes | List of all members
pcr::ComposedPropertyUIUpdate Class Reference

helper class composing requests to a ->XObjectInspectorUI interface, coming from multiple sources More...

#include <composeduiupdate.hxx>

Collaboration diagram for pcr::ComposedPropertyUIUpdate:
[legend]

Public Member Functions

 ComposedPropertyUIUpdate (const css::uno::Reference< css::inspection::XObjectInspectorUI > &_rxDelegatorUI, IPropertyExistenceCheck *_pPropertyCheck)
 constructs a ->ComposedPropertyUIUpdate instance More...
 
 ~ComposedPropertyUIUpdate ()
 
css::uno::Reference< css::inspection::XObjectInspectorUI > const & getDelegatorUI () const
 returns the delegator UI More...
 
css::uno::Reference< css::inspection::XObjectInspectorUI > getUIForPropertyHandler (const css::uno::Reference< css::inspection::XPropertyHandler > &_rxHandler)
 returns a ->XObjectInspectorUI instance belonging to a given property handler More...
 
void suspendAutoFire ()
 Suspends automatic firing of UI changes. More...
 
void resumeAutoFire ()
 Suspends automatic firing of UI changes. More...
 
void dispose ()
 disposes the instance, so it becomes non-functional. More...
 
bool shouldContinuePropertyHandling (const OUString &_rName) const
 invokes m_pPropertyCheck to check whether a given property should be handled More...
 

Private Member Functions

bool impl_isDisposed () const
 determines whether the instance is already disposed More...
 
void impl_checkDisposed () const
 throws an exception if the component is already disposed More...
 
void impl_fireAll_throw ()
 fires the collected UI changes to our delegator UI More...
 
void impl_fireEnablePropertyUI_throw ()
 fires the combination of ->XObjectInspectorUI::enablePropertyUI calls More...
 
void impl_fireEnablePropertyUIElements_throw ()
 fires the combination of ->XObjectInspectorUI::enablePropertyUIElements calls More...
 
void impl_fireRebuildPropertyUI_throw ()
 fires the combination of ->XObjectInspectorUI::rebuildPropertyUI calls More...
 
void impl_fireShowHidePropertyUI_throw ()
 fires the combination of ->XObjectInspectorUI::showPropertyUI and ->XObjectInspectorUI::hidePropertyUI calls More...
 
void impl_fireShowCategory_throw ()
 fires the combination of ->XObjectInspectorUI::showCategory calls More...
 
void callback_inspectorUIChanged_throw ()
 callback for when a single property handler requested any change in the inspector UI More...
 
 ComposedPropertyUIUpdate (const ComposedPropertyUIUpdate &)=delete
 
ComposedPropertyUIUpdateoperator= (const ComposedPropertyUIUpdate &)=delete
 

Private Attributes

std::unique_ptr< MapHandlerToUIm_pCollectedUIs
 
css::uno::Reference< css::inspection::XObjectInspectorUI > m_xDelegatorUI
 
oslInterlockedCount m_nSuspendCounter
 
IPropertyExistenceCheckm_pPropertyCheck
 

Detailed Description

helper class composing requests to a ->XObjectInspectorUI interface, coming from multiple sources

Usually, a handler tells the browser UI to enable to disable, or show or hide, certain elements. Now when multiple handlers do this, their instructions must be combined: If one handler disables a certain element, but others enable it, it must in the result still be disabled. Similar for showing/hiding elements.

->ComposedPropertyUIUpdate implements this combination. It does so by providing a dedicated ->XObjectInspectorUI instance for every participating handler, and remembering the UI state on a per-handler basis. Upon request (->fire), the combined UI state is forwarded to another ->XObjectInspectorUI instance, the so-called delegator UI.

Definition at line 58 of file composeduiupdate.hxx.

Constructor & Destructor Documentation

◆ ComposedPropertyUIUpdate() [1/2]

pcr::ComposedPropertyUIUpdate::ComposedPropertyUIUpdate ( const css::uno::Reference< css::inspection::XObjectInspectorUI > &  _rxDelegatorUI,
IPropertyExistenceCheck _pPropertyCheck 
)

constructs a ->ComposedPropertyUIUpdate instance

Parameters
_rxDelegatorUIa ->XObjectInspectorUI instance to which composed UI requests should be forwarded. Must not be <NULL>.
_pPropertyCheckan instance checking properties for existence. If this is not <NULL>, it will be invoked whenever one of the ->XObjectInspectorUI methods is called, to check the passed property name.
Beware of lifetime issues. The instance pointed to by <arg>_pPropertyCheck</arg> must live at least as long as the ->ComposedPropertyUIUpdate instance you're going to create.
Exceptions
css::lang::NullPointerExceptionif ->_rxDelegatorUI is <NULL>

◆ ~ComposedPropertyUIUpdate()

pcr::ComposedPropertyUIUpdate::~ComposedPropertyUIUpdate ( )

Definition at line 380 of file composeduiupdate.cxx.

◆ ComposedPropertyUIUpdate() [2/2]

pcr::ComposedPropertyUIUpdate::ComposedPropertyUIUpdate ( const ComposedPropertyUIUpdate )
privatedelete

Member Function Documentation

◆ callback_inspectorUIChanged_throw()

void pcr::ComposedPropertyUIUpdate::callback_inspectorUIChanged_throw ( )
private

callback for when a single property handler requested any change in the inspector UI

Definition at line 743 of file composeduiupdate.cxx.

References impl_fireAll_throw(), and m_nSuspendCounter.

Referenced by getUIForPropertyHandler().

◆ dispose()

void pcr::ComposedPropertyUIUpdate::dispose ( void  )

disposes the instance, so it becomes non-functional.

All cached handlers and cached ->XObjectInspectorUI instances will be released, the latter will also be disposed, so that if anybody still holds a reference to them and tries to operate them will get a DisposedException.

Definition at line 757 of file composeduiupdate.cxx.

References impl_isDisposed(), m_nSuspendCounter, m_pCollectedUIs, and m_xDelegatorUI.

◆ getDelegatorUI()

Reference< XObjectInspectorUI > const & pcr::ComposedPropertyUIUpdate::getDelegatorUI ( ) const

returns the delegator UI

Exceptions
css::lang::DisposedException

Definition at line 750 of file composeduiupdate.cxx.

References impl_checkDisposed(), and m_xDelegatorUI.

◆ getUIForPropertyHandler()

Reference< XObjectInspectorUI > pcr::ComposedPropertyUIUpdate::getUIForPropertyHandler ( const css::uno::Reference< css::inspection::XPropertyHandler > &  _rxHandler)

returns a ->XObjectInspectorUI instance belonging to a given property handler

In every call to an ->XPropertyHandler method which requires a ->XObjectInspectorUI, the same UI instance should be used. The instance here will cache all requests passed to it, and ->ComposedPropertyUIUpdate::fire will use the combination of all cached UI states of all handlers to update the delegator UI.

Definition at line 385 of file composeduiupdate.cxx.

References callback_inspectorUIChanged_throw(), impl_checkDisposed(), and m_pCollectedUIs.

◆ impl_checkDisposed()

void pcr::ComposedPropertyUIUpdate::impl_checkDisposed ( ) const
private

throws an exception if the component is already disposed

Definition at line 736 of file composeduiupdate.cxx.

References impl_isDisposed().

Referenced by getDelegatorUI(), getUIForPropertyHandler(), resumeAutoFire(), and suspendAutoFire().

◆ impl_fireAll_throw()

void pcr::ComposedPropertyUIUpdate::impl_fireAll_throw ( )
private

fires the collected UI changes to our delegator UI

All operations for any elements are forwarded:

  • If an element has been hidden at least once, it's also hidden at the delegator UI.
  • If an element has been shown at least once, and never been hidden, it's also shown at the delegator UI.
  • If an element has never been shown or hidden, it's also not touched at the delegator UI.
  • The same holds if you replace "hidden" in the last three items with "disabled", and "shown" with "enabled".
  • If an element should have been rebuilt (->XObjectInspectorUI::rebuiltPropertyUI) at least once, it's rebuilt at the delegator UI, too.
    After that, the request to rebuild the UI for this property is cleared, so subsequent calls to ->fire will not trigger a new rebuilt request.

@precond instance is not disposed

Definition at line 709 of file composeduiupdate.cxx.

References impl_fireEnablePropertyUI_throw(), impl_fireEnablePropertyUIElements_throw(), impl_fireRebuildPropertyUI_throw(), impl_fireShowCategory_throw(), impl_fireShowHidePropertyUI_throw(), and impl_isDisposed().

Referenced by callback_inspectorUIChanged_throw(), and resumeAutoFire().

◆ impl_fireEnablePropertyUI_throw()

void pcr::ComposedPropertyUIUpdate::impl_fireEnablePropertyUI_throw ( )
private

fires the combination of ->XObjectInspectorUI::enablePropertyUI calls

Definition at line 628 of file composeduiupdate.cxx.

References m_pCollectedUIs, and m_xDelegatorUI.

Referenced by impl_fireAll_throw().

◆ impl_fireEnablePropertyUIElements_throw()

void pcr::ComposedPropertyUIUpdate::impl_fireEnablePropertyUIElements_throw ( )
private

fires the combination of ->XObjectInspectorUI::enablePropertyUIElements calls

Definition at line 684 of file composeduiupdate.cxx.

References m_pCollectedUIs, and m_xDelegatorUI.

Referenced by impl_fireAll_throw().

◆ impl_fireRebuildPropertyUI_throw()

void pcr::ComposedPropertyUIUpdate::impl_fireRebuildPropertyUI_throw ( )
private

fires the combination of ->XObjectInspectorUI::rebuildPropertyUI calls

Definition at line 639 of file composeduiupdate.cxx.

References m_pCollectedUIs, and m_xDelegatorUI.

Referenced by impl_fireAll_throw().

◆ impl_fireShowCategory_throw()

void pcr::ComposedPropertyUIUpdate::impl_fireShowCategory_throw ( )
private

fires the combination of ->XObjectInspectorUI::showCategory calls

Definition at line 673 of file composeduiupdate.cxx.

References m_pCollectedUIs, and m_xDelegatorUI.

Referenced by impl_fireAll_throw().

◆ impl_fireShowHidePropertyUI_throw()

void pcr::ComposedPropertyUIUpdate::impl_fireShowHidePropertyUI_throw ( )
private

fires the combination of ->XObjectInspectorUI::showPropertyUI and ->XObjectInspectorUI::hidePropertyUI calls

Definition at line 653 of file composeduiupdate.cxx.

References m_pCollectedUIs, and m_xDelegatorUI.

Referenced by impl_fireAll_throw().

◆ impl_isDisposed()

bool pcr::ComposedPropertyUIUpdate::impl_isDisposed ( ) const
inlineprivate

determines whether the instance is already disposed

Definition at line 139 of file composeduiupdate.hxx.

References m_pCollectedUIs.

Referenced by dispose(), impl_checkDisposed(), and impl_fireAll_throw().

◆ operator=()

ComposedPropertyUIUpdate & pcr::ComposedPropertyUIUpdate::operator= ( const ComposedPropertyUIUpdate )
privatedelete

◆ resumeAutoFire()

void pcr::ComposedPropertyUIUpdate::resumeAutoFire ( )

Suspends automatic firing of UI changes.

@seealso suspendAutoFire

Definition at line 728 of file composeduiupdate.cxx.

References impl_checkDisposed(), impl_fireAll_throw(), and m_nSuspendCounter.

Referenced by pcr::ComposedUIAutoFireGuard::~ComposedUIAutoFireGuard().

◆ shouldContinuePropertyHandling()

bool pcr::ComposedPropertyUIUpdate::shouldContinuePropertyHandling ( const OUString &  _rName) const

invokes m_pPropertyCheck to check whether a given property should be handled

Definition at line 773 of file composeduiupdate.cxx.

References pcr::IPropertyExistenceCheck::hasPropertyByName(), and m_pPropertyCheck.

◆ suspendAutoFire()

void pcr::ComposedPropertyUIUpdate::suspendAutoFire ( )

Suspends automatic firing of UI changes.

normally, as soon as any of the property handlers does a request for an arbitrary UI change, the set of collected UI changes is evaluated, and the combined UI state is fired to the delegator UI.

You can disable this automatic firing by calling ->suspendAutoFire. As longs as auto firing is suspended, only explicit ->fire calls trigger the notification to the delegator UI.

Note that calls to ->suspendAutoFire are cumulative, that is, if you make multiple calls they must be accompanied by an equal number of calls to ->resumeAutoFire, to enable auto-firing again.

@seealso resumeAutoFire

Definition at line 721 of file composeduiupdate.cxx.

References impl_checkDisposed(), and m_nSuspendCounter.

Referenced by pcr::ComposedUIAutoFireGuard::ComposedUIAutoFireGuard().

Member Data Documentation

◆ m_nSuspendCounter

oslInterlockedCount pcr::ComposedPropertyUIUpdate::m_nSuspendCounter
private

◆ m_pCollectedUIs

std::unique_ptr< MapHandlerToUI > pcr::ComposedPropertyUIUpdate::m_pCollectedUIs
private

◆ m_pPropertyCheck

IPropertyExistenceCheck* pcr::ComposedPropertyUIUpdate::m_pPropertyCheck
private

Definition at line 65 of file composeduiupdate.hxx.

Referenced by shouldContinuePropertyHandling().

◆ m_xDelegatorUI

css::uno::Reference< css::inspection::XObjectInspectorUI > pcr::ComposedPropertyUIUpdate::m_xDelegatorUI
private

The documentation for this class was generated from the following files: