summaryrefslogtreecommitdiff
path: root/sw/source/uibase/uno/unodispatch.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/uibase/uno/unodispatch.cxx')
-rw-r--r--sw/source/uibase/uno/unodispatch.cxx51
1 files changed, 16 insertions, 35 deletions
diff --git a/sw/source/uibase/uno/unodispatch.cxx b/sw/source/uibase/uno/unodispatch.cxx
index 4060c0d08a39..a67afc31c19d 100644
--- a/sw/source/uibase/uno/unodispatch.cxx
+++ b/sw/source/uibase/uno/unodispatch.cxx
@@ -18,6 +18,7 @@
*/
#include <config_features.h>
+#include <config_fuzzers.h>
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/view/XSelectionSupplier.hpp>
@@ -26,6 +27,7 @@
#include <sfx2/dispatch.hxx>
#include <svx/dataaccessdescriptor.hxx>
#include <comphelper/servicehelper.hxx>
+#include <osl/diagnose.h>
#include <unodispatch.hxx>
#include <view.hxx>
#include <cmdid.h>
@@ -43,7 +45,7 @@ const char cInternalDBChangeNotification[] = ".uno::Writer/DataSourceChanged";
SwXDispatchProviderInterceptor::SwXDispatchProviderInterceptor(SwView& rVw) :
m_pView(&rVw)
{
- uno::Reference< frame::XFrame> xUnoFrame = m_pView->GetViewFrame()->GetFrame().GetFrameInterface();
+ uno::Reference< frame::XFrame> xUnoFrame = m_pView->GetViewFrame().GetFrame().GetFrameInterface();
m_xIntercepted.set(xUnoFrame, uno::UNO_QUERY);
if(m_xIntercepted.is())
{
@@ -103,7 +105,7 @@ uno::Sequence< uno::Reference< frame::XDispatch > > SwXDispatchProviderIntercept
{
DispatchMutexLock_Impl aLock;
uno::Sequence< uno::Reference< frame::XDispatch> > aReturn(aDescripts.getLength());
- std::transform(aDescripts.begin(), aDescripts.end(), aReturn.begin(),
+ std::transform(aDescripts.begin(), aDescripts.end(), aReturn.getArray(),
[this](const frame::DispatchDescriptor& rDescr) -> uno::Reference<frame::XDispatch> {
return queryDispatch(rDescr.FeatureURL, rDescr.FrameName, rDescr.SearchFlags); });
return aReturn;
@@ -149,26 +151,6 @@ void SwXDispatchProviderInterceptor::disposing( const lang::EventObject& )
m_xIntercepted = nullptr;
}
-namespace
-{
- class theSwXDispatchProviderInterceptorUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSwXDispatchProviderInterceptorUnoTunnelId > {};
-}
-
-const uno::Sequence< sal_Int8 > & SwXDispatchProviderInterceptor::getUnoTunnelId()
-{
- return theSwXDispatchProviderInterceptorUnoTunnelId::get().getSeq();
-}
-
-sal_Int64 SwXDispatchProviderInterceptor::getSomething(
- const uno::Sequence< sal_Int8 >& aIdentifier )
-{
- if( isUnoTunnelId<SwXDispatchProviderInterceptor>(aIdentifier) )
- {
- return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this ));
- }
- return 0;
-}
-
void SwXDispatchProviderInterceptor::Invalidate()
{
DispatchMutexLock_Impl aLock;
@@ -206,7 +188,7 @@ void SwXDispatch::dispatch(const util::URL& aURL,
{
if(!m_pView)
throw uno::RuntimeException();
-#if !HAVE_FEATURE_DBCONNECTIVITY
+#if !HAVE_FEATURE_DBCONNECTIVITY || ENABLE_FUZZERS
(void) aArgs;
if (false)
{
@@ -226,8 +208,8 @@ void SwXDispatch::dispatch(const util::URL& aURL,
}
else if(aURL.Complete == cURLFormLetter)
{
- SfxUnoAnyItem aDBProperties(FN_PARAM_DATABASE_PROPERTIES, uno::makeAny(aArgs));
- m_pView->GetViewFrame()->GetDispatcher()->ExecuteList(
+ SfxUnoAnyItem aDBProperties(FN_PARAM_DATABASE_PROPERTIES, uno::Any(aArgs));
+ m_pView->GetViewFrame().GetDispatcher()->ExecuteList(
FN_MAILMERGE_WIZARD,
SfxCallMode::ASYNCHRON,
{ &aDBProperties });
@@ -240,9 +222,9 @@ void SwXDispatch::dispatch(const util::URL& aURL,
else if(aURL.Complete == cInternalDBChangeNotification)
{
frame::FeatureStateEvent aEvent;
- aEvent.Source = *static_cast<cppu::OWeakObject*>(this);
+ aEvent.Source = getXWeak();
- const SwDBData& rData = m_pView->GetWrtShell().GetDBDesc();
+ const SwDBData& rData = m_pView->GetWrtShell().GetDBData();
svx::ODataAccessDescriptor aDescriptor;
aDescriptor.setDataSource(rData.sDataSource);
aDescriptor[svx::DataAccessDescriptorProperty::Command] <<= rData.sCommand;
@@ -282,13 +264,13 @@ void SwXDispatch::addStatusListener(
m_bOldEnable = bEnable;
frame::FeatureStateEvent aEvent;
aEvent.IsEnabled = bEnable;
- aEvent.Source = *static_cast<cppu::OWeakObject*>(this);
+ aEvent.Source = getXWeak();
aEvent.FeatureURL = aURL;
// one of the URLs requires a special state...
if (aURL.Complete == cURLDocumentDataSource)
{
- const SwDBData& rData = m_pView->GetWrtShell().GetDBDesc();
+ const SwDBData& rData = m_pView->GetWrtShell().GetDBData();
svx::ODataAccessDescriptor aDescriptor;
aDescriptor.setDataSource(rData.sDataSource);
@@ -318,10 +300,9 @@ void SwXDispatch::addStatusListener(
void SwXDispatch::removeStatusListener(
const uno::Reference< frame::XStatusListener >& xControl, const util::URL& )
{
- m_aStatusListenerVector.erase(
- std::remove_if(m_aStatusListenerVector.begin(), m_aStatusListenerVector.end(),
- [&](const StatusStruct_Impl& status) { return status.xListener.get() == xControl.get(); }),
- m_aStatusListenerVector.end());
+ std::erase_if(
+ m_aStatusListenerVector,
+ [&](const StatusStruct_Impl& status) { return status.xListener.get() == xControl.get(); });
if(m_aStatusListenerVector.empty() && m_pView)
{
uno::Reference<view::XSelectionSupplier> xSupplier = m_pView->GetUNOObject();
@@ -344,7 +325,7 @@ void SwXDispatch::selectionChanged( const lang::EventObject& )
m_bOldEnable = bEnable;
frame::FeatureStateEvent aEvent;
aEvent.IsEnabled = bEnable;
- aEvent.Source = *static_cast<cppu::OWeakObject*>(this);
+ aEvent.Source = getXWeak();
// calls to statusChanged may call addStatusListener or removeStatusListener
// so copy m_aStatusListenerVector on stack
@@ -366,7 +347,7 @@ void SwXDispatch::disposing( const lang::EventObject& rSource )
m_bListenerAdded = false;
lang::EventObject aObject;
- aObject.Source = static_cast<cppu::OWeakObject*>(this);
+ aObject.Source = getXWeak();
// calls to statusChanged may call addStatusListener or removeStatusListener
// so copy m_aStatusListenerVector on stack
auto copyStatusListenerVector = m_aStatusListenerVector;