[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-5-2+backports' - sw/qa sw/source

Samuel Mehrbrodt (via logerrit) logerrit at kemper.freedesktop.org
Thu May 9 14:34:47 UTC 2019


 sw/qa/extras/layout/data/tdf123898.odt |binary
 sw/qa/extras/uiwriter/uiwriter.cxx     |   14 +++++++
 sw/source/core/txtnode/txtedt.cxx      |   59 +--------------------------------
 3 files changed, 17 insertions(+), 56 deletions(-)

New commits:
commit 084b1c1f0a65d5e4743ae40407ccd628dbdb3864
Author:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Fri Mar 8 16:38:49 2019 +0100
Commit:     Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Thu May 9 16:33:49 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.Mehrbrodt at cib.de>
    (cherry picked from commit 86567ebde2d38c44aae93064b8c102f365641f81)
    
    Change-Id: I31df9140174c40cf4cf39891490301cbe4c5806a
    (cherry picked from commit f3c5731b1c4fd9d5e7d41782fa6c308e72b73946)
    Reviewed-on: https://gerrit.libreoffice.org/72050
    Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>
    Tested-by: Michael Weghorn <m.weghorn at 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/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 99e7bc5b20f7..73530817ce34 100755
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -116,6 +116,7 @@ public:
     void testFdo70807();
     void testImportRTF();
     void testExportRTF();
+    void testTdf123898();
     void testTdf67238();
     void testFdo75110();
     void testFdo75898();
@@ -232,6 +233,7 @@ public:
     CPPUNIT_TEST(testFdo70807);
     CPPUNIT_TEST(testImportRTF);
     CPPUNIT_TEST(testExportRTF);
+    CPPUNIT_TEST(testTdf123898);
     CPPUNIT_TEST(testTdf67238);
     CPPUNIT_TEST(testFdo75110);
     CPPUNIT_TEST(testFdo75898);
@@ -491,6 +493,18 @@ void SwUiWriterTest::testBookmarkCopy()
     }
 }
 
+void SwUiWriterTest::testTdf123898()
+{
+    load("sw/qa/extras/layout/data/", "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);
+}
+
 void SwUiWriterTest::testTdf67238()
 {
     //create a new writer document
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index 57d0694367ee..3974652e67f5 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -178,71 +178,18 @@ lcl_MaskRedlinesAndHiddenText( const SwTextNode& rNode, OUStringBuffer& rText,
  */
 static SwRect lcl_CalculateRepaintRect( SwTextFrame& rTextFrame, sal_Int32 nChgStart, sal_Int32 nChgEnd )
 {
-    SwRect aRect;
-
-    SwTextNode *pNode = rTextFrame.GetTextNode();
-
-    SwNodeIndex aNdIdx( *pNode );
-    SwPosition aPos( aNdIdx, SwIndex( pNode, 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;
-
-    while( pEndFrame->HasFollow() &&
-           nChgEnd >= pEndFrame->GetFollow()->GetOfst() )
-        pEndFrame = pEndFrame->GetFollow();
-
-    if ( pEnd2Pos )
-    {
-        // we are inside a special portion, take left border
-        SWRECTFN( pEndFrame )
-        (aRect.*fnRect->fnSetTop)( (pEnd2Pos->aLine.*fnRect->fnGetTop)() );
-        if ( pEndFrame->IsRightToLeft() )
-            (aRect.*fnRect->fnSetLeft)( (pEnd2Pos->aPortion.*fnRect->fnGetLeft)() );
-        else
-            (aRect.*fnRect->fnSetLeft)( (pEnd2Pos->aPortion.*fnRect->fnGetRight)() );
-        (aRect.*fnRect->fnSetWidth)( 1 );
-        (aRect.*fnRect->fnSetHeight)( (pEnd2Pos->aLine.*fnRect->fnGetHeight)() );
-        delete pEnd2Pos;
-    }
+    SwRect aRect = rTextFrame.GetPaintArea();
+    SwRect aTmp = rTextFrame.GetPaintArea();
 
-    aTmpState.m_p2Lines = nullptr;
-    SwRect aTmp;
-    aPos = SwPosition( aNdIdx, SwIndex( pNode, 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() &&
            nChgStart >= pStartFrame->GetFollow()->GetOfst() )
         pStartFrame = pStartFrame->GetFollow();
-    pEndFrame = pStartFrame;
+    const SwTextFrame* pEndFrame = pStartFrame;
     while( pEndFrame->HasFollow() &&
            nChgEnd >= 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
-        SWRECTFN( pStartFrame )
-        (aTmp.*fnRect->fnSetTop)( (pSt2Pos->aLine.*fnRect->fnGetTop)() );
-        if ( pStartFrame->IsRightToLeft() )
-            (aTmp.*fnRect->fnSetLeft)( (pSt2Pos->aPortion.*fnRect->fnGetRight)() );
-        else
-            (aTmp.*fnRect->fnSetLeft)( (pSt2Pos->aPortion.*fnRect->fnGetLeft)() );
-        (aTmp.*fnRect->fnSetWidth)( 1 );
-        (aTmp.*fnRect->fnSetHeight)( (pSt2Pos->aLine.*fnRect->fnGetHeight)() );
-        delete pSt2Pos;
-    }
-
     bool bSameFrame = true;
 
     if( rTextFrame.HasFollow() )


More information about the Libreoffice-commits mailing list