[Libreoffice-commits] core.git: sw/qa sw/source
Justin Luth (via logerrit)
logerrit at kemper.freedesktop.org
Fri Sep 4 15:50:25 UTC 2020
sw/qa/extras/ww8export/data/tdf135672_tableGrows.doc |binary
sw/qa/extras/ww8export/ww8export3.cxx | 11 +++++++++
sw/source/filter/ww8/ww8par2.cxx | 21 -------------------
sw/source/filter/ww8/ww8par2.hxx | 3 --
4 files changed, 13 insertions(+), 22 deletions(-)
New commits:
commit 76ec8b52da8ffe8a21c223937c7dbe960f12ebda
Author: Justin Luth <justin.luth at collabora.com>
AuthorDate: Sat Aug 22 21:11:24 2020 +0300
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Sep 4 17:49:47 2020 +0200
tdf#135672 doc import: fix left table position
On round-tripping, the table was creeping left on each save.
A follow-up commit handles growth creep.
Why this specially added code is now wrong is unknown to me.
I'm guessing that for docx, Writer was changed and doc
format never picked up on that change. It looks like this
probably happened already in OOo based on bibisect seeing
this creep and table growth as far back as I can test.
I really don't like just ripping out code like this,
but the proof is in the pudding. Now several documents
round-trip at the same position and size. Who can complain?
See the bug report, which questions why this was added:
commit 53d67a4e9f26689dbcce07f045ef6222bfadc27e
Author: Caolán McNamara on Tue Oct 16 11:42:32 2001 +0000
#93253# Fix borders and positioning
Change-Id: I3914bc84143a62f518542c10d19461e1edfadd17
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101187
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth at sil.org>
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
diff --git a/sw/qa/extras/ww8export/data/tdf135672_tableGrows.doc b/sw/qa/extras/ww8export/data/tdf135672_tableGrows.doc
new file mode 100644
index 000000000000..a2ae57def0c1
Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf135672_tableGrows.doc differ
diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx
index 81dea2f98188..6f1731eddc71 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -225,6 +225,17 @@ DECLARE_WW8EXPORT_TEST(testTdf73056_cellMargins, "tdf73056_cellMargins.doc")
CPPUNIT_ASSERT_EQUAL_MESSAGE( "bottom cell spacing to contents",
sal_Int32(101), getProperty<sal_Int32>(xPropSet, "BottomBorderDistance" ) );
}
+
+DECLARE_WW8EXPORT_TEST(testTdf135672_tableGrows, "tdf135672_tableGrows.doc")
+{
+ auto const xTable(getParagraphOrTable(1));
+ // This would shift left every round-trip. First time was -259, next -418.
+ 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"));
+}
+
DECLARE_WW8EXPORT_TEST(testTdf79435_legacyInputFields, "tdf79435_legacyInputFields.docx")
{
//using .docx input file to verify cross-format compatibility.
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index d80ffa6f885d..74719297255b 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -1772,7 +1772,6 @@ WW8TabDesc::WW8TabDesc(SwWW8ImplReader* pIoClass, WW8_CP nStartCp) :
m_nDefaultSwCols(0),
m_nBands(0),
m_nMinLeft(0),
- m_nConvertedLeft(0),
m_nMaxRight(0),
m_nSwWidth(0),
m_nPreferredWidth(0),
@@ -2231,9 +2230,7 @@ void WW8TabDesc::CalcDefaults()
// Non existent cells can reduce the number of columns.
// 3. pass: Replace border with defaults if needed
- m_nConvertedLeft = m_nMinLeft;
-
- short nLeftMaxThickness = 0, nRightMaxThickness=0;
+ short nRightMaxThickness=0;
for( pR = m_pFirstBand ; pR; pR = pR->pNextBand )
{
if( !pR->pTCs )
@@ -2292,26 +2289,10 @@ void WW8TabDesc::CalcDefaults()
if (nThickness > nRightMaxThickness)
nRightMaxThickness = nThickness;
}
-
- /*
- The left space of the table is in nMinLeft, but again this
- does not consider the margin thickness to its left in the
- placement value, so get the thickness of the left border,
- half is placed to the left of the nominal left side, and
- half to the right.
- */
- if ( ! pR->pTCs[0].rgbrc[1].fShadow() )
- {
- short nThickness = pR->pTCs[0].rgbrc[1].
- DetermineBorderProperties();
- if (nThickness > nLeftMaxThickness)
- nLeftMaxThickness = nThickness;
- }
}
}
m_nSwWidth = m_nSwWidth + nRightMaxThickness;
m_nMaxRight = m_nMaxRight + nRightMaxThickness;
- m_nConvertedLeft = m_nMinLeft-(nLeftMaxThickness/2);
for( pR = m_pFirstBand; pR; pR = pR->pNextBand )
{
diff --git a/sw/source/filter/ww8/ww8par2.hxx b/sw/source/filter/ww8/ww8par2.hxx
index ba22f768232e..bd3de34179b4 100644
--- a/sw/source/filter/ww8/ww8par2.hxx
+++ b/sw/source/filter/ww8/ww8par2.hxx
@@ -220,7 +220,6 @@ class WW8TabDesc
short m_nDefaultSwCols;
short m_nBands;
short m_nMinLeft;
- short m_nConvertedLeft;
short m_nMaxRight;
short m_nSwWidth;
short m_nPreferredWidth;
@@ -278,7 +277,7 @@ public:
void ParkPaM();
void FinishSwTable();
void MergeCells();
- short GetMinLeft() const { return m_nConvertedLeft; }
+ short GetMinLeft() const { return m_nMinLeft; }
~WW8TabDesc();
const WW8_TCell* GetCurrentWWCell() const { return m_pCurrentWWCell; }
More information about the Libreoffice-commits
mailing list