summaryrefslogtreecommitdiff
path: root/svx/source/svdraw/svdmrkv.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'svx/source/svdraw/svdmrkv.cxx')
-rw-r--r--svx/source/svdraw/svdmrkv.cxx25
1 files changed, 24 insertions, 1 deletions
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index db05163b1ec4..a4af90341b25 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -710,6 +710,7 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, SfxView
tools::Rectangle aSelection(rRect);
bool bIsChart = false;
Point addLogicOffset = Point(0,0);
+ bool convertMapMode = false;
if (!rRect.IsEmpty())
{
sal_uInt32 nTotalPaintWindows = this->PaintWindowCount();
@@ -739,7 +740,10 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, SfxView
if (OutputDevice* pOutputDevice = mpMarkedPV->GetView().GetFirstOutputDevice())
{
if (pOutputDevice->GetMapMode().GetMapUnit() == MapUnit::Map100thMM)
+ {
aSelection = OutputDevice::LogicToLogic(aSelection, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
+ convertMapMode = true;
+ }
}
}
@@ -780,6 +784,26 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, SfxView
aExtraInfo.append("\",\"type\":");
aExtraInfo.append(OString::number(pO->GetObjIdentifier()));
+ // In core, the gridOffset is calculated based on the LogicRect's TopLeft coordinate
+ // In online, we have the SnapRect and we calculate it based on its TopLeft coordinate
+ // SnapRect's TopLeft and LogicRect's TopLeft match unless there is rotation
+ // but the rotation is not applied to the LogicRect. Therefore,
+ // what we calculate in online does not match with the core in case of the rotation.
+ // Here we can send the correct gridOffset in the selection callback, this way
+ // whether the shape is rotated or not, we will always have the correct gridOffset
+ // Note that the gridOffset is calculated from the first selected obj
+ basegfx::B2DVector aGridOffset(0.0, 0.0);
+ if(getPossibleGridOffsetForSdrObject(aGridOffset, GetMarkedObjectByIndex(0), GetSdrPageView()))
+ {
+ Point p(aGridOffset.getX(), aGridOffset.getY());
+ if (convertMapMode)
+ p = OutputDevice::LogicToLogic(p, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
+ aExtraInfo.append(",\"gridOffsetX\":");
+ aExtraInfo.append(OString::number(p.getX()));
+ aExtraInfo.append(",\"gridOffsetY\":");
+ aExtraInfo.append(OString::number(p.getY()));
+ }
+
if (bWriterGraphic)
{
aExtraInfo.append(", \"isWriterGraphic\": true");
@@ -916,7 +940,6 @@ 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);