[Libreoffice-commits] core.git: vcl/qt5

Michael Weghorn (via logerrit) logerrit at kemper.freedesktop.org
Thu Jul 22 16:50:26 UTC 2021


 vcl/qt5/Qt5AccessibleWidget.cxx |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit b216a87d7a0956cbb864e73ec4fc5557ae93f64b
Author:     Michael Weghorn <m.weghorn at posteo.de>
AuthorDate: Thu Jul 22 11:00:18 2021 +0200
Commit:     Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Thu Jul 22 18:49:43 2021 +0200

    qt5 a11y: Improve Qt5AccessibleWidget::attributes
    
    * handle case where out params are nullptr
    * set fallback values for out params at the beginning
    
    This e.g. makes Accerciser show '-1' for both,
    startIndex and endIndex for the text interface of the
    "URL" and "Text" controls in Writer's "Insert" -> "Hyperlink" dialog
    along with no text. Making the actual text show up
    if there is any will be handled in an upcoming commit.
    
    Change-Id: Ie864f729ad06e28684bd426e4ba37b8a9d4d4634
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119363
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>

diff --git a/vcl/qt5/Qt5AccessibleWidget.cxx b/vcl/qt5/Qt5AccessibleWidget.cxx
index 33ad3634f24e..c68368085332 100644
--- a/vcl/qt5/Qt5AccessibleWidget.cxx
+++ b/vcl/qt5/Qt5AccessibleWidget.cxx
@@ -865,6 +865,12 @@ OUString lcl_convertFontWeight(double fontWeight)
 
 QString Qt5AccessibleWidget::attributes(int offset, int* startOffset, int* endOffset) const
 {
+    if (startOffset == nullptr || endOffset == nullptr)
+        return QString();
+
+    *startOffset = -1;
+    *endOffset = -1;
+
     Reference<XAccessibleText> xText(m_xAccessible, UNO_QUERY);
     if (!xText.is())
         return QString();
@@ -879,11 +885,7 @@ QString Qt5AccessibleWidget::attributes(int offset, int* startOffset, int* endOf
         offset = nTextLength - 1;
 
     if (offset < 0 || offset > nTextLength)
-    {
-        *startOffset = -1;
-        *endOffset = -1;
         return QString();
-    }
 
     const Sequence<PropertyValue> attribs
         = xText->getCharacterAttributes(offset, Sequence<OUString>());
@@ -915,6 +917,7 @@ QString Qt5AccessibleWidget::attributes(int offset, int* startOffset, int* endOf
     *endOffset = offset + 1;
     return toQString(aRet);
 }
+
 int Qt5AccessibleWidget::characterCount() const
 {
     Reference<XAccessibleText> xText(m_xAccessible, UNO_QUERY);


More information about the Libreoffice-commits mailing list