LibreOffice Module svx (master)  1
tbxcolorupdate.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #pragma once
21 
22 #include <tools/gen.hxx>
23 #include <tools/color.hxx>
24 #include <vcl/vclenum.hxx>
25 #include <vcl/vclptr.hxx>
26 #include <vcl/toolbox.hxx>
27 #include <svx/Palette.hxx>
28 #include <com/sun/star/drawing/LineStyle.hpp>
29 #include <com/sun/star/frame/FeatureStateEvent.hpp>
30 #include <com/sun/star/frame/XFrame.hpp>
31 
32 class ToolBox;
33 class VirtualDevice;
34 
35 namespace weld
36 {
37  class Toolbar;
38 }
39 
40 namespace svx
41 {
42 
43 
44  //= ToolboxButtonColorUpdater
45 
51  {
52  public:
53  ToolboxButtonColorUpdaterBase(bool bWideButton, const OUString& rCommandLabel,
54  const OUString& rCommandURL,
55  const css::uno::Reference<css::frame::XFrame>& rFrame);
56 
58 
59  void Update( const NamedColor& rNamedColor );
60  void Update( const Color& rColor, bool bForceUpdate = false );
61  Color const & GetCurrentColor() const { return maCurColor; }
62  OUString GetCurrentColorName() const;
63 
64  private:
67 
68  protected:
75  OUString maCommandLabel;
76  OUString maCommandURL;
77  css::uno::Reference<css::frame::XFrame> mxFrame;
78 
79  void Init(sal_uInt16 nSlotId);
80 
81  virtual void SetQuickHelpText(const OUString& rText) = 0;
82  virtual OUString GetQuickHelpText() const = 0;
83  virtual void SetImage(VirtualDevice* pVirDev) = 0;
84  virtual VclPtr<VirtualDevice> CreateVirtualDevice() const = 0;
85  virtual vcl::ImageType GetImageSize() const = 0;
86  virtual Size GetItemSize(const Size& rImageSize) const = 0;
87  };
88 
90  {
91  public:
92  VclToolboxButtonColorUpdater(sal_uInt16 nSlotId, sal_uInt16 nTbxBtnId, ToolBox* ptrTbx, bool bWideButton,
93  const OUString& rCommandLabel, const OUString& rCommandURL,
94  const css::uno::Reference<css::frame::XFrame>& rFrame);
95 
96 
97  private:
98  sal_uInt16 mnBtnId;
100 
101  virtual void SetQuickHelpText(const OUString& rText) override;
102  virtual OUString GetQuickHelpText() const override;
103  virtual void SetImage(VirtualDevice* pVirDev) override;
104  virtual VclPtr<VirtualDevice> CreateVirtualDevice() const override;
105  virtual vcl::ImageType GetImageSize() const override;
106  virtual Size GetItemSize(const Size& rImageSize) const override;
107  };
108 
110  {
111  public:
112  ToolboxButtonColorUpdater(sal_uInt16 nSlotId, const OString& rTbxBtnId, weld::Toolbar* ptrTbx, bool bWideButton,
113  const OUString& rCommandLabel, const css::uno::Reference<css::frame::XFrame>& rFrame);
114 
115  private:
116  OString msBtnId;
118 
119  virtual void SetQuickHelpText(const OUString& rText) override;
120  virtual OUString GetQuickHelpText() const override;
121  virtual void SetImage(VirtualDevice* pVirDev) override;
122  virtual VclPtr<VirtualDevice> CreateVirtualDevice() const override;
123  virtual vcl::ImageType GetImageSize() const override;
124  virtual Size GetItemSize(const Size& rImageSize) const override;
125  };
126 
128  {
129  private:
130  css::drawing::LineStyle m_eXLS;
132  public:
134  void Update(const css::frame::FeatureStateEvent& rEvent);
135  int GetStyleIndex() const;
136  };
137 }
138 
139 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual OUString GetQuickHelpText() const =0
std::pair< Color, OUString > NamedColor
Definition: Palette.hxx:29
Color const & GetCurrentColor() const
void Init(sal_uInt16 nSlotId)
virtual Size GetItemSize(const Size &rImageSize) const override
virtual OUString GetQuickHelpText() const override
virtual Size GetItemSize(const Size &rImageSize) const override
virtual OUString GetQuickHelpText() const override
virtual VclPtr< VirtualDevice > CreateVirtualDevice() const override
virtual VclPtr< VirtualDevice > CreateVirtualDevice() const override
ToolboxButtonColorUpdaterBase(bool bWideButton, const OUString &rCommandLabel, const OUString &rCommandURL, const css::uno::Reference< css::frame::XFrame > &rFrame)
virtual vcl::ImageType GetImageSize() const =0
VclToolboxButtonColorUpdater(sal_uInt16 nSlotId, sal_uInt16 nTbxBtnId, ToolBox *ptrTbx, bool bWideButton, const OUString &rCommandLabel, const OUString &rCommandURL, const css::uno::Reference< css::frame::XFrame > &rFrame)
virtual void SetImage(VirtualDevice *pVirDev) override
virtual void SetQuickHelpText(const OUString &rText) override
ToolboxButtonColorUpdaterBase & operator=(ToolboxButtonColorUpdaterBase const &)=delete
virtual void SetQuickHelpText(const OUString &rText) override
virtual void SetQuickHelpText(const OUString &rText)=0
virtual Size GetItemSize(const Size &rImageSize) const =0
virtual vcl::ImageType GetImageSize() const override
ToolboxButtonColorUpdater(sal_uInt16 nSlotId, const OString &rTbxBtnId, weld::Toolbar *ptrTbx, bool bWideButton, const OUString &rCommandLabel, const css::uno::Reference< css::frame::XFrame > &rFrame)
helper class to update a color in a toolbox button image
virtual void SetImage(VirtualDevice *pVirDev)=0
virtual VclPtr< VirtualDevice > CreateVirtualDevice() const =0
css::uno::Reference< css::frame::XFrame > mxFrame
virtual vcl::ImageType GetImageSize() const override
void Update(const css::frame::FeatureStateEvent &rEvent)
virtual void SetImage(VirtualDevice *pVirDev) override
void Update(const NamedColor &rNamedColor)