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_PROPERTYPANEL_LINEPAGE_HXX 23 #define SVX_PROPERTYPANEL_LINEPAGE_HXX 24 25 #include <svx/xdash.hxx> 26 #include <vcl/ctrl.hxx> 27 #include <sfx2/sidebar/SidebarPanelBase.hxx> 28 #include <sfx2/sidebar/ControllerItem.hxx> 29 #include <sfx2/sidebar/IContextChangeReceiver.hxx> 30 #include <vcl/fixed.hxx> 31 #include <vcl/field.hxx> 32 #include <boost/scoped_ptr.hpp> 33 #include <boost/scoped_array.hpp> 34 #include <svx/sidebar/ColorPopup.hxx> 35 #include "LineStylePopup.hxx" 36 #include "LineWidthPopup.hxx" 37 38 39 namespace svx { class ToolboxButtonColorUpdater; } 40 class SvxLineColorPage; 41 class SvxLineStylePage; 42 class SvxLineWidthPage; 43 class XLineStyleItem; 44 class XLineDashItem; 45 class XLineStartItem; 46 class XLineEndItem; 47 class LineEndLB_LPP; 48 class XLineEndList; 49 class ListBox; 50 class ToolBox; 51 class FloatingWindow; 52 53 namespace { 54 const String Dash_Name[] = 55 { 56 String("Ultrafine dashed", 16, RTL_TEXTENCODING_ASCII_US), //0 57 String("Dashed (variable)", 17,RTL_TEXTENCODING_ASCII_US ), //6 58 String("Fine dashed (variable)",22, RTL_TEXTENCODING_ASCII_US), //5 59 String("Fine dashed", 11, RTL_TEXTENCODING_ASCII_US), //1 60 String("Fine dotted", 11, RTL_TEXTENCODING_ASCII_US), //3 61 String("Ultrafine dotted (variable)",27, RTL_TEXTENCODING_ASCII_US), //8 62 String("3 dashes 3 dots (variable)", 26, RTL_TEXTENCODING_ASCII_US), //7 63 String("2 dots 1 dash",13,RTL_TEXTENCODING_ASCII_US ) , //9 64 String("Ultrafine 2 dots 3 dashes", 25, RTL_TEXTENCODING_ASCII_US), //2 65 String("Line with fine dots", 19, RTL_TEXTENCODING_ASCII_US) //4 66 }; 67 68 69 const XDash Dash_Set[] = 70 { 71 //Dash, dots, dotlen, dash, dashlen, distance 72 XDash(XDASH_RECT, 1, 51, 1, 51, 51), //0 73 XDash(XDASH_RECTRELATIVE, 1, 197, 0,0, 127), //6 74 XDash(XDASH_RECTRELATIVE, 1, 197,0,0,197), //5 75 XDash(XDASH_RECT, 1,508, 1,508, 508), //1 76 XDash(XDASH_RECT, 1, 0, 0, 0, 457), //3 77 XDash(XDASH_RECTRELATIVE, 1, 0, 0, 0, 50), //8 78 XDash(XDASH_RECTRELATIVE, 3, 197, 3, 0, 100), //7 79 XDash(XDASH_RECT, 2, 0, 1, 203,203) , //9 80 XDash(XDASH_RECT, 2, 51, 3,254, 127), //2 81 XDash(XDASH_RECT, 1,2007,10, 0, 152) //4 82 }; 83 84 #define SIDEBAR_LINE_WIDTH_GLOBAL_VALUE String("PopupPanel_LineWidth", 20, RTL_TEXTENCODING_ASCII_US) 85 86 } //end of anonymous namespace 87 88 89 namespace svx { namespace sidebar { 90 91 class PopupContainer; 92 class ColorPopup; 93 class LineStyleControl; 94 class LineWidthControl; 95 96 97 class LinePropertyPanel 98 : public Control, 99 public ::sfx2::sidebar::IContextChangeReceiver, 100 public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface 101 { 102 private: 103 friend class ::SvxLineStylePage; 104 friend class ::SvxLineWidthPage; 105 106 public: 107 static LinePropertyPanel* Create( 108 Window* pParent, 109 const cssu::Reference<css::frame::XFrame>& rxFrame, 110 SfxBindings* pBindings); 111 112 virtual void DataChanged( 113 const DataChangedEvent& rEvent); 114 115 virtual void HandleContextChange( 116 const ::sfx2::sidebar::EnumContext aContext); 117 118 virtual void NotifyItemUpdate( 119 const sal_uInt16 nSId, 120 const SfxItemState eState, 121 const SfxPoolItem* pState); 122 123 SfxBindings* GetBindings(); 124 125 void SetLineDashItem(XLineDashItem* pDash); 126 void SetLineStyleItem(XLineStyleItem* pStyle); 127 128 void SetWidth(long nWidth); 129 void SetWidthIcon(int n); 130 void SetWidthIcon(); 131 132 void EndLineStylePopupMode (void); 133 void EndLineWidthPopupMode (void); 134 135 private: 136 //ui controls 137 ::boost::scoped_ptr< FixedText > mpFTWidth; 138 ::boost::scoped_ptr< Window > mpTBWidthBackground; 139 ::boost::scoped_ptr< ToolBox > mpTBWidth; 140 ::boost::scoped_ptr< FixedText > mpFTColor; 141 ::boost::scoped_ptr< Window > mpTBColorBackground; 142 ::boost::scoped_ptr< ToolBox > mpTBColor; 143 ::boost::scoped_ptr< FixedText > mpFTStyle; 144 ::boost::scoped_ptr< Window > mpTBStyleBackground; 145 ::boost::scoped_ptr< ToolBox > mpTBStyle; 146 ::boost::scoped_ptr< FixedText > mpFTTrancparency; 147 ::boost::scoped_ptr< MetricField > mpMFTransparent; 148 ::boost::scoped_ptr< FixedText > mpFTArrow; 149 ::boost::scoped_ptr< LineEndLB_LPP > mpLBStart; 150 ::boost::scoped_ptr< LineEndLB_LPP > mpLBEnd; 151 ::boost::scoped_ptr< FixedText > mpFTEdgeStyle; 152 ::boost::scoped_ptr< ListBox > mpLBEdgeStyle; 153 ::boost::scoped_ptr< FixedText > mpFTCapStyle; 154 ::boost::scoped_ptr< ListBox > mpLBCapStyle; 155 156 //ControllerItem 157 ::sfx2::sidebar::ControllerItem maStyleControl; 158 ::sfx2::sidebar::ControllerItem maDashControl; 159 ::sfx2::sidebar::ControllerItem maWidthControl; 160 ::sfx2::sidebar::ControllerItem maColorControl; 161 ::sfx2::sidebar::ControllerItem maStartControl; 162 ::sfx2::sidebar::ControllerItem maEndControl; 163 ::sfx2::sidebar::ControllerItem maLineEndListControl; 164 ::sfx2::sidebar::ControllerItem maTransControl; 165 ::sfx2::sidebar::ControllerItem maEdgeStyle; 166 ::sfx2::sidebar::ControllerItem maCapStyle; 167 168 Color maColor; 169 ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpColorUpdater; 170 ::boost::scoped_ptr< XLineStyleItem > mpStyleItem; 171 ::boost::scoped_ptr< XLineDashItem > mpDashItem; 172 sal_uInt16 mnTrans; 173 SfxMapUnit meMapUnit; 174 sal_Int32 mnWidthCoreValue; 175 XLineEndList* mpLineEndList; 176 ::boost::scoped_ptr< XLineStartItem > mpStartItem; 177 ::boost::scoped_ptr< XLineEndItem > mpEndItem; 178 179 //popup windows 180 ColorPopup maColorPopup; 181 LineStylePopup maLineStylePopup; 182 LineWidthPopup maLineWidthPopup; 183 184 // images from ressource 185 Image maIMGColor; 186 Image maIMGNone; 187 188 // multi-images 189 ::boost::scoped_array<Image> mpIMGStyleIcon; 190 ::boost::scoped_array<Image> mpIMGWidthIcon; 191 ::boost::scoped_array<Image> mpIMGStyleIconH; //high contrast 192 ::boost::scoped_array<Image> mpIMGWidthIconH; //high contrast 193 194 cssu::Reference< css::frame::XFrame > mxFrame; 195 ::sfx2::sidebar::EnumContext maContext; 196 SfxBindings* mpBindings; 197 198 /// bitfield 199 bool mbColorAvailable : 1; 200 bool mbStyleAvailable : 1; 201 bool mbDashAvailable : 1; 202 bool mbTransAvailable : 1; 203 bool mbWidthValuable : 1; 204 bool mbStartAvailable : 1; 205 bool mbEndAvailable : 1; 206 207 void SetupIcons(void); 208 void Initialize(); 209 void FillLineEndList(); 210 void SelectEndStyle(bool bStart); 211 212 DECL_LINK(ImplPopupModeEndHdl, FloatingWindow* ); 213 DECL_LINK(ImplWidthPopupModeEndHdl, FloatingWindow* ); 214 DECL_LINK(ToolboxColorSelectHdl, ToolBox*); 215 DECL_LINK(ToolboxStyleSelectHdl, ToolBox*); 216 DECL_LINK(ToolboxWidthSelectHdl, ToolBox*); 217 DECL_LINK(ChangeTransparentHdl , void *); 218 DECL_LINK(ChangeStartHdl, void *); 219 DECL_LINK(ChangeEndHdl, void *); 220 DECL_LINK(ChangeEdgeStyleHdl, void *); 221 DECL_LINK(ChangeCapStyleHdl, void *); 222 223 // constructor/destuctor 224 LinePropertyPanel( 225 Window* pParent, 226 const cssu::Reference<css::frame::XFrame>& rxFrame, 227 SfxBindings* pBindings); 228 virtual ~LinePropertyPanel(void); 229 230 void SetStyleIcon(); 231 void SetColor( 232 const String& rsColorName, 233 const Color aColor); 234 235 PopupControl* CreateColorPopupControl (PopupContainer* pParent); 236 PopupControl* CreateLineStylePopupControl (PopupContainer* pParent); 237 PopupControl* CreateLineWidthPopupControl (PopupContainer* pParent); 238 }; 239 240 } } // end of namespace svx::sidebar 241 242 #endif 243