LibreOffice Module sfx2 (master) 1
Classes | Public Member Functions | Private Attributes | List of all members
sfx2::PreventDuplicateInteraction Class Referencefinal

Prevent us from showing the same interaction more than once during the same transaction. More...

#include <preventduplicateinteraction.hxx>

Inheritance diagram for sfx2::PreventDuplicateInteraction:
[legend]
Collaboration diagram for sfx2::PreventDuplicateInteraction:
[legend]

Classes

struct  InteractionInfo
 

Public Member Functions

virtual void SAL_CALL initialize (const css::uno::Sequence< css::uno::Any > &rArguments) override
 
virtual void SAL_CALL handle (const css::uno::Reference< css::task::XInteractionRequest > &xRequest) override
 
virtual sal_Bool SAL_CALL handleInteractionRequest (const css::uno::Reference< css::task::XInteractionRequest > &xRequest) override
 
virtual css::uno::Any SAL_CALL queryInterface (const css::uno::Type &aType) override
 
 PreventDuplicateInteraction (css::uno::Reference< css::uno::XComponentContext > xContext)
 ctor to guarantee right initialized instances of this class @descr It uses the given uno service manager to create the global generic UI interaction handler for later internal using. More...
 
virtual ~PreventDuplicateInteraction () override
 dtor to free used memory. More...
 
void setHandler (const css::uno::Reference< css::task::XInteractionHandler > &xHandler)
 set the outside interaction handler, which must be used internally if the interaction will not be blocked by the set list of rules. More...
 
void useDefaultUUIHandler ()
 instead of setting an outside interaction handler, this method make sure the default UUI interaction handler of the office is used. More...
 
void addInteractionRule (const PreventDuplicateInteraction::InteractionInfo &aInteractionInfo)
 add a new interaction to the list of interactions, which must be handled by this helper. More...
 
bool getInteractionInfo (const css::uno::Type &aInteraction, PreventDuplicateInteraction::InteractionInfo *pReturn) const
 return the info struct for the specified interaction. More...
 

Private Attributes

std::mutex m_aLock
 
css::uno::Reference< css::uno::XComponentContext > m_xContext
 Used to create needed uno services at runtime. More...
 
css::uno::Reference< css::task::XInteractionHandler > m_xHandler
 The outside interaction handler, which is used to handle every incoming interaction, if it's not blocked. More...
 
std::unique_ptr< WarningDialogsParentScopem_xWarningDialogsParent
 
std::vector< InteractionInfom_lInteractionRules
 This list describe which and how incoming interactions must be handled. More...
 

Detailed Description

Prevent us from showing the same interaction more than once during the same transaction.

@descr Every interaction provided to this helper will be safed ... handled by the internal used UUIInteractionHandler (!) and never be handled a second time!

On the other side there exists some interactions, which allow a retry. So this helper allow to set a list of interactions combined with a retry value.

Definition at line 153 of file preventduplicateinteraction.hxx.

Constructor & Destructor Documentation

◆ PreventDuplicateInteraction()

sfx2::PreventDuplicateInteraction::PreventDuplicateInteraction ( css::uno::Reference< css::uno::XComponentContext >  xContext)

ctor to guarantee right initialized instances of this class @descr It uses the given uno service manager to create the global generic UI interaction handler for later internal using.

Parameters
xSMGRuno service manager for creating services internally

@threadsafe not necessary

Definition at line 31 of file preventduplicateinteraction.cxx.

References m_xContext.

◆ ~PreventDuplicateInteraction()

sfx2::PreventDuplicateInteraction::~PreventDuplicateInteraction ( )
overridevirtual

dtor to free used memory.

Definition at line 36 of file preventduplicateinteraction.cxx.

Member Function Documentation

◆ addInteractionRule()

void sfx2::PreventDuplicateInteraction::addInteractionRule ( const PreventDuplicateInteraction::InteractionInfo aInteractionInfo)

add a new interaction to the list of interactions, which must be handled by this helper.

@descr This method must be called immediately after a new instance of this helper was created. Without such list of InteractionRules, this instances does nothing! On the other side there is no possibility to remove rules. So the same instance can't be used within different transactions. It's a OneWay-object .-)

Parameters
aInteractionInfodescribe the type of interaction, hos often it can be called etcpp.

@threadsafe yes

Definition at line 164 of file preventduplicateinteraction.cxx.

References m_aLock, m_lInteractionRules, sfx2::PreventDuplicateInteraction::InteractionInfo::m_nCallCount, and sfx2::PreventDuplicateInteraction::InteractionInfo::m_nMaxCount.

◆ getInteractionInfo()

bool sfx2::PreventDuplicateInteraction::getInteractionInfo ( const css::uno::Type &  aInteraction,
PreventDuplicateInteraction::InteractionInfo pReturn 
) const

return the info struct for the specified interaction.

Parameters
aInteractionspecify the interaction.
pReturnprovides information about:
  • the count how often this interaction was handled during the lifetime of this helper.
  • the interaction itself, so it can be analyzed further
Returns
[boolean] true if the queried interaction could be found. false otherwise.

@threadsafe yes

Definition at line 183 of file preventduplicateinteraction.cxx.

References m_aLock, and m_lInteractionRules.

◆ handle()

void SAL_CALL sfx2::PreventDuplicateInteraction::handle ( const css::uno::Reference< css::task::XInteractionRequest > &  xRequest)
overridevirtual

◆ handleInteractionRequest()

sal_Bool SAL_CALL sfx2::PreventDuplicateInteraction::handleInteractionRequest ( const css::uno::Reference< css::task::XInteractionRequest > &  xRequest)
overridevirtual

◆ initialize()

void SAL_CALL sfx2::PreventDuplicateInteraction::initialize ( const css::uno::Sequence< css::uno::Any > &  rArguments)
overridevirtual

Definition at line 201 of file preventduplicateinteraction.cxx.

References m_xHandler, and m_xWarningDialogsParent.

◆ queryInterface()

css::uno::Any SAL_CALL sfx2::PreventDuplicateInteraction::queryInterface ( const css::uno::Type &  aType)
overridevirtual

Definition at line 63 of file preventduplicateinteraction.cxx.

References m_aLock, and m_xHandler.

◆ setHandler()

void sfx2::PreventDuplicateInteraction::setHandler ( const css::uno::Reference< css::task::XInteractionHandler > &  xHandler)

set the outside interaction handler, which must be used internally if the interaction will not be blocked by the set list of rules.

Note
This overwrites the settings of e.g. useDefaultUUIHandler()!
Parameters
xHandlerthe new interaction handler

Definition at line 40 of file preventduplicateinteraction.cxx.

References m_aLock, m_xHandler, and m_xWarningDialogsParent.

◆ useDefaultUUIHandler()

void sfx2::PreventDuplicateInteraction::useDefaultUUIHandler ( )

instead of setting an outside interaction handler, this method make sure the default UUI interaction handler of the office is used.

Note
This overwrites the settings of e.g. setHandler()!

Definition at line 49 of file preventduplicateinteraction.cxx.

References m_aLock, m_xContext, m_xHandler, and m_xWarningDialogsParent.

Member Data Documentation

◆ m_aLock

std::mutex sfx2::PreventDuplicateInteraction::m_aLock
mutableprivate

◆ m_lInteractionRules

std::vector< InteractionInfo > sfx2::PreventDuplicateInteraction::m_lInteractionRules
private

This list describe which and how incoming interactions must be handled.

Further it contains all collected information after this interaction object was used.

Definition at line 198 of file preventduplicateinteraction.hxx.

Referenced by addInteractionRule(), getInteractionInfo(), handle(), and handleInteractionRequest().

◆ m_xContext

css::uno::Reference< css::uno::XComponentContext > sfx2::PreventDuplicateInteraction::m_xContext
private

Used to create needed uno services at runtime.

Definition at line 187 of file preventduplicateinteraction.hxx.

Referenced by useDefaultUUIHandler().

◆ m_xHandler

css::uno::Reference< css::task::XInteractionHandler > sfx2::PreventDuplicateInteraction::m_xHandler
private

The outside interaction handler, which is used to handle every incoming interaction, if it's not blocked.

Definition at line 191 of file preventduplicateinteraction.hxx.

Referenced by handle(), handleInteractionRequest(), initialize(), queryInterface(), setHandler(), and useDefaultUUIHandler().

◆ m_xWarningDialogsParent

std::unique_ptr<WarningDialogsParentScope> sfx2::PreventDuplicateInteraction::m_xWarningDialogsParent
private

Definition at line 193 of file preventduplicateinteraction.hxx.

Referenced by initialize(), setHandler(), and useDefaultUUIHandler().


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