sc/source/ui/inc/viewdata.hxx | 1 sc/source/ui/view/tabvwsh3.cxx | 53 +++++++++++++++++++++++++++++++++++------ sc/source/ui/view/tabvwsha.cxx | 15 +++++++++-- sc/source/ui/view/viewdata.cxx | 7 +++++ 4 files changed, 66 insertions(+), 10 deletions(-)
New commits: commit 82e620ab36b23b58a1be3f56f694c438395103ee Author: Pranam Lashkari <lpra...@collabora.com> AuthorDate: Fri Aug 21 07:41:37 2020 +0530 Commit: Pranam Lashkari <lpra...@collabora.com> CommitDate: Fri Aug 28 00:16:46 2020 +0200 lok-freezepanes: fixed freeze row and column handling Added freeze row and column buttons in online UI did not work because the case for LOK was not handled Change-Id: I44315c6bc89ae02b7a8ac4c7c493ad7e8eda439e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101127 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Dennis Francis <dennis.fran...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101432 Tested-by: Jenkins Reviewed-by: Pranam Lashkari <lpra...@collabora.com> diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx index 3c5c55036f42..2c362b58c4ec 100644 --- a/sc/source/ui/inc/viewdata.hxx +++ b/sc/source/ui/inc/viewdata.hxx @@ -656,6 +656,7 @@ public: SCCOLROW GetLOKSheetFreezeIndex(bool bIsCol) const; bool SetLOKSheetFreezeIndex(const SCCOLROW nFreezeIndex, bool bIsCol, SCTAB nForTab = -1); + bool RemoveLOKFreeze(); void DeriveLOKFreezeAllSheets(); void DeriveLOKFreezeIfNeeded(SCTAB nForTab); void OverrideWithLOKFreeze(ScSplitMode& eExHSplitMode, ScSplitMode& eExVSplitMode, diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx index 80748d849c3d..f12692547c6a 100644 --- a/sc/source/ui/view/tabvwsh3.cxx +++ b/sc/source/ui/view/tabvwsh3.cxx @@ -943,15 +943,52 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) case SID_WINDOW_FIX: { - ScSplitMode eHSplit = GetViewData().GetHSplitMode(); - ScSplitMode eVSplit = GetViewData().GetVSplitMode(); - if ( eHSplit == SC_SPLIT_FIX || eVSplit == SC_SPLIT_FIX ) // remove - RemoveSplit(); + if (!comphelper::LibreOfficeKit::isActive()) + { + ScSplitMode eHSplit = GetViewData().GetHSplitMode(); + ScSplitMode eVSplit = GetViewData().GetVSplitMode(); + if ( eHSplit == SC_SPLIT_FIX || eVSplit == SC_SPLIT_FIX ) // remove + RemoveSplit(); + else + FreezeSplitters( true, SC_SPLIT_METHOD_CURSOR); // create or fixate + rReq.Done(); + InvalidateSplit(); + } else - FreezeSplitters( true, SC_SPLIT_METHOD_CURSOR); // create or fixate + { + ScViewData& rViewData = GetViewData(); + SCTAB nThisTab = rViewData.GetTabNo(); + bool bChangedX = false, bChangedY = false; + if (rViewData.GetLOKSheetFreezeIndex(true) > 0 || + rViewData.GetLOKSheetFreezeIndex(false) > 0 ) // remove freeze + { + bChangedX = rViewData.RemoveLOKFreeze(); + } // create or fixate + else + { + bChangedX = rViewData.SetLOKSheetFreezeIndex(rViewData.GetCurX(), true); // Freeze column + bChangedY = rViewData.SetLOKSheetFreezeIndex(rViewData.GetCurY(), false); // Freeze row + } - rReq.Done(); - InvalidateSplit(); + rReq.Done(); + if (bChangedX || bChangedY) + { + rBindings.Invalidate( SID_WINDOW_FIX ); + rBindings.Invalidate( SID_WINDOW_FIX_COL ); + rBindings.Invalidate( SID_WINDOW_FIX_ROW ); + // Invalidate the slot for all views on the same tab of the document. + SfxLokHelper::forEachOtherView(this, [nThisTab](ScTabViewShell* pOther) { + ScViewData& rOtherViewData = pOther->GetViewData(); + if (rOtherViewData.GetTabNo() != nThisTab) + return; + + SfxBindings& rOtherBind = rOtherViewData.GetBindings(); + rOtherBind.Invalidate( SID_WINDOW_FIX ); + rOtherBind.Invalidate( SID_WINDOW_FIX_COL ); + rOtherBind.Invalidate( SID_WINDOW_FIX_ROW ); + }); + } + } } break; @@ -975,6 +1012,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) rReq.Done(); if (bChanged) { + rBindings.Invalidate( SID_WINDOW_FIX ); rBindings.Invalidate(nSlot); // Invalidate the slot for all views on the same tab of the document. SfxLokHelper::forEachOtherView(this, [nSlot, nThisTab](ScTabViewShell* pOther) { @@ -983,6 +1021,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) return; SfxBindings& rOtherBind = rOtherViewData.GetBindings(); + rOtherBind.Invalidate( SID_WINDOW_FIX ); rOtherBind.Invalidate(nSlot); }); } diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx index 7349f95c0193..bc12783ff048 100644 --- a/sc/source/ui/view/tabvwsha.cxx +++ b/sc/source/ui/view/tabvwsha.cxx @@ -412,9 +412,18 @@ void ScTabViewShell::GetState( SfxItemSet& rSet ) break; case SID_WINDOW_FIX: - rSet.Put(SfxBoolItem(nWhich, - rViewData.GetHSplitMode() == SC_SPLIT_FIX || - rViewData.GetVSplitMode() == SC_SPLIT_FIX )); + if(!comphelper::LibreOfficeKit::isActive()) + { + rSet.Put(SfxBoolItem(nWhich, + rViewData.GetHSplitMode() == SC_SPLIT_FIX || + rViewData.GetVSplitMode() == SC_SPLIT_FIX )); + } + else + { + rSet.Put(SfxBoolItem(nWhich, + rViewData.GetLOKSheetFreezeIndex(true) > 0 || + rViewData.GetLOKSheetFreezeIndex(false) > 0 )); + } break; case SID_WINDOW_FIX_COL: diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 630dc61d2752..930a9927457c 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -4135,6 +4135,13 @@ bool ScViewData::SetLOKSheetFreezeIndex(const SCCOLROW nFreezeIndex, bool bIsCol pDoc->SetLOKFreezeRow(static_cast<SCROW>(nFreezeIndex), nForTab); } +bool ScViewData::RemoveLOKFreeze() +{ + bool colUnfreezed = SetLOKSheetFreezeIndex(0, true); + bool rowUnfreezed = SetLOKSheetFreezeIndex(0, false); + return colUnfreezed || rowUnfreezed; +} + void ScViewData::DeriveLOKFreezeAllSheets() { SCTAB nMaxTab = static_cast<SCTAB>(maTabData.size()) - 1; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits