tdf#160580: make cycling from first to last tab configurable

This introduces Office/Calc/Input/CycleNextPrevSheetTab
boolean property, that controls the behavior implemented
in commit 552170c9c8
(tdf#156311 Cycling through tabs in Calc, 2023-08-16).

Change-Id: I0510743b4ab6d92488ba73a7b8d5b83be9586b2f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174745
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
This commit is contained in:
Mike Kaganski 2024-10-09 23:19:20 +05:00
parent 963255acd4
commit 5daac16a03
2 changed files with 21 additions and 4 deletions

View file

@ -721,6 +721,13 @@
</info>
<value>true</value>
</prop>
<prop oor:name="WrapNextPrevSheetTab" oor:type="xs:boolean" oor:nillable="false">
<info>
<desc>When switching to next / previous sheet, wrap from last to first tab (and vice versa)</desc>
<label>When switching to next / previous sheet, wrap from last to first tab (and vice versa)</label>
</info>
<value>true</value>
</prop>
<prop oor:name="LastFunctions" oor:type="oor:int-list" oor:nillable="false">
<info>
<desc>Specifies the functions last used.</desc>

View file

@ -1834,25 +1834,35 @@ void ScTabView::SelectNextTab( short nDir, bool bExtendSelection )
ScDocument& rDoc = aViewData.GetDocument();
SCTAB nTab = aViewData.GetTabNo();
SCTAB nNextTab = nTab;
SCTAB nCount = rDoc.GetTableCount();
if (nDir < 0)
{
do
{
--nNextTab;
if (nNextTab < 0)
nNextTab = rDoc.GetTableCount();
{
if (officecfg::Office::Calc::Input::WrapNextPrevSheetTab::get())
nNextTab = nCount;
else
return;
}
if (rDoc.IsVisible(nNextTab))
break;
} while (nNextTab != nTab);
}
if (nDir > 0)
else // nDir > 0
{
SCTAB nCount = rDoc.GetTableCount();
do
{
++nNextTab;
if (nNextTab >= nCount)
{
if (officecfg::Office::Calc::Input::WrapNextPrevSheetTab::get())
nNextTab = 0;
else
return;
}
if (rDoc.IsVisible(nNextTab))
break;
} while (nNextTab != nTab);