25#include <com/sun/star/uno/Reference.h>
26#include <com/sun/star/frame/XFrame.hpp>
27#include <com/sun/star/awt/XWindow.hpp>
28#include <com/sun/star/util/URL.hpp>
29#include <com/sun/star/util/URLTransformer.hpp>
30#include <com/sun/star/util/XURLTransformer.hpp>
31#include <com/sun/star/frame/XController.hpp>
32#include <com/sun/star/frame/XDispatchProvider.hpp>
33#include <com/sun/star/lang/XUnoTunnel.hpp>
34#include <com/sun/star/beans/PropertyValue.hpp>
35#include <com/sun/star/frame/status/ItemStatus.hpp>
36#include <com/sun/star/ui/XUIElementFactory.hpp>
37#include <com/sun/star/frame/status/Visibility.hpp>
62using namespace ::com::sun::star::frame::status;
78 Reference < XURLTransformer > xTrans( URLTransformer::create( ::comphelper::getProcessComponentContext() ) );
84 Reference < XModel >
xModel;
124 bool bShowStringItems )
128 pImpl->bShowString = bShowStringItems;
130 pImpl->nSlotId = nSlotID;
145 return pImpl->nTbxId;
149 return pImpl->nSlotId;
163 pImpl->pBox->SetItemWindow(
pImpl->nTbxId,
nullptr );
184 const std::type_info* aSlotType = pSlotPool->
GetSlotType( nSlotId );
191 return pFact->
pCtor( nSlotId, nTbxId, *pBox );
196 return pFact->
pCtor( nSlotId, nTbxId, *pBox );
233 ? SfxItemState::DISABLED
235 ? SfxItemState::DONTCARE
237 ? SfxItemState::UNKNOWN
238 : SfxItemState::DEFAULT;
242 const Reference< XDispatchProvider >& rProvider,
243 const OUString& rCommand,
244 Sequence< ::PropertyValue >
const & aArgs )
246 if ( rProvider.is() )
250 Reference < XURLTransformer > xTrans( URLTransformer::create( ::comphelper::getProcessComponentContext() ) );
251 xTrans->parseStrict( aTargetURL );
253 Reference < XDispatch >
xDispatch = rProvider->queryDispatch( aTargetURL, OUString(), 0 );
255 xDispatch->dispatch( aTargetURL, aArgs );
267 Reference < XDispatchProvider > xProvider(
xController, UNO_QUERY );
268 if ( xProvider.is() )
290 Reference < XDispatchProvider > xProvider(
xController, UNO_QUERY );
291 if ( xProvider.is() )
293 Reference < XDispatch > xDisp = xProvider->queryDispatch( rEvent.FeatureURL, OUString(), 0 );
297 pViewFrame = pDisp->GetDispatcher_Impl()->
GetFrame();
301 sal_uInt16 nSlotId = 0;
312 if ( rEvent.Requery )
317 std::unique_ptr<SfxPoolItem> pItem;
318 if ( rEvent.IsEnabled )
320 eState = SfxItemState::DEFAULT;
321 css::uno::Type aType = rEvent.State.getValueType();
326 eState = SfxItemState::UNKNOWN;
331 rEvent.State >>= bTemp ;
336 sal_uInt16 nTemp = 0;
337 rEvent.State >>= nTemp ;
342 sal_uInt32 nTemp = 0;
343 rEvent.State >>= nTemp ;
349 rEvent.State >>= sTemp ;
354 ItemStatus aItemStatus;
355 rEvent.State >>= aItemStatus;
358 if (tmpState != SfxItemState::UNKNOWN && tmpState != SfxItemState::DISABLED &&
359 tmpState != SfxItemState::DONTCARE &&
360 tmpState != SfxItemState::DEFAULT && tmpState != SfxItemState::SET)
361 throw css::uno::RuntimeException(
"unknown status");
368 rEvent.State >>= aVisibilityStatus;
377 pItem->SetWhich( nSlotId );
378 pItem->PutValue( rEvent.State, 0 );
393 Select(
static_cast<sal_uInt16
>(KeyModifier) );
428 DBG_ASSERT(
pImpl->pBox !=
nullptr,
"setting state to dangling ToolBox" );
431 pImpl->pBox->EnableItem(
GetId(), eState != SfxItemState::DISABLED );
438 case SfxItemState::DEFAULT:
441 if (
auto pBoolItem =
dynamic_cast< const SfxBoolItem*
>(pState) )
444 if ( pBoolItem->GetValue() )
446 nItemBits |= ToolBoxItemBits::CHECKABLE;
450 if (pEnumItem->HasBoolValue())
453 if (pEnumItem->GetBoolValue())
455 nItemBits |= ToolBoxItemBits::CHECKABLE;
458 else if (
pImpl->bShowString )
460 if (
auto pStringItem =
dynamic_cast< const SfxStringItem *
>( pState ) )
461 pImpl->pBox->SetItemText(
GetId(), pStringItem->GetValue() );
466 case SfxItemState::DONTCARE:
469 nItemBits |= ToolBoxItemBits::CHECKABLE;
477 pImpl->pBox->SetItemBits(
GetId(), nItemBits );
SfxApplication * SfxGetpApp()
SAL_DLLPRIVATE SfxTbxCtrlFactory * GetTbxCtrlFactory(const std::type_info &rSlotType, sal_uInt16 nSlotID) const
SAL_DLLPRIVATE void RegisterToolBoxControl_Impl(SfxModule *, const SfxTbxCtrlFactory &)
SAL_DLLPRIVATE SfxTbxCtrlFactory * GetTbxCtrlFactory(const std::type_info &rSlotType, sal_uInt16 nSlotID) const
SfxSlotPool * GetSlotPool() const
static SfxObjectShell * GetShellFromComponent(const css::uno::Reference< css::uno::XInterface > &xComp)
SfxModule * GetModule() const
virtual bool IsVoidItem() const
static SfxSlotPool & GetSlotPool(SfxViewFrame *pFrame=nullptr)
const std::type_info * GetSlotType(sal_uInt16 nSlotId) const
const SfxSlot * GetUnoSlot(const OUString &rUnoName) const
sal_uInt16 GetSlotId() const
const SfxType * GetType() const
SfxFrame & GetFrame() const
static css::uno::Reference< css::awt::XWindow > GetInterface(vcl::Window *pWindow)
static vcl::Window * GetWindow(const css::uno::Reference< css::awt::XWindow > &rxWindow)
#define DBG_ASSERT(sCon, aError)
Reference< XDispatch > xDispatch
bool IsInvalidItem(const SfxPoolItem *pItem)
SfxToolBoxControlCtor pCtor
std::unique_ptr< SfxPoolItem > CreateItem() const
Reference< XController > xController
Reference< XModel > xModel
rtl::Reference< svt::ToolboxController > SfxToolBoxControllerFactory(const Reference< XFrame > &rFrame, ToolBox *pToolbox, ToolBoxItemId nID, const OUString &aCommandURL)
SFX_IMPL_TOOLBOX_CONTROL_ARG(SfxToolBoxControl, SfxStringItem, true)