Fix tdf#82176 CJK: Cursor position, line selection and non-printing

characters do not take account of hanging punctuation. Note that
placing a cursor next to the hanging puncuation is still not possible,
but the selection and the non-printing characters works fine now.

Change-Id: I22c8c2c5044b46c325236caffec67d9f68c23eed
Reviewed-on: https://gerrit.libreoffice.org/17591
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Norbert Thiebaud <nthiebaud@gmail.com>
diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx
index bf1b5f2..04f46ae 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -2428,8 +2428,7 @@ void SwRootFrm::CalcFrmRects(SwShellCrsr &rCrsr)
            {
                lLeft = (pStartFrm->Frm().*fnRect->fnGetLeft)() +
                    (pStartFrm->Prt().*fnRect->fnGetLeft)();
                lRight = (pStartFrm->Frm().*fnRect->fnGetLeft)() +
                    (pStartFrm->Prt().*fnRect->fnGetRight)();
                lRight = (aEndFrm.*fnRect->fnGetRight)();
            }
            if( lLeft < (aStFrm.*fnRect->fnGetLeft)() )
                lLeft = (aStFrm.*fnRect->fnGetLeft)();
diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx
index 2f73c22..65a279d 100644
--- a/sw/source/core/text/itrcrsr.cxx
+++ b/sw/source/core/text/itrcrsr.cxx
@@ -1265,7 +1265,7 @@ sal_Int32 SwTextCursor::GetCrsrOfst( SwPosition *pPos, const Point &rPoint,
    // x is the horizontal offset within the line.
    SwTwips x = rPoint.X();
    const SwTwips nLeftMargin  = GetLineStart();
    SwTwips nRightMargin = GetLineEnd();
    SwTwips nRightMargin = GetLineEnd() + GetCurr()->GetHangingMargin();
    if( nRightMargin == nLeftMargin )
        nRightMargin += 30;

diff --git a/sw/source/core/text/itrpaint.cxx b/sw/source/core/text/itrpaint.cxx
index e2e9b44..903301e 100644
--- a/sw/source/core/text/itrpaint.cxx
+++ b/sw/source/core/text/itrpaint.cxx
@@ -423,7 +423,7 @@ void SwTextPainter::DrawTextLine( const SwRect &rPaint, SwSaveClip &rClip,
            if ( bAdjustBaseLine )
                GetInfo().Y( GetInfo().GetPos().Y()
                           + AdjustBaseLine( *pCurr, &aEnd ) );

            GetInfo().X( GetInfo().X() + GetCurr()->GetHangingMargin() );
            aEnd.Paint( GetInfo() );
            GetInfo().Y( nOldY );
        }