diff options
author | Mark Hung <marklh9@gmail.com> | 2017-02-02 21:15:01 +0800 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2017-02-02 20:43:20 +0000 |
commit | 542421402d4e4f32bd9c499673d7a3fa98b00683 (patch) | |
tree | 24b96b3ed803c9636292fbfdcb5871aa40baeb34 | |
parent | a364e1f039b0156306aa951e10632cd225b320a3 (diff) |
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.
Change-Id: I750b8078fbd607d49f4bf5f76ea606fc36ea5c23
Reviewed-on: https://gerrit.libreoffice.org/33832
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r-- | sw/source/core/text/itrcrsr.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/text/itrpaint.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/text/porlay.hxx | 1 |
3 files changed, 5 insertions, 2 deletions
diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx index 293cdfd3f22b..50976db46f36 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 76987a37e5e7..3236982f3693 100644 --- a/sw/source/core/text/itrpaint.cxx +++ b/sw/source/core/text/itrpaint.cxx @@ -443,7 +443,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 f5c90528dcbd..eb7c2bd996d7 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; } |