diff options
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/layout/data/tdf119875.odt | bin | 0 -> 7314 bytes | |||
-rw-r--r-- | sw/qa/extras/layout/layout.cxx | 15 | ||||
-rw-r--r-- | sw/source/core/layout/sectfrm.cxx | 28 |
3 files changed, 39 insertions, 4 deletions
diff --git a/sw/qa/extras/layout/data/tdf119875.odt b/sw/qa/extras/layout/data/tdf119875.odt Binary files differnew file mode 100644 index 000000000000..6f579546e312 --- /dev/null +++ b/sw/qa/extras/layout/data/tdf119875.odt diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 8c9740b7e2ae..5dee5c580402 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -23,6 +23,7 @@ public: void testTdf117923(); void testTdf118058(); void testTdf117188(); + void testTdf119875(); CPPUNIT_TEST_SUITE(SwLayoutWriter); CPPUNIT_TEST(testTdf116830); @@ -31,6 +32,7 @@ public: CPPUNIT_TEST(testTdf117923); CPPUNIT_TEST(testTdf118058); CPPUNIT_TEST(testTdf117188); + CPPUNIT_TEST(testTdf119875); CPPUNIT_TEST_SUITE_END(); private: @@ -156,6 +158,19 @@ void SwLayoutWriter::testTdf117188() assertXPath(pXmlDoc, "/root/page/body/txt/anchored/fly/infos/prtBounds", "height", sHeight); } +void SwLayoutWriter::testTdf119875() +{ + createDoc("tdf119875.odt"); + xmlDocPtr pXmlDoc = parseLayoutDump(); + sal_Int32 nFirstTop + = getXPath(pXmlDoc, "/root/page[2]/body/section[1]/infos/bounds", "top").toInt32(); + sal_Int32 nSecondTop + = getXPath(pXmlDoc, "/root/page[2]/body/section[2]/infos/bounds", "top").toInt32(); + // The first section had the same top value as the second one, so they + // overlapped. + CPPUNIT_ASSERT_LESS(nSecondTop, nFirstTop); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SwLayoutWriter); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx index 3790c92a199d..f456da19b54d 100644 --- a/sw/source/core/layout/sectfrm.cxx +++ b/sw/source/core/layout/sectfrm.cxx @@ -44,6 +44,21 @@ #include <flyfrms.hxx> #include <sortedobjs.hxx> +namespace +{ +/** + * Performs the correct type of position invalidation depending on if we're in + * CalcContent(). + */ +void InvalidateFramePos(SwFrame* pFrame, bool bInCalcContent) +{ + if (bInCalcContent) + pFrame->InvalidatePos_(); + else + pFrame->InvalidatePos(); +} +} + SwSectionFrame::SwSectionFrame( SwSection &rSect, SwFrame* pSib ) : SwLayoutFrame( rSect.GetFormat(), pSib ) , SwFlowFrame( static_cast<SwFrame&>(*this) ) @@ -2121,15 +2136,20 @@ SwTwips SwSectionFrame::Grow_( SwTwips nDist, bool bTst ) } if( GetNext() ) { + // Own height changed, need to invalidate the position of + // next frames. SwFrame *pFrame = GetNext(); while( pFrame && pFrame->IsSctFrame() && !static_cast<SwSectionFrame*>(pFrame)->GetSection() ) + { + // Invalidate all in-between frames, otherwise position + // calculation (which only looks back to one relative + // frame) will have an incorrect result. + InvalidateFramePos(pFrame, bInCalcContent); pFrame = pFrame->GetNext(); + } if( pFrame ) { - if( bInCalcContent ) - pFrame->InvalidatePos_(); - else - pFrame->InvalidatePos(); + InvalidateFramePos(pFrame, bInCalcContent); } } // #i28701# - Due to the new object positioning |