LibreOffice Module sfx2 (master) 1
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
SfxDispatcher Class Referencefinal

#include <dispatch.hxx>

Public Member Functions

 SfxDispatcher ()
 
 SfxDispatcher (SfxViewFrame *pFrame)
 The constructor of the SfxDispatcher class places a stack of empty <SfxShell> pointers. More...
 
SAL_DLLPRIVATE void Construct_Impl ()
 
 ~SfxDispatcher ()
 The destructor of the SfxDispatcher class should not be called when the SfxDispatcher instance is active. More...
 
const SfxPoolItemExecute (sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
 Method to execute a <SfxSlot>s over the Slot-Id. More...
 
const SfxPoolItemExecute (sal_uInt16 nSlot, SfxCallMode nCall, SfxItemSet const *pArgs, SfxItemSet const *pInternalArgs, sal_uInt16 nModi)
 
const SfxPoolItemExecuteList (sal_uInt16 nSlot, SfxCallMode nCall, std::initializer_list< SfxPoolItem const * > args, std::initializer_list< SfxPoolItem const * > internalargs=std::initializer_list< SfxPoolItem const * >())
 Method to execute a <SfxSlot>s over the Slot-Id. More...
 
const SfxPoolItemExecute (sal_uInt16 nSlot, SfxCallMode nCall, const SfxItemSet &rArgs)
 Method to execute a <SfxSlot>s over the Slot-Id. More...
 
const SfxSlotGetSlot (const OUString &rCommand)
 
bool IsActive (const SfxShell &rShell)
 This method checks whether a particular <SfxShell> instance is on the SfxDispatcher. More...
 
sal_uInt16 GetShellLevel (const SfxShell &rShell)
 Determines the position of a given SfxShell in the stack of the dispatcher. More...
 
SfxBindingsGetBindings () const
 This method returns a pointer to the <SfxBinding> Instance on which the SfxDispatcher is currently bound. More...
 
void Push (SfxShell &rShell)
 With this method, a <SfxShell> pushed on to the SfxDispatcher. More...
 
void Pop (SfxShell &rShell, SfxDispatcherPopFlags nMode=SfxDispatcherPopFlags::NONE)
 With this method, one or more <SfxShell> are popped from the SfxDispatcher. More...
 
SfxShellGetShell (sal_uInt16 nIdx) const
 Returns a pointer to the <SfxShell> which is at the position nIdx (from the top, last pushed is 0) on the stack. More...
 
SfxViewFrameGetFrame () const
 Returns a pointer to the <SfxViewFrame> instance, which belongs to this SfxDispatcher. More...
 
SfxModuleGetModule () const
 
void ExecutePopup (const OUString &rResName, vcl::Window *pWin=nullptr, const Point *pPos=nullptr)
 
bool IsAppDispatcher () const
 With this method it can be determined if the SfxDispacher is the applications dispatcher. More...
 
bool IsFlushed () const
 This method checks if the stack of the SfxDispatchers is flushed, or if push- or pop- commands are pending. More...
 
void Flush ()
 This method performs outstanding push- and pop- commands. More...
 
void Lock (bool bLock)
 With this method the SfxDispatcher can be locked and released. More...
 
bool IsLocked () const
 With this method it can be determined whether the SfxDispatcher is locked or unlocked. More...
 
void SetSlotFilter (SfxSlotFilterState nEnable=SfxSlotFilterState::DISABLED, o3tl::span< sal_uInt16 const > pSIDs=o3tl::span< sal_uInt16 const >())
 With this method a filter set, the target slots can be enabled or disabled. More...
 
void HideUI (bool bHide=true)
 
ToolbarId GetObjectBarId (sal_uInt16 nPos) const
 
SfxItemState QueryState (sal_uInt16 nSID, const SfxPoolItem *&rpState)
 
template<class T >
SfxItemState QueryState (TypedWhichId< T > nSID, const T *&rpState)
 
SfxItemState QueryState (sal_uInt16 nSID, css::uno::Any &rAny)
 
void SetDisableFlags (SfxDisableFlags nFlags)
 
SfxDisableFlags GetDisableFlags () const
 
SAL_DLLPRIVATE void SetMenu_Impl ()
 
SAL_DLLPRIVATE void Update_Impl (bool bForce=false)
 
SAL_DLLPRIVATE bool IsUpdated_Impl () const
 
SAL_DLLPRIVATE bool GetShellAndSlot_Impl (sal_uInt16 nSlot, SfxShell **ppShell, const SfxSlot **ppSlot, bool bOwnShellsOnly, bool bRealSlot)
 This method searches in SfxDispatcher after <SfxShell> , from the Slot Id nSlot currently being handled. More...
 
SAL_DLLPRIVATE void SetReadOnly_Impl (bool bOn)
 
SAL_DLLPRIVATE bool GetReadOnly_Impl () const
 
SAL_DLLPRIVATE SfxSlotFilterState IsSlotEnabledByFilter_Impl (sal_uInt16 nSID) const
 Searches for 'nSID' in the Filter set by <SetSlotFilter()> and returns sal_True, if the SIDis allowed, or sal_False, if it is disabled by the Filter. More...
 
SAL_DLLPRIVATE void SetQuietMode_Impl (bool bOn)
 With 'bOn' the Dispatcher is quasi dead and transfers everything to the Parent-Dispatcher. More...
 
SAL_DLLPRIVATE bool IsReadOnlyShell_Impl (sal_uInt16 nShell) const
 
SAL_DLLPRIVATE void RemoveShell_Impl (SfxShell &rShell)
 
SAL_DLLPRIVATE void DoActivate_Impl (bool bMDI)
 This method controls the activation of a dispatcher. More...
 
SAL_DLLPRIVATE void DoDeactivate_Impl (bool bMDI, SfxViewFrame const *pNew)
 This method controls the deactivation of a dispatcher. More...
 
SAL_DLLPRIVATE void InvalidateBindings_Impl (bool)
 

Static Public Member Functions

static void ExecutePopup (vcl::Window *pWin=nullptr, const Point *pPosPixel=nullptr)
 
static boost::property_tree::ptree fillPopupMenu (const rtl::Reference< VCLXPopupMenu > &rMenu)
 

Private Member Functions

SAL_DLLPRIVATE bool CheckVirtualStack (const SfxShell &rShell)
 With this method it can be tested whether the <SfxShell> rShell is on the stack, when it was flushed. More...
 
 DECL_DLLPRIVATE_LINK (EventHdl_Impl, Timer *, void)
 
void PostMsgHandler (std::unique_ptr< SfxRequest >)
 Helper method to receive the asynchronously executed <SfxRequest>s. More...
 
SAL_DLLPRIVATE void Call_Impl (SfxShell &rShell, const SfxSlot &rSlot, SfxRequest &rReq, bool bRecord)
 Helper function to check whether a slot can be executed and check the execution itself. More...
 
SAL_DLLPRIVATE void Update_Impl_ (bool, bool, bool, SfxWorkWindow *)
 
bool FindServer_ (sal_uInt16 nId, SfxSlotServer &rServer)
 This helper method searches for the <Slot-Server> which currently serves the nSlot. More...
 
bool FillState_ (const SfxSlotServer &rServer, SfxItemSet &rState, const SfxSlot *pRealSlot)
 Helper method to obtain the status of the <Slot-Server>s rSvr. More...
 
void Execute_ (SfxShell &rShell, const SfxSlot &rSlot, SfxRequest &rReq, SfxCallMode eCall)
 This method performs a request for a cached <Slot-Server>. More...
 
void FlushImpl ()
 Helper method to execute the outstanding push and pop commands. More...
 

Private Attributes

std::unique_ptr< SfxDispatcher_ImplxImp
 

Friends

class SfxApplication
 
class SfxViewFrame
 
class SfxBindings
 
class SfxStateCache
 
class SfxPopupMenuManager
 
class SfxHelp
 

Detailed Description

Definition at line 69 of file dispatch.hxx.

Constructor & Destructor Documentation

◆ SfxDispatcher() [1/2]

SfxDispatcher::SfxDispatcher ( )

Definition at line 312 of file dispatch.cxx.

References Construct_Impl(), and xImp.

◆ SfxDispatcher() [2/2]

SfxDispatcher::SfxDispatcher ( SfxViewFrame pViewFrame)

The constructor of the SfxDispatcher class places a stack of empty <SfxShell> pointers.

It is not initially locked and is considered flushed.

Definition at line 321 of file dispatch.cxx.

References Construct_Impl(), and xImp.

◆ ~SfxDispatcher()

SfxDispatcher::~SfxDispatcher ( )

The destructor of the SfxDispatcher class should not be called when the SfxDispatcher instance is active.

It may, however, still be a <SfxShell> pointer on the stack.

Definition at line 331 of file dispatch.cxx.

References DBG_ASSERT, GetBindings(), SfxBindings::GetDispatcher_Impl(), SfxBindings::GetSubBindings_Impl(), SfxApplication::IsDowning(), SAL_INFO, SfxBindings::SetDispatcher(), SfxGetpApp(), and xImp.

Member Function Documentation

◆ Call_Impl()

void SfxDispatcher::Call_Impl ( SfxShell rShell,
const SfxSlot rSlot,
SfxRequest rReq,
bool  bRecord 
)
private

◆ CheckVirtualStack()

bool SfxDispatcher::CheckVirtualStack ( const SfxShell rShell)
private

With this method it can be tested whether the <SfxShell> rShell is on the stack, when it was flushed.

This way the SfxDispatcher is not actually flushed.

This method is intended among other things to make assertions possible without the side effect of having to flush the SfxDispatcher.

Definition at line 471 of file dispatch.cxx.

References CheckVirtualStack(), DBG_ASSERT, i, SFX_STACK, and xImp.

Referenced by CheckVirtualStack(), and IsActive().

◆ Construct_Impl()

void SfxDispatcher::Construct_Impl ( )

Definition at line 285 of file dispatch.cxx.

References DISABLED, LINK, NONE, None, PostMsgHandler(), and xImp.

Referenced by SfxDispatcher().

◆ DECL_DLLPRIVATE_LINK()

SfxDispatcher::DECL_DLLPRIVATE_LINK ( EventHdl_Impl  ,
Timer ,
void   
)
private

References Execute(), GetBindings(), and GetShell().

◆ DoActivate_Impl()

void SfxDispatcher::DoActivate_Impl ( bool  bMDI)

This method controls the activation of a dispatcher.

Since the application dispatcher is always active, either as a sub dispatcher of the <SfxViewFrame> dispatcher or as itself, it is never activated as a whole, instead only its individual <SfxShell>s at <SfxDispatcher::Push(SfxShell&)>.

When activating a SfxDispatcher all of the SfxShells located on its stack are called with the handler <SfxShell::Activate(bool)>, starting with the lowest.

Definition at line 573 of file dispatch.cxx.

References DBG_ASSERT, GetBindings(), i, IsAppDispatcher(), SAL_INFO, SfxBindings::SetActiveFrame(), SfxBindings::SetDispatcher(), SFX_STACK, and xImp.

◆ DoDeactivate_Impl()

void SfxDispatcher::DoDeactivate_Impl ( bool  bMDI,
SfxViewFrame const *  pNew 
)

This method controls the deactivation of a dispatcher.

Since the application dispatcher is always active, either as a sub dispatcher of the <SfxViewFrame> dispatcher or as itself, it is never deactivated as a whole, instead only its individual <SfxShell>s at <SfxDispatcher::Pop(SfxShell&)>.

When deactivating a SfxDispatcher all of the SfxShells located on its stack are called with the handler <SfxShell::Deactivate(bool)>, starting with the lowest.

Definition at line 624 of file dispatch.cxx.

References DBG_ASSERT, Flush(), SfxChildWindow::GetAlignment(), SfxWorkWindow::GetChildWindow_Impl(), GetFrame(), SfxViewFrame::GetFrame(), SfxFrame::GetFrameInterface(), i, IsAppDispatcher(), SfxApplication::IsDowning(), n, NOALIGNMENT, SAL_INFO, SFX_STACK, SfxGetpApp(), and xImp.

◆ Execute() [1/3]

const SfxPoolItem * SfxDispatcher::Execute ( sal_uInt16  nSlot,
SfxCallMode  eCall,
const SfxItemSet rArgs 
)

Method to execute a <SfxSlot>s over the Slot-Id.

Parameters
nSlotthe Id of the executing function
eCallSfxCallMode::SYNCRHON, ..._ASYNCHRON or ..._SLOT
rArgs<SfxItemSet> with the parameters
Returns
const SfxPoolItem* Pointer to the SfxPoolItem valid to the next run though the Message-Loop, which contains the return value.

Or a NULL-Pointer, when the function was not executed (for example canceled by the user).

Definition at line 881 of file dispatch.cxx.

References Execute_(), SfxItemIter::GetCurItem(), SfxShell::GetPool(), SfxRequest::GetReturnValue(), GetShellAndSlot_Impl(), IsLocked(), MappedPut_Impl(), SfxItemIter::NextItem(), and SfxRequest::SetModifier().

◆ Execute() [2/3]

const SfxPoolItem * SfxDispatcher::Execute ( sal_uInt16  nSlot,
SfxCallMode  nCall,
SfxItemSet const *  pArgs,
SfxItemSet const *  pInternalArgs,
sal_uInt16  nModi 
)

◆ Execute() [3/3]

const SfxPoolItem * SfxDispatcher::Execute ( sal_uInt16  nSlot,
SfxCallMode  eCall = SfxCallMode::SLOT,
const SfxPoolItem **  pArgs = nullptr,
sal_uInt16  nModi = 0,
const SfxPoolItem **  pInternalArgs = nullptr 
)

Method to execute a <SfxSlot>s over the Slot-Id.

Parameters
nSlotthe Id of the executing function
eCallSfxCallMode::SYNCRHON, ..._ASYNCHRON or ..._SLOT
pArgsZero terminated C-Array of Parameters
pInternalArgsZero terminated C-Array of Parameters
Returns
const SfxPoolItem* Pointer to the SfxPoolItem valid to the next run though the Message-Loop, which contains the return value.

Or a NULL-Pointer, when the function was not executed (for example canceled by the user).

Definition at line 833 of file dispatch.cxx.

References Execute_(), SfxShell::GetPool(), GetShellAndSlot_Impl(), IsLocked(), MappedPut_Impl(), SfxItemSet::Put(), and SfxGetpApp().

Referenced by SfxCommonTemplateDialog_Impl::ActionSelect(), SfxDispatchController_Impl::dispatch(), SfxObjectShell::ExecFile_Impl(), SfxViewFrame::ExecReload_Impl(), SfxCommonTemplateDialog_Impl::Execute_Impl(), SfxManageStyleSheetPage::Execute_Impl(), IMPL_LINK(), IMPL_LINK_NOARG(), SfxApplication::OpenDocExec_Impl(), SfxApplication::OpenRemoteExec_Impl(), SfxApplication::SignPDFExec_Impl(), and SfxObjectShell::SignSignatureLine().

◆ Execute_()

void SfxDispatcher::Execute_ ( SfxShell rShell,
const SfxSlot rSlot,
SfxRequest rReq,
SfxCallMode  eCallMode 
)
private

This method performs a request for a cached <Slot-Server>.

Parameters
rShellto the calling <SfxShell>
rSlotto the calling <SfxSlot>
rReqfunction to be performed (Id and optional parameters)
eCallModeSynchronously, asynchronously or as shown in the slot

Definition at line 726 of file dispatch.cxx.

References SfxRequest::AllowRecording(), ASYNCHRON, Call_Impl(), DBG_ASSERT, Execute_(), IsLocked(), SfxSlot::IsMode(), n, RECORD, SFX_STACK, SLOT, SYNCHRON, and xImp.

Referenced by Execute(), Execute_(), SfxBindings::Execute_Impl(), and ExecuteList().

◆ ExecuteList()

const SfxPoolItem * SfxDispatcher::ExecuteList ( sal_uInt16  nSlot,
SfxCallMode  eCall,
std::initializer_list< SfxPoolItem const * >  args,
std::initializer_list< SfxPoolItem const * >  internalargs = std::initializer_list<SfxPoolItem const*>() 
)

Method to execute a <SfxSlot>s over the Slot-Id.

[Note]

The parameters are copied, can therefore be passed on as the address of stack objects.

Parameters
nSlotthe Id of the executing function
eCallSfxCallMode::SYNCRHON, ..._ASYNCHRON or ..._SLOT
argslist of SfxPoolItem arguments
Returns
Pointer to the SfxPoolItem valid to the next run though the Message-Loop, which contains the return value.

Or a NULL-Pointer, when the function was not executed (for example canceled by the user).

[Example]

pDispatcher->Execute( SID_OPENDOCUMENT, SfxCallMode::SYNCHRON, { &SfxStringItem( SID_FILE_NAME, "\\tmp\\temp.sdd" ), &SfxStringItem( SID_FILTER_NAME, "StarDraw Presentation" ), &SfxBoolItem( SID_DOC_READONLY, sal_False ), });

Definition at line 931 of file dispatch.cxx.

References args, Execute_(), SfxShell::GetPool(), SfxRequest::GetReturnValue(), GetShellAndSlot_Impl(), IsLocked(), MappedPut_Impl(), SfxItemSet::Put(), SfxRequest::SetInternalArgs_Impl(), and SfxGetpApp().

Referenced by SfxViewFrame::AddDispatchMacroToBasic_Impl(), SfxModelessDialogController::Close(), SfxDockingWindow::Close(), StyleList::FamilySelect(), IMPL_LINK_NOARG(), SfxViewShell::JumpToMark(), SfxApplication::LoadTemplate(), SfxApplication::MiscExec_Impl(), SfxApplication::NewDocExec_Impl(), SfxViewFrame::Notify(), SfxVersionDialog::Open_Impl(), SfxRecordingFloat_Impl::SfxRecordingFloat_Impl(), and SfxRecordingFloatWrapper_Impl::~SfxRecordingFloatWrapper_Impl().

◆ ExecutePopup() [1/2]

void SfxDispatcher::ExecutePopup ( const OUString &  rResName,
vcl::Window pWin = nullptr,
const Point pPos = nullptr 
)

◆ ExecutePopup() [2/2]

void SfxDispatcher::ExecutePopup ( vcl::Window pWin = nullptr,
const Point pPosPixel = nullptr 
)
static

◆ fillPopupMenu()

boost::property_tree::ptree SfxDispatcher::fillPopupMenu ( const rtl::Reference< VCLXPopupMenu > &  rMenu)
static

Definition at line 1832 of file dispatch.cxx.

Referenced by ExecutePopup().

◆ FillState_()

bool SfxDispatcher::FillState_ ( const SfxSlotServer rSvr,
SfxItemSet rState,
const SfxSlot pRealSlot 
)
private

Helper method to obtain the status of the <Slot-Server>s rSvr.

The required slots IDs (partly converted to Which-IDs of the pool) must be present in rstate.

The SfxDispatcher is flushed before the query.

Parameters
rSvrSlot-Server to query
rStateSfxItemSet to be filled
pRealSlotThe actual Slot if possible

Definition at line 1655 of file dispatch.cxx.

References SfxItemSet::Count(), DBG_ASSERT, FillState_(), SfxInterface::GetClassName(), SfxItemIter::GetCurItem(), SfxShell::GetInterface(), SfxItemSet::GetPool(), GetShell(), SfxSlotServer::GetShellLevel(), SfxSlotServer::GetSlot(), SfxInterface::GetSlot(), SfxItemPool::GetSlotId(), SfxSlot::GetStateFnc(), SfxSlot::GetType(), IsInvalidItem(), IsLocked(), SfxItemIter::NextItem(), SAL_INFO_IF, SFX_STACK, SfxType::Type(), and xImp.

Referenced by FillState_(), and SfxBindings::Update_Impl().

◆ FindServer_()

bool SfxDispatcher::FindServer_ ( sal_uInt16  nSlot,
SfxSlotServer rServer 
)
private

This helper method searches for the <Slot-Server> which currently serves the nSlot.

As the result, rServe is filled accordingly.

If known the SfxInterface which is currently served by nSlot can be passed along.

The SfxDispatcher is flushed while searching for nSlot.

Parameters
nSlotSlot-Id to search for
rServer<SfxSlotServer>-Instance to fill
Returns
true The Slot was found, rServer is valid.

false The Slot is currently not served, rServer is invalid.

Definition at line 1535 of file dispatch.cxx.

References bReadOnly, CONTAINER, DISABLED, ENABLED_READONLY, FindServer_(), Flush(), SfxShell::GetDisableFlags(), SfxShell::GetInterface(), GetShell(), SfxInterface::GetSlot(), SfxViewShell::GetUIActiveClient(), SfxShell::GetVerbSlot_Impl(), i, IsLocked(), SfxSlot::IsMode(), IsSlotEnabledByFilter_Impl(), SfxSlot::nDisableFlags, SfxSlot::nFlags, NONE, READONLYDOC, SfxSlotServer::SetShellLevel(), SfxSlotServer::SetSlot(), SFX_STACK, and xImp.

Referenced by FindServer_(), GetShellAndSlot_Impl(), SfxStateCache::GetSlotServer(), and PostMsgHandler().

◆ Flush()

void SfxDispatcher::Flush ( void  )

◆ FlushImpl()

void SfxDispatcher::FlushImpl ( )
private

Helper method to execute the outstanding push and pop commands.

Definition at line 1286 of file dispatch.cxx.

References DBG_ASSERT, FlushImpl(), GetBindings(), i, InvalidateBindings_Impl(), SfxApplication::IsDowning(), NONE, None, SAL_INFO, SfxShell::SetDisableFlags(), SFX_STACK, SfxGetpApp(), and xImp.

Referenced by Flush(), and FlushImpl().

◆ GetBindings()

SfxBindings * SfxDispatcher::GetBindings ( ) const

This method returns a pointer to the <SfxBinding> Instance on which the SfxDispatcher is currently bound.

A SfxDispatcher is only bound to the SfxBindings when it is <UI-aktiv>. If it is not UI-active, a NULL-pointer is returned.

The returned pointer is only valid in the immediate context of the method call.

Definition at line 545 of file dispatch.cxx.

References xImp.

Referenced by Call_Impl(), SfxDispatchController_Impl::dispatch(), DoActivate_Impl(), FlushImpl(), InvalidateBindings_Impl(), Lock(), SfxViewFrame::Notify(), Pop(), SfxShell::PutItem(), SfxBindings::SetDispatcher(), SetQuietMode_Impl(), SetSlotFilter(), SfxShell::SetVerbs(), Update_Impl(), and ~SfxDispatcher().

◆ GetDisableFlags()

SfxDisableFlags SfxDispatcher::GetDisableFlags ( ) const

Definition at line 2085 of file dispatch.cxx.

References xImp.

◆ GetFrame()

SfxViewFrame * SfxDispatcher::GetFrame ( ) const

◆ GetModule()

SfxModule * SfxDispatcher::GetModule ( ) const

Definition at line 2090 of file dispatch.cxx.

References GetShell().

◆ GetObjectBarId()

ToolbarId SfxDispatcher::GetObjectBarId ( sal_uInt16  nPos) const

Definition at line 1915 of file dispatch.cxx.

References nPos, and xImp.

◆ GetReadOnly_Impl()

bool SfxDispatcher::GetReadOnly_Impl ( ) const

Definition at line 1954 of file dispatch.cxx.

References xImp.

Referenced by SfxViewFrame::Notify().

◆ GetShell()

SfxShell * SfxDispatcher::GetShell ( sal_uInt16  nIdx) const

Returns a pointer to the <SfxShell> which is at the position nIdx (from the top, last pushed is 0) on the stack.

Thus the SfxDispatcher is not flushed.

Is the stack not deep enough a NULL-Pointer is returned.

Definition at line 529 of file dispatch.cxx.

References xImp.

Referenced by SfxBindings::CreateSet_Impl(), SfxViewFrame::ExecHistory_Impl(), SfxBindings::Execute_Impl(), ExecutePopup(), FillState_(), FindServer_(), SfxControllerItem::GetCoreMetric(), GetModule(), GetShellAndSlot_Impl(), GetSlot(), PostMsgHandler(), SfxApplication::SetOptions(), SfxDispatchController_Impl::StateChanged(), SfxViewFrame::StateHistory_Impl(), and Update_Impl_().

◆ GetShellAndSlot_Impl()

bool SfxDispatcher::GetShellAndSlot_Impl ( sal_uInt16  nSlot,
SfxShell **  ppShell,
const SfxSlot **  ppSlot,
bool  bOwnShellsOnly,
bool  bRealSlot 
)

This method searches in SfxDispatcher after <SfxShell> , from the Slot Id nSlot currently being handled.

For this, the dispatcher is first flushed.

Parameters
nSlotthe searchable Slot-Id
ppShellthe SfxShell, which are currently handled the nSlot
ppSlotthe SfxSlot, which are currently handled the nSlot
Returns
int sal_True The SfxShell was found, ppShell and ppSlot are valid.

sal_False The SfxShell was not found, ppShell and ppSlot are invalid.

Definition at line 696 of file dispatch.cxx.

References FindServer_(), Flush(), GetShell(), GetShellAndSlot_Impl(), SfxSlotServer::GetShellLevel(), SfxSlotServer::GetSlot(), SFX_STACK, and xImp.

Referenced by SfxDispatchController_Impl::dispatch(), Execute(), ExecuteList(), GetShellAndSlot_Impl(), and QueryState().

◆ GetShellLevel()

sal_uInt16 SfxDispatcher::GetShellLevel ( const SfxShell rShell)

Determines the position of a given SfxShell in the stack of the dispatcher.

If possible this is flushed before.

[Return value]

sal_uInt16 == USRT_MAX The SfxShell is not on this SfxDispatcher.

< USHRT_MAX Position of the SfxShell on the Dispatcher from the top count stating with 0.

Definition at line 510 of file dispatch.cxx.

References Flush(), GetShellLevel(), n, SFX_STACK, and xImp.

Referenced by GetShellLevel(), SfxBindings::InvalidateShell(), and SfxViewShell::PushSubShells_Impl().

◆ GetSlot()

const SfxSlot * SfxDispatcher::GetSlot ( const OUString &  rCommand)

Definition at line 769 of file dispatch.cxx.

References Flush(), GetShell(), SfxInterface::GetSlot(), i, and xImp.

◆ HideUI()

void SfxDispatcher::HideUI ( bool  bHide = true)

◆ InvalidateBindings_Impl()

void SfxDispatcher::InvalidateBindings_Impl ( bool  bModify)

◆ IsActive()

bool SfxDispatcher::IsActive ( const SfxShell rShell)

This method checks whether a particular <SfxShell> instance is on the SfxDispatcher.

Returns
true The SfxShell instance is on the SfxDispatcher. false The SfxShell instance is not on the SfxDispatcher.

Definition at line 180 of file dispatch.cxx.

References CheckVirtualStack().

Referenced by SfxViewShell::AddSubShell(), and SfxViewShell::RemoveSubShell().

◆ IsAppDispatcher()

bool SfxDispatcher::IsAppDispatcher ( ) const

With this method it can be determined if the SfxDispacher is the applications dispatcher.

Returns
bool it is the application dispatcher.

Definition at line 206 of file dispatch.cxx.

References xImp.

Referenced by DoActivate_Impl(), DoDeactivate_Impl(), and InvalidateBindings_Impl().

◆ IsFlushed()

bool SfxDispatcher::IsFlushed ( ) const

This method checks if the stack of the SfxDispatchers is flushed, or if push- or pop- commands are pending.

Definition at line 145 of file dispatch.cxx.

References xImp.

Referenced by SfxBindings::NextJob_Impl().

◆ IsLocked()

bool SfxDispatcher::IsLocked ( ) const

With this method it can be determined whether the SfxDispatcher is locked or unlocked.

A locked SfxDispatcher does not perform <SfxRequest>s and no longer provides any status information. It behaves as if all the slots are disabled.

The dispatcher is also marked as blocked, if all Dispatcher are locked (<SfxApplication::LockDispatcher()>) or the associated top frame is in the modal-mode and if the specified slot are handled as frame-specific (ie, not served by the application).

Definition at line 196 of file dispatch.cxx.

References xImp.

Referenced by SfxDispatchController_Impl::dispatch(), Execute(), Execute_(), ExecuteList(), FillState_(), FindServer_(), and PostMsgHandler().

◆ IsReadOnlyShell_Impl()

bool SfxDispatcher::IsReadOnlyShell_Impl ( sal_uInt16  nShell) const

Definition at line 2016 of file dispatch.cxx.

References xImp.

Referenced by Update_Impl_().

◆ IsSlotEnabledByFilter_Impl()

SfxSlotFilterState SfxDispatcher::IsSlotEnabledByFilter_Impl ( sal_uInt16  nSID) const

Searches for 'nSID' in the Filter set by <SetSlotFilter()> and returns sal_True, if the SIDis allowed, or sal_False, if it is disabled by the Filter.

Returns
0 => disabled 1 => enabled 2 => enabled even if ReadOnlyDoc

Definition at line 1497 of file dispatch.cxx.

References DISABLED, ENABLED, ENABLED_READONLY, SfxCompareSIDs_Impl(), and xImp.

Referenced by FindServer_().

◆ IsUpdated_Impl()

bool SfxDispatcher::IsUpdated_Impl ( ) const

Definition at line 2073 of file dispatch.cxx.

References xImp.

Referenced by SfxViewFrame::Notify().

◆ Lock()

void SfxDispatcher::Lock ( bool  bLock)

With this method the SfxDispatcher can be locked and released.

A locked SfxDispatcher does not perform <SfxRequest>s and does no longer provide status information. It behaves as if all the slots were disabled.

Definition at line 1895 of file dispatch.cxx.

References GetBindings(), i, SfxBindings::InvalidateAll(), and xImp.

Referenced by SfxViewFrame::Close(), and SfxBaseController::ConnectSfxFrame_Impl().

◆ Pop()

void SfxDispatcher::Pop ( SfxShell rShell,
SfxDispatcherPopFlags  nMode = SfxDispatcherPopFlags::NONE 
)

With this method, one or more <SfxShell> are popped from the SfxDispatcher.

The SfxShell is marked for popping and a timer is set up. Only when the timer has reached the end, the pop is actually performed ( <SfxDispatcher::Flush()> ) and the <SfxBindings> is invalidated. While the timer is running the opposing push and pop commands on one SfxShell cancel each other out.

Parameters
rShellthe stack to take the SfxShell instance.
nModeSfxDispatcherPopFlags::POP_UNTIL Also all 'rShell' of SfxShells are taken from the stack.

SfxDispatcherPopFlags::POP_DELETE All SfxShells actually taken from the stack will be deleted.

SfxDispatcherPopFlags::PUSH (InPlace use only) The Shell is pushed.

Definition at line 380 of file dispatch.cxx.

References DBG_ASSERT, GetBindings(), SfxInterface::GetClassName(), SfxShell::GetInterface(), SfxApplication::IsDowning(), POP_DELETE, POP_UNTIL, PUSH, SAL_INFO, SAL_STREAM, SfxGetpApp(), and xImp.

Referenced by Push(), SfxViewShell::PushSubShells_Impl(), and SfxViewShell::RemoveSubShell().

◆ PostMsgHandler()

void SfxDispatcher::PostMsgHandler ( std::unique_ptr< SfxRequest pReq)
private

Helper method to receive the asynchronously executed <SfxRequest>s.

why bRecord?

Definition at line 971 of file dispatch.cxx.

References Call_Impl(), DBG_ASSERT, FindServer_(), Flush(), GetShell(), SfxSlotServer::GetShellLevel(), SfxSlotServer::GetSlot(), IsLocked(), PostMsgHandler(), SFX_STACK, and xImp.

Referenced by Construct_Impl(), and PostMsgHandler().

◆ Push()

void SfxDispatcher::Push ( SfxShell rShell)

With this method, a <SfxShell> pushed on to the SfxDispatcher.

The SfxShell is first marked for push and a timer is set up. First when the timer has counted down to zero the push ( <SfxDispatcher::Flush()> ) is actually performed and the <SfxBindings> is invalidated. While the timer is counting down the opposing push and pop commands on the same SfxShell are leveled out.

Definition at line 168 of file dispatch.cxx.

References Pop(), and PUSH.

Referenced by SfxViewShell::AddSubShell(), SfxBaseController::ConnectSfxFrame_Impl(), and SfxViewShell::PushSubShells_Impl().

◆ QueryState() [1/3]

SfxItemState SfxDispatcher::QueryState ( sal_uInt16  nSID,
const SfxPoolItem *&  rpState 
)

◆ QueryState() [2/3]

SfxItemState SfxDispatcher::QueryState ( sal_uInt16  nSID,
css::uno::Any &  rAny 
)

◆ QueryState() [3/3]

template<class T >
SfxItemState SfxDispatcher::QueryState ( TypedWhichId< T >  nSID,
const T *&  rpState 
)
inline

Definition at line 157 of file dispatch.hxx.

◆ RemoveShell_Impl()

void SfxDispatcher::RemoveShell_Impl ( SfxShell rShell)

◆ SetDisableFlags()

void SfxDispatcher::SetDisableFlags ( SfxDisableFlags  nFlags)

Definition at line 2078 of file dispatch.cxx.

References xImp.

Referenced by SfxBaseModel::createViewController(), and SfxViewFrame::ReleaseObjectShell_Impl().

◆ SetMenu_Impl()

void SfxDispatcher::SetMenu_Impl ( )

◆ SetQuietMode_Impl()

void SfxDispatcher::SetQuietMode_Impl ( bool  bOn)

With 'bOn' the Dispatcher is quasi dead and transfers everything to the Parent-Dispatcher.

Definition at line 1962 of file dispatch.cxx.

References GetBindings(), SfxBindings::InvalidateAll(), and xImp.

Referenced by SfxViewFrame::Construct_Impl().

◆ SetReadOnly_Impl()

void SfxDispatcher::SetReadOnly_Impl ( bool  bOn)

Definition at line 1949 of file dispatch.cxx.

References xImp.

Referenced by SfxViewFrame::Notify().

◆ SetSlotFilter()

void SfxDispatcher::SetSlotFilter ( SfxSlotFilterState  nEnable = SfxSlotFilterState::DISABLED,
o3tl::span< sal_uInt16 const >  pSIDs = o3tl::span<sal_uInt16 const>() 
)

With this method a filter set, the target slots can be enabled or disabled.

The passed array must be retained until the destructor or the next <SetSlotFilter()>, it is not deleted from the dispatcher, so it can thus be static.

In read-only documents the quasi ReadOnlyDoc Flag of slots can be overturned by the use of 'bEnable == 2', so this will be displayed again. On the other slots it has no effect.

HACK(here should be used an enum) ???

Parameters
nEnable1==true: only enable specified slots, disable all other 0==false: disable specified slots, first enable all other
nCountNumber of SIDs in the following Array
pSIDssorted Array of 'nCount' SIDs

[Example]

Targeted disabling of Slots 1, 2 and 3:

static sal_uInt16 const pSIDs[] = { 1, 2, 3 };
pDisp->SetSlotFilter( sal_False, sizeof(pSIDs)/sizeof(sal_uInt16), pSIDs );

only permit Slots 5, 6 and 7:

static sal_uInt16 const pSIDs[] = { 5, 6, 7 };
pDisp->SetSlotFilter( sal_True, sizeof(pSIDs)/sizeof(sal_uInt16), pSIDs );

Turn-off Filter:

pDisp->SetSlotFilter();

Definition at line 1465 of file dispatch.cxx.

References DBG_ASSERT, GetBindings(), SfxBindings::InvalidateAll(), n, o3tl::span< typename T >::size(), and xImp.

◆ Update_Impl()

void SfxDispatcher::Update_Impl ( bool  bForce = false)

◆ Update_Impl_()

void SfxDispatcher::Update_Impl_ ( bool  bUIActive,
bool  bIsMDIApp,
bool  bIsIPOwner,
SfxWorkWindow pTaskWin 
)
private

Friends And Related Function Documentation

◆ SfxApplication

friend class SfxApplication
friend

Definition at line 76 of file dispatch.hxx.

◆ SfxBindings

friend class SfxBindings
friend

Definition at line 78 of file dispatch.hxx.

◆ SfxHelp

friend class SfxHelp
friend

Definition at line 81 of file dispatch.hxx.

◆ SfxPopupMenuManager

friend class SfxPopupMenuManager
friend

Definition at line 80 of file dispatch.hxx.

◆ SfxStateCache

friend class SfxStateCache
friend

Definition at line 79 of file dispatch.hxx.

◆ SfxViewFrame

friend class SfxViewFrame
friend

Definition at line 77 of file dispatch.hxx.

Member Data Documentation

◆ xImp

std::unique_ptr<SfxDispatcher_Impl> SfxDispatcher::xImp
private

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