summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorMarco Cecchetti <marco.cecchetti@collabora.com>2017-09-30 17:51:26 +0200
committerJan Holesovsky <kendy@collabora.com>2017-10-03 14:14:07 +0200
commitc7d2de2905d53d12b186f577260fd95460f4eea5 (patch)
tree8d82f9bfa9742546668b0ce43dc611abd67becb0 /sfx2
parentb8ad0fc55baa69724e90dc3bb7d96fbd7149b163 (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/43036 Reviewed-by: Jan Holesovsky <kendy@collabora.com> Tested-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'sfx2')
-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 e763676167d6..25278f8bd2bf 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -1333,6 +1333,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
(