From 97dea0d4b527e7b530c86f2952263316184470d4 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Thu, 17 Sep 2009 15:48:04 -0400 Subject: #i5560# Applied & adjusted for the latest codebase the patches from go-oo. The original patches were contributed by Daniel Watson. --- svtools/inc/tabbar.hxx | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'svtools/inc/tabbar.hxx') diff --git a/svtools/inc/tabbar.hxx b/svtools/inc/tabbar.hxx index 5261697dd8b0..35d65c037a7a 100644 --- a/svtools/inc/tabbar.hxx +++ b/svtools/inc/tabbar.hxx @@ -430,6 +430,11 @@ public: USHORT nPos = TABBAR_APPEND ); void RemovePage( USHORT nPageId ); void MovePage( USHORT nPageId, USHORT nNewPos ); + + Color GetTabBgColor( USHORT nPageId ) const; + void SetTabBgColor( USHORT nPageId, const Color& aTabBgColor ); + BOOL IsDefaultTabBgColor( USHORT nPageId ); + void Clear(); void EnablePage( USHORT nPageId, BOOL bEnable = TRUE ); -- cgit v1.2.3 From 384eadc23010eba913416b04d0bc87f9411df0f1 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Tue, 23 Feb 2010 16:13:04 -0500 Subject: calctabcolor: Use static constant values instead of macro define for more type safety. --- svtools/inc/tabbar.hxx | 10 ++++---- svtools/source/control/tabbar.cxx | 51 +++++++++++++++++++++------------------ 2 files changed, 32 insertions(+), 29 deletions(-) (limited to 'svtools/inc/tabbar.hxx') diff --git a/svtools/inc/tabbar.hxx b/svtools/inc/tabbar.hxx index 35d65c037a7a..a19790a68d55 100644 --- a/svtools/inc/tabbar.hxx +++ b/svtools/inc/tabbar.hxx @@ -323,9 +323,6 @@ typedef USHORT TabBarPageBits; // - TabBar-Types - // ---------------- -#define TABBAR_APPEND ((USHORT)0xFFFF) -#define TABBAR_PAGE_NOTFOUND ((USHORT)0xFFFF) - #define TABBAR_RENAMING_YES ((long)TRUE) #define TABBAR_RENAMING_NO ((long)FALSE) #define TABBAR_RENAMING_CANCEL ((long)2) @@ -403,6 +400,9 @@ private: DECL_DLLPRIVATE_LINK( ImplClickHdl, ImplTabButton* ); public: + static const sal_uInt16 APPEND; + static const sal_uInt16 PAGE_NOT_FOUND; + TabBar( Window* pParent, WinBits nWinStyle = WB_STDTABBAR ); virtual ~TabBar(); @@ -427,7 +427,7 @@ public: void InsertPage( USHORT nPageId, const XubString& rText, TabBarPageBits nBits = 0, - USHORT nPos = TABBAR_APPEND ); + USHORT nPos = TabBar::APPEND ); void RemovePage( USHORT nPageId ); void MovePage( USHORT nPageId, USHORT nNewPos ); @@ -461,7 +461,7 @@ public: void SelectPage( USHORT nPageId, BOOL bSelect = TRUE ); void SelectPageRange( BOOL bSelect = FALSE, USHORT nStartPos = 0, - USHORT nEndPos = TABBAR_APPEND ); + USHORT nEndPos = TabBar::APPEND ); USHORT GetSelectPage( USHORT nSelIndex = 0 ) const; USHORT GetSelectPageCount() const; BOOL IsPageSelected( USHORT nPageId ) const; diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx index 50618901798c..112787dd3f00 100644 --- a/svtools/source/control/tabbar.cxx +++ b/svtools/source/control/tabbar.cxx @@ -357,6 +357,9 @@ struct TabBar_Impl // ======================================================================= +const sal_uInt16 TabBar::APPEND = ::std::numeric_limits::max(); +const sal_uInt16 TabBar::PAGE_NOT_FOUND = ::std::numeric_limits::max(); + void TabBar::ImplInit( WinBits nWinStyle ) { mpItemList = new ImplTabBarList; @@ -1594,7 +1597,7 @@ void TabBar::InsertPage( USHORT nPageId, const XubString& rText, TabBarPageBits nBits, USHORT nPos ) { DBG_ASSERT( nPageId, "TabBar::InsertPage(): PageId == 0" ); - DBG_ASSERT( GetPagePos( nPageId ) == TABBAR_PAGE_NOTFOUND, + DBG_ASSERT( GetPagePos( nPageId ) == PAGE_NOT_FOUND, "TabBar::InsertPage(): PageId already exists" ); DBG_ASSERT( nBits <= TPB_SPECIAL, "TabBar::InsertPage(): nBits is wrong" ); @@ -1620,7 +1623,7 @@ Color TabBar::GetTabBgColor( USHORT nPageId ) const { USHORT nPos = GetPagePos( nPageId ); - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) return mpItemList->GetObject( nPos )->maTabBgColor; else return Color( COL_AUTO ); @@ -1630,7 +1633,7 @@ void TabBar::SetTabBgColor( USHORT nPageId, const Color& aTabBgColor ) { USHORT nPos = GetPagePos( nPageId ); ImplTabBarItem* pItem; - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) { pItem = mpItemList->GetObject( nPos ); // TODO: Need to take the text color specification out of this code! @@ -1657,7 +1660,7 @@ void TabBar::RemovePage( USHORT nPageId ) USHORT nPos = GetPagePos( nPageId ); // Existiert Item - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) { if ( mnCurPageId == nPageId ) mnCurPageId = 0; @@ -1692,7 +1695,7 @@ void TabBar::MovePage( USHORT nPageId, USHORT nNewPos ) return; // Existiert Item - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) { // TabBar-Item in der Liste verschieben ImplTabBarItem* pItem = mpItemList->Remove( nPos ); @@ -1730,7 +1733,7 @@ void TabBar::Clear() if ( IsReallyVisible() && IsUpdateMode() ) Invalidate(); - CallEventListeners( VCLEVENT_TABBAR_PAGEREMOVED, (void*) TABBAR_PAGE_NOTFOUND ); + CallEventListeners( VCLEVENT_TABBAR_PAGEREMOVED, (void*) PAGE_NOT_FOUND ); } // ----------------------------------------------------------------------- @@ -1739,7 +1742,7 @@ void TabBar::EnablePage( USHORT nPageId, BOOL bEnable ) { USHORT nPos = GetPagePos( nPageId ); - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) { ImplTabBarItem* pItem = mpItemList->GetObject( nPos ); @@ -1762,7 +1765,7 @@ BOOL TabBar::IsPageEnabled( USHORT nPageId ) const { USHORT nPos = GetPagePos( nPageId ); - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) return mpItemList->GetObject( nPos )->mbEnable; else return FALSE; @@ -1774,7 +1777,7 @@ void TabBar::SetPageBits( USHORT nPageId, TabBarPageBits nBits ) { USHORT nPos = GetPagePos( nPageId ); - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) { ImplTabBarItem* pItem = mpItemList->GetObject( nPos ); @@ -1795,7 +1798,7 @@ TabBarPageBits TabBar::GetPageBits( USHORT nPageId ) const { USHORT nPos = GetPagePos( nPageId ); - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) return mpItemList->GetObject( nPos )->mnBits; else return FALSE; @@ -1832,7 +1835,7 @@ USHORT TabBar::GetPagePos( USHORT nPageId ) const pItem = mpItemList->Next(); } - return TABBAR_PAGE_NOTFOUND; + return PAGE_NOT_FOUND; } // ----------------------------------------------------------------------- @@ -1857,7 +1860,7 @@ Rectangle TabBar::GetPageRect( USHORT nPageId ) const { USHORT nPos = GetPagePos( nPageId ); - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) return mpItemList->GetObject( nPos )->maRect; else return Rectangle(); @@ -1870,7 +1873,7 @@ void TabBar::SetCurPageId( USHORT nPageId ) USHORT nPos = GetPagePos( nPageId ); // Wenn Item nicht existiert, dann nichts machen - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) { // Wenn sich aktuelle Page nicht geaendert hat, dann muessen wir // jetzt nichts mehr machen @@ -1962,7 +1965,7 @@ void TabBar::MakeVisible( USHORT nPageId ) USHORT nPos = GetPagePos( nPageId ); // Wenn Item nicht existiert, dann nichts machen - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) { if ( nPos < mnFirstPos ) SetFirstPageId( nPageId ); @@ -2011,7 +2014,7 @@ void TabBar::SetFirstPageId( USHORT nPageId ) USHORT nPos = GetPagePos( nPageId ); // Wenn Item nicht existiert, dann FALSE zurueckgeben - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) { if ( nPos != mnFirstPos ) { @@ -2045,7 +2048,7 @@ void TabBar::SelectPage( USHORT nPageId, BOOL bSelect ) { USHORT nPos = GetPagePos( nPageId ); - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) { ImplTabBarItem* pItem = mpItemList->GetObject( nPos ); @@ -2126,7 +2129,7 @@ USHORT TabBar::GetSelectPageCount() const BOOL TabBar::IsPageSelected( USHORT nPageId ) const { USHORT nPos = GetPagePos( nPageId ); - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) return mpItemList->GetObject( nPos )->mbSelect; else return FALSE; @@ -2137,7 +2140,7 @@ BOOL TabBar::IsPageSelected( USHORT nPageId ) const BOOL TabBar::StartEditMode( USHORT nPageId ) { USHORT nPos = GetPagePos( nPageId ); - if ( mpEdit || (nPos == TABBAR_PAGE_NOTFOUND) || (mnLastOffX < 8) ) + if ( mpEdit || (nPos == PAGE_NOT_FOUND) || (mnLastOffX < 8) ) return FALSE; mnEditId = nPageId; @@ -2358,7 +2361,7 @@ void TabBar::SetSelectTextColor( const Color& rColor ) void TabBar::SetPageText( USHORT nPageId, const XubString& rText ) { USHORT nPos = GetPagePos( nPageId ); - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) { mpItemList->GetObject( nPos )->maText = rText; mbSizeFormat = TRUE; @@ -2376,7 +2379,7 @@ void TabBar::SetPageText( USHORT nPageId, const XubString& rText ) XubString TabBar::GetPageText( USHORT nPageId ) const { USHORT nPos = GetPagePos( nPageId ); - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) return mpItemList->GetObject( nPos )->maText; else return XubString(); @@ -2387,7 +2390,7 @@ XubString TabBar::GetPageText( USHORT nPageId ) const void TabBar::SetHelpText( USHORT nPageId, const XubString& rText ) { USHORT nPos = GetPagePos( nPageId ); - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) mpItemList->GetObject( nPos )->maHelpText = rText; } @@ -2396,7 +2399,7 @@ void TabBar::SetHelpText( USHORT nPageId, const XubString& rText ) XubString TabBar::GetHelpText( USHORT nPageId ) const { USHORT nPos = GetPagePos( nPageId ); - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) { ImplTabBarItem* pItem = mpItemList->GetObject( nPos ); if ( !pItem->maHelpText.Len() && pItem->mnHelpId ) @@ -2417,7 +2420,7 @@ XubString TabBar::GetHelpText( USHORT nPageId ) const void TabBar::SetHelpId( USHORT nPageId, ULONG nHelpId ) { USHORT nPos = GetPagePos( nPageId ); - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) mpItemList->GetObject( nPos )->mnHelpId = nHelpId; } @@ -2426,7 +2429,7 @@ void TabBar::SetHelpId( USHORT nPageId, ULONG nHelpId ) ULONG TabBar::GetHelpId( USHORT nPageId ) const { USHORT nPos = GetPagePos( nPageId ); - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) return mpItemList->GetObject( nPos )->mnHelpId; else return 0; -- cgit v1.2.3