[Libreoffice-commits] core.git: Branch 'distro/collabora/co-2021' - editeng/source

Dennis Francis (via logerrit) logerrit at kemper.freedesktop.org
Wed Jun 9 07:34:29 UTC 2021


 editeng/source/editeng/impedit.cxx |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

New commits:
commit 73e2bee5753e4b34024a138f8a0ea1203dfe79be
Author:     Dennis Francis <dennis.francis at collabora.com>
AuthorDate: Tue May 25 10:35:22 2021 +0530
Commit:     Dennis Francis <dennis.francis at collabora.com>
CommitDate: Wed Jun 9 09:33:51 2021 +0200

    sc: lokit: fix wrong edit cursor coordinates for numeric cells
    
    The cursor coordinates returned by editengine implementation is computed
    with respect to document-visible-area in "display" hmm and not "print"
    hmm. For numeric cells, the visible top-left is always non-zero, hence
    triggering this incorrect "refpoint" subtraction to compute "relrect".
    
    The fix is to calculate the correct "relrect" by subtracting the display
    hmm version of "refpoint" from the edit cursor rectange and then convert
    to twips.
    
    Change-Id: I4b663edcb1f74e1bdcc300788769d580fcfe7e17
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116426
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
    Reviewed-by: Dennis Francis <dennis.francis at collabora.com>
    (cherry picked from commit 77704022556bb97a64ef47666230a2c0232d45d3)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116804

diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index edb7cd228151..3b329d567943 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -1312,11 +1312,15 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor )
 
                 MapUnit eDevUnit = rOutDev.GetMapMode().GetMapUnit();
                 tools::Rectangle aCursorRectPureLogical(aEditCursor.TopLeft(), GetCursor()->GetSize());
-                // Get rectangle in window-coordinates from editeng(doc) coordinates.
-                aCursorRectPureLogical = mpLOKSpecialPositioning->GetWindowPos(aCursorRectPureLogical, eDevUnit);
+                // Get rectangle in window-coordinates from editeng(doc) coordinates in hmm.
+                aCursorRectPureLogical = GetWindowPos(aCursorRectPureLogical);
+                Point aRefPointLogical = GetOutputArea().TopLeft();
+                // Get the relative coordinates w.r.t refpoint in display hmm.
+                aCursorRectPureLogical.Move(-aRefPointLogical.X(), -aRefPointLogical.Y());
+                // Convert to twips.
+                aCursorRectPureLogical = OutputDevice::LogicToLogic(aCursorRectPureLogical, MapMode(eDevUnit), MapMode(MapUnit::MapTwip));
+                // "refpoint" in print twips.
                 const Point aRefPoint = mpLOKSpecialPositioning->GetRefPoint();
-                // Get the relative coordinates w.r.t rRefPoint.
-                aCursorRectPureLogical.Move(-aRefPoint.X(), -aRefPoint.Y());
                 aMessageParams.put("relrect", aCursorRectPureLogical.toString());
                 aMessageParams.put("refpoint", aRefPoint.toString());
             }


More information about the Libreoffice-commits mailing list