summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Hung <marklh9@gmail.com>2017-02-02 21:15:01 +0800
committerMichael Stahl <mstahl@redhat.com>2017-02-06 22:21:12 +0000
commitbf357ae90811edc101ff13774c2e28a16bb5420d (patch)
treedd37390016e15242fd5b852566ef245693b4dbe2
parentaa09fd58bd499a2a2c3a32c5f613892bad54076c (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. Cherry-picked from 542421402d4e4f32bd9c499673d7a3fa98b00683 Change-Id: I750b8078fbd607d49f4bf5f76ea606fc36ea5c23 Reviewed-on: https://gerrit.libreoffice.org/33832 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com> Reviewed-on: https://gerrit.libreoffice.org/33891
-rw-r--r--sw/source/core/text/itrcrsr.cxx3
-rw-r--r--sw/source/core/text/itrpaint.cxx3
-rw-r--r--sw/source/core/text/porlay.hxx1
3 files changed, 5 insertions, 2 deletions
diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx
index 884e5ce50a03..684e0e3a1c91 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 be1b63a5e34c..8d4545a510e1 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 76d0921b8134..109cb66c37ff 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; }