summaryrefslogtreecommitdiff
path: root/sc/source/ui/view/tabview.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/tabview.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/tabview.cxx')
-rw-r--r--sc/source/ui/view/tabview.cxx31
1 files changed, 17 insertions, 14 deletions
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 8ac7f7bb8e36..5e334cb79522 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -1907,8 +1907,11 @@ Point ScTabView::GetMousePosPixel()
return aPos;
}
-void ScTabView::FreezeSplitters( bool bFreeze, SplitMethod eSplitMetod)
+void ScTabView::FreezeSplitters( bool bFreeze, SplitMethod eSplitMethod, SCCOLROW nFreezeIndex)
{
+ if ((eSplitMethod == SC_SPLIT_METHOD_COL || eSplitMethod == SC_SPLIT_METHOD_ROW) && nFreezeIndex < 0)
+ nFreezeIndex = 0;
+
ScSplitMode eOldH = aViewData.GetHSplitMode();
ScSplitMode eOldV = aViewData.GetVSplitMode();
@@ -1929,10 +1932,10 @@ void ScTabView::FreezeSplitters( bool bFreeze, SplitMethod eSplitMetod)
SCROW nPosY = 1;
if (eOldV != SC_SPLIT_NONE || eOldH != SC_SPLIT_NONE)
{
- if ( eOldV != SC_SPLIT_NONE && (eSplitMetod == SC_SPLIT_METHOD_FIRST_ROW || eSplitMetod == SC_SPLIT_METHOD_CURSOR))
+ if ( eOldV != SC_SPLIT_NONE && (eSplitMethod == SC_SPLIT_METHOD_ROW || eSplitMethod == SC_SPLIT_METHOD_CURSOR))
aSplit.setY( aViewData.GetVSplitPos() - aWinStart.Y() );
- if ( eOldH != SC_SPLIT_NONE && (eSplitMetod == SC_SPLIT_METHOD_FIRST_COL || eSplitMetod == SC_SPLIT_METHOD_CURSOR))
+ if ( eOldH != SC_SPLIT_NONE && (eSplitMethod == SC_SPLIT_METHOD_COL || eSplitMethod == SC_SPLIT_METHOD_CURSOR))
{
long nSplitPos = aViewData.GetHSplitPos();
if ( bLayoutRTL )
@@ -1944,28 +1947,28 @@ void ScTabView::FreezeSplitters( bool bFreeze, SplitMethod eSplitMetod)
bool bLeft;
bool bTop;
aViewData.GetMouseQuadrant( aSplit, ePos, nPosX, nPosY, bLeft, bTop );
- if (eSplitMetod == SC_SPLIT_METHOD_FIRST_COL)
- nPosX = 1;
+ if (eSplitMethod == SC_SPLIT_METHOD_COL)
+ nPosX = static_cast<SCCOL>(nFreezeIndex);
else if (!bLeft)
++nPosX;
- if (eSplitMetod == SC_SPLIT_METHOD_FIRST_ROW)
- nPosY = 1;
+ if (eSplitMethod == SC_SPLIT_METHOD_ROW)
+ nPosY = static_cast<SCROW>(nFreezeIndex);
else if (!bTop)
++nPosY;
}
else
{
- switch(eSplitMetod)
+ switch(eSplitMethod)
{
- case SC_SPLIT_METHOD_FIRST_ROW:
+ case SC_SPLIT_METHOD_ROW:
{
nPosX = 0;
- nPosY = 1;
+ nPosY = static_cast<SCROW>(nFreezeIndex);
}
break;
- case SC_SPLIT_METHOD_FIRST_COL:
+ case SC_SPLIT_METHOD_COL:
{
- nPosX = 1;
+ nPosX = static_cast<SCCOL>(nFreezeIndex);
nPosY = 0;
}
break;
@@ -1983,7 +1986,7 @@ void ScTabView::FreezeSplitters( bool bFreeze, SplitMethod eSplitMetod)
SCCOL nLeftPos = aViewData.GetPosX(SC_SPLIT_LEFT);
SCCOL nRightPos = nPosX;
- if (eSplitMetod == SC_SPLIT_METHOD_FIRST_ROW || eSplitMetod == SC_SPLIT_METHOD_CURSOR)
+ if (eSplitMethod == SC_SPLIT_METHOD_ROW || eSplitMethod == SC_SPLIT_METHOD_CURSOR)
{
if (eOldV != SC_SPLIT_NONE)
{
@@ -2005,7 +2008,7 @@ void ScTabView::FreezeSplitters( bool bFreeze, SplitMethod eSplitMetod)
aViewData.SetVSplitMode( SC_SPLIT_NONE );
}
- if (eSplitMetod == SC_SPLIT_METHOD_FIRST_COL || eSplitMetod == SC_SPLIT_METHOD_CURSOR)
+ if (eSplitMethod == SC_SPLIT_METHOD_COL || eSplitMethod == SC_SPLIT_METHOD_CURSOR)
{
if (eOldH != SC_SPLIT_NONE)
{