accessibility/inc/extended/textwindowaccessibility.hxx    |    7 +-----
 accessibility/source/extended/textwindowaccessibility.cxx |   16 +++++++++-----
 accessibility/source/helper/acc_factory.cxx               |    6 ++---
 basctl/source/basicide/textwindowpeer.cxx                 |    2 -
 include/vcl/accessiblefactory.hxx                         |    3 +-
 5 files changed, 19 insertions(+), 15 deletions(-)

New commits:
commit 3794ab35403073077990d076f32252303652d7f8
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Dec 13 10:06:28 2024 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Dec 13 20:50:59 2024 +0100

    a11y: Report font slant (italic) in IDE editor with correct type
    
    Use the existing vcl::unohelper::ConvertFontSlant
    helper to convert the FontItalic enum value to the
    corresponding FontSlant instead of casting to an integer.
    
    The latter would trigger an assertion when trying to
    extract a FontSlant from the Any later, seen e.g.
    with the qt6 VCL plugin when navigating to the paragraphs
    in the "Tools" > "Macros" > "Edit Macros" dialog in Accerciser,
    or when moving navigating through the text while Orca is active.
    
    Backtrace:
    
        1 __pthread_kill_implementation pthread_kill.c 44 0x7ffff789dc8c
        2 __pthread_kill_internal pthread_kill.c 78 0x7ffff789dcef
        3 __GI_raise raise.c 26 0x7ffff7849c42
        4 __GI_abort abort.c 79 0x7ffff78324f0
        5 ?? 0x7ffff74a1a3d
        6 ?? 0x7ffff74b300a
        7 std::terminate() 0x7ffff74a15e9
        8 __cxa_throw 0x7ffff74b3288
        9 o3tl::doAccess<com::sun::star::awt::FontSlant> any.hxx 284 
0x7fffee23ea99
        10 ConvertUnoToIAccessible2TextAttributes 
AccessibleTextAttributeHelper.cxx 288 0x7fffee23bd8e
        11 AccessibleTextAttributeHelper::GetIAccessible2TextAttributes 
AccessibleTextAttributeHelper.cxx 347 0x7fffee23b45e
        12 QtAccessibleWidget::attributes QtAccessibleWidget.cxx 1001 
0x7fffe4685866
        13 non-virtual thunk to QtAccessibleWidget::attributes(int, int *, int 
*) const 0x7fffe4685bca
        14 AtSpiAdaptor::getAttributes atspiadaptor.cpp 2329 0x7fffe2d15b79
        15 AtSpiAdaptor::textInterface atspiadaptor.cpp 1990 0x7fffe2d0c3ed
        16 AtSpiAdaptor::handleMessage atspiadaptor.cpp 1481 0x7fffe2d067f8
        17 QDBusConnectionPrivate::activateObject qdbusintegrator.cpp 1448 
0x7fffe046d567
        18 QDBusActivateObjectEvent::placeMetaCall qdbusintegrator.cpp 1604 
0x7fffe046e520
        19 QObject::event qobject.cpp 1432 0x7fffe3908d70
        20 QApplicationPrivate::notify_helper qapplication.cpp 3297 
0x7fffe17e2d90
        21 QApplication::notify qapplication.cpp 3247 0x7fffe17e6cad
        22 QCoreApplication::notifyInternal2 qcoreapplication.cpp 1122 
0x7fffe3845c99
        23 QCoreApplication::sendEvent qcoreapplication.cpp 1564 0x7fffe3846a79
        24 QCoreApplicationPrivate::sendPostedEvents qcoreapplication.cpp 1920 
0x7fffe38483b8
        25 QCoreApplication::sendPostedEvents qcoreapplication.cpp 1751 
0x7fffe38468bc
        26 postEventSourceDispatch qeventdispatcher_glib.cpp 246 0x7fffe3e39281
        27 ?? 0x7fffea10b81f
        28 ?? 0x7fffea10da57
        29 g_main_context_iteration 0x7fffea10e1c0
        30 QEventDispatcherGlib::processEvents qeventdispatcher_glib.cpp 399 
0x7fffe3e3847b
        31 QPAEventDispatcherGlib::processEvents qeventdispatcher_glib.cpp 89 
