summaryrefslogtreecommitdiff
path: root/sc/source/ui/view/tabview.cxx
diff options
context:
space:
mode:
authorJustin Luth <jluth@mail.com>2022-11-01 19:33:33 -0400
committerEike Rathke <erack@redhat.com>2022-11-07 22:22:33 +0100
commite6bc90aa8a959e08abf4b5c10d793ff9a549efe4 (patch)
tree07c7f8bf1bbb17c9811bce3c09a149cf1069d1a7 /sc/source/ui/view/tabview.cxx
parentcbfac11330882c7d0a817b6c37a08b2ace2b66f4 (diff)
tdf#112641 sc: always allow freezing at cell A1
For some good reasons, freezing rows and columns doesn't work unless that cell is currently visible, and that is almost guaranteed anyway since the hisorical way of doing it was at the cursor. However, since LO 5.2 there are menu and UNO commands to freeze the first row and the first column. It would be nice if these would work regardless of where you are in the spreadsheet (and keep you at that position too). [If there is already a SPLIT (not freeze), then the bottom right quadrant is still the "position" that is maintained.] [This "works" if the first row/column is hidden. When unhidden, the freeze will be in effect. I assume that is reasonable and doesn't need to be avoided for any reason.] Change-Id: Iddc5d63adaad7ecfe6b5fb9b60ff3ec6274b0756 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142128 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com> Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc/source/ui/view/tabview.cxx')
-rw-r--r--sc/source/ui/view/tabview.cxx22
1 files changed, 21 insertions, 1 deletions
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 0371b9f40940..94a9aa144ad6 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -1932,6 +1932,7 @@ void ScTabView::FreezeSplitters( bool bFreeze, SplitMethod eSplitMethod, SCCOLRO
vcl::Window* pWin = pGridWin[ePos];
bool bLayoutRTL = aViewData.GetDocument().IsLayoutRTL( aViewData.GetTabNo() );
+ bool bUpdateFix = false;
if ( bFreeze )
{
@@ -2015,6 +2016,15 @@ void ScTabView::FreezeSplitters( bool bFreeze, SplitMethod eSplitMethod, SCCOLRO
aViewData.SetPosY(SC_SPLIT_TOP, nTopPos);
aViewData.SetPosY(SC_SPLIT_BOTTOM, nBottomPos);
}
+ else if (nPosY == 1 && eSplitMethod == SC_SPLIT_METHOD_ROW)
+ {
+ // Freeze first row, but row 1 is not visible on screen now == special handling
+ aViewData.SetVSplitMode(SC_SPLIT_FIX);
+ aViewData.SetFixPosY(nPosY);
+
+ aViewData.SetPosY(SC_SPLIT_TOP, 0);
+ bUpdateFix = true;
+ }
else
aViewData.SetVSplitMode(SC_SPLIT_NONE);
}
@@ -2040,6 +2050,16 @@ void ScTabView::FreezeSplitters( bool bFreeze, SplitMethod eSplitMethod, SCCOLRO
aViewData.SetPosX(SC_SPLIT_LEFT, nLeftPos);
aViewData.SetPosX(SC_SPLIT_RIGHT, nRightPos);
}
+ else if (nPosX == 1 && eSplitMethod == SC_SPLIT_METHOD_COL)
+ {
+ // Freeze first column, but col A is not visible on screen now == special handling
+ aViewData.SetHSplitMode(SC_SPLIT_FIX);
+ aViewData.SetFixPosX(nPosX);
+
+ aViewData.SetPosX(SC_SPLIT_RIGHT, aViewData.GetPosX(SC_SPLIT_LEFT));
+ aViewData.SetPosX(SC_SPLIT_LEFT, 0);
+ bUpdateFix = true;
+ }
else
aViewData.SetHSplitMode( SC_SPLIT_NONE );
}
@@ -2059,7 +2079,7 @@ void ScTabView::FreezeSplitters( bool bFreeze, SplitMethod eSplitMethod, SCCOLRO
p->SetMapMode( p->GetDrawMapMode() );
SetNewVisArea();
- RepeatResize(false);
+ RepeatResize(bUpdateFix);
UpdateShow();
PaintLeft();