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 SVX_SIDEBAR_PARA_PROPERTY_PAGE_HXX 23 #define SVX_SIDEBAR_PARA_PROPERTY_PAGE_HXX 24 25 #include <vcl/ctrl.hxx> 26 #include <sfx2/sidebar/SidebarPanelBase.hxx> 27 #include <sfx2/sidebar/ControllerItem.hxx> 28 #include <sfx2/sidebar/IContextChangeReceiver.hxx> 29 #include <editeng/lspcitem.hxx> 30 #include <svtools/ctrlbox.hxx> 31 #include <svx/tbxcolorupdate.hxx> 32 #include <svx/relfld.hxx> 33 #include <editeng/svxenum.hxx> 34 #include <editeng/fhgtitem.hxx> 35 36 #include <com/sun/star/ui/XUIElement.hpp> 37 38 #include <boost/scoped_ptr.hpp> 39 40 #include "sidebar/ColorPopup.hxx" 41 #include <vcl/vclenum.hxx> 42 #include <vcl/fixed.hxx> 43 #include <svl/poolitem.hxx> 44 #include <tools/fldunit.hxx> 45 46 #include "ParaLineSpacingPopup.hxx" 47 48 class FloatingWindow; 49 class ToolBox; 50 51 namespace svx { namespace sidebar { 52 53 class PopupControl; 54 class PopupContainer; 55 56 class ParaPropertyPanel 57 : public Control, 58 public ::sfx2::sidebar::IContextChangeReceiver, 59 public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface 60 { 61 public: 62 static ParaPropertyPanel* Create ( 63 Window* pParent, 64 const cssu::Reference<css::frame::XFrame>& rxFrame, 65 SfxBindings* pBindings); 66 67 virtual void DataChanged (const DataChangedEvent& rEvent); 68 SfxBindings* GetBindings(); 69 70 virtual void HandleContextChange ( 71 const ::sfx2::sidebar::EnumContext aContext); 72 73 virtual void NotifyItemUpdate( 74 const sal_uInt16 nSId, 75 const SfxItemState eState, 76 const SfxPoolItem* pState); 77 78 void ShowMenu (void); 79 sal_uInt16 GetBulletTypeIndex(){ return nBulletTypeIndex; } 80 void SetBulletTypeIndex(sal_uInt16 nInd){ nBulletTypeIndex = nInd; } 81 sal_uInt16 GetNumTypeIndex(){ return nNumTypeIndex; } 82 void SetNumTypeIndex(sal_uInt16 nInd){ nNumTypeIndex = nInd; } 83 //End 84 FieldUnit GetCurrentUnit( SfxItemState eState, const SfxPoolItem* pState ); 85 86 void EndSpacingPopupMode (void); 87 void EndBulletsPopupMode (void); 88 void EndNumberingPopupMode (void); 89 90 private: 91 /********************************************************** 92 ** 93 ** UI controls 94 ** 95 ***********************************************************/ 96 //Alignment 97 ::boost::scoped_ptr<Window> maAlignToolBoxBackground; 98 ::boost::scoped_ptr<ToolBox> maAlignToolBox; 99 ::boost::scoped_ptr<Window> maTBxVertAlignBackground; 100 ::boost::scoped_ptr<ToolBox> maTBxVertAlign; 101 //NumBullet&Backcolor 102 ::boost::scoped_ptr<Window> maTBxNumBulletBackground; 103 ::boost::scoped_ptr<ToolBox> maTBxNumBullet; 104 ::boost::scoped_ptr<Window> maTBxBackColorBackground; 105 ::boost::scoped_ptr<ToolBox> maTBxBackColor; 106 //Paragraph spacing 107 ::boost::scoped_ptr<FixedText> maFTUL; 108 ::boost::scoped_ptr<Window> maTbxUL_IncDecBackground; 109 ::boost::scoped_ptr<ToolBox> maTbxUL_IncDec; 110 ::boost::scoped_ptr<SvxRelativeField> maTopDist; 111 ::boost::scoped_ptr<SvxRelativeField> maBottomDist; 112 //Line spacing 113 ::boost::scoped_ptr<Window> maLineSPTbxBackground; 114 ::boost::scoped_ptr<ToolBox> maLineSPTbx; 115 //Indent 116 ::boost::scoped_ptr<FixedText> maFTIndent; 117 ::boost::scoped_ptr<Window> maTbxIndent_IncDecBackground; 118 ::boost::scoped_ptr<ToolBox> maTbxIndent_IncDec; 119 ::boost::scoped_ptr<Window> maTbxProDemoteBackground; 120 ::boost::scoped_ptr<ToolBox> maTbxProDemote; 121 ::boost::scoped_ptr<SvxRelativeField> maLeftIndent; 122 ::boost::scoped_ptr<SvxRelativeField> maRightIndent; 123 ::boost::scoped_ptr<SvxRelativeField> maFLineIndent; 124 ::boost::scoped_ptr<::svx::ToolboxButtonColorUpdater> mpColorUpdater; 125 126 /********************************************************** 127 ** 128 ** Resources 129 ** 130 ***********************************************************/ 131 FixedImage maFISpace1; 132 FixedImage maFISpace2; 133 FixedImage maFIndent1; 134 FixedImage maFIndent2; 135 FixedImage maFIndent3; 136 137 Image maSpace1; 138 Image maSpace2; 139 Image maSpace3; 140 Image maIndent1; 141 Image maIndent2; 142 Image maIndent3; 143 144 Image maLeftPara; 145 Image maCentPara; 146 Image maRightPara; 147 Image maJusPara; 148 149 Image maIndInc; 150 Image maIndDec; 151 Image maIndInc_BD; 152 Image maIndDec_BD; 153 Image maIndHang; 154 Image maParInc; 155 Image maParDec; 156 157 ImageList maVertImageList; 158 ImageList maVertImageListH; 159 ImageList maNumBImageList; 160 ImageList maNumBImageListH; 161 ImageList maNumBImageListRTL; //sym2_7380 162 Image maImgBackColorHigh; 163 Image maImgBackColor; 164 165 /**************************************************************** 166 ** 167 ** Data Member 168 ** 169 *****************************************************************/ 170 long maTxtLeft; 171 //Line spacing 172 SvxLineSpacingItem *mpLnSPItem; 173 SfxItemState meLnSpState; 174 bool mbOutLineLeft; 175 bool mbOutLineRight; 176 long maUpper; 177 long maLower; 178 179 sal_uInt16 nBulletTypeIndex; 180 sal_uInt16 nNumTypeIndex; 181 Color maColor; 182 bool mbColorAvailable; 183 FieldUnit m_eMetricUnit; 184 FieldUnit m_last_eMetricUnit; 185 SfxMapUnit m_eLRSpaceUnit; 186 SfxMapUnit m_eULSpaceUnit; 187 /**************************************************************** 188 ** 189 ** Controll Itemb 190 ** 191 *****************************************************************/ 192 193 ::sfx2::sidebar::ControllerItem maLeftAlignControl; 194 ::sfx2::sidebar::ControllerItem maCenterAlignControl; 195 ::sfx2::sidebar::ControllerItem maRightAlignControl; 196 ::sfx2::sidebar::ControllerItem maJustifyAlignControl; 197 ::sfx2::sidebar::ControllerItem maLRSpaceControl; 198 ::sfx2::sidebar::ControllerItem maLNSpaceControl; 199 ::sfx2::sidebar::ControllerItem maULSpaceControl; 200 ::sfx2::sidebar::ControllerItem maOutLineLeftControl; 201 ::sfx2::sidebar::ControllerItem maOutLineRightControl; 202 ::sfx2::sidebar::ControllerItem maDecIndentControl; 203 ::sfx2::sidebar::ControllerItem maIncIndentControl; 204 ::sfx2::sidebar::ControllerItem maVertTop; 205 ::sfx2::sidebar::ControllerItem maVertCenter; 206 ::sfx2::sidebar::ControllerItem maVertBottom; 207 ::sfx2::sidebar::ControllerItem maBulletOnOff; 208 ::sfx2::sidebar::ControllerItem maNumberOnOff; 209 ::sfx2::sidebar::ControllerItem maBackColorControl; 210 ::sfx2::sidebar::ControllerItem m_aMetricCtl; 211 ::sfx2::sidebar::ControllerItem maBulletNumRuleIndex; 212 ::sfx2::sidebar::ControllerItem maNumNumRuleIndex; 213 214 cssu::Reference<css::frame::XFrame> mxFrame; 215 ::sfx2::sidebar::EnumContext maContext; 216 SfxBindings* mpBindings; 217 218 219 ParaLineSpacingPopup maLineSpacePopup; 220 221 ParaPropertyPanel ( 222 Window* pParent, 223 const cssu::Reference<css::frame::XFrame>& rxFrame, 224 SfxBindings* pBindings); 225 virtual ~ParaPropertyPanel (void); 226 227 void InitImageList(::boost::scoped_ptr<ToolBox>& rTbx, ImageList& rImglst, ImageList& rImgHlst); 228 229 DECL_LINK(AlignStyleModifyHdl_Impl, ToolBox*); 230 DECL_LINK(VertTbxSelectHandler, ToolBox*); 231 DECL_LINK(NumBTbxSelectHandler, ToolBox*); 232 DECL_LINK(ModifyIndentHdl_Impl, SvxRelativeField*); 233 DECL_LINK(ClickIndent_IncDec_Hdl_Impl, ToolBox*); 234 DECL_LINK(ClickProDemote_Hdl_Impl, ToolBox*); 235 DECL_LINK(ULSpaceHdl_Impl, SvxRelativeField*); 236 DECL_LINK(ClickUL_IncDec_Hdl_Impl, ToolBox*); 237 DECL_LINK(ImplPopupModeEndHdl, FloatingWindow* ); 238 239 void VertStateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState); 240 void ParaBKGStateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState); 241 void StateChangedAlignmentImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ); 242 void StateChangedIndentImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ); 243 void StateChangedLnSPImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ); 244 void StateChangedULImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ); 245 void StateChangeOutLineImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ); 246 void StateChangeIncDecImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ); 247 //Sym3_1093. Add toggle state for numbering and bullet icons 248 void StateChangeBulletNumImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ); 249 //Modified for Numbering&Bullets Dialog UX Enh(Story 992) by chengjh,2011.7.5 250 //Handing the transferred the num rule index data of the current selection 251 void StateChangeBulletNumRuleImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ); 252 253 void initial(); 254 void ReSize(bool bSize); 255 256 257 PopupControl* CreateLineSpacingControl (PopupContainer* pParent); 258 PopupControl* CreateBulletsPopupControl (PopupContainer* pParent); 259 PopupControl* CreateNumberingPopupControl (PopupContainer* pParent); 260 PopupControl* CreateBGColorPopupControl (PopupContainer* pParent); 261 DECL_LINK(ClickLineSPDropDownHdl_Impl, ToolBox*); 262 DECL_LINK(NumBTbxDDHandler, ToolBox*); 263 DECL_LINK(ToolBoxBackColorDDHandler, ToolBox *); 264 265 void SetupIcons (void); 266 void InitToolBoxAlign(); 267 void InitToolBoxVertAlign(); 268 void InitToolBoxIndent(); 269 void InitToolBoxBGColor(); 270 void InitToolBoxBulletsNumbering(); 271 void InitToolBoxSpacing(); 272 void InitToolBoxLineSpacing(); 273 }; 274 275 } } // end of namespace ::svx::sidebar 276 277 #endif 278 279