From e8b9572bf89f55463f2c879a401ed62efc165d95 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Tue, 12 Feb 2019 16:38:47 +0100 Subject: sw btlr writing mode: implement initial layout The bulk of this commit is reasonably straightforward, the interesting parts are: - SwFrame::CheckDir() is where the layout reads the doc model, i.e. sets the new SwFrame::mbVertLRBT. - We had 3 text directions previously: horizontal, vertical (implicitly RL) and vertical LR (implicitly TB). This adds a 4th text direction for the LRBT case. - SwTextFrame::SwitchHorizontalToVertical() is responsible for re-locating the origo of a string to be painted from the top left to the bottom left corner (in addition to the height/width swap that's done for all vertical directions). - Finally MapDirection() is the place where we map Writer's new btlr mode (with no character rotation) to VCL's 900 (90 degrees) rotated direction. No functional changes intended for existing text directions. Lots of places are still not yet adapted, but this is good enough to paint a single word in a table cell at the correct position with the correct direction. Change-Id: I465c62db6562d8a2be140c3d37473e590830139e Reviewed-on: https://gerrit.libreoffice.org/67740 Reviewed-by: Miklos Vajna Tested-by: Jenkins --- sw/source/core/txtnode/swfont.cxx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'sw/source/core/txtnode/swfont.cxx') diff --git a/sw/source/core/txtnode/swfont.cxx b/sw/source/core/txtnode/swfont.cxx index 33fefa32b833..8c0e97cd30a7 100644 --- a/sw/source/core/txtnode/swfont.cxx +++ b/sw/source/core/txtnode/swfont.cxx @@ -363,14 +363,17 @@ sal_uInt16 SwFont::CalcShadowSpace( } // maps directions for vertical layout -static sal_uInt16 MapDirection( sal_uInt16 nDir, const bool bVertFormat ) +static sal_uInt16 MapDirection(sal_uInt16 nDir, const bool bVertFormat, const bool bVertFormatLRBT) { if ( bVertFormat ) { switch ( nDir ) { case 0 : - nDir = 2700; + if (bVertFormatLRBT) + nDir = 900; + else + nDir = 2700; break; case 900 : nDir = 0; @@ -420,10 +423,10 @@ sal_uInt16 SwFont::GetOrientation( const bool bVertFormat ) const return UnMapDirection( m_aSub[m_nActual].GetOrientation(), bVertFormat ); } -void SwFont::SetVertical( sal_uInt16 nDir, const bool bVertFormat ) +void SwFont::SetVertical(sal_uInt16 nDir, const bool bVertFormat, const bool bVertLayoutLRBT) { // map direction if frame has vertical layout - nDir = MapDirection( nDir, bVertFormat ); + nDir = MapDirection(nDir, bVertFormat, bVertLayoutLRBT); if( nDir != m_aSub[SwFontScript::Latin].GetOrientation() ) { -- cgit v1.2.3