summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMarco Cecchetti <marco.cecchetti@collabora.com>2017-09-30 17:51:26 +0200
committerJulien Nabet <serval2412@yahoo.fr>2017-11-04 09:30:55 +0100
commit52f2e70c9ef727a1a638d44fbabe76fc4b5a755a (patch)
treec0b1e1b53c3b7ae0e71055f7abfa6651fe24c394 /sc
parent3dde9d988f0c9a432429389359c3531f10a4ff10 (diff)
lok: temporary workaround: disable formula mode for online
- Start empty spreadsheet, open it with two users (let's call them A & B). - Type "=" with user A. - Start moving around to different cells with user B. => Cell name of user B's selected cell is entered in user A's formula. This is due to the fact that ScModel::GetInputHandler() returns always the input handler which is handling the edited formula and not the input handler of the current view. That really messes up collaborative editing, so better to disable it, until we implement an alternative solution. Change-Id: I6e779cba3f377d12b7a4a19a6ee53c924fc9ba20 Reviewed-on: https://gerrit.libreoffice.org/43035 Reviewed-by: Jan Holesovsky <kendy@collabora.com> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/app/inputhdl.cxx12
-rw-r--r--sc/source/ui/app/scmod.cxx6
-rw-r--r--sc/source/ui/view/tabvwsh4.cxx26
3 files changed, 44 insertions, 0 deletions
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 4d2036b2836f..aa5fec4e1a86 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -2373,6 +2373,18 @@ void ScInputHandler::UpdateFormulaMode()
(rText[0] == '=' || rText[0] == '+' || rText[0] == '-');
}
+ // formula mode in online is not usable in collaborative mode,
+ // this is a workaround for disabling formula mode in online
+ // when there is more than a single view
+ if (comphelper::LibreOfficeKit::isActive()
+ && SfxViewShell::GetActiveShells(/*only visible shells*/ false) > 1)
+ {
+ // we look for not visible shells, too, since this method can be
+ // invoked by a TabViewShell ctor and at such a stage the view
+ // is not yet visible,
+ bIsFormula = false;
+ }
+
if ( bIsFormula )
{
if (!bFormulaMode)
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index c45e5d649ba9..414c8567bb93 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -1673,6 +1673,12 @@ bool ScModule::IsFormulaMode()
// Just keep function autopilot here for references to other documents
bool bIsFormula = false;
+ // formula mode in online is not usable in collaborative mode,
+ // this is a workaround for disabling formula mode in online
+ // when there is more than a single view
+ if (comphelper::LibreOfficeKit::isActive() && SfxViewShell::GetActiveShells() > 1)
+ return false;
+
if ( nCurRefDlgId )
{
SfxChildWindow* pChildWnd = lcl_GetChildWinFromAnyView( nCurRefDlgId );
diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index f222d8a51019..d1f40a7bd313 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -1733,6 +1733,32 @@ ScTabViewShell::ScTabViewShell( SfxViewFrame* pViewFrame,
//put things back as we found them
if (bInstalledScTabViewObjAsTempController)
GetViewData().GetDocShell()->GetModel()->setCurrentController(nullptr);
+
+ // formula mode in online is not usable in collaborative mode,
+ // this is a workaround for disabling formula mode in online
+ // when there is more than a single view
+ if (comphelper::LibreOfficeKit::isActive())
+ {
+ SfxViewShell* pViewShell = SfxViewShell::GetFirst();
+ // have we already one view ?
+ if (pViewShell)
+ {
+ // this view is not yet visible at this stage, so we look for not visible views, too
+ SfxViewShell* pViewShell2 = SfxViewShell::GetNext(*pViewShell, /*only visible shells*/ false);
+ // if the second view is not this one, it means that there is
+ // already more than one active view and so the formula mode
+ // has already been disabled
+ if (pViewShell2 && pViewShell2 == this)
+ {
+ ScTabViewShell* pTabViewShell = dynamic_cast<ScTabViewShell*>(pViewShell);
+ ScInputHandler* pInputHdl = pTabViewShell->GetInputHandler();
+ if (pInputHdl && pInputHdl->IsFormulaMode())
+ {
+ pInputHdl->SetMode(SC_INPUT_NONE);
+ }
+ }
+ }
+ }
}
ScTabViewShell::~ScTabViewShell()