summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/qa/extras/uiwriter/data/tdf106736-grid.odtbin0 -> 11498 bytes
-rw-r--r--sw/qa/extras/uiwriter/uiwriter.cxx12
-rw-r--r--sw/source/core/text/itrform2.cxx9
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
new file mode 100644
index 000000000000..45d5f40dadb9
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/tdf106736-grid.odt
Binary files 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();