summaryrefslogtreecommitdiff
path: root/basic/source/classes
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2023-04-23 20:12:58 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2023-06-18 09:34:24 +0200
commit8da305acc9bc1fa0a31cd61d5da632e6bb4ae48c (patch)
tree1860abbcf9c15c410f7843e4713c23bf7215159c /basic/source/classes
parent89a25bcda3dde0147f7b4f24eccfffa3216c8c0e (diff)
Use getXWeak in basic
Change-Id: I0915360548ccc02d731eb915b5d32508cedd1461 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150835 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'basic/source/classes')
-rw-r--r--basic/source/classes/propacc.cxx33
-rw-r--r--basic/source/classes/sbunoobj.cxx2
-rw-r--r--basic/source/classes/sbxmod.cxx2
3 files changed, 17 insertions, 20 deletions
diff --git a/basic/source/classes/propacc.cxx b/basic/source/classes/propacc.cxx
index 4c948c3038af..f9eacc3d1298 100644
--- a/basic/source/classes/propacc.cxx
+++ b/basic/source/classes/propacc.cxx
@@ -129,7 +129,7 @@ Sequence< PropertyValue > SbPropertyValues::getPropertyValues()
void SbPropertyValues::setPropertyValues(const Sequence< PropertyValue >& rPropertyValues )
{
if (!m_aPropVals.empty())
- throw IllegalArgumentException("m_aPropVals not empty", static_cast<cppu::OWeakObject*>(this), -1);
+ throw IllegalArgumentException("m_aPropVals not empty", getXWeak(), -1);
for (const PropertyValue& i : rPropertyValues)
{
@@ -150,26 +150,23 @@ void RTL_Impl_CreatePropertySet( SbxArray& rPar )
// Get class names of struct
- Reference< XInterface > xInterface = static_cast<OWeakObject*>(new SbPropertyValues());
+ Reference xInterface(getXWeak(new SbPropertyValues()));
SbxVariableRef refVar = rPar.Get(0);
- if( xInterface.is() )
+ // Set PropertyValues
+ Any aArgAsAny = sbxToUnoValue(rPar.Get(1),
+ cppu::UnoType<Sequence<PropertyValue>>::get() );
+ auto pArg = o3tl::doAccess<Sequence<PropertyValue>>(aArgAsAny);
+ Reference< XPropertyAccess > xPropAcc( xInterface, UNO_QUERY );
+ xPropAcc->setPropertyValues( *pArg );
+
+ // Build a SbUnoObject and return it
+ auto xUnoObj = tools::make_ref<SbUnoObject>( "stardiv.uno.beans.PropertySet", Any(xInterface) );
+ if( xUnoObj->getUnoAny().hasValue() )
{
- // Set PropertyValues
- Any aArgAsAny = sbxToUnoValue(rPar.Get(1),
- cppu::UnoType<Sequence<PropertyValue>>::get() );
- auto pArg = o3tl::doAccess<Sequence<PropertyValue>>(aArgAsAny);
- Reference< XPropertyAccess > xPropAcc( xInterface, UNO_QUERY );
- xPropAcc->setPropertyValues( *pArg );
-
- // Build a SbUnoObject and return it
- auto xUnoObj = tools::make_ref<SbUnoObject>( "stardiv.uno.beans.PropertySet", Any(xInterface) );
- if( xUnoObj->getUnoAny().hasValue() )
- {
- // Return object
- refVar->PutObject( xUnoObj.get() );
- return;
- }
+ // Return object
+ refVar->PutObject( xUnoObj.get() );
+ return;
}
// Object could not be created
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index 36feb923a6de..b9db47dcd306 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -3960,7 +3960,7 @@ Any SAL_CALL InvocationToAllListenerMapper::invoke(const OUString& FunctionName,
}
AllEventObject aAllEvent;
- aAllEvent.Source = static_cast<OWeakObject*>(this);
+ aAllEvent.Source = getXWeak();
aAllEvent.Helper = m_Helper;
aAllEvent.ListenerType = Type(m_xListenerType->getTypeClass(), m_xListenerType->getName() );
aAllEvent.MethodName = FunctionName;
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index cce2caca22b4..5b7ee24e1f9c 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -165,7 +165,7 @@ DocObjectWrapper::DocObjectWrapper( SbModule* pVar ) : m_pMod( pVar )
instances that are acquired during the call are released
before m_refCount is decremented again */
{
- m_xAggProxy->setDelegator( static_cast< cppu::OWeakObject * >( this ) );
+ m_xAggProxy->setDelegator( getXWeak() );
}
osl_atomic_decrement( &m_refCount );