summaryrefslogtreecommitdiff
path: root/sfx2/source
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 /sfx2/source
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 'sfx2/source')
-rw-r--r--sfx2/source/view/viewsh.cxx31
1 files changed, 31 insertions, 0 deletions
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 61a8d822a20c..107a27ba6899 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -1308,6 +1308,37 @@ void SfxViewShell::WriteUserDataSequence ( uno::Sequence < beans::PropertyValue
}
+// returns the number of current available shells of spec. type viewing the specified doc.
+size_t SfxViewShell::GetActiveShells ( bool bOnlyVisible )
+{
+ size_t nShells = 0;
+
+ // search for a SfxViewShell of the specified type
+ SfxViewShellArr_Impl &rShells = SfxGetpApp()->GetViewShells_Impl();
+ SfxViewFrameArr_Impl &rFrames = SfxGetpApp()->GetViewFrames_Impl();
+ for (SfxViewShell* pShell : rShells)
+ {
+ if ( pShell )
+ {
+ // sometimes dangling SfxViewShells exist that point to a dead SfxViewFrame
+ // these ViewShells shouldn't be accessible anymore
+ // a destroyed ViewFrame is not in the ViewFrame array anymore, so checking this array helps
+ for (SfxViewFrame* pFrame : rFrames)
+ {
+ if ( pFrame == pShell->GetViewFrame() )
+ {
+ // only ViewShells with a valid ViewFrame will be returned
+ if ( !bOnlyVisible || pFrame->IsVisible() )
+ ++nShells;
+ }
+ }
+ }
+ }
+
+ return nShells;
+}
+
+
// returns the first shell of spec. type viewing the specified doc.
SfxViewShell* SfxViewShell::GetFirst
(