[Libreoffice-commits] core.git: sw/source

László Németh (via logerrit) logerrit at kemper.freedesktop.org
Mon Nov 2 18:08:29 UTC 2020


 sw/source/core/text/frmpaint.cxx |   23 +++++++++++++++++++++++
 sw/source/core/text/itrpaint.cxx |    7 +++++--
 2 files changed, 28 insertions(+), 2 deletions(-)

New commits:
commit db25f1e2e3ae7a078f8f3c080ff3c4802f83b853
Author:     László Németh <nemeth at numbertext.org>
AuthorDate: Mon Nov 2 11:33:56 2020 +0100
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Mon Nov 2 19:07:48 2020 +0100

    tdf#105967 sw change tracking: fix pilcrow in empty line
    
    At pilcrow symbol of inserted or deleted empty paragraphs,
    paint strikeout/underline based on redline color. Keep also
    the underline and strikeout formattings of the pilrow symbol
    in netural color, if they are not affected by change tracking.
    
    Follow-up of commit 37d85df2d2fd53ee436f24484b48aafc91d501b1
    (tdf#105967 sw change tracking: fix pilcrow color) and
    commit 350dbba44ee7703b1da11cc4732a5090ce5efe3d
    (tdf#105967 sw change tracking: fix pilcrow symbol).
    
    Note: clean-up also commit 58f64686cd83a349611daa52188db8bca347b3d4
    (tdf#105967 sw change tracking: fix line break symbol).
    
    Change-Id: I5f527d17fdf4b9a20bd57d5dfe9366e1271ca772
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105176
    Tested-by: Jenkins
    Reviewed-by: László Németh <nemeth at numbertext.org>

diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx
index 2d46fec51020..d664b07c5d50 100644
--- a/sw/source/core/text/frmpaint.cxx
+++ b/sw/source/core/text/frmpaint.cxx
@@ -502,6 +502,7 @@ bool SwTextFrame::PaintEmpty( const SwRect &rRect, bool bCheck ) const
         else if( pSh->GetWin() )
         {
             std::unique_ptr<SwFont> pFnt;
+            RedlineType eRedline = RedlineType::Any;
             const SwTextNode& rTextNode = *GetTextNodeForParaProps();
             if ( rTextNode.HasSwAttrSet() )
             {
@@ -525,6 +526,17 @@ bool SwTextFrame::PaintEmpty( const SwRect &rRect, bool bCheck ) const
                     aAttrHandler.Init(  rTextNode.GetSwAttrSet(),
                                        *rTextNode.getIDocumentSettingAccess() );
                     SwRedlineItr aRedln(rTextNode, *pFnt, aAttrHandler, nRedlPos, SwRedlineItr::Mode::Show);
+                    const SwRangeRedline* pRedline = rIDRA.GetRedlineTable()[nRedlPos];
+                    // show redlining only on the inserted/deleted empty paragraph, but not on the next one
+                    if ( rTextNode.GetIndex() != pRedline->End()->nNode.GetIndex() )
+                        eRedline = pRedline->GetType();
+                    // except if the next empty paragraph starts a new redline (e.g. deletion after insertion)
+                    else if ( nRedlPos + 1 < rIDRA.GetRedlineTable().size() )
+                    {
+                        const SwRangeRedline* pNextRedline = rIDRA.GetRedlineTable()[nRedlPos + 1];
+                        if ( rTextNode.GetIndex() == pNextRedline->Start()->nNode.GetIndex() )
+                            eRedline = pNextRedline->GetType();
+                    }
                 }
             }
 
@@ -591,6 +603,17 @@ bool SwTextFrame::PaintEmpty( const SwRect &rRect, bool bCheck ) const
                     aDrawInf.SetFont( pFnt.get() );
                     aDrawInf.SetSnapToGrid( false );
 
+                    // show redline color and settings drawing a background pilcrow,
+                    // but keep also other formattings (with neutral pilcrow color)
+                    if ( eRedline != RedlineType::Any )
+                    {
+                        pFnt->DrawText_( aDrawInf );
+                        if ( eRedline == RedlineType::Delete )
+                            pFnt->SetStrikeout( STRIKEOUT_NONE );
+                        else
+                            pFnt->SetUnderline( LINESTYLE_NONE );
+                    }
+
                     pFnt->SetColor(NON_PRINTING_CHARACTER_COLOR);
                     pFnt->DrawText_( aDrawInf );
                 }
diff --git a/sw/source/core/text/itrpaint.cxx b/sw/source/core/text/itrpaint.cxx
index ea0b965914e9..d714f5c68b4c 100644
--- a/sw/source/core/text/itrpaint.cxx
+++ b/sw/source/core/text/itrpaint.cxx
@@ -326,11 +326,14 @@ void SwTextPainter::DrawTextLine( const SwRect &rPaint, SwSaveClip &rClip,
             // Paragraph symbols should have the same font as the paragraph in front of them,
             // except for the case that there's redlining in the paragraph
             if( GetRedln() )
+            {
                 SeekAndChg( GetInfo() );
+                // paint redlining
+                if ( m_pCurr->HasRedline() )
+                    static_cast<SwBreakPortion&>(*pPor).PaintRedline( GetInfo() );
+            }
             else
                 SeekAndChgBefore( GetInfo() );
-            // paint redlining
-            static_cast<SwBreakPortion&>(*pPor).PaintRedline( GetInfo() );
         }
         else
             bSeeked = false;


More information about the Libreoffice-commits mailing list