1facb16e7SArmin Le Grand /**************************************************************
2facb16e7SArmin Le Grand  *
3facb16e7SArmin Le Grand  * Licensed to the Apache Software Foundation (ASF) under one
4facb16e7SArmin Le Grand  * or more contributor license agreements.  See the NOTICE file
5facb16e7SArmin Le Grand  * distributed with this work for additional information
6facb16e7SArmin Le Grand  * regarding copyright ownership.  The ASF licenses this file
7facb16e7SArmin Le Grand  * to you under the Apache License, Version 2.0 (the
8facb16e7SArmin Le Grand  * "License"); you may not use this file except in compliance
9facb16e7SArmin Le Grand  * with the License.  You may obtain a copy of the License at
10facb16e7SArmin Le Grand  *
11facb16e7SArmin Le Grand  *   http://www.apache.org/licenses/LICENSE-2.0
12facb16e7SArmin Le Grand  *
13facb16e7SArmin Le Grand  * Unless required by applicable law or agreed to in writing,
14facb16e7SArmin Le Grand  * software distributed under the License is distributed on an
15facb16e7SArmin Le Grand  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16facb16e7SArmin Le Grand  * KIND, either express or implied.  See the License for the
17facb16e7SArmin Le Grand  * specific language governing permissions and limitations
18facb16e7SArmin Le Grand  * under the License.
19facb16e7SArmin Le Grand  *
20facb16e7SArmin Le Grand  *************************************************************/
21facb16e7SArmin Le Grand 
22facb16e7SArmin Le Grand #ifndef SC_PROPERTYPANEL_APPEARANCE_HXX
23facb16e7SArmin Le Grand #define SC_PROPERTYPANEL_APPEARANCE_HXX
24facb16e7SArmin Le Grand 
25facb16e7SArmin Le Grand #include <sfx2/sidebar/ControllerItem.hxx>
26facb16e7SArmin Le Grand #include <sfx2/sidebar/IContextChangeReceiver.hxx>
27facb16e7SArmin Le Grand #include <boost/scoped_ptr.hpp>
28facb16e7SArmin Le Grand #include <svx/sidebar/ColorPopup.hxx>
29facb16e7SArmin Le Grand 
30facb16e7SArmin Le Grand class FixedText;
31facb16e7SArmin Le Grand namespace svx { class ToolboxButtonColorUpdater; }
32facb16e7SArmin Le Grand namespace sc { namespace sidebar {
33facb16e7SArmin Le Grand     class CellLineStylePopup;
34facb16e7SArmin Le Grand     class CellBorderStylePopup;
35facb16e7SArmin Le Grand     class CellLineStyleControl;
36facb16e7SArmin Le Grand     class CellBorderUpdater;
37facb16e7SArmin Le Grand }}
38facb16e7SArmin Le Grand class ToolBox;
39facb16e7SArmin Le Grand class CheckBox;
40facb16e7SArmin Le Grand 
41facb16e7SArmin Le Grand namespace sc { namespace sidebar {
42facb16e7SArmin Le Grand 
43facb16e7SArmin Le Grand class CellAppearancePropertyPanel
44facb16e7SArmin Le Grand :   public Control,
45facb16e7SArmin Le Grand     public ::sfx2::sidebar::IContextChangeReceiver,
46facb16e7SArmin Le Grand     public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
47facb16e7SArmin Le Grand {
48facb16e7SArmin Le Grand private:
49facb16e7SArmin Le Grand     friend class CellLineStyleControl;
50facb16e7SArmin Le Grand     friend class CellBorderStyleControl;
51facb16e7SArmin Le Grand 
52facb16e7SArmin Le Grand public:
53facb16e7SArmin Le Grand     static CellAppearancePropertyPanel* Create(
54facb16e7SArmin Le Grand         Window* pParent,
55facb16e7SArmin Le Grand         const cssu::Reference<css::frame::XFrame>& rxFrame,
56facb16e7SArmin Le Grand         SfxBindings* pBindings);
57facb16e7SArmin Le Grand 
58facb16e7SArmin Le Grand     virtual void DataChanged(
59facb16e7SArmin Le Grand         const DataChangedEvent& rEvent);
60facb16e7SArmin Le Grand 
61facb16e7SArmin Le Grand     virtual void HandleContextChange(
62facb16e7SArmin Le Grand         const ::sfx2::sidebar::EnumContext aContext);
63facb16e7SArmin Le Grand 
64facb16e7SArmin Le Grand     virtual void NotifyItemUpdate(
65facb16e7SArmin Le Grand         const sal_uInt16 nSId,
66facb16e7SArmin Le Grand         const SfxItemState eState,
6745da7d5eSAndre Fischer         const SfxPoolItem* pState,
6845da7d5eSAndre Fischer         const bool bIsEnabled);
69facb16e7SArmin Le Grand 
70facb16e7SArmin Le Grand     SfxBindings* GetBindings();
71facb16e7SArmin Le Grand 
72*6a606da0SAndre Fischer     virtual void Resize (void);
73*6a606da0SAndre Fischer 
74facb16e7SArmin Le Grand private:
75facb16e7SArmin Le Grand     //ui controls
76facb16e7SArmin Le Grand     ::boost::scoped_ptr< FixedText >        mpFTFillColor;
77facb16e7SArmin Le Grand     ::boost::scoped_ptr< Window >           mpTBFillColorBackground;
78facb16e7SArmin Le Grand     ::boost::scoped_ptr< ToolBox >          mpTBFillColor;
79facb16e7SArmin Le Grand     ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpFillColorUpdater;
80facb16e7SArmin Le Grand 
81facb16e7SArmin Le Grand     ::boost::scoped_ptr< FixedText >        mpFTCellBorder;
82facb16e7SArmin Le Grand     ::boost::scoped_ptr< Window >           mpTBCellBorderBackground;
83facb16e7SArmin Le Grand     ::boost::scoped_ptr< ToolBox >          mpTBCellBorder;
84facb16e7SArmin Le Grand     ::boost::scoped_ptr< CellBorderUpdater > mpCellBorderUpdater;
85facb16e7SArmin Le Grand 
86facb16e7SArmin Le Grand     ::boost::scoped_ptr< Window >           mpTBLineStyleBackground;
87facb16e7SArmin Le Grand     ::boost::scoped_ptr< ToolBox >          mpTBLineStyle;
88facb16e7SArmin Le Grand 
89facb16e7SArmin Le Grand     ::boost::scoped_ptr< Window >           mpTBLineColorBackground;
90facb16e7SArmin Le Grand     ::boost::scoped_ptr< ToolBox >          mpTBLineColor;
91facb16e7SArmin Le Grand     ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpLineColorUpdater;
92facb16e7SArmin Le Grand 
93facb16e7SArmin Le Grand     ::boost::scoped_ptr< CheckBox >         mpCBXShowGrid;
94facb16e7SArmin Le Grand 
95facb16e7SArmin Le Grand     ::sfx2::sidebar::ControllerItem         maBackColorControl;
96facb16e7SArmin Le Grand     ::sfx2::sidebar::ControllerItem         maLineColorControl;
97facb16e7SArmin Le Grand     ::sfx2::sidebar::ControllerItem         maLineStyleControl;
98facb16e7SArmin Le Grand     ::sfx2::sidebar::ControllerItem         maBorderOuterControl;
99facb16e7SArmin Le Grand     ::sfx2::sidebar::ControllerItem         maBorderInnerControl;
100facb16e7SArmin Le Grand     ::sfx2::sidebar::ControllerItem         maGridShowControl;
101facb16e7SArmin Le Grand     ::sfx2::sidebar::ControllerItem         maBorderTLBRControl;
102facb16e7SArmin Le Grand     ::sfx2::sidebar::ControllerItem         maBorderBLTRControl;
103facb16e7SArmin Le Grand 
104facb16e7SArmin Le Grand     // images
105facb16e7SArmin Le Grand     Image                                   maIMGBKColor;
106facb16e7SArmin Le Grand     Image                                   maIMGCellBorder;
107facb16e7SArmin Le Grand     Image                                   maIMGLineColor;
108facb16e7SArmin Le Grand     Image                                   maIMGLineStyle1;
109facb16e7SArmin Le Grand     Image                                   maIMGLineStyle2;
110facb16e7SArmin Le Grand     Image                                   maIMGLineStyle3;
111facb16e7SArmin Le Grand     Image                                   maIMGLineStyle4;
112facb16e7SArmin Le Grand     Image                                   maIMGLineStyle5;
113facb16e7SArmin Le Grand     Image                                   maIMGLineStyle6;
114facb16e7SArmin Le Grand     Image                                   maIMGLineStyle7;
115facb16e7SArmin Le Grand     Image                                   maIMGLineStyle8;
116facb16e7SArmin Le Grand     Image                                   maIMGLineStyle9;
117facb16e7SArmin Le Grand 
118facb16e7SArmin Le Grand     // high contrast images
119facb16e7SArmin Le Grand     Image                                   maIMGBKColorH;
120facb16e7SArmin Le Grand     Image                                   maIMGLineStyle0H;
121facb16e7SArmin Le Grand     Image                                   maIMGLineStyle1H;
122facb16e7SArmin Le Grand     Image                                   maIMGLineStyle2H;
123facb16e7SArmin Le Grand     Image                                   maIMGLineStyle3H;
124facb16e7SArmin Le Grand     Image                                   maIMGLineStyle4H;
125facb16e7SArmin Le Grand     Image                                   maIMGLineStyle5H;
126facb16e7SArmin Le Grand     Image                                   maIMGLineStyle6H;
127facb16e7SArmin Le Grand     Image                                   maIMGLineStyle7H;
128facb16e7SArmin Le Grand     Image                                   maIMGLineStyle8H;
129facb16e7SArmin Le Grand     Image                                   maIMGLineStyle9H;
130facb16e7SArmin Le Grand 
131facb16e7SArmin Le Grand     // cell background color
132facb16e7SArmin Le Grand     Color                                   maBackColor;
133facb16e7SArmin Le Grand 
134facb16e7SArmin Le Grand     // cell line color(s)
135facb16e7SArmin Le Grand     Color                                   maLineColor;
136facb16e7SArmin Le Grand     Color                                   maTLBRColor;
137facb16e7SArmin Le Grand     Color                                   maBLTRColor;
138facb16e7SArmin Le Grand 
139facb16e7SArmin Le Grand     // BorderStyle defines
140facb16e7SArmin Le Grand     sal_uInt16                              mnIn;
141facb16e7SArmin Le Grand     sal_uInt16                              mnOut;
142facb16e7SArmin Le Grand     sal_uInt16                              mnDis;
143facb16e7SArmin Le Grand     sal_uInt16                              mnTLBRIn;
144facb16e7SArmin Le Grand     sal_uInt16                              mnTLBROut;
145facb16e7SArmin Le Grand     sal_uInt16                              mnTLBRDis;
146facb16e7SArmin Le Grand     sal_uInt16                              mnBLTRIn;
147facb16e7SArmin Le Grand     sal_uInt16                              mnBLTROut;
148facb16e7SArmin Le Grand     sal_uInt16                              mnBLTRDis;
149facb16e7SArmin Le Grand 
150facb16e7SArmin Le Grand     /// bitfield
151facb16e7SArmin Le Grand     bool                                    mbBackColorAvailable : 1;
152facb16e7SArmin Le Grand     bool                                    mbLineColorAvailable : 1;
153facb16e7SArmin Le Grand     bool                                    mbBorderStyleAvailable : 1;
154facb16e7SArmin Le Grand 
155facb16e7SArmin Le Grand     // CellBorder defines
156facb16e7SArmin Le Grand     bool                                    mbLeft : 1;
157facb16e7SArmin Le Grand     bool                                    mbRight : 1;
158facb16e7SArmin Le Grand     bool                                    mbTop : 1;
159facb16e7SArmin Le Grand     bool                                    mbBottom : 1;
160facb16e7SArmin Le Grand     bool                                    mbVer : 1;
161facb16e7SArmin Le Grand     bool                                    mbHor : 1;
162facb16e7SArmin Le Grand 
163facb16e7SArmin Le Grand     bool                                    mbOuterBorder : 1; // mbLeft || mbRight || mbTop || mbBottom
164facb16e7SArmin Le Grand     bool                                    mbInnerBorder : 1; // mbVer || mbHor || bLeft || bRight || bTop || bBottom
165facb16e7SArmin Le Grand 
166facb16e7SArmin Le Grand     bool                                    mbTLBR : 1;
167facb16e7SArmin Le Grand     bool                                    mbBLTR : 1;
168facb16e7SArmin Le Grand 
169facb16e7SArmin Le Grand     // popups
170facb16e7SArmin Le Grand     svx::sidebar::ColorPopup                maFillColorPopup;
171facb16e7SArmin Le Grand     svx::sidebar::ColorPopup                maLineColorPopup;
172facb16e7SArmin Le Grand     ::boost::scoped_ptr< CellLineStylePopup > mpCellLineStylePopup;
173facb16e7SArmin Le Grand     ::boost::scoped_ptr< CellBorderStylePopup > mpCellBorderStylePopup;
174facb16e7SArmin Le Grand 
175facb16e7SArmin Le Grand     cssu::Reference<css::frame::XFrame>     mxFrame;
176facb16e7SArmin Le Grand     ::sfx2::sidebar::EnumContext            maContext;
177facb16e7SArmin Le Grand     SfxBindings*                            mpBindings;
178facb16e7SArmin Le Grand 
179facb16e7SArmin Le Grand     DECL_LINK(TbxBKColorSelectHdl, ToolBox*);
180facb16e7SArmin Le Grand     DECL_LINK(TbxLineColorSelectHdl, ToolBox*);
181facb16e7SArmin Le Grand     DECL_LINK(TbxCellBorderSelectHdl, ToolBox*);
182facb16e7SArmin Le Grand     DECL_LINK(TbxLineStyleSelectHdl, ToolBox*);
183facb16e7SArmin Le Grand     DECL_LINK(CBOXGridShowClkHdl, void*);
184facb16e7SArmin Le Grand 
185facb16e7SArmin Le Grand     // for fill color picker
186facb16e7SArmin Le Grand     svx::sidebar::PopupControl* CreateFillColorPopupControl(svx::sidebar::PopupContainer* pParent);
187facb16e7SArmin Le Grand     void SetFillColor(const String& rsColorName, const Color aColor);
188facb16e7SArmin Le Grand 
189facb16e7SArmin Le Grand     // for line color picker
190facb16e7SArmin Le Grand     svx::sidebar::PopupControl* CreateLineColorPopupControl(svx::sidebar::PopupContainer* pParent);
191facb16e7SArmin Le Grand     void SetLineColor(const String& rsColorName, const Color aColor);
192facb16e7SArmin Le Grand 
193facb16e7SArmin Le Grand     // for CellLineStyle popup
194facb16e7SArmin Le Grand     svx::sidebar::PopupControl* CreateCellLineStylePopupControl(svx::sidebar::PopupContainer* pParent);
195facb16e7SArmin Le Grand     void EndCellLineStylePopupMode(void);
196facb16e7SArmin Le Grand 
197facb16e7SArmin Le Grand     // for CellBorderStyle popup
198facb16e7SArmin Le Grand     svx::sidebar::PopupControl* CreateCellBorderStylePopupControl(svx::sidebar::PopupContainer* pParent);
199facb16e7SArmin Le Grand     void EndCellBorderStylePopupMode(void);
200facb16e7SArmin Le Grand 
201facb16e7SArmin Le Grand     // constructor/destuctor
202facb16e7SArmin Le Grand     CellAppearancePropertyPanel(
203facb16e7SArmin Le Grand         Window* pParent,
204facb16e7SArmin Le Grand         const cssu::Reference<css::frame::XFrame>& rxFrame,
205facb16e7SArmin Le Grand         SfxBindings* pBindings);
206facb16e7SArmin Le Grand     virtual ~CellAppearancePropertyPanel();
207facb16e7SArmin Le Grand 
208facb16e7SArmin Le Grand     void Initialize();
209facb16e7SArmin Le Grand     void SetStyleIcon();
210facb16e7SArmin Le Grand     void UpdateControlState();
211facb16e7SArmin Le Grand };
212facb16e7SArmin Le Grand 
213facb16e7SArmin Le Grand } } // end of namespace ::sc::sidebar
214facb16e7SArmin Le Grand 
215facb16e7SArmin Le Grand #endif
216facb16e7SArmin Le Grand // eof
217