sw/source/core/text/itrtxt.cxx | 4 +++- sw/source/core/text/pormulti.cxx | 23 +++++++++++++---------- 2 files changed, 16 insertions(+), 11 deletions(-)
New commits: commit c3579e74dec0db203566df1e356af9b06374ef9c Author: Mark Hung <mark...@gmail.com> Date: Sun Jul 30 07:57:44 2017 +0800 tdf#89409 Render ruby inside the grid in standard mode. In standard mode the text grids are rectangle and do not have dedicated space for ruby text. The ruby text either overlap with base text of the last line or clipped ( after scrolling ). Move ruby text inside the grid in standard mode as if there is no grid, and algin text to the center to keep the original text-to-text alignment behavior. Change-Id: Ia75ee016f9d492e4e73da6d7245aaeff40cbe1f3 Reviewed-on: https://gerrit.libreoffice.org/40632 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Mark Hung <mark...@gmail.com> diff --git a/sw/source/core/text/itrtxt.cxx b/sw/source/core/text/itrtxt.cxx index c62265e093d8..093927bd49b8 100644 --- a/sw/source/core/text/itrtxt.cxx +++ b/sw/source/core/text/itrtxt.cxx @@ -231,7 +231,9 @@ sal_uInt16 SwTextCursor::AdjustBaseLine( const SwLineLayout& rLine, const sal_uInt16 nRubyHeight = pGrid->GetRubyHeight(); const bool bRubyTop = ! pGrid->GetRubyTextBelow(); - if ( GetInfo().IsMulti() ) + if ( !pGrid->IsSquaredMode() ) + nOfst += ( rLine.Height() - nPorHeight ) / 2 + nPorAscent; + else if ( GetInfo().IsMulti() ) // we are inside the GetCharRect recursion for multi portions // we center the portion in its surrounding line nOfst = ( m_pCurr->Height() - nPorHeight ) / 2 + nPorAscent; diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx index 554dadf254f8..42fba70e6769 100644 --- a/sw/source/core/text/pormulti.cxx +++ b/sw/source/core/text/pormulti.cxx @@ -1256,9 +1256,9 @@ void SwTextPainter::PaintMultiPortion( const SwRect &rPaint, SwTextGridItem const*const pGrid(GetGridItem(m_pFrame->FindPageFrame())); const bool bHasGrid = pGrid && GetInfo().SnapToGrid(); sal_uInt16 nRubyHeight = 0; - bool bRubyTop = false; + bool bRubyTop = true; - if ( bHasGrid ) + if ( bHasGrid && pGrid->IsSquaredMode() ) { nRubyHeight = pGrid->GetRubyHeight(); bRubyTop = ! pGrid->GetRubyTextBelow(); @@ -1273,7 +1273,8 @@ void SwTextPainter::PaintMultiPortion( const SwRect &rPaint, if ( bRubyInGrid ) { GetInfo().SetSnapToGrid( ! bRubyTop ); - rMulti.Height( m_pCurr->Height() ); + if (pGrid->IsSquaredMode()) + rMulti.Height( m_pCurr->Height() ); } SwLayoutModeModifier aLayoutModeModifier( *GetInfo().GetOut() ); @@ -1297,7 +1298,7 @@ void SwTextPainter::PaintMultiPortion( const SwRect &rPaint, GetInfo().DrawViewOpt( rMulti, POR_FLD ); #endif - if ( bRubyInGrid ) + if ( bRubyInGrid && pGrid->IsSquaredMode() ) rMulti.Height( nOldHeight ); // do we have to repaint a post it portion? @@ -1394,7 +1395,7 @@ void SwTextPainter::PaintMultiPortion( const SwRect &rPaint, do { - if ( bHasGrid ) + if ( bHasGrid && pGrid->IsSquaredMode() ) { if( rMulti.HasRotation() ) { @@ -1524,16 +1525,18 @@ void SwTextPainter::PaintMultiPortion( const SwRect &rPaint, } else if ( bHasGrid && rMulti.IsRuby() ) { + GetInfo().SetSnapToGrid( bRubyTop ); GetInfo().X( nTmpX ); - if ( bRubyTop ) + if (pGrid->IsSquaredMode() ) { - nOfst += nRubyHeight; - GetInfo().SetSnapToGrid( true ); + if ( bRubyTop ) + nOfst += nRubyHeight; + else + nOfst += m_pCurr->Height() - nRubyHeight; } else { - nOfst += m_pCurr->Height() - nRubyHeight; - GetInfo().SetSnapToGrid( false ); + nOfst += rMulti.GetRoot().Height(); } } else { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits