winaccessibility/inc/AccObjectManagerAgent.hxx            |   11 +++++++----
 winaccessibility/source/UAccCOM/MAccessible.cxx           |    3 +--
 winaccessibility/source/service/AccFrameEventListener.cxx |    3 +--
 winaccessibility/source/service/AccObjectManagerAgent.cxx |   14 ++++++--------
 winaccessibility/source/service/AccTopWindowListener.cxx  |    6 ++----
 5 files changed, 17 insertions(+), 20 deletions(-)

New commits:
commit 36be1ecdc8cc2ef36ff9db0ba8af78b4aeee774e
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Thu Sep 16 14:57:53 2021 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Sep 17 07:05:46 2021 +0200

    wina11y: Get rid of more HWND<->sal_Int64 casting
    
    ... by changing the first param for
    AccObjectManagerAgent::SaveTopWindowHandle
    to HWND.
    
    Change-Id: Ia94bd95c49a64e63b1be332bd03e83a288707d80
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122204
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/winaccessibility/inc/AccObjectManagerAgent.hxx 
b/winaccessibility/inc/AccObjectManagerAgent.hxx
index c3e1ee78c387..e4e87be3dc3c 100644
--- a/winaccessibility/inc/AccObjectManagerAgent.hxx
+++ b/winaccessibility/inc/AccObjectManagerAgent.hxx
@@ -85,8 +85,7 @@ public:
     short GetParentRole(css::accessibility::XAccessible* pXAcc );
     bool IsContainer(css::accessibility::XAccessible* pXAcc);
 
-    void SaveTopWindowHandle(sal_Int64 hWnd,
-            css::accessibility::XAccessible* pXAcc);
+    void SaveTopWindowHandle(HWND hWnd, css::accessibility::XAccessible* 
pXAcc);
 
     void UpdateChildState(css::accessibility::XAccessible* pXAcc);
 
diff --git a/winaccessibility/source/service/AccObjectManagerAgent.cxx 
b/winaccessibility/source/service/AccObjectManagerAgent.cxx
index 1e0c37729f31..ab909d495398 100644
--- a/winaccessibility/source/service/AccObjectManagerAgent.cxx
+++ b/winaccessibility/source/service/AccObjectManagerAgent.cxx
@@ -157,11 +157,10 @@ bool AccObjectManagerAgent::InsertAccObj(
    * @return void
    */
 void
-AccObjectManagerAgent::SaveTopWindowHandle(sal_Int64 hWnd, XAccessible* pXAcc)
+AccObjectManagerAgent::SaveTopWindowHandle(HWND hWnd, XAccessible* pXAcc)
 {
     if( pWinManager )
-        pWinManager->SaveTopWindowHandle(
-                static_cast<HWND>(reinterpret_cast<void*>(hWnd)), pXAcc);
+        pWinManager->SaveTopWindowHandle(hWnd, pXAcc);
 }
 
 
diff --git a/winaccessibility/source/service/AccTopWindowListener.cxx 
b/winaccessibility/source/service/AccTopWindowListener.cxx
index 3c52d3280bd2..6ea78eb57c5b 100644
--- a/winaccessibility/source/service/AccTopWindowListener.cxx
+++ b/winaccessibility/source/service/AccTopWindowListener.cxx
@@ -65,8 +65,7 @@ void AccTopWindowListener::HandleWindowOpened( 
css::accessibility::XAccessible*
     //Only AccessibleContext exist, add all listeners
     if(pAccessibleContext != nullptr && systemdata != nullptr)
     {
-        accManagerAgent.SaveTopWindowHandle(
-                reinterpret_cast<sal_Int64>(systemdata->hWnd), pAccessible);
+        accManagerAgent.SaveTopWindowHandle(systemdata->hWnd, pAccessible);
 
         AddAllListeners(pAccessible,nullptr,systemdata->hWnd);
 
commit 2a5da1609d9d39e5b2bd80bd6af80bebcb6c1fb9
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Thu Sep 16 14:50:29 2021 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Sep 17 07:05:33 2021 +0200

    wina11y: Avoid some casting between HWND and sal_Int64
    
    ... by changing the corresponding params for
    AccObjectManagerAgent::InsertAccObj and
    AccObjectManagerAgent::InsertChildrenAccObj
    to HWND.
    
    Change-Id: I598bac30d827ae9166bc21cb5e8dff88a5cc99bf
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122203
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/winaccessibility/inc/AccObjectManagerAgent.hxx 
b/winaccessibility/inc/AccObjectManagerAgent.hxx
index ea4b5837b74f..c3e1ee78c387 100644
--- a/winaccessibility/inc/AccObjectManagerAgent.hxx
+++ b/winaccessibility/inc/AccObjectManagerAgent.hxx
@@ -21,6 +21,10 @@
 
 #include <memory>
 
+#include <prewin.h>
+#include <Windows.h>
+#include <postwin.h>
+
 #include <com/sun/star/accessibility/XAccessible.hpp>
 
 struct IMAccessible;
@@ -45,7 +49,7 @@ public:
 
     virtual bool InsertAccObj(css::accessibility::XAccessible* pXAcc,
                               css::accessibility::XAccessible* pParentXAcc,
-                              sal_Int64 pWnd=0);
+                              HWND hWnd = 0);
     virtual void GetIAccessibleFromResID(long childID,IMAccessible**);
     virtual bool 
GetIAccessibleFromXAccessible(css::accessibility::XAccessible* pXAcc, 
IAccessible** ppIA);
 
@@ -55,7 +59,7 @@ public:
     bool NotifyAccEvent(short pEvent = 0, css::accessibility::XAccessible* 
pXAcc = nullptr);
 
     bool InsertChildrenAccObj(css::accessibility::XAccessible* pXAcc,
-                              sal_Int64 pWnd=0);
+                              HWND  hWnd = 0);
     void DeleteChildrenAccObj( css::accessibility::XAccessible* pXAcc );
 
     void  DecreaseState( css::accessibility::XAccessible* pXAcc,unsigned short 
pState );
diff --git a/winaccessibility/source/UAccCOM/MAccessible.cxx 
b/winaccessibility/source/UAccCOM/MAccessible.cxx
index ed0796c43ec1..325cd00e2a62 100644
--- a/winaccessibility/source/UAccCOM/MAccessible.cxx
+++ b/winaccessibility/source/UAccCOM/MAccessible.cxx
@@ -1415,8 +1415,7 @@ IMAccessible* CMAccessible::GetChildInterface(long 
dChildID)//for test
 
         if(!isGet)
         {
-            g_pAgent->InsertAccObj(pXChild.get(), m_xAccessible.get(),
-                    reinterpret_cast<sal_Int64>(m_hwnd));
+            g_pAgent->InsertAccObj(pXChild.get(), m_xAccessible.get(), m_hwnd);
             isGet = get_IAccessibleFromXAccessible(pXChild.get(), &pChild);
         }
 
diff --git a/winaccessibility/source/service/AccFrameEventListener.cxx 
b/winaccessibility/source/service/AccFrameEventListener.cxx
index 2d31bdffb551..4ddaf3d8789b 100644
--- a/winaccessibility/source/service/AccFrameEventListener.cxx
+++ b/winaccessibility/source/service/AccFrameEventListener.cxx
@@ -91,8 +91,7 @@ void AccFrameEventListener::HandleChildChangedEvent(Any 
oldValue, Any newValue)
                 = pvclwindow->GetWindow()->GetSystemData();
 
             //add this child
-            pAgent->InsertAccObj(pAcc, m_xAccessible.get(),
-                    reinterpret_cast<sal_Int64>(systemdata->hWnd));
+            pAgent->InsertAccObj(pAcc, m_xAccessible.get(), systemdata->hWnd);
             //add all oldValue's existing children
             pAgent->InsertChildrenAccObj(pAcc);
             pAgent->NotifyAccEvent(UM_EVENT_CHILD_ADDED, pAcc);
diff --git a/winaccessibility/source/service/AccObjectManagerAgent.cxx 
b/winaccessibility/source/service/AccObjectManagerAgent.cxx
index b3290075fb6b..1e0c37729f31 100644
--- a/winaccessibility/source/service/AccObjectManagerAgent.cxx
+++ b/winaccessibility/source/service/AccObjectManagerAgent.cxx
@@ -142,11 +142,10 @@ void  AccObjectManagerAgent::UpdateDescription( 
XAccessible* pXAcc, Any newDesc
    * @return If the method is correctly processed.
    */
 bool AccObjectManagerAgent::InsertAccObj(
-        XAccessible* pXAcc, XAccessible* pParentXAcc, sal_Int64 nWnd)
+        XAccessible* pXAcc, XAccessible* pParentXAcc, HWND hWnd)
 {
     if( pWinManager )
-        return pWinManager->InsertAccObj(pXAcc, pParentXAcc,
-                static_cast<HWND>(reinterpret_cast<void*>(nWnd)));
+        return pWinManager->InsertAccObj(pXAcc, pParentXAcc, hWnd);
 
     return false;
 }
@@ -174,10 +173,10 @@ AccObjectManagerAgent::SaveTopWindowHandle(sal_Int64 
hWnd, XAccessible* pXAcc)
    * @return If the method is correctly processed.
    */
 bool
-AccObjectManagerAgent::InsertChildrenAccObj(XAccessible* pXAcc, sal_Int64 pWnd)
+AccObjectManagerAgent::InsertChildrenAccObj(XAccessible* pXAcc, HWND hWnd)
 {
     if( pWinManager )
-        return pWinManager->InsertChildrenAccObj( pXAcc, 
reinterpret_cast<HWND>(pWnd) );
+        return pWinManager->InsertChildrenAccObj(pXAcc, hWnd);
 
     return false;
 }
diff --git a/winaccessibility/source/service/AccTopWindowListener.cxx 
b/winaccessibility/source/service/AccTopWindowListener.cxx
index bcb821771c3c..3c52d3280bd2 100644
--- a/winaccessibility/source/service/AccTopWindowListener.cxx
+++ b/winaccessibility/source/service/AccTopWindowListener.cxx
@@ -139,8 +139,7 @@ void 
AccTopWindowListener::AddAllListeners(css::accessibility::XAccessible* pAcc
         return;
     }
 
-    accManagerAgent.InsertAccObj(pAccessible, pParentXAcc,
-            reinterpret_cast<sal_Int64>(pWND));
+    accManagerAgent.InsertAccObj(pAccessible, pParentXAcc, pWND);
 
     if (!accManagerAgent.IsContainer(pAccessible))
     {

Reply via email to