[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

Mark Hung marklh9 at gmail.com
Mon Feb 6 22:21:32 UTC 2017


 sw/source/core/text/itrcrsr.cxx  |    3 ++-
 sw/source/core/text/itrpaint.cxx |    3 ++-
 sw/source/core/text/porlay.hxx   |    1 +
 3 files changed, 5 insertions(+), 2 deletions(-)

New commits:
commit bf357ae90811edc101ff13774c2e28a16bb5420d
Author: Mark Hung <marklh9 at gmail.com>
Date:   Thu Feb 2 21:15:01 2017 +0800

    tdf#104270 count hanging margin only if there is hanging portion.
    
    GetHangingMargin() also returns offset for PostItPortion, assure
    there is a hanging portion before using the value.
    
    Cherry-picked from 542421402d4e4f32bd9c499673d7a3fa98b00683
    
    Change-Id: I750b8078fbd607d49f4bf5f76ea606fc36ea5c23
    Reviewed-on: https://gerrit.libreoffice.org/33832
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Reviewed-on: https://gerrit.libreoffice.org/33891

diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx
index 884e5ce..684e0e3 100644
--- a/sw/source/core/text/itrcrsr.cxx
+++ b/sw/source/core/text/itrcrsr.cxx
@@ -1260,7 +1260,8 @@ sal_Int32 SwTextCursor::GetCursorOfst( SwPosition *pPos, const Point &rPoint,
     // x is the horizontal offset within the line.
     SwTwips x = rPoint.X();
     const SwTwips nLeftMargin  = GetLineStart();
-    SwTwips nRightMargin = GetLineEnd() + GetCurr()->GetHangingMargin();
+    SwTwips nRightMargin = GetLineEnd() +
+        ( GetCurr()->IsHanging() ? GetCurr()->GetHangingMargin() : 0 );
     if( nRightMargin == nLeftMargin )
         nRightMargin += 30;
 
diff --git a/sw/source/core/text/itrpaint.cxx b/sw/source/core/text/itrpaint.cxx
index be1b63a..8d4545a 100644
--- a/sw/source/core/text/itrpaint.cxx
+++ b/sw/source/core/text/itrpaint.cxx
@@ -440,7 +440,8 @@ void SwTextPainter::DrawTextLine( const SwRect &rPaint, SwSaveClip &rClip,
             if ( bAdjustBaseLine )
                 GetInfo().Y( GetInfo().GetPos().Y()
                            + AdjustBaseLine( *m_pCurr, &aEnd ) );
-            GetInfo().X( GetInfo().X() + GetCurr()->GetHangingMargin() );
+            GetInfo().X( GetInfo().X() +
+                    ( GetCurr()->IsHanging() ? GetCurr()->GetHangingMargin() : 0 ) );
             aEnd.Paint( GetInfo() );
             GetInfo().Y( nOldY );
         }
diff --git a/sw/source/core/text/porlay.hxx b/sw/source/core/text/porlay.hxx
index 76d0921..109cb66 100644
--- a/sw/source/core/text/porlay.hxx
+++ b/sw/source/core/text/porlay.hxx
@@ -126,6 +126,7 @@ public:
     inline void SetForcedLeftMargin() { m_bForcedLeftMargin = true; }
     inline bool HasForcedLeftMargin() const { return m_bForcedLeftMargin; }
     inline void SetHanging( const bool bNew = true ) { m_bHanging = bNew; }
+    inline bool IsHanging() const { return m_bHanging; }
     inline void SetUnderscore( const bool bNew = true ) { m_bUnderscore = bNew; }
     inline bool HasUnderscore() const { return m_bUnderscore; }
 


More information about the Libreoffice-commits mailing list