Stop leaking all ScPostIt instances.
[LibreOffice.git] / sc / source / ui / sidebar / CellAppearancePropertyPanel.hxx
blobee253952172efb375664c9136f65ed385d5bc8db
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 .
19 #ifndef SC_PROPERTYPANEL_APPEARANCE_HXX
20 #define SC_PROPERTYPANEL_APPEARANCE_HXX
22 #include <sfx2/sidebar/ControllerItem.hxx>
23 #include <sfx2/sidebar/IContextChangeReceiver.hxx>
24 #include <svx/sidebar/PanelLayout.hxx>
25 #include <boost/scoped_ptr.hpp>
26 #include <svx/sidebar/ColorPopup.hxx>
28 class FixedText;
29 namespace svx { class ToolboxButtonColorUpdater; }
30 namespace sc { namespace sidebar {
31 class CellLineStylePopup;
32 class CellBorderStylePopup;
33 class CellLineStyleControl;
34 class CellBorderUpdater;
36 class ToolBox;
37 class CheckBox;
39 namespace sc { namespace sidebar {
41 class CellAppearancePropertyPanel
42 : public PanelLayout,
43 public ::sfx2::sidebar::IContextChangeReceiver,
44 public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
46 private:
47 friend class CellLineStyleControl;
48 friend class CellBorderStyleControl;
50 public:
51 static CellAppearancePropertyPanel* Create(
52 Window* pParent,
53 const cssu::Reference<css::frame::XFrame>& rxFrame,
54 SfxBindings* pBindings);
56 virtual void DataChanged(
57 const DataChangedEvent& rEvent);
59 virtual void HandleContextChange(
60 const ::sfx2::sidebar::EnumContext aContext);
62 virtual void NotifyItemUpdate(
63 const sal_uInt16 nSId,
64 const SfxItemState eState,
65 const SfxPoolItem* pState,
66 const bool bIsEnabled);
68 SfxBindings* GetBindings();
70 private:
71 //ui controls
73 ToolBox* mpTBFillColor;
74 ToolBox* mpTBCellBorder;
75 ToolBox* mpTBLineStyle;
76 ToolBox* mpTBLineColor;
77 ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpFillColorUpdater;
78 ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpLineColorUpdater;
79 ::boost::scoped_ptr< CellBorderUpdater > mpCellBorderUpdater;
80 CheckBox* mpCBXShowGrid;
82 ::sfx2::sidebar::ControllerItem maBackColorControl;
83 ::sfx2::sidebar::ControllerItem maLineColorControl;
84 ::sfx2::sidebar::ControllerItem maLineStyleControl;
85 ::sfx2::sidebar::ControllerItem maBorderOuterControl;
86 ::sfx2::sidebar::ControllerItem maBorderInnerControl;
87 ::sfx2::sidebar::ControllerItem maGridShowControl;
88 ::sfx2::sidebar::ControllerItem maBorderTLBRControl;
89 ::sfx2::sidebar::ControllerItem maBorderBLTRControl;
91 // images
92 Image maIMGCellBorder;
93 Image maIMGLineStyle1;
94 Image maIMGLineStyle2;
95 Image maIMGLineStyle3;
96 Image maIMGLineStyle4;
97 Image maIMGLineStyle5;
98 Image maIMGLineStyle6;
99 Image maIMGLineStyle7;
100 Image maIMGLineStyle8;
101 Image maIMGLineStyle9;
103 // cell background color
104 Color maBackColor;
106 // cell line color(s)
107 Color maLineColor;
108 Color maTLBRColor;
109 Color maBLTRColor;
111 // BorderStyle defines
112 sal_uInt16 mnIn;
113 sal_uInt16 mnOut;
114 sal_uInt16 mnDis;
115 sal_uInt16 mnTLBRIn;
116 sal_uInt16 mnTLBROut;
117 sal_uInt16 mnTLBRDis;
118 sal_uInt16 mnBLTRIn;
119 sal_uInt16 mnBLTROut;
120 sal_uInt16 mnBLTRDis;
122 /// bitfield
123 bool mbBackColorAvailable : 1;
124 bool mbLineColorAvailable : 1;
125 bool mbBorderStyleAvailable : 1;
127 // CellBorder defines
128 bool mbLeft : 1;
129 bool mbRight : 1;
130 bool mbTop : 1;
131 bool mbBottom : 1;
132 bool mbVer : 1;
133 bool mbHor : 1;
135 bool mbOuterBorder : 1; // mbLeft || mbRight || mbTop || mbBottom
136 bool mbInnerBorder : 1; // mbVer || mbHor || bLeft || bRight || bTop || bBottom
138 bool mbTLBR : 1;
139 bool mbBLTR : 1;
141 // popups
142 svx::sidebar::ColorPopup maFillColorPopup;
143 svx::sidebar::ColorPopup maLineColorPopup;
144 ::boost::scoped_ptr< CellLineStylePopup > mpCellLineStylePopup;
145 ::boost::scoped_ptr< CellBorderStylePopup > mpCellBorderStylePopup;
147 cssu::Reference<css::frame::XFrame> mxFrame;
148 ::sfx2::sidebar::EnumContext maContext;
149 SfxBindings* mpBindings;
151 DECL_LINK(TbxBKColorSelectHdl, ToolBox*);
152 DECL_LINK(TbxLineColorSelectHdl, ToolBox*);
153 DECL_LINK(TbxCellBorderSelectHdl, ToolBox*);
154 DECL_LINK(TbxLineStyleSelectHdl, ToolBox*);
155 DECL_LINK(CBOXGridShowClkHdl, void*);
157 // for fill color picker
158 svx::sidebar::PopupControl* CreateFillColorPopupControl(svx::sidebar::PopupContainer* pParent);
159 void SetFillColor(const OUString& rsColorName, const Color aColor);
161 // for line color picker
162 svx::sidebar::PopupControl* CreateLineColorPopupControl(svx::sidebar::PopupContainer* pParent);
163 void SetLineColor(const OUString& rsColorName, const Color aColor);
165 // for CellLineStyle popup
166 svx::sidebar::PopupControl* CreateCellLineStylePopupControl(svx::sidebar::PopupContainer* pParent);
167 void EndCellLineStylePopupMode(void);
169 // for CellBorderStyle popup
170 svx::sidebar::PopupControl* CreateCellBorderStylePopupControl(svx::sidebar::PopupContainer* pParent);
171 void EndCellBorderStylePopupMode(void);
173 // constructor/destuctor
174 CellAppearancePropertyPanel(
175 Window* pParent,
176 const cssu::Reference<css::frame::XFrame>& rxFrame,
177 SfxBindings* pBindings);
178 virtual ~CellAppearancePropertyPanel();
180 void Initialize();
181 void SetStyleIcon();
182 void UpdateControlState();
185 } } // end of namespace ::sc::sidebar
187 #endif
188 // eof
190 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */