diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-11-06 14:16:21 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-11-08 21:49:19 +0100 |
commit | afa52f6907f6baa408a51dccee650faebb5d2d6b (patch) | |
tree | 8e6c68ce463068b7da16a42e331c83768b61bc47 /sfx2 | |
parent | 10e0a94416094e9c73b4152989481b89afd8b141 (diff) |
only colors are in use so reduce down to just those
Change-Id: I757a0f2e7baa981ecb3cad7e0f975e3ae9c509b0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105414
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/IwyuFilter_sfx2.yaml | 3 | ||||
-rw-r--r-- | sfx2/Library_sfx.mk | 1 | ||||
-rw-r--r-- | sfx2/inc/sidebar/DeckTitleBar.hxx | 2 | ||||
-rw-r--r-- | sfx2/inc/sidebar/DrawHelper.hxx | 10 | ||||
-rw-r--r-- | sfx2/inc/sidebar/Paint.hxx | 73 | ||||
-rw-r--r-- | sfx2/inc/sidebar/PanelTitleBar.hxx | 2 | ||||
-rw-r--r-- | sfx2/inc/sidebar/TitleBar.hxx | 8 | ||||
-rw-r--r-- | sfx2/source/sidebar/Deck.cxx | 15 | ||||
-rw-r--r-- | sfx2/source/sidebar/DeckLayouter.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/sidebar/DeckTitleBar.cxx | 6 | ||||
-rw-r--r-- | sfx2/source/sidebar/DrawHelper.cxx | 86 | ||||
-rw-r--r-- | sfx2/source/sidebar/MenuButton.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/sidebar/Paint.cxx | 102 | ||||
-rw-r--r-- | sfx2/source/sidebar/Panel.cxx | 3 | ||||
-rw-r--r-- | sfx2/source/sidebar/PanelTitleBar.cxx | 7 | ||||
-rw-r--r-- | sfx2/source/sidebar/SidebarController.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/sidebar/SidebarPanelBase.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/sidebar/TabBar.cxx | 5 | ||||
-rw-r--r-- | sfx2/source/sidebar/TabItem.cxx | 7 | ||||
-rw-r--r-- | sfx2/source/sidebar/Theme.cxx | 121 | ||||
-rw-r--r-- | sfx2/source/sidebar/TitleBar.cxx | 9 |
21 files changed, 100 insertions, 370 deletions
diff --git a/sfx2/IwyuFilter_sfx2.yaml b/sfx2/IwyuFilter_sfx2.yaml index dfeac025ea8d..87396e719fc4 100644 --- a/sfx2/IwyuFilter_sfx2.yaml +++ b/sfx2/IwyuFilter_sfx2.yaml @@ -4,9 +4,6 @@ excludelist: sfx2/inc/sidebar/Accessible.hxx: # base class has to be a complete type - com/sun/star/accessibility/XAccessible.hpp - sfx2/inc/sidebar/Paint.hxx: - # Needed for boost::variant - - vcl/gradient.hxx sfx2/inc/sidebar/UnoDeck.hxx: # base class has to be a complete type - com/sun/star/ui/XDeck.hpp diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk index cb0b099eb37d..05c31e58034d 100644 --- a/sfx2/Library_sfx.mk +++ b/sfx2/Library_sfx.mk @@ -276,7 +276,6 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\ sfx2/source/sidebar/MenuButton \ sfx2/source/sidebar/IContextChangeReceiver \ sfx2/source/sidebar/ILayoutableWindow \ - sfx2/source/sidebar/Paint \ sfx2/source/sidebar/Panel \ sfx2/source/sidebar/PanelDescriptor \ sfx2/source/sidebar/PanelLayout \ diff --git a/sfx2/inc/sidebar/DeckTitleBar.hxx b/sfx2/inc/sidebar/DeckTitleBar.hxx index 86a71c76a36e..eee139556020 100644 --- a/sfx2/inc/sidebar/DeckTitleBar.hxx +++ b/sfx2/inc/sidebar/DeckTitleBar.hxx @@ -38,7 +38,7 @@ public: private: virtual tools::Rectangle GetTitleArea(const tools::Rectangle& rTitleBarBox) override; virtual void PaintDecoration(vcl::RenderContext& rRenderContext) override; - virtual sidebar::Paint GetBackgroundPaint() override; + virtual Color GetBackgroundPaintColor() override; virtual void HandleToolBoxItemClick(const sal_uInt16 nItemIndex) override; virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override; diff --git a/sfx2/inc/sidebar/DrawHelper.hxx b/sfx2/inc/sidebar/DrawHelper.hxx index a657ac041aef..a066b157aee4 100644 --- a/sfx2/inc/sidebar/DrawHelper.hxx +++ b/sfx2/inc/sidebar/DrawHelper.hxx @@ -25,21 +25,19 @@ class SvBorder; namespace sfx2::sidebar { -class Paint; - /** Some convenience functions for painting backgrounds and borders. */ class DrawHelper { public: static void DrawBorder(vcl::RenderContext& rRenderContext, const tools::Rectangle& rBox, const SvBorder& rBorderSize, - const Paint& rHorizontalPaint, const Paint& rVerticalPaint); + const Color& rHorizontalColor, const Color& rVerticalColor); static void DrawHorizontalLine(vcl::RenderContext& rRenderContext, const sal_Int32 nLeft, const sal_Int32 nRight, - const sal_Int32 nY, const sal_Int32 nHeight, const Paint& rPaint); + const sal_Int32 nY, const sal_Int32 nHeight, const Color& rColor); static void DrawVerticalLine(vcl::RenderContext& rRenderContext, const sal_Int32 nTop, const sal_Int32 nBottom, - const sal_Int32 nX, const sal_Int32 nWidth, const Paint& rPaint); + const sal_Int32 nX, const sal_Int32 nWidth, const Color& rColor); static void DrawRoundedRectangle(vcl::RenderContext& rRenderContext, const tools::Rectangle& rBox, const sal_Int32 nCornerRadius, - const Color& rBorderColor, const Paint& rFillPaint); + const Color& rBorderColor, const Color& rFillColor); }; } // end of namespace sfx2::sidebar diff --git a/sfx2/inc/sidebar/Paint.hxx b/sfx2/inc/sidebar/Paint.hxx deleted file mode 100644 index ea2af1d5e0cf..000000000000 --- a/sfx2/inc/sidebar/Paint.hxx +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#pragma once - -#include <vcl/gradient.hxx> -#include <vcl/wall.hxx> - -#include <boost/variant.hpp> - -namespace sfx2::sidebar { - -/** Abstraction of different ways to fill outlines. - Can be - - none (empty: outline is not filled) - - singular color - - gradient -*/ -class Paint -{ -public: - enum Type - { - NoPaint, - ColorPaint, - GradientPaint - }; - - // Create a Paint object for an Any that may contain a color, a - // awt::Gradient, or nothing. - static Paint Create (const css::uno::Any& rValue); - - // Create paint with type NoPaint. - explicit Paint(); - - // Create a Paint object for the given color. - explicit Paint (const Color& rColor); - - // Create a Paint object for the given gradient. - explicit Paint (const Gradient& rGradient); - - Type GetType() const { return meType;} - const Color& GetColor() const; - const Gradient& GetGradient() const; - - Wallpaper GetWallpaper() const; - -private: - Type meType; - ::boost::variant< - Color, - Gradient - > maValue; -}; - -} // end of namespace sfx2::sidebar - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sidebar/PanelTitleBar.hxx b/sfx2/inc/sidebar/PanelTitleBar.hxx index b060124b9e07..e84febf1e125 100644 --- a/sfx2/inc/sidebar/PanelTitleBar.hxx +++ b/sfx2/inc/sidebar/PanelTitleBar.hxx @@ -46,7 +46,7 @@ public: private: virtual tools::Rectangle GetTitleArea(const tools::Rectangle& rTitleBarBox) override; virtual void PaintDecoration(vcl::RenderContext& rRenderContext) override; - virtual sidebar::Paint GetBackgroundPaint() override; + virtual Color GetBackgroundPaintColor() override; virtual void HandleToolBoxItemClick (const sal_uInt16 nItemIndex) override; virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override; diff --git a/sfx2/inc/sidebar/TitleBar.hxx b/sfx2/inc/sidebar/TitleBar.hxx index e1029b54ee30..f86a39324d70 100644 --- a/sfx2/inc/sidebar/TitleBar.hxx +++ b/sfx2/inc/sidebar/TitleBar.hxx @@ -18,8 +18,6 @@ */ #pragma once -#include <sidebar/Paint.hxx> - #include <sidebar/SidebarToolBox.hxx> namespace sfx2::sidebar { @@ -29,7 +27,7 @@ class TitleBar : public vcl::Window public: TitleBar (const OUString& rsTitle, vcl::Window* pParentWindow, - const sidebar::Paint& rInitialBackgroundPaint); + const Color& rInitialBackgroundColor); virtual ~TitleBar() override; virtual void dispose() override; @@ -59,13 +57,13 @@ protected: virtual tools::Rectangle GetTitleArea (const tools::Rectangle& rTitleBarBox) = 0; virtual void PaintDecoration (vcl::RenderContext& rRenderContext) = 0; void PaintFocus(vcl::RenderContext& rRenderContext, const tools::Rectangle& rFocusBox); - virtual sidebar::Paint GetBackgroundPaint() = 0; + virtual Color GetBackgroundPaintColor() = 0; virtual void HandleToolBoxItemClick (const sal_uInt16 nItemIndex); virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override; private: Image maIcon; - sidebar::Paint maBackgroundPaint; + Color maBackgroundColor; void PaintTitle(vcl::RenderContext& rRenderContext, const tools::Rectangle& rTitleBox); DECL_LINK(SelectionHandler, ToolBox*, void); diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx index 60ca3be37a9e..1cc11cafc37e 100644 --- a/sfx2/source/sidebar/Deck.cxx +++ b/sfx2/source/sidebar/Deck.cxx @@ -23,7 +23,6 @@ #include <sidebar/DrawHelper.hxx> #include <sidebar/DeckTitleBar.hxx> #include <sidebar/PanelTitleBar.hxx> -#include <sidebar/Paint.hxx> #include <sfx2/sidebar/Panel.hxx> #include <sfx2/sidebar/Theme.hxx> #include <sfx2/lokhelper.hxx> @@ -136,8 +135,8 @@ void Deck::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& /*r // Paint deck background outside the border. tools::Rectangle aBox(0, 0, aWindowSize.Width() - 1, aWindowSize.Height() - 1); DrawHelper::DrawBorder(rRenderContext, aBox, aPadding, - Theme::GetPaint(Theme::Paint_DeckBackground), - Theme::GetPaint(Theme::Paint_DeckBackground)); + Theme::GetColor(Theme::Color_DeckBackground), + Theme::GetColor(Theme::Color_DeckBackground)); // Paint the border. const int nBorderSize(Theme::GetInteger(Theme::Int_DeckBorderSize)); @@ -145,11 +144,11 @@ void Deck::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& /*r aBox.AdjustTop(aPadding.Top() ); aBox.AdjustRight( -(aPadding.Right()) ); aBox.AdjustBottom( -(aPadding.Bottom()) ); - const sfx2::sidebar::Paint& rHorizontalBorderPaint(Theme::GetPaint(Theme::Paint_HorizontalBorder)); + const Color nHorizontalBorderPaint(Theme::GetColor(Theme::Color_HorizontalBorder)); DrawHelper::DrawBorder(rRenderContext, aBox, SvBorder(nBorderSize, nBorderSize, nBorderSize, nBorderSize), - rHorizontalBorderPaint, - Theme::GetPaint(Theme::Paint_VerticalBorder)); + nHorizontalBorderPaint, + Theme::GetColor(Theme::Color_VerticalBorder)); } void Deck::DataChanged (const DataChangedEvent&) @@ -421,11 +420,11 @@ void Deck::ScrollContainerWindow::Paint(vcl::RenderContext& rRenderContext, cons const sal_Int32 nSeparatorHeight(Theme::GetInteger(Theme::Int_DeckSeparatorHeight)); const sal_Int32 nLeft(0); const sal_Int32 nRight(GetSizePixel().Width() - 1); - const sfx2::sidebar::Paint& rHorizontalBorderPaint(Theme::GetPaint(Theme::Paint_HorizontalBorder)); + const Color nHorizontalBorderPaint(Theme::GetColor(Theme::Color_HorizontalBorder)); for (auto const& separator : maSeparators) { DrawHelper::DrawHorizontalLine(rRenderContext, nLeft, nRight, separator, - nSeparatorHeight, rHorizontalBorderPaint); + nSeparatorHeight, nHorizontalBorderPaint); } } diff --git a/sfx2/source/sidebar/DeckLayouter.cxx b/sfx2/source/sidebar/DeckLayouter.cxx index 77cda6dcaf01..c4c9cd4b9a81 100644 --- a/sfx2/source/sidebar/DeckLayouter.cxx +++ b/sfx2/source/sidebar/DeckLayouter.cxx @@ -616,7 +616,7 @@ void UpdateFiller ( if (rBox.GetHeight() > 0) { // Show the filler. - rFiller.SetBackground(Theme::GetPaint(Theme::Paint_PanelBackground).GetWallpaper()); + rFiller.SetBackground(Theme::GetColor(Theme::Color_PanelBackground)); rFiller.SetPosSizePixel(rBox.TopLeft(), rBox.GetSize()); rFiller.Show(); } diff --git a/sfx2/source/sidebar/DeckTitleBar.cxx b/sfx2/source/sidebar/DeckTitleBar.cxx index 4c2e86840e7d..2d8fcd92b1c2 100644 --- a/sfx2/source/sidebar/DeckTitleBar.cxx +++ b/sfx2/source/sidebar/DeckTitleBar.cxx @@ -41,7 +41,7 @@ const sal_Int32 gaRightGripPadding (6); DeckTitleBar::DeckTitleBar (const OUString& rsTitle, vcl::Window* pParentWindow, const std::function<void()>& rCloserAction) - : TitleBar(rsTitle, pParentWindow, GetBackgroundPaint()) + : TitleBar(rsTitle, pParentWindow, GetBackgroundPaintColor()) , maCloserAction(rCloserAction) , mbIsCloserVisible(false) { @@ -100,9 +100,9 @@ void DeckTitleBar::PaintDecoration(vcl::RenderContext& rRenderContext) rRenderContext.DrawImage(aTopLeft, aImage); } -sidebar::Paint DeckTitleBar::GetBackgroundPaint() +Color DeckTitleBar::GetBackgroundPaintColor() { - return Theme::GetPaint(Theme::Paint_DeckTitleBarBackground); + return Theme::GetColor(Theme::Color_DeckTitleBarBackground); } void DeckTitleBar::HandleToolBoxItemClick (const sal_uInt16 nItemIndex) diff --git a/sfx2/source/sidebar/DrawHelper.cxx b/sfx2/source/sidebar/DrawHelper.cxx index 4c9f193ba21f..52da8bf8a422 100644 --- a/sfx2/source/sidebar/DrawHelper.cxx +++ b/sfx2/source/sidebar/DrawHelper.cxx @@ -18,108 +18,58 @@ */ #include <sidebar/DrawHelper.hxx> -#include <sidebar/Paint.hxx> #include <tools/svborder.hxx> namespace sfx2::sidebar { void DrawHelper::DrawBorder(vcl::RenderContext& rRenderContext, const tools::Rectangle& rBox, const SvBorder& rBorderSize, - const Paint& rHorizontalPaint, const Paint& rVerticalPaint) + const Color& rHorizontalColor, const Color& rVerticalColor) { // Draw top line. DrawHorizontalLine(rRenderContext, rBox.Left(), rBox.Right(), - rBox.Top(), rBorderSize.Top(), rHorizontalPaint); + rBox.Top(), rBorderSize.Top(), rHorizontalColor); // Draw bottom line. DrawHorizontalLine(rRenderContext, rBox.Left() + rBorderSize.Left(), rBox.Right(), rBox.Bottom() - rBorderSize.Bottom() + 1, rBorderSize.Bottom(), - rHorizontalPaint); + rHorizontalColor); // Draw left line. DrawVerticalLine(rRenderContext, rBox.Top() + rBorderSize.Top(), rBox.Bottom(), - rBox.Left(), rBorderSize.Left(), rVerticalPaint); + rBox.Left(), rBorderSize.Left(), rVerticalColor); // Draw right line. DrawVerticalLine(rRenderContext, rBox.Top() + rBorderSize.Top(), rBox.Bottom() - rBorderSize.Bottom(), - rBox.Right() - rBorderSize.Right() + 1, rBorderSize.Right(), rVerticalPaint); + rBox.Right() - rBorderSize.Right() + 1, rBorderSize.Right(), rVerticalColor); } void DrawHelper::DrawHorizontalLine(vcl::RenderContext& rRenderContext, const sal_Int32 nLeft, const sal_Int32 nRight, - const sal_Int32 nY, const sal_Int32 nHeight, const Paint& rPaint) + const sal_Int32 nY, const sal_Int32 nHeight, const Color& rColor) { - switch (rPaint.GetType()) + rRenderContext.SetLineColor(rColor); + for (sal_Int32 nYOffset = 0; nYOffset < nHeight; ++nYOffset) { - case Paint::ColorPaint: - { - const Color aColor(rPaint.GetColor()); - rRenderContext.SetLineColor(aColor); - for (sal_Int32 nYOffset = 0; nYOffset < nHeight; ++nYOffset) - { - rRenderContext.DrawLine(Point(nLeft, nY + nYOffset), - Point(nRight, nY + nYOffset)); - } - break; - } - case Paint::GradientPaint: - rRenderContext.DrawGradient(tools::Rectangle(nLeft, nY, nRight, nY + nHeight - 1), - rPaint.GetGradient()); - break; - - case Paint::NoPaint: - default: - break; + rRenderContext.DrawLine(Point(nLeft, nY + nYOffset), + Point(nRight, nY + nYOffset)); } } void DrawHelper::DrawVerticalLine(vcl::RenderContext& rRenderContext, const sal_Int32 nTop, const sal_Int32 nBottom, - const sal_Int32 nX, const sal_Int32 nWidth, const Paint& rPaint) + const sal_Int32 nX, const sal_Int32 nWidth, const Color& rColor) { - switch (rPaint.GetType()) + rRenderContext.SetLineColor(rColor); + for (sal_Int32 nXOffset = 0; nXOffset < nWidth; ++nXOffset) { - case Paint::ColorPaint: - { - const Color aColor(rPaint.GetColor()); - rRenderContext.SetLineColor(aColor); - for (sal_Int32 nXOffset = 0; nXOffset < nWidth; ++nXOffset) - { - rRenderContext.DrawLine(Point(nX + nXOffset, nTop), - Point(nX + nXOffset, nBottom)); - } - break; - } - case Paint::GradientPaint: - rRenderContext.DrawGradient(tools::Rectangle(nX, nTop, nX + nWidth - 1, nBottom), - rPaint.GetGradient()); - break; - - case Paint::NoPaint: - default: - break; + rRenderContext.DrawLine(Point(nX + nXOffset, nTop), + Point(nX + nXOffset, nBottom)); } } void DrawHelper::DrawRoundedRectangle(vcl::RenderContext& rRenderContext, const tools::Rectangle& rBox, const sal_Int32 nCornerRadius, - const Color& rBorderColor, const Paint& rFillPaint) + const Color& rBorderColor, const Color& rFillColor) { rRenderContext.SetLineColor(rBorderColor); - switch (rFillPaint.GetType()) - { - case Paint::ColorPaint: - rRenderContext.SetFillColor(rFillPaint.GetColor()); - rRenderContext.DrawRect(rBox, nCornerRadius, nCornerRadius); - break; - - case Paint::GradientPaint: - rRenderContext.DrawGradient(rBox, rFillPaint.GetGradient()); - rRenderContext.SetFillColor(); - rRenderContext.DrawRect(rBox, nCornerRadius, nCornerRadius); - break; - - case Paint::NoPaint: - default: - rRenderContext.SetFillColor(); - rRenderContext.DrawRect(rBox, nCornerRadius, nCornerRadius); - break; - } + rRenderContext.SetFillColor(rFillColor); + rRenderContext.DrawRect(rBox, nCornerRadius, nCornerRadius); } } // end of namespace sfx2::sidebar diff --git a/sfx2/source/sidebar/MenuButton.cxx b/sfx2/source/sidebar/MenuButton.cxx index fb8d914ded2a..d89ef544f624 100644 --- a/sfx2/source/sidebar/MenuButton.cxx +++ b/sfx2/source/sidebar/MenuButton.cxx @@ -49,8 +49,8 @@ void MenuButton::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangl ? Theme::GetColor(Theme::Color_TabItemBorder) : COL_TRANSPARENT), (bIsHighlighted - ? Theme::GetPaint(Theme::Paint_TabItemBackgroundHighlight) - : Theme::GetPaint(Theme::Paint_TabItemBackgroundNormal))); + ? Theme::GetColor(Theme::Color_TabItemBackgroundHighlight) + : Theme::GetColor(Theme::Color_TabItemBackgroundNormal))); const Image aIcon(Button::GetModeImage()); const Size aIconSize(aIcon.GetSizePixel()); diff --git a/sfx2/source/sidebar/Paint.cxx b/sfx2/source/sidebar/Paint.cxx deleted file mode 100644 index 1ab8b5d6dfb0..000000000000 --- a/sfx2/source/sidebar/Paint.cxx +++ /dev/null @@ -1,102 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#include <sidebar/Paint.hxx> -#include <sidebar/Tools.hxx> -#include <com/sun/star/awt/Gradient.hpp> - -using namespace css; - -namespace sfx2::sidebar { - -Paint::Paint() - : meType(NoPaint) -{ -} - -Paint::Paint (const Color& rColor) - : meType(ColorPaint), - maValue(rColor) -{ -} - -Paint::Paint (const Gradient& rGradient) - : meType(GradientPaint), - maValue(rGradient) -{ -} - -Paint Paint::Create (const css::uno::Any& rValue) -{ - Color aColor (0); - if (rValue >>= aColor) - return Paint(aColor); - - awt::Gradient aAwtGradient; - if (rValue >>= aAwtGradient) - return Paint(Tools::AwtToVclGradient(aAwtGradient)); - - return Paint(); -} - -const Color& Paint::GetColor() const -{ - if (meType != ColorPaint) - { - assert(meType==ColorPaint); - static const Color aErrorColor; - return aErrorColor; - } - else - return ::boost::get<Color>(maValue); -} - -const Gradient& Paint::GetGradient() const -{ - if (meType != GradientPaint) - { - assert(meType==GradientPaint); - static Gradient aErrorGradient; - return aErrorGradient; - } - else - return ::boost::get<Gradient>(maValue); -} - -Wallpaper Paint::GetWallpaper() const -{ - switch (meType) - { - case Paint::NoPaint: - default: - return Wallpaper(); - break; - - case Paint::ColorPaint: - return Wallpaper(GetColor()); - break; - - case Paint::GradientPaint: - return Wallpaper(GetGradient()); - break; - } -} - -} // end of namespace sfx2::sidebar - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/sidebar/Panel.cxx b/sfx2/source/sidebar/Panel.cxx index 6c7824b43cfd..c4de2280f891 100644 --- a/sfx2/source/sidebar/Panel.cxx +++ b/sfx2/source/sidebar/Panel.cxx @@ -21,7 +21,6 @@ #include <sidebar/PanelTitleBar.hxx> #include <sidebar/PanelDescriptor.hxx> #include <sfx2/sidebar/Theme.hxx> -#include <sidebar/Paint.hxx> #include <sfx2/sidebar/ResourceManager.hxx> #include <sfx2/sidebar/SidebarController.hxx> @@ -79,7 +78,7 @@ void Panel::SetLurkMode(bool bLurk) void Panel::ApplySettings(vcl::RenderContext& rRenderContext) { - rRenderContext.SetBackground(Theme::GetPaint(Theme::Paint_PanelBackground).GetWallpaper()); + rRenderContext.SetBackground(Theme::GetColor(Theme::Color_PanelBackground)); } void Panel::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) diff --git a/sfx2/source/sidebar/PanelTitleBar.cxx b/sfx2/source/sidebar/PanelTitleBar.cxx index db45394c9306..4dbb787cd3bd 100644 --- a/sfx2/source/sidebar/PanelTitleBar.cxx +++ b/sfx2/source/sidebar/PanelTitleBar.cxx @@ -20,7 +20,6 @@ #include <sidebar/PanelTitleBar.hxx> #include <sfx2/sfxresid.hxx> #include <sfx2/strings.hrc> -#include <sidebar/Paint.hxx> #include <sfx2/sidebar/Panel.hxx> #include <sfx2/sidebar/Theme.hxx> #include <sidebar/ControllerFactory.hxx> @@ -43,7 +42,7 @@ const sal_Int32 gaRightIconPadding (5); PanelTitleBar::PanelTitleBar(const OUString& rsTitle, vcl::Window* pParentWindow, Panel* pPanel) - : TitleBar(rsTitle, pParentWindow, GetBackgroundPaint()), + : TitleBar(rsTitle, pParentWindow, GetBackgroundPaintColor()), mbIsLeftButtonDown(false), mpPanel(pPanel), mxFrame(), @@ -130,9 +129,9 @@ void PanelTitleBar::PaintDecoration (vcl::RenderContext& rRenderContext) } } -Paint PanelTitleBar::GetBackgroundPaint() +Color PanelTitleBar::GetBackgroundPaintColor() { - return Theme::GetPaint(Theme::Paint_PanelTitleBarBackground); + return Theme::GetColor(Theme::Color_PanelTitleBarBackground); } void PanelTitleBar::HandleToolBoxItemClick (const sal_uInt16 nItemIndex) diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index 3fdd33ef220b..435ea63150d3 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -1465,7 +1465,7 @@ void SidebarController::UpdateCloseIndicator (const bool bCloseAfterDrag) const Image aImage (Theme::GetImage(Theme::Image_CloseIndicator)); pFixedImage->SetImage(aImage); pFixedImage->SetSizePixel(aImage.GetSizePixel()); - pFixedImage->SetBackground(Theme::GetWallpaper(Theme::Paint_DeckBackground)); + pFixedImage->SetBackground(Theme::GetColor(Theme::Color_DeckBackground)); } // Place and show the indicator. diff --git a/sfx2/source/sidebar/SidebarPanelBase.cxx b/sfx2/source/sidebar/SidebarPanelBase.cxx index 666a573f627b..a1f0b8b6208c 100644 --- a/sfx2/source/sidebar/SidebarPanelBase.cxx +++ b/sfx2/source/sidebar/SidebarPanelBase.cxx @@ -67,7 +67,7 @@ SidebarPanelBase::SidebarPanelBase ( } if (mpControl != nullptr) { - mpControl->SetBackground(Theme::GetWallpaper(Theme::Paint_PanelBackground)); + mpControl->SetBackground(Theme::GetColor(Theme::Color_PanelBackground)); mpControl->Show(); } } diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx index 7c8d98c7ff7d..6d95e432fbba 100644 --- a/sfx2/source/sidebar/TabBar.cxx +++ b/sfx2/source/sidebar/TabBar.cxx @@ -20,7 +20,6 @@ #include <sfx2/sidebar/TabBar.hxx> #include <sidebar/ControlFactory.hxx> #include <sidebar/DeckDescriptor.hxx> -#include <sidebar/Paint.hxx> #include <sfx2/sidebar/Theme.hxx> #include <sidebar/Tools.hxx> #include <sfx2/sidebar/FocusManager.hxx> @@ -59,7 +58,7 @@ TabBar::TabBar(vcl::Window* pParentWindow, pParentSidebarController(rParentSidebarController) { - SetBackground(Theme::GetPaint(Theme::Paint_TabBarBackground).GetWallpaper()); + SetBackground(Wallpaper(Theme::GetColor(Theme::Color_TabBarBackground))); mpMenuButton->SetModeImage(Theme::GetImage(Theme::Image_TabBarMenu)); mpMenuButton->SetClickHdl(LINK(this, TabBar, OnToolboxClicked)); @@ -223,7 +222,7 @@ void TabBar::RemoveDeckHighlight () void TabBar::DataChanged (const DataChangedEvent& rDataChangedEvent) { - SetBackground(Theme::GetPaint(Theme::Paint_TabBarBackground).GetWallpaper()); + SetBackground(Theme::GetColor(Theme::Color_TabBarBackground)); UpdateButtonIcons(); Window::DataChanged(rDataChangedEvent); diff --git a/sfx2/source/sidebar/TabItem.cxx b/sfx2/source/sidebar/TabItem.cxx index cb4d217fdaf1..c6cfa80fd2d6 100644 --- a/sfx2/source/sidebar/TabItem.cxx +++ b/sfx2/source/sidebar/TabItem.cxx @@ -20,7 +20,6 @@ #include <sidebar/TabItem.hxx> #include <sidebar/DrawHelper.hxx> -#include <sidebar/Paint.hxx> #include <sfx2/sidebar/Theme.hxx> #include <vcl/event.hxx> @@ -35,7 +34,7 @@ TabItem::TabItem (vcl::Window* pParentWindow) , mbIsLeftButtonDown(false) { SetStyle(GetStyle() | WB_TABSTOP | WB_DIALOGCONTROL | WB_NOPOINTERFOCUS); - SetBackground(Theme::GetPaint(Theme::Paint_TabBarBackground).GetWallpaper()); + SetBackground(Theme::GetColor(Theme::Color_TabBarBackground)); #ifdef DEBUG SetText(OUString("TabItem")); #endif @@ -53,8 +52,8 @@ void TabItem::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& ? Theme::GetColor(Theme::Color_TabItemBorder) : COL_TRANSPARENT, bIsHighlighted - ? Theme::GetPaint(Theme::Paint_TabItemBackgroundHighlight) - : Theme::GetPaint(Theme::Paint_TabItemBackgroundNormal)); + ? Theme::GetColor(Theme::Color_TabItemBackgroundHighlight) + : Theme::GetColor(Theme::Color_TabItemBackgroundNormal)); const Image aIcon(Button::GetModeImage()); const Size aIconSize (aIcon.GetSizePixel()); diff --git a/sfx2/source/sidebar/Theme.cxx b/sfx2/source/sidebar/Theme.cxx index a19b60f3d5d7..da66a71c292d 100644 --- a/sfx2/source/sidebar/Theme.cxx +++ b/sfx2/source/sidebar/Theme.cxx @@ -18,7 +18,6 @@ */ #include <sfx2/sidebar/Theme.hxx> -#include <sidebar/Paint.hxx> #include <sidebar/Tools.hxx> #include <sfx2/app.hxx> @@ -42,7 +41,6 @@ Theme::Theme() : ThemeInterfaceBase(m_aMutex), maImages(), maColors(), - maPaints(), maIntegers(), maBooleans(), mbIsHighContrastMode(Application::GetSettings().GetStyleSettings().GetHighContrastMode()), @@ -73,31 +71,15 @@ Image Theme::GetImage (const ThemeItem eItem) Color Theme::GetColor (const ThemeItem eItem) { const PropertyType eType (GetPropertyType(eItem)); - OSL_ASSERT(eType==PT_Color || eType==PT_Paint); + OSL_ASSERT(eType==PT_Color); const sal_Int32 nIndex (GetIndex(eItem, eType)); const Theme& rTheme (GetCurrentTheme()); if (eType == PT_Color) return rTheme.maColors[nIndex]; - else if (eType == PT_Paint) - return rTheme.maPaints[nIndex].GetColor(); else return COL_WHITE; } -const Paint& Theme::GetPaint (const ThemeItem eItem) -{ - const PropertyType eType (GetPropertyType(eItem)); - OSL_ASSERT(eType==PT_Paint); - const sal_Int32 nIndex (GetIndex(eItem, eType)); - const Theme& rTheme (GetCurrentTheme()); - return rTheme.maPaints[nIndex]; -} - -Wallpaper Theme::GetWallpaper (const ThemeItem eItem) -{ - return GetPaint(eItem).GetWallpaper(); -} - sal_Int32 Theme::GetInteger (const ThemeItem eItem) { const PropertyType eType (GetPropertyType(eItem)); @@ -160,11 +142,11 @@ void Theme::UpdateTheme() aSecondColor.DecreaseLuminance(15); setPropertyValue( - maPropertyIdToNameMap[Paint_DeckBackground], + maPropertyIdToNameMap[Color_DeckBackground], Any(sal_Int32(aBaseBackgroundColor.GetRGBColor()))); setPropertyValue( - maPropertyIdToNameMap[Paint_DeckTitleBarBackground], + maPropertyIdToNameMap[Color_DeckTitleBarBackground], Any(sal_Int32(aBaseBackgroundColor.GetRGBColor()))); setPropertyValue( maPropertyIdToNameMap[Int_DeckSeparatorHeight], @@ -179,11 +161,11 @@ void Theme::UpdateTheme() 26, rStyle.GetFloatTitleHeight())))); setPropertyValue( - maPropertyIdToNameMap[Paint_PanelBackground], + maPropertyIdToNameMap[Color_PanelBackground], Any(sal_Int32(aBaseBackgroundColor.GetRGBColor()))); setPropertyValue( - maPropertyIdToNameMap[Paint_PanelTitleBarBackground], + maPropertyIdToNameMap[Color_PanelTitleBarBackground], Any(sal_Int32(aSecondColor.GetRGBColor()))); setPropertyValue( maPropertyIdToNameMap[Color_PanelTitleFont], @@ -195,7 +177,7 @@ void Theme::UpdateTheme() 26, rStyle.GetTitleHeight())))); setPropertyValue( - maPropertyIdToNameMap[Paint_TabBarBackground], + maPropertyIdToNameMap[Color_TabBarBackground], Any(sal_Int32(aBaseBackgroundColor.GetRGBColor()))); setPropertyValue( maPropertyIdToNameMap[Int_TabBarLeftPadding], @@ -231,7 +213,7 @@ void Theme::UpdateTheme() Any(sal_Int32(rStyle.GetActiveBorderColor().GetRGBColor()))); setPropertyValue( - maPropertyIdToNameMap[Paint_DropDownBackground], + maPropertyIdToNameMap[Color_DropDownBackground], Any(sal_Int32(aBaseBackgroundColor.GetRGBColor()))); setPropertyValue( maPropertyIdToNameMap[Color_DropDownBorder], @@ -245,18 +227,18 @@ void Theme::UpdateTheme() Any(sal_Int32(rStyle.GetHighlightTextColor().GetRGBColor()))); setPropertyValue( - maPropertyIdToNameMap[Paint_TabItemBackgroundNormal], - Any()); + maPropertyIdToNameMap[Color_TabItemBackgroundNormal], + Any(sal_Int32(COL_TRANSPARENT))); setPropertyValue( - maPropertyIdToNameMap[Paint_TabItemBackgroundHighlight], + maPropertyIdToNameMap[Color_TabItemBackgroundHighlight], Any(sal_Int32(rStyle.GetActiveTabColor().GetRGBColor()))); setPropertyValue( - maPropertyIdToNameMap[Paint_HorizontalBorder], + maPropertyIdToNameMap[Color_HorizontalBorder], Any(sal_Int32(aBorderColor.GetRGBColor()))); setPropertyValue( - maPropertyIdToNameMap[Paint_VerticalBorder], + maPropertyIdToNameMap[Color_VerticalBorder], Any(sal_Int32(aBorderColor.GetRGBColor()))); setPropertyValue( maPropertyIdToNameMap[Image_Grip], @@ -546,9 +528,8 @@ void Theme::SetupPropertyMaps() { maPropertyIdToNameMap.resize(Post_Bool_); maImages.resize(Image_Color_ - Pre_Image_ - 1); - maColors.resize(Color_Paint_ - Image_Color_ - 1); - maPaints.resize(Paint_Int_ - Color_Paint_ - 1); - maIntegers.resize(Int_Bool_ - Paint_Int_ - 1); + maColors.resize(Color_Int_ - Image_Color_ - 1); + maIntegers.resize(Int_Bool_ - Color_Int_ - 1); maBooleans.resize(Post_Bool_ - Int_Bool_ - 1); maPropertyNameToIdMap["Image_Grip"]=Image_Grip; @@ -595,35 +576,35 @@ void Theme::SetupPropertyMaps() maPropertyIdToNameMap[Color_HighlightText]="Color_HighlightText"; - maPropertyNameToIdMap["Paint_DeckBackground"]=Paint_DeckBackground; - maPropertyIdToNameMap[Paint_DeckBackground]="Paint_DeckBackground"; + maPropertyNameToIdMap["Color_DeckBackground"]=Color_DeckBackground; + maPropertyIdToNameMap[Color_DeckBackground]="Color_DeckBackground"; - maPropertyNameToIdMap["Paint_DeckTitleBarBackground"]=Paint_DeckTitleBarBackground; - maPropertyIdToNameMap[Paint_DeckTitleBarBackground]="Paint_DeckTitleBarBackground"; + maPropertyNameToIdMap["Color_DeckTitleBarBackground"]=Color_DeckTitleBarBackground; + maPropertyIdToNameMap[Color_DeckTitleBarBackground]="Color_DeckTitleBarBackground"; - maPropertyNameToIdMap["Paint_PanelBackground"]=Paint_PanelBackground; - maPropertyIdToNameMap[Paint_PanelBackground]="Paint_PanelBackground"; + maPropertyNameToIdMap["Color_PanelBackground"]=Color_PanelBackground; + maPropertyIdToNameMap[Color_PanelBackground]="Color_PanelBackground"; - maPropertyNameToIdMap["Paint_PanelTitleBarBackground"]=Paint_PanelTitleBarBackground; - maPropertyIdToNameMap[Paint_PanelTitleBarBackground]="Paint_PanelTitleBarBackground"; + maPropertyNameToIdMap["Color_PanelTitleBarBackground"]=Color_PanelTitleBarBackground; + maPropertyIdToNameMap[Color_PanelTitleBarBackground]="Color_PanelTitleBarBackground"; - maPropertyNameToIdMap["Paint_TabBarBackground"]=Paint_TabBarBackground; - maPropertyIdToNameMap[Paint_TabBarBackground]="Paint_TabBarBackground"; + maPropertyNameToIdMap["Color_TabBarBackground"]=Color_TabBarBackground; + maPropertyIdToNameMap[Color_TabBarBackground]="Color_TabBarBackground"; - maPropertyNameToIdMap["Paint_TabItemBackgroundNormal"]=Paint_TabItemBackgroundNormal; - maPropertyIdToNameMap[Paint_TabItemBackgroundNormal]="Paint_TabItemBackgroundNormal"; + maPropertyNameToIdMap["Color_TabItemBackgroundNormal"]=Color_TabItemBackgroundNormal; + maPropertyIdToNameMap[Color_TabItemBackgroundNormal]="Color_TabItemBackgroundNormal"; - maPropertyNameToIdMap["Paint_TabItemBackgroundHighlight"]=Paint_TabItemBackgroundHighlight; - maPropertyIdToNameMap[Paint_TabItemBackgroundHighlight]="Paint_TabItemBackgroundHighlight"; + maPropertyNameToIdMap["Color_TabItemBackgroundHighlight"]=Color_TabItemBackgroundHighlight; + maPropertyIdToNameMap[Color_TabItemBackgroundHighlight]="Color_TabItemBackgroundHighlight"; - maPropertyNameToIdMap["Paint_HorizontalBorder"]=Paint_HorizontalBorder; - maPropertyIdToNameMap[Paint_HorizontalBorder]="Paint_HorizontalBorder"; + maPropertyNameToIdMap["Color_HorizontalBorder"]=Color_HorizontalBorder; + maPropertyIdToNameMap[Color_HorizontalBorder]="Color_HorizontalBorder"; - maPropertyNameToIdMap["Paint_VerticalBorder"]=Paint_VerticalBorder; - maPropertyIdToNameMap[Paint_VerticalBorder]="Paint_VerticalBorder"; + maPropertyNameToIdMap["Color_VerticalBorder"]=Color_VerticalBorder; + maPropertyIdToNameMap[Color_VerticalBorder]="Color_VerticalBorder"; - maPropertyNameToIdMap["Paint_DropDownBackground"]=Paint_DropDownBackground; - maPropertyIdToNameMap[Paint_DropDownBackground]="Paint_DropDownBackground"; + maPropertyNameToIdMap["Color_DropDownBackground"]=Color_DropDownBackground; + maPropertyIdToNameMap[Color_DropDownBackground]="Color_DropDownBackground"; maPropertyNameToIdMap["Int_DeckTitleBarHeight"]=Int_DeckTitleBarHeight; @@ -707,20 +688,18 @@ Theme::PropertyType Theme::GetPropertyType (const ThemeItem eItem) case Color_DropDownBorder: case Color_Highlight: case Color_HighlightText: + case Color_DeckBackground: + case Color_DeckTitleBarBackground: + case Color_PanelBackground: + case Color_PanelTitleBarBackground: + case Color_TabBarBackground: + case Color_TabItemBackgroundNormal: + case Color_TabItemBackgroundHighlight: + case Color_HorizontalBorder: + case Color_VerticalBorder: + case Color_DropDownBackground: return PT_Color; - case Paint_DeckBackground: - case Paint_DeckTitleBarBackground: - case Paint_PanelBackground: - case Paint_PanelTitleBarBackground: - case Paint_TabBarBackground: - case Paint_TabItemBackgroundNormal: - case Paint_TabItemBackgroundHighlight: - case Paint_HorizontalBorder: - case Paint_VerticalBorder: - case Paint_DropDownBackground: - return PT_Paint; - case Int_DeckTitleBarHeight: case Int_DeckBorderSize: case Int_DeckSeparatorHeight: @@ -759,9 +738,6 @@ css::uno::Type const & Theme::GetCppuType (const PropertyType eType) case PT_Color: return cppu::UnoType<sal_uInt32>::get(); - case PT_Paint: - return cppu::UnoType<void>::get(); - case PT_Integer: return cppu::UnoType<sal_Int32>::get(); @@ -782,10 +758,8 @@ sal_Int32 Theme::GetIndex (const ThemeItem eItem, const PropertyType eType) return eItem - Pre_Image_-1; case PT_Color: return eItem - Image_Color_-1; - case PT_Paint: - return eItem - Color_Paint_-1; case PT_Integer: - return eItem - Paint_Int_-1; + return eItem - Color_Int_-1; case PT_Boolean: return eItem - Int_Bool_-1; default: @@ -899,11 +873,6 @@ void Theme::ProcessNewValue ( } break; } - case PT_Paint: - { - maPaints[nIndex] = Paint::Create(rValue); - break; - } case PT_Integer: { sal_Int32 nValue (0); diff --git a/sfx2/source/sidebar/TitleBar.cxx b/sfx2/source/sidebar/TitleBar.cxx index 55aefc0f2725..5324857c56cc 100644 --- a/sfx2/source/sidebar/TitleBar.cxx +++ b/sfx2/source/sidebar/TitleBar.cxx @@ -18,7 +18,6 @@ */ #include <sidebar/TitleBar.hxx> -#include <sidebar/Paint.hxx> #include <sidebar/AccessibleTitleBar.hxx> #include <com/sun/star/accessibility/AccessibleRole.hpp> @@ -33,12 +32,12 @@ namespace sfx2::sidebar { TitleBar::TitleBar(const OUString& rsTitle, vcl::Window* pParentWindow, - const sidebar::Paint& rInitialBackgroundPaint) + const Color& rInitialBackgroundColor) : Window(pParentWindow) , maToolBox(VclPtr<SidebarToolBox>::Create(this)) , msTitle(rsTitle) , maIcon() - , maBackgroundPaint(rInitialBackgroundPaint) + , maBackgroundColor(rInitialBackgroundColor) { maToolBox->SetSelectHdl(LINK(this, TitleBar, SelectionHandler)); } @@ -68,7 +67,7 @@ void TitleBar::SetIcon(const css::uno::Reference<css::graphic::XGraphic>& rIcon) void TitleBar::ApplySettings(vcl::RenderContext& rRenderContext) { - rRenderContext.SetBackground(maBackgroundPaint.GetWallpaper()); + rRenderContext.SetBackground(maBackgroundColor); } void TitleBar::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& /*rUpdateArea*/) @@ -85,7 +84,7 @@ void TitleBar::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& void TitleBar::DataChanged (const DataChangedEvent& /*rEvent*/) { - maBackgroundPaint = GetBackgroundPaint(); + maBackgroundColor = GetBackgroundPaintColor(); Invalidate(); } |