Kaydet (Commit) c3579e74 authored tarafından Mark Hung's avatar Mark Hung

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/40632Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMark Hung <marklh9@gmail.com>
üst 63767e54
......@@ -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;
......
......@@ -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
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment