diff --git a/0001-Resolves-tdf-99498-don-t-overwrite-trwWidth-value-if.patch b/0001-Resolves-tdf-99498-don-t-overwrite-trwWidth-value-if.patch index 0b524b8..eb0877a 100644 --- a/0001-Resolves-tdf-99498-don-t-overwrite-trwWidth-value-if.patch +++ b/0001-Resolves-tdf-99498-don-t-overwrite-trwWidth-value-if.patch @@ -1,15 +1,26 @@ -From edd0439c353ba64d04a689a5daa82ecf622e5c5c Mon Sep 17 00:00:00 2001 +From b9dbeb401b1f8f9b89a1ab477a566cbf42967c8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Wed, 27 Apr 2016 14:50:05 +0100 Subject: [PATCH] Resolves: tdf#99498 don't overwrite trwWidth value if set on a table +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Reviewed-on: https://gerrit.libreoffice.org/24430 +Reviewed-by: Caolán McNamara +Tested-by: Caolán McNamara +(cherry picked from commit b71f470e370c1819cba99abe5ef654d28bbf8749) Change-Id: Ia39da999a2de1ca2b8bec5fc7f35d2f9ffe2dd19 +Reviewed-on: https://gerrit.libreoffice.org/24434 +Tested-by: Jenkins +Reviewed-by: Miklos Vajna --- sw/qa/extras/rtfimport/data/tdf99498.rtf | 3 +++ - sw/qa/extras/rtfimport/rtfimport.cxx | 10 ++++++++++ + sw/qa/extras/rtfimport/rtfimport.cxx | 11 +++++++++++ writerfilter/source/rtftok/rtfdocumentimpl.cxx | 18 ++++++++++++++---- - 3 files changed, 27 insertions(+), 4 deletions(-) + 3 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 sw/qa/extras/rtfimport/data/tdf99498.rtf diff --git a/sw/qa/extras/rtfimport/data/tdf99498.rtf b/sw/qa/extras/rtfimport/data/tdf99498.rtf @@ -22,11 +33,11 @@ index 0000000..61a3066 +{\*\generator iText 2.1.7 by 1T3XT} +\par\par\trowd\trftsWidth3\trwWidth4000\trhdr\trqc\trgaph10\trpaddl0\trpaddr0\trpaddfl3\trpaddfr3\clvertalt\clcbpat1\clftsWidth3\clwWidth0\cellx0\clvertalt\clcbpat1\clftsWidth3\clwWidth0\cellx0\pard\plain\intbl\s0\fi0\li0\ri0\sl280\plain\f1\fs22\cf0 CELLCONTENTS \cell\pard\plain\intbl\s0\fi0\li0\ri0\sl280\plain\cell \row\pard} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx -index 3cc668f..be2b637 100644 +index 20f8755..5dfc751 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx -@@ -2518,6 +2518,16 @@ DECLARE_RTFIMPORT_TEST(testTdf97035, "tdf97035.rtf") - CPPUNIT_ASSERT_EQUAL(sal_Int16(2299), getProperty< uno::Sequence >(xTableRows->getByIndex(1), "TableColumnSeparators")[0].Position); +@@ -2497,6 +2497,17 @@ DECLARE_RTFIMPORT_TEST(testTdf96308Tabpos, "tdf96308-tabpos.rtf") + CPPUNIT_ASSERT(!aTabStops.hasElements()); } +DECLARE_RTFIMPORT_TEST(testTdf99498, "tdf99498.rtf") @@ -34,7 +45,8 @@ index 3cc668f..be2b637 100644 + uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + -+ // Table width should be 7056 ++ // Table width was a tiny sub one char wide 145twips, it should now be a table wide ++ // enough to see all the text in the first column without breaking into multiple lines + CPPUNIT_ASSERT_EQUAL(sal_Int32(7056), getProperty(xTables->getByIndex(0), "Width")); +} + @@ -43,10 +55,10 @@ index 3cc668f..be2b637 100644 { // This was A1BC34D, i.e. the first "super" text portion was mis-imported, diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx -index 0d726f4..459f0a1 100644 +index bb1991d..26e70ae 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx -@@ -1382,10 +1382,14 @@ void RTFDocumentImpl::prepareProperties( +@@ -1374,10 +1374,14 @@ void RTFDocumentImpl::prepareProperties( } // Table width. @@ -65,7 +77,7 @@ index 0d726f4..459f0a1 100644 auto pRowValue = std::make_shared(1); if (nCells > 0) -@@ -4846,6 +4850,12 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) +@@ -4810,6 +4814,12 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) lcl_putNestedSprm(m_aStates.top().aTableRowSprms, NS_ooxml::LN_CT_TblPrBase_tblCellMar, NS_ooxml::LN_CT_TblCellMar_right, std::make_shared(aAttributes)); } break; @@ -75,9 +87,9 @@ index 0d726f4..459f0a1 100644 + case RTF_TRWWIDTH: + lcl_putNestedAttribute(m_aStates.top().aTableRowSprms, NS_ooxml::LN_CT_TblPrBase_tblW, NS_ooxml::LN_CT_TblWidth_w, pIntValue); + break; - case RTF_PROPTYPE: + default: { - switch (nParam) + SAL_INFO("writerfilter", "TODO handle value '" << lcl_RtfToString(nKeyword) << "'"); -- -2.7.3 +2.7.4