sw/source/core/access/accmap.cxx |   13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

New commits:
commit 08b7a0eb45c8816c6cf093d9a7405ce9b6d3f990
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Wed Jan 24 12:28:34 2024 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Thu Jan 25 09:42:04 2024 +0100

    sw a11y: Drop unnecessary cast to SwAccessiblePreview
    
    With
    
        Change-Id: I32d5bd2f81e7a69eacf92af1cf24249eb3a9f2a0
        Author: Michael Weghorn <m.wegh...@posteo.de>
        Date:   Wed Jan 24 12:10:32 2024 +0100
    
            sw a11y: Return SwAccessibleContext to avoid casting
    
    in place, `SwAccessibleMap::GetDocumentView_` returns the
    more concrete `rtl::Reference<SwAccessibleContext>`, and
    `SwAccessibleContext::InvalidateFocus` is what gets
    called here, so there's no need to cast to
    `SwAccessiblePreview` here.
    
    (The previous `static_cast` wasn't type-safe, so the
    extra null check after the cast didn't really add much
    value.)
    
    Change-Id: I4788d5e96570ceb0ffe97abfa9c48722cc90dc63
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162517
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index 0a6da3f501b8..38c9233ec018 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -2671,16 +2671,9 @@ void SwAccessibleMap::InvalidateFocus()
 
     if(GetShell()->IsPreview())
     {
-        uno::Reference<XAccessible> xAcc = GetDocumentView_( true );
-        if (xAcc)
-        {
-            SwAccessiblePreview *pAccPreview = static_cast<SwAccessiblePreview 
*>(xAcc.get());
-            if (pAccPreview)
-            {
-                pAccPreview->InvalidateFocus();
-                return ;
-            }
-        }
+        rtl::Reference<SwAccessibleContext> xDocView = GetDocumentView_(true);
+        assert(xDocView.is());
+        xDocView->InvalidateFocus();
     }
 
     rtl::Reference < SwAccessibleContext > xAcc = mxCursorContext;

Reply via email to