diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2020-05-14 18:02:23 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2020-05-19 09:12:46 +0200 |
commit | a872552854cc632f6c968bad9f858500e16c2d41 (patch) | |
tree | d6c5ccc3839680c22f262f97daaf41a09fa31b33 /writerfilter | |
parent | eb084aea05326b29ed51e4ebae6c66bc5bffa84c (diff) |
DOCX export: fix interaction between the crop and the wrap polygon of image
If the wrap polygon is influenced by crop at import time, we need to do
the opposite at export time.
Do this for RTF and DOCX, where there is matching import code in
writerfilter/, leave DOC alone for now.
Test this by changing testFdo76803 into an export test, then seeing how
the first point's Y position fails and fixing up the exporter, so we
get back the old good value.
Conflicts:
sw/source/filter/ww8/docxsdrexport.cxx
(cherry picked from commit c68b458514b35cae70c9a6630e06f46a867aa3b9)
Change-Id: Ieef18aad3c76f7945c7348201b07bcb27a4cd48d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94319
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx | 5 | ||||
-rw-r--r-- | writerfilter/source/dmapper/WrapPolygonHandler.cxx | 3 |
2 files changed, 5 insertions, 3 deletions
diff --git a/writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx b/writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx index 0214f639bf53..7f6383ae0e5c 100644 --- a/writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx +++ b/writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx @@ -125,13 +125,14 @@ CPPUNIT_TEST_FIXTURE(Test, testWrapPolyCrop) // 10582, the lower 33% of the graphic is cropped, and the wrap polygon covers the middle third // of the area vertically. Which means 10582*2/3 = 7054.67 is the cropped height, and the top of // the middle third is 2351.55. + // Then there is a 15 twips shift from the origo, so it's 2351.55 + 26.46 = 2378.01 in mm100. // // Without the accompanying fix in place, this test would have failed with: - // - Expected: 2361 + // - Expected: 2368 // - Actual : 3542 // i.e. the wrap polygon covered a larger-than-correct area, which end the end means 3 lines // were wrapping around the image, not only 2 as Word does it. - CPPUNIT_ASSERT_EQUAL(2361., aPolygon.getB2DPoint(0).getY()); + CPPUNIT_ASSERT_EQUAL(2368., aPolygon.getB2DPoint(0).getY()); } } diff --git a/writerfilter/source/dmapper/WrapPolygonHandler.cxx b/writerfilter/source/dmapper/WrapPolygonHandler.cxx index 14c1d6a0c5bf..aa23342443a4 100644 --- a/writerfilter/source/dmapper/WrapPolygonHandler.cxx +++ b/writerfilter/source/dmapper/WrapPolygonHandler.cxx @@ -20,6 +20,7 @@ #include <com/sun/star/drawing/PointSequence.hpp> #include <com/sun/star/text/GraphicCrop.hpp> #include <comphelper/sequence.hxx> +#include <tools/mapunit.hxx> #include <ooxml/resourceids.hxx> @@ -99,7 +100,7 @@ WrapPolygon::Pointer_t WrapPolygon::correctWordWrapPolygon(const awt::Size & rSr const long nWrap100Percent = 21600; Fraction aMove(nWrap100Percent, rSrcSize.Width); - aMove = aMove * Fraction(15, 1); + aMove = aMove * Fraction(convertTwipToMm100(15), 1); awt::Point aMovePoint(aMove.operator long(), 0); pResult = move(aMovePoint); |