sw/qa/extras/uiwriter/data/tdf106736-grid.odt |binary sw/qa/extras/uiwriter/uiwriter.cxx | 12 ++++++++++++ sw/source/core/text/itrform2.cxx | 9 ++++++--- 3 files changed, 18 insertions(+), 3 deletions(-)
New commits: commit 94b1cc2b68a7ac784c041405063b3861bbdf2bb1 Author: Mark Hung <mark...@gmail.com> Date: Tue Apr 4 13:19:27 2017 +0800 tdf#106736 do not insert kern portion before tab portion. Postion of SwTabPortion is set in constructor and is not expected to change later. If it is changed later, overflow will make the line full and push the content to the next line. Change-Id: I75fa9842c2c5bc0c2c16f9c5c17c43cdf88ea6ff Reviewed-on: https://gerrit.libreoffice.org/36061 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/sw/qa/extras/uiwriter/data/tdf106736-grid.odt b/sw/qa/extras/uiwriter/data/tdf106736-grid.odt new file mode 100644 index 000000000000..45d5f40dadb9 Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf106736-grid.odt differ diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index a0c814be86d4..802fc179822f 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -231,6 +231,7 @@ public: void testTdf104492(); void testTdf105417(); void testTdf105625(); + void testTdf106736(); void testMsWordCompTrailingBlanks(); CPPUNIT_TEST_SUITE(SwUiWriterTest); @@ -354,6 +355,7 @@ public: CPPUNIT_TEST(testTdf104492); CPPUNIT_TEST(testTdf105417); CPPUNIT_TEST(testTdf105625); + CPPUNIT_TEST(testTdf106736); CPPUNIT_TEST(testMsWordCompTrailingBlanks); CPPUNIT_TEST_SUITE_END(); @@ -4487,6 +4489,16 @@ void SwUiWriterTest::testTdf105625() CPPUNIT_ASSERT_EQUAL(nMarksBefore, nMarksAfter + 1); } +void SwUiWriterTest::testTdf106736() +{ + createDoc("tdf106736-grid.odt"); + xmlDocPtr pXmlDoc = parseLayoutDump(); + sal_Int32 nWidth = getXPath(pXmlDoc, "(//Text[@nType='POR_TABLEFT'])[1]", "nWidth").toInt32(); + // In tdf106736, width of tab overflow so that it got + // width value around 9200, expected value is around 103 + CPPUNIT_ASSERT_MESSAGE("Left Tab width is ~103", nWidth < 150); +} + void SwUiWriterTest::testMsWordCompTrailingBlanks() { // The option is true in settings.xml diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index 1e4f6929b7c7..0823187a85b1 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -377,6 +377,8 @@ void SwTextFormatter::BuildPortions( SwTextFormatInfo &rInf ) // used for grid mode only: // the pointer is stored, because after formatting of non-asian text, // the width of the kerning portion has to be adjusted + // Inserting a SwKernPortion before a SwTabPortion isn't necessary + // and will break the SwTabPortion. SwKernPortion* pGridKernPortion = nullptr; bool bFull = false; @@ -458,7 +460,8 @@ void SwTextFormatter::BuildPortions( SwTextFormatInfo &rInf ) nLstHeight /= 5; // does the kerning portion still fit into the line? if( bAllowBefore && ( nLstActual != nNxtActual ) && - nLstHeight && rInf.X() + nLstHeight <= rInf.Width() ) + nLstHeight && rInf.X() + nLstHeight <= rInf.Width() && + ! pPor->InTabGrp() ) { SwKernPortion* pKrn = new SwKernPortion( *rInf.GetLast(), nLstHeight, @@ -469,7 +472,7 @@ void SwTextFormatter::BuildPortions( SwTextFormatInfo &rInf ) } } } - else if ( bHasGrid && ! pGridKernPortion && ! pMulti ) + else if ( bHasGrid && ! pGridKernPortion && ! pMulti && ! pPor->InTabGrp() ) { // insert a grid kerning portion if ( ! pGridKernPortion ) @@ -615,7 +618,7 @@ void SwTextFormatter::BuildPortions( SwTextFormatInfo &rInf ) } } - if ( bHasGrid && pPor != pGridKernPortion && ! pMulti ) + if ( bHasGrid && pPor != pGridKernPortion && ! pMulti && ! pPor->InTabGrp() ) { sal_Int32 nTmp = rInf.GetIdx() + pPor->GetLen(); const SwTwips nRestWidth = rInf.Width() - rInf.X() - pPor->Width(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits