summaryrefslogtreecommitdiff
path: root/extensions/source/ole/unoobjw.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/source/ole/unoobjw.cxx')
-rw-r--r--extensions/source/ole/unoobjw.cxx92
1 files changed, 10 insertions, 82 deletions
diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx
index 2d935f8d9583..915ecd92f8fc 100644
--- a/extensions/source/ole/unoobjw.cxx
+++ b/extensions/source/ole/unoobjw.cxx
@@ -41,7 +41,6 @@
#pragma clang diagnostic ignored "-Winvalid-noreturn"
#pragma clang diagnostic ignored "-Wmicrosoft"
#pragma clang diagnostic ignored "-Wnon-pod-varargs"
-#pragma clang diagnostic ignored "-Wnon-virtual-dtor"
#pragma clang diagnostic ignored "-Wnonportable-include-path"
#pragma clang diagnostic ignored "-Wsequence-point"
#pragma clang diagnostic ignored "-Wtypename-missing"
@@ -57,13 +56,9 @@
#include <salhelper/simplereferenceobject.hxx>
#include <rtl/ref.hxx>
#include <rtl/ustring.hxx>
-#include <tools/diagnose_ex.h>
#include <sal/log.hxx>
#include <com/sun/star/beans/MethodConcept.hpp>
#include <com/sun/star/beans/PropertyConcept.hpp>
-#include <com/sun/star/frame/Desktop.hpp>
-#include <com/sun/star/frame/TerminationVetoException.hpp>
-#include <com/sun/star/frame/XTerminateListener.hpp>
#include <com/sun/star/lang/NoSuchMethodException.hpp>
#include <com/sun/star/script/CannotConvertException.hpp>
#include <com/sun/star/script/FailReason.hpp>
@@ -86,7 +81,6 @@
#include <osl/interlck.h>
#include <com/sun/star/uno/genfunc.h>
#include <comphelper/automationinvokedzone.hxx>
-#include <comphelper/asyncquithandler.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/profilezone.hxx>
#include <comphelper/windowsdebugoutput.hxx>
@@ -101,7 +95,6 @@
#include "unoobjw.hxx"
#include "servprov.hxx"
-using namespace std;
using namespace osl;
using namespace cppu;
using namespace com::sun::star::uno;
@@ -117,64 +110,6 @@ static bool writeBackOutParameter(VARIANTARG* pDest, VARIANT* pSource);
static bool writeBackOutParameter2( VARIANTARG* pDest, VARIANT* pSource);
static HRESULT mapCannotConvertException(const CannotConvertException &e, unsigned int * puArgErr);
-namespace {
-
-class TerminationVetoer : public WeakImplHelper<css::frame::XTerminateListener>
-{
-public:
- int mnCount;
-
-private:
- TerminationVetoer()
- : mnCount(0)
- {
- try
- {
- Reference< css::frame::XDesktop > xDesktop =
- css::frame::Desktop::create( comphelper::getProcessComponentContext() );
- xDesktop->addTerminateListener( this );
- }
- catch ( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION("extensions.olebridge");
- }
- }
-
-public:
- static rtl::Reference< TerminationVetoer > get()
- {
- static rtl::Reference< TerminationVetoer > aInstance( new TerminationVetoer );
-
- return aInstance;
- }
-
- // XTerminateListener
- void SAL_CALL queryTermination( const EventObject& ) override
- {
- SAL_INFO("extensions.olebridge", "TerminationVetoer::queryTermination: count=" << mnCount);
- // Always veto termination while an OLE object is active, except if it is an OLE object that
- // has asked us to quit.
- if (!AsyncQuitHandler::instance().IsForceQuit() && mnCount > 0)
- {
- SAL_INFO("extensions.olebridge", "TerminationVetoer::queryTermination: Throwing!");
- throw css::frame::TerminationVetoException();
- }
- }
-
- void SAL_CALL notifyTermination( const EventObject& ) override
- {
- // ???
- }
-
- // XEventListener
- void SAL_CALL disposing( const css::lang::EventObject& ) override
- {
- // ???
- }
-};
-
-}
-
/* Does not throw any exceptions.
Param pInfo can be NULL.
*/
@@ -193,8 +128,6 @@ InterfaceOleWrapper::InterfaceOleWrapper( Reference<XMultiServiceFactory> const
UnoConversionUtilities<InterfaceOleWrapper>( xFactory, unoWrapperClass, comWrapperClass),
m_defaultValueType( 0)
{
- TerminationVetoer::get()->mnCount++;
- SAL_INFO("extensions.olebridge", "InterfaceOleWrapper CTOR, count=" << TerminationVetoer::get()->mnCount);
}
InterfaceOleWrapper::~InterfaceOleWrapper()
@@ -204,9 +137,6 @@ InterfaceOleWrapper::~InterfaceOleWrapper()
auto it = UnoObjToWrapperMap.find( reinterpret_cast<sal_uIntPtr>(m_xOrigin.get()));
if(it != UnoObjToWrapperMap.end())
UnoObjToWrapperMap.erase(it);
-
- TerminationVetoer::get()->mnCount--;
- SAL_INFO("extensions.olebridge", "InterfaceOleWrapper DTOR, count=" << TerminationVetoer::get()->mnCount);
}
COM_DECLSPEC_NOTHROW STDMETHODIMP InterfaceOleWrapper::QueryInterface(REFIID riid, void ** ppv)
@@ -1570,7 +1500,7 @@ Any SAL_CALL InterfaceOleWrapper::createBridge(const Any& modelDepObject,
if( pVar)
{
pVar->vt= VT_DISPATCH;
- pVar->pdispVal= static_cast<IDispatch*>( this);
+ pVar->pdispVal= this;
AddRef();
retAny<<= reinterpret_cast< sal_uIntPtr >( pVar);
@@ -1731,7 +1661,7 @@ static bool writeBackOutParameter(VARIANTARG* pDest, VARIANT* pSource)
else
{
// variantarg and variant must have same type
- if ((V_VT(pDest) & oleTypeFlags) == oleTypeFlags)
+ if ((V_VT(pDest) & oleTypeFlags) == oleTypeFlags)
{
if ((oleTypeFlags & VT_ARRAY) != 0)
{
@@ -1887,7 +1817,7 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP InterfaceOleWrapper::Invoke(DISPID dispidMembe
sParams += ",";
std::stringstream aStringStream;
aStringStream << pdispparams->rgvarg[i];
- sParams += OUString::createFromAscii(aStringStream.str().c_str());
+ sParams += OUString::createFromAscii(aStringStream.str());
}
sParams += "]";
#endif
@@ -2395,6 +2325,7 @@ Sink::Call( const OUString& Method, Sequence< Any >& Arguments )
aMethods.getLength() > 0);
int nMemId = 1;
+ auto ArgumentsRange = asNonConstRange(Arguments);
// Skip the three XInterface methods
for (int i = 3; i < aMethods.getLength(); i++)
{
@@ -2443,9 +2374,7 @@ Sink::Call( const OUString& Method, Sequence< Any >& Arguments )
aDispParams.rgvarg[j].vt |= VT_BYREF;
break;
case VT_BOOL:
- // SAL_ DEBUG("===> VT_BOOL is initially " << (int)aDispParams.rgvarg[j].boolVal);
aDispParams.rgvarg[j].byref = new VARIANT_BOOL(aDispParams.rgvarg[j].boolVal);
- // SAL_ DEBUG(" byref=" << aDispParams.rgvarg[j].byref);
aDispParams.rgvarg[j].vt |= VT_BYREF;
break;
default:
@@ -2488,21 +2417,21 @@ Sink::Call( const OUString& Method, Sequence< Any >& Arguments )
case VT_BYREF|VT_I2:
{
SHORT *pI = static_cast<SHORT*>(aDispParams.rgvarg[j].byref);
- Arguments[nIncomingArgIndex] <<= static_cast<sal_Int16>(*pI);
+ ArgumentsRange[nIncomingArgIndex] <<= static_cast<sal_Int16>(*pI);
delete pI;
}
break;
case VT_BYREF|VT_I4:
{
LONG *pL = static_cast<LONG*>(aDispParams.rgvarg[j].byref);
- Arguments[nIncomingArgIndex] <<= static_cast<sal_Int32>(*pL);
+ ArgumentsRange[nIncomingArgIndex] <<= static_cast<sal_Int32>(*pL);
delete pL;
}
break;
case VT_BYREF|VT_BSTR:
{
BSTR *pBstr = static_cast<BSTR*>(aDispParams.rgvarg[j].byref);
- Arguments[nIncomingArgIndex] <<= OUString(o3tl::toU(*pBstr));
+ ArgumentsRange[nIncomingArgIndex] <<= OUString(o3tl::toU(*pBstr));
// Undo SysAllocString() done in anyToVariant()
SysFreeString(*pBstr);
delete pBstr;
@@ -2511,8 +2440,7 @@ Sink::Call( const OUString& Method, Sequence< Any >& Arguments )
case VT_BYREF|VT_BOOL:
{
VARIANT_BOOL *pBool = static_cast<VARIANT_BOOL*>(aDispParams.rgvarg[j].byref);
- // SAL_ DEBUG("===> VT_BOOL: byref is now " << aDispParams.rgvarg[j].byref << ", " << (int)*pBool);
- Arguments[nIncomingArgIndex] <<= (*pBool != VARIANT_FALSE);
+ ArgumentsRange[nIncomingArgIndex] <<= (*pBool != VARIANT_FALSE);
delete pBool;
}
break;
@@ -2831,7 +2759,7 @@ HRESULT InterfaceOleWrapper::InvokeGeneral( DISPID dispidMember, unsigned short
if( m_defaultValueType == VT_DISPATCH)
{
pvarResult->vt= VT_DISPATCH;
- pvarResult->pdispVal= static_cast<IDispatch*>( this);
+ pvarResult->pdispVal= this;
AddRef();
ret= S_OK;
}
@@ -3163,7 +3091,7 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP UnoObjectWrapperRemoteOpt::GetIDsOfNames ( RE
{
// name has not been bad before( member exists
typedef NameToIdMap::iterator ITnames;
- pair< ITnames, bool > pair_id= m_nameToDispIdMap.emplace(name, m_currentId++);
+ std::pair< ITnames, bool > pair_id= m_nameToDispIdMap.emplace(name, m_currentId++);
// new ID inserted ?
if( pair_id.second )
{// yes, now create MemberInfo and ad to IdToMemberInfoMap