summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2024-11-21 09:49:34 +0100
committerMichael Weghorn <m.weghorn@posteo.de>2024-11-22 00:15:39 +0100
commit11e857374fb44a1a24fb07948e3ee300f09b6a11 (patch)
tree255e42aa38144faa8621f12afeba038c294b9f61 /vcl
parent08c315e7b7a2198b36f956245453fad13f1ac6cc (diff)
vcl: Simplify NotebookbarTabControlBase::ImplActivateTabPage a bit
Only set new value for nCurPos if there's a valid new page instead of always doing it and then reverting back to the old value. Change-Id: I25f56e34da6260ee7c586fa25a88ff813f7c26f3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176926 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/control/tabctrl.cxx18
1 files changed, 7 insertions, 11 deletions
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index a4f968a5a5ab..0cf5b5eac808 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -2282,31 +2282,27 @@ static bool lcl_isValidPage(const ImplTabItem& rItem)
void NotebookbarTabControlBase::ImplActivateTabPage( bool bNext )
{
- const sal_uInt16 nOldPos = GetPagePos(GetCurPageId());
- bool bFound = false;
- sal_Int32 nCurPos = nOldPos;
+ sal_Int32 nCurPos = GetPagePos(GetCurPageId());
if (bNext)
{
- for (nCurPos++; nCurPos < GetPageCount(); nCurPos++)
- if (lcl_isValidPage(mpTabCtrlData->maItemList[nCurPos]))
+ for (sal_Int32 nPos = nCurPos + 1; nPos < GetPageCount(); nPos++)
+ if (lcl_isValidPage(mpTabCtrlData->maItemList[nPos]))
{
- bFound = true;
+ nCurPos = nPos;
break;
}
}
else
{
- for (nCurPos--; nCurPos >= 0; nCurPos--)
- if (lcl_isValidPage(mpTabCtrlData->maItemList[nCurPos]))
+ for (sal_Int32 nPos = nCurPos - 1; nPos >= 0; nPos--)
+ if (lcl_isValidPage(mpTabCtrlData->maItemList[nPos]))
{
- bFound = true;
+ nCurPos = nPos;
break;
}
}
- if (!bFound)
- nCurPos = nOldPos;
SelectTabPage( TabControl::GetPageId( nCurPos ) );
}