[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - svx/source sw/source
merttumer (via logerrit)
logerrit at kemper.freedesktop.org
Tue May 25 04:20:16 UTC 2021
svx/source/svdraw/svdmrkv.cxx | 21 ++++++++++++++++-----
sw/source/core/draw/dview.cxx | 6 ++++--
sw/source/uibase/shells/drawsh.cxx | 12 +++++++++++-
sw/source/uibase/uiview/view2.cxx | 7 ++++++-
4 files changed, 37 insertions(+), 9 deletions(-)
New commits:
commit 0a5606dc180c7a643ff4820f7e05413398352b2d
Author: merttumer <mert.tumer at collabora.com>
AuthorDate: Mon May 24 10:52:13 2021 +0300
Commit: Mert Tumer <mert.tumer at collabora.com>
CommitDate: Tue May 25 06:19:44 2021 +0200
Extended MoveShapeHandle command for Anchors as well
Change-Id: I0e2811802f17831097a86103571b505a7557717a
Signed-off-by: merttumer <mert.tumer at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116040
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index 875d0dfc3993..61f7d472ecd6 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -1002,6 +1002,7 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, SfxView
{
boost::property_tree::ptree responseJSON;
boost::property_tree::ptree others;
+ boost::property_tree::ptree anchor;
boost::property_tree::ptree rectangle;
boost::property_tree::ptree poly;
boost::property_tree::ptree custom;
@@ -1036,6 +1037,14 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, SfxView
{
selectedNode = &custom;
}
+ else if (kind == static_cast<sal_Int32>(SdrHdlKind::Anchor) || kind == static_cast<sal_Int32>(SdrHdlKind::Anchor_TR))
+ {
+ if (getSdrModelFromSdrView().IsWriter())
+ selectedNode = &anchor;
+ else
+ // put it to others as we dont render them except in writer
+ selectedNode = &others;
+ }
else
{
selectedNode = &others;
@@ -1054,6 +1063,7 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, SfxView
nodes.add_child("rectangle", rectangle);
nodes.add_child("poly", poly);
nodes.add_child("custom", custom);
+ nodes.add_child("anchor", anchor);
nodes.add_child("others", others);
responseJSON.add_child("kinds", nodes);
std::stringstream aStream;
@@ -1415,11 +1425,6 @@ void SdrMarkView::SetMarkHandles(SfxViewShell* pOtherShell)
}
}
- // moved it here to access all the handles for callback.
- if (bTiledRendering && pViewShell)
- {
- SetMarkHandlesForLOKit(aRect, pOtherShell);
- }
// rotation point/axis of reflection
if(!bLimitedRotation)
{
@@ -1432,6 +1437,12 @@ void SdrMarkView::SetMarkHandles(SfxViewShell* pOtherShell)
// add custom handles (used by other apps, e.g. AnchorPos)
AddCustomHdl();
+ // moved it here to access all the handles for callback.
+ if (bTiledRendering && pViewShell)
+ {
+ SetMarkHandlesForLOKit(aRect, pOtherShell);
+ }
+
// try to restore focus handle index from remembered values
if(bSaveOldFocus)
{
diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx
index c1a7b6a8cbbc..f9ef11b99897 100644
--- a/sw/source/core/draw/dview.cxx
+++ b/sw/source/core/draw/dview.cxx
@@ -239,8 +239,10 @@ void SwDrawView::AddCustomHdl()
}
// add anchor handle:
- maHdlList.AddHdl( std::make_unique<SwSdrHdl>( aPos, ( pAnch->IsVertical() && !pAnch->IsVertLR() ) ||
- pAnch->IsRightToLeft() ) );
+ std::unique_ptr<SdrHdl> hdl = std::make_unique<SwSdrHdl>( aPos, ( pAnch->IsVertical() && !pAnch->IsVertLR() ) ||
+ pAnch->IsRightToLeft() );
+ hdl->SetObjHdlNum(maHdlList.GetHdlCount());
+ maHdlList.AddHdl(std::move(hdl));
}
SdrObject* SwDrawView::GetMaxToTopObj( SdrObject* pObj ) const
diff --git a/sw/source/uibase/shells/drawsh.cxx b/sw/source/uibase/shells/drawsh.cxx
index a37d57f84e28..ef91d2efb9c3 100644
--- a/sw/source/uibase/shells/drawsh.cxx
+++ b/sw/source/uibase/shells/drawsh.cxx
@@ -231,7 +231,17 @@ void SwDrawShell::Execute(SfxRequest &rReq)
const sal_uLong handleNum = handleNumItem->GetValue();
const sal_uLong newPosX = newPosXTwips->GetValue();
const sal_uLong newPosY = newPosYTwips->GetValue();
- pSdrView->MoveShapeHandle(handleNum, Point(newPosX, newPosY), OrdNum ? OrdNum->GetValue() : -1);
+ const Point mPoint(newPosX, newPosY);
+ const SdrHdl* handle = pSdrView->GetHdlList().GetHdl(handleNum);
+ if (handle->GetKind() == SdrHdlKind::Anchor || handle->GetKind() == SdrHdlKind::Anchor_TR)
+ {
+ rSh.FindAnchorPos(mPoint, /*bMoveIt=*/true);
+ SdrDragView* pDragView = dynamic_cast<SdrDragView*>(pSdrView);
+ if (pDragView != nullptr)
+ pDragView->ModelHasChanged();
+ }
+ else
+ pSdrView->MoveShapeHandle(handleNum, mPoint, OrdNum ? OrdNum->GetValue() : -1);
}
}
break;
diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx
index 1224842d09fe..1e2356884137 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -1307,7 +1307,12 @@ void SwView::Execute(SfxRequest &rReq)
const sal_uLong handleNum = handleNumItem->GetValue();
const sal_uLong newPosX = newPosXTwips->GetValue();
const sal_uLong newPosY = newPosYTwips->GetValue();
- pSdrView->MoveShapeHandle(handleNum, Point(newPosX, newPosY), OrdNum ? OrdNum->GetValue() : -1);
+ const Point mPoint(newPosX, newPosY);
+ const SdrHdl* handle = pSdrView->GetHdlList().GetHdl(handleNum);
+ if (handle->GetKind() == SdrHdlKind::Anchor || handle->GetKind() == SdrHdlKind::Anchor_TR)
+ m_pWrtShell->FindAnchorPos(mPoint, /*bMoveIt=*/true);
+ else
+ pSdrView->MoveShapeHandle(handleNum, mPoint, OrdNum ? OrdNum->GetValue() : -1);
}
break;
}
More information about the Libreoffice-commits
mailing list