25#include <com/sun/star/frame/XDispatchProviderInterception.hpp>
26#include <com/sun/star/view/XSelectionSupplier.hpp>
27#include <com/sun/star/sdb/CommandType.hpp>
44 return uno::Reference<view::XSelectionSupplier>( rViewFrame.
GetFrame().
GetController(), uno::UNO_QUERY );
46 return uno::Reference<view::XSelectionSupplier>();
61 static_cast<frame::XDispatchProviderInterceptor*
>(
this));
64 uno::Reference<lang::XComponent> xInterceptedComponent(
m_xIntercepted, uno::UNO_QUERY);
65 if (xInterceptedComponent.is())
66 xInterceptedComponent->addEventListener(
static_cast<lang::XEventListener*
>(
this));
82 if ( rHint.
GetId() == SfxHintId::Dying )
89 const util::URL& aURL,
const OUString& aTargetFrameName,
90 sal_Int32 nSearchFlags )
94 uno::Reference<frame::XDispatch> xResult;
112uno::Sequence< uno::Reference<frame::XDispatch> > SAL_CALL
114 const uno::Sequence<frame::DispatchDescriptor>& aDescripts )
118 uno::Sequence< uno::Reference< frame::XDispatch> > aReturn(aDescripts.getLength());
119 std::transform(aDescripts.begin(), aDescripts.end(), aReturn.getArray(),
120 [
this](
const frame::DispatchDescriptor& rDescr) -> uno::Reference<frame::XDispatch> {
121 return queryDispatch(rDescr.FeatureURL, rDescr.FrameName, rDescr.SearchFlags); });
127uno::Reference<frame::XDispatchProvider> SAL_CALL
135 const uno::Reference<frame::XDispatchProvider>& xNewDispatchProvider )
141uno::Reference<frame::XDispatchProvider> SAL_CALL
149 const uno::Reference<frame::XDispatchProvider>& xNewSupplier )
164 static_cast<frame::XDispatchProviderInterceptor*
>(
this));
165 uno::Reference<lang::XComponent> xInterceptedComponent(
m_xIntercepted, uno::UNO_QUERY);
166 if (xInterceptedComponent.is())
167 xInterceptedComponent->removeEventListener(
static_cast<lang::XEventListener*
>(
this));
175 pViewShell( pViewSh ),
176 bListeningToView( false )
190 if ( xSupplier.is() )
191 xSupplier->removeSelectionChangeListener(
this);
197 if ( rHint.
GetId() == SfxHintId::Dying )
204 const uno::Sequence<beans::PropertyValue>& aArgs )
221 throw uno::RuntimeException();
226 rEvent.IsEnabled = rParam.
bImport;
231 sal_Int32
nType = rParam.
bSql ? sdb::CommandType::COMMAND :
251 const uno::Reference<frame::XStatusListener>& xListener,
252 const util::URL& aURL)
257 throw uno::RuntimeException();
260 frame::FeatureStateEvent
aEvent;
262 aEvent.Source = getXWeak();
272 if ( xSupplier.is() )
273 xSupplier->addSelectionChangeListener(
this);
284 xListener->statusChanged(
aEvent );
288 const uno::Reference<frame::XStatusListener>& xListener,
289 const util::URL& aURL )
300 if ( rObj == xListener )
310 if ( xSupplier.is() )
311 xSupplier->removeSelectionChangeListener(
this);
338 frame::FeatureStateEvent
aEvent;
339 aEvent.Source = getXWeak();
345 xDataSourceListener->statusChanged(
aEvent );
354 uno::Reference<view::XSelectionSupplier> xSupplier(rSource.Source, uno::UNO_QUERY);
355 xSupplier->removeSelectionChangeListener(
this);
359 aEvent.Source = getXWeak();
361 xDataSourceListener->disposing(
aEvent );
void GetImportParam(ScImportParam &rImportParam) const
void DoImportUno(const ScAddress &rPos, const css::uno::Sequence< css::beans::PropertyValue > &aArgs)
ScDBData * GetDBData(bool bMarkArea=true, ScGetDBMode eMode=SC_DB_MAKE, ScGetDBSelection eSel=ScGetDBSelection::Keep)
virtual void SAL_CALL setMasterDispatchProvider(const css::uno::Reference< css::frame::XDispatchProvider > &xNewSupplier) override
ScTabViewShell * pViewShell
virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches(const css::uno::Sequence< css::frame::DispatchDescriptor > &aDescripts) override
css::uno::Reference< css::frame::XDispatchProvider > m_xMasterDispatcher
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
XEventListener.
virtual ~ScDispatchProviderInterceptor() override
virtual css::uno::Reference< css::frame::XDispatchProvider > SAL_CALL getSlaveDispatchProvider() override
XDispatchProviderInterceptor.
virtual void SAL_CALL setSlaveDispatchProvider(const css::uno::Reference< css::frame::XDispatchProvider > &xNewDispatchProvider) override
css::uno::Reference< css::frame::XDispatch > m_xMyDispatch
own dispatch
ScDispatchProviderInterceptor(ScTabViewShell *pViewSh)
virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch(const css::util::URL &aURL, const OUString &aTargetFrameName, sal_Int32 nSearchFlags) override
XDispatchProvider.
virtual css::uno::Reference< css::frame::XDispatchProvider > SAL_CALL getMasterDispatchProvider() override
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
css::uno::Reference< css::frame::XDispatchProvider > m_xSlaveDispatcher
chaining
css::uno::Reference< css::frame::XDispatchProviderInterception > m_xIntercepted
the component which's dispatches we're intercepting
ScDispatch(ScTabViewShell *pViewSh)
virtual void SAL_CALL addStatusListener(const css::uno::Reference< css::frame::XStatusListener > &xControl, const css::util::URL &aURL) override
ScTabViewShell * pViewShell
virtual void SAL_CALL removeStatusListener(const css::uno::Reference< css::frame::XStatusListener > &xControl, const css::util::URL &aURL) override
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
XEventListener.
virtual void SAL_CALL selectionChanged(const css::lang::EventObject &aEvent) override
XSelectionChangeListener.
ScImportParam aLastImport
virtual void SAL_CALL dispatch(const css::util::URL &aURL, const css::uno::Sequence< css::beans::PropertyValue > &aArgs) override
XDispatch.
std::vector< css::uno::Reference< css::frame::XStatusListener > > aDataSourceListeners
virtual ~ScDispatch() override
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
ScViewData & GetViewData()
ScDocShell * GetDocShell() const
const css::uno::Reference< css::frame::XFrame > & GetFrameInterface() const
css::uno::Reference< css::frame::XController > GetController() const
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
void EndListening(SfxBroadcaster &rBroadcaster, bool bRemoveAllDuplicates=false)
SfxFrame & GetFrame() const
SfxViewFrame & GetViewFrame() const
css::uno::Sequence< css::beans::PropertyValue > const & createPropertyValueSequence()
void setDataSource(const OUString &_sDataSourceNameOrLocation)
static void lcl_FillDataSource(frame::FeatureStateEvent &rEvent, const ScImportParam &rParam)
const char cURLInsertColumns[]
static uno::Reference< view::XSelectionSupplier > lcl_GetSelectionSupplier(const SfxViewShell *pViewShell)
constexpr OUStringLiteral cURLDocDataSource