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 #ifndef INCLUDED_SVX_TBXCOLORUPDATE_HXX
21 #define INCLUDED_SVX_TBXCOLORUPDATE_HXX
22 
23 #include <svx/svxdllapi.h>
24 
25 #include <tools/gen.hxx>
26 #include <tools/color.hxx>
27 #include <vcl/vclenum.hxx>
28 #include <vcl/vclptr.hxx>
29 #include <svx/Palette.hxx>
30 #include <com/sun/star/drawing/LineStyle.hpp>
31 #include <com/sun/star/frame/FeatureStateEvent.hpp>
32 #include <com/sun/star/frame/XFrame.hpp>
33 
34 class ToolBox;
35 class VirtualDevice;
36 
37 namespace weld
38 {
39  class Toolbar;
40 }
41 
42 namespace svx
43 {
44 
45 
46  //= ToolboxButtonColorUpdater
47 
53  {
54  public:
55  ToolboxButtonColorUpdaterBase(bool bWideButton, const OUString& rCommandLabel,
56  const OUString& rCommandURL,
57  const css::uno::Reference<css::frame::XFrame>& rFrame);
58 
60 
61  void Update( const NamedColor& rNamedColor );
62  void Update( const Color& rColor, bool bForceUpdate = false );
63  Color const & GetCurrentColor() const { return maCurColor; }
64  OUString GetCurrentColorName();
65 
66  private:
69 
70  protected:
76  OUString maCommandLabel;
77  OUString maCommandURL;
78  css::uno::Reference<css::frame::XFrame> mxFrame;
79 
80  void Init(sal_uInt16 nSlotId);
81 
82  virtual void SetQuickHelpText(const OUString& rText) = 0;
83  virtual OUString GetQuickHelpText() const = 0;
84  virtual void SetImage(VirtualDevice* pVirDev) = 0;
85  virtual VclPtr<VirtualDevice> CreateVirtualDevice() const = 0;
86  virtual vcl::ImageType GetImageSize() const = 0;
87  virtual Size GetItemSize() const = 0;
88  };
89 
91  {
92  public:
93  VclToolboxButtonColorUpdater(sal_uInt16 nSlotId, sal_uInt16 nTbxBtnId, ToolBox* ptrTbx, bool bWideButton,
94  const OUString& rCommandLabel, const OUString& rCommandURL,
95  const css::uno::Reference<css::frame::XFrame>& rFrame);
96 
97 
98  private:
99  sal_uInt16 mnBtnId;
101 
102  virtual void SetQuickHelpText(const OUString& rText) override;
103  virtual OUString GetQuickHelpText() const override;
104  virtual void SetImage(VirtualDevice* pVirDev) override;
105  virtual VclPtr<VirtualDevice> CreateVirtualDevice() const override;
106  virtual vcl::ImageType GetImageSize() const override;
107  virtual Size GetItemSize() const override;
108  };
109 
111  {
112  public:
113  ToolboxButtonColorUpdater(sal_uInt16 nSlotId, const OString& rTbxBtnId, weld::Toolbar* ptrTbx, bool bWideButton,
114  const OUString& rCommandLabel, const css::uno::Reference<css::frame::XFrame>& rFrame);
115 
116  private:
117  OString msBtnId;
119 
120  virtual void SetQuickHelpText(const OUString& rText) override;
121  virtual OUString GetQuickHelpText() const override;
122  virtual void SetImage(VirtualDevice* pVirDev) override;
123  virtual VclPtr<VirtualDevice> CreateVirtualDevice() const override;
124  virtual vcl::ImageType GetImageSize() const override;
125  virtual Size GetItemSize() const override;
126  };
127 
129  {
130  private:
131  css::drawing::LineStyle m_eXLS;
133  public:
135  void Update(const css::frame::FeatureStateEvent& rEvent);
136  int GetStyleIndex() const;
137  };
138 }
139 
140 #endif // INCLUDED_SVX_TBXCOLORUPDATE_HXX
141 
142 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual OUString GetQuickHelpText() const =0
std::pair< Color, OUString > NamedColor
Definition: Palette.hxx:27
Color const & GetCurrentColor() const
void Init(sal_uInt16 nSlotId)
virtual OUString GetQuickHelpText() const override
virtual Size GetItemSize() const =0
virtual OUString GetQuickHelpText() const override
virtual VclPtr< VirtualDevice > CreateVirtualDevice() const override
virtual VclPtr< VirtualDevice > CreateVirtualDevice() const override
virtual Size GetItemSize() 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 override
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)