sc/source/ui/app/scmod.cxx | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-)
New commits: commit d0163b5b7ef1b73a4184d521d89f60df8a09d33e Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Tue Oct 19 11:09:32 2021 +0200 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Fri Oct 22 09:28:10 2021 +0200 lok: fix formula mode after reference dialog was used m_nCurRefDlgId is a global variable which can be used by many views. It should be deglobalized in LOK case in the furture. For now let's fallback when we didn't get child window for remembered value of m_nCurRefDlgId. It fixes following case: 1. opened pivot table dialog and in destination section selected "selection", selected a range, closed dialog 2. tried to type formula in the cell and point any cell to add reference before this patch formula mode was closed, after it adds correctly the selected range to the formula Change-Id: I4d6756f08207f78a6033865203905bc2fed59fb7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123803 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Mert Tumer <mert.tu...@collabora.com> diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index 54fba8044957..4163094bd390 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -1612,6 +1612,14 @@ bool ScModule::IsModalMode(SfxObjectShell* pDocSh) !( pRefDlg->IsRefInputMode() && pRefDlg->IsDocAllowed(pDocSh) ); } } + else if ( pDocSh && comphelper::LibreOfficeKit::isActive() ) + { + // m_nCurRefDlgId is not deglobalized so it can be set by other view + // in LOK case when no ChildWindow for this view was detected -> fallback + ScInputHandler* pHdl = GetInputHdl(); + if ( pHdl ) + bIsModal = pHdl->IsModalMode(pDocSh); + } } else if (pDocSh) { @@ -1693,6 +1701,14 @@ bool ScModule::IsFormulaMode() bIsFormula = pChildWnd->IsVisible() && pRefDlg && pRefDlg->IsRefInputMode(); } } + else if ( comphelper::LibreOfficeKit::isActive() ) + { + // m_nCurRefDlgId is not deglobalized so it can be set by other view + // in LOK case when no ChildWindow for this view was detected -> fallback + ScInputHandler* pHdl = GetInputHdl(); + if ( pHdl ) + bIsFormula = pHdl->IsFormulaMode(); + } } else { @@ -1728,7 +1744,13 @@ void ScModule::SetReference( const ScRange& rRef, ScDocument& rDoc, if( m_nCurRefDlgId ) { - SfxChildWindow* pChildWnd = lcl_GetChildWinFromAnyView( m_nCurRefDlgId ); + SfxChildWindow* pChildWnd = nullptr; + + if ( comphelper::LibreOfficeKit::isActive() ) + pChildWnd = lcl_GetChildWinFromCurrentView( m_nCurRefDlgId ); + else + pChildWnd = lcl_GetChildWinFromAnyView( m_nCurRefDlgId ); + OSL_ENSURE( pChildWnd, "NoChildWin" ); if ( pChildWnd ) { @@ -1754,6 +1776,14 @@ void ScModule::SetReference( const ScRange& rRef, ScDocument& rDoc, } } } + else if ( comphelper::LibreOfficeKit::isActive() ) + { + // m_nCurRefDlgId is not deglobalized so it can be set by other view + // in LOK case when no ChildWindow for this view was detected -> fallback + ScInputHandler* pHdl = GetInputHdl(); + if (pHdl) + pHdl->SetReference( aNew, rDoc ); + } } else {