[Libreoffice-commits] core.git: Branch 'feature/cib_contract57c' - sw/qa sw/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Mar 12 10:38:02 UTC 2019
sw/qa/extras/layout/data/tdf123898.odt |binary
sw/qa/extras/layout/layout.cxx | 14 ++++++++
sw/source/core/txtnode/txtedt.cxx | 56 +--------------------------------
3 files changed, 17 insertions(+), 53 deletions(-)
New commits:
commit ed928becb09cf67c19d8bce1e4735747ea2ac0fb
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Fri Mar 8 16:38:49 2019 +0100
Commit: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Tue Mar 12 10:36:20 2019 +0100
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.Mehrbrodt at cib.de>
(cherry picked from commit 86567ebde2d38c44aae93064b8c102f365641f81)
Change-Id: I31df9140174c40cf4cf39891490301cbe4c5806a
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 b1ef14cbbad8..1e9047f855c2 100755
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -33,6 +33,7 @@ public:
void testTdf119875();
void testTdf116989();
void testTdf122607();
+ void testTdf123898();
CPPUNIT_TEST_SUITE(SwLayoutWriter);
CPPUNIT_TEST(testTdf116830);
@@ -51,6 +52,7 @@ public:
CPPUNIT_TEST(testTdf119875);
CPPUNIT_TEST(testTdf116989);
CPPUNIT_TEST(testTdf122607);
+ CPPUNIT_TEST(testTdf123898);
CPPUNIT_TEST_SUITE_END();
private:
@@ -320,6 +322,18 @@ void SwLayoutWriter::testTdf122607()
"nWidth", "428");
}
+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 7a646fc2b8ed..7b88b14ff5b9 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() )
More information about the Libreoffice-commits
mailing list