[Libreoffice-commits] core.git: svx/source

mert (via logerrit) logerrit at kemper.freedesktop.org
Tue Mar 2 07:28:42 UTC 2021


 svx/source/svdraw/svdmrkv.cxx  |    9 ++++++---
 svx/source/svdraw/svdoedge.cxx |    2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)

New commits:
commit 275377505f474ef54c50ec86b06c9b9435756913
Author:     mert <mert.tumer at collabora.com>
AuthorDate: Fri Feb 19 09:55:12 2021 +0300
Commit:     Mert Tumer <mert.tumer at collabora.com>
CommitDate: Tue Mar 2 08:27:48 2021 +0100

    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 at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111193
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111513
    Tested-by: Jenkins

diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index fbeeb8fda859..8c1ec40dce92 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -892,6 +892,7 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S
                 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);
@@ -901,8 +902,11 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S
                     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;
@@ -932,7 +936,6 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S
                     }
                     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 de697372d120..2eafff7605fc 100644
--- a/svx/source/svdraw/svdoedge.cxx
+++ b/svx/source/svdraw/svdoedge.cxx
@@ -2141,7 +2141,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);


More information about the Libreoffice-commits mailing list