0x7fffe2f67218
        32 QtInstance::ImplYield QtInstance.cxx 464 0x7fffe472d3c2
        33 QtInstance::DoYield QtInstance.cxx 475 0x7fffe4730441
        34 ImplYield svapp.cxx 385 0x7fffeed3c9d6
        35 Application::Yield svapp.cxx 473 0x7fffeed3c36f
        36 Application::Execute svapp.cxx 360 0x7fffeed3c150
        37 desktop::Desktop::Main app.cxx 1679 0x7ffff7b2788b
        38 ImplSVMain svmain.cxx 228 0x7fffeed5e2a6
        39 SVMain svmain.cxx 246 0x7fffeed5fe99
        40 soffice_main sofficemain.cxx 121 0x7ffff7ba11ba
        41 sal_main main.c 51 0x555555555a6d
        42 main main.c 49 0x555555555a47
    
    Change-Id: Id30fc0acf20af5213c025a337765bb638ab6b02c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178404
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/accessibility/source/extended/textwindowaccessibility.cxx 
b/accessibility/source/extended/textwindowaccessibility.cxx
index 4216c62665de..0e05409e202d 100644
--- a/accessibility/source/extended/textwindowaccessibility.cxx
+++ b/accessibility/source/extended/textwindowaccessibility.cxx
@@ -964,7 +964,7 @@ Document::retrieveCharacterAttributes(
 
     //character posture
     aAttrib.Name = "CharPosture";
-    aAttrib.Value <<= static_cast<sal_Int16>(aFont.GetItalic());
+    aAttrib.Value <<= vcl::unohelper::ConvertFontSlant(aFont.GetItalic());
     aAttribs.push_back(aAttrib);
 
     //character relief
commit cd76d6caafa0fe20bed9df42f84d82cd857b20a8
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Dec 13 09:53:34 2024 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Dec 13 20:50:52 2024 +0100

    a11y: Pass vcl::Window instead of VCLXWindow for TextWindow a11y
    
    As was done for the other a11y classes subclassing
    VCLXAccessibleComponent in
    
        commit 168512dce7f1f1453c045584d47bd78a0a6c73f7
        Author: Michael Weghorn <m.wegh...@posteo.de>
        Date:   Thu Dec 12 18:06:13 2024 +0100
    
            a11y: Stop using VCLXWindow in vcl a11y classes
    
    , also pass the vcl::Window when creating an
    XAccessibleContext for a TextView, to get rid of
    the UNO/toolkit dependency.
    
    Change-Id: I3c5febd27a53fe17f83cc4e95dd7466f11a7a225
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178403
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/accessibility/inc/extended/textwindowaccessibility.hxx 
b/accessibility/inc/extended/textwindowaccessibility.hxx
index 60511460991d..6fbaed7175b0 100644
--- a/accessibility/inc/extended/textwindowaccessibility.hxx
+++ b/accessibility/inc/extended/textwindowaccessibility.hxx
@@ -316,8 +316,7 @@ typedef std::unordered_map< OUString,
 class Document final : public ::VCLXAccessibleComponent, public ::SfxListener
 {
 public:
-    Document(::VCLXWindow * pVclXWindow, ::TextEngine & rEngine,
-             ::TextView & rView);
+    Document(vcl::Window* pWindow, ::TextEngine & rEngine, ::TextView & rView);
 
     css::uno::Reference<css::accessibility::XAccessible> getAccessible() const;
 
diff --git a/accessibility/source/extended/textwindowaccessibility.cxx 
b/accessibility/source/extended/textwindowaccessibility.cxx
index 78e6ea3932c4..4216c62665de 100644
--- a/accessibility/source/extended/textwindowaccessibility.cxx
+++ b/accessibility/source/extended/textwindowaccessibility.cxx
@@ -701,9 +701,9 @@ void Paragraph::checkDisposed()
         OUString(), getXWeak());
 }
 
-Document::Document(::VCLXWindow * pVclXWindow, ::TextEngine & rEngine,
-                   ::TextView & rView):
-    VCLXAccessibleComponent(pVclXWindow->GetWindow()),
+Document::Document(vcl::Window* pWindow, ::TextEngine & rEngine,
+                   ::TextView & rView)
+    : VCLXAccessibleComponent(pWindow),
     m_rEngine(rEngine),
     m_rView(rView),
     m_aEngineListener(*this),
diff --git a/accessibility/source/helper/acc_factory.cxx 
b/accessibility/source/helper/acc_factory.cxx
index 9ac17ca3e106..ac32fb769b13 100644
--- a/accessibility/source/helper/acc_factory.cxx
+++ b/accessibility/source/helper/acc_factory.cxx
@@ -146,7 +146,7 @@ public:
 
     virtual css::uno::Reference< css::accessibility::XAccessibleContext >
         createAccessibleTextWindowContext(
-            VCLXWindow* pVclXWindow, TextEngine& rEngine, TextView& rView
+            vcl::Window* pWindow, TextEngine& rEngine, TextView& rView
         ) const override;
 
     virtual css::uno::Reference< css::accessibility::XAccessible >
@@ -387,9 +387,9 @@ Reference< XAccessible > 
AccessibleFactory::createAccessibleTabBar( TabBar& _rTa
 }
 
 Reference< XAccessibleContext > 
