summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2021-07-22 11:00:18 +0200
committerMichael Weghorn <m.weghorn@posteo.de>2021-07-22 18:49:43 +0200
commitb216a87d7a0956cbb864e73ec4fc5557ae93f64b (patch)
treefa23adb29974ba135991af9c0aee34b41cb8ca33
parent3957ffb88f9856f2288b5f390609207b2e9c4c2b (diff)
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@posteo.de>
-rw-r--r--vcl/qt5/Qt5AccessibleWidget.cxx11
1 files changed, 7 insertions, 4 deletions
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);