sw/CppunitTest_sw_ww8import.mk | 1 + sw/qa/extras/ww8import/data/tdf112535.doc |binary sw/qa/extras/ww8import/ww8import.cxx | 20 ++++++++++++++++++++ sw/source/filter/ww8/ww8graf.cxx | 8 ++++++++ 4 files changed, 29 insertions(+)
New commits: commit 4927f0c98c4231cb126e6d2e958971dcf5aa5268 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Mon Jul 29 20:49:21 2019 +0200 Commit: Xisco FaulĂ <xiscofa...@libreoffice.org> CommitDate: Fri Aug 2 16:41:41 2019 +0200 tdf#112535 DOC import: fix handling the have contour but no polygon case In case a graphic has contour enabled, but there is no wrap polygon, that means auto-contour in Writer, and no contour in Word, so handle this difference during DOC import. Regarding the DOCX import -> DOC export -> DOC import scenario, this fixes a regression from commit 628a0f313ed05db0149db680837c99267a77ea3c (DOCX drawingML import: handle SurroundContour shape property, 2014-08-11), though the DOC import part was always broken, I think. (cherry picked from commit 90928f23994d8fc1d9cc7edf95880782c8ca712a) Change-Id: I6049fcf5df20736b702de901aef7068826d43f18 Reviewed-on: https://gerrit.libreoffice.org/76579 Tested-by: Jenkins Reviewed-by: Xisco FaulĂ <xiscofa...@libreoffice.org> diff --git a/sw/CppunitTest_sw_ww8import.mk b/sw/CppunitTest_sw_ww8import.mk index 31a7dcbe80ba..01e0d6b95164 100644 --- a/sw/CppunitTest_sw_ww8import.mk +++ b/sw/CppunitTest_sw_ww8import.mk @@ -25,6 +25,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_ww8import, \ unotest \ vcl \ sfx \ + svl \ sw \ utl \ )) diff --git a/sw/qa/extras/ww8import/data/tdf112535.doc b/sw/qa/extras/ww8import/data/tdf112535.doc new file mode 100644 index 000000000000..4eea19ecd54c Binary files /dev/null and b/sw/qa/extras/ww8import/data/tdf112535.doc differ diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx index 73495cea2754..bd29b496fea4 100644 --- a/sw/qa/extras/ww8import/ww8import.cxx +++ b/sw/qa/extras/ww8import/ww8import.cxx @@ -15,6 +15,7 @@ #include <viscrs.hxx> #include <wrtsh.hxx> #include <ndgrf.hxx> +#include <fmtsrnd.hxx> #include <editeng/boxitem.hxx> #include <editeng/lrspitem.hxx> #include <editeng/ulspitem.hxx> @@ -85,6 +86,25 @@ DECLARE_WW8IMPORT_TEST(testTdf107773, "tdf107773.doc") CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), xDrawPage->getCount()); } +DECLARE_WW8IMPORT_TEST(testTdf112535, "tdf112535.doc") +{ + SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + + SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + CPPUNIT_ASSERT(pDoc->GetSpzFrameFormats()); + + SwFrameFormats& rFormats = *pDoc->GetSpzFrameFormats(); + CPPUNIT_ASSERT(!rFormats.empty()); + + const SwFrameFormat* pFormat = rFormats[0]; + CPPUNIT_ASSERT(pFormat); + + // Without the accompanying fix in place, this test would have failed: auto-contour was enabled + // in Writer, but not in Word. + CPPUNIT_ASSERT(!pFormat->GetSurround().IsContour()); +} + DECLARE_WW8IMPORT_TEST(testTdf106291, "tdf106291.doc") { // Table cell was merged vertically instead of horizontally -> had incorrect dimensions diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index 3beb1e2f6181..58f72514f147 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -2087,6 +2087,14 @@ void SwWW8ImplReader::MapWrapIntoFlyFormat(SvxMSDffImportRec const * pRecord, pNd->SetContour(&aPoly); } } + else if (pFlyFormat->GetSurround().IsContour()) + { + // Contour is enabled, but no polygon is set: disable contour, because Word does not + // Writer-style auto-contour in that case. + SwFormatSurround aSurround(pFlyFormat->GetSurround()); + aSurround.SetContour(false); + pFlyFormat->SetFormatAttr(aSurround); + } } static sal_Int32 lcl_ConvertCrop(sal_uInt32 const nCrop, sal_Int32 const nSize) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits