[Libreoffice-commits] core.git: vcl/qt5 winaccessibility/source
Samuel Thibault (via logerrit)
logerrit at kemper.freedesktop.org
Fri May 8 22:18:34 UTC 2020
vcl/qt5/Qt5AccessibleWidget.cxx | 7 ++-
winaccessibility/source/UAccCOM/AccTextBase.cxx | 45 +++++++++++++++++++++++-
2 files changed, 49 insertions(+), 3 deletions(-)
New commits:
commit 6aef5a1e880262354cf739e461a12a0ef9573fef
Author: Samuel Thibault <samuel.thibault at ens-lyon.org>
AuthorDate: Thu May 7 14:18:51 2020 +0200
Commit: Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Sat May 9 00:17:59 2020 +0200
tdf#118418 implement scrollSubstringTo() for Qt & windows
Use new accessibility scroll type compatible with IAccessible2.
Change-Id: I0967d1c56425e1e860db34f4b9c17427e531fe02
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93636
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
diff --git a/vcl/qt5/Qt5AccessibleWidget.cxx b/vcl/qt5/Qt5AccessibleWidget.cxx
index dd062e369c46..0ffdf102a10a 100644
--- a/vcl/qt5/Qt5AccessibleWidget.cxx
+++ b/vcl/qt5/Qt5AccessibleWidget.cxx
@@ -30,6 +30,7 @@
#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleScrollType.hpp>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <com/sun/star/accessibility/XAccessible.hpp>
#include <com/sun/star/accessibility/XAccessibleAction.hpp>
@@ -900,9 +901,11 @@ void Qt5AccessibleWidget::removeSelection(int /* selectionIndex */)
{
SAL_INFO("vcl.qt5", "Unsupported QAccessibleTextInterface::removeSelection");
}
-void Qt5AccessibleWidget::scrollToSubstring(int /* startIndex */, int /* endIndex */)
+void Qt5AccessibleWidget::scrollToSubstring(int startIndex, int endIndex)
{
- SAL_INFO("vcl.qt5", "Unsupported QAccessibleTextInterface::scrollToSubstring");
+ Reference<XAccessibleText> xText(m_xAccessible, UNO_QUERY);
+ if (xText.is())
+ xText->scrollSubstringTo(startIndex, endIndex, AccessibleScrollType_SCROLL_ANYWHERE);
}
void Qt5AccessibleWidget::selection(int selectionIndex, int* startOffset, int* endOffset) const
diff --git a/winaccessibility/source/UAccCOM/AccTextBase.cxx b/winaccessibility/source/UAccCOM/AccTextBase.cxx
index 6717ce6fed7f..caf3af18b38b 100644
--- a/winaccessibility/source/UAccCOM/AccTextBase.cxx
+++ b/winaccessibility/source/UAccCOM/AccTextBase.cxx
@@ -28,6 +28,7 @@
#include <vcl/svapp.hxx>
#include <o3tl/char16_t2wchar_t.hxx>
+#include <com/sun/star/accessibility/AccessibleScrollType.hpp>
#include <com/sun/star/accessibility/AccessibleTextType.hpp>
#include <com/sun/star/accessibility/XAccessible.hpp>
#include <com/sun/star/accessibility/XAccessibleContext.hpp>
@@ -895,9 +896,51 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccTextBase::scrollSubstringToPoint(long, lon
return E_NOTIMPL;
}
-COM_DECLSPEC_NOTHROW STDMETHODIMP CAccTextBase::scrollSubstringTo(long, long, IA2ScrollType)
+COM_DECLSPEC_NOTHROW STDMETHODIMP CAccTextBase::scrollSubstringTo(long startIndex, long endIndex, IA2ScrollType type)
{
+ SolarMutexGuard g;
+
+ ENTER_PROTECTED_BLOCK
+
+ // #CHECK XInterface#
+ if(!pRXText.is())
+ return E_FAIL;
+
+ AccessibleScrollType lUnoType;
+
+ switch(type)
+ {
+ case IA2_SCROLL_TYPE_TOP_LEFT:
+ lUnoType = AccessibleScrollType_SCROLL_TOP_LEFT;
+ break;
+ case IA2_SCROLL_TYPE_BOTTOM_RIGHT:
+ lUnoType = AccessibleScrollType_SCROLL_BOTTOM_RIGHT;
+ break;
+ case IA2_SCROLL_TYPE_TOP_EDGE:
+ lUnoType = AccessibleScrollType_SCROLL_TOP_EDGE;
+ break;
+ case IA2_SCROLL_TYPE_BOTTOM_EDGE:
+ lUnoType = AccessibleScrollType_SCROLL_BOTTOM_EDGE;
+ break;
+ case IA2_SCROLL_TYPE_LEFT_EDGE:
+ lUnoType = AccessibleScrollType_SCROLL_LEFT_EDGE;
+ break;
+ case IA2_SCROLL_TYPE_RIGHT_EDGE:
+ lUnoType = AccessibleScrollType_SCROLL_RIGHT_EDGE;
+ break;
+ case IA2_SCROLL_TYPE_ANYWHERE:
+ lUnoType = AccessibleScrollType_SCROLL_ANYWHERE;
+ break;
+ default:
+ return E_NOTIMPL;
+ }
+
+ if( GetXInterface()->scrollSubstringTo(startIndex, endIndex, lUnoType) )
+ return S_OK;
+
return E_NOTIMPL;
+
+ LEAVE_PROTECTED_BLOCK
}
/**
More information about the Libreoffice-commits
mailing list