summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2023-04-23 20:14:54 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2023-06-18 11:10:20 +0200
commit0c2b2c9babfd781e0d9d68bb2a14a045b0c6ec4c (patch)
treefef431f10266f60a7941b71315b66932a29e568f
parent627984834cffbe6d1afce8b2be91277c221525b8 (diff)
Use getXWeak in stoc
Change-Id: Icd694eeae002ab28cbd06ba3097e9039e299de3b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150871 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r--stoc/source/corereflection/crarray.cxx16
-rw-r--r--stoc/source/corereflection/crcomp.cxx10
-rw-r--r--stoc/source/corereflection/crefl.cxx8
-rw-r--r--stoc/source/corereflection/crenum.cxx4
-rw-r--r--stoc/source/corereflection/criface.cxx8
-rw-r--r--stoc/source/inspect/introspection.cxx4
-rw-r--r--stoc/source/invocation/invocation.cxx4
-rw-r--r--stoc/source/javaloader/javaloader.cxx2
-rw-r--r--stoc/source/javavm/javavm.cxx50
-rw-r--r--stoc/source/proxy_factory/proxyfac.cxx3
-rw-r--r--stoc/source/security/access_controller.cxx18
-rw-r--r--stoc/source/security/file_policy.cxx2
-rw-r--r--stoc/source/servicemanager/servicemanager.cxx12
-rw-r--r--stoc/source/simpleregistry/simpleregistry.cxx110
-rw-r--r--stoc/source/typeconv/convert.cxx2
-rw-r--r--stoc/source/uriproc/UriReferenceFactory.cxx2
-rw-r--r--stoc/test/javavm/jvm_interaction/interactionhandler.cxx5
-rw-r--r--stoc/test/registry_tdprovider/testregistrytdprovider.cxx2
-rw-r--r--stoc/test/tdmanager/testtdmanager.cxx2
-rw-r--r--stoc/test/testproxyfac.cxx10
20 files changed, 136 insertions, 138 deletions
diff --git a/stoc/source/corereflection/crarray.cxx b/stoc/source/corereflection/crarray.cxx
index ca8d159ef721..67be31e1ac93 100644
--- a/stoc/source/corereflection/crarray.cxx
+++ b/stoc/source/corereflection/crarray.cxx
@@ -40,13 +40,13 @@ void ArrayIdlClassImpl::realloc( Any & rArray, sal_Int32 nLen )
{
throw IllegalArgumentException(
"expected sequence, but found " + rArray.getValueType().getTypeName(),
- static_cast<XWeak *>(static_cast<OWeakObject *>(this)), 0 );
+ getXWeak(), 0 );
}
if (nLen < 0)
{
throw IllegalArgumentException(
"negative length given!",
- static_cast<XWeak *>(static_cast<OWeakObject *>(this)), 1 );
+ getXWeak(), 1 );
}
uno_Sequence ** ppSeq = const_cast<uno_Sequence **>(static_cast<uno_Sequence * const *>(rArray.getValue()));
@@ -64,7 +64,7 @@ sal_Int32 ArrayIdlClassImpl::getLen( const Any & rArray )
{
throw IllegalArgumentException(
"expected sequence, but found " + rArray.getValueType().getTypeName(),
- static_cast<XWeak *>(static_cast<OWeakObject *>(this)), 0 );
+ getXWeak(), 0 );
}
return (*static_cast<uno_Sequence * const *>(rArray.getValue()))->nElements;
@@ -77,7 +77,7 @@ Any ArrayIdlClassImpl::get( const Any & rArray, sal_Int32 nIndex )
{
throw IllegalArgumentException(
"expected sequence, but found " + rArray.getValueType().getTypeName(),
- static_cast<XWeak *>(static_cast<OWeakObject *>(this)), 0 );
+ getXWeak(), 0 );
}
uno_Sequence * pSeq = *static_cast<uno_Sequence * const *>(rArray.getValue());
@@ -85,7 +85,7 @@ Any ArrayIdlClassImpl::get( const Any & rArray, sal_Int32 nIndex )
{
throw ArrayIndexOutOfBoundsException(
"illegal index given, index " + OUString::number(nIndex) + " is < " + OUString::number(pSeq->nElements),
- static_cast<XWeak *>(static_cast<OWeakObject *>(this)) );
+ getXWeak() );
}
Any aRet;
@@ -107,7 +107,7 @@ void ArrayIdlClassImpl::set( Any & rArray, sal_Int32 nIndex, const Any & rNewVal
{
throw IllegalArgumentException(
"expected sequence, but found " + rArray.getValueType().getTypeName(),
- static_cast<XWeak *>(static_cast<OWeakObject *>(this)), 0 );
+ getXWeak(), 0 );
}
uno_Sequence * pSeq = *static_cast<uno_Sequence * const *>(rArray.getValue());
@@ -115,7 +115,7 @@ void ArrayIdlClassImpl::set( Any & rArray, sal_Int32 nIndex, const Any & rNewVal
{
throw ArrayIndexOutOfBoundsException(
"illegal index given, index " + OUString::number(nIndex) + " is < " + OUString::number(pSeq->nElements),
- static_cast<XWeak *>(static_cast<OWeakObject *>(this)) );
+ getXWeak() );
}
uno_Sequence ** ppSeq = const_cast<uno_Sequence **>(static_cast<uno_Sequence * const *>(rArray.getValue()));
@@ -135,7 +135,7 @@ void ArrayIdlClassImpl::set( Any & rArray, sal_Int32 nIndex, const Any & rNewVal
TYPELIB_DANGER_RELEASE( pElemTypeDescr );
throw IllegalArgumentException(
"sequence element is not assignable by given value!",
- static_cast<XWeak *>(static_cast<OWeakObject *>(this)), 2 );
+ getXWeak(), 2 );
}
TYPELIB_DANGER_RELEASE( pElemTypeDescr );
}
diff --git a/stoc/source/corereflection/crcomp.cxx b/stoc/source/corereflection/crcomp.cxx
index 990e5a63aa1a..b1143e158b09 100644
--- a/stoc/source/corereflection/crcomp.cxx
+++ b/stoc/source/corereflection/crcomp.cxx
@@ -137,7 +137,7 @@ Any IdlCompFieldImpl::get( const Any & rObj )
}
throw IllegalArgumentException(
"expected struct or exception, got " + rObj.getValueType().getTypeName(),
- static_cast<XWeak *>(static_cast<OWeakObject *>(this)), 0 );
+ getXWeak(), 0 );
}
void IdlCompFieldImpl::set( const Any & rObj, const Any & rValue )
@@ -161,7 +161,7 @@ void IdlCompFieldImpl::set( const Any & rObj, const Any & rValue )
{
throw IllegalArgumentException(
"cannot assign value to destination",
- static_cast<XWeak *>(static_cast<OWeakObject *>(this)), 1 );
+ getXWeak(), 1 );
}
return;
}
@@ -169,7 +169,7 @@ void IdlCompFieldImpl::set( const Any & rObj, const Any & rValue )
}
throw IllegalArgumentException(
"expected struct or exception, got " + rObj.getValueType().getTypeName(),
- static_cast<XWeak *>(static_cast<OWeakObject *>(this)), 0 );
+ getXWeak(), 0 );
}
@@ -194,7 +194,7 @@ void IdlCompFieldImpl::set( Any & rObj, const Any & rValue )
{
throw IllegalArgumentException(
"cannot assign to destination",
- static_cast<XWeak *>(static_cast<OWeakObject *>(this)), 1 );
+ getXWeak(), 1 );
}
return;
}
@@ -202,7 +202,7 @@ void IdlCompFieldImpl::set( Any & rObj, const Any & rValue )
}
throw IllegalArgumentException(
"expected struct or exception, got " + rObj.getValueType().getTypeName(),
- static_cast<XWeak *>(static_cast<OWeakObject *>(this)), 0 );
+ getXWeak(), 0 );
}
diff --git a/stoc/source/corereflection/crefl.cxx b/stoc/source/corereflection/crefl.cxx
index 4f396065b478..5fb675a03a4b 100644
--- a/stoc/source/corereflection/crefl.cxx
+++ b/stoc/source/corereflection/crefl.cxx
@@ -264,7 +264,7 @@ Reference< XIdlClass > IdlReflectionServiceImpl::forType( typelib_TypeDescriptio
}
throw RuntimeException(
"IdlReflectionServiceImpl::forType() failed!",
- static_cast<XWeak *>(static_cast<OWeakObject *>(this)) );
+ getXWeak() );
}
@@ -281,7 +281,7 @@ const Mapping & IdlReflectionServiceImpl::getCpp2Uno()
{
throw RuntimeException(
"cannot get c++ to uno mapping!",
- static_cast<XWeak *>(static_cast<OWeakObject *>(this)) );
+ getXWeak() );
}
}
}
@@ -301,7 +301,7 @@ const Mapping & IdlReflectionServiceImpl::getUno2Cpp()
{
throw RuntimeException(
"cannot get uno to c++ mapping!",
- static_cast<XWeak *>(static_cast<OWeakObject *>(this)) );
+ getXWeak() );
}
}
}
@@ -317,7 +317,7 @@ uno_Interface * IdlReflectionServiceImpl::mapToUno(
throw RuntimeException(
"illegal object given!",
- static_cast<XWeak *>(static_cast<OWeakObject *>(this)) );
+ getXWeak() );
}
}
diff --git a/stoc/source/corereflection/crenum.cxx b/stoc/source/corereflection/crenum.cxx
index f61ab565609a..2cb07c9b5ec8 100644
--- a/stoc/source/corereflection/crenum.cxx
+++ b/stoc/source/corereflection/crenum.cxx
@@ -92,14 +92,14 @@ void IdlEnumFieldImpl::set( const Any &, const Any & )
{
throw IllegalAccessException(
"cannot set enum field, it is constant",
- static_cast<XWeak *>(static_cast<OWeakObject *>(this)) );
+ getXWeak() );
}
void IdlEnumFieldImpl::set( Any &, const Any & )
{
throw IllegalAccessException(
"cannot set enum field, it is constant",
- static_cast<XWeak *>(static_cast<OWeakObject *>(this)) );
+ getXWeak() );
}
diff --git a/stoc/source/corereflection/criface.cxx b/stoc/source/corereflection/criface.cxx
index 612b87106f3b..458c7c3693a7 100644
--- a/stoc/source/corereflection/criface.cxx
+++ b/stoc/source/corereflection/criface.cxx
@@ -151,7 +151,7 @@ Any IdlAttributeFieldImpl::get( const Any & rObj )
}
throw IllegalArgumentException(
"illegal object given!",
- static_cast<XWeak *>(static_cast<OWeakObject *>(this)), 0 );
+ getXWeak(), 0 );
}
void IdlAttributeFieldImpl::set( Any & rObj, const Any & rValue )
@@ -160,7 +160,7 @@ void IdlAttributeFieldImpl::set( Any & rObj, const Any & rValue )
{
throw IllegalAccessException(
"cannot set readonly attribute!",
- static_cast<XWeak *>(static_cast<OWeakObject *>(this)) );
+ getXWeak() );
}
uno_Interface * pUnoI = getReflection()->mapToUno(
@@ -237,7 +237,7 @@ void IdlAttributeFieldImpl::set( Any & rObj, const Any & rValue )
}
throw IllegalArgumentException(
"illegal destination object given!",
- static_cast<XWeak *>(static_cast<OWeakObject *>(this)), 0 );
+ getXWeak(), 0 );
}
void IdlAttributeFieldImpl::set( const Any & rObj, const Any & rValue )
@@ -644,7 +644,7 @@ Any SAL_CALL IdlInterfaceMethodImpl::invoke( const Any & rObj, Sequence< Any > &
}
throw IllegalArgumentException(
"illegal destination object given!",
- static_cast<XWeak *>(static_cast<OWeakObject *>(this)), 0 );
+ getXWeak(), 0 );
}
diff --git a/stoc/source/inspect/introspection.cxx b/stoc/source/inspect/introspection.cxx
index e6c44c4748ba..be39b568002e 100644
--- a/stoc/source/inspect/introspection.cxx
+++ b/stoc/source/inspect/introspection.cxx
@@ -1562,7 +1562,7 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect(
osl::MutexGuard g(m_aMutex);
if (rBHelper.bDisposed || rBHelper.bInDispose) {
throw css::lang::DisposedException(
- getImplementationName(), static_cast<OWeakObject *>(this));
+ getImplementationName(), getXWeak());
}
reflection = reflection_;
}
@@ -1628,7 +1628,7 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect(
osl::MutexGuard g(m_aMutex);
if (rBHelper.bDisposed || rBHelper.bInDispose) {
throw css::lang::DisposedException(
- getImplementationName(), static_cast<OWeakObject *>(this));
+ getImplementationName(), getXWeak());
}
TypeKey key(xPropSetInfo, SupportedTypesSeq);
pAccess = typeCache_.find(key);
diff --git a/stoc/source/invocation/invocation.cxx b/stoc/source/invocation/invocation.cxx
index 5463c059eb5f..5c57f5107de9 100644
--- a/stoc/source/invocation/invocation.cxx
+++ b/stoc/source/invocation/invocation.cxx
@@ -603,7 +603,7 @@ Any Invocation_Impl::invoke( const OUString& FunctionName, const Sequence<Any>&
throw IllegalArgumentException(
"incorrect number of parameters passed invoking function " + FunctionName +
": expected " + OUString::number(nFParamsLen) + ", got " + OUString::number(InParams.getLength()),
- static_cast<OWeakObject *>(this), sal_Int16(1) );
+ getXWeak(), sal_Int16(1) );
}
// IN Parameter
@@ -883,7 +883,7 @@ InvocationInfo SAL_CALL Invocation_Impl::getInfoForName( const OUString& aName,
{
throw IllegalArgumentException(
"getExactName(), Unknown name " + aName,
- static_cast<XWeak *>(static_cast<OWeakObject *>(this)), 0 );
+ getXWeak(), 0 );
}
return aRetInfo;
}
diff --git a/stoc/source/javaloader/javaloader.cxx b/stoc/source/javaloader/javaloader.cxx
index b6d67a6bc923..e54ce9b2d776 100644
--- a/stoc/source/javaloader/javaloader.cxx
+++ b/stoc/source/javaloader/javaloader.cxx
@@ -471,7 +471,7 @@ const css::uno::Reference<XImplementationLoader> & JavaComponentLoader::getJavaL
css::uno::Any anyEx = cppu::getCaughtException();
throw css::lang::WrappedTargetRuntimeException(
"jvmaccess::VirtualMachine::AttachGuard::CreationException",
- static_cast< cppu::OWeakObject * >(this), anyEx );
+ getXWeak(), anyEx );
}
// set the service manager at the javaloader
diff --git a/stoc/source/javavm/javavm.cxx b/stoc/source/javavm/javavm.cxx
index 12bcc2c904b7..96fdd61401fc 100644
--- a/stoc/source/javavm/javavm.cxx
+++ b/stoc/source/javavm/javavm.cxx
@@ -486,11 +486,11 @@ JavaVirtualMachine::initialize(css::uno::Sequence< css::uno::Any > const &
osl::MutexGuard aGuard(m_aMutex);
if (m_bDisposed)
throw css::lang::DisposedException(
- "", static_cast< cppu::OWeakObject * >(this));
+ "", getXWeak());
if (m_xUnoVirtualMachine.is())
throw css::uno::RuntimeException(
"bad call to initialize",
- static_cast< cppu::OWeakObject * >(this));
+ getXWeak());
css::beans::NamedValue val;
if (rArguments.getLength() == 1 && (rArguments[0] >>= val) && val.Name == "UnoVirtualMachine" )
{
@@ -519,7 +519,7 @@ JavaVirtualMachine::initialize(css::uno::Sequence< css::uno::Any > const &
css::uno::Any anyEx = cppu::getCaughtException();
throw css::lang::WrappedTargetRuntimeException(
"jvmaccess::UnoVirtualMachine::CreationException",
- static_cast< cppu::OWeakObject * >(this), anyEx );
+ getXWeak(), anyEx );
}
}
}
@@ -531,7 +531,7 @@ JavaVirtualMachine::initialize(css::uno::Sequence< css::uno::Any > const &
" non-null pointer to a jvmaccess:UnoVirtualMachine, or (b)"
" a hyper representing a non-null pointer to a"
" jvmaccess::VirtualMachine required",
- static_cast< cppu::OWeakObject * >(this), 0);
+ getXWeak(), 0);
}
m_xVirtualMachine = m_xUnoVirtualMachine->getVirtualMachine();
}
@@ -559,7 +559,7 @@ JavaVirtualMachine::getJavaVM(css::uno::Sequence< sal_Int8 > const & rProcessId)
osl::MutexGuard aGuard(m_aMutex);
if (m_bDisposed)
throw css::lang::DisposedException(
- "", static_cast< cppu::OWeakObject * >(this));
+ "", getXWeak());
css::uno::Sequence< sal_Int8 > aId(16);
rtl_getGlobalProcessId(reinterpret_cast< sal_uInt8 * >(aId.getArray()));
enum ReturnType {
@@ -623,7 +623,7 @@ JavaVirtualMachine::getJavaVM(css::uno::Sequence< sal_Int8 > const & rProcessId)
css::java::JavaNotFoundException exc(
"JavaVirtualMachine::getJavaVM failed because"
" No suitable JRE found!",
- static_cast< cppu::OWeakObject * >(this));
+ getXWeak());
askForRetry(css::uno::Any(exc));
return css::uno::Any();
}
@@ -644,7 +644,7 @@ JavaVirtualMachine::getJavaVM(css::uno::Sequence< sal_Int8 > const & rProcessId)
css::java::InvalidJavaSettingsException exc(
"JavaVirtualMachine::getJavaVM failed because"
" Java settings have changed!",
- static_cast< cppu::OWeakObject * >(this));
+ getXWeak());
askForRetry(css::uno::Any(exc));
return css::uno::Any();
}
@@ -659,7 +659,7 @@ JavaVirtualMachine::getJavaVM(css::uno::Sequence< sal_Int8 > const & rProcessId)
//enable the use of a JRE now?
css::java::JavaDisabledException exc(
"JavaVirtualMachine::getJavaVM failed because Java is disabled!",
- static_cast< cppu::OWeakObject * >(this));
+ getXWeak());
if( ! askForRetry(css::uno::Any(exc)))
return css::uno::Any();
continue;
@@ -696,7 +696,7 @@ JavaVirtualMachine::getJavaVM(css::uno::Sequence< sal_Int8 > const & rProcessId)
//and select it under Tools - Options - %PRODUCTNAME - Java.
css::java::JavaVMCreationFailureException exc(
"JavaVirtualMachine::getJavaVM failed because Java is defective!",
- static_cast< cppu::OWeakObject * >(this), 0);
+ getXWeak(), 0);
askForRetry(css::uno::Any(exc));
return css::uno::Any();
}
@@ -714,7 +714,7 @@ JavaVirtualMachine::getJavaVM(css::uno::Sequence< sal_Int8 > const & rProcessId)
css::java::RestartRequiredException exc(
"JavaVirtualMachine::getJavaVM failed because "
"Office must be restarted before Java can be used!",
- static_cast< cppu::OWeakObject * >(this));
+ getXWeak());
askForRetry(css::uno::Any(exc));
return css::uno::Any();
}
@@ -752,7 +752,7 @@ JavaVirtualMachine::getJavaVM(css::uno::Sequence< sal_Int8 > const & rProcessId)
css::uno::Any anyEx = cppu::getCaughtException();
throw css::lang::WrappedTargetRuntimeException(
"jvmaccess::VirtualMachine::AttachGuard::CreationException occurred",
- static_cast< cppu::OWeakObject * >(this), anyEx );
+ getXWeak(), anyEx );
}
}
switch (returnType) {
@@ -761,7 +761,7 @@ JavaVirtualMachine::getJavaVM(css::uno::Sequence< sal_Int8 > const & rProcessId)
throw css::uno::RuntimeException(
"JavaVirtualMachine service was initialized in a way"
" that the requested JavaVM pointer is not available",
- static_cast< cppu::OWeakObject * >(this));
+ getXWeak());
}
return css::uno::Any(reinterpret_cast< sal_IntPtr >(m_pJavaVm));
case RETURN_VIRTUALMACHINE:
@@ -781,7 +781,7 @@ sal_Bool SAL_CALL JavaVirtualMachine::isVMStarted()
osl::MutexGuard aGuard(m_aMutex);
if (m_bDisposed)
throw css::lang::DisposedException(
- OUString(), static_cast< cppu::OWeakObject * >(this));
+ OUString(), getXWeak());
return m_xUnoVirtualMachine.is();
}
@@ -791,7 +791,7 @@ sal_Bool SAL_CALL JavaVirtualMachine::isVMEnabled()
osl::MutexGuard aGuard(m_aMutex);
if (m_bDisposed)
throw css::lang::DisposedException(
- OUString(), static_cast< cppu::OWeakObject * >(this));
+ OUString(), getXWeak());
}
// stoc_javavm::JVM aJvm;
// initVMConfiguration(&aJvm, m_xContext->getServiceManager(), m_xContext);
@@ -808,7 +808,7 @@ sal_Bool SAL_CALL JavaVirtualMachine::isThreadAttached()
osl::MutexGuard aGuard(m_aMutex);
if (m_bDisposed)
throw css::lang::DisposedException(
- OUString(), static_cast< cppu::OWeakObject * >(this));
+ OUString(), getXWeak());
// TODO isThreadAttached only returns true if the thread was attached via
// registerThread:
GuardStack * pStack
@@ -821,11 +821,11 @@ void SAL_CALL JavaVirtualMachine::registerThread()
osl::MutexGuard aGuard(m_aMutex);
if (m_bDisposed)
throw css::lang::DisposedException(
- "", static_cast< cppu::OWeakObject * >(this));
+ "", getXWeak());
if (!m_xUnoVirtualMachine.is())
throw css::uno::RuntimeException(
"JavaVirtualMachine::registerThread: null VirtualMachine",
- static_cast< cppu::OWeakObject * >(this));
+ getXWeak());
GuardStack * pStack
= static_cast< GuardStack * >(m_aAttachGuards.getData());
if (pStack == nullptr)
@@ -845,7 +845,7 @@ void SAL_CALL JavaVirtualMachine::registerThread()
throw css::lang::WrappedTargetRuntimeException(
"JavaVirtualMachine::registerThread: jvmaccess::"
"VirtualMachine::AttachGuard::CreationException",
- static_cast< cppu::OWeakObject * >(this), anyEx );
+ getXWeak(), anyEx );
}
}
@@ -854,17 +854,17 @@ void SAL_CALL JavaVirtualMachine::revokeThread()
osl::MutexGuard aGuard(m_aMutex);
if (m_bDisposed)
throw css::lang::DisposedException(
- "", static_cast< cppu::OWeakObject * >(this));
+ "", getXWeak());
if (!m_xUnoVirtualMachine.is())
throw css::uno::RuntimeException(
"JavaVirtualMachine::revokeThread: null VirtualMachine",
- static_cast< cppu::OWeakObject * >(this));
+ getXWeak());
GuardStack * pStack
= static_cast< GuardStack * >(m_aAttachGuards.getData());
if (pStack == nullptr || pStack->empty())
throw css::uno::RuntimeException(
"JavaVirtualMachine::revokeThread: no matching registerThread",
- static_cast< cppu::OWeakObject * >(this));
+ getXWeak());
delete pStack->top();
pStack->pop();
}
@@ -1116,7 +1116,7 @@ void SAL_CALL JavaVirtualMachine::elementReplaced(
css::uno::Any anyEx = cppu::getCaughtException();
throw css::lang::WrappedTargetRuntimeException(
"jvmaccess::VirtualMachine::AttachGuard::CreationException",
- static_cast< cppu::OWeakObject * >(this), anyEx );
+ getXWeak(), anyEx );
}
}
@@ -1356,7 +1356,7 @@ void JavaVirtualMachine::setUpUnoVirtualMachine(JNIEnv * environment) {
css::uno::Any anyEx = cppu::getCaughtException();
throw css::lang::WrappedTargetRuntimeException(
"css::lang::IllegalArgumentException",
- static_cast< cppu::OWeakObject * >(this), anyEx );
+ getXWeak(), anyEx );
}
OUString classPath;
try {
@@ -1457,7 +1457,7 @@ void JavaVirtualMachine::setUpUnoVirtualMachine(JNIEnv * environment) {
css::uno::Any anyEx = cppu::getCaughtException();
throw css::lang::WrappedTargetRuntimeException(
"jvmaccess::UnoVirtualMachine::CreationException",
- static_cast< cppu::OWeakObject * >(this), anyEx );
+ getXWeak(), anyEx );
}
}
@@ -1469,7 +1469,7 @@ void JavaVirtualMachine::handleJniException(JNIEnv * environment) {
#endif
throw css::uno::RuntimeException(
"JNI exception occurred",
- static_cast< cppu::OWeakObject * >(this));
+ getXWeak());
}
diff --git a/stoc/source/proxy_factory/proxyfac.cxx b/stoc/source/proxy_factory/proxyfac.cxx
index 6745d0163c70..2653363b3c36 100644
--- a/stoc/source/proxy_factory/proxyfac.cxx
+++ b/stoc/source/proxy_factory/proxyfac.cxx
@@ -292,8 +292,7 @@ Any ProxyRoot::queryAggregation( Type const & rType )
OSL_ASSERT( cpp_env != nullptr );
// mind a new delegator, calculate current root:
- Reference< XInterface > xRoot(
- static_cast< OWeakObject * >(this), UNO_QUERY_THROW );
+ Reference< XInterface > xRoot(getXWeak());
OUString oid;
(*cpp_env->getObjectIdentifier)( cpp_env, &oid.pData, xRoot.get() );
OSL_ASSERT( !oid.isEmpty() );
diff --git a/stoc/source/security/access_controller.cxx b/stoc/source/security/access_controller.cxx
index a99ea23b00e9..af58d1472878 100644
--- a/stoc/source/security/access_controller.cxx
+++ b/stoc/source/security/access_controller.cxx
@@ -370,7 +370,7 @@ AccessController::AccessController( Reference< XComponentContext > const & xComp
throw RuntimeException(
"expected a user id in component context entry "
"\"/services/" + SERVICE_NAME + "/single-user-id\"!",
- static_cast<OWeakObject *>(this) );
+ getXWeak() );
}
m_mode = Mode::SingleUser;
}
@@ -413,14 +413,14 @@ void AccessController::initialize(
if (Mode::SingleUser != m_mode) // only if in single-user mode
{
throw RuntimeException(
- "invalid call: ac must be in \"single-user\" mode!", static_cast<OWeakObject *>(this) );
+ "invalid call: ac must be in \"single-user\" mode!", getXWeak() );
}
OUString userId;
arguments[ 0 ] >>= userId;
if ( userId.isEmpty() )
{
throw RuntimeException(
- "expected a user-id as first argument!", static_cast<OWeakObject *>(this) );
+ "expected a user-id as first argument!", getXWeak() );
}
// assured that no sync is necessary: no check happens at this forking time
m_singleUserId = userId;
@@ -439,7 +439,7 @@ Reference< security::XPolicy > const & AccessController::getPolicy()
if (!xPolicy.is())
{
throw SecurityException(
- "cannot get policy singleton!", static_cast<OWeakObject *>(this) );
+ "cannot get policy singleton!", getXWeak() );
}
MutexGuard guard( m_aMutex );
@@ -576,7 +576,7 @@ PermissionCollection AccessController::getEffectivePermissions(
if ( userId.isEmpty() )
{
throw SecurityException(
- "cannot determine current user in multi-user ac!", static_cast<OWeakObject *>(this) );
+ "cannot determine current user in multi-user ac!", getXWeak() );
}
// lookup policy for user
@@ -721,7 +721,7 @@ void AccessController::checkPermission(
if (rBHelper.bDisposed)
{
throw lang::DisposedException(
- "checkPermission() call on disposed AccessController!", static_cast<OWeakObject *>(this) );
+ "checkPermission() call on disposed AccessController!", getXWeak() );
}
if (Mode::Off == m_mode)
@@ -750,7 +750,7 @@ Any AccessController::doRestricted(
if (rBHelper.bDisposed)
{
throw lang::DisposedException(
- "doRestricted() call on disposed AccessController!", static_cast<OWeakObject *>(this) );
+ "doRestricted() call on disposed AccessController!", getXWeak() );
}
if (Mode::Off == m_mode) // optimize this way, because no dynamic check will be performed
@@ -782,7 +782,7 @@ Any AccessController::doPrivileged(
if (rBHelper.bDisposed)
{
throw lang::DisposedException(
- "doPrivileged() call on disposed AccessController!", static_cast<OWeakObject *>(this) );
+ "doPrivileged() call on disposed AccessController!", getXWeak() );
}
if (Mode::Off == m_mode) // no dynamic check will be performed
@@ -816,7 +816,7 @@ Reference< security::XAccessControlContext > AccessController::getContext()
if (rBHelper.bDisposed)
{
throw lang::DisposedException(
- "getContext() call on disposed AccessController!", static_cast<OWeakObject *>(this) );
+ "getContext() call on disposed AccessController!", getXWeak() );
}
if (Mode::Off == m_mode) // optimize this way, because no dynamic check will be performed
diff --git a/stoc/source/security/file_policy.cxx b/stoc/source/security/file_policy.cxx
index 1a8e8a2b86c9..5bbd604b1a72 100644
--- a/stoc/source/security/file_policy.cxx
+++ b/stoc/source/security/file_policy.cxx
@@ -374,7 +374,7 @@ void FilePolicy::refresh()
{
throw RuntimeException(
"name of policy file unknown!",
- static_cast<OWeakObject *>(this) );
+ getXWeak() );
}
PolicyReader reader( fileName, m_ac );
diff --git a/stoc/source/servicemanager/servicemanager.cxx b/stoc/source/servicemanager/servicemanager.cxx
index c42e97a9160d..cc2a51026ab5 100644
--- a/stoc/source/servicemanager/servicemanager.cxx
+++ b/stoc/source/servicemanager/servicemanager.cxx
@@ -413,7 +413,7 @@ void OServiceManager::check_undisposed() const
{
throw lang::DisposedException(
"service manager instance has already been disposed!",
- static_cast<OWeakObject *>(const_cast<OServiceManager *>(this)) );
+ const_cast<OServiceManager *>(this)->getXWeak() );
}
}
@@ -522,7 +522,7 @@ void SAL_CALL OServiceManagerWrapper::setPropertyValue(
{
throw IllegalArgumentException(
"no XComponentContext given!",
- static_cast<OWeakObject *>(this), 1 );
+ getXWeak(), 1 );
}
MutexGuard aGuard( m_aMutex );
@@ -659,7 +659,7 @@ void OServiceManager::setPropertyValue(
{
throw UnknownPropertyException(
"unknown property " + PropertyName,
- static_cast<OWeakObject *>(this) );
+ getXWeak() );
}
Reference< XComponentContext > xContext;
@@ -667,7 +667,7 @@ void OServiceManager::setPropertyValue(
{
throw IllegalArgumentException(
"no XComponentContext given!",
- static_cast<OWeakObject *>(this), 1 );
+ getXWeak(), 1 );
}
MutexGuard aGuard( m_aMutex );
@@ -1071,7 +1071,7 @@ void OServiceManager::remove( const Any & Element )
{
throw NoSuchElementException(
"element is not in: " + *implName,
- static_cast< OWeakObject * >(this) );
+ getXWeak() );
}
xEle = iFind->second;
}
@@ -1093,7 +1093,7 @@ void OServiceManager::remove( const Any & Element )
{
throw NoSuchElementException(
"element not found",
- static_cast< OWeakObject * >(this) );
+ getXWeak() );
}
//First remove all factories which have been loaded by ORegistryServiceManager.
m_SetLoadedFactories.erase( *aIt);
diff --git a/stoc/source/simpleregistry/simpleregistry.cxx b/stoc/source/simpleregistry/simpleregistry.cxx
index 82e53417e2a3..f793aa56dbe5 100644
--- a/stoc/source/simpleregistry/simpleregistry.cxx
+++ b/stoc/source/simpleregistry/simpleregistry.cxx
@@ -226,7 +226,7 @@ css::registry::RegistryValueType Key::getValueType()
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry key getValueType:"
" underlying RegistryKey::getValueInfo() = " + OUString::number(static_cast<int>(err)),
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
switch (type) {
default:
@@ -263,12 +263,12 @@ sal_Int32 Key::getLongValue()
throw css::registry::InvalidValueException(
"com.sun.star.registry.SimpleRegistry key getLongValue:"
" underlying RegistryKey::getValue() = RegError::INVALID_VALUE",
- static_cast< OWeakObject * >(this));
+ getXWeak());
default:
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry key getLongValue:"
" underlying RegistryKey::getValue() = " + OUString::number(static_cast<int>(err)),
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
return value;
}
@@ -282,7 +282,7 @@ void Key::setLongValue(sal_Int32 value)
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry key setLongValue:"
" underlying RegistryKey::setValue() = " + OUString::number(static_cast<int>(err)),
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
}
@@ -301,19 +301,19 @@ css::uno::Sequence< sal_Int32 > Key::getLongListValue()
"com.sun.star.registry.SimpleRegistry key getLongListValue:"
" underlying RegistryKey::getLongListValue() ="
" RegError::INVALID_VALUE",
- static_cast< OWeakObject * >(this));
+ getXWeak());
default:
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry key getLongListValue:"
" underlying RegistryKey::getLongListValue() = " + OUString::number(static_cast<int>(err)),
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
sal_uInt32 n = list.getLength();
if (n > SAL_MAX_INT32) {
throw css::registry::InvalidValueException(
"com.sun.star.registry.SimpleRegistry key getLongListValue:"
" underlying RegistryKey::getLongListValue() too large",
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
css::uno::Sequence< sal_Int32 > value(static_cast< sal_Int32 >(n));
auto aValueRange = asNonConstRange(value);
@@ -332,7 +332,7 @@ void Key::setLongListValue(css::uno::Sequence< sal_Int32 > const & seqValue)
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry key setLongListValue:"
" underlying RegistryKey::setLongListValue() = " + OUString::number(static_cast<int>(err)),
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
}
@@ -346,13 +346,13 @@ OUString Key::getAsciiValue()
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry key getAsciiValue:"
" underlying RegistryKey::getValueInfo() = " + OUString::number(static_cast<int>(err)),
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
if (type != RegValueType::STRING) {
throw css::registry::InvalidValueException(
"com.sun.star.registry.SimpleRegistry key getAsciiValue:"
" underlying RegistryKey type = " + OUString::number(static_cast<int>(type)),
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
// size contains terminating null (error in underlying registry.cxx):
if (size == 0) {
@@ -360,13 +360,13 @@ OUString Key::getAsciiValue()
"com.sun.star.registry.SimpleRegistry key getAsciiValue:"
" underlying RegistryKey size 0 cannot happen due to"
" design error",
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
if (size > SAL_MAX_INT32) {
throw css::registry::InvalidValueException(
"com.sun.star.registry.SimpleRegistry key getAsciiValue:"
" underlying RegistryKey size too large",
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
std::vector< char > list(size);
err = key_->getValue(OUString(), list.data());
@@ -374,14 +374,14 @@ OUString Key::getAsciiValue()
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry key getAsciiValue:"
" underlying RegistryKey::getValue() = " + OUString::number(static_cast<int>(err)),
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
if (list[size - 1] != '\0') {
throw css::registry::InvalidValueException(
"com.sun.star.registry.SimpleRegistry key getAsciiValue:"
" underlying RegistryKey value must be null-terminated due"
" to design error",
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
OUString value;
if (!rtl_convertStringToUString(
@@ -394,7 +394,7 @@ OUString Key::getAsciiValue()
throw css::registry::InvalidValueException(
"com.sun.star.registry.SimpleRegistry key getAsciiValue:"
" underlying RegistryKey not UTF-8",
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
return value;
}
@@ -411,7 +411,7 @@ void Key::setAsciiValue(OUString const & value)
throw css::uno::RuntimeException(
"com.sun.star.registry.SimpleRegistry key setAsciiValue:"
" value not UTF-16",
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
RegError err = key_->setValue(
OUString(), RegValueType::STRING,
@@ -421,7 +421,7 @@ void Key::setAsciiValue(OUString const & value)
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry key setAsciiValue:"
" underlying RegistryKey::setValue() = " + OUString::number(static_cast<int>(err)),
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
}
@@ -440,13 +440,13 @@ css::uno::Sequence< OUString > Key::getAsciiListValue()
"com.sun.star.registry.SimpleRegistry key"
" getAsciiListValue: underlying"
" RegistryKey::getStringListValue() = RegError::INVALID_VALUE",
- static_cast< OWeakObject * >(this));
+ getXWeak());
default:
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry key"
" getAsciiListValue: underlying"
" RegistryKey::getStringListValue() = " + OUString::number(static_cast<int>(err)),
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
sal_uInt32 n = list.getLength();
if (n > SAL_MAX_INT32) {
@@ -454,7 +454,7 @@ css::uno::Sequence< OUString > Key::getAsciiListValue()
"com.sun.star.registry.SimpleRegistry key"
" getAsciiListValue: underlying"
" RegistryKey::getStringListValue() too large",
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
css::uno::Sequence< OUString > value(static_cast< sal_Int32 >(n));
auto aValueRange = asNonConstRange(value);
@@ -472,7 +472,7 @@ css::uno::Sequence< OUString > Key::getAsciiListValue()
"com.sun.star.registry.SimpleRegistry key"
" getAsciiListValue: underlying RegistryKey not"
" UTF-8",
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
}
return value;
@@ -493,7 +493,7 @@ void Key::setAsciiListValue(
throw css::uno::RuntimeException(
"com.sun.star.registry.SimpleRegistry key"
" setAsciiListValue: value not UTF-16",
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
list.push_back(utf8);
}
@@ -509,7 +509,7 @@ void Key::setAsciiListValue(
"com.sun.star.registry.SimpleRegistry key"
" setAsciiListValue: underlying"
" RegistryKey::setStringListValue() = " + OUString::number(static_cast<int>(err)),
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
}
@@ -523,13 +523,13 @@ OUString Key::getStringValue()
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry key getStringValue:"
" underlying RegistryKey::getValueInfo() = " + OUString::number(static_cast<int>(err)),
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
if (type != RegValueType::UNICODE) {
throw css::registry::InvalidValueException(
"com.sun.star.registry.SimpleRegistry key getStringValue:"
" underlying RegistryKey type = " + OUString::number(static_cast<int>(type)),
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
// size contains terminating null and is *2 (error in underlying
// registry.cxx):
@@ -538,13 +538,13 @@ OUString Key::getStringValue()
"com.sun.star.registry.SimpleRegistry key getStringValue:"
" underlying RegistryKey size 0 or odd cannot happen due to"
" design error",
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
if (size > SAL_MAX_INT32) {
throw css::registry::InvalidValueException(
"com.sun.star.registry.SimpleRegistry key getStringValue:"
" underlying RegistryKey size too large",
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
std::vector< sal_Unicode > list(size);
err = key_->getValue(OUString(), list.data());
@@ -552,14 +552,14 @@ OUString Key::getStringValue()
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry key getStringValue:"
" underlying RegistryKey::getValue() = " + OUString::number(static_cast<int>(err)),
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
if (list[size/2 - 1] != 0) {
throw css::registry::InvalidValueException(
"com.sun.star.registry.SimpleRegistry key getStringValue:"
" underlying RegistryKey value must be null-terminated due"
" to design error",
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
return OUString(list.data(), static_cast< sal_Int32 >(size/2 - 1));
}
@@ -576,7 +576,7 @@ void Key::setStringValue(OUString const & value)
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry key setStringValue:"
" underlying RegistryKey::setValue() = " + OUString::number(static_cast<int>(err)),
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
}
@@ -595,13 +595,13 @@ css::uno::Sequence< OUString > Key::getStringListValue()
"com.sun.star.registry.SimpleRegistry key"
" getStringListValue: underlying"
" RegistryKey::getUnicodeListValue() = RegError::INVALID_VALUE",
- static_cast< OWeakObject * >(this));
+ getXWeak());
default:
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry key"
" getStringListValue: underlying"
" RegistryKey::getUnicodeListValue() = " + OUString::number(static_cast<int>(err)),
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
sal_uInt32 n = list.getLength();
if (n > SAL_MAX_INT32) {
@@ -609,7 +609,7 @@ css::uno::Sequence< OUString > Key::getStringListValue()
"com.sun.star.registry.SimpleRegistry key"
" getStringListValue: underlying"
" RegistryKey::getUnicodeListValue() too large",
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
css::uno::Sequence< OUString > value(static_cast< sal_Int32 >(n));
auto aValueRange = asNonConstRange(value);
@@ -634,7 +634,7 @@ void Key::setStringListValue(
"com.sun.star.registry.SimpleRegistry key"
" setStringListValue: underlying"
" RegistryKey::setUnicodeListValue() = " + OUString::number(static_cast<int>(err)),
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
}
@@ -648,19 +648,19 @@ css::uno::Sequence< sal_Int8 > Key::getBinaryValue()
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry key getBinaryValue:"
" underlying RegistryKey::getValueInfo() = " + OUString::number(static_cast<int>(err)),
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
if (type != RegValueType::BINARY) {
throw css::registry::InvalidValueException(
"com.sun.star.registry.SimpleRegistry key getBinaryValue:"
" underlying RegistryKey type = " + OUString::number(static_cast<int>(type)),
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
if (size > SAL_MAX_INT32) {
throw css::registry::InvalidValueException(
"com.sun.star.registry.SimpleRegistry key getBinaryValue:"
" underlying RegistryKey size too large",
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
css::uno::Sequence< sal_Int8 > value(static_cast< sal_Int32 >(size));
err = key_->getValue(OUString(), value.getArray());
@@ -668,7 +668,7 @@ css::uno::Sequence< sal_Int8 > Key::getBinaryValue()
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry key getBinaryValue:"
" underlying RegistryKey::getValue() = " + OUString::number(static_cast<int>(err)),
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
return value;
}
@@ -684,7 +684,7 @@ void Key::setBinaryValue(css::uno::Sequence< sal_Int8 > const & value)
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry key setBinaryValue:"
" underlying RegistryKey::setValue() = " + OUString::number(static_cast<int>(err)),
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
}
@@ -703,7 +703,7 @@ css::uno::Reference< css::registry::XRegistryKey > Key::openKey(
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry key openKey:"
" underlying RegistryKey::openKey() = " + OUString::number(static_cast<int>(err)),
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
}
@@ -722,7 +722,7 @@ css::uno::Reference< css::registry::XRegistryKey > Key::createKey(
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry key createKey:"
" underlying RegistryKey::createKey() = " + OUString::number(static_cast<int>(err)),
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
}
@@ -734,7 +734,7 @@ void Key::closeKey()
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry key closeKey:"
" underlying RegistryKey::closeKey() = " + OUString::number(static_cast<int>(err)),
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
}
@@ -746,7 +746,7 @@ void Key::deleteKey(OUString const & rKeyName)
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry key deleteKey:"
" underlying RegistryKey::deleteKey() = " + OUString::number(static_cast<int>(err)),
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
}
@@ -760,14 +760,14 @@ Key::openKeys()
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry key openKeys:"
" underlying RegistryKey::openSubKeys() = " + OUString::number(static_cast<int>(err)),
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
sal_uInt32 n = list.getLength();
if (n > SAL_MAX_INT32) {
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry key getKeyNames:"
" underlying RegistryKey::getKeyNames() too large",
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
css::uno::Sequence< css::uno::Reference< css::registry::XRegistryKey > >
keys(static_cast< sal_Int32 >(n));
@@ -788,14 +788,14 @@ css::uno::Sequence< OUString > Key::getKeyNames()
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry key getKeyNames:"
" underlying RegistryKey::getKeyNames() = " + OUString::number(static_cast<int>(err)),
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
sal_uInt32 n = list.getLength();
if (n > SAL_MAX_INT32) {
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry key getKeyNames:"
" underlying RegistryKey::getKeyNames() too large",
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
css::uno::Sequence< OUString > names(static_cast< sal_Int32 >(n));
auto aNamesRange = asNonConstRange(names);
@@ -810,21 +810,21 @@ sal_Bool Key::createLink(
{
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry key createLink: links are no longer supported",
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
void Key::deleteLink(OUString const & /*rLinkName*/)
{
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry key deleteLink: links are no longer supported",
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
OUString Key::getLinkTarget(OUString const & /*rLinkName*/)
{
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry key getLinkTarget: links are no longer supported",
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
OUString Key::getResolvedName(OUString const & aKeyName)
@@ -836,7 +836,7 @@ OUString Key::getResolvedName(OUString const & aKeyName)
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry key getResolvedName:"
" underlying RegistryKey::getResolvedName() = " + OUString::number(static_cast<int>(err)),
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
return resolved;
}
@@ -860,7 +860,7 @@ void SimpleRegistry::open(
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry.open(" + rURL +
"): underlying Registry::open/create() = " + OUString::number(static_cast<int>(err)),
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
}
@@ -877,7 +877,7 @@ void SimpleRegistry::close()
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry.close:"
" underlying Registry::close() = " + OUString::number(static_cast<int>(err)),
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
}
@@ -889,7 +889,7 @@ void SimpleRegistry::destroy()
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry.destroy:"
" underlying Registry::destroy() = " + OUString::number(static_cast<int>(err)),
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
}
@@ -902,7 +902,7 @@ css::uno::Reference< css::registry::XRegistryKey > SimpleRegistry::getRootKey()
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry.getRootKey:"
" underlying Registry::getRootKey() = " + OUString::number(static_cast<int>(err)),
- static_cast< OWeakObject * >(this));
+ getXWeak());
}
return new Key(this, root);
}
diff --git a/stoc/source/typeconv/convert.cxx b/stoc/source/typeconv/convert.cxx
index 51b857b424c6..c3cd1b999726 100644
--- a/stoc/source/typeconv/convert.cxx
+++ b/stoc/source/typeconv/convert.cxx
@@ -538,7 +538,7 @@ Any SAL_CALL TypeConverter_Impl::convertTo( const Any& rVal, const Type& aDestTy
if (!aDestTD.is()) {
throw css::lang::IllegalArgumentException(
"Bad XTypeConverter::convertTo destination " + aDestType.getTypeName(),
- static_cast<cppu::OWeakObject *>(this), 1);
+ getXWeak(), 1);
}
typelib_TypeDescription * pSourceElementTD = nullptr;
TYPELIB_DANGER_GET(
diff --git a/stoc/source/uriproc/UriReferenceFactory.cxx b/stoc/source/uriproc/UriReferenceFactory.cxx
index 6b78fa079d15..257391771340 100644
--- a/stoc/source/uriproc/UriReferenceFactory.cxx
+++ b/stoc/source/uriproc/UriReferenceFactory.cxx
@@ -392,7 +392,7 @@ css::uno::Reference< css::uri::XUriReference > Factory::parse(
css::uno::Any anyEx = cppu::getCaughtException();
throw css::lang::WrappedTargetRuntimeException(
"creating service " + serviceName,
- static_cast< cppu::OWeakObject * >(this),
+ getXWeak(),
anyEx);
}
if (service.is()) {
diff --git a/stoc/test/javavm/jvm_interaction/interactionhandler.cxx b/stoc/test/javavm/jvm_interaction/interactionhandler.cxx
index b82ef594afda..f1c4baf863cf 100644
--- a/stoc/test/javavm/jvm_interaction/interactionhandler.cxx
+++ b/stoc/test/javavm/jvm_interaction/interactionhandler.cxx
@@ -75,8 +75,7 @@ Any SAL_CALL Context::getValueByName( const OUString& Name) throw (RuntimeExcept
Any retVal;
if( Name.equals( INTERACTION_HANDLER_NAME))
{
- Reference<XInteractionHandler> handler( static_cast<XWeak*>(new InteractionHandler()),
- UNO_QUERY);
+ Reference<XInteractionHandler> handler(new InteractionHandler());
retVal <<= handler;
}
return retVal;
@@ -119,7 +118,7 @@ void SAL_CALL InteractionHandler::handle( const Reference< XInteractionRequest >
sal_Bool test1(const Reference< XMultiServiceFactory > & xMgr )
{
sal_Bool retVal= sal_True;
- setCurrentContext( Reference<XCurrentContext>( static_cast<XWeak*>(new Context()), UNO_QUERY));
+ setCurrentContext(Reference<XCurrentContext>(new Context());
OUString sVMService("com.sun.star.java.JavaVirtualMachine");
Reference<XInterface> xXInt= xMgr->createInstance(sVMService);
diff --git a/stoc/test/registry_tdprovider/testregistrytdprovider.cxx b/stoc/test/registry_tdprovider/testregistrytdprovider.cxx
index 879859b92e27..46e3d0998b01 100644
--- a/stoc/test/registry_tdprovider/testregistrytdprovider.cxx
+++ b/stoc/test/registry_tdprovider/testregistrytdprovider.cxx
@@ -741,7 +741,7 @@ css::uno::Reference< css::uno::XInterface > Service::createInstance(
css::uno::Reference< css::uno::XComponentContext > const & context)
throw (css::uno::Exception)
{
- return static_cast< cppu::OWeakObject * >(new Service(context));
+ return cppu::getXWeak(new Service(context));
}
extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(char const * implName,
diff --git a/stoc/test/tdmanager/testtdmanager.cxx b/stoc/test/tdmanager/testtdmanager.cxx
index e466904b4314..7c9971d6aa64 100644
--- a/stoc/test/tdmanager/testtdmanager.cxx
+++ b/stoc/test/tdmanager/testtdmanager.cxx
@@ -275,7 +275,7 @@ css::uno::Reference< css::uno::XInterface > Service::createInstance(
css::uno::Reference< css::uno::XComponentContext > const & context)
throw (css::uno::Exception)
{
- return static_cast< cppu::OWeakObject * >(new Service(context));
+ return cppu::getXWeak(new Service(context));
}
extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(char const * implName,
diff --git a/stoc/test/testproxyfac.cxx b/stoc/test/testproxyfac.cxx
index 2388ac078b53..befc67ae8ee3 100644
--- a/stoc/test/testproxyfac.cxx
+++ b/stoc/test/testproxyfac.cxx
@@ -92,7 +92,7 @@ Any TargetObject::queryInterface( Type const & type )
return ret;
throw lang::DisposedException(
OUString( "my test exception" ),
- static_cast< OWeakObject * >(this) );
+ getXWeak() );
}
int TargetObject::s_obj = 0;
@@ -146,7 +146,7 @@ Reference< XInterface > TestMaster::create(
Reference< reflection::XProxyFactory > const & xProxyFac )
{
TestMaster * that = new TestMaster;
- Reference< XInterface > xRet( static_cast< OWeakObject * >( that ) );
+ Reference< XInterface > xRet( getXWeak( that ) );
{
Reference< XAggregation > xAgg( xProxyFac->createProxy( xTarget ) );
// ownership take over
@@ -162,7 +162,7 @@ Reference< XInterface > TestMaster::create(
Reference< reflection::XProxyFactory > const & xProxyFac )
{
return create(
- static_cast< OWeakObject * >( new TargetObject ), xProxyFac );
+ getXWeak( new TargetObject ), xProxyFac );
}
@@ -268,7 +268,7 @@ SAL_IMPLEMENT_MAIN()
Reference< XAggregation > x(
xProxyFac->createProxy(
- static_cast< OWeakObject * >( new TargetObject ) ) );
+ getXWeak( new TargetObject ) ) );
// no call
{
@@ -303,7 +303,7 @@ SAL_IMPLEMENT_MAIN()
test_proxyfac(
xProxyFac->createProxy(
- static_cast< OWeakObject * >( new TargetObject ) ),
+ getXWeak( new TargetObject ) ),
OUString( "target" ),
xProxyFac );
uno_dumpEnvironment( stdout, cpp_env.get(), 0 );