include/svx/svdedtv.hxx | 6 +++++- sd/source/ui/func/futransf.cxx | 13 ++++++++----- svx/source/svdraw/svdedtv1.cxx | 8 +++++++- 3 files changed, 20 insertions(+), 7 deletions(-)
New commits: commit 206c5b374eb56ef1674bb0dbd0d199d2761ea469 Author: mert <mert.tu...@collabora.com> AuthorDate: Thu Mar 4 12:17:27 2021 +0300 Commit: Mert Tumer <mert.tu...@collabora.com> CommitDate: Tue Mar 9 09:37:31 2021 +0100 Fix wrong position on move when page has margin Change-Id: I9ac2d9914b86210ca2148b44488c2c70cc5870d4 Signed-off-by: mert <mert.tu...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111949 Reviewed-by: Miklos Vajna <vmik...@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/include/svx/svdedtv.hxx b/include/svx/svdedtv.hxx index 973a28cd1b9e..4351ccee2764 100644 --- a/include/svx/svdedtv.hxx +++ b/include/svx/svdedtv.hxx @@ -305,7 +305,11 @@ public: // geometrical attribute (position, size, rotation angle) // A PageOrigin set at a position is taken into account. SfxItemSet GetGeoAttrFromMarked() const; - void SetGeoAttrToMarked(const SfxItemSet& rAttr); + // In LOK, interactive shape movement uses this function + // in that case, margin is not taken into account + // and the final position of the shape becomes incorrect + // However, "Position and Size" dialog and other cases already add the margins. + void SetGeoAttrToMarked(const SfxItemSet& rAttr, bool addPageMargin = false); // Returns NULL if: // - nothing is marked, diff --git a/sd/source/ui/func/futransf.cxx b/sd/source/ui/func/futransf.cxx index 96a805040cb9..a0dc99664c3f 100644 --- a/sd/source/ui/func/futransf.cxx +++ b/sd/source/ui/func/futransf.cxx @@ -28,6 +28,7 @@ #include <sdresid.hxx> #include <drawdoc.hxx> #include <svx/svxdlg.hxx> +#include <comphelper/lok.hxx> #include <memory> @@ -48,14 +49,13 @@ rtl::Reference<FuPoor> FuTransform::Create( ViewShell* pViewSh, ::sd::Window* pW namespace { -void setUndo(::sd::View* pView, const SfxItemSet* pArgs) +void setUndo(::sd::View* pView, const SfxItemSet* pArgs, bool addPageMargin) { // Undo OUString aString = pView->GetDescriptionOfMarkedObjects() + " " + SdResId(STR_TRANSFORM); pView->BegUndo(aString); - - pView->SetGeoAttrToMarked(*pArgs); + pView->SetGeoAttrToMarked(*pArgs, addPageMargin); pView->SetAttributes(*pArgs); pView->EndUndo(); } @@ -71,7 +71,9 @@ void FuTransform::DoExecute( SfxRequest& rReq ) if (pArgs) { - setUndo(mpView, pArgs); + // If this comes from LOK, that means the shape is moved by mouse + // only then pArgs is pre-set. + setUndo(mpView, pArgs, comphelper::LibreOfficeKit::isActive()); return; } @@ -116,7 +118,8 @@ void FuTransform::DoExecute( SfxRequest& rReq ) if (nResult == RET_OK) { pRequest->Done(*(pDlg->GetOutputItemSet())); - setUndo(mpView, pRequest->GetArgs()); + // Page margin is already calculated at this point. + setUndo(mpView, pRequest->GetArgs(), false); } // deferred until the dialog ends diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx index cf29f4a268df..830ef238c590 100644 --- a/svx/source/svdraw/svdedtv1.cxx +++ b/svx/source/svdraw/svdedtv1.cxx @@ -1534,7 +1534,7 @@ static Point ImpGetPoint(const tools::Rectangle& rRect, RectPoint eRP) return Point(); // Should not happen! } -void SdrEditView::SetGeoAttrToMarked(const SfxItemSet& rAttr) +void SdrEditView::SetGeoAttrToMarked(const SfxItemSet& rAttr, bool addPageMargin) { const bool bTiledRendering = comphelper::LibreOfficeKit::isActive(); @@ -1542,6 +1542,12 @@ void SdrEditView::SetGeoAttrToMarked(const SfxItemSet& rAttr) if(GetSdrPageView()) { + if (addPageMargin) + { + SdrPage * pPage = GetSdrPageView()->GetPage(); + Point upperLeft(pPage->GetLeftBorder(), pPage->GetUpperBorder()); + aRect.Move(upperLeft.getX(), upperLeft.getY()); + } GetSdrPageView()->LogicToPagePos(aRect); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits