sw/qa/extras/ww8export/ww8export3.cxx | 2 +- sw/qa/extras/ww8import/ww8import.cxx | 6 +++--- sw/source/filter/ww8/ww8par2.cxx | 25 +------------------------ 3 files changed, 5 insertions(+), 28 deletions(-)
New commits: commit 0b495a630b7c449b3e8911d3970449776e502ce9 Author: Justin Luth <justin.l...@collabora.com> AuthorDate: Sat Aug 22 21:24:58 2020 +0300 Commit: Justin Luth <justin_l...@sil.org> CommitDate: Sat Sep 5 11:09:54 2020 +0200 tdf#135672 doc import: fix table width On round-tripping, the table was growing on each save. A previous commit handled position creep. Change-Id: I0c8c3b644a5c005252afd761cc164dd001321d65 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101188 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_l...@sil.org> diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx index 6f1731eddc71..757e24b40555 100644 --- a/sw/qa/extras/ww8export/ww8export3.cxx +++ b/sw/qa/extras/ww8export/ww8export3.cxx @@ -233,7 +233,7 @@ DECLARE_WW8EXPORT_TEST(testTdf135672_tableGrows, "tdf135672_tableGrows.doc") CPPUNIT_ASSERT_EQUAL(sal_Int32(-101), getProperty<sal_Int32>(xTable, "LeftMargin")); // This would grow every round-trip. First time was 11118, next 11435 - //CPPUNIT_ASSERT_EQUAL(sal_Int32(10800), getProperty<sal_Int32>(xTable, "Width")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(10800), getProperty<sal_Int32>(xTable, "Width")); } DECLARE_WW8EXPORT_TEST(testTdf79435_legacyInputFields, "tdf79435_legacyInputFields.docx") diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx index 30c8210a3153..a703e08de6ae 100644 --- a/sw/qa/extras/ww8import/ww8import.cxx +++ b/sw/qa/extras/ww8import/ww8import.cxx @@ -123,12 +123,12 @@ DECLARE_WW8IMPORT_TEST(testTdf112535, "tdf112535.doc") CPPUNIT_ASSERT(!pFormat->GetSurround().IsContour()); } -DECLARE_WW8IMPORT_TEST(testTdf106291, "tdf106291.doc") +DECLARE_WW8EXPORT_TEST(testTdf106291, "tdf106291.doc") { // Table cell was merged vertically instead of horizontally -> had incorrect dimensions OUString cellWidth = parseDump("/root/page[1]/body/tab/row/cell[1]/infos/bounds", "width"); OUString cellHeight = parseDump("/root/page[1]/body/tab/row/cell[1]/infos/bounds", "height"); - CPPUNIT_ASSERT_EQUAL(sal_Int32(8660), cellWidth.toInt32()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(8650), cellWidth.toInt32()); CPPUNIT_ASSERT(cellHeight.toInt32() > 200); // height might depend on font size } @@ -218,7 +218,7 @@ DECLARE_WW8IMPORT_TEST(testTdf106799, "tdf106799.doc") CPPUNIT_ASSERT(pViewShell); pViewShell->Reformat(); - sal_Int32 const nCellWidths[3][4] = { { 9530, 0, 0, 0 },{ 2382, 2382, 2382, 2384 },{ 2382, 2382, 2382, 2384 } }; + sal_Int32 const nCellWidths[3][4] = { { 9528, 0, 0, 0 },{ 2382, 2382, 2382, 2382 },{ 2382, 2382, 2382, 2382 } }; sal_Int32 const nCellTxtLns[3][4] = { { 1, 0, 0, 0 },{ 1, 0, 0, 0},{ 1, 1, 1, 1 } }; // Table was distorted because of missing sprmPFInnerTableCell at paragraph marks (0x0D) with sprmPFInnerTtp for (sal_Int32 nRow : { 0, 1, 2 }) diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index 74719297255b..6f8f7a49fc8c 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -2230,7 +2230,6 @@ void WW8TabDesc::CalcDefaults() // Non existent cells can reduce the number of columns. // 3. pass: Replace border with defaults if needed - short nRightMaxThickness=0; for( pR = m_pFirstBand ; pR; pR = pR->pNextBand ) { if( !pR->pTCs ) @@ -2270,35 +2269,13 @@ void WW8TabDesc::CalcDefaults() } } } - if (pR->nWwCols) - { - /* - Similar to graphics and other elements word does not totally - factor the width of the border into its calculations of size, we - do so we must adjust out widths and other dimensions to fit. It - appears that what occurs is that the last cell's right margin if - the margin width that is not calculated into winwords table - dimensions, so in that case increase the table to include the - extra width of the right margin. - */ - if ( ! pR->pTCs[pR->nWwCols-1].rgbrc[3].fShadow() ) - { - short nThickness = pR->pTCs[pR->nWwCols-1].rgbrc[3]. - DetermineBorderProperties(); - pR->nCenter[pR->nWwCols] = pR->nCenter[pR->nWwCols] + nThickness; - if (nThickness > nRightMaxThickness) - nRightMaxThickness = nThickness; - } - } } - m_nSwWidth = m_nSwWidth + nRightMaxThickness; - m_nMaxRight = m_nMaxRight + nRightMaxThickness; for( pR = m_pFirstBand; pR; pR = pR->pNextBand ) { pR->nSwCols = pR->nWwCols; pR->bLEmptyCol = pR->nCenter[0] - m_nMinLeft >= MINLAY; - pR->bREmptyCol = (m_nMaxRight - pR->nCenter[pR->nWwCols] - nRightMaxThickness) >= MINLAY; + pR->bREmptyCol = (m_nMaxRight - pR->nCenter[pR->nWwCols]) >= MINLAY; short nAddCols = short(pR->bLEmptyCol) + short(pR->bREmptyCol); sal_uInt16 i; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits