From caef452db36f0ba74d1f14cf9d58582aa83b52bb Mon Sep 17 00:00:00 2001 From: Andre Fischer Date: Mon, 14 Jun 2010 18:02:38 +0200 Subject: [PATCH] renaissance1: #i107215# Improved high contrast handling. --- sd/source/ui/slidesorter/inc/view/SlsTheme.hxx | 1 + .../view/SlsInsertionIndicatorOverlay.cxx | 4 ++-- .../ui/slidesorter/view/SlsPageObjectPainter.cxx | 9 +++++++-- sd/source/ui/slidesorter/view/SlsTheme.cxx | 12 ++++++++++-- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx b/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx index 31975b8602be..3ec3acdbb7e4 100644 --- a/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx +++ b/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx @@ -85,6 +85,7 @@ public: Color_PageNumber, Color_Selection, Color_PreviewBorder, + Color_PageCountFontColor, _ColorType_Size_ }; ColorData GetColor (const ColorType eType); diff --git a/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx b/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx index 42f69dadcd72..abaa5a43b215 100644 --- a/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx +++ b/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx @@ -319,10 +319,10 @@ void InsertionIndicatorOverlay::PaintPageCount ( rDevice.DrawRect(GrowRectangle(aTextBox, nBorder)); rDevice.SetFillColor(); - rDevice.SetLineColor(COL_WHITE); + rDevice.SetLineColor(pTheme->GetColor(Theme::Color_PageCountFontColor)); rDevice.DrawRect(GrowRectangle(aTextBox, nBorder-1)); - rDevice.SetTextColor(COL_WHITE); + rDevice.SetTextColor(pTheme->GetColor(Theme::Color_PageCountFontColor)); rDevice.DrawText(aTextBox.TopLeft()-aTextOffset, sNumber); } } diff --git a/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx b/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx index 85df1100c123..87f777ecb509 100644 --- a/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx +++ b/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx @@ -383,7 +383,7 @@ Bitmap& PageObjectPainter::GetBackgroundForState ( maMouseOverBackground, Theme::Gradient_MouseOverPage, rReferenceDevice, - (eState & Focused)); + (eState & Focused)!=0); case Selected | Focused: return GetBackground( @@ -448,7 +448,12 @@ Bitmap PageObjectPainter::CreateBackgroundBitmap( VirtualDevice aBitmapDevice (rReferenceDevice); aBitmapDevice.SetOutputSizePixel(aSize); - // Paint the background with a linear gradient that starts some pixels + // Fill the background with the background color of the slide sorter. + aBitmapDevice.SetFillColor(mpTheme->GetColor(Theme::Color_Background)); + aBitmapDevice.SetLineColor(mpTheme->GetColor(Theme::Color_Background)); + aBitmapDevice.DrawRect(Rectangle(Point(0,0), aSize)); + + // Paint the slide area with a linear gradient that starts some pixels // below the top and ends some pixels above the bottom. const sal_Int32 nHeight (aPageObjectBox.GetHeight()); const sal_Int32 nDefaultConstantSize(nHeight/4); diff --git a/sd/source/ui/slidesorter/view/SlsTheme.cxx b/sd/source/ui/slidesorter/view/SlsTheme.cxx index 8dd414bde0b7..37e8c3e4d28a 100644 --- a/sd/source/ui/slidesorter/view/SlsTheme.cxx +++ b/sd/source/ui/slidesorter/view/SlsTheme.cxx @@ -138,6 +138,10 @@ Theme::Theme (const ::boost::shared_ptr& rpProperties) void Theme::Update (const ::boost::shared_ptr& rpProperties) { + const bool bSavedHighContrastMode (mbIsHighContrastMode); + mbIsHighContrastMode = rpProperties->IsHighContrastModeActive(); + + // Set up colors. maBackgroundColor = rpProperties->GetBackgroundColor().GetColor(); maPageBackgroundColor = svtools::ColorConfig().GetColorValue(svtools::DOCCOLOR).nColor; @@ -148,7 +152,12 @@ void Theme::Update (const ::boost::shared_ptr& rpPropert maColor[Color_Background] = maBackgroundColor; const ColorData aSelectionColor (rpProperties->GetSelectionColor().GetColor()); maColor[Color_Selection] = aSelectionColor; + if (Color(aSelectionColor).IsBright()) + maColor[Color_PageCountFontColor] = Black; + else + maColor[Color_PageCountFontColor] = White; + // Set up gradients. SetGradient(Gradient_SelectedPage, aSelectionColor, 50, 50, +100,+100, +50,+25); SetGradient(Gradient_MouseOverPage, aSelectionColor, 75, 75, +100,+100, +50,+25); SetGradient(Gradient_SelectedAndFocusedPage, aSelectionColor, 50, 50, +100,+100, -50,-75); @@ -163,8 +172,7 @@ void Theme::Update (const ::boost::shared_ptr& rpPropert GetGradient(Gradient_FocusedPage).maFillColor1 = GetGradient(Gradient_NormalPage).maFillColor1; GetGradient(Gradient_FocusedPage).maFillColor2 = GetGradient(Gradient_NormalPage).maFillColor2; - const bool bSavedHighContrastMode (mbIsHighContrastMode); - mbIsHighContrastMode = rpProperties->IsHighContrastModeActive(); + // Set up icons. if (bSavedHighContrastMode != mbIsHighContrastMode || maIcons.empty()) { LocalResource aResource (RID_SLIDESORTER_ICONS);