sw/qa/extras/layout/data/tdf123898.odt |binary sw/qa/extras/layout/layout.cxx | 15 ++++++++ sw/source/core/txtnode/txtedt.cxx | 56 +-------------------------------- 3 files changed, 18 insertions(+), 53 deletions(-)
New commits: commit c8ba56ff47795815192930320d05d0d408e8433a Author: Samuel Mehrbrodt <samuel.mehrbr...@cib.de> AuthorDate: Fri Mar 8 16:38:49 2019 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Thu May 9 16:34:07 2019 +0200 tdf#123898 Fix frame content misaligned Frame was correctly formatted until spellchecker comes and calls GetCharRect which somehow reformats the frame causes the misalignment. So instead of calling GetCharRect, just call GetPaintArea as the frame is already formatted at this point. Reviewed-on: https://gerrit.libreoffice.org/68927 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@cib.de> (cherry picked from commit 86567ebde2d38c44aae93064b8c102f365641f81) Change-Id: I31df9140174c40cf4cf39891490301cbe4c5806a Reviewed-on: https://gerrit.libreoffice.org/72047 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/sw/qa/extras/layout/data/tdf123898.odt b/sw/qa/extras/layout/data/tdf123898.odt new file mode 100644 index 000000000000..31800aadb18b Binary files /dev/null and b/sw/qa/extras/layout/data/tdf123898.odt differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 98969b4062a6..52625202aa6f 100755 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -12,6 +12,7 @@ #include <test/mtfxmldump.hxx> #include <com/sun/star/frame/DispatchHelper.hpp> #include <officecfg/Office/Common.hxx> +#include <vcl/scheduler.hxx> #include <fmtanchr.hxx> #include <fmtfsize.hxx> #include <fmtcntnt.hxx> @@ -51,6 +52,7 @@ public: void testTdf117188(); void testTdf119875(); void testTdf116989(); + void testTdf123898(); CPPUNIT_TEST_SUITE(SwLayoutWriter); CPPUNIT_TEST(testRedlineFootnotes); @@ -77,6 +79,7 @@ public: CPPUNIT_TEST(testTdf117188); CPPUNIT_TEST(testTdf119875); CPPUNIT_TEST(testTdf116989); + CPPUNIT_TEST(testTdf123898); CPPUNIT_TEST_SUITE_END(); private: @@ -2495,6 +2498,18 @@ void SwLayoutWriter::testTdf116989() } } +void SwLayoutWriter::testTdf123898() +{ + createDoc("tdf123898.odt"); + + // Make sure spellchecker has done its job already + Scheduler::ProcessEventsToIdle(); + + xmlDocPtr pXmlDoc = parseLayoutDump(); + // Make sure that the arrow on the left is not there (there are 43 children if it's there) + assertXPathChildren(pXmlDoc, "/root/page/body/txt/anchored/fly/txt", 42); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SwLayoutWriter); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx index 9f48b30c0846..b513886d4290 100644 --- a/sw/source/core/txtnode/txtedt.cxx +++ b/sw/source/core/txtnode/txtedt.cxx @@ -204,71 +204,21 @@ static SwRect lcl_CalculateRepaintRect( SwTextFrame & rTextFrame, SwTextNode & rNode, sal_Int32 const nChgStart, sal_Int32 const nChgEnd) { - SwRect aRect; - TextFrameIndex const iChgStart(rTextFrame.MapModelToView(&rNode, nChgStart)); TextFrameIndex const iChgEnd(rTextFrame.MapModelToView(&rNode, nChgEnd)); - SwPosition aPos( rNode, nChgEnd ); - SwCursorMoveState aTmpState( MV_NONE ); - aTmpState.m_b2Lines = true; - rTextFrame.GetCharRect( aRect, aPos, &aTmpState ); - // information about end of repaint area - Sw2LinesPos* pEnd2Pos = aTmpState.m_p2Lines; - - const SwTextFrame *pEndFrame = &rTextFrame; + SwRect aRect = rTextFrame.GetPaintArea(); + SwRect aTmp = rTextFrame.GetPaintArea(); - while( pEndFrame->HasFollow() && - iChgEnd >= pEndFrame->GetFollow()->GetOfst()) - pEndFrame = pEndFrame->GetFollow(); - - if ( pEnd2Pos ) - { - // we are inside a special portion, take left border - SwRectFnSet aRectFnSet(pEndFrame); - aRectFnSet.SetTop( aRect, aRectFnSet.GetTop(pEnd2Pos->aLine) ); - if ( pEndFrame->IsRightToLeft() ) - aRectFnSet.SetLeft( aRect, aRectFnSet.GetLeft(pEnd2Pos->aPortion) ); - else - aRectFnSet.SetLeft( aRect, aRectFnSet.GetRight(pEnd2Pos->aPortion) ); - aRectFnSet.SetWidth( aRect, 1 ); - aRectFnSet.SetHeight( aRect, aRectFnSet.GetHeight(pEnd2Pos->aLine) ); - delete pEnd2Pos; - } - - aTmpState.m_p2Lines = nullptr; - SwRect aTmp; - aPos = SwPosition( rNode, nChgStart ); - rTextFrame.GetCharRect( aTmp, aPos, &aTmpState ); - - // i63141: GetCharRect(..) could cause a formatting, - // during the formatting SwTextFrames could be joined, deleted, created... - // => we have to reinit pStartFrame and pEndFrame after the formatting const SwTextFrame* pStartFrame = &rTextFrame; while( pStartFrame->HasFollow() && iChgStart >= pStartFrame->GetFollow()->GetOfst()) pStartFrame = pStartFrame->GetFollow(); - pEndFrame = pStartFrame; + const SwTextFrame* pEndFrame = pStartFrame; while( pEndFrame->HasFollow() && iChgEnd >= pEndFrame->GetFollow()->GetOfst()) pEndFrame = pEndFrame->GetFollow(); - // information about start of repaint area - Sw2LinesPos* pSt2Pos = aTmpState.m_p2Lines; - if ( pSt2Pos ) - { - // we are inside a special portion, take right border - SwRectFnSet aRectFnSet(pStartFrame); - aRectFnSet.SetTop( aTmp, aRectFnSet.GetTop(pSt2Pos->aLine) ); - if ( pStartFrame->IsRightToLeft() ) - aRectFnSet.SetLeft( aTmp, aRectFnSet.GetRight(pSt2Pos->aPortion) ); - else - aRectFnSet.SetLeft( aTmp, aRectFnSet.GetLeft(pSt2Pos->aPortion) ); - aRectFnSet.SetWidth( aTmp, 1 ); - aRectFnSet.SetHeight( aTmp, aRectFnSet.GetHeight(pSt2Pos->aLine) ); - delete pSt2Pos; - } - bool bSameFrame = true; if( rTextFrame.HasFollow() ) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits