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