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-10 12:34:28 +0000
commite9e63fc49962270b51a4ec6aa2d6b41f5256ac02 (patch)
treed4a5efa2676d2827a781b485e374d6483bd8f26d
parent38c82af5368c7dfb134305cb402b1ce9e1a7cc7f (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/34083
-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 b6f9928b5fe0..a55790aec431 100644
--- a/sw/source/core/text/itrcrsr.cxx
+++ b/sw/source/core/text/itrcrsr.cxx
@@ -1268,7 +1268,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 e91428a9b719..50b0f0639fe6 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 89b9dd768849..49b0b7f9f556 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; }