summaryrefslogtreecommitdiff
path: root/embeddedobj/source/general/intercept.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'embeddedobj/source/general/intercept.cxx')
-rw-r--r--embeddedobj/source/general/intercept.cxx58
1 files changed, 31 insertions, 27 deletions
diff --git a/embeddedobj/source/general/intercept.cxx b/embeddedobj/source/general/intercept.cxx
index 9b1449cd9518..2ee2949bcf9f 100644
--- a/embeddedobj/source/general/intercept.cxx
+++ b/embeddedobj/source/general/intercept.cxx
@@ -18,7 +18,7 @@
*/
#include <com/sun/star/embed/EmbedStates.hpp>
-#include <cppuhelper/interfacecontainer.hxx>
+#include <comphelper/multiinterfacecontainer3.hxx>
#include <intercept.hxx>
#include <docholder.hxx>
@@ -26,35 +26,36 @@
using namespace ::com::sun::star;
-#define IUL 6
-
-uno::Sequence< OUString > Interceptor::m_aInterceptedURL(IUL);
+constexpr OUString IU0 = u".uno:Save"_ustr;
+constexpr OUString IU1 = u".uno:SaveAll"_ustr;
+constexpr OUString IU2 = u".uno:CloseDoc"_ustr;
+constexpr OUString IU3 = u".uno:CloseWin"_ustr;
+constexpr OUString IU4 = u".uno:CloseFrame"_ustr;
+constexpr OUString IU5 = u".uno:SaveAs"_ustr;
class StatusChangeListenerContainer
- : public cppu::OMultiTypeInterfaceContainerHelperVar<OUString>
+ : public comphelper::OMultiTypeInterfaceContainerHelperVar3<frame::XStatusListener, OUString>
{
public:
explicit StatusChangeListenerContainer(osl::Mutex& aMutex)
- : cppu::OMultiTypeInterfaceContainerHelperVar<OUString>(aMutex)
+ : comphelper::OMultiTypeInterfaceContainerHelperVar3<frame::XStatusListener, OUString>(aMutex)
{
}
};
+namespace embeddedobj
+{
+const uno::Sequence< OUString > Interceptor::m_aInterceptedURL{ IU0, IU1, IU2, IU3, IU4, IU5 };
+
void Interceptor::DisconnectDocHolder()
{
osl::MutexGuard aGuard( m_aMutex );
m_pDocHolder = nullptr;
}
-Interceptor::Interceptor( DocumentHolder* pDocHolder )
+Interceptor::Interceptor( embeddedobj::DocumentHolder* pDocHolder )
: m_pDocHolder( pDocHolder )
{
- m_aInterceptedURL[0] = ".uno:Save";
- m_aInterceptedURL[1] = ".uno:SaveAll";
- m_aInterceptedURL[2] = ".uno:CloseDoc";
- m_aInterceptedURL[3] = ".uno:CloseWin";
- m_aInterceptedURL[4] = ".uno:CloseFrame";
- m_aInterceptedURL[5] = ".uno:SaveAs";
}
Interceptor::~Interceptor()
@@ -94,7 +95,7 @@ Interceptor::dispatch(
{
if ( aNewArgs[nInd].Name == "SaveTo" )
{
- aNewArgs[nInd].Value <<= true;
+ aNewArgs.getArray()[nInd].Value <<= true;
break;
}
nInd++;
@@ -103,8 +104,9 @@ Interceptor::dispatch(
if ( nInd == aNewArgs.getLength() )
{
aNewArgs.realloc( nInd + 1 );
- aNewArgs[nInd].Name = "SaveTo";
- aNewArgs[nInd].Value <<= true;
+ auto pNewArgs = aNewArgs.getArray();
+ pNewArgs[nInd].Name = "SaveTo";
+ pNewArgs[nInd].Value <<= true;
}
uno::Reference< frame::XDispatch > xDispatch = m_xSlaveDispatchProvider->queryDispatch(
@@ -251,26 +253,26 @@ uno::Sequence< uno::Reference< frame::XDispatch > > SAL_CALL
Interceptor::queryDispatches(
const uno::Sequence<frame::DispatchDescriptor >& Requests )
{
- uno::Sequence< uno::Reference< frame::XDispatch > > aRet;
osl::MutexGuard aGuard(m_aMutex);
- if(m_xSlaveDispatchProvider.is())
- aRet = m_xSlaveDispatchProvider->queryDispatches(Requests);
- else
- aRet.realloc(Requests.getLength());
+ typedef uno::Sequence<uno::Reference<frame::XDispatch>> DispatchSeq;
+ DispatchSeq aRet = m_xSlaveDispatchProvider.is()
+ ? m_xSlaveDispatchProvider->queryDispatches(Requests)
+ : DispatchSeq(Requests.getLength());
+ auto aRetRange = asNonConstRange(aRet);
for(sal_Int32 i = 0; i < Requests.getLength(); ++i)
if(m_aInterceptedURL[0] == Requests[i].FeatureURL.Complete)
- aRet[i] = static_cast<frame::XDispatch*>(this);
+ aRetRange[i] = static_cast<frame::XDispatch*>(this);
else if(m_aInterceptedURL[1] == Requests[i].FeatureURL.Complete)
- aRet[i] = nullptr;
+ aRetRange[i] = nullptr;
else if(m_aInterceptedURL[2] == Requests[i].FeatureURL.Complete)
- aRet[i] = static_cast<frame::XDispatch*>(this);
+ aRetRange[i] = static_cast<frame::XDispatch*>(this);
else if(m_aInterceptedURL[3] == Requests[i].FeatureURL.Complete)
- aRet[i] = static_cast<frame::XDispatch*>(this);
+ aRetRange[i] = static_cast<frame::XDispatch*>(this);
else if(m_aInterceptedURL[4] == Requests[i].FeatureURL.Complete)
- aRet[i] = static_cast<frame::XDispatch*>(this);
+ aRetRange[i] = static_cast<frame::XDispatch*>(this);
else if(m_aInterceptedURL[5] == Requests[i].FeatureURL.Complete)
- aRet[i] = static_cast<frame::XDispatch*>(this);
+ aRetRange[i] = static_cast<frame::XDispatch*>(this);
return aRet;
}
@@ -310,4 +312,6 @@ Interceptor::setMasterDispatchProvider(
m_xMasterDispatchProvider = NewSupplier;
}
+} // namespace embeddedobj
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */