summaryrefslogtreecommitdiff
path: root/sw/source/core/inc/frame.hxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2019-02-12 16:38:47 +0100
committerMiklos Vajna <vmiklos@collabora.com>2019-02-12 18:18:53 +0100
commite8b9572bf89f55463f2c879a401ed62efc165d95 (patch)
treebb14bef40f4ee43df2249c0e9ea43a449e84f331 /sw/source/core/inc/frame.hxx
parent4bbb0bcb88614d3ccaaab4bea4fe2309c92b881e (diff)
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 <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sw/source/core/inc/frame.hxx')
-rw-r--r--sw/source/core/inc/frame.hxx15
1 files changed, 12 insertions, 3 deletions
diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx
index 0a9a1ea823c0..5f9a2cfcf886 100644
--- a/sw/source/core/inc/frame.hxx
+++ b/sw/source/core/inc/frame.hxx
@@ -404,6 +404,7 @@ protected:
bool mbVertical : 1;
bool mbVertLR : 1;
+ bool mbVertLRBT : 1;
bool mbValidLineNum : 1;
bool mbFixSize : 1;
@@ -602,6 +603,7 @@ public:
inline bool IsVertical() const;
inline bool IsVertLR() const;
+ inline bool IsVertLRBT() const;
void SetDerivedVert( bool bNew ){ mbDerivedVert = bNew; }
void SetInvalidVert( bool bNew) { mbInvalidVert = bNew; }
@@ -955,6 +957,10 @@ inline bool SwFrame::IsVertLR() const
{
return mbVertLR;
}
+inline bool SwFrame::IsVertLRBT() const
+{
+ return mbVertLRBT;
+}
inline bool SwFrame::IsRightToLeft() const
{
if( mbInvalidR2L )
@@ -1312,21 +1318,23 @@ struct SwRectFnCollection
typedef SwRectFnCollection* SwRectFn;
// This class allows to use proper methods regardless of orientation (LTR/RTL, horizontal or vertical)
-extern SwRectFn fnRectHori, fnRectVert, fnRectVertL2R;
+extern SwRectFn fnRectHori, fnRectVert, fnRectVertL2R, fnRectVertL2RB2T;
class SwRectFnSet {
public:
explicit SwRectFnSet(const SwFrame *pFrame)
: m_bVert(pFrame->IsVertical())
, m_bVertL2R(pFrame->IsVertLR())
+ , m_bVertL2RB2T(pFrame->IsVertLRBT())
{
- m_fnRect = m_bVert ? (m_bVertL2R ? fnRectVertL2R : fnRectVert) : fnRectHori;
+ m_fnRect = m_bVert ? (m_bVertL2R ? (m_bVertL2RB2T ? fnRectVertL2RB2T : fnRectVertL2R) : fnRectVert) : fnRectHori;
}
void Refresh(const SwFrame *pFrame)
{
m_bVert = pFrame->IsVertical();
m_bVertL2R = pFrame->IsVertLR();
- m_fnRect = m_bVert ? (m_bVertL2R ? fnRectVertL2R : fnRectVert) : fnRectHori;
+ m_bVertL2RB2T = pFrame->IsVertLRBT();
+ m_fnRect = m_bVert ? (m_bVertL2R ? (m_bVertL2RB2T ? fnRectVertL2RB2T : fnRectVertL2R) : fnRectVert) : fnRectHori;
}
bool IsVert() const { return m_bVert; }
@@ -1395,6 +1403,7 @@ public:
private:
bool m_bVert;
bool m_bVertL2R;
+ bool m_bVertL2RB2T;
SwRectFn m_fnRect;
};