diff options
author | mert <mert.tumer@collabora.com> | 2021-02-19 09:55:12 +0300 |
---|---|---|
committer | Mert Tumer <mert.tumer@collabora.com> | 2021-02-24 08:37:57 +0100 |
commit | 82e6ded597e5f448cac213b1c8b72a5ff2660392 (patch) | |
tree | abe2830b2b511583853eecf27deeaf6738523f7c | |
parent | e9908474d66d71d8186dd0c21c5bb756ab4b72d2 (diff) |
Convert MapModeUnits If necessary.
Connecting to a glue point or handle callback messages
contain points which may need a unit conversion depending
on the module
Change-Id: Icc0b2bc5981bb7d135efd38e60ac06fe12a70480
Signed-off-by: mert <mert.tumer@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111193
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
-rw-r--r-- | svx/source/svdraw/svdmrkv.cxx | 9 | ||||
-rw-r--r-- | svx/source/svdraw/svdoedge.cxx | 2 |
2 files changed, 7 insertions, 4 deletions
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index e3b122d11938..beda9a2c3621 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -917,6 +917,7 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, SfxView boost::property_tree::ptree poly; boost::property_tree::ptree custom; boost::property_tree::ptree nodes; + const bool convertMapMode = mpMarkedPV->GetView().GetFirstOutputDevice()->GetMapMode().GetMapUnit() == MapUnit::Map100thMM; for (size_t i = 0; i < maHdlList.GetHdlCount(); i++) { SdrHdl *pHdl = maHdlList.GetHdl(i); @@ -926,8 +927,11 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, SfxView child.put("id", pHdl->GetObjHdlNum()); child.put("kind", kind); child.put("pointer", static_cast<sal_Int32>(pHdl->GetPointer())); - point.put("x", convertMm100ToTwip(pHdl->GetPos().getX())); - point.put("y", convertMm100ToTwip(pHdl->GetPos().getY())); + Point pHdlPos = pHdl->GetPos(); + if (convertMapMode) + pHdlPos = OutputDevice::LogicToLogic(pHdlPos, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip)); + point.put("x", pHdlPos.getX()); + point.put("y", pHdlPos.getY()); child.add_child("point", point); const auto node = std::make_pair("", child); boost::property_tree::ptree* selectedNode = nullptr; @@ -957,7 +961,6 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, SfxView } else kindNode.get().push_back(node); - } nodes.add_child("rectangle", rectangle); nodes.add_child("poly", poly); diff --git a/svx/source/svdraw/svdoedge.cxx b/svx/source/svdraw/svdoedge.cxx index 5946ecadc4c4..99dee49aa2d2 100644 --- a/svx/source/svdraw/svdoedge.cxx +++ b/svx/source/svdraw/svdoedge.cxx @@ -2140,7 +2140,7 @@ bool SdrEdgeObj::ImpFindConnector(const Point& rPt, const SdrPageView& rPV, SdrO // sensitive area of connectors is twice as large as the one of the handles sal_uInt16 nMarkHdSiz=rPV.GetView().GetMarkHdlSizePixel(); Size aHalfConSiz(nMarkHdSiz,nMarkHdSiz); - if (comphelper::LibreOfficeKit::isActive()) + if (comphelper::LibreOfficeKit::isActive() && pOut->GetMapMode().GetMapUnit() == MapUnit::Map100thMM) aHalfConSiz=pOut->PixelToLogic(aHalfConSiz, MapMode(MapUnit::Map100thMM)); else aHalfConSiz=pOut->PixelToLogic(aHalfConSiz); |