summaryrefslogtreecommitdiff
path: root/sc/source/ui/view/tabvwsh3.cxx
diff options
context:
space:
mode:
authorDennis Francis <dennis.francis@collabora.com>2020-07-15 15:55:45 +0530
committerDennis Francis <dennis.francis@collabora.com>2020-07-24 15:19:40 +0200
commit7b4802070ac6fb930255536bf3ed2c52428b4181 (patch)
tree9fa0eb65a86b19cb2aea0d5cbc70b1f75ca33341 /sc/source/ui/view/tabvwsh3.cxx
parent4948b14eedb79a1408e20ab477929fe062d13c27 (diff)
lok-freezepanes: Generalize FreezePanes* uno-commands...
to allow an integer parameter as the row/column index of the freeze and use them to set/get freeze indices (row/column) from the lok clients. The behaviour of the exisiting freeze/split-panes controls in desktop Calc is not affected, but new menu/notebookbar options can be added for freezing on a specific row/column in a follow-up commit. For now, the freeze-panes are shared between all views for each tab of the spreadsheet. "Private" freeze-panes support can also be added without much difficulty (for this we need another uno command for the private/shared flag, but that can be in a separate commit). Notes regarding compatibility: Since Online-Calc has support only for the freeze-panes functionality presently, any pre-exisiting 'real splits' in the spreadsheet (created using the native-desktop Calc or alternatives) are converted to equivalent 'freezes' on import, but on export, such 'freezes' are re-converted and written as 'real splits'. In case the spreadsheet has 'freezes' on import, they are used/exported as such. In short, the type of sheet-window splits in the document are preserved. Change-Id: Ia990616f5cedfb2b5db820770c17ec7e209f0e48 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99347 Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> Reviewed-by: Dennis Francis <dennis.francis@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sc/source/ui/view/tabvwsh3.cxx')
-rw-r--r--sc/source/ui/view/tabvwsh3.cxx47
1 files changed, 37 insertions, 10 deletions
diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx
index 5601804260f1..2a883642b2da 100644
--- a/sc/source/ui/view/tabvwsh3.cxx
+++ b/sc/source/ui/view/tabvwsh3.cxx
@@ -50,7 +50,9 @@
#include <svx/zoomslideritem.hxx>
#include <svx/svxdlg.hxx>
+#include <comphelper/lok.hxx>
#include <comphelper/string.hxx>
+#include <sfx2/lokhelper.hxx>
#include <scabstdlg.hxx>
namespace
@@ -940,18 +942,43 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
break;
case SID_WINDOW_FIX_COL:
- {
- FreezeSplitters( true, SC_SPLIT_METHOD_FIRST_COL);
- rReq.Done();
- InvalidateSplit();
- }
- break;
-
case SID_WINDOW_FIX_ROW:
{
- FreezeSplitters( true, SC_SPLIT_METHOD_FIRST_ROW);
- rReq.Done();
- InvalidateSplit();
+ bool bIsCol = (nSlot == SID_WINDOW_FIX_COL);
+ sal_Int32 nFreezeIndex = 1;
+ if (const SfxInt32Item* pItem = rReq.GetArg<SfxInt32Item>(nSlot))
+ {
+ nFreezeIndex = pItem->GetValue();
+ if (nFreezeIndex < 0)
+ nFreezeIndex = 0;
+ }
+
+ if (comphelper::LibreOfficeKit::isActive())
+ {
+ ScViewData& rViewData = GetViewData();
+ SCTAB nThisTab = rViewData.GetTabNo();
+ bool bChanged = rViewData.SetLOKSheetFreezeIndex(nFreezeIndex, bIsCol);
+ rReq.Done();
+ if (bChanged)
+ {
+ rBindings.Invalidate(nSlot);
+ // Invalidate the slot for all views on the same tab of the document.
+ SfxLokHelper::forEachOtherView(this, [nSlot, nThisTab](ScTabViewShell* pOther) {
+ ScViewData& rOtherViewData = pOther->GetViewData();
+ if (rOtherViewData.GetTabNo() != nThisTab)
+ return;
+
+ SfxBindings& rOtherBind = rOtherViewData.GetBindings();
+ rOtherBind.Invalidate(nSlot);
+ });
+ }
+ }
+ else
+ {
+ FreezeSplitters( true, bIsCol ? SC_SPLIT_METHOD_COL : SC_SPLIT_METHOD_ROW, nFreezeIndex);
+ rReq.Done();
+ InvalidateSplit();
+ }
}
break;