AccessibleFactory::createAccessibleTextWindowContext(
-    VCLXWindow* pVclXWindow, TextEngine& rEngine, TextView& rView ) const
+    vcl::Window* pWindow, TextEngine& rEngine, TextView& rView) const
 {
-    return new Document( pVclXWindow, rEngine, rView );
+    return new Document(pWindow, rEngine, rView );
 }
 
 Reference< XAccessible > AccessibleFactory::createAccessibleTreeListBox(
diff --git a/basctl/source/basicide/textwindowpeer.cxx 
b/basctl/source/basicide/textwindowpeer.cxx
index 421468a27918..a3ad564baccd 100644
--- a/basctl/source/basicide/textwindowpeer.cxx
+++ b/basctl/source/basicide/textwindowpeer.cxx
@@ -57,7 +57,7 @@ TextWindowPeer::TextWindowPeer(TextView & view):
 css::uno::Reference<css::accessibility::XAccessibleContext>
 TextWindowPeer::CreateAccessibleContext() {
     return m_aFactoryAccess.getFactory().createAccessibleTextWindowContext(
-        this, m_rEngine, m_rView);
+        GetWindow(), m_rEngine, m_rView);
 }
 
 }
diff --git a/include/vcl/accessiblefactory.hxx 
b/include/vcl/accessiblefactory.hxx
index fde375c79875..1ccef276cde3 100644
--- a/include/vcl/accessiblefactory.hxx
+++ b/include/vcl/accessiblefactory.hxx
@@ -41,6 +41,7 @@ namespace com::sun::star {
 namespace vcl { class IAccessibleBrowseBox; }
 namespace vcl { class IAccessibleTabListBox; }
 namespace vcl { class IAccessibleTableProvider; }
+namespace vcl { class Window; }
 
 class SvHeaderTabListBox;
 class SvtIconChoiceCtrl;
@@ -112,7 +113,7 @@ namespace vcl
 
         virtual css::uno::Reference< css::accessibility::XAccessibleContext >
             createAccessibleTextWindowContext(
-                VCLXWindow* pVclXWindow, TextEngine& rEngine, TextView& rView
+                vcl::Window* pWindow, TextEngine& rEngine, TextView& rView
             ) const = 0;
 
         virtual css::uno::Reference< css::accessibility::XAccessible >
commit 667823e412ac2b08d1a2f929e0347fc9ef54256c
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Dec 13 09:41:24 2024 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Dec 13 20:50:46 2024 +0100

    a11y: Get text window doc accessible from Window on demand
    
    Instead of storing a reference to the VCLXWindow (which is
    a TextWindowPeer), which is the EditorWindow's accessible
    as Document::m_xAccessible member, adjust Document::getAccessible
    to get the accessible on demand via vcl::Window::GetAccessible
    instead.
    
    This also prepares for no more passing the VCLXWindow
    to the ctor in an upcoming commit.
    
    Change-Id: I498f90a456eda453508a4f1ed84983006594ea86
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178402
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/accessibility/inc/extended/textwindowaccessibility.hxx 
b/accessibility/inc/extended/textwindowaccessibility.hxx
index e998ac3c443e..60511460991d 100644
--- a/accessibility/inc/extended/textwindowaccessibility.hxx
+++ b/accessibility/inc/extended/textwindowaccessibility.hxx
@@ -319,8 +319,7 @@ public:
     Document(::VCLXWindow * pVclXWindow, ::TextEngine & rEngine,
              ::TextView & rView);
 
-    const css::uno::Reference< css::accessibility::XAccessible >&
-    getAccessible() const { return m_xAccessible; }
+    css::uno::Reference<css::accessibility::XAccessible> getAccessible() const;
 
     css::lang::Locale retrieveLocale();
 
@@ -531,7 +530,6 @@ private:
     Paragraphs::iterator visibleEnd() { return getIter(m_nVisibleEnd); }
     Paragraphs::iterator focused() { return getIter(m_nFocused); }
 
-    css::uno::Reference< css::accessibility::XAccessible > m_xAccessible;
     ::TextEngine & m_rEngine;
     ::TextView & m_rView;
 
diff --git a/accessibility/source/extended/textwindowaccessibility.cxx 
b/accessibility/source/extended/textwindowaccessibility.cxx
index e19915407e00..78e6ea3932c4 100644
--- a/accessibility/source/extended/textwindowaccessibility.cxx
+++ b/accessibility/source/extended/textwindowaccessibility.cxx
@@ -704,7 +704,6 @@ void Paragraph::checkDisposed()
 Document::Document(::VCLXWindow * pVclXWindow, ::TextEngine & rEngine,
                    ::TextView & rView):
     VCLXAccessibleComponent(pVclXWindow->GetWindow()),
-    m_xAccessible(pVclXWindow),
     m_rEngine(rEngine),
     m_rView(rView),
     m_aEngineListener(*this),
@@ -729,6 +728,13 @@ Document::Document(::VCLXWindow * pVclXWindow, 
::TextEngine & rEngine,
     m_aViewListener.startListening(*m_rView.GetWindow());
 }
 
+css::uno::Reference<css::accessibility::XAccessible> Document::getAccessible() 
const
+{
+    if (vcl::Window* pWindow = GetWindow())
+        return pWindow->GetAccessible();
+    return nullptr;
+}
+
 css::lang::Locale Document::retrieveLocale()
 {
     SolarMutexGuard aGuard;

Reply via email to