diff options
-rw-r--r-- | include/svtools/tabbar.hxx | 25 | ||||
-rw-r--r-- | sc/source/ui/view/tabcont.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/view/drviews1.cxx | 16 | ||||
-rw-r--r-- | sd/source/ui/view/drviewsb.cxx | 8 | ||||
-rw-r--r-- | svtools/source/control/tabbar.cxx | 10 |
5 files changed, 34 insertions, 29 deletions
diff --git a/include/svtools/tabbar.hxx b/include/svtools/tabbar.hxx index 766ac7d4744f..48ac6d1f679f 100644 --- a/include/svtools/tabbar.hxx +++ b/include/svtools/tabbar.hxx @@ -23,6 +23,7 @@ #include <svtools/svtdllapi.h> #include <tools/link.hxx> #include <vcl/window.hxx> +#include <o3tl/typed_flags_set.hxx> #include <memory> #include <vector> @@ -49,13 +50,13 @@ Allowed PageBits Setting page bits modify the display attributes of the tab name -TPB_DISPLAY_NAME_BLUE +TabBarPageBits::Blue - Display tab name in light blue, used in draw for invisible layers and in calc for scenario pages -TPB_DISPLAY_NAME_ITALIC +TabBarPageBits::Italic - Display tab name italic, used in draw for locked layers -TPB_DISPLAY_NAME_UNDERLINE +TabBarPageBits::Underline - Display tab name underlined, used in draw for non-printable layers @@ -276,15 +277,19 @@ class Button; // Page bits -typedef sal_uInt16 TabBarPageBits; - -#define TPB_DISPLAY_NAME_BLUE ((TabBarPageBits)0x0001) -#define TPB_DISPLAY_NAME_ITALIC ((TabBarPageBits)0x0002) -#define TPB_DISPLAY_NAME_UNDERLINE ((TabBarPageBits)0x0004) +enum class TabBarPageBits { + NONE = 0x00, + Blue = 0x01, + Italic = 0x02, + Underline = 0x04, +}; +namespace o3tl { + template<> struct typed_flags<TabBarPageBits> : is_typed_flags<TabBarPageBits, 0x07> {}; +}; // interface checks only, do not use in regular control flow -#define TPB_DISPLAY_NAME_ALLFLAGS ((TabBarPageBits)(TPB_DISPLAY_NAME_BLUE | TPB_DISPLAY_NAME_ITALIC | TPB_DISPLAY_NAME_UNDERLINE)) +#define TPB_DISPLAY_NAME_ALLFLAGS (TabBarPageBits::Blue | TabBarPageBits::Italic | TabBarPageBits::Underline) // - TabBar-Types - used in TabBar::AllowRenaming @@ -403,7 +408,7 @@ public: virtual void Mirror(); void InsertPage( sal_uInt16 nPageId, const OUString& rText, - TabBarPageBits nBits = 0, + TabBarPageBits nBits = TabBarPageBits::NONE, sal_uInt16 nPos = TabBar::APPEND ); void RemovePage( sal_uInt16 nPageId ); void MovePage( sal_uInt16 nPageId, sal_uInt16 nNewPos ); diff --git a/sc/source/ui/view/tabcont.cxx b/sc/source/ui/view/tabcont.cxx index 93a77fe2d176..c71cd4458581 100644 --- a/sc/source/ui/view/tabcont.cxx +++ b/sc/source/ui/view/tabcont.cxx @@ -58,7 +58,7 @@ ScTabControl::ScTabControl( vcl::Window* pParent, ScViewData* pData ) if (pDoc->GetName(i,aString)) { if ( pDoc->IsScenario(i) ) - InsertPage( static_cast<sal_uInt16>(i)+1, aString, TPB_DISPLAY_NAME_BLUE); + InsertPage( static_cast<sal_uInt16>(i)+1, aString, TabBarPageBits::Blue); else InsertPage( static_cast<sal_uInt16>(i)+1, aString ); if ( !pDoc->IsDefaultTabBgColor(i) ) @@ -365,7 +365,7 @@ void ScTabControl::UpdateStatus() if (pDoc->GetName(i,aString)) { if ( pDoc->IsScenario(i) ) - InsertPage(static_cast<sal_uInt16>(i)+1, aString, TPB_DISPLAY_NAME_BLUE); + InsertPage(static_cast<sal_uInt16>(i)+1, aString, TabBarPageBits::Blue); else InsertPage( static_cast<sal_uInt16>(i)+1, aString ); if ( !pDoc->IsDefaultTabBgColor(i) ) diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx index 14a873323738..02caf3eaa473 100644 --- a/sd/source/ui/view/drviews1.cxx +++ b/sd/source/ui/view/drviews1.cxx @@ -1167,22 +1167,22 @@ void DrawViewShell::ResetActualLayer() // Set page bits for modified tab name display - TabBarPageBits nBits = 0; + TabBarPageBits nBits = TabBarPageBits::NONE; SdrPageView* pPV = mpDrawView->GetSdrPageView(); if (pPV) { if (!pPV->IsLayerVisible(aName)) { - nBits |= TPB_DISPLAY_NAME_BLUE; + nBits |= TabBarPageBits::Blue; } if (pPV->IsLayerLocked(aName)) { - nBits |= TPB_DISPLAY_NAME_ITALIC; + nBits |= TabBarPageBits::Italic; } if (!pPV->IsLayerPrintable(aName)) { - nBits |= TPB_DISPLAY_NAME_UNDERLINE; + nBits |= TabBarPageBits::Underline; } } @@ -1200,19 +1200,19 @@ void DrawViewShell::ResetActualLayer() // Set page bits for modified tab name display - TabBarPageBits nBits = 0; + TabBarPageBits nBits = TabBarPageBits::NONE; if (!mpDrawView->GetSdrPageView()->IsLayerVisible(aName)) { - nBits = TPB_DISPLAY_NAME_BLUE; + nBits = TabBarPageBits::Blue; } if (mpDrawView->GetSdrPageView()->IsLayerLocked(aName)) { - nBits |= TPB_DISPLAY_NAME_ITALIC; + nBits |= TabBarPageBits::Italic; } if (!mpDrawView->GetSdrPageView()->IsLayerPrintable(aName)) { - nBits |= TPB_DISPLAY_NAME_UNDERLINE; + nBits |= TabBarPageBits::Underline; } // Save the bits diff --git a/sd/source/ui/view/drviewsb.cxx b/sd/source/ui/view/drviewsb.cxx index 877d30c8d26b..336b43699cb5 100644 --- a/sd/source/ui/view/drviewsb.cxx +++ b/sd/source/ui/view/drviewsb.cxx @@ -190,19 +190,19 @@ void DrawViewShell::ModifyLayer ( // Set page bits for modified tab name display - TabBarPageBits nBits = 0; + TabBarPageBits nBits = TabBarPageBits::NONE; if (!bIsVisible) { - nBits = TPB_DISPLAY_NAME_BLUE; + nBits = TabBarPageBits::Blue; } if (bIsLocked) { - nBits |= TPB_DISPLAY_NAME_ITALIC; + nBits |= TabBarPageBits::Italic; } if (!bIsPrintable) { - nBits |= TPB_DISPLAY_NAME_UNDERLINE; + nBits |= TabBarPageBits::Underline; } // Save the bits diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx index 86b2f3587b80..2e3a5a3b563f 100644 --- a/svtools/source/control/tabbar.cxx +++ b/svtools/source/control/tabbar.cxx @@ -1199,17 +1199,17 @@ void TabBar::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& r // Special display of tab name depending on page bits - if (pItem->mnBits & TPB_DISPLAY_NAME_BLUE) + if (pItem->mnBits & TabBarPageBits::Blue) { rRenderContext.SetTextColor(Color(COL_LIGHTBLUE)); } - if (pItem->mnBits & TPB_DISPLAY_NAME_ITALIC) + if (pItem->mnBits & TabBarPageBits::Italic) { vcl::Font aSpecialFont = rRenderContext.GetFont(); aSpecialFont.SetItalic(FontItalic::ITALIC_NORMAL); rRenderContext.SetFont(aSpecialFont); } - if (pItem->mnBits & TPB_DISPLAY_NAME_UNDERLINE) + if (pItem->mnBits & TabBarPageBits::Underline) { vcl::Font aSpecialFont = rRenderContext.GetFont(); aSpecialFont.SetUnderline(LINESTYLE_SINGLE); @@ -1792,7 +1792,7 @@ TabBarPageBits TabBar::GetPageBits(sal_uInt16 nPageId) const if (nPos != PAGE_NOT_FOUND) return mpImpl->mpItemList[nPos]->mnBits; else - return 0; + return TabBarPageBits::NONE; } sal_uInt16 TabBar::GetPageCount() const @@ -2091,7 +2091,7 @@ bool TabBar::StartEditMode(sal_uInt16 nPageId) aForegroundColor = aFaceTextColor; aBackgroundColor = aFaceColor; } - if (GetPageBits( mnEditId ) & TPB_DISPLAY_NAME_BLUE) + if (GetPageBits( mnEditId ) & TabBarPageBits::Blue) { aForegroundColor = Color(COL_LIGHTBLUE); } |