diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-01-13 14:04:29 +0900 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-01-14 21:31:32 +0900 |
commit | dc265e3b104de6a3882d25b7b808daf99425d9ee (patch) | |
tree | c8bff35a9624796c53871b3f70cb3e7cc4460b37 | |
parent | 8cd86d5e27b2ba0b4621474007eea1dea9957e8b (diff) |
infobar: combine anon. namespace, light/dark color to constant
Change-Id: Ie22c9b2997031146ee3a25ad55b2198ed50ee028
-rw-r--r-- | sfx2/source/dialog/infobar.cxx | 113 |
1 files changed, 56 insertions, 57 deletions
diff --git a/sfx2/source/dialog/infobar.cxx b/sfx2/source/dialog/infobar.cxx index 1455559da520..70e75e5ec512 100644 --- a/sfx2/source/dialog/infobar.cxx +++ b/sfx2/source/dialog/infobar.cxx @@ -31,78 +31,77 @@ using namespace basegfx; namespace { - class SfxCloseButton : public PushButton - { - public: - SfxCloseButton(vcl::Window* pParent) : PushButton(pParent, 0) - { - } - virtual ~SfxCloseButton() {} +const long INFO_BAR_BASE_HEIGHT = 40; - virtual void Paint(const Rectangle& rRect) SAL_OVERRIDE; - }; +const BColor constLightColor(1.0, 1.0, 191.0 / 255.0); +const BColor constDarkColor(217.0 / 255.0, 217.0 / 255.0, 78.0 / 255.0); - void SfxCloseButton::Paint(const Rectangle&) - { - const ViewInformation2D aNewViewInfos; - const unique_ptr<BaseProcessor2D> pProcessor( - createBaseProcessor2DFromOutputDevice(*this, aNewViewInfos)); +class SfxCloseButton : public PushButton +{ +public: + SfxCloseButton(vcl::Window* pParent) : PushButton(pParent, 0) + {} - const Rectangle aRect(Point(0, 0), PixelToLogic(GetSizePixel())); + virtual ~SfxCloseButton() {} - Primitive2DSequence aSeq(2); + virtual void Paint(const Rectangle& rRect) SAL_OVERRIDE; +}; - BColor aLightColor(1.0, 1.0, 191.0 / 255.0); - BColor aDarkColor(217.0 / 255.0, 217.0 / 255.0, 78.0 / 255.0); +void SfxCloseButton::Paint(const Rectangle&) +{ + const ViewInformation2D aNewViewInfos; + const unique_ptr<BaseProcessor2D> pProcessor( + createBaseProcessor2DFromOutputDevice(*this, aNewViewInfos)); - const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); - if (rSettings.GetHighContrastMode()) - { - aLightColor = rSettings.GetLightColor().getBColor(); - aDarkColor = rSettings.GetDialogTextColor().getBColor(); - } + const Rectangle aRect(Point(0, 0), PixelToLogic(GetSizePixel())); - // Light background - B2DPolygon aPolygon; - aPolygon.append(B2DPoint(aRect.Left(), aRect.Top())); - aPolygon.append(B2DPoint(aRect.Right(), aRect.Top())); - aPolygon.append(B2DPoint(aRect.Right(), aRect.Bottom())); - aPolygon.append(B2DPoint(aRect.Left(), aRect.Bottom())); - aPolygon.setClosed(true); + Primitive2DSequence aSeq(2); - PolyPolygonColorPrimitive2D* pBack = - new PolyPolygonColorPrimitive2D(B2DPolyPolygon(aPolygon), aLightColor); - aSeq[0] = pBack; + BColor aLightColor(constLightColor); + BColor aDarkColor(constDarkColor); + + const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); + if (rSettings.GetHighContrastMode()) + { + aLightColor = rSettings.GetLightColor().getBColor(); + aDarkColor = rSettings.GetDialogTextColor().getBColor(); + } - LineAttribute aLineAttribute(aDarkColor, 2.0); + // Light background + B2DPolygon aPolygon; + aPolygon.append(B2DPoint(aRect.Left(), aRect.Top())); + aPolygon.append(B2DPoint(aRect.Right(), aRect.Top())); + aPolygon.append(B2DPoint(aRect.Right(), aRect.Bottom())); + aPolygon.append(B2DPoint(aRect.Left(), aRect.Bottom())); + aPolygon.setClosed(true); - // Cross - B2DPolyPolygon aCross; + PolyPolygonColorPrimitive2D* pBack = + new PolyPolygonColorPrimitive2D(B2DPolyPolygon(aPolygon), aLightColor); + aSeq[0] = pBack; - B2DPolygon aLine1; - aLine1.append(B2DPoint(aRect.Left(), aRect.Top())); - aLine1.append(B2DPoint(aRect.Right(), aRect.Bottom())); - aCross.append(aLine1); + LineAttribute aLineAttribute(aDarkColor, 2.0); - B2DPolygon aLine2; - aLine2.append(B2DPoint(aRect.Right(), aRect.Top())); - aLine2.append(B2DPoint(aRect.Left(), aRect.Bottom())); - aCross.append(aLine2); + // Cross + B2DPolyPolygon aCross; - PolyPolygonStrokePrimitive2D* pCross = - new PolyPolygonStrokePrimitive2D(aCross, aLineAttribute, StrokeAttribute()); + B2DPolygon aLine1; + aLine1.append(B2DPoint(aRect.Left(), aRect.Top())); + aLine1.append(B2DPoint(aRect.Right(), aRect.Bottom())); + aCross.append(aLine1); - aSeq[1] = pCross; + B2DPolygon aLine2; + aLine2.append(B2DPoint(aRect.Right(), aRect.Top())); + aLine2.append(B2DPoint(aRect.Left(), aRect.Bottom())); + aCross.append(aLine2); - pProcessor->process(aSeq); - } -} + PolyPolygonStrokePrimitive2D* pCross = + new PolyPolygonStrokePrimitive2D(aCross, aLineAttribute, StrokeAttribute()); -namespace -{ + aSeq[1] = pCross; -const long INFO_BAR_BASE_HEIGHT = 40; + pProcessor->process(aSeq); +} } // anonymous namespace @@ -119,7 +118,7 @@ SfxInfoBarWindow::SfxInfoBarWindow(vcl::Window* pParent, const OUString& sId, SetPosSizePixel(Point(0, 0), Size(nWidth, INFO_BAR_BASE_HEIGHT * nScaleFactor)); m_pMessage->SetText(sMessage); - m_pMessage->SetBackground(Wallpaper(Color(255, 255, 191))); + m_pMessage->SetBackground(Wallpaper(Color(constLightColor))); m_pMessage->Show(); m_pCloseBtn->SetClickHdl(LINK(this, SfxInfoBarWindow, CloseHandler)); @@ -151,8 +150,8 @@ void SfxInfoBarWindow::Paint(const Rectangle& rPaintRect) Primitive2DSequence aSeq(2); - BColor aLightColor(1.0, 1.0, 191.0 / 255.0); - BColor aDarkColor(217.0 / 255.0, 217.0 / 255.0, 78.0 / 255.0); + BColor aLightColor(constLightColor); + BColor aDarkColor(constDarkColor); const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); if (rSettings.GetHighContrastMode()) |