diff options
-rw-r--r-- | sw/qa/extras/layout/data/tdf124600.docx | bin | 0 -> 16899 bytes | |||
-rw-r--r-- | sw/qa/extras/layout/layout.cxx | 13 | ||||
-rw-r--r-- | sw/source/core/text/itrform2.cxx | 8 |
3 files changed, 21 insertions, 0 deletions
diff --git a/sw/qa/extras/layout/data/tdf124600.docx b/sw/qa/extras/layout/data/tdf124600.docx Binary files differnew file mode 100644 index 000000000000..fc732b5e73bf --- /dev/null +++ b/sw/qa/extras/layout/data/tdf124600.docx diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 2110eed1e31c..ccbfd0b944a3 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -3154,6 +3154,19 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testShapeAllowOverlap) #endif } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf124600) +{ + createDoc("tdf124600.docx"); + xmlDocPtr pXmlDoc = parseLayoutDump(); + + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 1 + // - Actual : 2 + // i.e. the last line in the body text had 2 lines, while it should have 1, as Word does (as the + // fly frame does not intersect with the print area of the paragraph.) + assertXPath(pXmlDoc, "/root/page/body/txt[2]/LineBreak", 1); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index 9c59c5353fea..f03d93087732 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -2312,6 +2312,14 @@ void SwTextFormatter::CalcFlyWidth( SwTextFormatInfo &rInf ) if ( m_pFrame->IsVertical() ) m_pFrame->SwitchVerticalToHorizontal( aInter ); + if (!aInter.IsEmpty() && aInter.Bottom() < nTop) + { + // Intersects with the frame area (with upper margin), but not with the print area (without + // upper margin). Don't reserve space for the fly portion in this case, text is allowed to + // folow there. + aInter.Height(0); + } + if( !aInter.IsOver( aLine ) ) return; |