sw/qa/extras/ooxmlexport/data/tdf142693_hugePaperSizeImport.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport13.cxx | 7 +++++++ writerfilter/source/dmapper/ConversionHelper.cxx | 5 +++++ writerfilter/source/dmapper/ConversionHelper.hxx | 1 + writerfilter/source/dmapper/DomainMapper.cxx | 4 ++-- 5 files changed, 15 insertions(+), 2 deletions(-)
New commits: commit 446771fe3e91eb7d154e86b9c6a614374110e9ca Author: Attila Szűcs <szucs.atti...@nisz.hu> AuthorDate: Wed Jul 14 16:24:01 2021 +0200 Commit: László Németh <nem...@numbertext.org> CommitDate: Tue Jul 27 10:32:10 2021 +0200 tdf#142693 DOCX import: fix zeroing huge page sizes which bigger than 2^15 twips (> ~57.8 cm). Regression from commit 4d1621136c464b462a598571ecdcfe2ae119d8c7 "Fix ignoring large twips values like MSO does (cp#1000087)". Note: Writer could export page size up to 600 cm × 600 cm, and now it can import it back as well. It can even import page sizes in kilometers, and display that, but there will be other issues about its display. MS Word couldn't save page size over 2^15, but can import, and display them till up to 2^16 (that is about 116 cm). Co-authored-by: Tibor Nagy (NISZ) Change-Id: Icc1bd708d53036768a7be94cb1ebe18c1c4c8487 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118940 Tested-by: László Németh <nem...@numbertext.org> Reviewed-by: László Németh <nem...@numbertext.org> (cherry picked from commit d5d9795968771651c57c661d95b6992c3c778eca) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119441 Tested-by: Jenkins diff --git a/sw/qa/extras/ooxmlexport/data/tdf142693_hugePaperSizeImport.docx b/sw/qa/extras/ooxmlexport/data/tdf142693_hugePaperSizeImport.docx new file mode 100644 index 000000000000..6ec35a7684d7 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf142693_hugePaperSizeImport.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx index 0c7c1984f421..3e7b38f8df75 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx @@ -1226,6 +1226,13 @@ DECLARE_OOXMLEXPORT_TEST(testTdf127741, "tdf127741.docx") CPPUNIT_ASSERT(visitedStyleName.equalsIgnoreAsciiCase("Visited Internet Link")); } +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf142693_hugePaperSizeImport, "tdf142693_hugePaperSizeImport.docx") +{ + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); + assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:pgSz", "w", "90369"); + assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:pgSz", "h", "104372"); +} + DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf127925, "tdf127925.odt") { CPPUNIT_ASSERT_EQUAL(1, getPages()); diff --git a/writerfilter/source/dmapper/ConversionHelper.cxx b/writerfilter/source/dmapper/ConversionHelper.cxx index 12cac7c8f1b3..cf41150ea548 100644 --- a/writerfilter/source/dmapper/ConversionHelper.cxx +++ b/writerfilter/source/dmapper/ConversionHelper.cxx @@ -423,6 +423,11 @@ sal_Int32 convertTwipToMM100(sal_Int32 _t) return ::convertTwipToMm100( _t ); } +sal_Int32 convertTwipToMM100WithoutLimit(sal_Int32 _t) +{ + return ::convertTwipToMm100(_t); +} + double convertTwipToMM100Double(sal_Int32 _t) { // It appears that MSO handles large twip values specially, probably legacy 16bit handling, diff --git a/writerfilter/source/dmapper/ConversionHelper.hxx b/writerfilter/source/dmapper/ConversionHelper.hxx index 72c0efe0d540..619c93c9b8af 100644 --- a/writerfilter/source/dmapper/ConversionHelper.hxx +++ b/writerfilter/source/dmapper/ConversionHelper.hxx @@ -46,6 +46,7 @@ namespace writerfilter::dmapper::ConversionHelper{ OUString ConvertMSFormatStringToSO(const OUString& rFormat, css::lang::Locale& rLocale, bool bHijri); // export just for test SAL_DLLPUBLIC_EXPORT sal_Int32 convertTwipToMM100(sal_Int32 _t); + SAL_DLLPUBLIC_EXPORT sal_Int32 convertTwipToMM100WithoutLimit(sal_Int32 _t); SAL_DLLPUBLIC_EXPORT double convertTwipToMM100Double(sal_Int32 _t); SAL_DLLPUBLIC_EXPORT sal_uInt32 convertTwipToMM100Unsigned(sal_Int32 _t); sal_Int16 convertTableJustification( sal_Int32 nIntValue ); diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 232650c7f8ea..3a78e3db5a66 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -625,7 +625,7 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) break; case NS_ooxml::LN_CT_PageSz_h: { - sal_Int32 nHeight = ConversionHelper::convertTwipToMM100(nIntValue); + sal_Int32 nHeight = ConversionHelper::convertTwipToMM100WithoutLimit(nIntValue); CT_PageSz.h = PaperInfo::sloppyFitPageDimension(nHeight); } break; @@ -634,7 +634,7 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) break; case NS_ooxml::LN_CT_PageSz_w: { - sal_Int32 nWidth = ConversionHelper::convertTwipToMM100(nIntValue); + sal_Int32 nWidth = ConversionHelper::convertTwipToMM100WithoutLimit(nIntValue); CT_PageSz.w = PaperInfo::sloppyFitPageDimension(nWidth); } break; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits