svtools/source/control/valueacc.cxx |    6 +++---
 svtools/source/control/valueset.cxx |    4 ++--
 svtools/source/uno/unoimap.cxx      |   10 +++++-----
 3 files changed, 10 insertions(+), 10 deletions(-)

New commits:
commit 6276e7c28ed53670fb911ec2bd97a6696583d36b
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Sun Apr 23 20:15:01 2023 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Sat May 6 07:25:32 2023 +0200

    Use getXWeak in svtools
    
    Change-Id: Ia985e96eb441d03ace050f4f184a899fba897830
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150873
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/svtools/source/control/valueacc.cxx 
b/svtools/source/control/valueacc.cxx
index 1ba2c79dbbab..a14676d403fa 100644
--- a/svtools/source/control/valueacc.cxx
+++ b/svtools/source/control/valueacc.cxx
@@ -387,7 +387,7 @@ void ValueItemAcc::FireAccessibleEvent( short nEventId, 
const uno::Any& rOldValu
     accessibility::AccessibleEventObject                                       
                 aEvtObject;
 
     aEvtObject.EventId = nEventId;
-    aEvtObject.Source = static_cast<uno::XWeak*>(this);
+    aEvtObject.Source = getXWeak();
     aEvtObject.NewValue = rNewValue;
     aEvtObject.OldValue = rOldValue;
 
@@ -418,7 +418,7 @@ void ValueSetAcc::FireAccessibleEvent( short nEventId, 
const uno::Any& rOldValue
     accessibility::AccessibleEventObject                                       
                 aEvtObject;
 
     aEvtObject.EventId = nEventId;
-    aEvtObject.Source = static_cast<uno::XWeak*>(this);
+    aEvtObject.Source = getXWeak();
     aEvtObject.NewValue = rNewValue;
     aEvtObject.OldValue = rOldValue;
 
@@ -952,7 +952,7 @@ void ValueSetAcc::ThrowIfDisposed()
         SAL_WARN("svx", "Calling disposed object. Throwing exception:");
         throw lang::DisposedException (
             "object has been already disposed",
-            static_cast<uno::XWeak*>(this));
+            getXWeak());
     }
     else
     {
diff --git a/svtools/source/control/valueset.cxx 
b/svtools/source/control/valueset.cxx
index 76bce45c8de3..933f8d42ca49 100644
--- a/svtools/source/control/valueset.cxx
+++ b/svtools/source/control/valueset.cxx
@@ -804,7 +804,7 @@ void ValueSet::SelectItem( sal_uInt16 nItemId )
             {
                 Any aOldAny;
                 Any aNewAny;
-                aOldAny <<= 
Reference<XInterface>(static_cast<cppu::OWeakObject*>(pItemAcc));
+                aOldAny <<= Reference(getXWeak(pItemAcc));
                 
ImplFireAccessibleEvent(AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOldAny, 
aNewAny );
             }
         }
@@ -827,7 +827,7 @@ void ValueSet::SelectItem( sal_uInt16 nItemId )
     {
         Any aOldAny;
         Any aNewAny;
-        aNewAny <<= 
Reference<XInterface>(static_cast<cppu::OWeakObject*>(pItemAcc));
+        aNewAny <<= Reference(getXWeak(pItemAcc));
         ImplFireAccessibleEvent(AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, 
aOldAny, aNewAny);
     }
 
diff --git a/svtools/source/uno/unoimap.cxx b/svtools/source/uno/unoimap.cxx
index 64d7521fc63b..210e580818c0 100644
--- a/svtools/source/uno/unoimap.cxx
+++ b/svtools/source/uno/unoimap.cxx
@@ -671,27 +671,27 @@ void SvUnoImageMap::fillImageMap( ImageMap& rMap ) const
 
 Reference< XInterface > SvUnoImageMapRectangleObject_createInstance( const 
SvEventDescription* pSupportedMacroItems )
 {
-    return static_cast<XWeak*>(new SvUnoImageMapObject( 
IMapObjectType::Rectangle, pSupportedMacroItems ));
+    return getXWeak(new SvUnoImageMapObject( IMapObjectType::Rectangle, 
pSupportedMacroItems ));
 }
 
 Reference< XInterface > SvUnoImageMapCircleObject_createInstance( const 
SvEventDescription* pSupportedMacroItems )
 {
-    return static_cast<XWeak*>(new SvUnoImageMapObject( 
IMapObjectType::Circle, pSupportedMacroItems ));
+    return getXWeak(new SvUnoImageMapObject( IMapObjectType::Circle, 
pSupportedMacroItems ));
 }
 
 Reference< XInterface > SvUnoImageMapPolygonObject_createInstance( const 
SvEventDescription* pSupportedMacroItems )
 {
-    return static_cast<XWeak*>(new SvUnoImageMapObject( 
IMapObjectType::Polygon, pSupportedMacroItems ));
+    return getXWeak(new SvUnoImageMapObject( IMapObjectType::Polygon, 
pSupportedMacroItems ));
 }
 
 Reference< XInterface > SvUnoImageMap_createInstance()
 {
-    return static_cast<XWeak*>(new SvUnoImageMap);
+    return getXWeak(new SvUnoImageMap);
 }
 
 Reference< XInterface > SvUnoImageMap_createInstance( const ImageMap& rMap, 
const SvEventDescription* pSupportedMacroItems )
 {
-    return static_cast<XWeak*>(new SvUnoImageMap( rMap, pSupportedMacroItems 
));
+    return getXWeak(new SvUnoImageMap( rMap, pSupportedMacroItems ));
 }
 
 bool SvUnoImageMap_fillImageMap( const Reference< XInterface >& xImageMap, 
ImageMap& rMap )

Reply via email to