1b9e67834SAndre Fischer /************************************************************** 2b9e67834SAndre Fischer * 3b9e67834SAndre Fischer * Licensed to the Apache Software Foundation (ASF) under one 4b9e67834SAndre Fischer * or more contributor license agreements. See the NOTICE file 5b9e67834SAndre Fischer * distributed with this work for additional information 6b9e67834SAndre Fischer * regarding copyright ownership. The ASF licenses this file 7b9e67834SAndre Fischer * to you under the Apache License, Version 2.0 (the 8b9e67834SAndre Fischer * "License"); you may not use this file except in compliance 9b9e67834SAndre Fischer * with the License. You may obtain a copy of the License at 10b9e67834SAndre Fischer * 11b9e67834SAndre Fischer * http://www.apache.org/licenses/LICENSE-2.0 12b9e67834SAndre Fischer * 13b9e67834SAndre Fischer * Unless required by applicable law or agreed to in writing, 14b9e67834SAndre Fischer * software distributed under the License is distributed on an 15b9e67834SAndre Fischer * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16b9e67834SAndre Fischer * KIND, either express or implied. See the License for the 17b9e67834SAndre Fischer * specific language governing permissions and limitations 18b9e67834SAndre Fischer * under the License. 19b9e67834SAndre Fischer * 20b9e67834SAndre Fischer *************************************************************/ 21b9e67834SAndre Fischer 22b9e67834SAndre Fischer #include "precompiled_svx.hxx" 23b9e67834SAndre Fischer 24b9e67834SAndre Fischer #include "TextPropertyPanel.hrc" 25b9e67834SAndre Fischer #include "TextPropertyPanel.hxx" 26b9e67834SAndre Fischer #include "SvxSBFontNameBox.hxx" 27b9e67834SAndre Fischer 28b9e67834SAndre Fischer #include "svx/dialmgr.hxx" 29b9e67834SAndre Fischer 30b9e67834SAndre Fischer #include <editeng/brshitem.hxx> 31b9e67834SAndre Fischer #include <editeng/colritem.hxx> 32b9e67834SAndre Fischer #include <editeng/crsditem.hxx> 33b9e67834SAndre Fischer #include <editeng/escpitem.hxx> 34b9e67834SAndre Fischer #include <editeng/flstitem.hxx> 35b9e67834SAndre Fischer #include <editeng/fontitem.hxx> 36b9e67834SAndre Fischer #include <editeng/kernitem.hxx> 37b9e67834SAndre Fischer #include <editeng/postitem.hxx> 38b9e67834SAndre Fischer #include <editeng/shdditem.hxx> 39b9e67834SAndre Fischer #include <editeng/udlnitem.hxx> 40b9e67834SAndre Fischer #include <editeng/wghtitem.hxx> 41b9e67834SAndre Fischer #include <rtl/ref.hxx> 42b9e67834SAndre Fischer #include <sfx2/dispatch.hxx> 43b9e67834SAndre Fischer #include <sfx2/objsh.hxx> 44b9e67834SAndre Fischer #include <sfx2/viewsh.hxx> 45b9e67834SAndre Fischer #include <sfx2/sidebar/propertypanel.hrc> 46b9e67834SAndre Fischer #include <sfx2/sidebar/ControlFactory.hxx> 47b9e67834SAndre Fischer #include <sfx2/sidebar/Theme.hxx> 4895a18594SAndre Fischer #include "sfx2/imagemgr.hxx" 49b9e67834SAndre Fischer #include <svtools/ctrltool.hxx> 50b9e67834SAndre Fischer #include <svtools/unitconv.hxx> 51b9e67834SAndre Fischer 52b9e67834SAndre Fischer #include <vcl/gradient.hxx> 53b9e67834SAndre Fischer #include <vcl/svapp.hxx> 5495a18594SAndre Fischer #include <vcl/toolbox.hxx> 55d4aefcaeSZheng Fan #include "TextCharacterSpacingControl.hxx" 56d4aefcaeSZheng Fan #include "TextCharacterSpacingPopup.hxx" 57d4aefcaeSZheng Fan #include "TextUnderlineControl.hxx" 58d4aefcaeSZheng Fan #include "TextUnderlinePopup.hxx" 59*facb16e7SArmin Le Grand #include <svx/sidebar/ColorControl.hxx> 60*facb16e7SArmin Le Grand #include <svx/sidebar/PopupContainer.hxx> 61d4aefcaeSZheng Fan 62d4aefcaeSZheng Fan 63d4aefcaeSZheng Fan #include <boost/bind.hpp> 64b9e67834SAndre Fischer 65b9e67834SAndre Fischer using namespace css; 66b9e67834SAndre Fischer using namespace cssu; 67b9e67834SAndre Fischer using ::sfx2::sidebar::Theme; 687a32b0c8SAndre Fischer using ::sfx2::sidebar::ControlFactory; 69b9e67834SAndre Fischer 70b9e67834SAndre Fischer #define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) 71b9e67834SAndre Fischer 72b9e67834SAndre Fischer namespace svx { namespace sidebar { 73b9e67834SAndre Fischer 74b9e67834SAndre Fischer #undef HAS_IA2 75b9e67834SAndre Fischer 76b9e67834SAndre Fischer 77b9e67834SAndre Fischer #define FONT_CONTROL_WIDTH 160 78b9e67834SAndre Fischer #define SIZE_CONTROL_WIDTH 80 79b9e67834SAndre Fischer #define CONTROL_COMBOX_HEIGHT 20 80b9e67834SAndre Fischer #define CONTROL_HEIGHT_5X 120 81d4aefcaeSZheng Fan 82d4aefcaeSZheng Fan 83b9e67834SAndre Fischer #define TEXT_SECTIONPAGE_HEIGHT_S SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT + ( TOOLBOX_ITEM_HEIGHT + 2 ) + CONTROL_SPACING_VERTICAL * 1 + SECTIONPAGE_MARGIN_VERTICAL_BOT 84b9e67834SAndre Fischer #define TEXT_SECTIONPAGE_HEIGHT SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT + ( TOOLBOX_ITEM_HEIGHT + 2 ) * 2 + CONTROL_SPACING_VERTICAL * 2 + SECTIONPAGE_MARGIN_VERTICAL_BOT 85b9e67834SAndre Fischer 86b9e67834SAndre Fischer // 87d4aefcaeSZheng Fan 88b9e67834SAndre Fischer //end 89d4aefcaeSZheng Fan PopupControl* TextPropertyPanel::CreateCharacterSpacingControl (PopupContainer* pParent) 90d4aefcaeSZheng Fan { 91d4aefcaeSZheng Fan return new TextCharacterSpacingControl(pParent, *this); 92d4aefcaeSZheng Fan } 93b9e67834SAndre Fischer 94d4aefcaeSZheng Fan PopupControl* TextPropertyPanel::CreateUnderlinePopupControl (PopupContainer* pParent) 95d4aefcaeSZheng Fan { 96d4aefcaeSZheng Fan return new TextUnderlineControl(pParent, *this); 97d4aefcaeSZheng Fan } 98b9e67834SAndre Fischer 99d4aefcaeSZheng Fan PopupControl* TextPropertyPanel::CreateFontColorPopupControl (PopupContainer* pParent) 100d4aefcaeSZheng Fan { 101d4aefcaeSZheng Fan return new ColorControl( 102d4aefcaeSZheng Fan pParent, 103d4aefcaeSZheng Fan mpBindings, 104d4aefcaeSZheng Fan SVX_RES(RID_POPUPPANEL_TEXTPAGE_FONT_COLOR), 105d4aefcaeSZheng Fan SVX_RES(VS_FONT_COLOR), 106d4aefcaeSZheng Fan ::boost::bind(&TextPropertyPanel::GetFontColor, this), 107d4aefcaeSZheng Fan ::boost::bind(&TextPropertyPanel::SetFontColor, this, _1,_2), 108d4aefcaeSZheng Fan pParent, 109d4aefcaeSZheng Fan 0); 110d4aefcaeSZheng Fan } 111d4aefcaeSZheng Fan 112d4aefcaeSZheng Fan PopupControl* TextPropertyPanel::CreateBrushColorPopupControl (PopupContainer* pParent) 113d4aefcaeSZheng Fan { 114d4aefcaeSZheng Fan return new ColorControl( 115d4aefcaeSZheng Fan pParent, 116d4aefcaeSZheng Fan mpBindings, 117d4aefcaeSZheng Fan SVX_RES(RID_POPUPPANEL_TEXTPAGE_FONT_COLOR), 118d4aefcaeSZheng Fan SVX_RES(VS_FONT_COLOR), 119d4aefcaeSZheng Fan ::boost::bind(&TextPropertyPanel::GetBrushColor, this), 120d4aefcaeSZheng Fan ::boost::bind(&TextPropertyPanel::SetBrushColor, this, _1,_2), 121d4aefcaeSZheng Fan pParent, 122d4aefcaeSZheng Fan 0); 123d4aefcaeSZheng Fan } 124b9e67834SAndre Fischer 125d4aefcaeSZheng Fan long TextPropertyPanel::GetSelFontSize() 126d4aefcaeSZheng Fan { 127d4aefcaeSZheng Fan long nH = 240; 128d4aefcaeSZheng Fan SfxMapUnit eUnit = maSpacingControl.GetCoreMetric(); 129d4aefcaeSZheng Fan if (mpHeightItem) 130d4aefcaeSZheng Fan nH = LogicToLogic( mpHeightItem->GetHeight(), (MapUnit)eUnit, MAP_TWIP ); 131d4aefcaeSZheng Fan return nH; 132d4aefcaeSZheng Fan } 133b9e67834SAndre Fischer 134b9e67834SAndre Fischer 13595a18594SAndre Fischer TextPropertyPanel* TextPropertyPanel::Create ( 136b9e67834SAndre Fischer Window* pParent, 137b9e67834SAndre Fischer const cssu::Reference<css::frame::XFrame>& rxFrame, 138b9e67834SAndre Fischer SfxBindings* pBindings) 139b9e67834SAndre Fischer { 140b9e67834SAndre Fischer if (pParent == NULL) 141b9e67834SAndre Fischer throw lang::IllegalArgumentException(A2S("no parent Window given to TextPropertyPanel::Create"), NULL, 0); 142b9e67834SAndre Fischer if ( ! rxFrame.is()) 143b9e67834SAndre Fischer throw lang::IllegalArgumentException(A2S("no XFrame given to TextPropertyPanel::Create"), NULL, 1); 144b9e67834SAndre Fischer if (pBindings == NULL) 145b9e67834SAndre Fischer throw lang::IllegalArgumentException(A2S("no SfxBindings given to TextPropertyPanel::Create"), NULL, 2); 146b9e67834SAndre Fischer 14795a18594SAndre Fischer return new TextPropertyPanel( 14895a18594SAndre Fischer pParent, 14995a18594SAndre Fischer rxFrame, 15095a18594SAndre Fischer pBindings); 151b9e67834SAndre Fischer } 152b9e67834SAndre Fischer 153b9e67834SAndre Fischer 154d4aefcaeSZheng Fan ::sfx2::sidebar::ControllerItem& TextPropertyPanel::GetSpaceController() 155d4aefcaeSZheng Fan { 156d4aefcaeSZheng Fan return maSpacingControl; 157d4aefcaeSZheng Fan } 158b9e67834SAndre Fischer 159b9e67834SAndre Fischer TextPropertyPanel::TextPropertyPanel ( 160b9e67834SAndre Fischer Window* pParent, 161b9e67834SAndre Fischer const cssu::Reference<css::frame::XFrame>& rxFrame, 162b9e67834SAndre Fischer SfxBindings* pBindings) 16395a18594SAndre Fischer : Control(pParent, SVX_RES(RID_SIDEBAR_TEXT_PANEL)), 164b9e67834SAndre Fischer mpFontNameBox (new SvxSBFontNameBox(this, SVX_RES(CB_SBFONT_FONT))), 165b9e67834SAndre Fischer maFontSizeBox (this, SVX_RES(MB_SBFONT_FONTSIZE)), 1667a32b0c8SAndre Fischer mpToolBoxIncDecBackground(ControlFactory::CreateToolBoxBackground(this)), 1677a32b0c8SAndre Fischer mpToolBoxIncDec(ControlFactory::CreateToolBox( 1687a32b0c8SAndre Fischer mpToolBoxIncDecBackground.get(), 1697a32b0c8SAndre Fischer SVX_RES(TB_INCREASE_DECREASE))), 1707a32b0c8SAndre Fischer mpToolBoxFontBackground(ControlFactory::CreateToolBoxBackground(this)), 1717a32b0c8SAndre Fischer mpToolBoxFont(ControlFactory::CreateToolBox( 1727a32b0c8SAndre Fischer mpToolBoxFontBackground.get(), 1737a32b0c8SAndre Fischer SVX_RES(TB_FONT))), 1747a32b0c8SAndre Fischer mpToolBoxFontColorBackground(ControlFactory::CreateToolBoxBackground(this)), 1757a32b0c8SAndre Fischer mpToolBoxFontColor(ControlFactory::CreateToolBox( 1767a32b0c8SAndre Fischer mpToolBoxFontColorBackground.get(), 1777a32b0c8SAndre Fischer SVX_RES(TB_FONTCOLOR))), 1787a32b0c8SAndre Fischer mpToolBoxScriptBackground(ControlFactory::CreateToolBoxBackground(this)), 1797a32b0c8SAndre Fischer mpToolBoxScript(ControlFactory::CreateToolBox( 1807a32b0c8SAndre Fischer mpToolBoxScriptBackground.get(), 1817a32b0c8SAndre Fischer SVX_RES(TB_SCRIPT))), 1827a32b0c8SAndre Fischer mpToolBoxScriptSwBackground(ControlFactory::CreateToolBoxBackground(this)), 1837a32b0c8SAndre Fischer mpToolBoxScriptSw(ControlFactory::CreateToolBox( 1847a32b0c8SAndre Fischer mpToolBoxScriptSwBackground.get(), 1857a32b0c8SAndre Fischer SVX_RES(TB_SCRIPT_SW))), 1867a32b0c8SAndre Fischer mpToolBoxSpacingBackground(ControlFactory::CreateToolBoxBackground(this)), 1877a32b0c8SAndre Fischer mpToolBoxSpacing(ControlFactory::CreateToolBox( 1887a32b0c8SAndre Fischer mpToolBoxSpacingBackground.get(), 1897a32b0c8SAndre Fischer SVX_RES(TB_SPACING))), 1907a32b0c8SAndre Fischer mpToolBoxHighlightBackground(ControlFactory::CreateToolBoxBackground(this)), 1917a32b0c8SAndre Fischer mpToolBoxHighlight(ControlFactory::CreateToolBox( 1927a32b0c8SAndre Fischer mpToolBoxHighlightBackground.get(), 1937a32b0c8SAndre Fischer SVX_RES(TB_HIGHLIGHT))), 194d4aefcaeSZheng Fan maCharSpacePopup(this, ::boost::bind(&TextPropertyPanel::CreateCharacterSpacingControl, this, _1)), 195d4aefcaeSZheng Fan maFontColorPopup(this, ::boost::bind(&TextPropertyPanel::CreateFontColorPopupControl, this, _1)), 196d4aefcaeSZheng Fan maBrushColorPopup(this, ::boost::bind(&TextPropertyPanel::CreateBrushColorPopupControl, this, _1)), 197d4aefcaeSZheng Fan maUnderlinePopup(this, ::boost::bind(&TextPropertyPanel::CreateUnderlinePopupControl, this, _1)), 198b9e67834SAndre Fischer mpFontColorUpdater(), 199b9e67834SAndre Fischer mpHighlightUpdater(), 200b9e67834SAndre Fischer 201b9e67834SAndre Fischer maFontNameControl (SID_ATTR_CHAR_FONT, *pBindings, *this), 202b9e67834SAndre Fischer maFontSizeControl (SID_ATTR_CHAR_FONTHEIGHT, *pBindings, *this), 203b9e67834SAndre Fischer maWeightControl (SID_ATTR_CHAR_WEIGHT, *pBindings, *this), 204b9e67834SAndre Fischer maItalicControl (SID_ATTR_CHAR_POSTURE, *pBindings, *this), 205b9e67834SAndre Fischer maUnderlineControl (SID_ATTR_CHAR_UNDERLINE, *pBindings, *this), 206b9e67834SAndre Fischer maStrikeControl (SID_ATTR_CHAR_STRIKEOUT, *pBindings, *this), 207b9e67834SAndre Fischer maShadowControl (SID_ATTR_CHAR_SHADOWED, *pBindings, *this), 208b9e67834SAndre Fischer maFontColorControl (SID_ATTR_CHAR_COLOR, *pBindings, *this), 209b9e67834SAndre Fischer maScriptControlSw (SID_ATTR_CHAR_ESCAPEMENT, *pBindings, *this), //for sw 210b9e67834SAndre Fischer maSuperScriptControl (SID_SET_SUPER_SCRIPT, *pBindings, *this), 211b9e67834SAndre Fischer maSubScriptControl (SID_SET_SUB_SCRIPT, *pBindings, *this), 212b9e67834SAndre Fischer maSpacingControl (SID_ATTR_CHAR_KERNING, *pBindings, *this), 213b9e67834SAndre Fischer maHighlightControl (SID_ATTR_BRUSH_CHAR, *pBindings, *this), 214b9e67834SAndre Fischer maSDFontGrow (SID_GROW_FONT_SIZE, *pBindings, *this), 215b9e67834SAndre Fischer maSDFontShrink (SID_SHRINK_FONT_SIZE, *pBindings, *this), 216b9e67834SAndre Fischer 217b9e67834SAndre Fischer maImgIncrease (SVX_RES( IMG_INCREASE)), 218b9e67834SAndre Fischer maImgDecrease (SVX_RES( IMG_DECREASE)), 219b9e67834SAndre Fischer maImgBold (SVX_RES( IMG_BOLD )), 220b9e67834SAndre Fischer maImgItalic (SVX_RES( IMG_ITALIC )), 221b9e67834SAndre Fischer maImgUnderline (SVX_RES( IMG_UNDERLINE )), 222b9e67834SAndre Fischer maImgStrike (SVX_RES( IMG_STRIKEOUT )), 223b9e67834SAndre Fischer maImgShadow (SVX_RES( IMG_SHADOWED )), 224b9e67834SAndre Fischer maImgFontColor (SVX_RES( IMG_FONTCOLOR)), 225b9e67834SAndre Fischer maImgSupScript (SVX_RES( IMG_SUPSCRIPT)), 226b9e67834SAndre Fischer maImgSubScript (SVX_RES( IMG_SUBSCRIPT)), 227b9e67834SAndre Fischer maImgHighlight (SVX_RES( IMG_HIGHLIGHT)), 228b9e67834SAndre Fischer 229b9e67834SAndre Fischer maImgNormalIcon (SVX_RES(IMG_SPACING_D)), 230b9e67834SAndre Fischer 231b9e67834SAndre Fischer maImgIncreaseHigh (SVX_RES( IMG_INCREASE_H )), 232b9e67834SAndre Fischer maImgDecreaseHigh (SVX_RES( IMG_DECREASE_H )), 233b9e67834SAndre Fischer maImgBoldHigh (SVX_RES( IMG_BOLD_H )), 234b9e67834SAndre Fischer maImgItalicHigh (SVX_RES( IMG_ITALIC_H )), 235b9e67834SAndre Fischer maImgUnderlineHigh (SVX_RES( IMG_UNDERLINE_H )), 236b9e67834SAndre Fischer maImgStrikeHigh (SVX_RES( IMG_STRIKEOUT_H )), 237b9e67834SAndre Fischer maImgShadowHigh (SVX_RES( IMG_SHADOWED_H )), 238b9e67834SAndre Fischer maImgFontColorHigh (SVX_RES( IMG_FONTCOLOR_H)), 239b9e67834SAndre Fischer maImgSupScriptHigh (SVX_RES( IMG_SUPSCRIPT_H)), 240b9e67834SAndre Fischer maImgSubScriptHigh (SVX_RES( IMG_SUBSCRIPT_H)), 241b9e67834SAndre Fischer maImgHighlightHigh (SVX_RES( IMG_HIGHLIGHT_H)), 242b9e67834SAndre Fischer 243b9e67834SAndre Fischer mpFontList (NULL), 244b9e67834SAndre Fischer mbMustDelete (false), 245b9e67834SAndre Fischer mbFocusOnFontSizeCtrl(false), 24695a18594SAndre Fischer mxFrame(rxFrame), 247b9e67834SAndre Fischer maContext(), 248b9e67834SAndre Fischer mpBindings(pBindings) 249b9e67834SAndre Fischer { 250b9e67834SAndre Fischer Initialize(); 251b9e67834SAndre Fischer FreeResource(); 25295a18594SAndre Fischer 25395a18594SAndre Fischer // Let the Pane draw the background. 25495a18594SAndre Fischer SetBackground(Wallpaper()); 255b9e67834SAndre Fischer } 256b9e67834SAndre Fischer 257b9e67834SAndre Fischer 258b9e67834SAndre Fischer 259b9e67834SAndre Fischer 260b9e67834SAndre Fischer TextPropertyPanel::~TextPropertyPanel (void) 261b9e67834SAndre Fischer { 262b9e67834SAndre Fischer if(mbMustDelete) 263b9e67834SAndre Fischer delete mpFontList; 264b9e67834SAndre Fischer 265b9e67834SAndre Fischer /*AF 266b9e67834SAndre Fischer delete mpPageUnderline; 267b9e67834SAndre Fischer delete mpFloatWinUnderline; 268b9e67834SAndre Fischer 269b9e67834SAndre Fischer delete mpPageFontColor; 270b9e67834SAndre Fischer delete mpFloatWinFontColor; 271b9e67834SAndre Fischer 272b9e67834SAndre Fischer delete mpPageSpacing; 273b9e67834SAndre Fischer delete mpFloatWinSpacing; 274b9e67834SAndre Fischer */ 2757a32b0c8SAndre Fischer 2767a32b0c8SAndre Fischer // Destroy the toolbox windows. 2777a32b0c8SAndre Fischer mpToolBoxIncDec.reset(); 2787a32b0c8SAndre Fischer mpToolBoxFont.reset(); 2797a32b0c8SAndre Fischer mpToolBoxFontColor.reset(); 2807a32b0c8SAndre Fischer mpToolBoxScript.reset(); 2817a32b0c8SAndre Fischer mpToolBoxScriptSw.reset(); 2827a32b0c8SAndre Fischer mpToolBoxSpacing.reset(); 2837a32b0c8SAndre Fischer mpToolBoxHighlight.reset(); 2847a32b0c8SAndre Fischer 2857a32b0c8SAndre Fischer // Destroy the background windows of the toolboxes. 2867a32b0c8SAndre Fischer mpToolBoxIncDecBackground.reset(); 2877a32b0c8SAndre Fischer mpToolBoxFontBackground.reset(); 2887a32b0c8SAndre Fischer mpToolBoxFontColorBackground.reset(); 2897a32b0c8SAndre Fischer mpToolBoxScriptBackground.reset(); 2907a32b0c8SAndre Fischer mpToolBoxScriptSwBackground.reset(); 2917a32b0c8SAndre Fischer mpToolBoxSpacingBackground.reset(); 2927a32b0c8SAndre Fischer mpToolBoxHighlightBackground.reset(); 293b9e67834SAndre Fischer } 294b9e67834SAndre Fischer 295b9e67834SAndre Fischer 296b9e67834SAndre Fischer 297b9e67834SAndre Fischer 29895a18594SAndre Fischer Image TextPropertyPanel::GetIcon (const ::rtl::OUString& rsURL) 29995a18594SAndre Fischer { 30095a18594SAndre Fischer return GetImage(mxFrame, rsURL, sal_False, Theme::IsHighContrastMode()); 30195a18594SAndre Fischer } 30295a18594SAndre Fischer 30395a18594SAndre Fischer 304d4aefcaeSZheng Fan void TextPropertyPanel::SetSpacing(long nKern) 305d4aefcaeSZheng Fan { 306d4aefcaeSZheng Fan mlKerning = nKern; 307d4aefcaeSZheng Fan } 30895a18594SAndre Fischer 30995a18594SAndre Fischer 310b9e67834SAndre Fischer void TextPropertyPanel::HandleContextChange ( 311b9e67834SAndre Fischer const ::sfx2::sidebar::EnumContext aContext) 312b9e67834SAndre Fischer { 313b9e67834SAndre Fischer if (maContext == aContext) 314b9e67834SAndre Fischer { 315b9e67834SAndre Fischer // Nothing to do. 316b9e67834SAndre Fischer return; 317b9e67834SAndre Fischer } 318b9e67834SAndre Fischer 319b9e67834SAndre Fischer maContext = aContext; 320b9e67834SAndre Fischer switch (maContext.GetCombinedContext()) 321b9e67834SAndre Fischer { 322b9e67834SAndre Fischer case CombinedEnumContext(Application_Calc, Context_Cell): 323b9e67834SAndre Fischer case CombinedEnumContext(Application_Calc, Context_Pivot): 324b9e67834SAndre Fischer { 325b9e67834SAndre Fischer mpToolBoxScript->Hide(); 326b9e67834SAndre Fischer mpToolBoxScriptSw->Hide(); 327b9e67834SAndre Fischer mpToolBoxSpacing->Hide(); 328b9e67834SAndre Fischer mpToolBoxHighlight->Hide(); 329b9e67834SAndre Fischer 330b9e67834SAndre Fischer Size aSize(PROPERTYPAGE_WIDTH,TEXT_SECTIONPAGE_HEIGHT_S); 331b9e67834SAndre Fischer aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) ); 332b9e67834SAndre Fischer aSize.setWidth(GetOutputSizePixel().Width()); 333b9e67834SAndre Fischer SetSizePixel(aSize); 334b9e67834SAndre Fischer break; 335b9e67834SAndre Fischer } 336b9e67834SAndre Fischer 337b9e67834SAndre Fischer case CombinedEnumContext(Application_Writer, Context_Text): 338b9e67834SAndre Fischer case CombinedEnumContext(Application_Writer, Context_Table): 339b9e67834SAndre Fischer { 340b9e67834SAndre Fischer mpToolBoxScriptSw->Show(); 341b9e67834SAndre Fischer mpToolBoxScript->Hide(); 342b9e67834SAndre Fischer mpToolBoxHighlight->Show(); 343b9e67834SAndre Fischer mpToolBoxSpacing->Show(); 344b9e67834SAndre Fischer 345b9e67834SAndre Fischer Size aSize(PROPERTYPAGE_WIDTH, TEXT_SECTIONPAGE_HEIGHT); 346b9e67834SAndre Fischer aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) ); 347b9e67834SAndre Fischer aSize.setWidth(GetOutputSizePixel().Width()); 348b9e67834SAndre Fischer SetSizePixel(aSize); 349b9e67834SAndre Fischer break; 350b9e67834SAndre Fischer } 351b9e67834SAndre Fischer 352b9e67834SAndre Fischer case CombinedEnumContext(Application_Writer, Context_DrawText): 353b9e67834SAndre Fischer case CombinedEnumContext(Application_Writer, Context_Annotation): 354b9e67834SAndre Fischer { 355b9e67834SAndre Fischer mpToolBoxScriptSw->Show(); 356b9e67834SAndre Fischer mpToolBoxScript->Hide(); 357b9e67834SAndre Fischer mpToolBoxSpacing->Show(); 358b9e67834SAndre Fischer mpToolBoxHighlight->Hide(); 359b9e67834SAndre Fischer 360b9e67834SAndre Fischer Size aSize(PROPERTYPAGE_WIDTH,TEXT_SECTIONPAGE_HEIGHT); 361b9e67834SAndre Fischer aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) ); 362b9e67834SAndre Fischer aSize.setWidth(GetOutputSizePixel().Width()); 363b9e67834SAndre Fischer SetSizePixel(aSize); 364b9e67834SAndre Fischer break; 365b9e67834SAndre Fischer } 366b9e67834SAndre Fischer 367b9e67834SAndre Fischer case CombinedEnumContext(Application_Calc, Context_EditCell): 368b9e67834SAndre Fischer case CombinedEnumContext(Application_Calc, Context_DrawText): 369b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_DrawText): 370b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_Text): 371b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_Table): 372b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_OutlineText): 373b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_Draw): 374b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_TextObject): 375b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_Graphic): 376b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_DrawText): 377b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_Text): 378b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_Table): 379b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_OutlineText): 380b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_Draw): 381b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_TextObject): 382b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_Graphic): 383b9e67834SAndre Fischer { 384b9e67834SAndre Fischer mpToolBoxScriptSw->Hide(); 385b9e67834SAndre Fischer mpToolBoxScript->Show(); 386b9e67834SAndre Fischer mpToolBoxSpacing->Show(); 387b9e67834SAndre Fischer mpToolBoxHighlight->Hide(); 388b9e67834SAndre Fischer 389b9e67834SAndre Fischer Size aSize(PROPERTYPAGE_WIDTH,TEXT_SECTIONPAGE_HEIGHT); 390b9e67834SAndre Fischer aSize = LogicToPixel( aSize,MapMode(MAP_APPFONT) ); 391b9e67834SAndre Fischer aSize.setWidth(GetOutputSizePixel().Width()); 392b9e67834SAndre Fischer SetSizePixel(aSize); 393b9e67834SAndre Fischer break; 394b9e67834SAndre Fischer } 395b9e67834SAndre Fischer 396b9e67834SAndre Fischer default: 397b9e67834SAndre Fischer break; 398b9e67834SAndre Fischer } 399b9e67834SAndre Fischer } 400b9e67834SAndre Fischer 401d4aefcaeSZheng Fan SfxBindings* TextPropertyPanel::GetBindings() 402d4aefcaeSZheng Fan { 403d4aefcaeSZheng Fan return mpBindings; 404d4aefcaeSZheng Fan } 405b9e67834SAndre Fischer 406b9e67834SAndre Fischer 407b9e67834SAndre Fischer void TextPropertyPanel::DataChanged (const DataChangedEvent& rEvent) 408b9e67834SAndre Fischer { 40995a18594SAndre Fischer (void)rEvent; 41095a18594SAndre Fischer 411b9e67834SAndre Fischer SetupIcons(); 412b9e67834SAndre Fischer } 413b9e67834SAndre Fischer 414b9e67834SAndre Fischer 415b9e67834SAndre Fischer 416b9e67834SAndre Fischer void TextPropertyPanel::Initialize (void) 417b9e67834SAndre Fischer { 41895a18594SAndre Fischer //<<modify fill font list 41995a18594SAndre Fischer SfxObjectShell* pDocSh = SfxObjectShell::Current(); 420b9e67834SAndre Fischer const SfxPoolItem* pItem = NULL; 421b9e67834SAndre Fischer 422b9e67834SAndre Fischer if (pDocSh != NULL) 423b9e67834SAndre Fischer pItem = pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST ); 424b9e67834SAndre Fischer if (pItem != NULL) 425b9e67834SAndre Fischer mpFontList = ( (SvxFontListItem*)pItem )->GetFontList(); 426b9e67834SAndre Fischer else 427b9e67834SAndre Fischer { 428b9e67834SAndre Fischer mpFontList = new FontList( Application::GetDefaultDevice() ); 42995a18594SAndre Fischer mbMustDelete = 1; 430b9e67834SAndre Fischer } 431b9e67834SAndre Fischer 432b9e67834SAndre Fischer mpFontNameBox->SetAccessibleName(mpFontNameBox->GetQuickHelpText()); 43395a18594SAndre Fischer const FontInfo aFontInfo (mpFontList->Get( String::CreateFromAscii( "" ), String::CreateFromAscii( "" ))); 43495a18594SAndre Fischer maFontSizeBox.Fill(&aFontInfo,mpFontList); 43595a18594SAndre Fischer maFontSizeBox.SetAccessibleName(maFontSizeBox.GetQuickHelpText()); 436b9e67834SAndre Fischer 437b9e67834SAndre Fischer //toolbox 438b9e67834SAndre Fischer SetupIcons(); 43995a18594SAndre Fischer InitToolBoxIncDec(); 44095a18594SAndre Fischer InitToolBoxFont(); 44195a18594SAndre Fischer InitToolBoxFontColor(); 44295a18594SAndre Fischer InitToolBoxScript(); 44395a18594SAndre Fischer InitToolBoxSpacing(); 44495a18594SAndre Fischer InitToolBoxHighlight(); 445b9e67834SAndre Fischer 446b9e67834SAndre Fischer #ifdef HAS_IA2 447d4aefcaeSZheng Fan mpFontNameBox->SetAccRelationLabeledBy(&mpFontNameBox); 448d4aefcaeSZheng Fan mpFontNameBox->SetMpSubEditAccLableBy(&mpFontNameBox); 449b9e67834SAndre Fischer maFontSizeBox.SetAccRelationLabeledBy(&maFontSizeBox); 45095a18594SAndre Fischer maFontSizeBox.SetMpSubEditAccLableBy(&maFontSizeBox); 451d4aefcaeSZheng Fan mpToolBoxFont.SetAccRelationLabeledBy(&mpToolBoxFont); 452d4aefcaeSZheng Fan mpToolBoxIncDec.SetAccRelationLabeledBy(&mpToolBoxIncDec); 453d4aefcaeSZheng Fan mpToolBoxFontColor.SetAccRelationLabeledBy(&mpToolBoxFontColor); 454d4aefcaeSZheng Fan mpToolBoxScript.SetAccRelationLabeledBy(&mpToolBoxScript); 455d4aefcaeSZheng Fan mpToolBoxScriptSw.SetAccRelationLabeledBy(&mpToolBoxScriptSw); 456d4aefcaeSZheng Fan mpToolBoxSpacing.SetAccRelationLabeledBy(&mpToolBoxSpacing); 457d4aefcaeSZheng Fan mpToolBoxHighlight.SetAccRelationLabeledBy(&mpToolBoxHighlight); 458b9e67834SAndre Fischer #endif 459b9e67834SAndre Fischer 46095a18594SAndre Fischer //init state 46195a18594SAndre Fischer mpHeightItem = NULL; 46295a18594SAndre Fischer meWeight = WEIGHT_NORMAL; 46395a18594SAndre Fischer meItalic = ITALIC_NONE; 46495a18594SAndre Fischer mbShadow = false; 46595a18594SAndre Fischer meStrike = STRIKEOUT_NONE; 46695a18594SAndre Fischer mbPostureAvailable = true; 46795a18594SAndre Fischer mbWeightAvailable = true; 46895a18594SAndre Fischer meUnderline = UNDERLINE_NONE; 46995a18594SAndre Fischer meUnderlineColor = COL_AUTO; // 47095a18594SAndre Fischer maColor = COL_BLACK; 47195a18594SAndre Fischer mbColorAvailable = true; 47295a18594SAndre Fischer maBackColor = COL_AUTO; 47395a18594SAndre Fischer mbBackColorAvailable = true; 47495a18594SAndre Fischer meColorType = FONT_COLOR; 47595a18594SAndre Fischer meEscape = SVX_ESCAPEMENT_OFF; 47695a18594SAndre Fischer mbSuper = false; 47795a18594SAndre Fischer mbSub = false; 47895a18594SAndre Fischer mbKernAvailable = true; 47995a18594SAndre Fischer mbKernLBAvailable = true; 48095a18594SAndre Fischer mlKerning = 0; 48195a18594SAndre Fischer mpFontColorUpdater.reset(new ToolboxButtonColorUpdater( 482b9e67834SAndre Fischer SID_ATTR_CHAR_COLOR, 483b9e67834SAndre Fischer TBI_FONTCOLOR, 484b9e67834SAndre Fischer mpToolBoxFontColor.get(), 485b9e67834SAndre Fischer TBX_UPDATER_MODE_CHAR_COLOR_NEW)); 486b9e67834SAndre Fischer mpHighlightUpdater.reset(new ToolboxButtonColorUpdater( 487b9e67834SAndre Fischer SID_ATTR_BRUSH_CHAR, 488b9e67834SAndre Fischer TBI_HIGHLIGHT, 489b9e67834SAndre Fischer mpToolBoxHighlight.get(), 490b9e67834SAndre Fischer TBX_UPDATER_MODE_CHAR_COLOR_NEW)); 491b9e67834SAndre Fischer 49295a18594SAndre Fischer //set handler 49395a18594SAndre Fischer mpFontNameBox->SetBindings(mpBindings); 49495a18594SAndre Fischer //add 49595a18594SAndre Fischer Link aLink = LINK(this, TextPropertyPanel, FontSelHdl); 49695a18594SAndre Fischer mpFontNameBox->SetSelectHdl(aLink); 49795a18594SAndre Fischer //add end 498b9e67834SAndre Fischer 49995a18594SAndre Fischer aLink = LINK(this, TextPropertyPanel, FontSizeModifyHdl); 50095a18594SAndre Fischer maFontSizeBox.SetModifyHdl(aLink); 50195a18594SAndre Fischer //add 50295a18594SAndre Fischer aLink = LINK(this, TextPropertyPanel, FontSizeSelHdl); 50395a18594SAndre Fischer maFontSizeBox.SetSelectHdl(aLink); 50495a18594SAndre Fischer //add end 50595a18594SAndre Fischer aLink = LINK(this, TextPropertyPanel, FontSizeLoseFocus); 50695a18594SAndre Fischer maFontSizeBox.SetLoseFocusHdl(aLink); 50795a18594SAndre Fischer 50895a18594SAndre Fischer // add 50995a18594SAndre Fischer long aSizeBoxHeight = maFontSizeBox.GetSizePixel().getHeight();; 51095a18594SAndre Fischer Point aPosFontSize = maFontSizeBox.GetPosPixel(); 51195a18594SAndre Fischer long aPosY = aPosFontSize.getY(); 51295a18594SAndre Fischer Point pTBIncDec = mpToolBoxIncDec->GetPosPixel(); 51395a18594SAndre Fischer long aIncDecHeight = mpToolBoxIncDec->GetSizePixel().getHeight(); 51495a18594SAndre Fischer pTBIncDec.setY(aPosY+aSizeBoxHeight/2-aIncDecHeight/2); 51595a18594SAndre Fischer mpToolBoxIncDec->SetPosPixel(pTBIncDec); 51695a18594SAndre Fischer //end 517b9e67834SAndre Fischer } 518b9e67834SAndre Fischer 519d4aefcaeSZheng Fan void TextPropertyPanel::EndSpacingPopupMode (void) 520d4aefcaeSZheng Fan { 521d4aefcaeSZheng Fan maCharSpacePopup.Hide(); 522d4aefcaeSZheng Fan } 523b9e67834SAndre Fischer 524d4aefcaeSZheng Fan void TextPropertyPanel::EndUnderlinePopupMode (void) 525d4aefcaeSZheng Fan { 526d4aefcaeSZheng Fan maUnderlinePopup.Hide(); 527d4aefcaeSZheng Fan } 528b9e67834SAndre Fischer 529b9e67834SAndre Fischer 530b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxFont() 531b9e67834SAndre Fischer { 532b9e67834SAndre Fischer mpToolBoxFont->SetQuickHelpText(TBI_BOLD,String(SVX_RES(STR_QH_BOLD))); //Add 533b9e67834SAndre Fischer mpToolBoxFont->SetQuickHelpText(TBI_ITALIC,String(SVX_RES(STR_QH_ITALIC))); //Add 534b9e67834SAndre Fischer mpToolBoxFont->SetQuickHelpText(TBI_UNDERLINE,String(SVX_RES(STR_QH_UNDERLINE))); //Add 535b9e67834SAndre Fischer mpToolBoxFont->SetBackground(Wallpaper()); 536b9e67834SAndre Fischer mpToolBoxFont->SetPaintTransparent(true); 537b9e67834SAndre Fischer 538b9e67834SAndre Fischer Size aTbxSize( mpToolBoxFont->CalcWindowSizePixel() ); 539b9e67834SAndre Fischer mpToolBoxFont->SetOutputSizePixel( aTbxSize ); 540b9e67834SAndre Fischer 541b9e67834SAndre Fischer Link aLink = LINK(this, TextPropertyPanel, ToolboxFontSelectHandler); 542b9e67834SAndre Fischer mpToolBoxFont->SetSelectHdl ( aLink ); 543b9e67834SAndre Fischer aLink = LINK(this, TextPropertyPanel, ToolBoxUnderlineClickHdl); 544b9e67834SAndre Fischer mpToolBoxFont->SetDropdownClickHdl(aLink); 545b9e67834SAndre Fischer } 546b9e67834SAndre Fischer 547b9e67834SAndre Fischer 548b9e67834SAndre Fischer 549b9e67834SAndre Fischer 550b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxIncDec() 551b9e67834SAndre Fischer { 552b9e67834SAndre Fischer Size aTbxSize( mpToolBoxIncDec->CalcWindowSizePixel() ); 553b9e67834SAndre Fischer mpToolBoxIncDec->SetOutputSizePixel( aTbxSize ); 554b9e67834SAndre Fischer 555b9e67834SAndre Fischer Link aLink = LINK(this, TextPropertyPanel, ToolboxIncDecSelectHdl); 556b9e67834SAndre Fischer mpToolBoxIncDec->SetSelectHdl ( aLink ); 557b9e67834SAndre Fischer } 558b9e67834SAndre Fischer 559b9e67834SAndre Fischer 560b9e67834SAndre Fischer 561b9e67834SAndre Fischer 562b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxFontColor() 563b9e67834SAndre Fischer { 564b9e67834SAndre Fischer Size aTbxSize( mpToolBoxFontColor->CalcWindowSizePixel() ); 565b9e67834SAndre Fischer mpToolBoxFontColor->SetOutputSizePixel( aTbxSize ); 566b9e67834SAndre Fischer mpToolBoxFontColor->SetItemBits( TBI_FONTCOLOR, mpToolBoxFontColor->GetItemBits( TBI_FONTCOLOR ) | TIB_DROPDOWNONLY ); 567b9e67834SAndre Fischer 568b9e67834SAndre Fischer Link aLink = LINK(this, TextPropertyPanel, ToolBoxFontColorDropHdl); 569b9e67834SAndre Fischer mpToolBoxFontColor->SetDropdownClickHdl ( aLink ); 570b9e67834SAndre Fischer mpToolBoxFontColor->SetSelectHdl ( aLink ); 571b9e67834SAndre Fischer 572b9e67834SAndre Fischer } 573b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxScript() 574b9e67834SAndre Fischer { 575b9e67834SAndre Fischer Size aTbxSize( mpToolBoxScriptSw->CalcWindowSizePixel() ); 576b9e67834SAndre Fischer mpToolBoxScriptSw->SetOutputSizePixel( aTbxSize ); 577b9e67834SAndre Fischer 578b9e67834SAndre Fischer Link aLink = LINK(this, TextPropertyPanel, ToolBoxSwScriptSelectHdl); 579b9e67834SAndre Fischer mpToolBoxScriptSw->SetSelectHdl ( aLink ); 580b9e67834SAndre Fischer 581b9e67834SAndre Fischer aTbxSize = mpToolBoxScript->CalcWindowSizePixel() ; 582b9e67834SAndre Fischer mpToolBoxScript->SetOutputSizePixel( aTbxSize ); 583b9e67834SAndre Fischer 584b9e67834SAndre Fischer aLink = LINK(this, TextPropertyPanel, ToolBoxScriptSelectHdl); 585b9e67834SAndre Fischer mpToolBoxScript->SetSelectHdl ( aLink ); 586b9e67834SAndre Fischer } 587b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxSpacing() 588b9e67834SAndre Fischer { 589b9e67834SAndre Fischer Size aTbxSize( mpToolBoxSpacing->CalcWindowSizePixel() ); 590b9e67834SAndre Fischer mpToolBoxSpacing->SetOutputSizePixel( aTbxSize ); 591b9e67834SAndre Fischer mpToolBoxSpacing->SetItemBits( TBI_SPACING, mpToolBoxSpacing->GetItemBits( TBI_SPACING ) | TIB_DROPDOWNONLY ); 592b9e67834SAndre Fischer 593b9e67834SAndre Fischer Link aLink = LINK(this, TextPropertyPanel, SpacingClickHdl); 594b9e67834SAndre Fischer mpToolBoxSpacing->SetDropdownClickHdl ( aLink ); 595b9e67834SAndre Fischer mpToolBoxSpacing->SetSelectHdl( aLink ); 596b9e67834SAndre Fischer } 597b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxHighlight() 598b9e67834SAndre Fischer { 599b9e67834SAndre Fischer Size aTbxSize( mpToolBoxHighlight->CalcWindowSizePixel() ); 600b9e67834SAndre Fischer mpToolBoxHighlight->SetOutputSizePixel( aTbxSize ); 601b9e67834SAndre Fischer mpToolBoxHighlight->SetItemBits( TBI_HIGHLIGHT, mpToolBoxHighlight->GetItemBits( TBI_HIGHLIGHT ) | TIB_DROPDOWNONLY ); 602b9e67834SAndre Fischer 603b9e67834SAndre Fischer Link aLink = LINK(this, TextPropertyPanel, ToolBoxHighlightDropHdl); 604b9e67834SAndre Fischer mpToolBoxHighlight->SetDropdownClickHdl ( aLink ); 605b9e67834SAndre Fischer mpToolBoxHighlight->SetSelectHdl( aLink ); 606b9e67834SAndre Fischer } 607b9e67834SAndre Fischer 608b9e67834SAndre Fischer 609b9e67834SAndre Fischer 610b9e67834SAndre Fischer 611b9e67834SAndre Fischer void TextPropertyPanel::SetupIcons (void) 612b9e67834SAndre Fischer { 613b9e67834SAndre Fischer if (Theme::GetBoolean(Theme::Bool_UseSymphonyIcons)) 614b9e67834SAndre Fischer { 615b9e67834SAndre Fischer mpToolBoxIncDec->SetItemImage(TBI_INCREASE, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgIncreaseHigh : maImgIncrease); 616b9e67834SAndre Fischer mpToolBoxIncDec->SetItemImage(TBI_DECREASE, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgDecreaseHigh : maImgDecrease); 617b9e67834SAndre Fischer mpToolBoxFont->SetItemImage(TBI_BOLD, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgBoldHigh : maImgBold); 618b9e67834SAndre Fischer mpToolBoxFont->SetItemImage(TBI_ITALIC, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgItalicHigh : maImgItalic); 619b9e67834SAndre Fischer mpToolBoxFont->SetItemImage(TBI_UNDERLINE, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgUnderlineHigh : maImgUnderline); 620b9e67834SAndre Fischer mpToolBoxFont->SetItemImage(TBI_STRIKEOUT, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgStrikeHigh : maImgStrike); 621b9e67834SAndre Fischer mpToolBoxFont->SetItemImage(TBI_SHADOWED, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgShadowHigh : maImgShadow); 622b9e67834SAndre Fischer 623b9e67834SAndre Fischer mpToolBoxFontColor->SetItemImage(TBI_FONTCOLOR, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgFontColorHigh : maImgFontColor); 624b9e67834SAndre Fischer //for sw 625b9e67834SAndre Fischer mpToolBoxScriptSw->SetItemImage(TBI_SUPER_SW, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgSupScriptHigh : maImgSupScript); 626b9e67834SAndre Fischer mpToolBoxScriptSw->SetItemImage(TBI_SUB_SW, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgSubScriptHigh : maImgSubScript); 627b9e67834SAndre Fischer //for sc and sd 628b9e67834SAndre Fischer mpToolBoxScript->SetItemImage(TBI_SUPER, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgSupScriptHigh : maImgSupScript); 629b9e67834SAndre Fischer mpToolBoxScript->SetItemImage(TBI_SUB, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgSubScriptHigh : maImgSubScript); 630b9e67834SAndre Fischer mpToolBoxSpacing->SetItemImage(TBI_SPACING, maImgNormalIcon); 631b9e67834SAndre Fischer mpToolBoxHighlight->SetItemImage(TBI_HIGHLIGHT, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgHighlightHigh : maImgHighlight); 632b9e67834SAndre Fischer } 633b9e67834SAndre Fischer else 634b9e67834SAndre Fischer { 635b9e67834SAndre Fischer mpToolBoxIncDec->SetItemImage(TBI_INCREASE, GetIcon(A2S(".uno:Grow"))); 636b9e67834SAndre Fischer mpToolBoxIncDec->SetItemImage(TBI_DECREASE, GetIcon(A2S(".uno:Shrink"))); 637b9e67834SAndre Fischer mpToolBoxFont->SetItemImage(TBI_BOLD, GetIcon(A2S(".uno:Bold"))); 638b9e67834SAndre Fischer mpToolBoxFont->SetItemImage(TBI_ITALIC, GetIcon(A2S(".uno:Italic"))); 639b9e67834SAndre Fischer mpToolBoxFont->SetItemImage(TBI_UNDERLINE, GetIcon(A2S(".uno:Underline"))); 640b9e67834SAndre Fischer mpToolBoxFont->SetItemImage(TBI_STRIKEOUT, GetIcon(A2S(".uno:Strikeout"))); 641b9e67834SAndre Fischer mpToolBoxFont->SetItemImage(TBI_SHADOWED, GetIcon(A2S(".uno:Shadowed"))); 642b9e67834SAndre Fischer 643b9e67834SAndre Fischer mpToolBoxFontColor->SetItemImage(TBI_FONTCOLOR, GetIcon(A2S(".uno:FontColor"))); 644b9e67834SAndre Fischer //for sw 645b9e67834SAndre Fischer mpToolBoxScriptSw->SetItemImage(TBI_SUPER_SW, GetIcon(A2S(".uno:SuperScript"))); 646b9e67834SAndre Fischer mpToolBoxScriptSw->SetItemImage(TBI_SUB_SW, GetIcon(A2S(".uno:SubScript"))); 647b9e67834SAndre Fischer //for sc and sd 648b9e67834SAndre Fischer mpToolBoxScript->SetItemImage(TBI_SUPER, GetIcon(A2S(".uno:SuperScript"))); 649b9e67834SAndre Fischer mpToolBoxScript->SetItemImage(TBI_SUB, GetIcon(A2S(".uno:SubScript"))); 650b9e67834SAndre Fischer mpToolBoxSpacing->SetItemImage(TBI_SPACING, GetIcon(A2S(".uno:FontworkCharacterSpacingFloater"))); 651b9e67834SAndre Fischer mpToolBoxHighlight->SetItemImage(TBI_HIGHLIGHT, GetIcon(A2S(".uno:BackColor"))); 652b9e67834SAndre Fischer } 653b9e67834SAndre Fischer } 654b9e67834SAndre Fischer 655b9e67834SAndre Fischer 656b9e67834SAndre Fischer 657b9e67834SAndre Fischer 658b9e67834SAndre Fischer IMPL_LINK( TextPropertyPanel, FontSelHdl, FontNameBox*, pBox ) 659b9e67834SAndre Fischer { 660b9e67834SAndre Fischer if ( !pBox->IsTravelSelect() ) 661b9e67834SAndre Fischer { 662b9e67834SAndre Fischer if( SfxViewShell::Current() ) 663b9e67834SAndre Fischer { 664b9e67834SAndre Fischer Window* pShellWnd = SfxViewShell::Current()->GetWindow(); 665b9e67834SAndre Fischer 666b9e67834SAndre Fischer if ( pShellWnd ) 667b9e67834SAndre Fischer pShellWnd->GrabFocus(); 668b9e67834SAndre Fischer } 669b9e67834SAndre Fischer } 670b9e67834SAndre Fischer return 0; 671b9e67834SAndre Fischer } 672b9e67834SAndre Fischer //add end 673b9e67834SAndre Fischer IMPL_LINK( TextPropertyPanel, FontSizeModifyHdl, FontSizeBox*, pSizeBox ) 674b9e67834SAndre Fischer { 675b9e67834SAndre Fischer if (pSizeBox == &maFontSizeBox) 676b9e67834SAndre Fischer { 677b9e67834SAndre Fischer long nSize = pSizeBox->GetValue(); 678b9e67834SAndre Fischer mbFocusOnFontSizeCtrl = true; 679b9e67834SAndre Fischer 680b9e67834SAndre Fischer float fSize = (float)nSize / 10; 681b9e67834SAndre Fischer SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric(); 682b9e67834SAndre Fischer SvxFontHeightItem aItem( CalcToUnit( fSize, eUnit ), 100, SID_ATTR_CHAR_FONTHEIGHT ) ; 683b9e67834SAndre Fischer 684b9e67834SAndre Fischer mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONTHEIGHT, SFX_CALLMODE_RECORD, &aItem, 0L ); 685b9e67834SAndre Fischer mpBindings->Invalidate(SID_ATTR_CHAR_FONTHEIGHT,true,false); 686b9e67834SAndre Fischer } 687b9e67834SAndre Fischer return 0; 688b9e67834SAndre Fischer } 689b9e67834SAndre Fischer //add 690b9e67834SAndre Fischer IMPL_LINK( TextPropertyPanel, FontSizeSelHdl, FontSizeBox*, pSizeBox ) 691b9e67834SAndre Fischer { 692b9e67834SAndre Fischer if ( !pSizeBox->IsTravelSelect() ) 693b9e67834SAndre Fischer { 694b9e67834SAndre Fischer if( SfxViewShell::Current() ) 695b9e67834SAndre Fischer { 696b9e67834SAndre Fischer Window* pShellWnd = SfxViewShell::Current()->GetWindow(); 697b9e67834SAndre Fischer 698b9e67834SAndre Fischer if ( pShellWnd ) 699b9e67834SAndre Fischer pShellWnd->GrabFocus(); 700b9e67834SAndre Fischer } 701b9e67834SAndre Fischer } 702b9e67834SAndre Fischer 703b9e67834SAndre Fischer return 0; 704b9e67834SAndre Fischer } 705b9e67834SAndre Fischer //add end 706b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, FontSizeLoseFocus, FontSizeBox*, pSizeBox) 707b9e67834SAndre Fischer { 708b9e67834SAndre Fischer if(pSizeBox == &maFontSizeBox) 709b9e67834SAndre Fischer { 710b9e67834SAndre Fischer mbFocusOnFontSizeCtrl = false; 711b9e67834SAndre Fischer } 712b9e67834SAndre Fischer return 0; 713b9e67834SAndre Fischer } 714b9e67834SAndre Fischer 715b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolboxFontSelectHandler, ToolBox*, pToolBox) 716b9e67834SAndre Fischer { 717b9e67834SAndre Fischer const sal_uInt16 nId = pToolBox->GetCurItemId(); 718b9e67834SAndre Fischer 719b9e67834SAndre Fischer //Bold 720b9e67834SAndre Fischer if(nId == TBI_BOLD) 721b9e67834SAndre Fischer { 722b9e67834SAndre Fischer EndTracking(); 723b9e67834SAndre Fischer if(meWeight != WEIGHT_BOLD) 724b9e67834SAndre Fischer meWeight = WEIGHT_BOLD; 725b9e67834SAndre Fischer else 726b9e67834SAndre Fischer meWeight = WEIGHT_NORMAL; 727b9e67834SAndre Fischer SvxWeightItem aWeightItem(meWeight, SID_ATTR_CHAR_WEIGHT); 728b9e67834SAndre Fischer mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_WEIGHT, SFX_CALLMODE_RECORD, &aWeightItem, 0L); 729b9e67834SAndre Fischer UpdateFontBold(); 730b9e67834SAndre Fischer } 731b9e67834SAndre Fischer //Italic 732b9e67834SAndre Fischer else if(nId == TBI_ITALIC) 733b9e67834SAndre Fischer { 734b9e67834SAndre Fischer EndTracking(); 735b9e67834SAndre Fischer if(meItalic != ITALIC_NORMAL) 736b9e67834SAndre Fischer meItalic = ITALIC_NORMAL; 737b9e67834SAndre Fischer else 738b9e67834SAndre Fischer meItalic = ITALIC_NONE; 739b9e67834SAndre Fischer SvxPostureItem aPostureItem(meItalic, SID_ATTR_CHAR_POSTURE); 740b9e67834SAndre Fischer mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_POSTURE, SFX_CALLMODE_RECORD, &aPostureItem, 0L); 741b9e67834SAndre Fischer UpdateFontItalic(); 742b9e67834SAndre Fischer } 743b9e67834SAndre Fischer //underline 744b9e67834SAndre Fischer else if(nId == TBI_UNDERLINE) 745b9e67834SAndre Fischer { 746b9e67834SAndre Fischer EndTracking(); 747b9e67834SAndre Fischer //add , keep underline's color 748b9e67834SAndre Fischer if(meUnderline == UNDERLINE_NONE) 749b9e67834SAndre Fischer { 75095a18594SAndre Fischer //AF: meUnderline = GetDefaultUnderline(); 75195a18594SAndre Fischer meUnderline = UNDERLINE_SINGLE; 752b9e67834SAndre Fischer //<<modify 753b9e67834SAndre Fischer //SvxTextLineItem aLineItem(meUnderline, SID_ATTR_CHAR_UNDERLINE); 754b9e67834SAndre Fischer SvxUnderlineItem aLineItem(meUnderline, SID_ATTR_CHAR_UNDERLINE); 755b9e67834SAndre Fischer //modify end>> 756b9e67834SAndre Fischer aLineItem.SetColor(meUnderlineColor); 757b9e67834SAndre Fischer mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_UNDERLINE, SFX_CALLMODE_RECORD, &aLineItem, 0L); 758b9e67834SAndre Fischer } 759b9e67834SAndre Fischer else 760b9e67834SAndre Fischer { 761b9e67834SAndre Fischer meUnderline = UNDERLINE_NONE; 762b9e67834SAndre Fischer //<<modify 763b9e67834SAndre Fischer //SvxTextLineItem aLineItem(meUnderline, SID_ATTR_CHAR_UNDERLINE); 764b9e67834SAndre Fischer SvxUnderlineItem aLineItem(meUnderline, SID_ATTR_CHAR_UNDERLINE); 765b9e67834SAndre Fischer //modify end>> 766b9e67834SAndre Fischer mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_UNDERLINE, SFX_CALLMODE_RECORD, &aLineItem, 0L); 767b9e67834SAndre Fischer } 768b9e67834SAndre Fischer UpdateFontUnderline(); 769b9e67834SAndre Fischer //add end 770b9e67834SAndre Fischer } 771b9e67834SAndre Fischer //strike out 772b9e67834SAndre Fischer else if(nId == TBI_STRIKEOUT) 773b9e67834SAndre Fischer { 774b9e67834SAndre Fischer EndTracking(); 775b9e67834SAndre Fischer if(meStrike != STRIKEOUT_NONE && meStrike != STRIKEOUT_DONTKNOW) 776b9e67834SAndre Fischer meStrike = STRIKEOUT_NONE; 777b9e67834SAndre Fischer else 778b9e67834SAndre Fischer meStrike = STRIKEOUT_SINGLE; 779b9e67834SAndre Fischer SvxCrossedOutItem aStrikeItem(meStrike,SID_ATTR_CHAR_STRIKEOUT); 780b9e67834SAndre Fischer mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_STRIKEOUT, SFX_CALLMODE_RECORD, &aStrikeItem, 0L); 781b9e67834SAndre Fischer UpdateFontStrikeOut(); 782b9e67834SAndre Fischer } 783b9e67834SAndre Fischer //shadowed 784b9e67834SAndre Fischer else if(nId == TBI_SHADOWED) 785b9e67834SAndre Fischer { 786b9e67834SAndre Fischer EndTracking(); 787b9e67834SAndre Fischer mbShadow = !mbShadow; 788b9e67834SAndre Fischer SvxShadowedItem aShadowItem(mbShadow, SID_ATTR_CHAR_SHADOWED); 789b9e67834SAndre Fischer mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_SHADOWED, SFX_CALLMODE_RECORD, &aShadowItem, 0L); 790b9e67834SAndre Fischer UpdateFontShadowed(); 791b9e67834SAndre Fischer } 792b9e67834SAndre Fischer return 0; 793b9e67834SAndre Fischer } 794b9e67834SAndre Fischer 795b9e67834SAndre Fischer 796b9e67834SAndre Fischer 797b9e67834SAndre Fischer 798b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolboxIncDecSelectHdl, ToolBox*, pToolBox) 799b9e67834SAndre Fischer { 800b9e67834SAndre Fischer const sal_uInt16 nId = pToolBox->GetCurItemId(); 801b9e67834SAndre Fischer 802b9e67834SAndre Fischer // font size +/- enhancement in sd 803b9e67834SAndre Fischer switch (maContext.GetCombinedContext()) 804b9e67834SAndre Fischer { 805b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_DrawText): 806b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_Text): 807b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_Table): 808b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_OutlineText): 809b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_Draw): 810b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_TextObject): 811b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_Graphic): 812b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_DrawText): 813b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_Text): 814b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_Table): 815b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_OutlineText): 816b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_Draw): 817b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_TextObject): 818b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_Graphic): 819b9e67834SAndre Fischer if(nId == TBI_INCREASE) 820b9e67834SAndre Fischer { 821b9e67834SAndre Fischer EndTracking(); 822b9e67834SAndre Fischer SfxVoidItem aItem(SID_GROW_FONT_SIZE); 823b9e67834SAndre Fischer mpBindings->GetDispatcher()->Execute( SID_GROW_FONT_SIZE, SFX_CALLMODE_RECORD, &aItem, 0L ); 824b9e67834SAndre Fischer } 825b9e67834SAndre Fischer else if(nId == TBI_DECREASE) 826b9e67834SAndre Fischer { 827b9e67834SAndre Fischer EndTracking(); 828b9e67834SAndre Fischer SfxVoidItem aItem(SID_SHRINK_FONT_SIZE); 829b9e67834SAndre Fischer mpBindings->GetDispatcher()->Execute( SID_SHRINK_FONT_SIZE, SFX_CALLMODE_RECORD, &aItem, 0L ); 830b9e67834SAndre Fischer } 831b9e67834SAndre Fischer break; 832b9e67834SAndre Fischer 833b9e67834SAndre Fischer default: 834b9e67834SAndre Fischer if(nId == TBI_INCREASE) 835b9e67834SAndre Fischer { 836b9e67834SAndre Fischer EndTracking(); 837b9e67834SAndre Fischer mbFocusOnFontSizeCtrl = false; 838b9e67834SAndre Fischer sal_Int64 iValue = maFontSizeBox.GetValue(); 839b9e67834SAndre Fischer int iPos = maFontSizeBox.GetValuePos(iValue, FUNIT_NONE); 840b9e67834SAndre Fischer long nSize = iValue; 841b9e67834SAndre Fischer if(iPos != LISTBOX_ENTRY_NOTFOUND) 842b9e67834SAndre Fischer nSize = maFontSizeBox.GetValue(iPos+1 , FUNIT_NONE); 843b9e67834SAndre Fischer else if(iValue >= 100 && iValue < 105) 844b9e67834SAndre Fischer nSize = 105; 845b9e67834SAndre Fischer else if(iValue >= 105 && iValue < 110) 846b9e67834SAndre Fischer nSize = 110; 847b9e67834SAndre Fischer else if(iValue < 960) 848b9e67834SAndre Fischer { 849b9e67834SAndre Fischer nSize = (nSize / 10) * 10 + 10; 850b9e67834SAndre Fischer while(maFontSizeBox.GetValuePos(nSize, FUNIT_NONE) == LISTBOX_ENTRY_NOTFOUND) 851b9e67834SAndre Fischer nSize += 10; 852b9e67834SAndre Fischer } 853b9e67834SAndre Fischer else 854b9e67834SAndre Fischer { 855b9e67834SAndre Fischer nSize = iValue; 856b9e67834SAndre Fischer } 857b9e67834SAndre Fischer 858b9e67834SAndre Fischer float fSize = (float)nSize / 10; 859b9e67834SAndre Fischer 860b9e67834SAndre Fischer SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric(); 861b9e67834SAndre Fischer SvxFontHeightItem aItem( CalcToUnit( fSize, eUnit ), 100, SID_ATTR_CHAR_FONTHEIGHT ) ; 862b9e67834SAndre Fischer 863b9e67834SAndre Fischer mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONTHEIGHT, SFX_CALLMODE_RECORD, &aItem, 0L ); 864b9e67834SAndre Fischer mpBindings->Invalidate(SID_ATTR_CHAR_FONTHEIGHT,true,false); 865b9e67834SAndre Fischer //add , update ASAP 866b9e67834SAndre Fischer maFontSizeBox.SetValue( nSize ); 867b9e67834SAndre Fischer if(nSize >= 960) 868b9e67834SAndre Fischer { 869b9e67834SAndre Fischer mpToolBoxIncDec->EnableItem(TBI_INCREASE,false); 870b9e67834SAndre Fischer mpToolBoxIncDec->EnableItem(TBI_DECREASE,true); 871b9e67834SAndre Fischer } 872b9e67834SAndre Fischer else if(nSize <= 60) 873b9e67834SAndre Fischer { 874b9e67834SAndre Fischer mpToolBoxIncDec->EnableItem(TBI_INCREASE,true); 875b9e67834SAndre Fischer mpToolBoxIncDec->EnableItem(TBI_DECREASE,false); 876b9e67834SAndre Fischer } 877b9e67834SAndre Fischer else 878b9e67834SAndre Fischer { 879b9e67834SAndre Fischer mpToolBoxIncDec->EnableItem(TBI_INCREASE,true); 880b9e67834SAndre Fischer mpToolBoxIncDec->EnableItem(TBI_DECREASE,true); 881b9e67834SAndre Fischer } 882b9e67834SAndre Fischer //add end 883b9e67834SAndre Fischer } 884b9e67834SAndre Fischer else if(nId == TBI_DECREASE) 885b9e67834SAndre Fischer { 886b9e67834SAndre Fischer EndTracking(); 887b9e67834SAndre Fischer mbFocusOnFontSizeCtrl = false; 888b9e67834SAndre Fischer sal_Int64 iValue = maFontSizeBox.GetValue(); 889b9e67834SAndre Fischer int iPos = maFontSizeBox.GetValuePos(iValue, FUNIT_NONE); 890b9e67834SAndre Fischer long nSize = iValue; 891b9e67834SAndre Fischer if(iPos != LISTBOX_ENTRY_NOTFOUND) 892b9e67834SAndre Fischer nSize = maFontSizeBox.GetValue(iPos-1 , FUNIT_NONE); 893b9e67834SAndre Fischer else if(iValue > 100 && iValue <= 105) 894b9e67834SAndre Fischer nSize = 100; 895b9e67834SAndre Fischer else if(iValue > 105 && iValue <= 110) 896b9e67834SAndre Fischer nSize = 105; 897b9e67834SAndre Fischer else if(iValue > 960) 898b9e67834SAndre Fischer { 899b9e67834SAndre Fischer nSize = 960; 900b9e67834SAndre Fischer } 901b9e67834SAndre Fischer else if(iValue > 60) 902b9e67834SAndre Fischer { 903b9e67834SAndre Fischer nSize = (nSize / 10) * 10 ; 904b9e67834SAndre Fischer while(maFontSizeBox.GetValuePos(nSize, FUNIT_NONE) == LISTBOX_ENTRY_NOTFOUND) 905b9e67834SAndre Fischer nSize -= 10; 906b9e67834SAndre Fischer } 907b9e67834SAndre Fischer else 908b9e67834SAndre Fischer { 909b9e67834SAndre Fischer nSize = iValue; 910b9e67834SAndre Fischer } 911b9e67834SAndre Fischer 912b9e67834SAndre Fischer float fSize = (float)nSize / 10; 913b9e67834SAndre Fischer 914b9e67834SAndre Fischer SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric(); 915b9e67834SAndre Fischer SvxFontHeightItem aItem( CalcToUnit( fSize, eUnit ), 100, SID_ATTR_CHAR_FONTHEIGHT ) ; 916b9e67834SAndre Fischer 917b9e67834SAndre Fischer mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONTHEIGHT, SFX_CALLMODE_RECORD, &aItem, 0L ); 918b9e67834SAndre Fischer mpBindings->Invalidate(SID_ATTR_CHAR_FONTHEIGHT,true,false); 919b9e67834SAndre Fischer //add 920b9e67834SAndre Fischer maFontSizeBox.SetValue( nSize ); 921b9e67834SAndre Fischer if(nSize >= 960) 922b9e67834SAndre Fischer { 923b9e67834SAndre Fischer mpToolBoxIncDec->EnableItem(TBI_INCREASE,false); 924b9e67834SAndre Fischer mpToolBoxIncDec->EnableItem(TBI_DECREASE,true); 925b9e67834SAndre Fischer } 926b9e67834SAndre Fischer else if(nSize <= 60) 927b9e67834SAndre Fischer { 928b9e67834SAndre Fischer mpToolBoxIncDec->EnableItem(TBI_INCREASE,true); 929b9e67834SAndre Fischer mpToolBoxIncDec->EnableItem(TBI_DECREASE,false); 930b9e67834SAndre Fischer } 931b9e67834SAndre Fischer else 932b9e67834SAndre Fischer { 933b9e67834SAndre Fischer mpToolBoxIncDec->EnableItem(TBI_INCREASE,true); 934b9e67834SAndre Fischer mpToolBoxIncDec->EnableItem(TBI_DECREASE,true); 935b9e67834SAndre Fischer } 936b9e67834SAndre Fischer //add end 937b9e67834SAndre Fischer } 938b9e67834SAndre Fischer } 939b9e67834SAndre Fischer return 0; 940b9e67834SAndre Fischer } 941b9e67834SAndre Fischer 942b9e67834SAndre Fischer 943b9e67834SAndre Fischer 944b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolBoxUnderlineClickHdl, ToolBox*, pToolBox) 945b9e67834SAndre Fischer { 946b9e67834SAndre Fischer const sal_uInt16 nId = pToolBox->GetCurItemId(); 947d4aefcaeSZheng Fan OSL_ASSERT(nId == TBI_UNDERLINE); 948b9e67834SAndre Fischer if(nId == TBI_UNDERLINE) 949b9e67834SAndre Fischer { 950b9e67834SAndre Fischer pToolBox->SetItemDown( nId, true ); 951d4aefcaeSZheng Fan maUnderlinePopup.Rearrange(meUnderline); 952d4aefcaeSZheng Fan maUnderlinePopup.Show(*pToolBox); 953b9e67834SAndre Fischer 954b9e67834SAndre Fischer } 955d4aefcaeSZheng Fan return 0L; 956b9e67834SAndre Fischer } 957b9e67834SAndre Fischer 958b9e67834SAndre Fischer 959b9e67834SAndre Fischer 960b9e67834SAndre Fischer 961b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolBoxFontColorDropHdl,ToolBox*, pToolBox) 962b9e67834SAndre Fischer { 963b9e67834SAndre Fischer const sal_uInt16 nId = pToolBox->GetCurItemId(); 964b9e67834SAndre Fischer if(nId == TBI_FONTCOLOR) 965b9e67834SAndre Fischer { 966b9e67834SAndre Fischer meColorType = FONT_COLOR; 967b9e67834SAndre Fischer 968b9e67834SAndre Fischer pToolBox->SetItemDown( nId, true ); 969b9e67834SAndre Fischer 970d4aefcaeSZheng Fan maFontColorPopup.Show(*pToolBox); 971d4aefcaeSZheng Fan maFontColorPopup.SetCurrentColor(maColor, mbColorAvailable); 972b9e67834SAndre Fischer } 973b9e67834SAndre Fischer return 0; 974b9e67834SAndre Fischer } 975b9e67834SAndre Fischer 976b9e67834SAndre Fischer 977b9e67834SAndre Fischer 978b9e67834SAndre Fischer 979b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolBoxSwScriptSelectHdl, ToolBox*, pToolBox) 980b9e67834SAndre Fischer { 981b9e67834SAndre Fischer const sal_uInt16 nId = pToolBox->GetCurItemId(); 982b9e67834SAndre Fischer if( nId == TBI_SUPER_SW ) 983b9e67834SAndre Fischer { 984b9e67834SAndre Fischer if(meEscape != SVX_ESCAPEMENT_SUPERSCRIPT) 985b9e67834SAndre Fischer { 986b9e67834SAndre Fischer meEscape = SVX_ESCAPEMENT_SUPERSCRIPT; 987b9e67834SAndre Fischer SvxEscapementItem aSupItem(DFLT_ESC_SUPER, DFLT_ESC_PROP, SID_ATTR_CHAR_ESCAPEMENT); 988b9e67834SAndre Fischer mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aSupItem, 0L ); 989b9e67834SAndre Fischer } 990b9e67834SAndre Fischer else 991b9e67834SAndre Fischer { 992b9e67834SAndre Fischer meEscape = SVX_ESCAPEMENT_OFF; 993b9e67834SAndre Fischer SvxEscapementItem aNoneItem(0, 100, SID_ATTR_CHAR_ESCAPEMENT); 994b9e67834SAndre Fischer mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aNoneItem, 0L ); 995b9e67834SAndre Fischer } 996b9e67834SAndre Fischer } 997b9e67834SAndre Fischer else if(TBI_SUB_SW == nId) 998b9e67834SAndre Fischer { 999b9e67834SAndre Fischer if(meEscape != SVX_ESCAPEMENT_SUBSCRIPT) 1000b9e67834SAndre Fischer { 1001b9e67834SAndre Fischer meEscape = (SvxEscapement)SVX_ESCAPEMENT_SUBSCRIPT; 1002b9e67834SAndre Fischer SvxEscapementItem aSubItem(DFLT_ESC_SUB, DFLT_ESC_PROP, SID_ATTR_CHAR_ESCAPEMENT); 1003b9e67834SAndre Fischer mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aSubItem, 0L ); 1004b9e67834SAndre Fischer } 1005b9e67834SAndre Fischer else 1006b9e67834SAndre Fischer { 1007b9e67834SAndre Fischer meEscape = SVX_ESCAPEMENT_OFF; 1008b9e67834SAndre Fischer SvxEscapementItem aNoneItem(0, 100, SID_ATTR_CHAR_ESCAPEMENT); 1009b9e67834SAndre Fischer mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aNoneItem, 0L ); 1010b9e67834SAndre Fischer } 1011b9e67834SAndre Fischer } 1012b9e67834SAndre Fischer UpdateFontScript(); 1013b9e67834SAndre Fischer 1014b9e67834SAndre Fischer return 0; 1015b9e67834SAndre Fischer } 1016b9e67834SAndre Fischer 1017b9e67834SAndre Fischer 1018b9e67834SAndre Fischer 1019b9e67834SAndre Fischer 1020b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolBoxScriptSelectHdl, ToolBox*, pToolBox) 1021b9e67834SAndre Fischer { 1022b9e67834SAndre Fischer const sal_uInt16 nId = pToolBox->GetCurItemId(); 1023b9e67834SAndre Fischer if( nId == TBI_SUPER ) 1024b9e67834SAndre Fischer { 1025b9e67834SAndre Fischer mbSuper = !mbSuper; 1026b9e67834SAndre Fischer SfxBoolItem aSupItem(SID_SET_SUPER_SCRIPT, mbSuper); 1027b9e67834SAndre Fischer mpBindings->GetDispatcher()->Execute( SID_SET_SUPER_SCRIPT, SFX_CALLMODE_RECORD, &aSupItem, 0L ); 1028b9e67834SAndre Fischer } 1029b9e67834SAndre Fischer else if(TBI_SUB == nId) 1030b9e67834SAndre Fischer { 1031b9e67834SAndre Fischer 1032b9e67834SAndre Fischer mbSub = !mbSub; 1033b9e67834SAndre Fischer SfxBoolItem aSubItem(SID_SET_SUB_SCRIPT, mbSub ); 1034b9e67834SAndre Fischer mpBindings->GetDispatcher()->Execute( SID_SET_SUB_SCRIPT, SFX_CALLMODE_RECORD, &aSubItem, 0L ); 1035b9e67834SAndre Fischer } 1036b9e67834SAndre Fischer UpdateFontScript(); 1037b9e67834SAndre Fischer return 0; 1038b9e67834SAndre Fischer } 1039b9e67834SAndre Fischer 1040b9e67834SAndre Fischer 1041b9e67834SAndre Fischer 1042b9e67834SAndre Fischer 1043b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolBoxHighlightDropHdl, ToolBox*, pToolBox) 1044b9e67834SAndre Fischer { 1045b9e67834SAndre Fischer const sal_uInt16 nId = pToolBox->GetCurItemId(); 1046b9e67834SAndre Fischer if(nId == TBI_HIGHLIGHT) 1047b9e67834SAndre Fischer { 1048b9e67834SAndre Fischer meColorType = BACK_COLOR; 1049b9e67834SAndre Fischer 1050b9e67834SAndre Fischer pToolBox->SetItemDown( nId, true ); 1051d4aefcaeSZheng Fan maBrushColorPopup.Show(*pToolBox); 1052d4aefcaeSZheng Fan maBrushColorPopup.SetCurrentColor(maBackColor, mbBackColorAvailable); 1053b9e67834SAndre Fischer 1054b9e67834SAndre Fischer } 1055b9e67834SAndre Fischer return 0; 1056b9e67834SAndre Fischer } 1057b9e67834SAndre Fischer 1058b9e67834SAndre Fischer 1059b9e67834SAndre Fischer 1060b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, SpacingClickHdl, ToolBox*, pToolBox) 1061b9e67834SAndre Fischer { 1062b9e67834SAndre Fischer const sal_uInt16 nId = pToolBox->GetCurItemId(); 1063d4aefcaeSZheng Fan OSL_ASSERT(nId == TBI_SPACING); 1064b9e67834SAndre Fischer if(nId == TBI_SPACING) 1065b9e67834SAndre Fischer { 1066b9e67834SAndre Fischer pToolBox->SetItemDown( nId, true ); 1067d4aefcaeSZheng Fan maCharSpacePopup.Rearrange(mbKernLBAvailable,mbKernAvailable,mlKerning); 1068d4aefcaeSZheng Fan maCharSpacePopup.Show(*pToolBox); 1069b9e67834SAndre Fischer 1070b9e67834SAndre Fischer } 1071d4aefcaeSZheng Fan return 0L; 1072b9e67834SAndre Fischer } 1073b9e67834SAndre Fischer 1074b9e67834SAndre Fischer 1075b9e67834SAndre Fischer 1076b9e67834SAndre Fischer 1077b9e67834SAndre Fischer IMPL_LINK( TextPropertyPanel, ImplPopupModeEndHdl, FloatingWindow*, EMPTYARG ) 1078b9e67834SAndre Fischer { 1079b9e67834SAndre Fischer return 0; 1080b9e67834SAndre Fischer } 1081b9e67834SAndre Fischer 1082b9e67834SAndre Fischer 1083b9e67834SAndre Fischer 1084b9e67834SAndre Fischer 1085b9e67834SAndre Fischer 1086b9e67834SAndre Fischer 1087b9e67834SAndre Fischer 1088b9e67834SAndre Fischer 1089b9e67834SAndre Fischer void TextPropertyPanel::NotifyItemUpdate ( 1090b9e67834SAndre Fischer const sal_uInt16 nSID, 1091b9e67834SAndre Fischer const SfxItemState eState, 1092b9e67834SAndre Fischer const SfxPoolItem* pState) 1093b9e67834SAndre Fischer { 1094b9e67834SAndre Fischer switch(nSID) 1095b9e67834SAndre Fischer { 1096b9e67834SAndre Fischer case SID_ATTR_CHAR_FONT: 1097b9e67834SAndre Fischer if ( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxFontItem) ) 1098b9e67834SAndre Fischer { 1099b9e67834SAndre Fischer mpFontNameBox->Enable(); 1100b9e67834SAndre Fischer const SvxFontItem* pFontItem = (const SvxFontItem*)pState; 1101b9e67834SAndre Fischer mpFontNameBox->SetText( pFontItem->GetFamilyName() ); 1102b9e67834SAndre Fischer } 1103b9e67834SAndre Fischer else 1104b9e67834SAndre Fischer { 1105b9e67834SAndre Fischer mpFontNameBox->SetText( String() ); 1106b9e67834SAndre Fischer if (SFX_ITEM_DISABLED == eState) 1107b9e67834SAndre Fischer { 1108b9e67834SAndre Fischer mpFontNameBox->Disable(); 1109b9e67834SAndre Fischer } 1110b9e67834SAndre Fischer } 1111b9e67834SAndre Fischer break; 1112b9e67834SAndre Fischer case SID_ATTR_CHAR_FONTHEIGHT: 1113b9e67834SAndre Fischer if ( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxFontHeightItem) ) 1114b9e67834SAndre Fischer { 1115b9e67834SAndre Fischer mpHeightItem = (SvxFontHeightItem*)pState;//const SvxFontHeightItem* 1116b9e67834SAndre Fischer SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric(); 1117b9e67834SAndre Fischer long iValue = (long)CalcToPoint( mpHeightItem->GetHeight(), eUnit, 10 ); 1118b9e67834SAndre Fischer mpToolBoxIncDec->Enable(); 1119b9e67834SAndre Fischer 1120b9e67834SAndre Fischer // font size +/- enhancement in sd 1121b9e67834SAndre Fischer switch(maContext.GetCombinedContext()) 1122b9e67834SAndre Fischer { 1123b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_DrawText): 1124b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_Text): 1125b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_Table): 1126b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_OutlineText): 1127b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_Draw): 1128b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_TextObject): 1129b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_Graphic): 1130b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_DrawText): 1131b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_Text): 1132b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_Table): 1133b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_OutlineText): 1134b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_Draw): 1135b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_TextObject): 1136b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_Graphic): 1137b9e67834SAndre Fischer break; 1138b9e67834SAndre Fischer 1139b9e67834SAndre Fischer default: 1140b9e67834SAndre Fischer if(iValue > 60 && iValue < 960 ) 1141b9e67834SAndre Fischer { 1142b9e67834SAndre Fischer mpToolBoxIncDec->EnableItem(TBI_INCREASE,true); 1143b9e67834SAndre Fischer mpToolBoxIncDec->EnableItem(TBI_DECREASE,true); 1144b9e67834SAndre Fischer } 1145b9e67834SAndre Fischer else if (iValue <= 60) 1146b9e67834SAndre Fischer { 1147b9e67834SAndre Fischer mpToolBoxIncDec->EnableItem(TBI_INCREASE,true); 1148b9e67834SAndre Fischer mpToolBoxIncDec->EnableItem(TBI_DECREASE,false); 1149b9e67834SAndre Fischer } 1150b9e67834SAndre Fischer else if (iValue >= 960) 1151b9e67834SAndre Fischer { 1152b9e67834SAndre Fischer mpToolBoxIncDec->EnableItem(TBI_INCREASE,false); 1153b9e67834SAndre Fischer mpToolBoxIncDec->EnableItem(TBI_DECREASE,true); 1154b9e67834SAndre Fischer } 1155b9e67834SAndre Fischer } 1156b9e67834SAndre Fischer mpToolBoxIncDec->SetItemState(TBI_INCREASE, STATE_NOCHECK); 1157b9e67834SAndre Fischer mpToolBoxIncDec->SetItemState(TBI_DECREASE, STATE_NOCHECK); 1158b9e67834SAndre Fischer 1159b9e67834SAndre Fischer if( mbFocusOnFontSizeCtrl ) 1160b9e67834SAndre Fischer return; 1161b9e67834SAndre Fischer 1162b9e67834SAndre Fischer maFontSizeBox.Enable( ); 1163b9e67834SAndre Fischer maFontSizeBox.SetValue( iValue ); 1164b9e67834SAndre Fischer maFontSizeBox.LoseFocus(); 1165b9e67834SAndre Fischer } 1166b9e67834SAndre Fischer else 1167b9e67834SAndre Fischer { 1168b9e67834SAndre Fischer mpHeightItem = NULL; 1169b9e67834SAndre Fischer maFontSizeBox.SetText( String() ); 1170b9e67834SAndre Fischer //increase decrease diabled when multi-seletion have different font size 1171b9e67834SAndre Fischer 1172b9e67834SAndre Fischer // font size +/- enhancement in sd 1173b9e67834SAndre Fischer switch(maContext.GetCombinedContext()) 1174b9e67834SAndre Fischer { 1175b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_DrawText): 1176b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_Text): 1177b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_Table): 1178b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_OutlineText): 1179b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_Draw): 1180b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_TextObject): 1181b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_Graphic): 1182b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_DrawText): 1183b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_Text): 1184b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_Table): 1185b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_OutlineText): 1186b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_Draw): 1187b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_TextObject): 1188b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_Graphic): 1189b9e67834SAndre Fischer break; 1190b9e67834SAndre Fischer 1191b9e67834SAndre Fischer default: 1192b9e67834SAndre Fischer mpToolBoxIncDec->Disable(); 1193b9e67834SAndre Fischer } 1194b9e67834SAndre Fischer if ( eState <= SFX_ITEM_READONLY ) 1195b9e67834SAndre Fischer { 1196b9e67834SAndre Fischer maFontSizeBox.Disable( ); 1197b9e67834SAndre Fischer } 1198b9e67834SAndre Fischer } 1199b9e67834SAndre Fischer break; 1200b9e67834SAndre Fischer case SID_ATTR_CHAR_WEIGHT: 1201b9e67834SAndre Fischer mbWeightAvailable = (eState >= SFX_ITEM_DONTCARE); 1202b9e67834SAndre Fischer if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxWeightItem)) 1203b9e67834SAndre Fischer { 1204b9e67834SAndre Fischer const SvxWeightItem* pItem = (const SvxWeightItem*)pState; 1205b9e67834SAndre Fischer meWeight = (FontWeight)pItem->GetValue(); 1206b9e67834SAndre Fischer TextStyleChanged(); 1207b9e67834SAndre Fischer } 1208b9e67834SAndre Fischer else 1209b9e67834SAndre Fischer { 1210b9e67834SAndre Fischer meWeight = WEIGHT_NORMAL; 1211b9e67834SAndre Fischer TextStyleChanged(); 1212b9e67834SAndre Fischer } 1213b9e67834SAndre Fischer break; 1214b9e67834SAndre Fischer case SID_ATTR_CHAR_POSTURE: 1215b9e67834SAndre Fischer mbPostureAvailable = (eState >= SFX_ITEM_DONTCARE); 1216b9e67834SAndre Fischer if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxPostureItem)) 1217b9e67834SAndre Fischer { 1218b9e67834SAndre Fischer const SvxPostureItem* pItem = (const SvxPostureItem*)pState; 1219b9e67834SAndre Fischer meItalic = (FontItalic)pItem->GetValue(); 1220b9e67834SAndre Fischer TextStyleChanged(); 1221b9e67834SAndre Fischer } 1222b9e67834SAndre Fischer else 1223b9e67834SAndre Fischer { 1224b9e67834SAndre Fischer meItalic = ITALIC_NONE; 1225b9e67834SAndre Fischer TextStyleChanged(); 1226b9e67834SAndre Fischer } 1227b9e67834SAndre Fischer break; 1228b9e67834SAndre Fischer case SID_ATTR_CHAR_UNDERLINE: 1229b9e67834SAndre Fischer if( eState >= SFX_ITEM_DEFAULT) //SvxUnderlineItem 1230b9e67834SAndre Fischer { 1231b9e67834SAndre Fischer //<<delete 1232b9e67834SAndre Fischer //if(pState->ISA(SvxTextLineItem)) 1233b9e67834SAndre Fischer //{ 1234b9e67834SAndre Fischer // const SvxTextLineItem* pItem = (const SvxTextLineItem*)pState; 1235b9e67834SAndre Fischer // meUnderline = (FontUnderline)pItem->GetValue(); 1236b9e67834SAndre Fischer // //add , need to record the underline's color, if not the color will turn to auto 1237b9e67834SAndre Fischer // meUnderlineColor = pItem->GetColor(); 1238b9e67834SAndre Fischer // //add end 1239b9e67834SAndre Fischer //} 1240b9e67834SAndre Fischer //else 1241b9e67834SAndre Fischer //delete end>> 1242b9e67834SAndre Fischer if(pState->ISA(SvxUnderlineItem)) 1243b9e67834SAndre Fischer { 1244b9e67834SAndre Fischer const SvxUnderlineItem* pItem = (const SvxUnderlineItem*)pState; 1245b9e67834SAndre Fischer meUnderline = (FontUnderline)pItem->GetValue(); 1246b9e67834SAndre Fischer //add 1247b9e67834SAndre Fischer meUnderlineColor = pItem->GetColor(); 1248b9e67834SAndre Fischer //add end 1249b9e67834SAndre Fischer } 1250b9e67834SAndre Fischer TextStyleChanged(); 1251b9e67834SAndre Fischer } 1252b9e67834SAndre Fischer else 1253b9e67834SAndre Fischer { 1254b9e67834SAndre Fischer meUnderline = UNDERLINE_NONE; 1255b9e67834SAndre Fischer TextStyleChanged(); 1256b9e67834SAndre Fischer } 1257b9e67834SAndre Fischer break; 1258b9e67834SAndre Fischer case SID_ATTR_CHAR_SHADOWED: 1259b9e67834SAndre Fischer if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxShadowedItem)) 1260b9e67834SAndre Fischer { 1261b9e67834SAndre Fischer const SvxShadowedItem* pItem = (const SvxShadowedItem*)pState; 1262b9e67834SAndre Fischer mbShadow = pItem->GetValue(); 1263b9e67834SAndre Fischer TextStyleChanged(); 1264b9e67834SAndre Fischer } 1265b9e67834SAndre Fischer else 1266b9e67834SAndre Fischer { 1267b9e67834SAndre Fischer mbShadow = false; 1268b9e67834SAndre Fischer TextStyleChanged(); 1269b9e67834SAndre Fischer } 1270b9e67834SAndre Fischer break; 1271b9e67834SAndre Fischer case SID_ATTR_CHAR_STRIKEOUT: 1272b9e67834SAndre Fischer if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxCrossedOutItem)) 1273b9e67834SAndre Fischer { 1274b9e67834SAndre Fischer const SvxCrossedOutItem* pItem = (const SvxCrossedOutItem*)pState; 1275b9e67834SAndre Fischer meStrike = (FontStrikeout)pItem->GetValue(); 1276b9e67834SAndre Fischer 1277b9e67834SAndre Fischer TextStyleChanged(); 1278b9e67834SAndre Fischer } 1279b9e67834SAndre Fischer else 1280b9e67834SAndre Fischer { 1281b9e67834SAndre Fischer meStrike = STRIKEOUT_NONE; 1282b9e67834SAndre Fischer TextStyleChanged(); 1283b9e67834SAndre Fischer } 1284b9e67834SAndre Fischer break; 1285b9e67834SAndre Fischer case SID_ATTR_CHAR_COLOR: 1286b9e67834SAndre Fischer if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxColorItem)) 1287b9e67834SAndre Fischer { 1288d4aefcaeSZheng Fan const SvxColorItem* pItem = (const SvxColorItem*)pState; 1289d4aefcaeSZheng Fan maColor = pItem->GetValue(); 1290b9e67834SAndre Fischer mbColorAvailable = true; 129195a18594SAndre Fischer if (mpFontColorUpdater) 129295a18594SAndre Fischer mpFontColorUpdater->Update(maColor); 1293b9e67834SAndre Fischer } 1294b9e67834SAndre Fischer else 1295b9e67834SAndre Fischer { 1296b9e67834SAndre Fischer mbColorAvailable = false; 1297b9e67834SAndre Fischer maColor.SetColor(COL_AUTO); 129895a18594SAndre Fischer if (mpFontColorUpdater) 129995a18594SAndre Fischer mpFontColorUpdater->Update(maColor); 1300b9e67834SAndre Fischer } 1301b9e67834SAndre Fischer break; 1302b9e67834SAndre Fischer case SID_ATTR_BRUSH_CHAR: 1303b9e67834SAndre Fischer if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxBrushItem)) 1304b9e67834SAndre Fischer { 1305b9e67834SAndre Fischer const SvxBrushItem* pItem = (const SvxBrushItem*)pState; 1306b9e67834SAndre Fischer maBackColor = pItem->GetColor(); 1307b9e67834SAndre Fischer mbBackColorAvailable = true; 13087a32b0c8SAndre Fischer if (mpHighlightUpdater) 13097a32b0c8SAndre Fischer mpHighlightUpdater->Update(maBackColor); 1310b9e67834SAndre Fischer } 1311b9e67834SAndre Fischer else 1312b9e67834SAndre Fischer { 1313b9e67834SAndre Fischer mbBackColorAvailable = false; 1314b9e67834SAndre Fischer maBackColor.SetColor(COL_AUTO); 13157a32b0c8SAndre Fischer if (mpHighlightUpdater) 13167a32b0c8SAndre Fischer mpHighlightUpdater->Update(maBackColor); 1317b9e67834SAndre Fischer } 1318b9e67834SAndre Fischer break; 1319b9e67834SAndre Fischer case SID_ATTR_CHAR_ESCAPEMENT: 1320b9e67834SAndre Fischer if( eState == SFX_ITEM_AVAILABLE) 1321b9e67834SAndre Fischer { 1322b9e67834SAndre Fischer if( pState->ISA(SvxEscapementItem)) 1323b9e67834SAndre Fischer { 1324b9e67834SAndre Fischer const SvxEscapementItem* pItem = (const SvxEscapementItem *)pState; 1325b9e67834SAndre Fischer short nEsc = pItem->GetEsc(); 1326b9e67834SAndre Fischer if(nEsc == 0) 1327b9e67834SAndre Fischer meEscape = SVX_ESCAPEMENT_OFF; 1328b9e67834SAndre Fischer else if(nEsc > 0) 1329b9e67834SAndre Fischer meEscape = SVX_ESCAPEMENT_SUPERSCRIPT; 1330b9e67834SAndre Fischer else 1331b9e67834SAndre Fischer meEscape = SVX_ESCAPEMENT_SUBSCRIPT; 1332b9e67834SAndre Fischer } 1333b9e67834SAndre Fischer else 1334b9e67834SAndre Fischer { 1335b9e67834SAndre Fischer meEscape = SVX_ESCAPEMENT_OFF; 1336b9e67834SAndre Fischer } 1337b9e67834SAndre Fischer TextStyleChanged(); 1338b9e67834SAndre Fischer } 1339b9e67834SAndre Fischer else if(eState == SFX_ITEM_DISABLED) 1340b9e67834SAndre Fischer { 1341b9e67834SAndre Fischer mpToolBoxScriptSw->EnableItem(TBI_SUPER,false); 1342b9e67834SAndre Fischer mpToolBoxScriptSw->EnableItem(TBI_SUB,false); 1343b9e67834SAndre Fischer } 1344b9e67834SAndre Fischer else 1345b9e67834SAndre Fischer { 1346b9e67834SAndre Fischer meEscape = SVX_ESCAPEMENT_OFF; 1347b9e67834SAndre Fischer TextStyleChanged(); 1348b9e67834SAndre Fischer } 1349b9e67834SAndre Fischer break; 1350b9e67834SAndre Fischer case SID_SET_SUB_SCRIPT: 1351b9e67834SAndre Fischer if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SfxBoolItem)) 1352b9e67834SAndre Fischer { 1353b9e67834SAndre Fischer const SfxBoolItem* pItem = (const SfxBoolItem*)pState; 1354b9e67834SAndre Fischer mbSub = pItem->GetValue(); 1355b9e67834SAndre Fischer TextStyleChanged(); 1356b9e67834SAndre Fischer } 1357b9e67834SAndre Fischer else 1358b9e67834SAndre Fischer { 1359b9e67834SAndre Fischer mbSub = false; 1360b9e67834SAndre Fischer TextStyleChanged(); 1361b9e67834SAndre Fischer } 1362b9e67834SAndre Fischer break; 1363b9e67834SAndre Fischer case SID_SET_SUPER_SCRIPT: 1364b9e67834SAndre Fischer if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SfxBoolItem)) 1365b9e67834SAndre Fischer { 1366b9e67834SAndre Fischer const SfxBoolItem* pItem = (const SfxBoolItem*)pState; 1367b9e67834SAndre Fischer mbSuper = pItem->GetValue(); 1368b9e67834SAndre Fischer TextStyleChanged(); 1369b9e67834SAndre Fischer } 1370b9e67834SAndre Fischer else 1371b9e67834SAndre Fischer { 1372b9e67834SAndre Fischer mbSuper = false; 1373b9e67834SAndre Fischer TextStyleChanged(); 1374b9e67834SAndre Fischer } 1375b9e67834SAndre Fischer break; 1376b9e67834SAndre Fischer case SID_ATTR_CHAR_KERNING: 1377b9e67834SAndre Fischer if ( SFX_ITEM_AVAILABLE == eState ) 1378b9e67834SAndre Fischer { 1379b9e67834SAndre Fischer mbKernLBAvailable = true; 1380b9e67834SAndre Fischer 1381b9e67834SAndre Fischer if(pState->ISA(SvxKerningItem)) 1382b9e67834SAndre Fischer { 1383b9e67834SAndre Fischer const SvxKerningItem* pKerningItem = (const SvxKerningItem*)pState; 1384b9e67834SAndre Fischer mlKerning = (long)pKerningItem->GetValue(); 1385b9e67834SAndre Fischer mbKernAvailable = true; 1386b9e67834SAndre Fischer } 1387b9e67834SAndre Fischer else 1388b9e67834SAndre Fischer { 1389b9e67834SAndre Fischer mlKerning = 0; 1390b9e67834SAndre Fischer mbKernAvailable =false; 1391b9e67834SAndre Fischer } 1392b9e67834SAndre Fischer } 1393b9e67834SAndre Fischer else if (SFX_ITEM_DISABLED == eState) 1394b9e67834SAndre Fischer { 1395b9e67834SAndre Fischer mbKernLBAvailable = false; 1396b9e67834SAndre Fischer mbKernAvailable = false; 1397b9e67834SAndre Fischer mlKerning = 0; 1398b9e67834SAndre Fischer } 1399b9e67834SAndre Fischer else 1400b9e67834SAndre Fischer { 1401b9e67834SAndre Fischer mbKernLBAvailable = true; 1402b9e67834SAndre Fischer mbKernAvailable = false; 1403b9e67834SAndre Fischer mlKerning = 0; 1404b9e67834SAndre Fischer } 1405b9e67834SAndre Fischer break; 1406b9e67834SAndre Fischer 1407b9e67834SAndre Fischer // font size +/- enhancement in sd 1408b9e67834SAndre Fischer case SID_SHRINK_FONT_SIZE: 1409b9e67834SAndre Fischer case SID_GROW_FONT_SIZE: 1410b9e67834SAndre Fischer switch(maContext.GetCombinedContext()) 1411b9e67834SAndre Fischer { 1412b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_DrawText): 1413b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_Text): 1414b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_Table): 1415b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_OutlineText): 1416b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_Draw): 1417b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_TextObject): 1418b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_Graphic): 1419b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_DrawText): 1420b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_Text): 1421b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_Table): 1422b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_OutlineText): 1423b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_Draw): 1424b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_TextObject): 1425b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_Graphic): 1426b9e67834SAndre Fischer if(eState == SFX_ITEM_DISABLED) 1427b9e67834SAndre Fischer { 1428b9e67834SAndre Fischer mpToolBoxIncDec->Disable(); 1429b9e67834SAndre Fischer } 1430b9e67834SAndre Fischer else 1431b9e67834SAndre Fischer { 1432b9e67834SAndre Fischer mpToolBoxIncDec->Enable(); 1433b9e67834SAndre Fischer } 1434b9e67834SAndre Fischer break; 1435b9e67834SAndre Fischer } 1436b9e67834SAndre Fischer break; 1437b9e67834SAndre Fischer } 1438b9e67834SAndre Fischer } 1439b9e67834SAndre Fischer 1440b9e67834SAndre Fischer 1441b9e67834SAndre Fischer 1442b9e67834SAndre Fischer 1443b9e67834SAndre Fischer void TextPropertyPanel::TextStyleChanged() 1444b9e67834SAndre Fischer { 1445b9e67834SAndre Fischer if( !mbWeightAvailable ) 1446b9e67834SAndre Fischer mpToolBoxFont->EnableItem(TBI_BOLD,false); 1447b9e67834SAndre Fischer else 1448b9e67834SAndre Fischer mpToolBoxFont->EnableItem(TBI_BOLD,true); 1449b9e67834SAndre Fischer 1450b9e67834SAndre Fischer if(!mbPostureAvailable ) 1451b9e67834SAndre Fischer mpToolBoxFont->EnableItem(TBI_ITALIC,false); 1452b9e67834SAndre Fischer else 1453b9e67834SAndre Fischer mpToolBoxFont->EnableItem(TBI_ITALIC,true); 1454b9e67834SAndre Fischer 1455b9e67834SAndre Fischer UpdateFontBold(); 1456b9e67834SAndre Fischer UpdateFontItalic(); 1457b9e67834SAndre Fischer UpdateFontUnderline(); 1458b9e67834SAndre Fischer UpdateFontStrikeOut(); 1459b9e67834SAndre Fischer UpdateFontShadowed(); 1460b9e67834SAndre Fischer UpdateFontScript(); 1461b9e67834SAndre Fischer } 1462b9e67834SAndre Fischer 1463b9e67834SAndre Fischer 1464b9e67834SAndre Fischer 1465b9e67834SAndre Fischer 1466b9e67834SAndre Fischer void TextPropertyPanel::UpdateFontBold() 1467b9e67834SAndre Fischer { 1468b9e67834SAndre Fischer if( meWeight == WEIGHT_BOLD ) 1469b9e67834SAndre Fischer { 1470b9e67834SAndre Fischer mpToolBoxFont->SetItemState(TBI_BOLD, STATE_CHECK); 1471b9e67834SAndre Fischer } 1472b9e67834SAndre Fischer else 1473b9e67834SAndre Fischer { 1474b9e67834SAndre Fischer mpToolBoxFont->SetItemState(TBI_BOLD, STATE_NOCHECK); 1475b9e67834SAndre Fischer } 1476b9e67834SAndre Fischer } 1477b9e67834SAndre Fischer void TextPropertyPanel::UpdateFontItalic() 1478b9e67834SAndre Fischer { 1479b9e67834SAndre Fischer if(meItalic == ITALIC_NORMAL) 1480b9e67834SAndre Fischer { 1481b9e67834SAndre Fischer mpToolBoxFont->SetItemState(TBI_ITALIC, STATE_CHECK); 1482b9e67834SAndre Fischer } 1483b9e67834SAndre Fischer else 1484b9e67834SAndre Fischer { 1485b9e67834SAndre Fischer mpToolBoxFont->SetItemState(TBI_ITALIC, STATE_NOCHECK); 1486b9e67834SAndre Fischer } 1487b9e67834SAndre Fischer } 1488b9e67834SAndre Fischer void TextPropertyPanel::UpdateFontUnderline() 1489b9e67834SAndre Fischer { 1490b9e67834SAndre Fischer if(meUnderline == UNDERLINE_NONE) 1491b9e67834SAndre Fischer { 1492b9e67834SAndre Fischer mpToolBoxFont->SetItemState(TBI_UNDERLINE, STATE_NOCHECK); 1493b9e67834SAndre Fischer } 1494b9e67834SAndre Fischer else 1495b9e67834SAndre Fischer { 1496b9e67834SAndre Fischer mpToolBoxFont->SetItemState(TBI_UNDERLINE, STATE_CHECK); 1497b9e67834SAndre Fischer } 1498b9e67834SAndre Fischer } 1499b9e67834SAndre Fischer void TextPropertyPanel::UpdateFontStrikeOut() 1500b9e67834SAndre Fischer { 1501b9e67834SAndre Fischer if(meStrike != STRIKEOUT_NONE && meStrike != STRIKEOUT_DONTKNOW) 1502b9e67834SAndre Fischer { 1503b9e67834SAndre Fischer mpToolBoxFont->SetItemState(TBI_STRIKEOUT, STATE_CHECK); 1504b9e67834SAndre Fischer } 1505b9e67834SAndre Fischer else 1506b9e67834SAndre Fischer { 1507b9e67834SAndre Fischer mpToolBoxFont->SetItemState(TBI_STRIKEOUT, STATE_NOCHECK); 1508b9e67834SAndre Fischer } 1509b9e67834SAndre Fischer } 1510b9e67834SAndre Fischer void TextPropertyPanel::UpdateFontShadowed() 1511b9e67834SAndre Fischer { 1512b9e67834SAndre Fischer if(mbShadow) 1513b9e67834SAndre Fischer { 1514b9e67834SAndre Fischer mpToolBoxFont->SetItemState(TBI_SHADOWED, STATE_CHECK); 1515b9e67834SAndre Fischer } 1516b9e67834SAndre Fischer else 1517b9e67834SAndre Fischer { 1518b9e67834SAndre Fischer mpToolBoxFont->SetItemState(TBI_SHADOWED, STATE_NOCHECK); 1519b9e67834SAndre Fischer } 1520b9e67834SAndre Fischer } 1521b9e67834SAndre Fischer void TextPropertyPanel::UpdateFontScript() 1522b9e67834SAndre Fischer { 1523b9e67834SAndre Fischer //script for sw 1524b9e67834SAndre Fischer mpToolBoxScriptSw->EnableItem(TBI_SUPER,true); 1525b9e67834SAndre Fischer mpToolBoxScriptSw->EnableItem(TBI_SUB,true); 1526b9e67834SAndre Fischer if(meEscape == SVX_ESCAPEMENT_SUPERSCRIPT) 1527b9e67834SAndre Fischer { 1528b9e67834SAndre Fischer mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_CHECK); 1529b9e67834SAndre Fischer mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_NOCHECK); 1530b9e67834SAndre Fischer } 1531b9e67834SAndre Fischer else if(meEscape == SVX_ESCAPEMENT_SUBSCRIPT) 1532b9e67834SAndre Fischer { 1533b9e67834SAndre Fischer mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_NOCHECK); 1534b9e67834SAndre Fischer mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_CHECK); 1535b9e67834SAndre Fischer } 1536b9e67834SAndre Fischer else 1537b9e67834SAndre Fischer { 1538b9e67834SAndre Fischer mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_NOCHECK); 1539b9e67834SAndre Fischer mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_NOCHECK); 1540b9e67834SAndre Fischer } 1541b9e67834SAndre Fischer 1542b9e67834SAndre Fischer //script for sc sd 1543b9e67834SAndre Fischer mpToolBoxScript->EnableItem(TBI_SUPER,true); 1544b9e67834SAndre Fischer mpToolBoxScript->EnableItem(TBI_SUB,true); 1545b9e67834SAndre Fischer if(mbSuper) 1546b9e67834SAndre Fischer { 1547b9e67834SAndre Fischer mpToolBoxScript->SetItemState(TBI_SUPER, STATE_CHECK); 1548b9e67834SAndre Fischer mpToolBoxScript->SetItemState(TBI_SUB, STATE_NOCHECK); 1549b9e67834SAndre Fischer } 1550b9e67834SAndre Fischer else if(mbSub) 1551b9e67834SAndre Fischer { 1552b9e67834SAndre Fischer mpToolBoxScript->SetItemState(TBI_SUPER, STATE_NOCHECK); 1553b9e67834SAndre Fischer mpToolBoxScript->SetItemState(TBI_SUB, STATE_CHECK); 1554b9e67834SAndre Fischer } 1555b9e67834SAndre Fischer else 1556b9e67834SAndre Fischer { 1557b9e67834SAndre Fischer mpToolBoxScript->SetItemState(TBI_SUPER, STATE_NOCHECK); 1558b9e67834SAndre Fischer mpToolBoxScript->SetItemState(TBI_SUB, STATE_NOCHECK); 1559b9e67834SAndre Fischer } 1560b9e67834SAndre Fischer } 1561b9e67834SAndre Fischer 1562d4aefcaeSZheng Fan Color TextPropertyPanel::GetFontColor (void) const 1563b9e67834SAndre Fischer { 1564d4aefcaeSZheng Fan return maColor; 1565b9e67834SAndre Fischer } 1566d4aefcaeSZheng Fan 1567d4aefcaeSZheng Fan void TextPropertyPanel::SetFontColor ( 1568d4aefcaeSZheng Fan const String& rsColorName, 1569d4aefcaeSZheng Fan const Color aColor) 1570b9e67834SAndre Fischer { 1571d4aefcaeSZheng Fan SvxColorItem aColorItem(aColor, SID_ATTR_CHAR_COLOR); 1572d4aefcaeSZheng Fan mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_COLOR, SFX_CALLMODE_RECORD, &aColorItem, 0L); 1573d4aefcaeSZheng Fan maColor = aColor; 1574b9e67834SAndre Fischer } 1575b9e67834SAndre Fischer 1576d4aefcaeSZheng Fan Color TextPropertyPanel::GetBrushColor (void) const 1577da72173fSAndre Fischer { 1578d4aefcaeSZheng Fan return maBackColor; 1579da72173fSAndre Fischer } 1580d4aefcaeSZheng Fan 1581d4aefcaeSZheng Fan void TextPropertyPanel::SetBrushColor ( 1582d4aefcaeSZheng Fan const String& rsColorName, 1583d4aefcaeSZheng Fan const Color aColor) 1584b9e67834SAndre Fischer { 1585d4aefcaeSZheng Fan SvxBrushItem aBrushItem(aColor, SID_ATTR_BRUSH_CHAR); 1586d4aefcaeSZheng Fan mpBindings->GetDispatcher()->Execute(SID_ATTR_BRUSH_CHAR, SFX_CALLMODE_RECORD, &aBrushItem, 0L); 1587d4aefcaeSZheng Fan maBackColor = aColor; 1588b9e67834SAndre Fischer } 1589d4aefcaeSZheng Fan 1590d4aefcaeSZheng Fan Color& TextPropertyPanel::GetUnderlineColor() 1591b9e67834SAndre Fischer { 1592d4aefcaeSZheng Fan return meUnderlineColor; 1593b9e67834SAndre Fischer } 1594d4aefcaeSZheng Fan 1595da72173fSAndre Fischer void TextPropertyPanel::SetUnderline(FontUnderline eUnderline) 1596da72173fSAndre Fischer { 1597da72173fSAndre Fischer meUnderline = eUnderline; 1598da72173fSAndre Fischer } 1599d4aefcaeSZheng Fan 1600b9e67834SAndre Fischer } } // end of namespace svx::sidebar 1601