bump product version to 4.2.0.1
[LibreOffice.git] / include / svx / sidebar / ColorControl.hxx
blobc76d7f0cfe1f36517ba6e4a8005e2772a2fe5a64
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SVX_SIDEBAR_COLORCONTROL_HXX
21 #define INCLUDED_SVX_SIDEBAR_COLORCONTROL_HXX
23 #include <svx/sidebar/PopupControl.hxx>
25 #include <svtools/valueset.hxx>
26 #include <boost/function.hpp>
27 #include <svx/SvxColorValueSet.hxx>
29 class Window;
30 class SfxBindings;
31 class RedId;
32 class FloatingWindow;
35 namespace svx { namespace sidebar {
37 /** The ColorControl uses a ValueSet control for displaying all named
38 colors in a matrix.
40 class SVX_DLLPUBLIC ColorControl
41 : public PopupControl
43 public:
44 /** Create a new ColorControl object.
45 @param rControlResId
46 The resource id for the whole color control.
47 @param rNoColorGetter
48 A functor for getting the color which will be returned when the
49 WB_NONEFIELD is used and got selected
50 @param rColorSetter
51 A functor for setting the color that is selected by the
52 user.
53 @param pNoColorStringResId
54 Resource id of an optional string for the "no color"
55 string. When a value is given then a
56 field/button is created above the color matrix for
57 selecting "no color" ie. transparent.
58 When zero is given then no such field is created.
60 ColorControl (
61 Window* pParent,
62 SfxBindings* pBindings,
63 const ResId& rControlResId,
64 const ResId& rValueSetResId,
65 const ::boost::function<Color(void)>& rNoColorGetter,
66 const ::boost::function<void(OUString&,Color)>& rColorSetter,
67 FloatingWindow* pFloatingWindow,
68 const ResId* pNoColorStringResId);
69 virtual ~ColorControl (void);
71 void GetFocus (void);
72 void SetCurColorSelect (
73 const Color aCol,
74 const bool bAvl);
76 private:
77 SvxColorValueSet maVSColor;
78 FloatingWindow* mpFloatingWindow;
79 const OUString msNoColorString;
80 ::boost::function<Color(void)> maNoColorGetter;
81 ::boost::function<void(OUString&,Color)> maColorSetter;
83 void FillColors (void);
84 DECL_LINK(VSSelectHdl, void *);
87 } } // end of namespace svx::sidebar
89 #endif // INCLUDED_SVX_SIDEBAR_COLORCONTROL_HXX
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */