diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2019-03-07 21:39:14 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2019-03-08 08:33:47 +0100 |
commit | 404bfc6f78549d16de193794960a9c9ab7604511 (patch) | |
tree | 89d49a0016adbcfdd42b34d3745ef981871f2904 /sw/source/core/text/txtfrm.cxx | |
parent | c40c9e9ba637ab05bf8160883512424d180db6bd (diff) |
sw btlr writing mode shell: left/right cursor travelling, fix vert pos
By implementing BTLR support in
SwTextFrame::SwitchVerticalToHorizontal() (Point version).
Cursor traveling now looks good: all of up/down/left/right direction
have the correct paragraph and character position for all the lrtb, tbrl
and btlr cases.
As a side effect this also fixes mouse click, where clicking above the
paragraph positioned the cursor at the bottom of the paragraph.
Explicitly add a test for the mouse case as well, given that I initially
planned to fix the keyboard part directly in SwCursor::UpDown(), where
the keyboard test would pass, but not the mouse one.
Change-Id: Iabeded3f03a64416cfcaf58e0438c4a1a793e662
Reviewed-on: https://gerrit.libreoffice.org/68886
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/source/core/text/txtfrm.cxx')
-rw-r--r-- | sw/source/core/text/txtfrm.cxx | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index 85a179880780..81e71b8176f9 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -614,16 +614,29 @@ void SwTextFrame::SwitchVerticalToHorizontal( Point& rPoint ) const // calc offset inside frame if ( IsVertLR() ) + // X offset is Y - left. nOfstX = rPoint.X() - getFrameArea().Left(); else { + // X offset is right - X. if ( mbIsSwapped ) nOfstX = getFrameArea().Left() + getFrameArea().Height() - rPoint.X(); else nOfstX = getFrameArea().Left() + getFrameArea().Width() - rPoint.X(); } - const long nOfstY = rPoint.Y() - getFrameArea().Top(); + long nOfstY; + if (IsVertLRBT()) + { + // Y offset is bottom - Y. + if (mbIsSwapped) + nOfstY = getFrameArea().Top() + getFrameArea().Width() - rPoint.Y(); + else + nOfstY = getFrameArea().Top() + getFrameArea().Height() - rPoint.Y(); + } + else + // Y offset is Y - top. + nOfstY = rPoint.Y() - getFrameArea().Top(); // calc rotated coords rPoint.setX( getFrameArea().Left() + nOfstY ); |