21#include <com/sun/star/beans/PropertyAttribute.hpp>
22#include <com/sun/star/beans/PropertyValue.hpp>
23#include <com/sun/star/beans/XPropertySet.hpp>
24#include <com/sun/star/frame/XDispatchProvider.hpp>
25#include <com/sun/star/lang/DisposedException.hpp>
26#include <com/sun/star/lang/XMultiServiceFactory.hpp>
27#include <com/sun/star/frame/XLayoutManager.hpp>
28#include <com/sun/star/util/URLTransformer.hpp>
42using namespace ::
cppu;
43using namespace css::awt;
44using namespace css::uno;
45using namespace css::util;
46using namespace css::beans;
47using namespace css::lang;
48using namespace css::frame;
54 const Reference< XComponentContext >& rxContext,
55 const Reference< XFrame >&
xFrame,
56 OUString aCommandURL ) :
57 OPropertyContainer( GetBroadcastHelper() )
58 , m_bSupportVisible(
false )
59 , m_bInitialized(
false )
65 , m_aCommandURL(std::move( aCommandURL ))
73 css::beans::PropertyAttribute::TRANSIENT | css::beans::PropertyAttribute::READONLY,
74 &m_bSupportVisible,
cppu::UnoType<
decltype(m_bSupportVisible)>::get());
78 m_xUrlTransformer = URLTransformer::create( rxContext );
86 OPropertyContainer(GetBroadcastHelper())
87 , m_bSupportVisible(false)
88 , m_bInitialized( false )
98 css::beans::PropertyAttribute::TRANSIENT | css::beans::PropertyAttribute::READONLY,
124 xPropSet.set(
m_xFrame, UNO_QUERY );
131 xLayoutManager.set(xPropSet->getPropertyValue(
"LayoutManager"),UNO_QUERY);
138 return xLayoutManager;
144 css::uno::Any
a(ToolboxController_Base::queryInterface(rType));
145 return a.hasValue() ?
a : OPropertyContainer::queryInterface(rType);
150 ToolboxController_Base::acquire();
155 ToolboxController_Base::release();
169 throw DisposedException();
176 PropertyValue aPropValue;
179 if ( rArgument >>= aPropValue )
181 if ( aPropValue.Name ==
"Frame" )
182 m_xFrame.set(aPropValue.Value,UNO_QUERY);
183 else if ( aPropValue.Name ==
"CommandURL" )
185 else if ( aPropValue.Name ==
"ServiceManager" )
191 else if ( aPropValue.Name ==
"ParentWindow" )
193 else if ( aPropValue.Name ==
"ModuleIdentifier" )
195 else if ( aPropValue.Name ==
"Identifier" )
198 if (aPropValue.Value >>= nTmp)
201 else if ( aPropValue.Name ==
"IsSidebar" )
231 throw DisposedException();
249 css::lang::EventObject
aEvent( xThis );
265 if (
xDispatch.is() && xStatusListener.is() )
301 if ( xSource == xIfac )
302 listener.second.clear();
306 if ( xIfac == xSource )
320 OUString aCommandURL;
326 throw DisposedException();
354 catch ( DisposedException& )
385 URLToDispatchMap::iterator pIter =
m_aListenerMap.find( aCommandURL );
403 if (
m_xContext.is() && xDispatchProvider.is() )
410 xStatusListener =
this;
411 URLToDispatchMap::iterator aIter =
m_aListenerMap.find( aCommandURL );
419 if ( xOldDispatch.is() )
420 xOldDispatch->removeStatusListener( xStatusListener,
aTargetURL );
447 URLToDispatchMap::iterator pIter =
m_aListenerMap.find( aCommandURL );
462 if (
xDispatch.is() && xStatusListener.is() )
472 std::vector< Listener > aDispatchVector;
483 if (
m_xContext.is() && xDispatchProvider.is() )
485 xStatusListener =
this;
507 listener.second.clear();
528 if (!sRealCommand.isEmpty())
550 if ( !xStatusListener.is() )
555 for (
Listener & rListener : aDispatchVector)
557 if ( rListener.xDispatch.is() )
558 rListener.xDispatch->addStatusListener( xStatusListener, rListener.aURL );
566 FeatureStateEvent aFeatureStateEvent;
567 aFeatureStateEvent.IsEnabled =
false;
568 aFeatureStateEvent.FeatureURL = rListener.aURL;
569 aFeatureStateEvent.State =
Any();
570 xStatusListener->statusChanged( aFeatureStateEvent );
592 if ( !(
m_xContext.is() && xDispatchProvider.is()) )
616 listener.second.clear();
639 xStatusListener =
this;
640 if (
m_xContext.is() && xDispatchProvider.is() )
649 if ( !(
xDispatch.is() && xStatusListener.is()) )
673 aURL.Complete = sCommandURL;
680 pDispatchInfo.get() ) )
681 pDispatchInfo.release();
704 css::uno::Sequence< Property > aProps;
706 return new ::cppu::OPropertyArrayHelper(aProps);
710 css::uno::Any& aOldValue ,
712 const css::uno::Any& aValue )
718 bool aNewValue(
false);
719 aValue >>= aNewValue;
722 aConvertedValue <<= aNewValue;
729 return OPropertyContainer::convertFastPropertyValue(aConvertedValue, aOldValue,
nHandle, aValue);
734 const css::uno::Any& aValue )
736 OPropertyContainer::setFastPropertyValue_NoBroadcast(
nHandle, aValue);
749 pDispatchInfo->mxDispatch->dispatch( pDispatchInfo->maURL, pDispatchInfo->maArgs );
750 delete pDispatchInfo;
785 *ppToolBox = pToolBox;
Reference< XComponentContext > m_xContext
PropertiesInfo aProperties
css::uno::Reference< css::lang::XComponent > m_xFrame
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
static vcl::Window * GetWindow(const css::uno::Reference< css::awt::XWindow > &rxWindow)
sal_Int32 removeInterface(const css::uno::Type &rKey, const css::uno::Reference< css::uno::XInterface > &rxIFace)
sal_Int32 addInterface(const css::uno::Type &rKey, const css::uno::Reference< css::uno::XInterface > &r)
void disposeAndClear(const css::lang::EventObject &rEvt)
::cppu::IPropertyArrayHelper * getArrayHelper()
void describeProperties(css::uno::Sequence< css::beans::Property > &_rProps) const
void registerProperty(const OUString &_rName, sal_Int32 _nHandle, sal_Int32 _nAttributes, void *_pPointerToMember, const css::uno::Type &_rMemberType)
static css::uno::Sequence< css::uno::Type > getBaseTypes()
Reference< XDispatch > xDispatch
Sequence< PropertyValue > aArguments
#define LINK(Instance, Class, Member)
css::uno::Sequence< T > concatSequences(const css::uno::Sequence< T > &rS1, const Ss &... rSn)
Reference< XComponentContext > getComponentContext(Reference< XMultiServiceFactory > const &factory)
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
IMPL_STATIC_LINK(AddressBookSourceDialog, OnComboGetFocus, weld::Widget &, rBox, void)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
Sequence< beans::PropertyValue > GetCommandProperties(const OUString &rsCommandName, const OUString &rsModuleName)
OUString GetRealCommandForCommand(const css::uno::Sequence< css::beans::PropertyValue > &rProperties)
OUString GetModuleIdentifier(const Reference< frame::XFrame > &rxFrame)
Reference< XFrame > xFrame