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 class FixedText; 32 namespace svx { class ToolboxButtonColorUpdater; } 33 namespace sc { namespace sidebar { 34 class CellLineStylePopup; 35 class CellBorderStylePopup; 36 class CellLineStyleControl; 37 class CellBorderUpdater; 38 }} 39 class ToolBox; 40 class CheckBox; 41 42 namespace sc { namespace sidebar { 43 44 class CellAppearancePropertyPanel 45 : public Control, 46 public ::sfx2::sidebar::IContextChangeReceiver, 47 public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface 48 { 49 private: 50 friend class CellLineStyleControl; 51 friend class CellBorderStyleControl; 52 53 public: 54 static CellAppearancePropertyPanel* Create( 55 Window* pParent, 56 const cssu::Reference<css::frame::XFrame>& rxFrame, 57 SfxBindings* pBindings); 58 59 virtual void DataChanged( 60 const DataChangedEvent& rEvent); 61 62 virtual void HandleContextChange( 63 const ::sfx2::sidebar::EnumContext aContext); 64 65 virtual void NotifyItemUpdate( 66 const sal_uInt16 nSId, 67 const SfxItemState eState, 68 const SfxPoolItem* pState, 69 const bool bIsEnabled); 70 71 SfxBindings* GetBindings(); 72 73 private: 74 //ui controls 75 ::boost::scoped_ptr< FixedText > mpFTFillColor; 76 ::boost::scoped_ptr< Window > mpTBFillColorBackground; 77 ::boost::scoped_ptr< ToolBox > mpTBFillColor; 78 ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpFillColorUpdater; 79 80 ::boost::scoped_ptr< FixedText > mpFTCellBorder; 81 ::boost::scoped_ptr< Window > mpTBCellBorderBackground; 82 ::boost::scoped_ptr< ToolBox > mpTBCellBorder; 83 ::boost::scoped_ptr< CellBorderUpdater > mpCellBorderUpdater; 84 85 ::boost::scoped_ptr< Window > mpTBLineStyleBackground; 86 ::boost::scoped_ptr< ToolBox > mpTBLineStyle; 87 88 ::boost::scoped_ptr< Window > mpTBLineColorBackground; 89 ::boost::scoped_ptr< ToolBox > mpTBLineColor; 90 ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpLineColorUpdater; 91 92 ::boost::scoped_ptr< CheckBox > mpCBXShowGrid; 93 94 ::sfx2::sidebar::ControllerItem maBackColorControl; 95 ::sfx2::sidebar::ControllerItem maLineColorControl; 96 ::sfx2::sidebar::ControllerItem maLineStyleControl; 97 ::sfx2::sidebar::ControllerItem maBorderOuterControl; 98 ::sfx2::sidebar::ControllerItem maBorderInnerControl; 99 ::sfx2::sidebar::ControllerItem maGridShowControl; 100 ::sfx2::sidebar::ControllerItem maBorderTLBRControl; 101 ::sfx2::sidebar::ControllerItem maBorderBLTRControl; 102 103 // images 104 Image maIMGBKColor; 105 Image maIMGCellBorder; 106 Image maIMGLineColor; 107 Image maIMGLineStyle1; 108 Image maIMGLineStyle2; 109 Image maIMGLineStyle3; 110 Image maIMGLineStyle4; 111 Image maIMGLineStyle5; 112 Image maIMGLineStyle6; 113 Image maIMGLineStyle7; 114 Image maIMGLineStyle8; 115 Image maIMGLineStyle9; 116 117 // high contrast images 118 Image maIMGBKColorH; 119 Image maIMGLineStyle0H; 120 Image maIMGLineStyle1H; 121 Image maIMGLineStyle2H; 122 Image maIMGLineStyle3H; 123 Image maIMGLineStyle4H; 124 Image maIMGLineStyle5H; 125 Image maIMGLineStyle6H; 126 Image maIMGLineStyle7H; 127 Image maIMGLineStyle8H; 128 Image maIMGLineStyle9H; 129 130 // cell background color 131 Color maBackColor; 132 133 // cell line color(s) 134 Color maLineColor; 135 Color maTLBRColor; 136 Color maBLTRColor; 137 138 // BorderStyle defines 139 sal_uInt16 mnIn; 140 sal_uInt16 mnOut; 141 sal_uInt16 mnDis; 142 sal_uInt16 mnTLBRIn; 143 sal_uInt16 mnTLBROut; 144 sal_uInt16 mnTLBRDis; 145 sal_uInt16 mnBLTRIn; 146 sal_uInt16 mnBLTROut; 147 sal_uInt16 mnBLTRDis; 148 149 /// bitfield 150 bool mbBackColorAvailable : 1; 151 bool mbLineColorAvailable : 1; 152 bool mbBorderStyleAvailable : 1; 153 154 // CellBorder defines 155 bool mbLeft : 1; 156 bool mbRight : 1; 157 bool mbTop : 1; 158 bool mbBottom : 1; 159 bool mbVer : 1; 160 bool mbHor : 1; 161 162 bool mbOuterBorder : 1; // mbLeft || mbRight || mbTop || mbBottom 163 bool mbInnerBorder : 1; // mbVer || mbHor || bLeft || bRight || bTop || bBottom 164 165 bool mbTLBR : 1; 166 bool mbBLTR : 1; 167 168 // popups 169 svx::sidebar::ColorPopup maFillColorPopup; 170 svx::sidebar::ColorPopup maLineColorPopup; 171 ::boost::scoped_ptr< CellLineStylePopup > mpCellLineStylePopup; 172 ::boost::scoped_ptr< CellBorderStylePopup > mpCellBorderStylePopup; 173 174 cssu::Reference<css::frame::XFrame> mxFrame; 175 ::sfx2::sidebar::EnumContext maContext; 176 SfxBindings* mpBindings; 177 178 DECL_LINK(TbxBKColorSelectHdl, ToolBox*); 179 DECL_LINK(TbxLineColorSelectHdl, ToolBox*); 180 DECL_LINK(TbxCellBorderSelectHdl, ToolBox*); 181 DECL_LINK(TbxLineStyleSelectHdl, ToolBox*); 182 DECL_LINK(CBOXGridShowClkHdl, void*); 183 184 // for fill color picker 185 svx::sidebar::PopupControl* CreateFillColorPopupControl(svx::sidebar::PopupContainer* pParent); 186 void SetFillColor(const String& rsColorName, const Color aColor); 187 188 // for line color picker 189 svx::sidebar::PopupControl* CreateLineColorPopupControl(svx::sidebar::PopupContainer* pParent); 190 void SetLineColor(const String& rsColorName, const Color aColor); 191 192 // for CellLineStyle popup 193 svx::sidebar::PopupControl* CreateCellLineStylePopupControl(svx::sidebar::PopupContainer* pParent); 194 void EndCellLineStylePopupMode(void); 195 196 // for CellBorderStyle popup 197 svx::sidebar::PopupControl* CreateCellBorderStylePopupControl(svx::sidebar::PopupContainer* pParent); 198 void EndCellBorderStylePopupMode(void); 199 200 // constructor/destuctor 201 CellAppearancePropertyPanel( 202 Window* pParent, 203 const cssu::Reference<css::frame::XFrame>& rxFrame, 204 SfxBindings* pBindings); 205 virtual ~CellAppearancePropertyPanel(); 206 207 void Initialize(); 208 void SetStyleIcon(); 209 void UpdateControlState(); 210 }; 211 212 } } // end of namespace ::sc::sidebar 213 214 #endif 215 // eof 216