summaryrefslogtreecommitdiff
path: root/svx/source
diff options
context:
space:
mode:
authorDennis Francis <dennis.francis@collabora.com>2021-12-13 11:36:53 +0530
committerDennis Francis <dennis.francis@collabora.com>2022-02-02 10:12:17 +0100
commita1e4dad6b98a2a5d4b4ef5db479d6f520331f1d1 (patch)
treea8d3746f8b93004591c4480cf7afe17c8613d1ce /svx/source
parent2c250e8f5007e756afb794944f0be791e2d535f4 (diff)
lokCalcRTL: ensure +ve X coords in shape handles/selections msgs
LOK client expects all coordinates to be in +ve document coordinates, so negate the negative X coordinates of LOK RTL shapes before sending the selection/handles messages. Conflicts: svx/source/svdraw/svdmrkv.cxx Change-Id: I683581370c5b115efbe315224d6218ec2e74c7f1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129190 Tested-by: Jenkins Reviewed-by: Dennis Francis <dennis.francis@collabora.com>
Diffstat (limited to 'svx/source')
-rw-r--r--svx/source/svdraw/svdmrkv.cxx27
1 files changed, 22 insertions, 5 deletions
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index 4406b5f535ff..73e530b2cd5e 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -703,6 +703,7 @@ OUString lcl_getDragParameterString( const OUString& rCID )
bool SdrMarkView::dumpGluePointsToJSON(boost::property_tree::ptree& rTree)
{
bool result = false;
+ tools::Long nSignX = mbNegativeX ? -1 : 1;
if (OutputDevice* pOutDev = mpMarkedPV ? mpMarkedPV->GetView().GetFirstOutputDevice() : nullptr)
{
bool bConvertUnit = false;
@@ -735,7 +736,7 @@ bool SdrMarkView::dumpGluePointsToJSON(boost::property_tree::ptree& rTree)
{
rPoint = o3tl::convert(rPoint, o3tl::Length::mm100, o3tl::Length::twip);
}
- point.put("x", rPoint.getX());
+ point.put("x", nSignX * rPoint.getX());
point.put("y", rPoint.getY());
node.add_child("point", point);
points.push_back(std::make_pair("", node));
@@ -750,7 +751,7 @@ bool SdrMarkView::dumpGluePointsToJSON(boost::property_tree::ptree& rTree)
p = o3tl::convert(p, o3tl::Length::mm100, o3tl::Length::twip);
}
boost::property_tree::ptree gridOffset;
- gridOffset.put("x", p.getX());
+ gridOffset.put("x", nSignX * p.getX());
gridOffset.put("y", p.getY());
object.add_child("gridoffset", gridOffset);
}
@@ -769,6 +770,7 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S
SfxViewShell* pViewShell = GetSfxViewShell();
tools::Rectangle aSelection(rRect);
+ tools::Long nSignX = mbNegativeX ? -1 : 1;
bool bIsChart = false;
Point addLogicOffset(0, 0);
bool convertMapMode = false;
@@ -862,7 +864,7 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S
if (convertMapMode)
p = o3tl::convert(p, o3tl::Length::mm100, o3tl::Length::twip);
aExtraInfo.append(",\"gridOffsetX\":");
- aExtraInfo.append(p.getX());
+ aExtraInfo.append(nSignX * p.getX());
aExtraInfo.append(",\"gridOffsetY\":");
aExtraInfo.append(p.getY());
}
@@ -966,6 +968,8 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S
const basegfx::B2DPoint aB2Point = aPolygon.getB2DPoint(nIndex);
Point aPoint(aB2Point.getX(), aB2Point.getY());
aPoint.Move(aLogicOffset.getX(), aLogicOffset.getY());
+ if (mbNegativeX)
+ aPoint.setX(-aPoint.X());
if (nIndex > 0)
sPolygonElem += " ";
sPolygonElem += aPoint.toString();
@@ -1078,8 +1082,21 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S
handleArrayStr = handleArrayStr + aStream.str().c_str();
}
}
- sSelectionText = aSelection.toString() +
- ", " + OString::number(nRotAngle.get());
+
+ if (mbNegativeX)
+ {
+ tools::Rectangle aNegatedRect(aSelection);
+ aNegatedRect.SetLeft(-aNegatedRect.Left());
+ aNegatedRect.SetRight(-aNegatedRect.Right());
+ aNegatedRect.Justify();
+ sSelectionText = aNegatedRect.toString() +
+ ", " + OString::number(nRotAngle.get());
+ }
+ else
+ {
+ sSelectionText = aSelection.toString() +
+ ", " + OString::number(nRotAngle.get());
+ }
if (!aExtraInfo.isEmpty())
{
sSelectionTextView = sSelectionText + ", " + aExtraInfo.toString() + "}";