Date: prev next · Thread: first prev next last
2020 Archives by date, by thread · List index


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.
From a55b4e20faef145f4bb0619bd22a9f78e0a61ca6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Wed, 22 Jan 2020 17:17:34 +0000
Subject: [PATCH] wip: demo how I think ScrollMDI could be used here

Change-Id: I56ad6a303ef3c9e54ffa3ac506cf206b664831fc
---
 sw/source/core/access/accpara.cxx | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index 0ffeea847e82..678aa2dce64c 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/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>
@@ -2899,9 +2900,14 @@ sal_Int32 SAL_CALL SwAccessibleParagraph::getTextMarkupCount( sal_Int32 
nTextMar
 }
 
 //MSAA Extension Implementation in app  module
-sal_Bool SAL_CALL SwAccessibleParagraph::scrollToPosition( const css::awt::Point&, sal_Bool )
+sal_Bool SAL_CALL SwAccessibleParagraph::scrollToPosition( const css::awt::Point& rPoint, sal_Bool 
)
 {
-    return false;
+    Point aPt(rPoint.X, rPoint.Y);
+    Point aCorePoint(GetMap()->PixelToCore(aPt));
+    const SwRect aRect(aCorePoint, aCorePoint);
+    SwViewShell* pViewShell = GetMap()->GetShell();
+    ScrollMDI(pViewShell, aRect, USHRT_MAX, USHRT_MAX);
+    return true;
 }
 
 sal_Int32 SAL_CALL SwAccessibleParagraph::getSelectedPortionCount(  )
-- 
2.24.1


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.