LibreOffice Module extensions (master) 1
|
helper class composing requests to a ->XObjectInspectorUI interface, coming from multiple sources More...
#include <composeduiupdate.hxx>
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 | |
ComposedPropertyUIUpdate & | operator= (const ComposedPropertyUIUpdate &)=delete |
Private Attributes | |
std::unique_ptr< MapHandlerToUI > | m_pCollectedUIs |
css::uno::Reference< css::inspection::XObjectInspectorUI > | m_xDelegatorUI |
oslInterlockedCount | m_nSuspendCounter |
IPropertyExistenceCheck * | m_pPropertyCheck |
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.
pcr::ComposedPropertyUIUpdate::ComposedPropertyUIUpdate | ( | const css::uno::Reference< css::inspection::XObjectInspectorUI > & | _rxDelegatorUI, |
IPropertyExistenceCheck * | _pPropertyCheck | ||
) |
constructs a ->ComposedPropertyUIUpdate instance
_rxDelegatorUI | a ->XObjectInspectorUI instance to which composed UI requests should be forwarded. Must not be <NULL>. |
_pPropertyCheck | an 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. |
css::lang::NullPointerException | if ->_rxDelegatorUI is <NULL> |
pcr::ComposedPropertyUIUpdate::~ComposedPropertyUIUpdate | ( | ) |
Definition at line 380 of file composeduiupdate.cxx.
|
privatedelete |
|
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().
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.
Reference< XObjectInspectorUI > const & pcr::ComposedPropertyUIUpdate::getDelegatorUI | ( | ) | const |
returns the delegator UI
css::lang::DisposedException |
Definition at line 750 of file composeduiupdate.cxx.
References impl_checkDisposed(), and m_xDelegatorUI.
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.
|
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().
|
private |
fires the collected UI changes to our delegator UI
All operations for any elements are forwarded:
@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().
|
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().
|
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().
|
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().
|
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().
|
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().
|
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().
|
privatedelete |
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().
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.
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().
|
private |
Definition at line 64 of file composeduiupdate.hxx.
Referenced by callback_inspectorUIChanged_throw(), dispose(), resumeAutoFire(), and suspendAutoFire().
|
private |
Definition at line 61 of file composeduiupdate.hxx.
Referenced by dispose(), getUIForPropertyHandler(), impl_fireEnablePropertyUI_throw(), impl_fireEnablePropertyUIElements_throw(), impl_fireRebuildPropertyUI_throw(), impl_fireShowCategory_throw(), impl_fireShowHidePropertyUI_throw(), and impl_isDisposed().
|
private |
Definition at line 65 of file composeduiupdate.hxx.
Referenced by shouldContinuePropertyHandling().
|
private |
Definition at line 63 of file composeduiupdate.hxx.
Referenced by dispose(), getDelegatorUI(), impl_fireEnablePropertyUI_throw(), impl_fireEnablePropertyUIElements_throw(), impl_fireRebuildPropertyUI_throw(), impl_fireShowCategory_throw(), and impl_fireShowHidePropertyUI_throw().