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 SC_PROPERTYPANEL_APPEARANCE_HXX
23 #define SC_PROPERTYPANEL_APPEARANCE_HXX
24 
25 #include <sfx2/sidebar/SidebarPanelBase.hxx>
26 #include <sfx2/sidebar/ControllerItem.hxx>
27 #include <sfx2/sidebar/IContextChangeReceiver.hxx>
28 #include <boost/scoped_ptr.hpp>
29 #include <svx/sidebar/ColorPopup.hxx>
30 
31 //#include <sfx2/sectionpage.hxx>
32 //#include <svx/dialcontrol.hxx>
33 //#include <svx/tbxcolorupdate.hxx>
34 //#include <svx/tbxlineupdate.hxx>
35 //#include <vcl/fixed.hxx>
36 //#include <vcl/toolbox.hxx>
37 //#include <vcl/button.hxx>
38 //#include <vcl/field.hxx>
39 //#include <svx/svxenum.hxx>
40 //#include <svx/borderline.hxx>
41 
42 class FixedText;
43 namespace svx { class ToolboxButtonColorUpdater; }
44 namespace sc { namespace sidebar {
45     class CellLineStylePopup;
46     class CellBorderStylePopup;
47     class CellLineStyleControl;
48     class CellBorderUpdater;
49 }}
50 class ToolBox;
51 class CheckBox;
52 
53 namespace sc { namespace sidebar {
54 
55 class CellAppearancePropertyPanel
56 :   public Control,
57     public ::sfx2::sidebar::IContextChangeReceiver,
58     public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
59 {
60 private:
61     friend class CellLineStyleControl;
62     friend class CellBorderStyleControl;
63 
64 public:
65     static CellAppearancePropertyPanel* Create(
66         Window* pParent,
67         const cssu::Reference<css::frame::XFrame>& rxFrame,
68         SfxBindings* pBindings);
69 
70     virtual void DataChanged(
71         const DataChangedEvent& rEvent);
72 
73     virtual void HandleContextChange(
74         const ::sfx2::sidebar::EnumContext aContext);
75 
76     virtual void NotifyItemUpdate(
77         const sal_uInt16 nSId,
78         const SfxItemState eState,
79         const SfxPoolItem* pState);
80 
81     SfxBindings* GetBindings();
82 
83     //virtual void Paint(const Rectangle &rRect);
84     //void SetColor(Color aColor, sal_uInt16 nType);
85 
86 private:
87     //ui controls
88     ::boost::scoped_ptr< FixedText >        mpFTFillColor;
89     ::boost::scoped_ptr< Window >           mpTBFillColorBackground;
90     ::boost::scoped_ptr< ToolBox >          mpTBFillColor;
91     ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpFillColorUpdater;
92 
93     ::boost::scoped_ptr< FixedText >        mpFTCellBorder;
94     ::boost::scoped_ptr< Window >           mpTBCellBorderBackground;
95     ::boost::scoped_ptr< ToolBox >          mpTBCellBorder;
96     ::boost::scoped_ptr< CellBorderUpdater > mpCellBorderUpdater;
97 
98     ::boost::scoped_ptr< Window >           mpTBLineStyleBackground;
99     ::boost::scoped_ptr< ToolBox >          mpTBLineStyle;
100 
101     ::boost::scoped_ptr< Window >           mpTBLineColorBackground;
102     ::boost::scoped_ptr< ToolBox >          mpTBLineColor;
103     ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpLineColorUpdater;
104 
105     ::boost::scoped_ptr< CheckBox >         mpCBXShowGrid;
106 
107     ::sfx2::sidebar::ControllerItem         maBackColorControl;
108     ::sfx2::sidebar::ControllerItem         maLineColorControl;
109     ::sfx2::sidebar::ControllerItem         maLineStyleControl;
110     ::sfx2::sidebar::ControllerItem         maBorderOuterControl;
111     ::sfx2::sidebar::ControllerItem         maBorderInnerControl;
112     ::sfx2::sidebar::ControllerItem         maGridShowControl;
113     ::sfx2::sidebar::ControllerItem         maBorderTLBRControl;
114     ::sfx2::sidebar::ControllerItem         maBorderBLTRControl;
115 
116     // images
117     Image                                   maIMGBKColor;
118     Image                                   maIMGCellBorder;
119     Image                                   maIMGLineColor;
120     Image                                   maIMGLineStyle1;
121     Image                                   maIMGLineStyle2;
122     Image                                   maIMGLineStyle3;
123     Image                                   maIMGLineStyle4;
124     Image                                   maIMGLineStyle5;
125     Image                                   maIMGLineStyle6;
126     Image                                   maIMGLineStyle7;
127     Image                                   maIMGLineStyle8;
128     Image                                   maIMGLineStyle9;
129 
130     // high contrast images
131     Image                                   maIMGBKColorH;
132     Image                                   maIMGLineStyle0H;
133     Image                                   maIMGLineStyle1H;
134     Image                                   maIMGLineStyle2H;
135     Image                                   maIMGLineStyle3H;
136     Image                                   maIMGLineStyle4H;
137     Image                                   maIMGLineStyle5H;
138     Image                                   maIMGLineStyle6H;
139     Image                                   maIMGLineStyle7H;
140     Image                                   maIMGLineStyle8H;
141     Image                                   maIMGLineStyle9H;
142 
143     // cell background color
144     Color                                   maBackColor;
145 
146     // cell line color(s)
147     Color                                   maLineColor;
148     Color                                   maTLBRColor;
149     Color                                   maBLTRColor;
150 
151     // BorderStyle defines
152     sal_uInt16                              mnIn;
153     sal_uInt16                              mnOut;
154     sal_uInt16                              mnDis;
155     sal_uInt16                              mnTLBRIn;
156     sal_uInt16                              mnTLBROut;
157     sal_uInt16                              mnTLBRDis;
158     sal_uInt16                              mnBLTRIn;
159     sal_uInt16                              mnBLTROut;
160     sal_uInt16                              mnBLTRDis;
161 
162     /// bitfield
163     bool                                    mbBackColorAvailable : 1;
164     bool                                    mbLineColorAvailable : 1;
165     bool                                    mbBorderStyleAvailable : 1;
166 
167     // CellBorder defines
168     bool                                    mbLeft : 1;
169     bool                                    mbRight : 1;
170     bool                                    mbTop : 1;
171     bool                                    mbBottom : 1;
172     bool                                    mbVer : 1;
173     bool                                    mbHor : 1;
174 
175     bool                                    mbOuterBorder : 1; // mbLeft || mbRight || mbTop || mbBottom
176     bool                                    mbInnerBorder : 1; // mbVer || mbHor || bLeft || bRight || bTop || bBottom
177 
178     bool                                    mbTLBR : 1;
179     bool                                    mbBLTR : 1;
180 
181     // popups
182     svx::sidebar::ColorPopup                maFillColorPopup;
183     svx::sidebar::ColorPopup                maLineColorPopup;
184     ::boost::scoped_ptr< CellLineStylePopup > mpCellLineStylePopup;
185     ::boost::scoped_ptr< CellBorderStylePopup > mpCellBorderStylePopup;
186 
187     cssu::Reference<css::frame::XFrame>     mxFrame;
188     ::sfx2::sidebar::EnumContext            maContext;
189     SfxBindings*                            mpBindings;
190 
191     DECL_LINK(TbxBKColorSelectHdl, ToolBox*);
192     DECL_LINK(TbxLineColorSelectHdl, ToolBox*);
193     DECL_LINK(TbxCellBorderSelectHdl, ToolBox*);
194     DECL_LINK(TbxLineStyleSelectHdl, ToolBox*);
195     DECL_LINK(CBOXGridShowClkHdl, void*);
196 
197     // for fill color picker
198     svx::sidebar::PopupControl* CreateFillColorPopupControl(svx::sidebar::PopupContainer* pParent);
199     Color GetLastFillColor(void) const;
200     void SetFillColor(const String& rsColorName, const Color aColor);
201 
202     // for line color picker
203     svx::sidebar::PopupControl* CreateLineColorPopupControl(svx::sidebar::PopupContainer* pParent);
204     Color GetLastLineColor(void) const;
205     void SetLineColor(const String& rsColorName, const Color aColor);
206 
207     // for CellLineStyle popup
208     svx::sidebar::PopupControl* CreateCellLineStylePopupControl(svx::sidebar::PopupContainer* pParent);
209     void EndCellLineStylePopupMode(void);
210 
211     // for CellBorderStyle popup
212     svx::sidebar::PopupControl* CreateCellBorderStylePopupControl(svx::sidebar::PopupContainer* pParent);
213     void EndCellBorderStylePopupMode(void);
214 
215     // constructor/destuctor
216     CellAppearancePropertyPanel(
217         Window* pParent,
218         const cssu::Reference<css::frame::XFrame>& rxFrame,
219         SfxBindings* pBindings);
220     virtual ~CellAppearancePropertyPanel();
221 
222     void Initialize();
223     void SetStyleIcon();
224     void UpdateControlState();
225 
226 
227 	//popup windows
228 //	SfxPopupPanelWin*		mpFloatWinColor;
229 //	class ScCellBackColorPage;
230 //	ScCellBackColorPage*	mpPageColor;
231 
232 //	SfxPopupPanelWin*		mpFloatWinLineColor;
233 //	class ScCellLineColorPage;
234 //	ScCellLineColorPage*	mpPageLineColor;
235 
236 //	SfxPopupPanelWin*		mpFloatWinStyle;
237 //	class ScCellLineStylePage;
238 //	ScCellLineStylePage*	mpPageStyle;
239 
240 //	SfxPopupPanelWin*		mpFloatWinBorder;
241 //	class ScCellLineBorderPage;
242 //	ScCellLineBorderPage*	mpPageBorder;
243 
244 //	void PaintRect(const ToolBox &rTB);
245 
246 //	ScCellBackColorPage* GetColorPage();
247 //	SfxPopupPanelWin* GetColorFloatWin();
248 //
249 //	ScCellLineColorPage* GetLineColorPage();
250 //	SfxPopupPanelWin* GetLineColorFloatWin();
251 //
252 //	ScCellLineStylePage* GetStylePage();
253 //	SfxPopupPanelWin* GetStyleFloatWin();
254 //
255 //	ScCellLineBorderPage* GetBorderPage();
256 //	SfxPopupPanelWin* GetBorderFloatWin();
257 
258 
259 };
260 
261 } } // end of namespace ::sc::sidebar
262 
263 #endif
264 // eof
265