diff options
-rw-r--r-- | sw/qa/extras/ooxmlimport/data/tdf116486.docx | bin | 0 -> 22455 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/text/itrform2.cxx | 12 |
3 files changed, 18 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/tdf116486.docx b/sw/qa/extras/ooxmlimport/data/tdf116486.docx Binary files differnew file mode 100644 index 000000000000..c6a4891b0cf4 --- /dev/null +++ b/sw/qa/extras/ooxmlimport/data/tdf116486.docx diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index ef0d085e699c..439658a63b39 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -1586,6 +1586,12 @@ DECLARE_OOXMLIMPORT_TEST(testTdf114217, "tdf114217.docx") CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), xDrawPage->getCount()); } +DECLARE_OOXMLIMPORT_TEST(testTdf116486, "tdf116486.docx") +{ + OUString aTop = parseDump("/root/page/body/txt/Special", "nHeight"); + CPPUNIT_ASSERT_EQUAL( OUString("4006"), aTop ); +} + // tests should only be added to ooxmlIMPORT *if* they fail round-tripping in ooxmlEXPORT CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index 7fc2ae4005df..f05a5f872509 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -2278,12 +2278,24 @@ void SwTextFormatter::CalcFlyWidth( SwTextFormatInfo &rInf ) SwRect aLine( rInf.X() + nLeftMin, nTop, rInf.RealWidth() - rInf.X() + nLeftMar - nLeftMin , nHeight ); + // tdf#116486: consider also the upper margin from getFramePrintArea because intersections + // with this additional space should lead to repositioning of paragraphs + // For compatibility we grab a related compat flag: + if ( GetTextFrame()->GetTextNode()->getIDocumentSettingAccess()->get(DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS) ) + { + const long nUpper = m_pFrame->getFramePrintArea().Top(); + // Increase the rectangle + if( nUpper > 0 && nTop >= nUpper ) + aLine.SubTop( nUpper ); + } SwRect aLineVert( aLine ); if ( m_pFrame->IsRightToLeft() ) m_pFrame->SwitchLTRtoRTL( aLineVert ); if ( m_pFrame->IsVertical() ) m_pFrame->SwitchHorizontalToVertical( aLineVert ); + + // GetFrame(...) determines and returns the intersection rectangle SwRect aInter( rTextFly.GetFrame( aLineVert ) ); if ( m_pFrame->IsRightToLeft() ) |