summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2019-03-08 16:38:49 +0100
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2019-03-12 10:08:19 +0100
commit86567ebde2d38c44aae93064b8c102f365641f81 (patch)
treee902fee5ef2a0f3bd854c804c65f1498366108c7
parentCorrectly match checkboxes and relevant settings (diff)
downloadcore-86567ebde2d38c44aae93064b8c102f365641f81.tar.gz
core-86567ebde2d38c44aae93064b8c102f365641f81.zip
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. Change-Id: I31df9140174c40cf4cf39891490301cbe4c5806a Reviewed-on: https://gerrit.libreoffice.org/68927 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
-rw-r--r--sw/qa/extras/layout/data/tdf123898.odtbin0 -> 9642 bytes
-rw-r--r--sw/qa/extras/layout/layout.cxx14
-rw-r--r--sw/source/core/txtnode/txtedt.cxx56
3 files changed, 17 insertions, 53 deletions
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
--- /dev/null
+++ b/sw/qa/extras/layout/data/tdf123898.odt
Binary files differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index a0cc3dea15a5..8fa2b9b821bc 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -71,6 +71,7 @@ public:
void testTdf115094();
void testTdf122607();
void testBtlrCell();
+ void testTdf123898();
CPPUNIT_TEST_SUITE(SwLayoutWriter);
CPPUNIT_TEST(testRedlineFootnotes);
@@ -112,6 +113,7 @@ public:
CPPUNIT_TEST(testTdf115094);
CPPUNIT_TEST(testTdf122607);
CPPUNIT_TEST(testBtlrCell);
+ CPPUNIT_TEST(testTdf123898);
CPPUNIT_TEST_SUITE_END();
private:
@@ -2895,6 +2897,18 @@ void SwLayoutWriter::testBtlrCell()
#endif
}
+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 f7c307c4c18f..39ca6f1a85a1 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -221,71 +221,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 );
-
- const SwTextFrame *pEndFrame = &rTextFrame;
+ SwRect aRect = rTextFrame.GetPaintArea();
+ SwRect aTmp = rTextFrame.GetPaintArea();
- while( pEndFrame->HasFollow() &&
- iChgEnd >= pEndFrame->GetFollow()->GetOfst())
- pEndFrame = pEndFrame->GetFollow();
-
- // information about end of repaint area
- if ( aTmpState.m_p2Lines )
- {
- Sw2LinesPos* pEnd2Pos = aTmpState.m_p2Lines.get();
- // 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) );
- aTmpState.m_p2Lines.reset();
- }
-
- 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
- if ( aTmpState.m_p2Lines )
- {
- Sw2LinesPos* pSt2Pos = aTmpState.m_p2Lines.get();
- // 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) );
- aTmpState.m_p2Lines.reset();
- }
-
bool bSameFrame = true;
if( rTextFrame.HasFollow() )