25#include <osl/diagnose.h>
34#include <com/sun/star/frame/XDispatch.hpp>
35#include <com/sun/star/frame/XDispatchProvider.hpp>
36#include <com/sun/star/frame/DispatchResultState.hpp>
56#include <unordered_map>
64#define TIMEOUT_FIRST 300
65#define TIMEOUT_UPDATING 20
82 std::vector<SfxFoundCache_Impl>
maData;
105 css::uno::Reference< css::frame::XDispatchRecorder >
xRecorder;
106 css::uno::Reference< css::frame::XDispatchProvider >
xProv;
109 std::vector<std::unique_ptr<SfxStateCache>>
pCaches;
123 std::unordered_map< sal_uInt16, bool >
129 pDispatcher(nullptr),
134 pImpl->bAllMsgDirty =
true;
135 pImpl->bContextChanged =
false;
136 pImpl->bMsgDirty =
true;
137 pImpl->bAllDirty =
true;
138 pImpl->nCachedFunc1 = 0;
139 pImpl->nCachedFunc2 = 0;
140 pImpl->bCtrlReleased =
false;
141 pImpl->bFirstRound =
false;
142 pImpl->bInNextJob =
false;
143 pImpl->bInUpdate =
false;
144 pImpl->pSubBindings =
nullptr;
169 pImpl->pSubBindings =
nullptr;
173 pImpl->aAutoTimer.Stop();
177 pImpl->pCaches.clear();
179 pImpl->mxWorkWin.reset();
188 for ( nCache = 0; nCache <
nCount; ++nCache )
192 sal_uInt16 nSlotId = pCache->
GetId();
195 std::size_t nNewCount =
pImpl->pCaches.size();
199 if ( nCache >= nNewCount ||
200 nSlotId !=
pImpl->pCaches[nCache]->GetId() )
207 for ( nCache =
pImpl->pCaches.size(); nCache > 0; --nCache )
215 pCtrl; pCtrl = pNext )
225 pImpl->pCaches.erase(
pImpl->pCaches.begin() + nCache - 1);
234 if (
pImpl->mxWorkWin )
235 pImpl->mxWorkWin->HidePopups_Impl( bHide );
252 const SfxSlot *pRealSlot =
nullptr;
255 std::optional<SfxItemSet> pSet =
CreateSet_Impl(rCache, pRealSlot, &pMsgServer, aFound);
256 bool bUpdated =
false;
260 if ( rDispat.
FillState_( *pMsgServer, *pSet, pRealSlot ) )
266 sal_uInt16 nWhich = rFound.
nWhichId;
268 SfxItemState eState = pSet->GetItemState(nWhich,
true, &pItem);
270 pItem = &pSet->Get(nWhich);
288 for (
auto const& slot :
pImpl->m_aInvalidateSlots)
291 pImpl->m_aInvalidateSlots.clear();
297 pImpl->m_aInvalidateSlots[
nId] =
true;
309 if (
pImpl->pSubBindings )
316 pImpl->bInUpdate =
true;
317 if (
pImpl->bMsgDirty )
325 bool bInternalUpdate =
true;
332 if ( bInternalUpdate )
338 pImpl->bInUpdate =
false;
344 pCache->
SetState(SfxItemState::DISABLED,
nullptr);
345 pImpl->bInUpdate =
false;
353 pImpl->bAllDirty =
false;
356 pImpl->bInUpdate =
false;
363 if (
pImpl->pSubBindings )
364 pImpl->pSubBindings->Update();
372 pImpl->bInUpdate =
true;
377 pImpl->bInUpdate =
false;
399 if (
pImpl->bMsgDirty )
416 pCache->
SetState( SfxItemState::DEFAULT, pItem );
437 if (
pImpl->bMsgDirty )
442 "cannot set items with which-id" );
449 pCache->
SetState( SfxItemState::DEFAULT, &rItem );
460 if ( !pCache &&
pImpl->pSubBindings )
461 return pImpl->pSubBindings->GetAnyStateCache_Impl(
nId );
483 const std::size_t nStart = ( pPos ? *pPos : 0 );
486 if ( nPos < pImpl->pCaches.size() &&
503 DBG_ASSERT( !
pImpl->bInUpdate,
"SfxBindings::Invalidate while in update" );
505 if (
pImpl->pSubBindings )
506 pImpl->pSubBindings->InvalidateAll( bWithMsg );
510 (
pImpl->bAllDirty && ( !bWithMsg ||
pImpl->bAllMsgDirty ) ) ||
516 pImpl->bAllMsgDirty =
pImpl->bAllMsgDirty || bWithMsg;
517 pImpl->bMsgDirty =
pImpl->bMsgDirty ||
pImpl->bAllMsgDirty || bWithMsg;
518 pImpl->bAllDirty =
true;
520 for (std::unique_ptr<SfxStateCache>& pCache :
pImpl->pCaches)
521 pCache->Invalidate(bWithMsg);
526 pImpl->aAutoTimer.Stop();
528 pImpl->aAutoTimer.Start();
535 const sal_uInt16* pIds
539 if (
pImpl->bInUpdate )
542 while ( pIds[
i] != 0 )
545 if (
pImpl->pSubBindings )
546 pImpl->pSubBindings->Invalidate( pIds );
550 if (
pImpl->pSubBindings )
551 pImpl->pSubBindings->Invalidate( pIds );
559 *pIds &&
n <
pImpl->pCaches.size();
564 if ( pCache->
GetId() == *pIds )
570 assert( *pIds > *(pIds-1) );
577 pImpl->aAutoTimer.Stop();
579 pImpl->aAutoTimer.Start();
597 DBG_ASSERT( !
pImpl->bInUpdate,
"SfxBindings::Invalidate while in update" );
599 if (
pImpl->pSubBindings )
600 pImpl->pSubBindings->InvalidateShell( rSh, bDeep );
617 if ( nLevel == USHRT_MAX )
620 for (std::unique_ptr<SfxStateCache>& pCache :
pImpl->pCaches)
625 pCache->Invalidate(
false);
630 pImpl->aAutoTimer.Stop();
632 pImpl->aAutoTimer.Start();
633 pImpl->bFirstRound =
true;
643 if (
pImpl->bInUpdate )
646 if (
pImpl->pSubBindings )
647 pImpl->pSubBindings->Invalidate(
nId );
651 if (
pImpl->pSubBindings )
652 pImpl->pSubBindings->Invalidate(
nId );
664 pImpl->aAutoTimer.Stop();
666 pImpl->aAutoTimer.Start();
679 DBG_ASSERT( !
pImpl->bInUpdate,
"SfxBindings::Invalidate while in update" );
681 if (
pImpl->pSubBindings )
682 pImpl->pSubBindings->Invalidate(
nId, bWithItem, bWithMsg );
701 pImpl->aAutoTimer.Stop();
703 pImpl->aAutoTimer.Start();
711 if (
pImpl->nCachedFunc1 <
pImpl->pCaches.size() &&
714 return pImpl->nCachedFunc1;
716 if (
pImpl->nCachedFunc2 <
pImpl->pCaches.size() &&
720 std::swap(
pImpl->nCachedFunc1,
pImpl->nCachedFunc2);
721 return pImpl->nCachedFunc1;
725 if (
pImpl->pCaches.size() <= nStartSearchAt )
729 if (
pImpl->pCaches.size() == (nStartSearchAt+1) )
731 return pImpl->pCaches[nStartSearchAt]->GetId() >=
nId ? 0 : 1;
733 std::size_t nLow = nStartSearchAt;
734 std::size_t nMid = 0;
735 std::size_t nHigh = 0;
737 nHigh =
pImpl->pCaches.size() - 1;
738 while ( !bFound && nLow <= nHigh )
740 nMid = (nLow + nHigh) >> 1;
741 DBG_ASSERT( nMid < pImpl->pCaches.size(),
"bsearch is buggy" );
742 int nDiff =
static_cast<int>(
nId) -
static_cast<int>( (
pImpl->pCaches[nMid])->GetId() );
748 else if ( nDiff > 0 )
756 std::size_t
nPos = bFound ? nMid : nLow;
757 DBG_ASSERT( nPos <= pImpl->pCaches.size(),
"" );
759 nId <= pImpl->pCaches[
nPos]->GetId(),
"" );
763 nId < pImpl->pCaches[
nPos+1]->GetId(),
"" );
783 DBG_ASSERT( !
pImpl->bInNextJob,
"SfxBindings::Register while status-updating" );
791 pImpl->pCaches.insert(
pImpl->pCaches.begin() +
nPos, std::make_unique<SfxStateCache>(
nId) );
798 pImpl->bMsgDirty =
true;
804 pImpl->pCaches[
nPos]->SetInternalController( &rItem );
816 DBG_ASSERT( !
pImpl->bInNextJob,
"SfxBindings::Release while status-updating" );
823 if ( pCache && pCache->
GetId() ==
nId )
833 if ( pItem == &rItem )
850 pImpl->bCtrlReleased =
true;
872 return ( pRet !=
nullptr );
876 const SfxPoolItem **ppInternalArgs,
bool bGlobalOnly )
885 return pBind->
Execute_Impl(
nId, ppItems, nModi, nCallMode, ppInternalArgs, bGlobalOnly );
886 pBind = pBind->
pImpl->pSubBindings;
894 std::unique_ptr<SfxStateCache> xCache;
900 pCache = xCache.get();
906 DBG_ASSERT( !ppInternalArgs,
"Internal args get lost when dispatched!" );
917 std::unique_ptr<SfxPoolItem> pPool;
918 if ( eRet == css::frame::DispatchResultState::DONTKNOW )
921 pPool.reset(
new SfxBoolItem(
nId, eRet == css::frame::DispatchResultState::SUCCESS) );
923 auto pTemp = pPool.get();
929 if (
pImpl->bMsgDirty )
947 if (
dynamic_cast< const SfxModule *
>( pShell ) ==
nullptr &&
dynamic_cast< const SfxApplication *
>( pShell ) ==
nullptr &&
dynamic_cast< const SfxViewFrame *
>( pShell ) ==
nullptr )
956 if ( ppInternalArgs )
959 for (
const SfxPoolItem **pArg = ppInternalArgs; *pArg; ++pArg )
984 const sal_uInt16 nSlotId = pSlot->
GetSlotId();
989 sal_uInt16 nWhich = pSlot->
GetWhich(rPool);
992 (*pFunc)(pShell, aSet);
995 if ( eState == SfxItemState::DISABLED )
999 pOldItem = &aSet.
Get(nWhich);
1001 if ( SfxItemState::SET == eState ||
1002 ( SfxItemState::DEFAULT == eState &&
1006 if (
auto pOldBoolItem =
dynamic_cast< const SfxBoolItem *
>( pOldItem ) )
1009 bool bOldValue = pOldBoolItem->GetValue();
1010 std::unique_ptr<SfxBoolItem> pNewItem(
static_cast<SfxBoolItem*
>(pOldItem->Clone()));
1011 pNewItem->SetValue( !bOldValue );
1016 if (pOldEnumItem->HasBoolValue())
1019 std::unique_ptr<SfxEnumItemInterface> pNewItem(
1021 pNewItem->SetBoolValue(!pOldEnumItem->GetBoolValue());
1026 OSL_FAIL(
"Toggle only for Enums and Bools allowed" );
1029 else if ( SfxItemState::DONTCARE == eState )
1033 DBG_ASSERT( pNewItem,
"Toggle to slot without ItemFactory" );
1034 pNewItem->SetWhich( nWhich );
1036 if (
auto pNewBoolItem =
dynamic_cast<SfxBoolItem *
>( pNewItem.get() ) )
1039 pNewBoolItem->SetValue(
true );
1044 if (pEnumItem->HasBoolValue())
1047 pEnumItem->SetBoolValue(
true);
1052 OSL_FAIL(
"Toggle only for Enums and Bools allowed" );
1056 OSL_FAIL(
"suspicious Toggle-Slot" );
1072 if (
pImpl->bAllMsgDirty )
1076 pImpl->bContextChanged =
false;
1079 pImpl->bContextChanged =
true;
1082 for (
size_t i = 0;
i <
pImpl->pCaches.size(); ++
i)
1087 pImpl->bMsgDirty =
pImpl->bAllMsgDirty =
false;
1101 DBG_ASSERT( !
pImpl->bMsgDirty,
"CreateSet_Impl with dirty MessageServer" );
1108 pRealSlot =
nullptr;
1109 *pMsgServer = pMsgSvr;
1120 pRealSlot = pMsgSvr->
GetSlot();
1131 std::size_t nCachePos =
pImpl->nMsgPos;
1135 while ( pSibling > pRealSlot )
1142 if ( pSiblingCache )
1153 bool bSameMethod = pSiblingCache && pFnc == pSiblingFnc;
1155 if ( bInsert && bSameMethod )
1159 pSibling, *pSiblingCache);
1170 while (
i < rFound.
size() )
1172 const sal_uInt16 nWhich1 = rFound[
i].nWhichId;
1174 for ( ;
i < rFound.
size()-1; ++
i )
1175 if ( rFound[
i].nWhichId+1 != rFound[
i+1].nWhichId )
1177 const sal_uInt16 nWhich2 = rFound[
i++].nWhichId;
1178 ranges = ranges.
MergeRange(nWhich1, nWhich2);
1200 if ( SfxItemState::DONTCARE == eState )
1205 else if ( SfxItemState::DEFAULT == eState &&
1210 rCache.
SetState( SfxItemState::UNKNOWN, &aVoid );
1212 else if ( SfxItemState::DISABLED == eState )
1213 rCache.
SetState(SfxItemState::DISABLED,
nullptr);
1215 rCache.
SetState(SfxItemState::DEFAULT, pItem);
1220 NextJob_Impl(pTimer);
1225 const unsigned MAX_INPUT_DELAY = 200;
1250 if (
pImpl->bMsgDirty )
1256 pImpl->bAllDirty =
false;
1260 bool bPreEmptive = pTimer;
1261 sal_uInt16 nLoops = 10;
1262 pImpl->bInNextJob =
true;
1267 bool bJobDone =
false;
1271 DBG_ASSERT( pCache,
"invalid SfxStateCache-position in job queue" );
1284 if ( bJobDone &&
pImpl->bFirstRound )
1290 pImpl->bFirstRound =
false;
1294 if ( bWasDirty && !bJobDone && bPreEmptive && (--nLoops == 0) )
1296 pImpl->bInNextJob =
false;
1304 pImpl->aAutoTimer.Stop();
1307 pImpl->bInNextJob =
false;
1317 std::setw(std::min(
nRegLevel, sal_uInt16(8))) <<
' ' <<
"this = " <<
this
1318 <<
" Level = " <<
nRegLevel <<
" SfxBindings::EnterRegistrations "
1320 ?
SAL_STREAM(
"File: " << pFile <<
" Line: " << nLine) :
""));
1323 if (
pImpl->pSubBindings )
1325 pImpl->pSubBindings->ENTERREGISTRATIONS();
1328 pImpl->pSubBindings->pImpl->nOwnRegLevel--;
1331 pImpl->pSubBindings->nRegLevel =
nRegLevel +
pImpl->pSubBindings->pImpl->nOwnRegLevel + 1;
1334 pImpl->nOwnRegLevel++;
1340 pImpl->aAutoTimer.Stop();
1343 pImpl->nCachedFunc1 = 0;
1344 pImpl->nCachedFunc2 = 0;
1347 pImpl->bCtrlReleased =
false;
1360 if (
pImpl->pSubBindings &&
pImpl->pSubBindings->nRegLevel >
pImpl->pSubBindings->pImpl->nOwnRegLevel )
1366 pImpl->pSubBindings->pImpl->nOwnRegLevel++;
1367 pImpl->pSubBindings->LEAVEREGISTRATIONS();
1370 pImpl->nOwnRegLevel--;
1375 if (
pImpl->bContextChanged )
1377 pImpl->bContextChanged =
false;
1383 if (
pImpl->bCtrlReleased )
1385 for ( sal_uInt16 nCache =
pImpl->pCaches.size(); nCache > 0; --nCache )
1394 pImpl->pCaches.erase(
pImpl->pCaches.begin() + nCache - 1);
1403 if ( !
pImpl->pCaches.empty() )
1405 pImpl->aAutoTimer.Stop();
1407 pImpl->aAutoTimer.Start();
1413 std::setw(std::min(
nRegLevel, sal_uInt16(8))) <<
' ' <<
"this = " <<
this
1414 <<
" Level = " <<
nRegLevel <<
" SfxBindings::LeaveRegistrations "
1416 ?
SAL_STREAM(
"File: " << pFile <<
" Line: " << nLine) :
""));
1433 pBind = pBind->
pImpl->pSubBindings;
1439 css::uno::Reference < css::frame::XDispatchProvider > xProv;
1448 if (
pImpl->pSubBindings &&
pImpl->pSubBindings->pDispatcher != pOldDispat )
1450 OSL_FAIL(
"SubBindings already set before activating!" );
1451 pImpl->pSubBindings->ENTERREGISTRATIONS();
1458 if (
pImpl->pSubBindings &&
pImpl->pSubBindings->pDispatcher != pOldDispat )
1460 OSL_FAIL(
"SubBindings still set even when deactivating!" );
1461 pImpl->pSubBindings->LEAVEREGISTRATIONS();
1471 while ( pBind && pBind !=
this )
1473 if ( !pBind->
pImpl->pSubBindings )
1479 pBind = pBind->
pImpl->pSubBindings;
1495 if (
pImpl->pSubBindings )
1496 pImpl->pSubBindings->StartUpdate_Impl( bComplete );
1509 css::uno::Reference< css::frame::XDispatch > xDisp;
1513 if ( xDisp.is() || !pCache )
1516 if ( !pSlot || pSlot->
pUnoName.isEmpty() )
1517 return SfxItemState::DISABLED;
1519 css::util::URL
aURL;
1520 OUString aCmd(
".uno:" );
1521 aURL.Protocol = aCmd;
1524 aURL.Complete = aCmd;
1528 xDisp =
pImpl->xProv->queryDispatch(
aURL, OUString(), 0 );
1534 bool bDeleteCache =
false;
1539 bDeleteCache =
true;
1544 xDisp->addStatusListener( xBind,
aURL );
1545 if ( !xBind->GetStatus().IsEnabled )
1547 eState = SfxItemState::DISABLED;
1551 css::uno::Any aAny = xBind->GetStatus().State;
1552 const css::uno::Type& aType = aAny.getValueType();
1562 sal_uInt16 nTemp = 0;
1568 sal_uInt32 nTemp = 0;
1582 xDisp->removeStatusListener( xBind,
aURL );
1600 if ( eState == SfxItemState::SET )
1602 DBG_ASSERT( pItem,
"SfxItemState::SET but no item!" );
1604 rpState.reset(pItem->
Clone());
1606 else if ( eState == SfxItemState::DEFAULT && pItem )
1608 rpState.reset(pItem->
Clone());
1622 if (
pImpl->pSubBindings )
1623 pImpl->pSubBindings->QueryControlState( nSlot, rState );
1629 if (
pImpl->bMsgDirty )
1646 css::uno::Reference<css::frame::XDispatch>
xDispatch =
1647 pImpl->xProv->queryDispatch(
aURL, OUString(), 0);
1655 return pDispatch->
GetId();
1660 if (
pImpl->pSubBindings )
1662 pImpl->pSubBindings->SetDispatchProvider_Impl( css::uno::Reference< css::frame::XDispatchProvider > () );
1665 pImpl->pSubBindings = pSub;
1669 pImpl->pSubBindings->SetDispatchProvider_Impl(
pImpl->xProv );
1675 return pImpl->pSubBindings;
1680 pImpl->mxWorkWin = std::move(xWork);
1685 return pImpl->mxWorkWin.get();
1690 bool bInUpdate =
pImpl->bInUpdate;
1691 if ( !bInUpdate &&
pImpl->pSubBindings )
1692 bInUpdate =
pImpl->pSubBindings->IsInUpdate();
1714 const css::uno::Reference< css::frame::XFrame >
xFrame(
pImpl->xProv, css::uno::UNO_QUERY );
1723 bool bInvalidate = ( rProv !=
pImpl->xProv );
1726 pImpl->xProv = rProv;
1730 if (
pImpl->pSubBindings )
1731 pImpl->pSubBindings->SetDispatchProvider_Impl(
pImpl->xProv );
1736 return pImpl->xRecorder;
1741 pImpl->xRecorder = rRecorder;
1746 if ( !
pImpl->bInUpdate && ( !
pImpl->bContextChanged || !
pImpl->bAllMsgDirty ) )
1754 uno::Reference < frame::XDispatch > xRet;
1756 if ( pCache && !bMasterCommand )
1766 xRet.set( pDispatch );
1770 DBG_ASSERT( pCache,
"No cache for OfficeDispatch!" );
1771 if ( pCache && !bMasterCommand )
SfxApplication * SfxGetpApp()
IMPL_LINK(SfxBindings, NextJob, Timer *, pTimer, void)
#define ENTERREGISTRATIONS()
#define LEAVEREGISTRATIONS()
static sal_uInt64 GetLastInputInterval()
std::unique_ptr< SfxWorkWindow > mxWorkWin
css::uno::Reference< css::frame::XDispatchRecorder > xRecorder
css::uno::Reference< css::frame::XDispatchProvider > xProv
std::vector< std::unique_ptr< SfxStateCache > > pCaches
std::unordered_map< sal_uInt16, bool > m_aInvalidateSlots
SfxBindings * pSubBindings
void SetVisibleState(sal_uInt16 nId, bool bShow)
SfxDispatcher * pDispatcher
SAL_DLLPRIVATE SfxStateCache * GetStateCache(sal_uInt16 nId, std::size_t *pPos)
SAL_DLLPRIVATE void SetSubBindings_Impl(SfxBindings *)
void LeaveRegistrations(std::string_view pFile={}, int nLine=0)
SAL_DLLPRIVATE SfxWorkWindow * GetWorkWindow_Impl() const
std::unique_ptr< SfxBindings_Impl > pImpl
void SetState(const SfxItemSet &rSet)
SAL_DLLPRIVATE SfxDispatcher * GetDispatcher_Impl()
void QueryControlState(sal_uInt16 nSID, boost::property_tree::ptree &rState)
SAL_DLLPRIVATE void StartUpdate_Impl(bool bComplete=false)
SAL_DLLPRIVATE void SetDispatchProvider_Impl(const css::uno::Reference< css::frame::XDispatchProvider > &rFrame)
SAL_DLLPRIVATE std::optional< SfxItemSet > CreateSet_Impl(SfxStateCache &rCache, const SfxSlot *&pRealSlot, const SfxSlotServer **, SfxFoundCacheArr_Impl &)
void InvalidateShell(const SfxShell &rSh, bool bDeep=false)
sal_uInt16 EnterRegistrations(std::string_view pFile={}, int nLine=0)
SfxItemState QueryState(sal_uInt16 nSID, std::unique_ptr< SfxPoolItem > &rpState)
SAL_DLLPRIVATE void SetWorkWindow_Impl(std::unique_ptr< SfxWorkWindow >)
sal_uInt16 QuerySlotId(const css::util::URL &aURL)
SAL_DLLPRIVATE const SfxPoolItem * Execute_Impl(sal_uInt16 nSlot, const SfxPoolItem **pArgs, sal_uInt16 nModi, SfxCallMode nCall, const SfxPoolItem **pInternalArgs, bool bGlobalOnly=false)
SAL_DLLPRIVATE void AddSlotToInvalidateSlotsMap_Impl(sal_uInt16 nId)
bool Execute(sal_uInt16 nSlot, const SfxPoolItem **pArgs=nullptr, SfxCallMode nCall=SfxCallMode::SLOT)
SAL_DLLPRIVATE void DeleteControllers_Impl()
SAL_DLLPRIVATE void InvalidateSlotsInMap_Impl()
const SfxPoolItem * ExecuteSynchron(sal_uInt16 nSlot, const SfxPoolItem **pArgs=nullptr)
SAL_DLLPRIVATE SfxStateCache * GetAnyStateCache_Impl(sal_uInt16 nId)
css::uno::Reference< css::frame::XDispatch > GetDispatch(const SfxSlot *, const css::util::URL &aURL, bool bMasterCommand)
SAL_DLLPRIVATE bool NextJob_Impl(Timer const *pTimer)
SfxDispatcher * GetDispatcher() const
void Invalidate(sal_uInt16 nId)
SAL_DLLPRIVATE std::size_t GetSlotPos(sal_uInt16 nId, std::size_t nStartSearchAt=0)
css::uno::Reference< css::frame::XFrame > GetActiveFrame() const
SAL_DLLPRIVATE void RegisterInternal_Impl(SfxControllerItem &rBinding)
void Register(SfxControllerItem &rBinding)
SAL_DLLPRIVATE void UpdateSlotServer_Impl()
const css::uno::Reference< css::frame::XDispatchRecorder > & GetRecorder() const
SAL_DLLPRIVATE void Register_Impl(SfxControllerItem &rBinding, bool)
void Release(SfxControllerItem &rBinding)
SAL_DLLPRIVATE void Update_Impl(SfxStateCache &rCache)
SAL_DLLPRIVATE void ContextChanged_Impl()
void HidePopups(bool bHide=true)
SAL_DLLPRIVATE void SetRecorder_Impl(css::uno::Reference< css::frame::XDispatchRecorder > const &)
SAL_DLLPRIVATE SfxBindings * GetSubBindings_Impl() const
SAL_DLLPRIVATE void ClearCache_Impl(sal_uInt16 nSlotId)
static SAL_DLLPRIVATE void UpdateControllers_Impl(const SfxFoundCache_Impl &rFound, const SfxPoolItem *pItem, SfxItemState eItemState)
void SetActiveFrame(const css::uno::Reference< css::frame::XFrame > &rFrame)
void SetDispatcher(SfxDispatcher *pDisp)
void InvalidateAll(bool bWithMsg)
virtual ~SfxBindings() override
void Broadcast(const SfxHint &rHint)
SfxControllerItem * ChangeItemLink(SfxControllerItem *pNewLink)
SfxControllerItem * GetItemLink()
SAL_DLLPRIVATE void Update_Impl(bool bForce=false)
bool IsFlushed() const
This method checks if the stack of the SfxDispatchers is flushed, or if push- or pop- commands are pe...
SfxBindings * GetBindings() const
This method returns a pointer to the <SfxBinding> Instance on which the SfxDispatcher is currently bo...
bool FillState_(const SfxSlotServer &rServer, SfxItemSet &rState, const SfxSlot *pRealSlot)
Helper method to obtain the status of the <Slot-Server>s rSvr.
sal_uInt16 GetShellLevel(const SfxShell &rShell)
Determines the position of a given SfxShell in the stack of the dispatcher.
SfxViewFrame * GetFrame() const
Returns a pointer to the <SfxViewFrame> instance, which belongs to this SfxDispatcher.
SfxShell * 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...
void Execute_(SfxShell &rShell, const SfxSlot &rSlot, SfxRequest &rReq, SfxCallMode eCall)
This method performs a request for a cached <Slot-Server>.
SfxItemState QueryState(sal_uInt16 nSID, const SfxPoolItem *&rpState)
void Flush()
This method performs outstanding push- and pop- commands.
SfxFoundCache_Impl & operator[](size_t i)
std::vector< SfxFoundCache_Impl > maData
void push_back(SfxFoundCache_Impl p)
const css::uno::Reference< css::frame::XFrame > & GetFrameInterface() const
const SfxPoolItem * GetCurItem() const
const SfxPoolItem * NextItem()
sal_uInt16 GetSlotId(sal_uInt16 nWhich) const
static bool IsWhich(sal_uInt16 nId)
static bool IsSlot(sal_uInt16 nId)
SfxItemPool * GetPool() const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
bool AcceptStateUpdate() const
void SetMasterUnoCommand(bool bSet)
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const=0
const SfxPoolItem * GetReturnValue() const
const SfxItemSet * GetArgs() const
void SetSlot(sal_uInt16 nNewSlot)
void AppendItem(const SfxPoolItem &)
SfxCallMode GetCallMode() const
void SetModifier(sal_uInt16 nModi)
void SetInternalArgs_Impl(const SfxAllItemSet &rArgs)
The class SfxShell is the base class for all classes, which provide the functionality of the form <Sl...
SfxItemPool & GetPool() const
Each Subclass of SfxShell must reference a pool.
static SfxSlotPool & GetSlotPool(SfxViewFrame *pFrame=nullptr)
const SfxSlot * GetSlot(sal_uInt16 nId) const
const SfxSlot * GetSlot() const
sal_uInt16 GetShellLevel() const
sal_uInt16 GetSlotId() const
const SfxType * GetType() const
const SfxSlot * GetNextSlot() const
const OUString & GetUnoName() const
SfxStateFunc GetStateFnc() const
bool IsMode(SfxSlotMode nMode) const
SfxSlotKind GetKind() const
sal_uInt16 GetWhich(const SfxItemPool &rPool) const
const css::uno::Reference< css::frame::XDispatch > & GetInternalDispatch() const
void Invalidate(bool bWithSlot)
SfxControllerItem * GetItemLink() const
SfxControllerItem * ChangeItemLink(SfxControllerItem *pNewBinding)
bool IsControllerDirty() const
css::uno::Reference< css::frame::XDispatch > GetDispatch() const
void SetState(SfxItemState, const SfxPoolItem *, bool bMaybeDirty=false)
void SetCachedState(bool bAlways)
SfxControllerItem * GetInternalController() const
const SfxSlotServer * GetSlotServer(SfxDispatcher &rDispat, const css::uno::Reference< css::frame::XDispatchProvider > &xProv)
void SetInternalDispatch(const css::uno::Reference< css::frame::XDispatch > &rDisp)
void ReleaseInternalController()
void SetVisibleState(bool bShow)
void GetState(boost::property_tree::ptree &)
sal_Int16 Dispatch(const SfxItemSet *pSet, bool bForceSynchron)
SfxFrame & GetFrame() const
virtual SfxObjectShell * GetObjectShell() override
#define DBG_ASSERT(sCon, aError)
Reference< XDispatch > xDispatch
void DeleteItemOnIdle(std::unique_ptr< SfxPoolItem > pItem)
#define LINK(Instance, Class, Member)
#define SAL_STREAM(stream)
#define SAL_INFO(area, stream)
#define INVALID_POOL_ITEM
void(* SfxStateFunc)(SfxShell *, SfxItemSet &rSet)
SfxFoundCache_Impl(sal_uInt16 nW, const SfxSlot *pS, SfxStateCache &rC)
std::unique_ptr< SfxPoolItem > CreateItem() const
SAL_WARN_UNUSED_RESULT WhichRangesContainer MergeRange(sal_uInt16 nFrom, sal_uInt16 nTo) const
Reference< XFrame > xFrame