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 #include <sfx2/sidebar/EnumContext.hxx> 30 31 #include <svtools/ctrlbox.hxx> 32 #include <svx/tbxcolorupdate.hxx> 33 #include <editeng/svxenum.hxx> 34 #include <editeng/fhgtitem.hxx> 35 36 #include <com/sun/star/ui/XSidebar.hpp> 37 #include <com/sun/star/frame/XToolbarController.hpp> 38 39 #include <boost/scoped_ptr.hpp> 40 #include "TextCharacterSpacingPopup.hxx" 41 #include "TextUnderlinePopup.hxx" 42 #include <svx/sidebar/ColorPopup.hxx> 43 #include <vcl/vclenum.hxx> 44 45 class FloatingWindow; 46 class ToolBox; 47 48 namespace svx { namespace sidebar { 49 50 class SvxSBFontNameBox; 51 class PopupControl; 52 class PopupContainer; 53 54 class TextPropertyPanel 55 : public Control, 56 public ::sfx2::sidebar::IContextChangeReceiver, 57 public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface 58 { 59 public: 60 static TextPropertyPanel* Create ( 61 Window* pParent, 62 const cssu::Reference<css::frame::XFrame>& rxFrame, 63 SfxBindings* pBindings, 64 const ::sfx2::sidebar::EnumContext& rContext); 65 66 virtual void DataChanged (const DataChangedEvent& rEvent); 67 68 ::sfx2::sidebar::ControllerItem& GetSpaceController(); 69 long GetSelFontSize(); 70 void SetSpacing(long nKern); 71 void EndSpacingPopupMode (void); 72 void EndUnderlinePopupMode (void); 73 void SetUnderline(FontUnderline eUnderline); 74 Color& GetUnderlineColor(); 75 void SetDefaultUnderline(FontUnderline eUnderline); 76 77 78 virtual void HandleContextChange ( 79 const ::sfx2::sidebar::EnumContext aContext); 80 81 82 virtual void NotifyItemUpdate( 83 const sal_uInt16 nSId, 84 const SfxItemState eState, 85 const SfxPoolItem* pState, 86 const bool bIsEnabled); 87 88 private: 89 //ui controls 90 ::boost::scoped_ptr<SvxSBFontNameBox> mpFontNameBox; 91 FontSizeBox maFontSizeBox; 92 ::boost::scoped_ptr<Window> mpToolBoxFontBackground; 93 ::boost::scoped_ptr<ToolBox> mpToolBoxFont; 94 ::boost::scoped_ptr<Window> mpToolBoxIncDecBackground; 95 ::boost::scoped_ptr<ToolBox> mpToolBoxIncDec; 96 ::boost::scoped_ptr<Window> mpToolBoxScriptBackground; 97 ::boost::scoped_ptr<ToolBox> mpToolBoxScript; 98 ::boost::scoped_ptr<Window> mpToolBoxScriptSwBackground; 99 ::boost::scoped_ptr<ToolBox> mpToolBoxScriptSw; 100 ::boost::scoped_ptr<Window> mpToolBoxSpacingBackground; 101 ::boost::scoped_ptr<ToolBox> mpToolBoxSpacing; 102 ::boost::scoped_ptr<Window> mpToolBoxFontColorBackground; 103 ::boost::scoped_ptr<ToolBox> mpToolBoxFontColor; 104 ::boost::scoped_ptr<Window> mpToolBoxFontColorBackgroundSW; 105 ::boost::scoped_ptr<ToolBox> mpToolBoxFontColorSW; 106 ::boost::scoped_ptr<Window> mpToolBoxHighlightBackground; 107 ::boost::scoped_ptr<ToolBox> mpToolBoxHighlight; 108 ::boost::scoped_ptr<ToolboxButtonColorUpdater> mpFontColorUpdater; 109 ::boost::scoped_ptr<ToolboxButtonColorUpdater> mpHighlightUpdater; 110 111 //control items 112 ::sfx2::sidebar::ControllerItem maFontNameControl; 113 ::sfx2::sidebar::ControllerItem maFontSizeControl; 114 ::sfx2::sidebar::ControllerItem maWeightControl; 115 ::sfx2::sidebar::ControllerItem maItalicControl; 116 ::sfx2::sidebar::ControllerItem maUnderlineControl; 117 ::sfx2::sidebar::ControllerItem maStrikeControl; 118 ::sfx2::sidebar::ControllerItem maShadowControl; 119 ::sfx2::sidebar::ControllerItem maScriptControlSw; 120 ::sfx2::sidebar::ControllerItem maSuperScriptControl; 121 ::sfx2::sidebar::ControllerItem maSubScriptControl; 122 ::sfx2::sidebar::ControllerItem maSpacingControl; 123 ::sfx2::sidebar::ControllerItem maSDFontGrow; 124 ::sfx2::sidebar::ControllerItem maSDFontShrink; 125 126 FontWeight meWeight; 127 FontItalic meItalic; 128 FontUnderline meUnderline; 129 Color meUnderlineColor; 130 bool mbShadow; 131 FontStrikeout meStrike; 132 bool mbWeightAvailable; 133 bool mbPostureAvailable; 134 SvxEscapement meEscape; //for sw 135 bool mbSuper; 136 bool mbSub; 137 bool mbKernAvailable; 138 bool mbKernLBAvailable; 139 long mlKerning; 140 SvxFontHeightItem* mpHeightItem; 141 142 const FontList* mpFontList; 143 bool mbMustDelete; 144 bool mbFocusOnFontSizeCtrl; 145 TextCharacterSpacingPopup maCharSpacePopup; 146 TextUnderlinePopup maUnderlinePopup; 147 148 cssu::Reference<css::frame::XFrame> mxFrame; 149 ::sfx2::sidebar::EnumContext maContext; 150 SfxBindings* mpBindings; 151 152 TextPropertyPanel ( 153 Window* pParent, 154 const cssu::Reference<css::frame::XFrame>& rxFrame, 155 SfxBindings* pBindings, 156 const ::sfx2::sidebar::EnumContext& rContext); 157 virtual ~TextPropertyPanel (void); 158 159 160 PopupControl* CreateCharacterSpacingControl (PopupContainer* pParent); 161 PopupControl* CreateUnderlinePopupControl (PopupContainer* pParent); 162 DECL_LINK(SpacingClickHdl, ToolBox*); 163 DECL_LINK(ToolBoxUnderlineClickHdl, ToolBox* ); 164 165 void Initialize (void); 166 void SetupToolboxItems (void); 167 void InitToolBoxFont(); 168 void InitToolBoxIncDec(); 169 void InitToolBoxScript(); 170 void InitToolBoxSpacing(); 171 172 DECL_LINK(FontSelHdl, FontNameBox *); 173 DECL_LINK(FontSizeModifyHdl, FontSizeBox *); 174 DECL_LINK(FontSizeSelHdl, FontSizeBox *); 175 DECL_LINK(FontSizeLoseFocus, FontSizeBox *); 176 DECL_LINK(ToolboxFontSelectHandler, ToolBox *); 177 DECL_LINK(ToolboxIncDecSelectHdl, ToolBox *); 178 DECL_LINK(ToolBoxSwScriptSelectHdl, ToolBox *); 179 DECL_LINK(ToolBoxScriptSelectHdl, ToolBox *); 180 181 void UpdateItem (const sal_uInt16 nSlotId); 182 183 /** Depending on the given context make one of the toolboxes 184 mpToolBoxFontColor and mpToolBoxFontColorSW visible. Both 185 occupy the same space. 186 */ 187 void UpdateFontColorToolbox ( 188 const ::sfx2::sidebar::EnumContext aContext); 189 }; 190 191 } } // end of namespace ::svx::sidebar 192 193 #endif 194