Kaydet (Commit) 2c9ca62c authored tarafından Miklos Vajna's avatar Miklos Vajna

SwCursor: when tiled rendering also select word before the point

On the desktop, the logic is that if we double-click before a word, then we
select the word, but if we double-click after it, then we don't.

When tiled rendering, it's more important to always select something, as
that's how the selection can be adjusted further. So if we long push
after a non-empty text node, then select its last word. This way
something is always selected if e.g. the user long pushes inside a table
cell. (If the table cell is empty, then that's handled in
SwCrsrShell::SelectCell().)

Change-Id: I6e84874b8cf252fc6b72a75ffe9db67b03636862
üst b2b3a184
......@@ -1366,13 +1366,24 @@ bool SwCursor::SelectWordWT( SwViewShell* pViewShell, sal_Int16 nWordType, const
}
else
{
const sal_Int32 nPtPos = GetPoint()->nContent.GetIndex();
sal_Int32 nPtPos = GetPoint()->nContent.GetIndex();
Boundary aBndry( g_pBreakIt->GetBreakIter()->getWordBoundary(
pTxtNd->GetTxt(), nPtPos,
g_pBreakIt->GetLocale( pTxtNd->GetLang( nPtPos ) ),
nWordType,
bForward ));
if (pViewShell->isTiledRendering() && aBndry.startPos == aBndry.endPos && nPtPos > 0)
{
// nPtPos is the end of the paragraph, select the last word then.
--nPtPos;
aBndry = Boundary( g_pBreakIt->GetBreakIter()->getWordBoundary(
pTxtNd->GetTxt(), nPtPos,
g_pBreakIt->GetLocale( pTxtNd->GetLang( nPtPos ) ),
nWordType,
bForward ));
}
if( aBndry.startPos != aBndry.endPos )
{
GetPoint()->nContent = aBndry.endPos;
......
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