summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Hung <marklh9@gmail.com>2017-07-30 07:57:44 +0800
committerMark Hung <marklh9@gmail.com>2017-08-11 17:52:05 +0200
commitc3579e74dec0db203566df1e356af9b06374ef9c (patch)
treef0ac3a4c77ca7ed9411d8e514b35d2da5299e54e
parent63767e542b91c8bb8d6347e46f2c52cc8bd2dc86 (diff)
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 <ci@libreoffice.org> Reviewed-by: Mark Hung <marklh9@gmail.com>
-rw-r--r--sw/source/core/text/itrtxt.cxx4
-rw-r--r--sw/source/core/text/pormulti.cxx23
2 files changed, 16 insertions, 11 deletions
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
{