xref: /aoo4110/main/svx/source/sidebar/ColorPanel.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 #ifndef SVX_SIDEBAR_COLOR_PANEL_HXX
23 #define SVX_SIDEBAR_COLOR_PANEL_HXX
24 
25 #include <svtools/valueset.hxx>
26 #include <vcl/window.hxx>
27 
28 
29 namespace svx { namespace sidebar {
30 
31 
32 /** This demo panel shows the colors that are available from the
33     StyleSettings.
34 */
35 class ColorPanel
36     : public ValueSet
37 {
38 public:
39     ColorPanel (::Window* pParent);
40     virtual ~ColorPanel (void);
41 
42     // From ::Window
43     virtual void Resize (void);
44     virtual void DataChanged (const DataChangedEvent& rEvent);
45 
46 private:
47     int mnPreferredColumnCount;
48 
49     /** Depending on the given number of columns and the item size
50         calculate the number of rows that are necessary to display all
51         items.
52     */
53     int CalculateRowCount (const Size& rItemSize, int nColumnCount);
54     void Fill (void);
55 
56     sal_Int32 GetPreferredHeight (sal_Int32 nWidth);
57 };
58 
59 } } // end of namespace ::svx::sidebar
60 
61 #endif
62