18dcb2a10SAndre Fischer /************************************************************** 28dcb2a10SAndre Fischer * 38dcb2a10SAndre Fischer * Licensed to the Apache Software Foundation (ASF) under one 48dcb2a10SAndre Fischer * or more contributor license agreements. See the NOTICE file 58dcb2a10SAndre Fischer * distributed with this work for additional information 68dcb2a10SAndre Fischer * regarding copyright ownership. The ASF licenses this file 78dcb2a10SAndre Fischer * to you under the Apache License, Version 2.0 (the 88dcb2a10SAndre Fischer * "License"); you may not use this file except in compliance 98dcb2a10SAndre Fischer * with the License. You may obtain a copy of the License at 108dcb2a10SAndre Fischer * 118dcb2a10SAndre Fischer * http://www.apache.org/licenses/LICENSE-2.0 128dcb2a10SAndre Fischer * 138dcb2a10SAndre Fischer * Unless required by applicable law or agreed to in writing, 148dcb2a10SAndre Fischer * software distributed under the License is distributed on an 158dcb2a10SAndre Fischer * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 168dcb2a10SAndre Fischer * KIND, either express or implied. See the License for the 178dcb2a10SAndre Fischer * specific language governing permissions and limitations 188dcb2a10SAndre Fischer * under the License. 198dcb2a10SAndre Fischer * 208dcb2a10SAndre Fischer *************************************************************/ 218dcb2a10SAndre Fischer 228dcb2a10SAndre Fischer #include "svx/sidebar/PopupControl.hxx" 238dcb2a10SAndre Fischer 248dcb2a10SAndre Fischer #include <svtools/valueset.hxx> 258dcb2a10SAndre Fischer #include <boost/function.hpp> 26*28bcfa49SArmin Le Grand #include <svx/SvxColorValueSet.hxx> 278dcb2a10SAndre Fischer 288dcb2a10SAndre Fischer class Window; 298dcb2a10SAndre Fischer class SfxBindings; 308dcb2a10SAndre Fischer class RedId; 318dcb2a10SAndre Fischer class FloatingWindow; 328dcb2a10SAndre Fischer 338dcb2a10SAndre Fischer 348dcb2a10SAndre Fischer namespace svx { namespace sidebar { 358dcb2a10SAndre Fischer 368dcb2a10SAndre Fischer /** The ColorControl uses a ValueSet control for displaying all named 378dcb2a10SAndre Fischer colors in a matrix. 388dcb2a10SAndre Fischer */ 39facb16e7SArmin Le Grand class SVX_DLLPUBLIC ColorControl 408dcb2a10SAndre Fischer : public PopupControl 418dcb2a10SAndre Fischer { 428dcb2a10SAndre Fischer public: 438dcb2a10SAndre Fischer /** Create a new ColorControl object. 448dcb2a10SAndre Fischer @param rControlResId 458dcb2a10SAndre Fischer The resource id for the whole color control. 46df46ddf6SArmin Le Grand @param rNoColorGetter 47df46ddf6SArmin Le Grand A functor for getting the color which will be returned when the 48df46ddf6SArmin Le Grand WB_NONEFIELD is used and got selected 498dcb2a10SAndre Fischer @param rColorSetter 508dcb2a10SAndre Fischer A functor for setting the color that is selected by the 518dcb2a10SAndre Fischer user. 52facb16e7SArmin Le Grand @param pNoColorStringResId 538dcb2a10SAndre Fischer Resource id of an optional string for the "no color" 54facb16e7SArmin Le Grand string. When a value is given then a 558dcb2a10SAndre Fischer field/button is created above the color matrix for 568dcb2a10SAndre Fischer selecting "no color" ie. transparent. 578dcb2a10SAndre Fischer When zero is given then no such field is created. 588dcb2a10SAndre Fischer */ 598dcb2a10SAndre Fischer ColorControl ( 608dcb2a10SAndre Fischer Window* pParent, 618dcb2a10SAndre Fischer SfxBindings* pBindings, 628dcb2a10SAndre Fischer const ResId& rControlResId, 638dcb2a10SAndre Fischer const ResId& rValueSetResId, 64df46ddf6SArmin Le Grand const ::boost::function<Color(void)>& rNoColorGetter, 658dcb2a10SAndre Fischer const ::boost::function<void(String&,Color)>& rColorSetter, 668dcb2a10SAndre Fischer FloatingWindow* pFloatingWindow, 67facb16e7SArmin Le Grand const ResId* pNoColorStringResId); 688dcb2a10SAndre Fischer virtual ~ColorControl (void); 698dcb2a10SAndre Fischer 708dcb2a10SAndre Fischer void GetFocus (void); 718dcb2a10SAndre Fischer void SetCurColorSelect ( 728dcb2a10SAndre Fischer const Color aCol, 738dcb2a10SAndre Fischer const bool bAvl); 748dcb2a10SAndre Fischer 758dcb2a10SAndre Fischer private: 768dcb2a10SAndre Fischer SfxBindings* mpBindings; 77*28bcfa49SArmin Le Grand SvxColorValueSet maVSColor; 788dcb2a10SAndre Fischer FloatingWindow* mpFloatingWindow; 798dcb2a10SAndre Fischer const String msNoColorString; 80df46ddf6SArmin Le Grand ::boost::function<Color(void)> maNoColorGetter; 818dcb2a10SAndre Fischer ::boost::function<void(String&,Color)> maColorSetter; 828dcb2a10SAndre Fischer 838dcb2a10SAndre Fischer void FillColors (void); 848dcb2a10SAndre Fischer DECL_LINK(VSSelectHdl, void *); 858dcb2a10SAndre Fischer }; 868dcb2a10SAndre Fischer 878dcb2a10SAndre Fischer } } // end of namespace svx::sidebar 88