[Libreoffice-commits] core.git: sw/qa sw/source
Regina Henschel (via logerrit)
logerrit at kemper.freedesktop.org
Fri Jul 2 08:17:33 UTC 2021
sw/qa/extras/ooxmlexport/data/tdf123569_rotWriterImage_46deg.odt |binary
sw/qa/extras/ooxmlexport/ooxmlexport16.cxx | 12 +++++
sw/source/filter/ww8/docxsdrexport.cxx | 23 +++++++++-
3 files changed, 34 insertions(+), 1 deletion(-)
New commits:
commit a020f2c3993fd8b625cee07ed73949982e719fca
Author: Regina Henschel <rb.henschel at t-online.de>
AuthorDate: Thu Jul 1 22:05:48 2021 +0200
Commit: Regina Henschel <rb.henschel at t-online.de>
CommitDate: Fri Jul 2 10:16:58 2021 +0200
tdf#123569 correct position of rotated Writer image
Error was, that the position pFrameFormat->GetHoriOrient().GetPos()
was treated as left/top of snap rectangle and the associated left/top
of a logic rectangle was calculated from it based on rotation angle.
But actually it is already left/top of logic rectangle.
Nevertheless effectExtent has to be calculated for the rotation.
The fix is based on commit 3262fc5ef3bde5b158909d11ccb008161ea95519.
A direct backport to LO7.2 is not possible.
Change-Id: I8761b673d1358bb476f1678fd2a104eaec6dcb2d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118243
Tested-by: Jenkins
Reviewed-by: Regina Henschel <rb.henschel at t-online.de>
diff --git a/sw/qa/extras/ooxmlexport/data/tdf123569_rotWriterImage_46deg.odt b/sw/qa/extras/ooxmlexport/data/tdf123569_rotWriterImage_46deg.odt
new file mode 100644
index 000000000000..b452852afee2
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf123569_rotWriterImage_46deg.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
index ecd0e4b62803..b670c72333ff 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
@@ -70,6 +70,18 @@ protected:
return OString(filename).endsWith(".docx");
}
};
+DECLARE_OOXMLEXPORT_TEST(testTdf123569_rotWriterImage, "tdf123569_rotWriterImage_46deg.odt")
+{
+ uno::Reference<beans::XPropertySet> xFrame(getShape(1), uno::UNO_QUERY);
+ // Error was, that position of logical rectangle was treated as position of snap rectangle.
+ // Thus a wrong position was calculated.
+ // Without fix this would have failed with expected 4798, actual 4860
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(4798),
+ getProperty<sal_Int32>(xFrame, "HoriOrientPosition"), 1);
+ // Without fix this would have failed with expected 1438, actual 4062
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(1438),
+ getProperty<sal_Int32>(xFrame, "VertOrientPosition"), 1);
+}
DECLARE_OOXMLEXPORT_TEST(testTdf142486_LeftMarginShadowLeft, "tdf142486_LeftMarginShadowLeft.docx")
{
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx
index c85e2581bd96..2b2fd89a635e 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -586,6 +586,26 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrameFormat* pFrameFormat, cons
// Adaption is missing here. Frames in LO have no stroke but border. The current conversion
// from border to line treats borders like table borders. That might give wrong values
// for drawing frames.
+
+ if (pObj && pObj->GetRotateAngle() != 0_deg100)
+ {
+ Degree100 nRotation = pObj->GetRotateAngle();
+ const SwRect aBoundRect(pFrameFormat->FindLayoutRect());
+ tools::Long nMSOWidth = rSize.Width();
+ tools::Long nMSOHeight = rSize.Height();
+ if ((nRotation > 4500_deg100 && nRotation <= 13500_deg100)
+ || (nRotation > 22500_deg100 && nRotation <= 31500_deg100))
+ std::swap(nMSOWidth, nMSOHeight);
+ nBottomExt += (aBoundRect.Height() - 1 - nMSOHeight) / 2;
+ nTopExt += (aBoundRect.Height() - 1 - nMSOHeight) / 2;
+ nLeftExt += (aBoundRect.Width() - nMSOWidth) / 2;
+ nRightExt += (aBoundRect.Width() - nMSOWidth) / 2;
+ }
+ lcl_makeDistAndExtentNonNegative(nDistT, nDistB, nDistL, nDistR, nLeftExt, nTopExt,
+ nRightExt, nBottomExt);
+
+ // ToDo: Inline rotated image fails because it would need wrapTight, what is not possible.
+ // ToDo: Image plus shadow fails because of wrong shadow direction.
}
else // other objects than frames. pObj exists.
{
@@ -684,7 +704,8 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrameFormat* pFrameFormat, cons
aPos.X += nPosXDiff; // Make the postponed position move of frames.
aPos.Y += nPosYDiff;
- if (pObj && lcl_IsRotateAngleValid(*pObj))
+ if (pObj && lcl_IsRotateAngleValid(*pObj)
+ && pObj->GetObjIdentifier() != SwFlyDrawObjIdentifier)
lclMovePositionWithRotation(aPos, rSize, pObj->GetRotateAngle());
const char* relativeFromH;
More information about the Libreoffice-commits
mailing list