[Libreoffice-commits] core.git: sw/source
Mark Hung
marklh9 at gmail.com
Thu Feb 2 20:43:55 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 542421402d4e4f32bd9c499673d7a3fa98b00683
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.
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>
diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx
index 293cdfd..50976db 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 76987a3..3236982 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 f5c9052..eb7c2bd 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