Bug 118418 - Scrolling API?

Martin Pieuchot mpi at grenadille.net
Mon Feb 17 16:21:47 UTC 2020


On 22/01/20(Wed) 17:38, Caolán McNamara wrote:
> On Mon, 2019-12-16 at 13:10 +0100, Martin Pieuchot wrote:
> > I'm looking for help/explanation about the coordinate system and
> > scrolling API to use in `SwAccessibleParagraph'.
> > 
> > I'm currently working on bug #118418 [1], trying to implement
> > scrollSubstringTo() and scrollSubstringToPoint() like I did for
> > gtk [2] and evince [3].
> > 
> > The diff below clearly shows that I don't know how to translate a
> > character index to coordinates that can be feed to Window's Scroll().
> > 
> > So here are my questions:
> > 
> > - Is calling getWindow()'s Scroll() the correct way to realize the
> >   scrolling.  If so, the code below doesn't correctly refresh all the
> >   text, so what am I missing?
> > 
> > - What API should I use to convert the coordinates?
> 
> I don't know for sure the correct answer, but I feel that for writer
> ScrollMDI might be your friend here and that the code should look
> something like the attached SwAccessibleParagraph::scrollToPosition
> demo. I haven't tested or checked further if its the right approach but
> maybe that helps.

It helped, thanks a lot !

Diff below implements scrollSubstringTo()'s SCROLL_ANYWHERE.  I'm
interested in comments and/or suggestions.

I'm also wondering if it is possible to specify a coordinate (x, y)
where the application should position an element via scrolling.  For
example scroll the page until this "word" is at the top of the screen,
or at position (x, y).  This is necessary for implementing the rest of
the API.

diff --git accessibility/inc/extended/AccessibleBrowseBoxTableCell.hxx accessibility/inc/extended/AccessibleBrowseBoxTableCell.hxx
index 6823fa67eb7a..5c1f8d738a4f 100644
--- accessibility/inc/extended/AccessibleBrowseBoxTableCell.hxx
+++ accessibility/inc/extended/AccessibleBrowseBoxTableCell.hxx
@@ -114,6 +114,8 @@ namespace accessibility
         virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
         virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
         virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
+        virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, sal_Int16 aScrollType) override;
+        virtual sal_Bool SAL_CALL scrollSubstringToPoint( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const css::awt::Point& aPoint ) override;
     };
 }
 
diff --git accessibility/inc/extended/AccessibleGridControlTableCell.hxx accessibility/inc/extended/AccessibleGridControlTableCell.hxx
index ed1735a14f0a..ab906bcc5552 100644
--- accessibility/inc/extended/AccessibleGridControlTableCell.hxx
+++ accessibility/inc/extended/AccessibleGridControlTableCell.hxx
@@ -138,6 +138,8 @@ namespace accessibility
         virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
         virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
         virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
+        virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, sal_Int16 aScrollType) override;
+        virtual sal_Bool SAL_CALL scrollSubstringToPoint( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const css::awt::Point& aPoint ) override;
     };
 }
 
diff --git accessibility/inc/extended/accessibleiconchoicectrlentry.hxx accessibility/inc/extended/accessibleiconchoicectrlentry.hxx
index 9f605554200a..c64327fa3794 100644
--- accessibility/inc/extended/accessibleiconchoicectrlentry.hxx
+++ accessibility/inc/extended/accessibleiconchoicectrlentry.hxx
@@ -157,6 +157,8 @@ namespace accessibility
         virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
         virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
         virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
+        virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, sal_Int16 aScrollType) override;
+        virtual sal_Bool SAL_CALL scrollSubstringToPoint( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const css::awt::Point& aPoint ) override;
 
         // XAccessibleEventBroadcaster
         virtual void SAL_CALL addAccessibleEventListener( const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener ) override;
diff --git accessibility/inc/extended/accessiblelistboxentry.hxx accessibility/inc/extended/accessiblelistboxentry.hxx
index 3c93620e7175..ed58abb0ef73 100644
--- accessibility/inc/extended/accessiblelistboxentry.hxx
+++ accessibility/inc/extended/accessiblelistboxentry.hxx
@@ -181,6 +181,8 @@ namespace accessibility
         virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
         virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
         virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
+        virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, sal_Int16 aScrollType) override;
+        virtual sal_Bool SAL_CALL scrollSubstringToPoint( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const css::awt::Point& aPoint ) override;
 
         // XAccessibleEventBroadcaster
         virtual void SAL_CALL addAccessibleEventListener( const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener ) override;
diff --git accessibility/inc/extended/textwindowaccessibility.hxx accessibility/inc/extended/textwindowaccessibility.hxx
index 5fed0a0a8dd7..4f35680b6903 100644
--- accessibility/inc/extended/textwindowaccessibility.hxx
+++ accessibility/inc/extended/textwindowaccessibility.hxx
@@ -229,6 +229,9 @@ private:
     virtual sal_Bool SAL_CALL setSelection(::sal_Int32 nStartIndex,
                                              ::sal_Int32 nEndIndex) override;
 
+    virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, sal_Int16 aScrollType) override;
+    virtual sal_Bool SAL_CALL scrollSubstringToPoint( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const css::awt::Point& aPoint ) override;
+
     virtual OUString SAL_CALL getText() override;
 
     virtual OUString SAL_CALL getTextRange(::sal_Int32 nStartIndex,
diff --git accessibility/inc/standard/vclxaccessibleedit.hxx accessibility/inc/standard/vclxaccessibleedit.hxx
index 3e98c34227d8..37cfce0aafd3 100644
--- accessibility/inc/standard/vclxaccessibleedit.hxx
+++ accessibility/inc/standard/vclxaccessibleedit.hxx
@@ -92,6 +92,8 @@ public:
     virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
     virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
     virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
+    virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, sal_Int16 aScrollType) override;
+    virtual sal_Bool SAL_CALL scrollSubstringToPoint( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const css::awt::Point& aPoint ) override;
 
     // XAccessibleEditableText
     virtual sal_Bool SAL_CALL cutText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
diff --git accessibility/inc/standard/vclxaccessiblelistitem.hxx accessibility/inc/standard/vclxaccessiblelistitem.hxx
index e2e5c2378176..e05b439c1fe6 100644
--- accessibility/inc/standard/vclxaccessiblelistitem.hxx
+++ accessibility/inc/standard/vclxaccessiblelistitem.hxx
@@ -144,6 +144,8 @@ public:
     virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
     virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
     virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
+    virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, sal_Int16 aScrollType) override;
+    virtual sal_Bool SAL_CALL scrollSubstringToPoint( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const css::awt::Point& aPoint ) override;
 
     // XAccessibleEventBroadcaster
     virtual void SAL_CALL addAccessibleEventListener( const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener ) override;
diff --git accessibility/inc/standard/vclxaccessiblemenuitem.hxx accessibility/inc/standard/vclxaccessiblemenuitem.hxx
index 7b087d3725b1..4a3a8adf57fe 100644
--- accessibility/inc/standard/vclxaccessiblemenuitem.hxx
+++ accessibility/inc/standard/vclxaccessiblemenuitem.hxx
@@ -87,6 +87,8 @@ public:
     virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
     virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
     virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
+    virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, sal_Int16 aScrollType) override;
+    virtual sal_Bool SAL_CALL scrollSubstringToPoint( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const css::awt::Point& aPoint ) override;
 
     // XAccessibleAction
     virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) final override;
diff --git accessibility/inc/standard/vclxaccessiblestatusbaritem.hxx accessibility/inc/standard/vclxaccessiblestatusbaritem.hxx
index 217b77feb36b..43c1f65f92ab 100644
--- accessibility/inc/standard/vclxaccessiblestatusbaritem.hxx
+++ accessibility/inc/standard/vclxaccessiblestatusbaritem.hxx
@@ -124,6 +124,8 @@ public:
     virtual sal_Int32 SAL_CALL getCharacterCount() override;
     virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) override;
     virtual OUString SAL_CALL getTextRange(sal_Int32 nStartIndex, sal_Int32 nEndIndex) override;
+    virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, sal_Int16 aScrollType) override;
+    virtual sal_Bool SAL_CALL scrollSubstringToPoint( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const css::awt::Point& aPoint ) override;
 
 };
 
diff --git accessibility/inc/standard/vclxaccessibletabpage.hxx accessibility/inc/standard/vclxaccessibletabpage.hxx
index 56832a866342..166fc95dcbb7 100644
--- accessibility/inc/standard/vclxaccessibletabpage.hxx
+++ accessibility/inc/standard/vclxaccessibletabpage.hxx
@@ -133,6 +133,8 @@ public:
     virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
     virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
     virtual OUString SAL_CALL getTextRange(sal_Int32 nStartIndex, sal_Int32 nEndIndex) override;
+    virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, sal_Int16 aScrollType) override;
+    virtual sal_Bool SAL_CALL scrollSubstringToPoint( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const css::awt::Point& aPoint ) override;
 };
 
 
diff --git accessibility/inc/standard/vclxaccessibletextcomponent.hxx accessibility/inc/standard/vclxaccessibletextcomponent.hxx
index 0d145ed6a286..3e690ba1910b 100644
--- accessibility/inc/standard/vclxaccessibletextcomponent.hxx
+++ accessibility/inc/standard/vclxaccessibletextcomponent.hxx
@@ -74,6 +74,8 @@ public:
     virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
     virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
     virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
+    virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, sal_Int16 aScrollType) override;
+    virtual sal_Bool SAL_CALL scrollSubstringToPoint( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const css::awt::Point& aPoint ) override;
 };
 
 
diff --git accessibility/inc/standard/vclxaccessibletoolboxitem.hxx accessibility/inc/standard/vclxaccessibletoolboxitem.hxx
index 6780bfad536e..1595815755b9 100644
--- accessibility/inc/standard/vclxaccessibletoolboxitem.hxx
+++ accessibility/inc/standard/vclxaccessibletoolboxitem.hxx
@@ -120,6 +120,8 @@ public:
     virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
     virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
     virtual OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
+    virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, sal_Int16 aScrollType) override;
+    virtual sal_Bool SAL_CALL scrollSubstringToPoint( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const css::awt::Point& aPoint ) override;
 
     // XAccessibleComponent
     virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override;
diff --git accessibility/source/extended/AccessibleBrowseBoxTableCell.cxx accessibility/source/extended/AccessibleBrowseBoxTableCell.cxx
index c09639850b84..9dad33aead38 100644
--- accessibility/source/extended/AccessibleBrowseBoxTableCell.cxx
+++ accessibility/source/extended/AccessibleBrowseBoxTableCell.cxx
@@ -322,6 +322,14 @@ namespace accessibility
         //!!! don't know how to put a string into the clipboard
         return false;
     }
+    sal_Bool SAL_CALL AccessibleBrowseBoxTableCell::scrollSubstringTo( sal_Int32, sal_Int32, sal_Int16 )
+    {
+        return false;
+    }
+    sal_Bool SAL_CALL AccessibleBrowseBoxTableCell::scrollSubstringToPoint( sal_Int32, sal_Int32, const css::awt::Point& )
+    {
+        return false;
+    }
     void AccessibleBrowseBoxTableCell::disposing( const EventObject& _rSource )
     {
             if ( _rSource.Source == mxParent )
diff --git accessibility/source/extended/AccessibleGridControlTableCell.cxx accessibility/source/extended/AccessibleGridControlTableCell.cxx
index 3e3af96ff04c..c300ad084fb0 100644
--- accessibility/source/extended/AccessibleGridControlTableCell.cxx
+++ accessibility/source/extended/AccessibleGridControlTableCell.cxx
@@ -320,6 +320,14 @@ namespace accessibility
         //!!! don't know how to put a string into the clipboard
         return false;
     }
+    sal_Bool SAL_CALL AccessibleGridControlTableCell::scrollSubstringTo( sal_Int32, sal_Int32, sal_Int16 )
+    {
+        return false;
+    }
+    sal_Bool SAL_CALL AccessibleGridControlTableCell::scrollSubstringToPoint( sal_Int32, sal_Int32, const css::awt::Point& )
+    {
+        return false;
+    }
 
     tools::Rectangle AccessibleGridControlTableCell::implGetBoundingBox()
     {
diff --git accessibility/source/extended/accessibleiconchoicectrlentry.cxx accessibility/source/extended/accessibleiconchoicectrlentry.cxx
index 38f9e4afbeaf..82b4310e1d98 100644
--- accessibility/source/extended/accessibleiconchoicectrlentry.cxx
+++ accessibility/source/extended/accessibleiconchoicectrlentry.cxx
@@ -474,6 +474,16 @@ namespace accessibility
         return true;
     }
 
+    sal_Bool SAL_CALL AccessibleIconChoiceCtrlEntry::scrollSubstringTo( sal_Int32, sal_Int32, sal_Int16 )
+    {
+        return false;
+    }
+
+    sal_Bool SAL_CALL AccessibleIconChoiceCtrlEntry::scrollSubstringToPoint( sal_Int32, sal_Int32, const css::awt::Point& )
+    {
+        return false;
+    }
+
     // XAccessibleEventBroadcaster
 
     void SAL_CALL AccessibleIconChoiceCtrlEntry::addAccessibleEventListener( const Reference< XAccessibleEventListener >& xListener )
diff --git accessibility/source/extended/accessiblelistboxentry.cxx accessibility/source/extended/accessiblelistboxentry.cxx
index c5e65ee5a1d4..49dbd43700a3 100644
--- accessibility/source/extended/accessiblelistboxentry.cxx
+++ accessibility/source/extended/accessiblelistboxentry.cxx
@@ -705,6 +705,16 @@ namespace accessibility
         return true;
     }
 
+    sal_Bool SAL_CALL AccessibleListBoxEntry::scrollSubstringTo( sal_Int32, sal_Int32, sal_Int16 )
+    {
+        return false;
+    }
+
+    sal_Bool SAL_CALL AccessibleListBoxEntry::scrollSubstringToPoint( sal_Int32, sal_Int32, const css::awt::Point& )
+    {
+        return false;
+    }
+
     // XAccessibleEventBroadcaster
 
     void SAL_CALL AccessibleListBoxEntry::addAccessibleEventListener( const Reference< XAccessibleEventListener >& xListener )
diff --git accessibility/source/extended/textwindowaccessibility.cxx accessibility/source/extended/textwindowaccessibility.cxx
index 882f38124def..ab4365862398 100644
--- accessibility/source/extended/textwindowaccessibility.cxx
+++ accessibility/source/extended/textwindowaccessibility.cxx
@@ -430,6 +430,18 @@ sal_Bool SAL_CALL Paragraph::copyText(::sal_Int32 nStartIndex,
     return true;
 }
 
+// virtual
+sal_Bool SAL_CALL Paragraph::scrollSubstringTo( sal_Int32, sal_Int32, sal_Int16 )
+{
+    return false;
+}
+
+// virtual
+sal_Bool SAL_CALL Paragraph::scrollSubstringToPoint( sal_Int32, sal_Int32, const css::awt::Point& )
+{
+    return false;
+}
+
 // virtual
 sal_Bool SAL_CALL Paragraph::cutText(::sal_Int32 nStartIndex,
                                            ::sal_Int32 nEndIndex)
diff --git accessibility/source/standard/vclxaccessibleedit.cxx accessibility/source/standard/vclxaccessibleedit.cxx
index 0435f71ccd28..ec5af9c61cc9 100644
--- accessibility/source/standard/vclxaccessibleedit.cxx
+++ accessibility/source/standard/vclxaccessibleedit.cxx
@@ -487,6 +487,15 @@ sal_Bool VCLXAccessibleEdit::copyText( sal_Int32 nStartIndex, sal_Int32 nEndInde
     return VCLXAccessibleTextComponent::copyText( nStartIndex, nEndIndex );
 }
 
+sal_Bool VCLXAccessibleEdit::scrollSubstringTo( sal_Int32, sal_Int32, sal_Int16 )
+{
+    return false;
+}
+
+sal_Bool VCLXAccessibleEdit::scrollSubstringToPoint( sal_Int32, sal_Int32, const css::awt::Point& )
+{
+    return false;
+}
 
 // XAccessibleEditableText
 
diff --git accessibility/source/standard/vclxaccessiblelistitem.cxx accessibility/source/standard/vclxaccessiblelistitem.cxx
index 6dda80fe0112..69c5073c579c 100644
--- accessibility/source/standard/vclxaccessiblelistitem.cxx
+++ accessibility/source/standard/vclxaccessiblelistitem.cxx
@@ -560,6 +560,16 @@ sal_Bool SAL_CALL VCLXAccessibleListItem::copyText( sal_Int32 nStartIndex, sal_I
     return bRet;
 }
 
+sal_Bool VCLXAccessibleListItem::scrollSubstringTo( sal_Int32, sal_Int32, sal_Int16 )
+{
+    return false;
+}
+
+sal_Bool VCLXAccessibleListItem::scrollSubstringToPoint( sal_Int32, sal_Int32, const css::awt::Point& )
+{
+    return false;
+}
+
 // XAccessibleEventBroadcaster
 
 void SAL_CALL VCLXAccessibleListItem::addAccessibleEventListener( const Reference< XAccessibleEventListener >& xListener )
diff --git accessibility/source/standard/vclxaccessiblemenuitem.cxx accessibility/source/standard/vclxaccessiblemenuitem.cxx
index 8733b6bb5ea2..7d0d1f6c8236 100644
--- accessibility/source/standard/vclxaccessiblemenuitem.cxx
+++ accessibility/source/standard/vclxaccessiblemenuitem.cxx
@@ -383,6 +383,16 @@ sal_Bool VCLXAccessibleMenuItem::copyText( sal_Int32 nStartIndex, sal_Int32 nEnd
     return bReturn;
 }
 
+sal_Bool VCLXAccessibleMenuItem::scrollSubstringTo( sal_Int32, sal_Int32, sal_Int16 )
+{
+    return false;
+}
+
+sal_Bool VCLXAccessibleMenuItem::scrollSubstringToPoint( sal_Int32, sal_Int32, const css::awt::Point& )
+{
+    return false;
+}
+
 
 // XAccessibleAction
 
diff --git accessibility/source/standard/vclxaccessiblestatusbaritem.cxx accessibility/source/standard/vclxaccessiblestatusbaritem.cxx
index ac6e4aff65b2..8910da8e2725 100644
--- accessibility/source/standard/vclxaccessiblestatusbaritem.cxx
+++ accessibility/source/standard/vclxaccessiblestatusbaritem.cxx
@@ -582,4 +582,14 @@ sal_Bool VCLXAccessibleStatusBarItem::copyText( sal_Int32 nStartIndex, sal_Int32
 }
 
 
+sal_Bool VCLXAccessibleStatusBarItem::scrollSubstringTo( sal_Int32, sal_Int32, sal_Int16 )
+{
+    return false;
+}
+
+sal_Bool VCLXAccessibleStatusBarItem::scrollSubstringToPoint( sal_Int32, sal_Int32, const css::awt::Point& )
+{
+    return false;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git accessibility/source/standard/vclxaccessibletabpage.cxx accessibility/source/standard/vclxaccessibletabpage.cxx
index 2b5cdb033d2a..ee66d6e5339b 100644
--- accessibility/source/standard/vclxaccessibletabpage.cxx
+++ accessibility/source/standard/vclxaccessibletabpage.cxx
@@ -669,5 +669,15 @@ sal_Bool VCLXAccessibleTabPage::copyText( sal_Int32 nStartIndex, sal_Int32 nEndI
     return bReturn;
 }
 
+sal_Bool VCLXAccessibleTabPage::scrollSubstringTo( sal_Int32, sal_Int32, sal_Int16 )
+{
+    return false;
+}
+
+sal_Bool VCLXAccessibleTabPage::scrollSubstringToPoint( sal_Int32, sal_Int32, const css::awt::Point& )
+{
+    return false;
+}
+
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git accessibility/source/standard/vclxaccessibletextcomponent.cxx accessibility/source/standard/vclxaccessibletextcomponent.cxx
index b9880754d058..24554a35ad1c 100644
--- accessibility/source/standard/vclxaccessibletextcomponent.cxx
+++ accessibility/source/standard/vclxaccessibletextcomponent.cxx
@@ -368,5 +368,14 @@ sal_Bool VCLXAccessibleTextComponent::copyText( sal_Int32 nStartIndex, sal_Int32
     return bReturn;
 }
 
+sal_Bool VCLXAccessibleTextComponent::scrollSubstringTo( sal_Int32, sal_Int32, sal_Int16 )
+{
+    return false;
+}
+
+sal_Bool VCLXAccessibleTextComponent::scrollSubstringToPoint( sal_Int32, sal_Int32, const css::awt::Point& )
+{
+    return false;
+}
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git accessibility/source/standard/vclxaccessibletoolboxitem.cxx accessibility/source/standard/vclxaccessibletoolboxitem.cxx
index 555f0beb008c..9b8aea8c9f12 100644
--- accessibility/source/standard/vclxaccessibletoolboxitem.cxx
+++ accessibility/source/standard/vclxaccessibletoolboxitem.cxx
@@ -555,6 +555,16 @@ sal_Bool SAL_CALL VCLXAccessibleToolBoxItem::copyText( sal_Int32 nStartIndex, sa
     return bReturn;
 }
 
+sal_Bool VCLXAccessibleToolBoxItem::scrollSubstringTo( sal_Int32, sal_Int32, sal_Int16 )
+{
+    return false;
+}
+
+sal_Bool VCLXAccessibleToolBoxItem::scrollSubstringToPoint( sal_Int32, sal_Int32, const css::awt::Point& )
+{
+    return false;
+}
+
 // XAccessibleComponent
 
 Reference< XAccessible > SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleAtPoint( const awt::Point& )
diff --git editeng/source/accessibility/AccessibleEditableTextPara.cxx editeng/source/accessibility/AccessibleEditableTextPara.cxx
index 297dbeef018c..14bb868e5382 100644
--- editeng/source/accessibility/AccessibleEditableTextPara.cxx
+++ editeng/source/accessibility/AccessibleEditableTextPara.cxx
@@ -2113,6 +2113,16 @@ namespace accessibility
         }
     }
 
+    sal_Bool SAL_CALL AccessibleEditableTextPara::scrollSubstringTo( sal_Int32, sal_Int32, sal_Int16 )
+    {
+        return false;
+    }
+
+    sal_Bool SAL_CALL AccessibleEditableTextPara::scrollSubstringToPoint( sal_Int32, sal_Int32, const css::awt::Point& )
+    {
+        return false;
+    }
+
     // XAccessibleEditableText
     sal_Bool SAL_CALL AccessibleEditableTextPara::cutText( sal_Int32 nStartIndex, sal_Int32 nEndIndex )
     {
diff --git editeng/source/accessibility/AccessibleStaticTextBase.cxx editeng/source/accessibility/AccessibleStaticTextBase.cxx
index 37aaf2b80459..15894f990d19 100644
--- editeng/source/accessibility/AccessibleStaticTextBase.cxx
+++ editeng/source/accessibility/AccessibleStaticTextBase.cxx
@@ -882,6 +882,16 @@ namespace accessibility
                                  aEndIndex.nPara, aEndIndex.nIndex );
     }
 
+    sal_Bool SAL_CALL AccessibleStaticTextBase::scrollSubstringTo( sal_Int32, sal_Int32, sal_Int16 )
+    {
+        return false;
+    }
+
+    sal_Bool SAL_CALL AccessibleStaticTextBase::scrollSubstringToPoint( sal_Int32, sal_Int32, const css::awt::Point& )
+    {
+        return false;
+    }
+
     // XAccessibleTextAttributes
     uno::Sequence< beans::PropertyValue > AccessibleStaticTextBase::getDefaultAttributes( const uno::Sequence< OUString >& RequestedAttributes )
     {
diff --git include/editeng/AccessibleEditableTextPara.hxx include/editeng/AccessibleEditableTextPara.hxx
index d2b07f965c3d..8d1d12f35d89 100644
--- include/editeng/AccessibleEditableTextPara.hxx
+++ include/editeng/AccessibleEditableTextPara.hxx
@@ -138,6 +138,8 @@ namespace accessibility
         /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine)
         virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
         virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
+        virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, sal_Int16 aScrollType) override;
+        virtual sal_Bool SAL_CALL scrollSubstringToPoint( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const css::awt::Point& aPoint ) override;
 
         // XAccessibleEditableText
         virtual sal_Bool SAL_CALL cutText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
diff --git include/editeng/AccessibleStaticTextBase.hxx include/editeng/AccessibleStaticTextBase.hxx
index 0ecf3021a2f4..49b6d8cbde98 100644
--- include/editeng/AccessibleStaticTextBase.hxx
+++ include/editeng/AccessibleStaticTextBase.hxx
@@ -198,6 +198,8 @@ namespace accessibility
         virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
         /// This will only work with a functional SvxEditViewForwarder, i.e. an EditEngine/Outliner in edit mode
         virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
+        virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, sal_Int16 aScrollType) override;
+        virtual sal_Bool SAL_CALL scrollSubstringToPoint( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const css::awt::Point& aPoint ) override;
 
         // XAccessibleTextAttributes
         virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getDefaultAttributes( const css::uno::Sequence< OUString >& RequestedAttributes ) override;
diff --git include/svx/AccessibleShape.hxx include/svx/AccessibleShape.hxx
index ced35ca26e66..4796716a2d4c 100644
--- include/svx/AccessibleShape.hxx
+++ include/svx/AccessibleShape.hxx
@@ -350,6 +350,8 @@ public:
         virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
         virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
         virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
+        virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, sal_Int16 aScrollType) override;
+        virtual sal_Bool SAL_CALL scrollSubstringToPoint( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const css::awt::Point& aPoint ) override;
 
     //===== Misc ========================================================
 
diff --git offapi/UnoApi_offapi.mk offapi/UnoApi_offapi.mk
index 12ab8e2057e9..7cf6e8b6b5c0 100644
--- offapi/UnoApi_offapi.mk
+++ offapi/UnoApi_offapi.mk
@@ -1622,6 +1622,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/accessibility,\
 	AccessibleRelation \
 	AccessibleRelationType \
 	AccessibleRole \
+	AccessibleScrollType \
 	AccessibleStateType \
 	AccessibleTableModelChange \
 	AccessibleTableModelChangeType \
diff --git offapi/com/sun/star/accessibility/AccessibleScrollType.idl offapi/com/sun/star/accessibility/AccessibleScrollType.idl
new file mode 100644
index 000000000000..59e8bcef98e6
--- /dev/null
+++ offapi/com/sun/star/accessibility/AccessibleScrollType.idl
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __com_sun_star_accessibility_AccessibleScrollType_idl__
+#define __com_sun_star_accessibility_AccessibleScrollType_idl__
+
+module com { module sun { module star { module accessibility {
+
+/** Scroll types
+
+    <p>Describes the type of scrolling that are available for the methods of
+    the XAccessibleScrollableText interface.</p>
+*/
+constants AccessibleScrollType
+{
+    /**
+    */
+    const short SCROLL_TOP_LEFT = 0;
+
+    /**
+    */
+    const short SCROLL_BOTTOM_RIGHT = 1;
+
+    /**
+    */
+    const short SCROLL_TOP_EDGE = 2;
+
+    /**
+    */
+    const short SCROLL_BOTTOM_EDGE = 3;
+
+    /**
+    */
+    const short SCROLL_LEFT_EDGE = 4;
+
+    /**
+    */
+    const short SCROLL_RIGHT_EDGE = 5;
+
+    /**
+    */
+    const short SCROLL_ANYWHERE = 6;
+};
+
+}; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git offapi/com/sun/star/accessibility/XAccessibleText.idl offapi/com/sun/star/accessibility/XAccessibleText.idl
index 7e90f2d8a463..8108f7893a29 100644
--- offapi/com/sun/star/accessibility/XAccessibleText.idl
+++ offapi/com/sun/star/accessibility/XAccessibleText.idl
@@ -491,6 +491,35 @@ interface XAccessibleText : ::com::sun::star::uno::XInterface
     boolean copyText ([in] long nStartIndex, [in] long nEndIndex)
         raises (::com::sun::star::lang::IndexOutOfBoundsException);
 
+    /** Scroll ...
+
+        @param nIndex
+
+        @return
+            Returns `TRUE` if ...
+
+        @throws ::com::sun::star::lang::IndexOutOfBoundsException
+            if the indices are invalid
+    */
+    boolean
+        scrollSubstringTo ([in] long nStartIndex, [in] long nEndIndex,
+            [in] short aScrollType)
+        raises (::com::sun::star::lang::IndexOutOfBoundsException);
+
+    /** Scroll ...
+
+        @param nIndex
+
+        @return
+            Returns `TRUE` if ...
+
+        @throws ::com::sun::star::lang::IndexOutOfBoundsException
+            if the indices are invalid
+    */
+    boolean
+        scrollSubstringToPoint ([in] long nStartIndex, [in] long nEndIndex,
+            [in] ::com::sun::star::awt::Point aPoint)
+        raises (::com::sun::star::lang::IndexOutOfBoundsException);
 };
 
 }; }; }; };
diff --git sc/source/ui/Accessibility/AccessibleCsvControl.cxx sc/source/ui/Accessibility/AccessibleCsvControl.cxx
index baf18888cbbf..18bacddaff85 100644
--- sc/source/ui/Accessibility/AccessibleCsvControl.cxx
+++ sc/source/ui/Accessibility/AccessibleCsvControl.cxx
@@ -610,6 +610,16 @@ sal_Bool SAL_CALL ScAccessibleCsvRuler::copyText( sal_Int32 /* nStartIndex */, s
     return false;
 }
 
+sal_Bool SAL_CALL ScAccessibleCsvRuler::scrollSubstringTo( sal_Int32 /* nStartIndex */, sal_Int32/* nEndIndex */, sal_Int16 /* aScrollType */ )
+{
+    return false;
+}
+
+sal_Bool SAL_CALL ScAccessibleCsvRuler::scrollSubstringToPoint( sal_Int32 /* nStartIndex */, sal_Int32 /* nEndIndex */, const css::awt::Point& /* rPoint */ )
+{
+    return false;
+}
+
 // XInterface -----------------------------------------------------------------
 
 Any SAL_CALL ScAccessibleCsvRuler::queryInterface( const css::uno::Type& rType )
diff --git sc/source/ui/inc/AccessibleCsvControl.hxx sc/source/ui/inc/AccessibleCsvControl.hxx
index 58e9035c88b1..4a0b73532c84 100644
--- sc/source/ui/inc/AccessibleCsvControl.hxx
+++ sc/source/ui/inc/AccessibleCsvControl.hxx
@@ -175,6 +175,9 @@ public:
     /** Copies the specified text range into the clipboard (ruler does nothing). */
     virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
 
+    virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, sal_Int16 aScrollType) override;
+    virtual sal_Bool SAL_CALL scrollSubstringToPoint( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const css::awt::Point& aPoint ) override;
+
     // XInterface -------------------------------------------------------------
 
     DECLARE_XINTERFACE()
diff --git sdext/source/presenter/PresenterAccessibility.cxx sdext/source/presenter/PresenterAccessibility.cxx
index 59397990458e..6ecc52341d8c 100644
--- sdext/source/presenter/PresenterAccessibility.cxx
+++ sdext/source/presenter/PresenterAccessibility.cxx
@@ -324,6 +324,10 @@ public:
 
     virtual sal_Bool SAL_CALL copyText (sal_Int32 nStartIndex, sal_Int32 nEndIndex) override;
 
+    virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, sal_Int16 aScrollType) override;
+
+    virtual sal_Bool SAL_CALL scrollSubstringToPoint( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const css::awt::Point& aPoint ) override;
+
 protected:
     virtual awt::Point GetRelativeLocation() override;
     virtual awt::Size GetSize() override;
@@ -1575,6 +1579,22 @@ sal_Bool SAL_CALL PresenterAccessible::AccessibleParagraph::copyText (
     return false;
 }
 
+sal_Bool SAL_CALL PresenterAccessible::AccessibleParagraph::scrollSubstringTo(
+    sal_Int32,
+    sal_Int32,
+    sal_Int16)
+{
+    return false;
+}
+
+sal_Bool SAL_CALL PresenterAccessible::AccessibleParagraph::scrollSubstringToPoint(
+    sal_Int32,
+    sal_Int32,
+    const css::awt::Point&)
+{
+    return false;
+}
+
 //----- protected -------------------------------------------------------------
 
 awt::Point PresenterAccessible::AccessibleParagraph::GetRelativeLocation()
diff --git starmath/source/accessibility.cxx starmath/source/accessibility.cxx
index 23f4c6cb0a42..6be8d252c21b 100644
--- starmath/source/accessibility.cxx
+++ starmath/source/accessibility.cxx
@@ -718,6 +718,16 @@ sal_Bool SAL_CALL SmGraphicAccessible::copyText(
     return bReturn;
 }
 
+sal_Bool SAL_CALL SmGraphicAccessible::scrollSubstringTo( sal_Int32, sal_Int32, sal_Int16 )
+{
+    return false;
+}
+
+sal_Bool SAL_CALL SmGraphicAccessible::scrollSubstringToPoint( sal_Int32, sal_Int32, const css::awt::Point& )
+{
+    return false;
+}
+
 OUString SAL_CALL SmGraphicAccessible::getImplementationName()
 {
     return "SmGraphicAccessible";
diff --git starmath/source/accessibility.hxx starmath/source/accessibility.hxx
index dceff88ae478..d8cb22854522 100644
--- starmath/source/accessibility.hxx
+++ starmath/source/accessibility.hxx
@@ -128,6 +128,8 @@ public:
     virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
     virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
     virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
+    virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, sal_Int16 aScrollType) override;
+    virtual sal_Bool SAL_CALL scrollSubstringToPoint( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const css::awt::Point& aPoint ) override;
 
     // XServiceInfo
     virtual OUString SAL_CALL getImplementationName(  ) override;
diff --git svx/source/accessibility/AccessibleShape.cxx svx/source/accessibility/AccessibleShape.cxx
index 1f2315e07c48..01e4a5aa3358 100644
--- svx/source/accessibility/AccessibleShape.cxx
+++ svx/source/accessibility/AccessibleShape.cxx
@@ -1336,6 +1336,8 @@ css::accessibility::TextSegment SAL_CALL AccessibleShape::getTextBehindIndex( sa
     return aResult;
 }
 sal_Bool SAL_CALL AccessibleShape::copyText( sal_Int32, sal_Int32 ){return true;}
+sal_Bool SAL_CALL AccessibleShape::scrollSubstringTo( sal_Int32, sal_Int32, sal_Int16 ){return false;}
+sal_Bool SAL_CALL AccessibleShape::scrollSubstringToPoint( sal_Int32, sal_Int32, const css::awt::Point& ){return false;}
 
 } // end of namespace accessibility
 
diff --git sw/source/core/access/accnotextframe.cxx sw/source/core/access/accnotextframe.cxx
index 7aa34cffe2bf..753d9912650e 100644
--- sw/source/core/access/accnotextframe.cxx
+++ sw/source/core/access/accnotextframe.cxx
@@ -259,6 +259,8 @@ css::accessibility::TextSegment SAL_CALL SwAccessibleNoTextFrame::getTextBehindI
 }
 
 sal_Bool SAL_CALL SwAccessibleNoTextFrame::copyText( sal_Int32, sal_Int32 ){return true;}
+sal_Bool SAL_CALL SwAccessibleNoTextFrame::scrollSubstringTo( sal_Int32, sal_Int32, sal_Int16 ){return false;}
+sal_Bool SAL_CALL SwAccessibleNoTextFrame::scrollSubstringToPoint( sal_Int32, sal_Int32, const css::awt::Point& ){return false;}
 
 //  XAccessibleHyperText
 
diff --git sw/source/core/access/accnotextframe.hxx sw/source/core/access/accnotextframe.hxx
index 38fdd480cc97..2677627c500e 100644
--- sw/source/core/access/accnotextframe.hxx
+++ sw/source/core/access/accnotextframe.hxx
@@ -104,6 +104,8 @@ public:
     virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
     virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
     virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
+    virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, sal_Int16 aScrollType) override;
+    virtual sal_Bool SAL_CALL scrollSubstringToPoint( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const css::awt::Point& aPoint ) override;
 
     // XAccessibleHypertext
     virtual sal_Int32 SAL_CALL getHyperLinkCount() override;
diff --git sw/source/core/access/accpara.cxx sw/source/core/access/accpara.cxx
index 8b4a1658d5e4..a22bcebf2ba3 100644
--- sw/source/core/access/accpara.cxx
+++ sw/source/core/access/accpara.cxx
@@ -21,6 +21,7 @@
 #include <numeric>
 #include <txtfrm.hxx>
 #include <flyfrm.hxx>
+#include <mdiexp.hxx>
 #include <ndtxt.hxx>
 #include <pam.hxx>
 #include <unotextrange.hxx>
@@ -34,6 +35,7 @@
 #include <vcl/window.hxx>
 #include <sal/log.hxx>
 #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/AccessibleTextType.hpp>
 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
@@ -2492,6 +2494,69 @@ sal_Bool SwAccessibleParagraph::copyText( sal_Int32 nStartIndex, sal_Int32 nEndI
     return true;
 }
 
+sal_Bool SwAccessibleParagraph::scrollSubstringTo( sal_Int32 nStartIndex,
+    sal_Int32 nEndIndex, sal_Int16 aScrollType )
+{
+    SolarMutexGuard aGuard;
+
+    ThrowIfDisposed();
+
+    // parameter checking
+    sal_Int32 nLength = GetString().getLength();
+    if ( ! IsValidRange( nStartIndex, nEndIndex, nLength ) )
+        throw lang::IndexOutOfBoundsException();
+
+    vcl::Window *pWin = GetWindow();
+    if ( ! pWin )
+        throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this));
+
+    awt::Rectangle startR, endR;
+    startR = getCharacterBounds(nStartIndex);
+    endR = getCharacterBounds(nEndIndex);
+
+    Point sP(startR.X, startR.Y);
+    Point eP(endR.X, endR.Y);
+    Point startPoint(GetMap()->PixelToCore(sP));
+    Point endPoint(GetMap()->PixelToCore(eP));
+
+    switch (aScrollType)
+    {
+#if 0
+        case AccessibleScrollType::SCROLL_TOP_LEFT:
+            break;
+        case AccessibleScrollType::SCROLL_BOTTOM_RIGHT:
+            break;
+        case AccessibleScrollType::SCROLL_TOP_EDGE:
+            break;
+        case AccessibleScrollType::SCROLL_BOTTOM_EDGE:
+            break;
+        case AccessibleScrollType::SCROLL_LEFT_EDGE:
+            break;
+        case AccessibleScrollType::SCROLL_RIGHT_EDGE:
+            break;
+#endif
+        case AccessibleScrollType::SCROLL_ANYWHERE:
+            break;
+        default:
+            return false;
+    }
+
+    const SwRect aRect(startPoint, endPoint);
+    SwViewShell* pViewShell = GetMap()->GetShell();
+    OSL_ENSURE( pViewShell != nullptr, "View shell expected!" );
+
+    ScrollMDI(pViewShell, aRect, USHRT_MAX, USHRT_MAX);
+
+    return true;
+}
+
+sal_Bool SwAccessibleParagraph::scrollSubstringToPoint( sal_Int32 nStartIndex,
+    sal_Int32 nEndIndex, const css::awt::Point& rPoint )
+{
+    fprintf(stderr, "%s: AccPara start=%u, end=%u, x|y=%d|%d\n", __func__, nStartIndex, nEndIndex, rPoint.X, rPoint.Y);
+    return false;
+}
+
 // XAccessibleEditableText
 
 sal_Bool SwAccessibleParagraph::cutText( sal_Int32 nStartIndex, sal_Int32 nEndIndex )
diff --git sw/source/core/access/accpara.hxx sw/source/core/access/accpara.hxx
index 5e6fed4a5705..6d4274166bbc 100644
--- sw/source/core/access/accpara.hxx
+++ sw/source/core/access/accpara.hxx
@@ -313,6 +313,8 @@ public:
     virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
     virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
     virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
+    virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, sal_Int16 aScrollType) override;
+    virtual sal_Bool SAL_CALL scrollSubstringToPoint( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const css::awt::Point& aPoint ) override;
 
     // XAccessibleEditableText
     virtual sal_Bool SAL_CALL cutText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
diff --git vcl/unx/gtk3/a11y/gtk3atktext.cxx vcl/unx/gtk3/a11y/gtk3atktext.cxx
index 1406ceea5544..2ae9471d2387 100644
--- vcl/unx/gtk3/a11y/gtk3atktext.cxx
+++ vcl/unx/gtk3/a11y/gtk3atktext.cxx
@@ -23,6 +23,7 @@
 
 #include <osl/diagnose.h>
 
+#include <com/sun/star/accessibility/AccessibleScrollType.hpp>
 #include <com/sun/star/accessibility/AccessibleTextType.hpp>
 #include <com/sun/star/accessibility/TextSegment.hpp>
 #include <com/sun/star/accessibility/XAccessibleMultiLineText.hpp>
@@ -56,6 +57,34 @@ text_type_from_boundary(AtkTextBoundary boundary_type)
 
 /*****************************************************************************/
 
+#if ATK_CHECK_VERSION(2,32,0)
+static sal_Int16
+scroll_type_from_scroll_type(AtkScrollType type)
+{
+    switch(type)
+    {
+        case ATK_SCROLL_TOP_LEFT:
+            return accessibility::AccessibleScrollType::SCROLL_TOP_LEFT;
+        case ATK_SCROLL_BOTTOM_RIGHT:
+            return accessibility::AccessibleScrollType::SCROLL_BOTTOM_RIGHT;
+        case ATK_SCROLL_TOP_EDGE:
+            return accessibility::AccessibleScrollType::SCROLL_TOP_EDGE;
+        case ATK_SCROLL_BOTTOM_EDGE:
+            return accessibility::AccessibleScrollType::SCROLL_BOTTOM_EDGE;
+        case ATK_SCROLL_LEFT_EDGE:
+            return accessibility::AccessibleScrollType::SCROLL_LEFT_EDGE;
+        case ATK_SCROLL_RIGHT_EDGE:
+            return accessibility::AccessibleScrollType::SCROLL_RIGHT_EDGE;
+        case ATK_SCROLL_ANYWHERE:
+            return accessibility::AccessibleScrollType::SCROLL_ANYWHERE;
+        default:
+            return -1;
+    }
+}
+#endif
+
+/*****************************************************************************/
+
 static gchar *
 adjust_boundaries( css::uno::Reference<css::accessibility::XAccessibleText> const & pText,
                    accessibility::TextSegment const & rTextSegment,
@@ -809,6 +838,68 @@ text_wrapper_set_selection (AtkText *text,
     return FALSE;
 }
 
+#if ATK_CHECK_VERSION(2,32,0)
+static gboolean
+text_wapper_scroll_substring_to(AtkText       *text,
+                                gint           start_offset,
+                                gint           end_offset,
+                                AtkScrollType  scroll_type)
+{
+    sal_Int16 type = scroll_type_from_scroll_type(scroll_type);
+    if (type == -1)
+        return FALSE;
+
+    g_warning( "Calling %s()", __func__ );
+    try {
+        css::uno::Reference<css::accessibility::XAccessibleText> pText
+            = getText( text );
+
+        if( pText.is() )
+            return pText->scrollSubstringTo( start_offset, end_offset , type );
+    }
+    catch(const uno::Exception&) {
+        g_warning( "Exception in scrollSubstringTo()" );
+    }
+
+    g_warning( "pText is apparently not XAccessibleText" );
+    return FALSE;
+}
+
+static gboolean
+text_wapper_scroll_substring_to_point(AtkText      *text,
+                                      gint          start_offset,
+                                      gint          end_offset,
+                                      AtkCoordType  coords,
+                                      gint          x,
+                                      gint          y)
+{
+    try {
+        css::uno::Reference<css::accessibility::XAccessibleText> pText
+            = getText( text );
+        if( pText.is() )
+        {
+            gint origin_x = 0;
+            gint origin_y = 0;
+
+            if( coords == ATK_XY_SCREEN )
+            {
+                g_return_val_if_fail( ATK_IS_COMPONENT( text ), -1 );
+                SAL_WNODEPRECATED_DECLARATIONS_PUSH
+                atk_component_get_position( ATK_COMPONENT( text ), &origin_x, &origin_y, coords);
+                SAL_WNODEPRECATED_DECLARATIONS_POP
+            }
+
+            return pText->scrollSubstringToPoint( start_offset, end_offset , awt::Point(x - origin_x, y - origin_y) );
+        }
+    }
+    catch(const uno::Exception&) {
+        g_warning( "Exception in scrollSubstringToPoint()" );
+    }
+
+    return FALSE;
+}
+#endif
+
 } // extern "C"
 
 void
@@ -833,6 +924,11 @@ textIfaceInit (AtkTextIface *iface)
   iface->get_default_attributes = text_wrapper_get_default_attributes;
   iface->get_character_extents = text_wrapper_get_character_extents;
   iface->get_offset_at_point = text_wrapper_get_offset_at_point;
+#if ATK_CHECK_VERSION(2,32,0)
+  iface->scroll_substring_to = text_wapper_scroll_substring_to;
+  iface->scroll_substring_to_point = text_wapper_scroll_substring_to_point;
+  g_warning( "%s: installing scroll interface", __func__ );
+#endif
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the LibreOffice mailing list