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 "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 void ShowMenu (void); 125 126 void SetLineDashItem(XLineDashItem* pDash); 127 void SetLineStyleItem(XLineStyleItem* pStyle); 128 129 void SetWidth(long nWidth); 130 void SetWidthIcon(int n); 131 void SetWidthIcon(); 132 133 void EndLineStylePopupMode (void); 134 void EndLineWidthPopupMode (void); 135 136 private: 137 //ui controls 138 ::boost::scoped_ptr< FixedText > mpFTWidth; 139 ::boost::scoped_ptr< Window > mpTBWidthBackground; 140 ::boost::scoped_ptr< ToolBox > mpTBWidth; 141 ::boost::scoped_ptr< FixedText > mpFTColor; 142 ::boost::scoped_ptr< Window > mpTBColorBackground; 143 ::boost::scoped_ptr< ToolBox > mpTBColor; 144 ::boost::scoped_ptr< FixedText > mpFTStyle; 145 ::boost::scoped_ptr< Window > mpTBStyleBackground; 146 ::boost::scoped_ptr< ToolBox > mpTBStyle; 147 ::boost::scoped_ptr< FixedText > mpFTTrancparency; 148 ::boost::scoped_ptr< MetricField > mpMFTransparent; 149 ::boost::scoped_ptr< FixedText > mpFTArrow; 150 ::boost::scoped_ptr< LineEndLB_LPP > mpLBStart; 151 ::boost::scoped_ptr< LineEndLB_LPP > mpLBEnd; 152 ::boost::scoped_ptr< FixedText > mpFTEdgeStyle; 153 ::boost::scoped_ptr< ListBox > mpLBEdgeStyle; 154 ::boost::scoped_ptr< FixedText > mpFTCapStyle; 155 ::boost::scoped_ptr< ListBox > mpLBCapStyle; 156 157 //ControllerItem 158 ::sfx2::sidebar::ControllerItem maStyleControl; 159 ::sfx2::sidebar::ControllerItem maDashControl; 160 ::sfx2::sidebar::ControllerItem maWidthControl; 161 ::sfx2::sidebar::ControllerItem maColorControl; 162 ::sfx2::sidebar::ControllerItem maStartControl; 163 ::sfx2::sidebar::ControllerItem maEndControl; 164 ::sfx2::sidebar::ControllerItem maLineEndListControl; 165 ::sfx2::sidebar::ControllerItem maTransControl; 166 ::sfx2::sidebar::ControllerItem maEdgeStyle; 167 ::sfx2::sidebar::ControllerItem maCapStyle; 168 169 Color maColor; 170 ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpColorUpdater; 171 ::boost::scoped_ptr< XLineStyleItem > mpStyleItem; 172 ::boost::scoped_ptr< XLineDashItem > mpDashItem; 173 sal_uInt16 mnTrans; 174 SfxMapUnit meMapUnit; 175 sal_Int32 mnWidthCoreValue; 176 XLineEndList* mpLineEndList; 177 ::boost::scoped_ptr< XLineStartItem > mpStartItem; 178 ::boost::scoped_ptr< XLineEndItem > mpEndItem; 179 180 //popup windows 181 ColorPopup maColorPopup; 182 LineStylePopup maLineStylePopup; 183 LineWidthPopup maLineWidthPopup; 184 185 // images from ressource 186 Image maIMGColor; 187 Image maIMGNone; 188 189 // multi-images 190 ::boost::scoped_array<Image> mpIMGStyleIcon; 191 ::boost::scoped_array<Image> mpIMGWidthIcon; 192 ::boost::scoped_array<Image> mpIMGStyleIconH; //high contrast 193 ::boost::scoped_array<Image> mpIMGWidthIconH; //high contrast 194 195 cssu::Reference< css::frame::XFrame > mxFrame; 196 ::sfx2::sidebar::EnumContext maContext; 197 SfxBindings* mpBindings; 198 199 /// bitfield 200 bool mbColorAvailable : 1; 201 bool mbStyleAvailable : 1; 202 bool mbDashAvailable : 1; 203 bool mbTransAvailable : 1; 204 bool mbWidthValuable : 1; 205 bool mbStartAvailable : 1; 206 bool mbEndAvailable : 1; 207 208 void SetupIcons(void); 209 void Initialize(); 210 void FillLineEndList(); 211 void SelectEndStyle(bool bStart); 212 213 DECL_LINK(ImplPopupModeEndHdl, FloatingWindow* ); 214 DECL_LINK(ImplWidthPopupModeEndHdl, FloatingWindow* ); 215 DECL_LINK(ToolboxColorSelectHdl, ToolBox*); 216 DECL_LINK(ToolboxStyleSelectHdl, ToolBox*); 217 DECL_LINK(ToolboxWidthSelectHdl, ToolBox*); 218 DECL_LINK(ChangeTransparentHdl , void *); 219 DECL_LINK(ChangeStartHdl, void *); 220 DECL_LINK(ChangeEndHdl, void *); 221 DECL_LINK(ChangeEdgeStyleHdl, void *); 222 DECL_LINK(ChangeCapStyleHdl, void *); 223 224 // constructor/destuctor 225 LinePropertyPanel( 226 Window* pParent, 227 const cssu::Reference<css::frame::XFrame>& rxFrame, 228 SfxBindings* pBindings); 229 virtual ~LinePropertyPanel(void); 230 231 void SetStyleIcon(); 232 void SetColor( 233 const String& rsColorName, 234 const Color aColor); 235 236 PopupControl* CreateColorPopupControl (PopupContainer* pParent); 237 PopupControl* CreateLineStylePopupControl (PopupContainer* pParent); 238 PopupControl* CreateLineWidthPopupControl (PopupContainer* pParent); 239 }; 240 241 } } // end of namespace svx::sidebar 242 243 #endif 244