Kaydet (Commit) b33715c0 authored tarafından Szymon Kłos's avatar Szymon Kłos

tdf#102139 : prevent the notebookbar from switching to empty tab

Change-Id: I0b463fef98d7597c9b7f22ee84701519a0f2b575
Reviewed-on: https://gerrit.libreoffice.org/33100Reviewed-by: 's avatarSzymon Kłos <eszkadev@gmail.com>
Tested-by: 's avatarSzymon Kłos <eszkadev@gmail.com>
üst 53f21cde
...@@ -68,7 +68,7 @@ protected: ...@@ -68,7 +68,7 @@ protected:
SAL_DLLPRIVATE Rectangle ImplGetTabRect( sal_uInt16 nPos, long nWidth = -1, long nHeight = -1 ); SAL_DLLPRIVATE Rectangle ImplGetTabRect( sal_uInt16 nPos, long nWidth = -1, long nHeight = -1 );
SAL_DLLPRIVATE void ImplChangeTabPage( sal_uInt16 nId, sal_uInt16 nOldId ); SAL_DLLPRIVATE void ImplChangeTabPage( sal_uInt16 nId, sal_uInt16 nOldId );
SAL_DLLPRIVATE bool ImplPosCurTabPage(); SAL_DLLPRIVATE bool ImplPosCurTabPage();
SAL_DLLPRIVATE void ImplActivateTabPage( bool bNext ); virtual void ImplActivateTabPage( bool bNext );
SAL_DLLPRIVATE void ImplShowFocus(); SAL_DLLPRIVATE void ImplShowFocus();
SAL_DLLPRIVATE void ImplDrawItem(vcl::RenderContext& rRenderContext, ImplTabItem* pItem, SAL_DLLPRIVATE void ImplDrawItem(vcl::RenderContext& rRenderContext, ImplTabItem* pItem,
const Rectangle& rCurRect, bool bFirstInGroup, const Rectangle& rCurRect, bool bFirstInGroup,
...@@ -208,6 +208,7 @@ public: ...@@ -208,6 +208,7 @@ public:
protected: protected:
virtual bool ImplPlaceTabs( long nWidth ) override; virtual bool ImplPlaceTabs( long nWidth ) override;
virtual void ImplPaint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) override; virtual void ImplPaint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) override;
virtual void ImplActivateTabPage( bool bNext ) override;
private: private:
bool bLastContextWasSupported; bool bLastContextWasSupported;
......
...@@ -2288,6 +2288,39 @@ void NotebookbarTabControl::SetCurPageId( sal_uInt16 nPageId ) ...@@ -2288,6 +2288,39 @@ void NotebookbarTabControl::SetCurPageId( sal_uInt16 nPageId )
TabControl::SetCurPageId( 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() sal_uInt16 NotebookbarTabControl::GetHeaderHeight()
{ {
return m_nHeaderHeight; return m_nHeaderHeight;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment