starmath/source/view.cxx |    4 ++++
 1 file changed, 4 insertions(+)

New commits:
commit f4b6ff46aea6d260eab191daf5d437dada39f4d0
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Wed Nov 23 12:29:48 2022 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Wed Nov 23 12:18:16 2022 +0100

    lok: take borders into account in in-place Math cursor/selection
    
    The offset is defined by formula's top/left borders (in UI under
    Format->Spacing).
    
    Change-Id: Ic17356f8c6e4db3cbe0df765d133ee240f5b088d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143136
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index 8898d10bf5a1..3c7c8b1554d3 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -2319,6 +2319,8 @@ std::optional<OString> SmViewShell::getLOKPayload(int 
nType, int nViewId) const
                 SmCursor& rCursor = GetDoc()->GetCursor();
                 OutputDevice& rOutDev = 
const_cast<SmGraphicWidget&>(widget).GetOutputDevice();
                 tools::Rectangle aCaret = rCursor.GetCaretRectangle(rOutDev);
+                Point aFormulaDrawPos = widget.GetFormulaDrawPos();
+                aCaret.Move(aFormulaDrawPos.X(), aFormulaDrawPos.Y());
                 LokStarMathHelper helper(SfxViewShell::Current());
                 tools::Rectangle aBounds = helper.GetBoundingBox();
                 aCaret.Move(aBounds.Left(), aBounds.Top());
@@ -2336,6 +2338,8 @@ std::optional<OString> SmViewShell::getLOKPayload(int 
nType, int nViewId) const
                 tools::Rectangle aSelection = 
rCursor.GetSelectionRectangle(rOutDev);
                 if (!aSelection.IsEmpty())
                 {
+                    Point aFormulaDrawPos = widget.GetFormulaDrawPos();
+                    aSelection.Move(aFormulaDrawPos.X(), aFormulaDrawPos.Y());
                     LokStarMathHelper helper(SfxViewShell::Current());
                     tools::Rectangle aBounds = helper.GetBoundingBox();
 

Reply via email to