diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2019-07-10 16:04:05 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2019-07-11 00:12:36 +0200 |
commit | c54597a8905b07807952aebc24237549302fb941 (patch) | |
tree | 3e0c001a5a9e8c2748820edbf109432e7a826446 /sw/source/uibase/shells | |
parent | bfdd98d214da77b4508bc7d2e9e31817471fe90c (diff) |
sw: fix TransformDialog with args when the shape moves to a different page
When a macro or Online invokes .uno:TransformDialog with arguments, then
instead of showing the dialog, we apply the position/size/etc settings
to the currently selected shape.
This was not working correctly when setting an absolute twips position
where the old and the new containing page frame was different.
The desktop case drag&drop invokes SwFEShell::EndDrag(), which uses
SwFEShell::ChgAnchor() to maintain the invariant that a draw shape
position and its anchor is contained within the same page frame.
The same was not true when SwDrawBaseShell::Execute() calls
SdrEditView::SetGeoAttrToMarked(), so extend that a bit to also update
the anchor position.
With this, moving down a shape from the 1st page to the 2nd one via the
API works and updates the anchor correctly, while in the past the move
was only possible within the bounds of the current page frame. (See the
"determine and set position" code in SwAnchoredDrawObject that enforces
this invariant when the anchor is not updated.)
Change-Id: Ia54470f6f3679ddc78a2f0a842f2fca10d20084d
Reviewed-on: https://gerrit.libreoffice.org/75359
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sw/source/uibase/shells')
-rw-r--r-- | sw/source/uibase/shells/drwbassh.cxx | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/sw/source/uibase/shells/drwbassh.cxx b/sw/source/uibase/shells/drwbassh.cxx index ef90e5b7abe0..2b6a66393cb1 100644 --- a/sw/source/uibase/shells/drwbassh.cxx +++ b/sw/source/uibase/shells/drwbassh.cxx @@ -348,7 +348,22 @@ void SwDrawBaseShell::Execute(SfxRequest const &rReq) } else { + pSh->StartAllAction(); pSdrView->SetGeoAttrToMarked( *pArgs ); + const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList(); + SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); + if (pObj) + { + SwFrameFormat* pFrameFormat = FindFrameFormat(pObj); + if (pFrameFormat) + { + const SwFormatAnchor& rAnchor = pFrameFormat->GetAnchor(); + // Don't change shape position / size, just update the anchor doc model + // position. + pSh->ChgAnchor(rAnchor.GetAnchorId(), /*bSameOnly=*/true); + } + } + pSh->EndAllAction(); } } } |