summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2022-07-14 16:52:23 +0200
committerSzymon Kłos <szymon.klos@collabora.com>2022-07-21 10:23:18 +0200
commit3cb565539288596483817ecc01828db377190e26 (patch)
treeb2db29256aeb13bd4ee71ed4c1e3772892029f7f /sc/source
parent8742557ec4e4361fe726c6274cd01afa3a8ea080 (diff)
lok: formulabar: handle mobile IME
Change-Id: I7cb69efaebb42020353133e590a161b2e4bc5210 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137086 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Mert Tumer <mert.tumer@collabora.com>
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/ui/app/inputhdl.cxx2
-rw-r--r--sc/source/ui/app/inputwin.cxx45
2 files changed, 36 insertions, 11 deletions
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 94e68ac4c00c..6eb949725c37 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -4125,7 +4125,7 @@ void ScInputHandler::InputCommand( const CommandEvent& rCEvt )
{
if (pTableView)
pTableView->Command( rCEvt );
- if (pTopView && !comphelper::LibreOfficeKit::isActive())
+ if (pTopView)
pTopView->Command( rCEvt );
if ( rCEvt.GetCommand() == CommandEventId::EndExtTextInput )
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 531d5c5d9a17..34d72d49481a 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -413,9 +413,18 @@ void ScInputWindow::StartFormula()
EditView* pView = mxTextWindow->GetEditView();
if (pView)
{
+ sal_Int32 nStartPara = 0, nEndPara = 0;
if (comphelper::LibreOfficeKit::isActive())
+ {
TextGrabFocus();
- pView->SetSelection( ESelection(0, nStartPos, 0, nEndPos) );
+ if (pViewSh && !pViewSh->isLOKDesktop())
+ {
+ nStartPara = nEndPara = pView->GetEditEngine()->GetParagraphCount() ?
+ (pView->GetEditEngine()->GetParagraphCount() - 1) : 0;
+ nStartPos = nEndPos = pView->GetEditEngine()->GetTextLen(nStartPara);
+ }
+ }
+ pView->SetSelection(ESelection(nStartPara, nStartPos, nEndPara, nEndPos));
pScMod->InputChanged(pView);
SetOkCancelMode();
pView->SetEditEngineUpdateLayout(true);
@@ -1729,10 +1738,26 @@ bool ScTextWnd::Command( const CommandEvent& rCEvt )
// see vcl/jsdialog/executor.cxx "textselection" event
const Point* pParaPoint = static_cast<const Point*>(rCEvt.GetEventData());
Point aSelectionStartEnd = rCEvt.GetMousePosPixel();
- m_xEditView->SetSelection(
- ESelection((pParaPoint ? pParaPoint->X() : 0), aSelectionStartEnd.X(),
- (pParaPoint ? pParaPoint->Y() : 0), aSelectionStartEnd.Y()));
+ sal_Int32 nParaStart, nParaEnd, nPosStart, nPosEnd;
+
+ ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell();
+ if (pViewSh && pViewSh->isLOKMobilePhone())
+ {
+ // We use IME - do not select anything, put cursor at the end
+ nParaStart = nParaEnd = m_xEditView->GetEditEngine()->GetParagraphCount() ?
+ (m_xEditView->GetEditEngine()->GetParagraphCount() - 1) : 0;
+ nPosStart = nPosEnd = m_xEditView->GetEditEngine()->GetTextLen(nParaStart);
+ }
+ else
+ {
+ nParaStart = pParaPoint ? pParaPoint->X() : 0;
+ nParaEnd = pParaPoint ? pParaPoint->Y() : 0;
+ nPosStart = aSelectionStartEnd.X();
+ nPosEnd = aSelectionStartEnd.Y();
+ }
+
+ m_xEditView->SetSelection(ESelection(nParaStart, nPosStart, nParaEnd, nPosEnd));
SC_MOD()->InputSelection( m_xEditView.get() );
bConsumed = true;
@@ -1894,12 +1919,6 @@ static sal_Int32 findFirstNonMatchingChar(const OUString& rStr1, const OUString&
void ScTextWnd::SetTextString( const OUString& rNewString )
{
- if (comphelper::LibreOfficeKit::isActive())
- {
- ESelection aSel = m_xEditView ? m_xEditView->GetSelection() : ESelection();
- ScInputHandler::LOKSendFormulabarUpdate(SfxViewShell::Current(), rNewString, aSel);
- }
-
// Ideally it would be best to create on demand the EditEngine/EditView here, but... for
// the initialisation scenario where a cell is first clicked on we end up with the text in the
// inputbar window scrolled to the bottom if we do that here ( because the tableview and topview
@@ -1974,6 +1993,12 @@ void ScTextWnd::SetTextString( const OUString& rNewString )
bInputMode = false;
}
+ if (comphelper::LibreOfficeKit::isActive())
+ {
+ ESelection aSel = m_xEditView ? m_xEditView->GetSelection() : ESelection();
+ ScInputHandler::LOKSendFormulabarUpdate(SfxViewShell::Current(), rNewString, aSel);
+ }
+
SetScrollBarRange();
DoScroll();
}