starmath/source/view.cxx | 4 ++++ 1 file changed, 4 insertions(+) New commits: commit 1636aa5db54b6438e8a93f6d5aa15f6867bfa856 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 14:03:27 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> (cherry picked from commit f4b6ff46aea6d260eab191daf5d437dada39f4d0) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143155 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 1fd8d04acb2c..a38f704ad42d 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -2349,6 +2349,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()); @@ -2366,6 +2368,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();