26#include <com/sun/star/frame/DispatchResultState.hpp>
27#include <com/sun/star/frame/XFrame.hpp>
28#include <com/sun/star/beans/PropertyValue.hpp>
52 : xDisp(
std::move( _xDisp ))
54 , pCache( pStateCache )
65 xDisp->removeStatusListener(
static_cast<css::frame::XStatusListener*
>(
this),
aURL );
76 css::uno::Reference< css::frame::XStatusListener > xKeepAlive(
this);
81 std::unique_ptr<SfxPoolItem> pItem;
88 else if (
aStatus.State.hasValue())
90 eState = SfxItemState::DEFAULT;
91 css::uno::Any aAny =
aStatus.State;
93 const css::uno::Type& aType = aAny.getValueType();
102 sal_uInt16 nTemp = 0;
108 sal_uInt32 nTemp = 0;
124 pItem->SetWhich(
nId );
125 pItem->PutValue( aAny, 0 );
135 eState = SfxItemState::UNKNOWN;
141 pCtrl->StateChangedAtToolBoxControl(
nId, eState, pItem.get() );
151 xDisp->removeStatusListener(
static_cast<css::frame::XStatusListener*
>(
this),
aURL);
153 catch (
const lang::DisposedException&)
165 sal_Int16 eRet = css::frame::DispatchResultState::DONTKNOW;
170 css::uno::Any aResult = xHelper->executeDispatch(
xDisp,
aURL, bForceSynchron, aProps);
172 css::frame::DispatchResultEvent
aEvent;
186 pInternalController(nullptr),
187 pController(nullptr),
188 pLastItem( nullptr ),
245 if ( !pSlot || pSlot->
pUnoName.isEmpty() )
254 OUString aCmd =
".uno:";
255 aURL.Protocol = aCmd;
258 aURL.Complete = aCmd;
262 css::uno::Reference< css::frame::XDispatch > xDisp = xProv->queryDispatch(
aURL, OUString(), 0 );
272 if ( pDispatcher == &rDispat || pDispatcher ==
SfxGetpApp()->GetAppDispatcher_Impl() )
291 css::uno::Reference < css::frame::XDispatchProvider > xFrameProv(
293 if ( xFrameProv != xProv )
330 boost::property_tree::ptree& rState
338 pCtrl->GetControlState(
nId, rState );
349 bool bDeleteItem(
false );
376 pCtrl->StateChangedAtToolBoxControl(
nId, eState, pState );
406 bool bBothAvailable =
pLastItem && pState &&
409 if ( bBothAvailable )
410 bNotify =
typeid(*pState) !=
typeid(*pLastItem) ||
424 pCtrl->StateChangedAtToolBoxControl(
nId, eState, pState );
481 return css::uno::Reference< css::frame::XDispatch > ();
488 sal_Int16 eRet = css::frame::DispatchResultState::DONTKNOW;
492 uno::Sequence < beans::PropertyValue > aArgs;
496 eRet =
mxDispatch->Dispatch( aArgs, bForceSynchron );
SfxApplication * SfxGetpApp()
void TransformItems(sal_uInt16 nSlotId, const SfxItemSet &rSet, uno::Sequence< beans::PropertyValue > &rArgs, const SfxSlot *pSlot)
css::uno::Reference< css::frame::XDispatch > xDisp
virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent &Event) override
BindDispatch_Impl(css::uno::Reference< css::frame::XDispatch > xDisp, css::util::URL aURL, SfxStateCache *pStateCache, const SfxSlot *pSlot)
css::frame::FeatureStateEvent aStatus
sal_Int16 Dispatch(const css::uno::Sequence< css::beans::PropertyValue > &aProps, bool bForceSynchron)
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
virtual void StateChangedAtToolBoxControl(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem *pState)
static SfxItemState GetItemState(const SfxPoolItem *pState)
SfxControllerItem * GetItemLink()
bool FindServer_(sal_uInt16 nId, SfxSlotServer &rServer)
This helper method searches for the <Slot-Server> which currently serves the nSlot.
SfxViewFrame * GetFrame() const
Returns a pointer to the <SfxViewFrame> instance, which belongs to this SfxDispatcher.
const css::uno::Reference< css::frame::XFrame > & GetFrameInterface() const
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const=0
static SfxSlotPool & GetSlotPool(SfxViewFrame *pFrame=nullptr)
const SfxSlot * GetSlot(sal_uInt16 nId) const
void SetSlot(const SfxSlot *pSlot)
const SfxSlot * GetSlot() const
const SfxType * GetType() const
const OUString & GetUnoName() const
SfxStateCache(const SfxStateCache &rOrig)=delete
void Invalidate(bool bWithSlot)
SfxControllerItem * GetItemLink() const
css::uno::Reference< css::frame::XDispatch > GetDispatch() const
void SetState(SfxItemState, const SfxPoolItem *, bool bMaybeDirty=false)
void SetCachedState(bool bAlways)
const SfxSlotServer * GetSlotServer(SfxDispatcher &rDispat, const css::uno::Reference< css::frame::XDispatchProvider > &xProv)
friend class BindDispatch_Impl
SfxControllerItem * pInternalController
void SetState_Impl(SfxItemState, const SfxPoolItem *, bool bMaybeDirty)
void SetVisibleState(bool bShow)
void GetState(boost::property_tree::ptree &)
sal_Int16 Dispatch(const SfxItemSet *pSet, bool bForceSynchron)
rtl::Reference< BindDispatch_Impl > mxDispatch
SfxControllerItem * pController
SfxFrame & GetFrame() const
#define DBG_ASSERT(sCon, aError)
#define TOOLS_WARN_EXCEPTION(area, stream)
bool IsInvalidItem(const SfxPoolItem *pItem)
std::unique_ptr< SfxPoolItem > CreateItem() const