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_TEXT_PROPERTY_PAGE_HXX 23 #define SVX_SIDEBAR_TEXT_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 30 #include <svtools/ctrlbox.hxx> 31 #include <svx/tbxcolorupdate.hxx> 32 #include <editeng/svxenum.hxx> 33 #include <editeng/fhgtitem.hxx> 34 35 #include <com/sun/star/ui/XUIElement.hpp> 36 37 #include <boost/scoped_ptr.hpp> 38 #include "TextCharacterSpacingPopup.hxx" 39 #include "TextUnderlinePopup.hxx" 40 #include "sidebar/ColorPopup.hxx" 41 #include <vcl/vclenum.hxx> 42 43 class FloatingWindow; 44 class ToolBox; 45 46 namespace svx { namespace sidebar { 47 48 class SvxSBFontNameBox; 49 class PopupControl; 50 class PopupContainer; 51 52 class TextPropertyPanel 53 : public Control, 54 public ::sfx2::sidebar::IContextChangeReceiver, 55 public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface 56 { 57 public: 58 static TextPropertyPanel* Create ( 59 Window* pParent, 60 const cssu::Reference<css::frame::XFrame>& rxFrame, 61 SfxBindings* pBindings); 62 63 virtual void DataChanged (const DataChangedEvent& rEvent); 64 SfxBindings* GetBindings(); 65 ::sfx2::sidebar::ControllerItem& GetSpaceController(); 66 long GetSelFontSize(); 67 void SetSpacing(long nKern); 68 void EndSpacingPopupMode (void); 69 void EndUnderlinePopupMode (void); 70 Color GetFontColor (void) const; 71 void SetFontColor (const String& rsColorName,const Color aColor); 72 Color GetBrushColor (void) const; 73 void SetBrushColor (const String& rsColorName,const Color aColor); 74 void SetUnderline(FontUnderline eUnderline); 75 Color& GetUnderlineColor(); 76 void SetDefaultUnderline(FontUnderline eUnderline); 77 78 79 enum ColorType 80 { 81 FONT_COLOR = 1, 82 BACK_COLOR = 2 83 }; 84 85 virtual void HandleContextChange ( 86 const ::sfx2::sidebar::EnumContext aContext); 87 88 virtual void NotifyItemUpdate( 89 const sal_uInt16 nSId, 90 const SfxItemState eState, 91 const SfxPoolItem* pState); 92 93 private: 94 //ui controls 95 ::boost::scoped_ptr<SvxSBFontNameBox> mpFontNameBox; 96 FontSizeBox maFontSizeBox; 97 ::boost::scoped_ptr<Window> mpToolBoxIncDecBackground; 98 ::boost::scoped_ptr<ToolBox> mpToolBoxIncDec; 99 ::boost::scoped_ptr<Window> mpToolBoxFontBackground; 100 ::boost::scoped_ptr<ToolBox> mpToolBoxFont; 101 ::boost::scoped_ptr<Window> mpToolBoxFontColorBackground; 102 ::boost::scoped_ptr<ToolBox> mpToolBoxFontColor; 103 ::boost::scoped_ptr<Window> mpToolBoxScriptBackground; 104 ::boost::scoped_ptr<ToolBox> mpToolBoxScript; 105 ::boost::scoped_ptr<Window> mpToolBoxScriptSwBackground; 106 ::boost::scoped_ptr<ToolBox> mpToolBoxScriptSw; 107 ::boost::scoped_ptr<Window> mpToolBoxSpacingBackground; 108 ::boost::scoped_ptr<ToolBox> mpToolBoxSpacing; 109 ::boost::scoped_ptr<Window> mpToolBoxHighlightBackground; 110 ::boost::scoped_ptr<ToolBox> mpToolBoxHighlight; 111 ::boost::scoped_ptr<ToolboxButtonColorUpdater> mpFontColorUpdater; 112 ::boost::scoped_ptr<ToolboxButtonColorUpdater> mpHighlightUpdater; 113 114 //control items 115 ::sfx2::sidebar::ControllerItem maFontNameControl; 116 ::sfx2::sidebar::ControllerItem maFontSizeControl; 117 ::sfx2::sidebar::ControllerItem maWeightControl; 118 ::sfx2::sidebar::ControllerItem maItalicControl; 119 ::sfx2::sidebar::ControllerItem maUnderlineControl; 120 ::sfx2::sidebar::ControllerItem maStrikeControl; 121 ::sfx2::sidebar::ControllerItem maShadowControl; 122 ::sfx2::sidebar::ControllerItem maFontColorControl; 123 ::sfx2::sidebar::ControllerItem maScriptControlSw; 124 ::sfx2::sidebar::ControllerItem maSuperScriptControl; 125 ::sfx2::sidebar::ControllerItem maSubScriptControl; 126 ::sfx2::sidebar::ControllerItem maSpacingControl; 127 ::sfx2::sidebar::ControllerItem maHighlightControl; 128 ::sfx2::sidebar::ControllerItem maSDFontGrow; 129 ::sfx2::sidebar::ControllerItem maSDFontShrink; 130 131 //Images 132 Image maImgIncrease; 133 Image maImgDecrease; 134 Image maImgBold; 135 Image maImgItalic; 136 Image maImgUnderline; 137 Image maImgStrike; 138 Image maImgShadow; 139 Image maImgFontColor; 140 Image maImgSupScript; 141 Image maImgSubScript; 142 Image maImgHighlight; 143 144 Image maImgNormalIcon; 145 146 Image maImgIncreaseHigh; 147 Image maImgDecreaseHigh; 148 Image maImgBoldHigh; 149 Image maImgItalicHigh; 150 Image maImgUnderlineHigh; 151 Image maImgStrikeHigh; 152 Image maImgShadowHigh; 153 Image maImgFontColorHigh; 154 Image maImgSupScriptHigh; 155 Image maImgSubScriptHigh; 156 // Image maImgSpacingHigh; // 157 Image maImgHighlightHigh; 158 159 FontWeight meWeight; 160 FontItalic meItalic; 161 FontUnderline meUnderline; 162 Color meUnderlineColor; // 163 bool mbShadow; 164 FontStrikeout meStrike; 165 bool mbWeightAvailable; 166 bool mbPostureAvailable; 167 Color maColor; 168 bool mbColorAvailable; 169 Color maBackColor; 170 bool mbBackColorAvailable; 171 ColorType meColorType; 172 SvxEscapement meEscape; //for sw 173 bool mbSuper; 174 bool mbSub; 175 bool mbKernAvailable; 176 bool mbKernLBAvailable; 177 long mlKerning; 178 SvxFontHeightItem* mpHeightItem; 179 180 const FontList* mpFontList; 181 bool mbMustDelete; 182 bool mbFocusOnFontSizeCtrl; 183 TextCharacterSpacingPopup maCharSpacePopup; 184 TextUnderlinePopup maUnderlinePopup; 185 ColorPopup maFontColorPopup; 186 ColorPopup maBrushColorPopup; 187 188 cssu::Reference<css::frame::XFrame> mxFrame; 189 ::sfx2::sidebar::EnumContext maContext; 190 SfxBindings* mpBindings; 191 192 TextPropertyPanel ( 193 Window* pParent, 194 const cssu::Reference<css::frame::XFrame>& rxFrame, 195 SfxBindings* pBindings); 196 virtual ~TextPropertyPanel (void); 197 198 199 PopupControl* CreateCharacterSpacingControl (PopupContainer* pParent); 200 PopupControl* CreateFontColorPopupControl (PopupContainer* pParent); 201 PopupControl* CreateBrushColorPopupControl (PopupContainer* pParent); 202 PopupControl* CreateUnderlinePopupControl (PopupContainer* pParent); 203 DECL_LINK(SpacingClickHdl, ToolBox*); 204 DECL_LINK(ToolBoxFontColorDropHdl, ToolBox *); //for new color picker 205 DECL_LINK(ToolBoxHighlightDropHdl, ToolBox *); 206 DECL_LINK(ToolBoxUnderlineClickHdl, ToolBox* ); 207 208 void Initialize (void); 209 void SetupIcons (void); 210 void InitToolBoxFont(); 211 void InitToolBoxIncDec(); 212 void InitToolBoxFontColor(); 213 void InitToolBoxScript(); 214 void InitToolBoxHighlight(); 215 void InitToolBoxSpacing(); 216 217 void UpdateFontBold(); 218 void UpdateFontItalic(); 219 void UpdateFontUnderline(); 220 void UpdateFontStrikeOut(); 221 void UpdateFontShadowed(); 222 void UpdateFontScript(); 223 224 DECL_LINK(FontSelHdl, FontNameBox *); 225 DECL_LINK(FontSizeModifyHdl, FontSizeBox *); 226 DECL_LINK(FontSizeSelHdl, FontSizeBox *); 227 DECL_LINK(FontSizeLoseFocus, FontSizeBox *); 228 DECL_LINK(ToolboxFontSelectHandler, ToolBox *); 229 DECL_LINK(ToolboxIncDecSelectHdl, ToolBox *); 230 DECL_LINK(ImplPopupModeEndHdl, FloatingWindow* ); 231 DECL_LINK(ToolBoxSwScriptSelectHdl, ToolBox *); 232 DECL_LINK(ToolBoxScriptSelectHdl, ToolBox *); 233 234 235 236 void TextStyleChanged(); 237 238 Image GetIcon (const ::rtl::OUString& rsURL); 239 }; 240 241 } } // end of namespace ::svx::sidebar 242 243 #endif 244