diff options
author | Szymon Kłos <eszkadev@gmail.com> | 2017-01-15 20:20:26 +0100 |
---|---|---|
committer | Szymon Kłos <eszkadev@gmail.com> | 2017-01-16 14:07:24 +0000 |
commit | b33715c00ea3a20e219d80845e72a2b37ba6c8cc (patch) | |
tree | f692d1f303fdd5ed2f99ec7ab4b23975c6d6a5ab /vcl | |
parent | 53f21cde330de4f0ad054a106e7a15654d79b7ee (diff) |
tdf#102139 : prevent the notebookbar from switching to empty tab
Change-Id: I0b463fef98d7597c9b7f22ee84701519a0f2b575
Reviewed-on: https://gerrit.libreoffice.org/33100
Reviewed-by: Szymon Kłos <eszkadev@gmail.com>
Tested-by: Szymon Kłos <eszkadev@gmail.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/control/tabctrl.cxx | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index ee31141867f6..740628bf5570 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -2288,6 +2288,39 @@ void NotebookbarTabControl::SetCurPageId( sal_uInt16 nPageId ) TabControl::SetCurPageId( nPageId ); } +void NotebookbarTabControl::ImplActivateTabPage( bool bNext ) +{ + sal_uInt16 nCurPos = GetPagePos( GetCurPageId() ); + + if ( bNext && nCurPos + 1 < GetPageCount() ) + { + sal_uInt16 nOldPos = nCurPos; + nCurPos++; + + ImplTabItem* pItem = &mpTabCtrlData->maItemList[nCurPos]; + while ( !pItem->mbEnabled && nCurPos + 1 < GetPageCount()) + { + nCurPos++; + pItem = &mpTabCtrlData->maItemList[nCurPos]; + } + + if ( !pItem->mbEnabled ) + nCurPos = nOldPos; + } + else if ( !bNext && nCurPos ) + { + nCurPos--; + ImplTabItem* pItem = &mpTabCtrlData->maItemList[nCurPos]; + while ( nCurPos && !pItem->mbEnabled ) + { + nCurPos--; + pItem = &mpTabCtrlData->maItemList[nCurPos]; + } + } + + SelectTabPage( TabControl::GetPageId( nCurPos ) ); +} + sal_uInt16 NotebookbarTabControl::GetHeaderHeight() { return m_nHeaderHeight; |