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