diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2021-10-19 11:09:32 +0200 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2021-12-29 10:40:31 +0100 |
commit | 673937056794da2fb96acb219d8c3dbf69a561a9 (patch) | |
tree | 406e67abc19c413db7d223217091580d49cc84d7 /sc | |
parent | 5fa0f02dace4538b0948bceddc23a9f55e1bf8a3 (diff) |
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 <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Mert Tumer <mert.tumer@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127667
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/app/scmod.cxx | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index bbc711bee057..d2aae8fee013 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -1563,6 +1563,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) { @@ -1644,6 +1652,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 { @@ -1679,7 +1695,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 ) { @@ -1705,6 +1727,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 { |