diff options
author | Mark Hung <marklh9@gmail.com> | 2017-04-04 13:19:27 +0800 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-04-14 11:09:51 +0200 |
commit | 94b1cc2b68a7ac784c041405063b3861bbdf2bb1 (patch) | |
tree | 5a5c772bb4dad32fc6f07c09d76b988b7558d281 /sw | |
parent | d490729a0fe23fd78bf84d51ea871644999f5871 (diff) |
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 <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/uiwriter/data/tdf106736-grid.odt | bin | 0 -> 11498 bytes | |||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter.cxx | 12 | ||||
-rw-r--r-- | sw/source/core/text/itrform2.cxx | 9 |
3 files changed, 18 insertions, 3 deletions
diff --git a/sw/qa/extras/uiwriter/data/tdf106736-grid.odt b/sw/qa/extras/uiwriter/data/tdf106736-grid.odt Binary files differnew file mode 100644 index 000000000000..45d5f40dadb9 --- /dev/null +++ b/sw/qa/extras/uiwriter/data/tdf106736-grid.odt 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(); |