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" 59facb16e7SArmin Le Grand #include <svx/sidebar/ColorControl.hxx> 60facb16e7SArmin 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 99*b7a56e95SArmin Le Grand namespace 100*b7a56e95SArmin Le Grand { 101*b7a56e95SArmin Le Grand Color GetAutomaticColor(void) 102*b7a56e95SArmin Le Grand { 103*b7a56e95SArmin Le Grand return COL_AUTO; 104*b7a56e95SArmin Le Grand } 105*b7a56e95SArmin Le Grand } // end of anonymous namespace 106*b7a56e95SArmin Le Grand 107d4aefcaeSZheng Fan PopupControl* TextPropertyPanel::CreateFontColorPopupControl (PopupContainer* pParent) 108d4aefcaeSZheng Fan { 109*b7a56e95SArmin Le Grand const ResId aResId(SVX_RES(STR_AUTOMATICE)); 110*b7a56e95SArmin Le Grand 111d4aefcaeSZheng Fan return new ColorControl( 112d4aefcaeSZheng Fan pParent, 113d4aefcaeSZheng Fan mpBindings, 114d4aefcaeSZheng Fan SVX_RES(RID_POPUPPANEL_TEXTPAGE_FONT_COLOR), 115d4aefcaeSZheng Fan SVX_RES(VS_FONT_COLOR), 116*b7a56e95SArmin Le Grand ::boost::bind(GetAutomaticColor), 117d4aefcaeSZheng Fan ::boost::bind(&TextPropertyPanel::SetFontColor, this, _1,_2), 118d4aefcaeSZheng Fan pParent, 119*b7a56e95SArmin Le Grand &aResId); 120d4aefcaeSZheng Fan } 121b9e67834SAndre Fischer 122d4aefcaeSZheng Fan PopupControl* TextPropertyPanel::CreateBrushColorPopupControl (PopupContainer* pParent) 123d4aefcaeSZheng Fan { 124*b7a56e95SArmin Le Grand const ResId aResId(SVX_RES(STR_AUTOMATICE)); 125*b7a56e95SArmin Le Grand 126d4aefcaeSZheng Fan return new ColorControl( 127d4aefcaeSZheng Fan pParent, 128d4aefcaeSZheng Fan mpBindings, 129d4aefcaeSZheng Fan SVX_RES(RID_POPUPPANEL_TEXTPAGE_FONT_COLOR), 130d4aefcaeSZheng Fan SVX_RES(VS_FONT_COLOR), 131*b7a56e95SArmin Le Grand ::boost::bind(GetAutomaticColor), 132d4aefcaeSZheng Fan ::boost::bind(&TextPropertyPanel::SetBrushColor, this, _1,_2), 133d4aefcaeSZheng Fan pParent, 134*b7a56e95SArmin Le Grand &aResId); 135d4aefcaeSZheng Fan } 136d4aefcaeSZheng Fan 137d4aefcaeSZheng Fan long TextPropertyPanel::GetSelFontSize() 138d4aefcaeSZheng Fan { 139d4aefcaeSZheng Fan long nH = 240; 140d4aefcaeSZheng Fan SfxMapUnit eUnit = maSpacingControl.GetCoreMetric(); 141d4aefcaeSZheng Fan if (mpHeightItem) 142d4aefcaeSZheng Fan nH = LogicToLogic( mpHeightItem->GetHeight(), (MapUnit)eUnit, MAP_TWIP ); 143d4aefcaeSZheng Fan return nH; 144d4aefcaeSZheng Fan } 145b9e67834SAndre Fischer 146b9e67834SAndre Fischer 14795a18594SAndre Fischer TextPropertyPanel* TextPropertyPanel::Create ( 148b9e67834SAndre Fischer Window* pParent, 149b9e67834SAndre Fischer const cssu::Reference<css::frame::XFrame>& rxFrame, 15037fee4fdSAndre Fischer SfxBindings* pBindings, 15137fee4fdSAndre Fischer const cssu::Reference<css::ui::XSidebar>& rxSidebar) 152b9e67834SAndre Fischer { 153b9e67834SAndre Fischer if (pParent == NULL) 154b9e67834SAndre Fischer throw lang::IllegalArgumentException(A2S("no parent Window given to TextPropertyPanel::Create"), NULL, 0); 155b9e67834SAndre Fischer if ( ! rxFrame.is()) 156b9e67834SAndre Fischer throw lang::IllegalArgumentException(A2S("no XFrame given to TextPropertyPanel::Create"), NULL, 1); 157b9e67834SAndre Fischer if (pBindings == NULL) 158b9e67834SAndre Fischer throw lang::IllegalArgumentException(A2S("no SfxBindings given to TextPropertyPanel::Create"), NULL, 2); 159b9e67834SAndre Fischer 16095a18594SAndre Fischer return new TextPropertyPanel( 161b9e67834SAndre Fischer pParent, 162b9e67834SAndre Fischer rxFrame, 16337fee4fdSAndre Fischer pBindings, 16437fee4fdSAndre Fischer rxSidebar); 165b9e67834SAndre Fischer } 166b9e67834SAndre Fischer 167b9e67834SAndre Fischer 168d4aefcaeSZheng Fan ::sfx2::sidebar::ControllerItem& TextPropertyPanel::GetSpaceController() 169d4aefcaeSZheng Fan { 170d4aefcaeSZheng Fan return maSpacingControl; 171d4aefcaeSZheng Fan } 172b9e67834SAndre Fischer 173b9e67834SAndre Fischer TextPropertyPanel::TextPropertyPanel ( 174b9e67834SAndre Fischer Window* pParent, 175b9e67834SAndre Fischer const cssu::Reference<css::frame::XFrame>& rxFrame, 17637fee4fdSAndre Fischer SfxBindings* pBindings, 17737fee4fdSAndre Fischer const cssu::Reference<css::ui::XSidebar>& rxSidebar) 17895a18594SAndre Fischer : Control(pParent, SVX_RES(RID_SIDEBAR_TEXT_PANEL)), 179b9e67834SAndre Fischer mpFontNameBox (new SvxSBFontNameBox(this, SVX_RES(CB_SBFONT_FONT))), 180b9e67834SAndre Fischer maFontSizeBox (this, SVX_RES(MB_SBFONT_FONTSIZE)), 1817a32b0c8SAndre Fischer mpToolBoxIncDecBackground(ControlFactory::CreateToolBoxBackground(this)), 1827a32b0c8SAndre Fischer mpToolBoxIncDec(ControlFactory::CreateToolBox( 1837a32b0c8SAndre Fischer mpToolBoxIncDecBackground.get(), 1847a32b0c8SAndre Fischer SVX_RES(TB_INCREASE_DECREASE))), 1857a32b0c8SAndre Fischer mpToolBoxFontBackground(ControlFactory::CreateToolBoxBackground(this)), 1867a32b0c8SAndre Fischer mpToolBoxFont(ControlFactory::CreateToolBox( 1877a32b0c8SAndre Fischer mpToolBoxFontBackground.get(), 1887a32b0c8SAndre Fischer SVX_RES(TB_FONT))), 1897a32b0c8SAndre Fischer mpToolBoxFontColorBackground(ControlFactory::CreateToolBoxBackground(this)), 1907a32b0c8SAndre Fischer mpToolBoxFontColor(ControlFactory::CreateToolBox( 1917a32b0c8SAndre Fischer mpToolBoxFontColorBackground.get(), 1927a32b0c8SAndre Fischer SVX_RES(TB_FONTCOLOR))), 1937a32b0c8SAndre Fischer mpToolBoxScriptBackground(ControlFactory::CreateToolBoxBackground(this)), 1947a32b0c8SAndre Fischer mpToolBoxScript(ControlFactory::CreateToolBox( 1957a32b0c8SAndre Fischer mpToolBoxScriptBackground.get(), 1967a32b0c8SAndre Fischer SVX_RES(TB_SCRIPT))), 1977a32b0c8SAndre Fischer mpToolBoxScriptSwBackground(ControlFactory::CreateToolBoxBackground(this)), 1987a32b0c8SAndre Fischer mpToolBoxScriptSw(ControlFactory::CreateToolBox( 1997a32b0c8SAndre Fischer mpToolBoxScriptSwBackground.get(), 2007a32b0c8SAndre Fischer SVX_RES(TB_SCRIPT_SW))), 2017a32b0c8SAndre Fischer mpToolBoxSpacingBackground(ControlFactory::CreateToolBoxBackground(this)), 2027a32b0c8SAndre Fischer mpToolBoxSpacing(ControlFactory::CreateToolBox( 2037a32b0c8SAndre Fischer mpToolBoxSpacingBackground.get(), 2047a32b0c8SAndre Fischer SVX_RES(TB_SPACING))), 2057a32b0c8SAndre Fischer mpToolBoxHighlightBackground(ControlFactory::CreateToolBoxBackground(this)), 2067a32b0c8SAndre Fischer mpToolBoxHighlight(ControlFactory::CreateToolBox( 2077a32b0c8SAndre Fischer mpToolBoxHighlightBackground.get(), 2087a32b0c8SAndre Fischer SVX_RES(TB_HIGHLIGHT))), 209b9e67834SAndre Fischer mpFontColorUpdater(), 210b9e67834SAndre Fischer mpHighlightUpdater(), 211b9e67834SAndre Fischer 212b9e67834SAndre Fischer maFontNameControl (SID_ATTR_CHAR_FONT, *pBindings, *this), 213b9e67834SAndre Fischer maFontSizeControl (SID_ATTR_CHAR_FONTHEIGHT, *pBindings, *this), 214b9e67834SAndre Fischer maWeightControl (SID_ATTR_CHAR_WEIGHT, *pBindings, *this), 215b9e67834SAndre Fischer maItalicControl (SID_ATTR_CHAR_POSTURE, *pBindings, *this), 216b9e67834SAndre Fischer maUnderlineControl (SID_ATTR_CHAR_UNDERLINE, *pBindings, *this), 217b9e67834SAndre Fischer maStrikeControl (SID_ATTR_CHAR_STRIKEOUT, *pBindings, *this), 218b9e67834SAndre Fischer maShadowControl (SID_ATTR_CHAR_SHADOWED, *pBindings, *this), 219b9e67834SAndre Fischer maFontColorControl (SID_ATTR_CHAR_COLOR, *pBindings, *this), 220b9e67834SAndre Fischer maScriptControlSw (SID_ATTR_CHAR_ESCAPEMENT, *pBindings, *this), //for sw 221b9e67834SAndre Fischer maSuperScriptControl (SID_SET_SUPER_SCRIPT, *pBindings, *this), 222b9e67834SAndre Fischer maSubScriptControl (SID_SET_SUB_SCRIPT, *pBindings, *this), 223b9e67834SAndre Fischer maSpacingControl (SID_ATTR_CHAR_KERNING, *pBindings, *this), 224b9e67834SAndre Fischer maHighlightControl (SID_ATTR_BRUSH_CHAR, *pBindings, *this), 225b9e67834SAndre Fischer maSDFontGrow (SID_GROW_FONT_SIZE, *pBindings, *this), 226b9e67834SAndre Fischer maSDFontShrink (SID_SHRINK_FONT_SIZE, *pBindings, *this), 227b9e67834SAndre Fischer 228b9e67834SAndre Fischer maImgIncrease (SVX_RES( IMG_INCREASE)), 229b9e67834SAndre Fischer maImgDecrease (SVX_RES( IMG_DECREASE)), 230b9e67834SAndre Fischer maImgBold (SVX_RES( IMG_BOLD )), 231b9e67834SAndre Fischer maImgItalic (SVX_RES( IMG_ITALIC )), 232b9e67834SAndre Fischer maImgUnderline (SVX_RES( IMG_UNDERLINE )), 233b9e67834SAndre Fischer maImgStrike (SVX_RES( IMG_STRIKEOUT )), 234b9e67834SAndre Fischer maImgShadow (SVX_RES( IMG_SHADOWED )), 235b9e67834SAndre Fischer maImgFontColor (SVX_RES( IMG_FONTCOLOR)), 236b9e67834SAndre Fischer maImgSupScript (SVX_RES( IMG_SUPSCRIPT)), 237b9e67834SAndre Fischer maImgSubScript (SVX_RES( IMG_SUBSCRIPT)), 238b9e67834SAndre Fischer maImgHighlight (SVX_RES( IMG_HIGHLIGHT)), 239b9e67834SAndre Fischer 240b9e67834SAndre Fischer maImgNormalIcon (SVX_RES(IMG_SPACING_D)), 241b9e67834SAndre Fischer 242b9e67834SAndre Fischer maImgIncreaseHigh (SVX_RES( IMG_INCREASE_H )), 243b9e67834SAndre Fischer maImgDecreaseHigh (SVX_RES( IMG_DECREASE_H )), 244b9e67834SAndre Fischer maImgBoldHigh (SVX_RES( IMG_BOLD_H )), 245b9e67834SAndre Fischer maImgItalicHigh (SVX_RES( IMG_ITALIC_H )), 246b9e67834SAndre Fischer maImgUnderlineHigh (SVX_RES( IMG_UNDERLINE_H )), 247b9e67834SAndre Fischer maImgStrikeHigh (SVX_RES( IMG_STRIKEOUT_H )), 248b9e67834SAndre Fischer maImgShadowHigh (SVX_RES( IMG_SHADOWED_H )), 249b9e67834SAndre Fischer maImgFontColorHigh (SVX_RES( IMG_FONTCOLOR_H)), 250b9e67834SAndre Fischer maImgSupScriptHigh (SVX_RES( IMG_SUPSCRIPT_H)), 251b9e67834SAndre Fischer maImgSubScriptHigh (SVX_RES( IMG_SUBSCRIPT_H)), 252b9e67834SAndre Fischer maImgHighlightHigh (SVX_RES( IMG_HIGHLIGHT_H)), 253b9e67834SAndre Fischer 254b9e67834SAndre Fischer mpFontList (NULL), 255b9e67834SAndre Fischer mbMustDelete (false), 256b9e67834SAndre Fischer mbFocusOnFontSizeCtrl(false), 257a7d1eb6fSPavel Janík maCharSpacePopup(this, ::boost::bind(&TextPropertyPanel::CreateCharacterSpacingControl, this, _1)), 258a7d1eb6fSPavel Janík maUnderlinePopup(this, ::boost::bind(&TextPropertyPanel::CreateUnderlinePopupControl, this, _1)), 259a7d1eb6fSPavel Janík maFontColorPopup(this, ::boost::bind(&TextPropertyPanel::CreateFontColorPopupControl, this, _1)), 260a7d1eb6fSPavel Janík maBrushColorPopup(this, ::boost::bind(&TextPropertyPanel::CreateBrushColorPopupControl, this, _1)), 26195a18594SAndre Fischer mxFrame(rxFrame), 262b9e67834SAndre Fischer maContext(), 26337fee4fdSAndre Fischer mpBindings(pBindings), 26437fee4fdSAndre Fischer mxSidebar(rxSidebar) 265b9e67834SAndre Fischer { 266b9e67834SAndre Fischer Initialize(); 267b9e67834SAndre Fischer FreeResource(); 268b9e67834SAndre Fischer } 269b9e67834SAndre Fischer 270b9e67834SAndre Fischer 271b9e67834SAndre Fischer 272b9e67834SAndre Fischer 273b9e67834SAndre Fischer TextPropertyPanel::~TextPropertyPanel (void) 274b9e67834SAndre Fischer { 275b9e67834SAndre Fischer if(mbMustDelete) 276b9e67834SAndre Fischer delete mpFontList; 277b9e67834SAndre Fischer 2787a32b0c8SAndre Fischer // Destroy the toolbox windows. 2797a32b0c8SAndre Fischer mpToolBoxIncDec.reset(); 2807a32b0c8SAndre Fischer mpToolBoxFont.reset(); 2817a32b0c8SAndre Fischer mpToolBoxFontColor.reset(); 2827a32b0c8SAndre Fischer mpToolBoxScript.reset(); 2837a32b0c8SAndre Fischer mpToolBoxScriptSw.reset(); 2847a32b0c8SAndre Fischer mpToolBoxSpacing.reset(); 2857a32b0c8SAndre Fischer mpToolBoxHighlight.reset(); 2867a32b0c8SAndre Fischer 2877a32b0c8SAndre Fischer // Destroy the background windows of the toolboxes. 2887a32b0c8SAndre Fischer mpToolBoxIncDecBackground.reset(); 2897a32b0c8SAndre Fischer mpToolBoxFontBackground.reset(); 2907a32b0c8SAndre Fischer mpToolBoxFontColorBackground.reset(); 2917a32b0c8SAndre Fischer mpToolBoxScriptBackground.reset(); 2927a32b0c8SAndre Fischer mpToolBoxScriptSwBackground.reset(); 2937a32b0c8SAndre Fischer mpToolBoxSpacingBackground.reset(); 2947a32b0c8SAndre Fischer mpToolBoxHighlightBackground.reset(); 295b9e67834SAndre Fischer } 296b9e67834SAndre Fischer 297b9e67834SAndre Fischer 298b9e67834SAndre Fischer 299b9e67834SAndre Fischer 30095a18594SAndre Fischer Image TextPropertyPanel::GetIcon (const ::rtl::OUString& rsURL) 30195a18594SAndre Fischer { 30295a18594SAndre Fischer return GetImage(mxFrame, rsURL, sal_False, Theme::IsHighContrastMode()); 30395a18594SAndre Fischer } 30495a18594SAndre Fischer 30595a18594SAndre Fischer 306d4aefcaeSZheng Fan void TextPropertyPanel::SetSpacing(long nKern) 307d4aefcaeSZheng Fan { 308d4aefcaeSZheng Fan mlKerning = nKern; 309d4aefcaeSZheng Fan } 31095a18594SAndre Fischer 31195a18594SAndre Fischer 312b9e67834SAndre Fischer void TextPropertyPanel::HandleContextChange ( 313b9e67834SAndre Fischer const ::sfx2::sidebar::EnumContext aContext) 314b9e67834SAndre Fischer { 315b9e67834SAndre Fischer if (maContext == aContext) 316b9e67834SAndre Fischer { 317b9e67834SAndre Fischer // Nothing to do. 318b9e67834SAndre Fischer return; 319b9e67834SAndre Fischer } 320b9e67834SAndre Fischer 321b9e67834SAndre Fischer maContext = aContext; 32237fee4fdSAndre Fischer switch (maContext.GetCombinedContext_DI()) 323b9e67834SAndre Fischer { 324b9e67834SAndre Fischer case CombinedEnumContext(Application_Calc, Context_Cell): 325b9e67834SAndre Fischer case CombinedEnumContext(Application_Calc, Context_Pivot): 326b9e67834SAndre Fischer { 327b9e67834SAndre Fischer mpToolBoxScript->Hide(); 328b9e67834SAndre Fischer mpToolBoxScriptSw->Hide(); 329b9e67834SAndre Fischer mpToolBoxSpacing->Hide(); 330b9e67834SAndre Fischer mpToolBoxHighlight->Hide(); 331b9e67834SAndre Fischer 332b9e67834SAndre Fischer Size aSize(PROPERTYPAGE_WIDTH,TEXT_SECTIONPAGE_HEIGHT_S); 333b9e67834SAndre Fischer aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) ); 334b9e67834SAndre Fischer aSize.setWidth(GetOutputSizePixel().Width()); 335b9e67834SAndre Fischer SetSizePixel(aSize); 33637fee4fdSAndre Fischer if (mxSidebar.is()) 33737fee4fdSAndre Fischer mxSidebar->requestLayout(); 338b9e67834SAndre Fischer break; 339b9e67834SAndre Fischer } 340b9e67834SAndre Fischer 34137fee4fdSAndre Fischer case CombinedEnumContext(Application_WriterAndWeb, Context_Text): 34237fee4fdSAndre Fischer case CombinedEnumContext(Application_WriterAndWeb, Context_Table): 343b9e67834SAndre Fischer { 344b9e67834SAndre Fischer mpToolBoxScriptSw->Show(); 345b9e67834SAndre Fischer mpToolBoxScript->Hide(); 346b9e67834SAndre Fischer mpToolBoxHighlight->Show(); 347b9e67834SAndre Fischer mpToolBoxSpacing->Show(); 348b9e67834SAndre Fischer 349b9e67834SAndre Fischer Size aSize(PROPERTYPAGE_WIDTH, TEXT_SECTIONPAGE_HEIGHT); 350b9e67834SAndre Fischer aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) ); 351b9e67834SAndre Fischer aSize.setWidth(GetOutputSizePixel().Width()); 352b9e67834SAndre Fischer SetSizePixel(aSize); 35337fee4fdSAndre Fischer if (mxSidebar.is()) 35437fee4fdSAndre Fischer mxSidebar->requestLayout(); 355b9e67834SAndre Fischer break; 356b9e67834SAndre Fischer } 357b9e67834SAndre Fischer 358b9e67834SAndre Fischer case CombinedEnumContext(Application_Writer, Context_DrawText): 359b9e67834SAndre Fischer case CombinedEnumContext(Application_Writer, Context_Annotation): 360b9e67834SAndre Fischer { 361b9e67834SAndre Fischer mpToolBoxScriptSw->Show(); 362b9e67834SAndre Fischer mpToolBoxScript->Hide(); 363b9e67834SAndre Fischer mpToolBoxSpacing->Show(); 364b9e67834SAndre Fischer mpToolBoxHighlight->Hide(); 365b9e67834SAndre Fischer 366b9e67834SAndre Fischer Size aSize(PROPERTYPAGE_WIDTH,TEXT_SECTIONPAGE_HEIGHT); 367b9e67834SAndre Fischer aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) ); 368b9e67834SAndre Fischer aSize.setWidth(GetOutputSizePixel().Width()); 369b9e67834SAndre Fischer SetSizePixel(aSize); 37037fee4fdSAndre Fischer if (mxSidebar.is()) 37137fee4fdSAndre Fischer mxSidebar->requestLayout(); 372b9e67834SAndre Fischer break; 373b9e67834SAndre Fischer } 374b9e67834SAndre Fischer 375b9e67834SAndre Fischer case CombinedEnumContext(Application_Calc, Context_EditCell): 376b9e67834SAndre Fischer case CombinedEnumContext(Application_Calc, Context_DrawText): 37737fee4fdSAndre Fischer case CombinedEnumContext(Application_DrawImpress, Context_DrawText): 37837fee4fdSAndre Fischer case CombinedEnumContext(Application_DrawImpress, Context_Text): 37937fee4fdSAndre Fischer case CombinedEnumContext(Application_DrawImpress, Context_Table): 38037fee4fdSAndre Fischer case CombinedEnumContext(Application_DrawImpress, Context_OutlineText): 38137fee4fdSAndre Fischer case CombinedEnumContext(Application_DrawImpress, Context_Draw): 38237fee4fdSAndre Fischer case CombinedEnumContext(Application_DrawImpress, Context_TextObject): 38337fee4fdSAndre Fischer case CombinedEnumContext(Application_DrawImpress, Context_Graphic): 384b9e67834SAndre Fischer { 385b9e67834SAndre Fischer mpToolBoxScriptSw->Hide(); 386b9e67834SAndre Fischer mpToolBoxScript->Show(); 387b9e67834SAndre Fischer mpToolBoxSpacing->Show(); 388b9e67834SAndre Fischer mpToolBoxHighlight->Hide(); 389b9e67834SAndre Fischer 390b9e67834SAndre Fischer Size aSize(PROPERTYPAGE_WIDTH,TEXT_SECTIONPAGE_HEIGHT); 391b9e67834SAndre Fischer aSize = LogicToPixel( aSize,MapMode(MAP_APPFONT) ); 392b9e67834SAndre Fischer aSize.setWidth(GetOutputSizePixel().Width()); 393b9e67834SAndre Fischer SetSizePixel(aSize); 39437fee4fdSAndre Fischer if (mxSidebar.is()) 39537fee4fdSAndre Fischer mxSidebar->requestLayout(); 396b9e67834SAndre Fischer break; 397b9e67834SAndre Fischer } 398b9e67834SAndre Fischer 399b9e67834SAndre Fischer default: 400b9e67834SAndre Fischer break; 401b9e67834SAndre Fischer } 402b9e67834SAndre Fischer } 403b9e67834SAndre Fischer 404d4aefcaeSZheng Fan SfxBindings* TextPropertyPanel::GetBindings() 405d4aefcaeSZheng Fan { 406d4aefcaeSZheng Fan return mpBindings; 407d4aefcaeSZheng Fan } 408b9e67834SAndre Fischer 409b9e67834SAndre Fischer 410b9e67834SAndre Fischer void TextPropertyPanel::DataChanged (const DataChangedEvent& rEvent) 411b9e67834SAndre Fischer { 41295a18594SAndre Fischer (void)rEvent; 41395a18594SAndre Fischer 414b9e67834SAndre Fischer SetupIcons(); 415b9e67834SAndre Fischer } 416b9e67834SAndre Fischer 417b9e67834SAndre Fischer 418b9e67834SAndre Fischer 419b9e67834SAndre Fischer void TextPropertyPanel::Initialize (void) 420b9e67834SAndre Fischer { 421b9e67834SAndre Fischer //<<modify fill font list 422b9e67834SAndre Fischer SfxObjectShell* pDocSh = SfxObjectShell::Current(); 423b9e67834SAndre Fischer const SfxPoolItem* pItem = NULL; 424b9e67834SAndre Fischer 425b9e67834SAndre Fischer if (pDocSh != NULL) 426b9e67834SAndre Fischer pItem = pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST ); 427b9e67834SAndre Fischer if (pItem != NULL) 428b9e67834SAndre Fischer mpFontList = ( (SvxFontListItem*)pItem )->GetFontList(); 429b9e67834SAndre Fischer else 430b9e67834SAndre Fischer { 431b9e67834SAndre Fischer mpFontList = new FontList( Application::GetDefaultDevice() ); 432b9e67834SAndre Fischer mbMustDelete = 1; 433b9e67834SAndre Fischer } 434b9e67834SAndre Fischer 435b9e67834SAndre Fischer mpFontNameBox->SetAccessibleName(mpFontNameBox->GetQuickHelpText()); 43695a18594SAndre Fischer const FontInfo aFontInfo (mpFontList->Get( String::CreateFromAscii( "" ), String::CreateFromAscii( "" ))); 43795a18594SAndre Fischer maFontSizeBox.Fill(&aFontInfo,mpFontList); 438b9e67834SAndre Fischer maFontSizeBox.SetAccessibleName(maFontSizeBox.GetQuickHelpText()); 439b9e67834SAndre Fischer 440b9e67834SAndre Fischer //toolbox 441b9e67834SAndre Fischer SetupIcons(); 442b9e67834SAndre Fischer InitToolBoxIncDec(); 443b9e67834SAndre Fischer InitToolBoxFont(); 444b9e67834SAndre Fischer InitToolBoxFontColor(); 445b9e67834SAndre Fischer InitToolBoxScript(); 446b9e67834SAndre Fischer InitToolBoxSpacing(); 447b9e67834SAndre Fischer InitToolBoxHighlight(); 448b9e67834SAndre Fischer 449b9e67834SAndre Fischer #ifdef HAS_IA2 450d4aefcaeSZheng Fan mpFontNameBox->SetAccRelationLabeledBy(&mpFontNameBox); 451d4aefcaeSZheng Fan mpFontNameBox->SetMpSubEditAccLableBy(&mpFontNameBox); 452b9e67834SAndre Fischer maFontSizeBox.SetAccRelationLabeledBy(&maFontSizeBox); 453b9e67834SAndre Fischer maFontSizeBox.SetMpSubEditAccLableBy(&maFontSizeBox); 454d4aefcaeSZheng Fan mpToolBoxFont.SetAccRelationLabeledBy(&mpToolBoxFont); 455d4aefcaeSZheng Fan mpToolBoxIncDec.SetAccRelationLabeledBy(&mpToolBoxIncDec); 456d4aefcaeSZheng Fan mpToolBoxFontColor.SetAccRelationLabeledBy(&mpToolBoxFontColor); 457d4aefcaeSZheng Fan mpToolBoxScript.SetAccRelationLabeledBy(&mpToolBoxScript); 458d4aefcaeSZheng Fan mpToolBoxScriptSw.SetAccRelationLabeledBy(&mpToolBoxScriptSw); 459d4aefcaeSZheng Fan mpToolBoxSpacing.SetAccRelationLabeledBy(&mpToolBoxSpacing); 460d4aefcaeSZheng Fan mpToolBoxHighlight.SetAccRelationLabeledBy(&mpToolBoxHighlight); 461b9e67834SAndre Fischer #endif 462b9e67834SAndre Fischer 463b9e67834SAndre Fischer //init state 464b9e67834SAndre Fischer mpHeightItem = NULL; 465b9e67834SAndre Fischer meWeight = WEIGHT_NORMAL; 466b9e67834SAndre Fischer meItalic = ITALIC_NONE; 467b9e67834SAndre Fischer mbShadow = false; 468b9e67834SAndre Fischer meStrike = STRIKEOUT_NONE; 469b9e67834SAndre Fischer mbPostureAvailable = true; 470b9e67834SAndre Fischer mbWeightAvailable = true; 471b9e67834SAndre Fischer meUnderline = UNDERLINE_NONE; 472b9e67834SAndre Fischer meUnderlineColor = COL_AUTO; // 473b9e67834SAndre Fischer maColor = COL_BLACK; 474b9e67834SAndre Fischer mbColorAvailable = true; 475b9e67834SAndre Fischer maBackColor = COL_AUTO; 476b9e67834SAndre Fischer mbBackColorAvailable = true; 477b9e67834SAndre Fischer meColorType = FONT_COLOR; 478b9e67834SAndre Fischer meEscape = SVX_ESCAPEMENT_OFF; 479b9e67834SAndre Fischer mbSuper = false; 480b9e67834SAndre Fischer mbSub = false; 481b9e67834SAndre Fischer mbKernAvailable = true; 482b9e67834SAndre Fischer mbKernLBAvailable = true; 483b9e67834SAndre Fischer mlKerning = 0; 484b9e67834SAndre Fischer mpFontColorUpdater.reset(new ToolboxButtonColorUpdater( 485b9e67834SAndre Fischer SID_ATTR_CHAR_COLOR, 486b9e67834SAndre Fischer TBI_FONTCOLOR, 487b9e67834SAndre Fischer mpToolBoxFontColor.get(), 488b9e67834SAndre Fischer TBX_UPDATER_MODE_CHAR_COLOR_NEW)); 489b9e67834SAndre Fischer mpHighlightUpdater.reset(new ToolboxButtonColorUpdater( 490b9e67834SAndre Fischer SID_ATTR_BRUSH_CHAR, 491b9e67834SAndre Fischer TBI_HIGHLIGHT, 492b9e67834SAndre Fischer mpToolBoxHighlight.get(), 493b9e67834SAndre Fischer TBX_UPDATER_MODE_CHAR_COLOR_NEW)); 494b9e67834SAndre Fischer 495b9e67834SAndre Fischer //set handler 496b9e67834SAndre Fischer mpFontNameBox->SetBindings(mpBindings); 497b9e67834SAndre Fischer //add 498b9e67834SAndre Fischer Link aLink = LINK(this, TextPropertyPanel, FontSelHdl); 499b9e67834SAndre Fischer mpFontNameBox->SetSelectHdl(aLink); 500b9e67834SAndre Fischer //add end 501b9e67834SAndre Fischer 502b9e67834SAndre Fischer aLink = LINK(this, TextPropertyPanel, FontSizeModifyHdl); 503b9e67834SAndre Fischer maFontSizeBox.SetModifyHdl(aLink); 504b9e67834SAndre Fischer //add 505b9e67834SAndre Fischer aLink = LINK(this, TextPropertyPanel, FontSizeSelHdl); 506b9e67834SAndre Fischer maFontSizeBox.SetSelectHdl(aLink); 507b9e67834SAndre Fischer //add end 508b9e67834SAndre Fischer aLink = LINK(this, TextPropertyPanel, FontSizeLoseFocus); 509b9e67834SAndre Fischer maFontSizeBox.SetLoseFocusHdl(aLink); 510b9e67834SAndre Fischer 511b9e67834SAndre Fischer // add 512b9e67834SAndre Fischer long aSizeBoxHeight = maFontSizeBox.GetSizePixel().getHeight();; 513b9e67834SAndre Fischer Point aPosFontSize = maFontSizeBox.GetPosPixel(); 514b9e67834SAndre Fischer long aPosY = aPosFontSize.getY(); 515b9e67834SAndre Fischer Point pTBIncDec = mpToolBoxIncDec->GetPosPixel(); 516b9e67834SAndre Fischer long aIncDecHeight = mpToolBoxIncDec->GetSizePixel().getHeight(); 517b9e67834SAndre Fischer pTBIncDec.setY(aPosY+aSizeBoxHeight/2-aIncDecHeight/2); 518b9e67834SAndre Fischer mpToolBoxIncDec->SetPosPixel(pTBIncDec); 519b9e67834SAndre Fischer //end 520b9e67834SAndre Fischer } 521b9e67834SAndre Fischer 522d4aefcaeSZheng Fan void TextPropertyPanel::EndSpacingPopupMode (void) 523d4aefcaeSZheng Fan { 524d4aefcaeSZheng Fan maCharSpacePopup.Hide(); 525d4aefcaeSZheng Fan } 526b9e67834SAndre Fischer 527d4aefcaeSZheng Fan void TextPropertyPanel::EndUnderlinePopupMode (void) 528d4aefcaeSZheng Fan { 529d4aefcaeSZheng Fan maUnderlinePopup.Hide(); 530d4aefcaeSZheng Fan } 531b9e67834SAndre Fischer 532b9e67834SAndre Fischer 533b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxFont() 534b9e67834SAndre Fischer { 535b9e67834SAndre Fischer mpToolBoxFont->SetQuickHelpText(TBI_BOLD,String(SVX_RES(STR_QH_BOLD))); //Add 536b9e67834SAndre Fischer mpToolBoxFont->SetQuickHelpText(TBI_ITALIC,String(SVX_RES(STR_QH_ITALIC))); //Add 537b9e67834SAndre Fischer mpToolBoxFont->SetQuickHelpText(TBI_UNDERLINE,String(SVX_RES(STR_QH_UNDERLINE))); //Add 538b9e67834SAndre Fischer mpToolBoxFont->SetBackground(Wallpaper()); 539b9e67834SAndre Fischer mpToolBoxFont->SetPaintTransparent(true); 540b9e67834SAndre Fischer 541b9e67834SAndre Fischer Size aTbxSize( mpToolBoxFont->CalcWindowSizePixel() ); 542b9e67834SAndre Fischer mpToolBoxFont->SetOutputSizePixel( aTbxSize ); 543b9e67834SAndre Fischer 544b9e67834SAndre Fischer Link aLink = LINK(this, TextPropertyPanel, ToolboxFontSelectHandler); 545b9e67834SAndre Fischer mpToolBoxFont->SetSelectHdl ( aLink ); 546b9e67834SAndre Fischer aLink = LINK(this, TextPropertyPanel, ToolBoxUnderlineClickHdl); 547b9e67834SAndre Fischer mpToolBoxFont->SetDropdownClickHdl(aLink); 548b9e67834SAndre Fischer } 549b9e67834SAndre Fischer 550b9e67834SAndre Fischer 551b9e67834SAndre Fischer 552b9e67834SAndre Fischer 553b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxIncDec() 554b9e67834SAndre Fischer { 555b9e67834SAndre Fischer Size aTbxSize( mpToolBoxIncDec->CalcWindowSizePixel() ); 556b9e67834SAndre Fischer mpToolBoxIncDec->SetOutputSizePixel( aTbxSize ); 557b9e67834SAndre Fischer 558b9e67834SAndre Fischer Link aLink = LINK(this, TextPropertyPanel, ToolboxIncDecSelectHdl); 559b9e67834SAndre Fischer mpToolBoxIncDec->SetSelectHdl ( aLink ); 560b9e67834SAndre Fischer } 561b9e67834SAndre Fischer 562b9e67834SAndre Fischer 563b9e67834SAndre Fischer 564b9e67834SAndre Fischer 565b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxFontColor() 566b9e67834SAndre Fischer { 567b9e67834SAndre Fischer Size aTbxSize( mpToolBoxFontColor->CalcWindowSizePixel() ); 568b9e67834SAndre Fischer mpToolBoxFontColor->SetOutputSizePixel( aTbxSize ); 569b9e67834SAndre Fischer mpToolBoxFontColor->SetItemBits( TBI_FONTCOLOR, mpToolBoxFontColor->GetItemBits( TBI_FONTCOLOR ) | TIB_DROPDOWNONLY ); 570b9e67834SAndre Fischer 571b9e67834SAndre Fischer Link aLink = LINK(this, TextPropertyPanel, ToolBoxFontColorDropHdl); 572b9e67834SAndre Fischer mpToolBoxFontColor->SetDropdownClickHdl ( aLink ); 573b9e67834SAndre Fischer mpToolBoxFontColor->SetSelectHdl ( aLink ); 574b9e67834SAndre Fischer 575b9e67834SAndre Fischer } 576b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxScript() 577b9e67834SAndre Fischer { 578b9e67834SAndre Fischer Size aTbxSize( mpToolBoxScriptSw->CalcWindowSizePixel() ); 579b9e67834SAndre Fischer mpToolBoxScriptSw->SetOutputSizePixel( aTbxSize ); 580b9e67834SAndre Fischer 581b9e67834SAndre Fischer Link aLink = LINK(this, TextPropertyPanel, ToolBoxSwScriptSelectHdl); 582b9e67834SAndre Fischer mpToolBoxScriptSw->SetSelectHdl ( aLink ); 583b9e67834SAndre Fischer 584b9e67834SAndre Fischer aTbxSize = mpToolBoxScript->CalcWindowSizePixel() ; 585b9e67834SAndre Fischer mpToolBoxScript->SetOutputSizePixel( aTbxSize ); 586b9e67834SAndre Fischer 587b9e67834SAndre Fischer aLink = LINK(this, TextPropertyPanel, ToolBoxScriptSelectHdl); 588b9e67834SAndre Fischer mpToolBoxScript->SetSelectHdl ( aLink ); 589b9e67834SAndre Fischer } 590b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxSpacing() 591b9e67834SAndre Fischer { 592b9e67834SAndre Fischer Size aTbxSize( mpToolBoxSpacing->CalcWindowSizePixel() ); 593b9e67834SAndre Fischer mpToolBoxSpacing->SetOutputSizePixel( aTbxSize ); 594b9e67834SAndre Fischer mpToolBoxSpacing->SetItemBits( TBI_SPACING, mpToolBoxSpacing->GetItemBits( TBI_SPACING ) | TIB_DROPDOWNONLY ); 595b9e67834SAndre Fischer 596b9e67834SAndre Fischer Link aLink = LINK(this, TextPropertyPanel, SpacingClickHdl); 597b9e67834SAndre Fischer mpToolBoxSpacing->SetDropdownClickHdl ( aLink ); 598b9e67834SAndre Fischer mpToolBoxSpacing->SetSelectHdl( aLink ); 599b9e67834SAndre Fischer } 600b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxHighlight() 601b9e67834SAndre Fischer { 602b9e67834SAndre Fischer Size aTbxSize( mpToolBoxHighlight->CalcWindowSizePixel() ); 603b9e67834SAndre Fischer mpToolBoxHighlight->SetOutputSizePixel( aTbxSize ); 604b9e67834SAndre Fischer mpToolBoxHighlight->SetItemBits( TBI_HIGHLIGHT, mpToolBoxHighlight->GetItemBits( TBI_HIGHLIGHT ) | TIB_DROPDOWNONLY ); 605b9e67834SAndre Fischer 606b9e67834SAndre Fischer Link aLink = LINK(this, TextPropertyPanel, ToolBoxHighlightDropHdl); 607b9e67834SAndre Fischer mpToolBoxHighlight->SetDropdownClickHdl ( aLink ); 608b9e67834SAndre Fischer mpToolBoxHighlight->SetSelectHdl( aLink ); 609b9e67834SAndre Fischer } 610b9e67834SAndre Fischer 611b9e67834SAndre Fischer 612b9e67834SAndre Fischer 613b9e67834SAndre Fischer 614b9e67834SAndre Fischer void TextPropertyPanel::SetupIcons (void) 615b9e67834SAndre Fischer { 616b9e67834SAndre Fischer if (Theme::GetBoolean(Theme::Bool_UseSymphonyIcons)) 617b9e67834SAndre Fischer { 618b9e67834SAndre Fischer mpToolBoxIncDec->SetItemImage(TBI_INCREASE, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgIncreaseHigh : maImgIncrease); 619b9e67834SAndre Fischer mpToolBoxIncDec->SetItemImage(TBI_DECREASE, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgDecreaseHigh : maImgDecrease); 620b9e67834SAndre Fischer mpToolBoxFont->SetItemImage(TBI_BOLD, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgBoldHigh : maImgBold); 621b9e67834SAndre Fischer mpToolBoxFont->SetItemImage(TBI_ITALIC, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgItalicHigh : maImgItalic); 622b9e67834SAndre Fischer mpToolBoxFont->SetItemImage(TBI_UNDERLINE, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgUnderlineHigh : maImgUnderline); 623b9e67834SAndre Fischer mpToolBoxFont->SetItemImage(TBI_STRIKEOUT, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgStrikeHigh : maImgStrike); 624b9e67834SAndre Fischer mpToolBoxFont->SetItemImage(TBI_SHADOWED, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgShadowHigh : maImgShadow); 625b9e67834SAndre Fischer 626b9e67834SAndre Fischer mpToolBoxFontColor->SetItemImage(TBI_FONTCOLOR, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgFontColorHigh : maImgFontColor); 627b9e67834SAndre Fischer //for sw 628b9e67834SAndre Fischer mpToolBoxScriptSw->SetItemImage(TBI_SUPER_SW, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgSupScriptHigh : maImgSupScript); 629b9e67834SAndre Fischer mpToolBoxScriptSw->SetItemImage(TBI_SUB_SW, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgSubScriptHigh : maImgSubScript); 630b9e67834SAndre Fischer //for sc and sd 631b9e67834SAndre Fischer mpToolBoxScript->SetItemImage(TBI_SUPER, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgSupScriptHigh : maImgSupScript); 632b9e67834SAndre Fischer mpToolBoxScript->SetItemImage(TBI_SUB, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgSubScriptHigh : maImgSubScript); 633b9e67834SAndre Fischer mpToolBoxSpacing->SetItemImage(TBI_SPACING, maImgNormalIcon); 634b9e67834SAndre Fischer mpToolBoxHighlight->SetItemImage(TBI_HIGHLIGHT, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgHighlightHigh : maImgHighlight); 635b9e67834SAndre Fischer } 636b9e67834SAndre Fischer else 637b9e67834SAndre Fischer { 638b9e67834SAndre Fischer mpToolBoxIncDec->SetItemImage(TBI_INCREASE, GetIcon(A2S(".uno:Grow"))); 639b9e67834SAndre Fischer mpToolBoxIncDec->SetItemImage(TBI_DECREASE, GetIcon(A2S(".uno:Shrink"))); 640b9e67834SAndre Fischer mpToolBoxFont->SetItemImage(TBI_BOLD, GetIcon(A2S(".uno:Bold"))); 641b9e67834SAndre Fischer mpToolBoxFont->SetItemImage(TBI_ITALIC, GetIcon(A2S(".uno:Italic"))); 642b9e67834SAndre Fischer mpToolBoxFont->SetItemImage(TBI_UNDERLINE, GetIcon(A2S(".uno:Underline"))); 643b9e67834SAndre Fischer mpToolBoxFont->SetItemImage(TBI_STRIKEOUT, GetIcon(A2S(".uno:Strikeout"))); 644b9e67834SAndre Fischer mpToolBoxFont->SetItemImage(TBI_SHADOWED, GetIcon(A2S(".uno:Shadowed"))); 645b9e67834SAndre Fischer 646b9e67834SAndre Fischer mpToolBoxFontColor->SetItemImage(TBI_FONTCOLOR, GetIcon(A2S(".uno:FontColor"))); 647b9e67834SAndre Fischer //for sw 648b9e67834SAndre Fischer mpToolBoxScriptSw->SetItemImage(TBI_SUPER_SW, GetIcon(A2S(".uno:SuperScript"))); 649b9e67834SAndre Fischer mpToolBoxScriptSw->SetItemImage(TBI_SUB_SW, GetIcon(A2S(".uno:SubScript"))); 650b9e67834SAndre Fischer //for sc and sd 651b9e67834SAndre Fischer mpToolBoxScript->SetItemImage(TBI_SUPER, GetIcon(A2S(".uno:SuperScript"))); 652b9e67834SAndre Fischer mpToolBoxScript->SetItemImage(TBI_SUB, GetIcon(A2S(".uno:SubScript"))); 653b9e67834SAndre Fischer mpToolBoxSpacing->SetItemImage(TBI_SPACING, GetIcon(A2S(".uno:FontworkCharacterSpacingFloater"))); 654b9e67834SAndre Fischer mpToolBoxHighlight->SetItemImage(TBI_HIGHLIGHT, GetIcon(A2S(".uno:BackColor"))); 655b9e67834SAndre Fischer } 656b9e67834SAndre Fischer } 657b9e67834SAndre Fischer 658b9e67834SAndre Fischer 659b9e67834SAndre Fischer 660b9e67834SAndre Fischer 661b9e67834SAndre Fischer IMPL_LINK( TextPropertyPanel, FontSelHdl, FontNameBox*, pBox ) 662b9e67834SAndre Fischer { 663b9e67834SAndre Fischer if ( !pBox->IsTravelSelect() ) 664b9e67834SAndre Fischer { 665b9e67834SAndre Fischer if( SfxViewShell::Current() ) 666b9e67834SAndre Fischer { 667b9e67834SAndre Fischer Window* pShellWnd = SfxViewShell::Current()->GetWindow(); 668b9e67834SAndre Fischer 669b9e67834SAndre Fischer if ( pShellWnd ) 670b9e67834SAndre Fischer pShellWnd->GrabFocus(); 671b9e67834SAndre Fischer } 672b9e67834SAndre Fischer } 673b9e67834SAndre Fischer return 0; 674b9e67834SAndre Fischer } 675b9e67834SAndre Fischer //add end 676b9e67834SAndre Fischer IMPL_LINK( TextPropertyPanel, FontSizeModifyHdl, FontSizeBox*, pSizeBox ) 677b9e67834SAndre Fischer { 678b9e67834SAndre Fischer if (pSizeBox == &maFontSizeBox) 679b9e67834SAndre Fischer { 680b9e67834SAndre Fischer long nSize = pSizeBox->GetValue(); 681b9e67834SAndre Fischer mbFocusOnFontSizeCtrl = true; 682b9e67834SAndre Fischer 683b9e67834SAndre Fischer float fSize = (float)nSize / 10; 684b9e67834SAndre Fischer SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric(); 685b9e67834SAndre Fischer SvxFontHeightItem aItem( CalcToUnit( fSize, eUnit ), 100, SID_ATTR_CHAR_FONTHEIGHT ) ; 686b9e67834SAndre Fischer 687b9e67834SAndre Fischer mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONTHEIGHT, SFX_CALLMODE_RECORD, &aItem, 0L ); 688b9e67834SAndre Fischer mpBindings->Invalidate(SID_ATTR_CHAR_FONTHEIGHT,true,false); 689b9e67834SAndre Fischer } 690b9e67834SAndre Fischer return 0; 691b9e67834SAndre Fischer } 692b9e67834SAndre Fischer //add 693b9e67834SAndre Fischer IMPL_LINK( TextPropertyPanel, FontSizeSelHdl, FontSizeBox*, pSizeBox ) 694b9e67834SAndre Fischer { 695b9e67834SAndre Fischer if ( !pSizeBox->IsTravelSelect() ) 696b9e67834SAndre Fischer { 697b9e67834SAndre Fischer if( SfxViewShell::Current() ) 698b9e67834SAndre Fischer { 699b9e67834SAndre Fischer Window* pShellWnd = SfxViewShell::Current()->GetWindow(); 700b9e67834SAndre Fischer 701b9e67834SAndre Fischer if ( pShellWnd ) 702b9e67834SAndre Fischer pShellWnd->GrabFocus(); 703b9e67834SAndre Fischer } 704b9e67834SAndre Fischer } 705b9e67834SAndre Fischer 706b9e67834SAndre Fischer return 0; 707b9e67834SAndre Fischer } 708b9e67834SAndre Fischer //add end 709b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, FontSizeLoseFocus, FontSizeBox*, pSizeBox) 710b9e67834SAndre Fischer { 711b9e67834SAndre Fischer if(pSizeBox == &maFontSizeBox) 712b9e67834SAndre Fischer { 713b9e67834SAndre Fischer mbFocusOnFontSizeCtrl = false; 714b9e67834SAndre Fischer } 715b9e67834SAndre Fischer return 0; 716b9e67834SAndre Fischer } 717b9e67834SAndre Fischer 718b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolboxFontSelectHandler, ToolBox*, pToolBox) 719b9e67834SAndre Fischer { 720b9e67834SAndre Fischer const sal_uInt16 nId = pToolBox->GetCurItemId(); 721b9e67834SAndre Fischer 722b9e67834SAndre Fischer //Bold 723b9e67834SAndre Fischer if(nId == TBI_BOLD) 724b9e67834SAndre Fischer { 725b9e67834SAndre Fischer EndTracking(); 726b9e67834SAndre Fischer if(meWeight != WEIGHT_BOLD) 727b9e67834SAndre Fischer meWeight = WEIGHT_BOLD; 728b9e67834SAndre Fischer else 729b9e67834SAndre Fischer meWeight = WEIGHT_NORMAL; 730b9e67834SAndre Fischer SvxWeightItem aWeightItem(meWeight, SID_ATTR_CHAR_WEIGHT); 731b9e67834SAndre Fischer mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_WEIGHT, SFX_CALLMODE_RECORD, &aWeightItem, 0L); 732b9e67834SAndre Fischer UpdateFontBold(); 733b9e67834SAndre Fischer } 734b9e67834SAndre Fischer //Italic 735b9e67834SAndre Fischer else if(nId == TBI_ITALIC) 736b9e67834SAndre Fischer { 737b9e67834SAndre Fischer EndTracking(); 738b9e67834SAndre Fischer if(meItalic != ITALIC_NORMAL) 739b9e67834SAndre Fischer meItalic = ITALIC_NORMAL; 740b9e67834SAndre Fischer else 741b9e67834SAndre Fischer meItalic = ITALIC_NONE; 742b9e67834SAndre Fischer SvxPostureItem aPostureItem(meItalic, SID_ATTR_CHAR_POSTURE); 743b9e67834SAndre Fischer mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_POSTURE, SFX_CALLMODE_RECORD, &aPostureItem, 0L); 744b9e67834SAndre Fischer UpdateFontItalic(); 745b9e67834SAndre Fischer } 746b9e67834SAndre Fischer //underline 747b9e67834SAndre Fischer else if(nId == TBI_UNDERLINE) 748b9e67834SAndre Fischer { 749b9e67834SAndre Fischer EndTracking(); 750b9e67834SAndre Fischer //add , keep underline's color 751b9e67834SAndre Fischer if(meUnderline == UNDERLINE_NONE) 752b9e67834SAndre Fischer { 75395a18594SAndre Fischer //AF: meUnderline = GetDefaultUnderline(); 75495a18594SAndre Fischer meUnderline = UNDERLINE_SINGLE; 755b9e67834SAndre Fischer //<<modify 756b9e67834SAndre Fischer //SvxTextLineItem aLineItem(meUnderline, SID_ATTR_CHAR_UNDERLINE); 757b9e67834SAndre Fischer SvxUnderlineItem aLineItem(meUnderline, SID_ATTR_CHAR_UNDERLINE); 758b9e67834SAndre Fischer //modify end>> 759b9e67834SAndre Fischer aLineItem.SetColor(meUnderlineColor); 760b9e67834SAndre Fischer mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_UNDERLINE, SFX_CALLMODE_RECORD, &aLineItem, 0L); 761b9e67834SAndre Fischer } 762b9e67834SAndre Fischer else 763b9e67834SAndre Fischer { 764b9e67834SAndre Fischer meUnderline = UNDERLINE_NONE; 765b9e67834SAndre Fischer //<<modify 766b9e67834SAndre Fischer //SvxTextLineItem aLineItem(meUnderline, SID_ATTR_CHAR_UNDERLINE); 767b9e67834SAndre Fischer SvxUnderlineItem aLineItem(meUnderline, SID_ATTR_CHAR_UNDERLINE); 768b9e67834SAndre Fischer //modify end>> 769b9e67834SAndre Fischer mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_UNDERLINE, SFX_CALLMODE_RECORD, &aLineItem, 0L); 770b9e67834SAndre Fischer } 771b9e67834SAndre Fischer UpdateFontUnderline(); 772b9e67834SAndre Fischer //add end 773b9e67834SAndre Fischer } 774b9e67834SAndre Fischer //strike out 775b9e67834SAndre Fischer else if(nId == TBI_STRIKEOUT) 776b9e67834SAndre Fischer { 777b9e67834SAndre Fischer EndTracking(); 778b9e67834SAndre Fischer if(meStrike != STRIKEOUT_NONE && meStrike != STRIKEOUT_DONTKNOW) 779b9e67834SAndre Fischer meStrike = STRIKEOUT_NONE; 780b9e67834SAndre Fischer else 781b9e67834SAndre Fischer meStrike = STRIKEOUT_SINGLE; 782b9e67834SAndre Fischer SvxCrossedOutItem aStrikeItem(meStrike,SID_ATTR_CHAR_STRIKEOUT); 783b9e67834SAndre Fischer mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_STRIKEOUT, SFX_CALLMODE_RECORD, &aStrikeItem, 0L); 784b9e67834SAndre Fischer UpdateFontStrikeOut(); 785b9e67834SAndre Fischer } 786b9e67834SAndre Fischer //shadowed 787b9e67834SAndre Fischer else if(nId == TBI_SHADOWED) 788b9e67834SAndre Fischer { 789b9e67834SAndre Fischer EndTracking(); 790b9e67834SAndre Fischer mbShadow = !mbShadow; 791b9e67834SAndre Fischer SvxShadowedItem aShadowItem(mbShadow, SID_ATTR_CHAR_SHADOWED); 792b9e67834SAndre Fischer mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_SHADOWED, SFX_CALLMODE_RECORD, &aShadowItem, 0L); 793b9e67834SAndre Fischer UpdateFontShadowed(); 794b9e67834SAndre Fischer } 795b9e67834SAndre Fischer return 0; 796b9e67834SAndre Fischer } 797b9e67834SAndre Fischer 798b9e67834SAndre Fischer 799b9e67834SAndre Fischer 800b9e67834SAndre Fischer 801b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolboxIncDecSelectHdl, ToolBox*, pToolBox) 802b9e67834SAndre Fischer { 803b9e67834SAndre Fischer const sal_uInt16 nId = pToolBox->GetCurItemId(); 804b9e67834SAndre Fischer 805b9e67834SAndre Fischer // font size +/- enhancement in sd 806b9e67834SAndre Fischer switch (maContext.GetCombinedContext()) 807b9e67834SAndre Fischer { 808b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_DrawText): 809b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_Text): 810b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_Table): 811b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_OutlineText): 812b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_Draw): 813b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_TextObject): 814b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_Graphic): 815b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_DrawText): 816b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_Text): 817b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_Table): 818b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_OutlineText): 819b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_Draw): 820b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_TextObject): 821b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_Graphic): 822b9e67834SAndre Fischer if(nId == TBI_INCREASE) 823b9e67834SAndre Fischer { 824b9e67834SAndre Fischer EndTracking(); 825b9e67834SAndre Fischer SfxVoidItem aItem(SID_GROW_FONT_SIZE); 826b9e67834SAndre Fischer mpBindings->GetDispatcher()->Execute( SID_GROW_FONT_SIZE, SFX_CALLMODE_RECORD, &aItem, 0L ); 827b9e67834SAndre Fischer } 828b9e67834SAndre Fischer else if(nId == TBI_DECREASE) 829b9e67834SAndre Fischer { 830b9e67834SAndre Fischer EndTracking(); 831b9e67834SAndre Fischer SfxVoidItem aItem(SID_SHRINK_FONT_SIZE); 832b9e67834SAndre Fischer mpBindings->GetDispatcher()->Execute( SID_SHRINK_FONT_SIZE, SFX_CALLMODE_RECORD, &aItem, 0L ); 833b9e67834SAndre Fischer } 834b9e67834SAndre Fischer break; 835b9e67834SAndre Fischer 836b9e67834SAndre Fischer default: 837b9e67834SAndre Fischer if(nId == TBI_INCREASE) 838b9e67834SAndre Fischer { 839b9e67834SAndre Fischer EndTracking(); 840b9e67834SAndre Fischer mbFocusOnFontSizeCtrl = false; 841b9e67834SAndre Fischer sal_Int64 iValue = maFontSizeBox.GetValue(); 842b9e67834SAndre Fischer int iPos = maFontSizeBox.GetValuePos(iValue, FUNIT_NONE); 843b9e67834SAndre Fischer long nSize = iValue; 844b9e67834SAndre Fischer if(iPos != LISTBOX_ENTRY_NOTFOUND) 845b9e67834SAndre Fischer nSize = maFontSizeBox.GetValue(iPos+1 , FUNIT_NONE); 846b9e67834SAndre Fischer else if(iValue >= 100 && iValue < 105) 847b9e67834SAndre Fischer nSize = 105; 848b9e67834SAndre Fischer else if(iValue >= 105 && iValue < 110) 849b9e67834SAndre Fischer nSize = 110; 850b9e67834SAndre Fischer else if(iValue < 960) 851b9e67834SAndre Fischer { 852b9e67834SAndre Fischer nSize = (nSize / 10) * 10 + 10; 853b9e67834SAndre Fischer while(maFontSizeBox.GetValuePos(nSize, FUNIT_NONE) == LISTBOX_ENTRY_NOTFOUND) 854b9e67834SAndre Fischer nSize += 10; 855b9e67834SAndre Fischer } 856b9e67834SAndre Fischer else 857b9e67834SAndre Fischer { 858b9e67834SAndre Fischer nSize = iValue; 859b9e67834SAndre Fischer } 860b9e67834SAndre Fischer 861b9e67834SAndre Fischer float fSize = (float)nSize / 10; 862b9e67834SAndre Fischer 863b9e67834SAndre Fischer SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric(); 864b9e67834SAndre Fischer SvxFontHeightItem aItem( CalcToUnit( fSize, eUnit ), 100, SID_ATTR_CHAR_FONTHEIGHT ) ; 865b9e67834SAndre Fischer 866b9e67834SAndre Fischer mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONTHEIGHT, SFX_CALLMODE_RECORD, &aItem, 0L ); 867b9e67834SAndre Fischer mpBindings->Invalidate(SID_ATTR_CHAR_FONTHEIGHT,true,false); 868b9e67834SAndre Fischer //add , update ASAP 869b9e67834SAndre Fischer maFontSizeBox.SetValue( nSize ); 870b9e67834SAndre Fischer if(nSize >= 960) 871b9e67834SAndre Fischer { 872b9e67834SAndre Fischer mpToolBoxIncDec->EnableItem(TBI_INCREASE,false); 873b9e67834SAndre Fischer mpToolBoxIncDec->EnableItem(TBI_DECREASE,true); 874b9e67834SAndre Fischer } 875b9e67834SAndre Fischer else if(nSize <= 60) 876b9e67834SAndre Fischer { 877b9e67834SAndre Fischer mpToolBoxIncDec->EnableItem(TBI_INCREASE,true); 878b9e67834SAndre Fischer mpToolBoxIncDec->EnableItem(TBI_DECREASE,false); 879b9e67834SAndre Fischer } 880b9e67834SAndre Fischer else 881b9e67834SAndre Fischer { 882b9e67834SAndre Fischer mpToolBoxIncDec->EnableItem(TBI_INCREASE,true); 883b9e67834SAndre Fischer mpToolBoxIncDec->EnableItem(TBI_DECREASE,true); 884b9e67834SAndre Fischer } 885b9e67834SAndre Fischer //add end 886b9e67834SAndre Fischer } 887b9e67834SAndre Fischer else if(nId == TBI_DECREASE) 888b9e67834SAndre Fischer { 889b9e67834SAndre Fischer EndTracking(); 890b9e67834SAndre Fischer mbFocusOnFontSizeCtrl = false; 891b9e67834SAndre Fischer sal_Int64 iValue = maFontSizeBox.GetValue(); 892b9e67834SAndre Fischer int iPos = maFontSizeBox.GetValuePos(iValue, FUNIT_NONE); 893b9e67834SAndre Fischer long nSize = iValue; 894b9e67834SAndre Fischer if(iPos != LISTBOX_ENTRY_NOTFOUND) 895b9e67834SAndre Fischer nSize = maFontSizeBox.GetValue(iPos-1 , FUNIT_NONE); 896b9e67834SAndre Fischer else if(iValue > 100 && iValue <= 105) 897b9e67834SAndre Fischer nSize = 100; 898b9e67834SAndre Fischer else if(iValue > 105 && iValue <= 110) 899b9e67834SAndre Fischer nSize = 105; 900b9e67834SAndre Fischer else if(iValue > 960) 901b9e67834SAndre Fischer { 902b9e67834SAndre Fischer nSize = 960; 903b9e67834SAndre Fischer } 904b9e67834SAndre Fischer else if(iValue > 60) 905b9e67834SAndre Fischer { 906b9e67834SAndre Fischer nSize = (nSize / 10) * 10 ; 907b9e67834SAndre Fischer while(maFontSizeBox.GetValuePos(nSize, FUNIT_NONE) == LISTBOX_ENTRY_NOTFOUND) 908b9e67834SAndre Fischer nSize -= 10; 909b9e67834SAndre Fischer } 910b9e67834SAndre Fischer else 911b9e67834SAndre Fischer { 912b9e67834SAndre Fischer nSize = iValue; 913b9e67834SAndre Fischer } 914b9e67834SAndre Fischer 915b9e67834SAndre Fischer float fSize = (float)nSize / 10; 916b9e67834SAndre Fischer 917b9e67834SAndre Fischer SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric(); 918b9e67834SAndre Fischer SvxFontHeightItem aItem( CalcToUnit( fSize, eUnit ), 100, SID_ATTR_CHAR_FONTHEIGHT ) ; 919b9e67834SAndre Fischer 920b9e67834SAndre Fischer mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONTHEIGHT, SFX_CALLMODE_RECORD, &aItem, 0L ); 921b9e67834SAndre Fischer mpBindings->Invalidate(SID_ATTR_CHAR_FONTHEIGHT,true,false); 922b9e67834SAndre Fischer //add 923b9e67834SAndre Fischer maFontSizeBox.SetValue( nSize ); 924b9e67834SAndre Fischer if(nSize >= 960) 925b9e67834SAndre Fischer { 926b9e67834SAndre Fischer mpToolBoxIncDec->EnableItem(TBI_INCREASE,false); 927b9e67834SAndre Fischer mpToolBoxIncDec->EnableItem(TBI_DECREASE,true); 928b9e67834SAndre Fischer } 929b9e67834SAndre Fischer else if(nSize <= 60) 930b9e67834SAndre Fischer { 931b9e67834SAndre Fischer mpToolBoxIncDec->EnableItem(TBI_INCREASE,true); 932b9e67834SAndre Fischer mpToolBoxIncDec->EnableItem(TBI_DECREASE,false); 933b9e67834SAndre Fischer } 934b9e67834SAndre Fischer else 935b9e67834SAndre Fischer { 936b9e67834SAndre Fischer mpToolBoxIncDec->EnableItem(TBI_INCREASE,true); 937b9e67834SAndre Fischer mpToolBoxIncDec->EnableItem(TBI_DECREASE,true); 938b9e67834SAndre Fischer } 939b9e67834SAndre Fischer //add end 940b9e67834SAndre Fischer } 941b9e67834SAndre Fischer } 942b9e67834SAndre Fischer return 0; 943b9e67834SAndre Fischer } 944b9e67834SAndre Fischer 945b9e67834SAndre Fischer 946b9e67834SAndre Fischer 947b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolBoxUnderlineClickHdl, ToolBox*, pToolBox) 948b9e67834SAndre Fischer { 949b9e67834SAndre Fischer const sal_uInt16 nId = pToolBox->GetCurItemId(); 950d4aefcaeSZheng Fan OSL_ASSERT(nId == TBI_UNDERLINE); 951b9e67834SAndre Fischer if(nId == TBI_UNDERLINE) 952b9e67834SAndre Fischer { 953b9e67834SAndre Fischer pToolBox->SetItemDown( nId, true ); 954d4aefcaeSZheng Fan maUnderlinePopup.Rearrange(meUnderline); 955d4aefcaeSZheng Fan maUnderlinePopup.Show(*pToolBox); 956b9e67834SAndre Fischer 957b9e67834SAndre Fischer } 958d4aefcaeSZheng Fan return 0L; 959b9e67834SAndre Fischer } 960b9e67834SAndre Fischer 961b9e67834SAndre Fischer 962b9e67834SAndre Fischer 963b9e67834SAndre Fischer 964b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolBoxFontColorDropHdl,ToolBox*, pToolBox) 965b9e67834SAndre Fischer { 966b9e67834SAndre Fischer const sal_uInt16 nId = pToolBox->GetCurItemId(); 967b9e67834SAndre Fischer if(nId == TBI_FONTCOLOR) 968b9e67834SAndre Fischer { 969b9e67834SAndre Fischer meColorType = FONT_COLOR; 970b9e67834SAndre Fischer 971b9e67834SAndre Fischer pToolBox->SetItemDown( nId, true ); 972b9e67834SAndre Fischer 973d4aefcaeSZheng Fan maFontColorPopup.Show(*pToolBox); 974d4aefcaeSZheng Fan maFontColorPopup.SetCurrentColor(maColor, mbColorAvailable); 975b9e67834SAndre Fischer } 976b9e67834SAndre Fischer return 0; 977b9e67834SAndre Fischer } 978b9e67834SAndre Fischer 979b9e67834SAndre Fischer 980b9e67834SAndre Fischer 981b9e67834SAndre Fischer 982b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolBoxSwScriptSelectHdl, ToolBox*, pToolBox) 983b9e67834SAndre Fischer { 984b9e67834SAndre Fischer const sal_uInt16 nId = pToolBox->GetCurItemId(); 985b9e67834SAndre Fischer if( nId == TBI_SUPER_SW ) 986b9e67834SAndre Fischer { 987b9e67834SAndre Fischer if(meEscape != SVX_ESCAPEMENT_SUPERSCRIPT) 988b9e67834SAndre Fischer { 989b9e67834SAndre Fischer meEscape = SVX_ESCAPEMENT_SUPERSCRIPT; 990b9e67834SAndre Fischer SvxEscapementItem aSupItem(DFLT_ESC_SUPER, DFLT_ESC_PROP, SID_ATTR_CHAR_ESCAPEMENT); 991b9e67834SAndre Fischer mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aSupItem, 0L ); 992b9e67834SAndre Fischer } 993b9e67834SAndre Fischer else 994b9e67834SAndre Fischer { 995b9e67834SAndre Fischer meEscape = SVX_ESCAPEMENT_OFF; 996b9e67834SAndre Fischer SvxEscapementItem aNoneItem(0, 100, SID_ATTR_CHAR_ESCAPEMENT); 997b9e67834SAndre Fischer mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aNoneItem, 0L ); 998b9e67834SAndre Fischer } 999b9e67834SAndre Fischer } 1000b9e67834SAndre Fischer else if(TBI_SUB_SW == nId) 1001b9e67834SAndre Fischer { 1002b9e67834SAndre Fischer if(meEscape != SVX_ESCAPEMENT_SUBSCRIPT) 1003b9e67834SAndre Fischer { 1004b9e67834SAndre Fischer meEscape = (SvxEscapement)SVX_ESCAPEMENT_SUBSCRIPT; 1005b9e67834SAndre Fischer SvxEscapementItem aSubItem(DFLT_ESC_SUB, DFLT_ESC_PROP, SID_ATTR_CHAR_ESCAPEMENT); 1006b9e67834SAndre Fischer mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aSubItem, 0L ); 1007b9e67834SAndre Fischer } 1008b9e67834SAndre Fischer else 1009b9e67834SAndre Fischer { 1010b9e67834SAndre Fischer meEscape = SVX_ESCAPEMENT_OFF; 1011b9e67834SAndre Fischer SvxEscapementItem aNoneItem(0, 100, SID_ATTR_CHAR_ESCAPEMENT); 1012b9e67834SAndre Fischer mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aNoneItem, 0L ); 1013b9e67834SAndre Fischer } 1014b9e67834SAndre Fischer } 1015b9e67834SAndre Fischer UpdateFontScript(); 1016b9e67834SAndre Fischer 1017b9e67834SAndre Fischer return 0; 1018b9e67834SAndre Fischer } 1019b9e67834SAndre Fischer 1020b9e67834SAndre Fischer 1021b9e67834SAndre Fischer 1022b9e67834SAndre Fischer 1023b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolBoxScriptSelectHdl, ToolBox*, pToolBox) 1024b9e67834SAndre Fischer { 1025b9e67834SAndre Fischer const sal_uInt16 nId = pToolBox->GetCurItemId(); 1026b9e67834SAndre Fischer if( nId == TBI_SUPER ) 1027b9e67834SAndre Fischer { 1028b9e67834SAndre Fischer mbSuper = !mbSuper; 1029b9e67834SAndre Fischer SfxBoolItem aSupItem(SID_SET_SUPER_SCRIPT, mbSuper); 1030b9e67834SAndre Fischer mpBindings->GetDispatcher()->Execute( SID_SET_SUPER_SCRIPT, SFX_CALLMODE_RECORD, &aSupItem, 0L ); 1031b9e67834SAndre Fischer } 1032b9e67834SAndre Fischer else if(TBI_SUB == nId) 1033b9e67834SAndre Fischer { 1034b9e67834SAndre Fischer 1035b9e67834SAndre Fischer mbSub = !mbSub; 1036b9e67834SAndre Fischer SfxBoolItem aSubItem(SID_SET_SUB_SCRIPT, mbSub ); 1037b9e67834SAndre Fischer mpBindings->GetDispatcher()->Execute( SID_SET_SUB_SCRIPT, SFX_CALLMODE_RECORD, &aSubItem, 0L ); 1038b9e67834SAndre Fischer } 1039b9e67834SAndre Fischer UpdateFontScript(); 1040b9e67834SAndre Fischer return 0; 1041b9e67834SAndre Fischer } 1042b9e67834SAndre Fischer 1043b9e67834SAndre Fischer 1044b9e67834SAndre Fischer 1045b9e67834SAndre Fischer 1046b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolBoxHighlightDropHdl, ToolBox*, pToolBox) 1047b9e67834SAndre Fischer { 1048b9e67834SAndre Fischer const sal_uInt16 nId = pToolBox->GetCurItemId(); 1049b9e67834SAndre Fischer if(nId == TBI_HIGHLIGHT) 1050b9e67834SAndre Fischer { 1051b9e67834SAndre Fischer meColorType = BACK_COLOR; 1052b9e67834SAndre Fischer 1053b9e67834SAndre Fischer pToolBox->SetItemDown( nId, true ); 1054d4aefcaeSZheng Fan maBrushColorPopup.Show(*pToolBox); 1055d4aefcaeSZheng Fan maBrushColorPopup.SetCurrentColor(maBackColor, mbBackColorAvailable); 1056b9e67834SAndre Fischer 1057b9e67834SAndre Fischer } 1058b9e67834SAndre Fischer return 0; 1059b9e67834SAndre Fischer } 1060b9e67834SAndre Fischer 1061b9e67834SAndre Fischer 1062b9e67834SAndre Fischer 1063b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, SpacingClickHdl, ToolBox*, pToolBox) 1064b9e67834SAndre Fischer { 1065b9e67834SAndre Fischer const sal_uInt16 nId = pToolBox->GetCurItemId(); 1066d4aefcaeSZheng Fan OSL_ASSERT(nId == TBI_SPACING); 1067b9e67834SAndre Fischer if(nId == TBI_SPACING) 1068b9e67834SAndre Fischer { 1069b9e67834SAndre Fischer pToolBox->SetItemDown( nId, true ); 1070d4aefcaeSZheng Fan maCharSpacePopup.Rearrange(mbKernLBAvailable,mbKernAvailable,mlKerning); 1071d4aefcaeSZheng Fan maCharSpacePopup.Show(*pToolBox); 1072b9e67834SAndre Fischer 1073b9e67834SAndre Fischer } 1074d4aefcaeSZheng Fan return 0L; 1075b9e67834SAndre Fischer } 1076b9e67834SAndre Fischer 1077b9e67834SAndre Fischer 1078b9e67834SAndre Fischer 1079b9e67834SAndre Fischer 1080b9e67834SAndre Fischer IMPL_LINK( TextPropertyPanel, ImplPopupModeEndHdl, FloatingWindow*, EMPTYARG ) 1081b9e67834SAndre Fischer { 1082b9e67834SAndre Fischer return 0; 1083b9e67834SAndre Fischer } 1084b9e67834SAndre Fischer 1085b9e67834SAndre Fischer 1086b9e67834SAndre Fischer 1087b9e67834SAndre Fischer 1088b9e67834SAndre Fischer 1089b9e67834SAndre Fischer 1090b9e67834SAndre Fischer 1091b9e67834SAndre Fischer 1092b9e67834SAndre Fischer void TextPropertyPanel::NotifyItemUpdate ( 1093b9e67834SAndre Fischer const sal_uInt16 nSID, 1094b9e67834SAndre Fischer const SfxItemState eState, 1095b9e67834SAndre Fischer const SfxPoolItem* pState) 1096b9e67834SAndre Fischer { 1097b9e67834SAndre Fischer switch(nSID) 1098b9e67834SAndre Fischer { 1099b9e67834SAndre Fischer case SID_ATTR_CHAR_FONT: 1100b9e67834SAndre Fischer if ( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxFontItem) ) 1101b9e67834SAndre Fischer { 1102b9e67834SAndre Fischer mpFontNameBox->Enable(); 1103b9e67834SAndre Fischer const SvxFontItem* pFontItem = (const SvxFontItem*)pState; 1104b9e67834SAndre Fischer mpFontNameBox->SetText( pFontItem->GetFamilyName() ); 1105b9e67834SAndre Fischer } 1106b9e67834SAndre Fischer else 1107b9e67834SAndre Fischer { 1108b9e67834SAndre Fischer mpFontNameBox->SetText( String() ); 1109b9e67834SAndre Fischer if (SFX_ITEM_DISABLED == eState) 1110b9e67834SAndre Fischer { 1111b9e67834SAndre Fischer mpFontNameBox->Disable(); 1112b9e67834SAndre Fischer } 1113b9e67834SAndre Fischer } 1114b9e67834SAndre Fischer break; 1115b9e67834SAndre Fischer case SID_ATTR_CHAR_FONTHEIGHT: 1116b9e67834SAndre Fischer if ( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxFontHeightItem) ) 1117b9e67834SAndre Fischer { 1118b9e67834SAndre Fischer mpHeightItem = (SvxFontHeightItem*)pState;//const SvxFontHeightItem* 1119b9e67834SAndre Fischer SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric(); 1120b9e67834SAndre Fischer long iValue = (long)CalcToPoint( mpHeightItem->GetHeight(), eUnit, 10 ); 1121b9e67834SAndre Fischer mpToolBoxIncDec->Enable(); 1122b9e67834SAndre Fischer 1123b9e67834SAndre Fischer // font size +/- enhancement in sd 1124b9e67834SAndre Fischer switch(maContext.GetCombinedContext()) 1125b9e67834SAndre Fischer { 1126b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_DrawText): 1127b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_Text): 1128b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_Table): 1129b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_OutlineText): 1130b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_Draw): 1131b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_TextObject): 1132b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_Graphic): 1133b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_DrawText): 1134b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_Text): 1135b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_Table): 1136b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_OutlineText): 1137b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_Draw): 1138b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_TextObject): 1139b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_Graphic): 1140b9e67834SAndre Fischer break; 1141b9e67834SAndre Fischer 1142b9e67834SAndre Fischer default: 1143b9e67834SAndre Fischer if(iValue > 60 && iValue < 960 ) 1144b9e67834SAndre Fischer { 1145b9e67834SAndre Fischer mpToolBoxIncDec->EnableItem(TBI_INCREASE,true); 1146b9e67834SAndre Fischer mpToolBoxIncDec->EnableItem(TBI_DECREASE,true); 1147b9e67834SAndre Fischer } 1148b9e67834SAndre Fischer else if (iValue <= 60) 1149b9e67834SAndre Fischer { 1150b9e67834SAndre Fischer mpToolBoxIncDec->EnableItem(TBI_INCREASE,true); 1151b9e67834SAndre Fischer mpToolBoxIncDec->EnableItem(TBI_DECREASE,false); 1152b9e67834SAndre Fischer } 1153b9e67834SAndre Fischer else if (iValue >= 960) 1154b9e67834SAndre Fischer { 1155b9e67834SAndre Fischer mpToolBoxIncDec->EnableItem(TBI_INCREASE,false); 1156b9e67834SAndre Fischer mpToolBoxIncDec->EnableItem(TBI_DECREASE,true); 1157b9e67834SAndre Fischer } 1158b9e67834SAndre Fischer } 1159b9e67834SAndre Fischer mpToolBoxIncDec->SetItemState(TBI_INCREASE, STATE_NOCHECK); 1160b9e67834SAndre Fischer mpToolBoxIncDec->SetItemState(TBI_DECREASE, STATE_NOCHECK); 1161b9e67834SAndre Fischer 1162b9e67834SAndre Fischer if( mbFocusOnFontSizeCtrl ) 1163b9e67834SAndre Fischer return; 1164b9e67834SAndre Fischer 1165b9e67834SAndre Fischer maFontSizeBox.Enable( ); 1166b9e67834SAndre Fischer maFontSizeBox.SetValue( iValue ); 1167b9e67834SAndre Fischer maFontSizeBox.LoseFocus(); 1168b9e67834SAndre Fischer } 1169b9e67834SAndre Fischer else 1170b9e67834SAndre Fischer { 1171b9e67834SAndre Fischer mpHeightItem = NULL; 1172b9e67834SAndre Fischer maFontSizeBox.SetText( String() ); 1173b9e67834SAndre Fischer //increase decrease diabled when multi-seletion have different font size 1174b9e67834SAndre Fischer 1175b9e67834SAndre Fischer // font size +/- enhancement in sd 1176b9e67834SAndre Fischer switch(maContext.GetCombinedContext()) 1177b9e67834SAndre Fischer { 1178b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_DrawText): 1179b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_Text): 1180b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_Table): 1181b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_OutlineText): 1182b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_Draw): 1183b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_TextObject): 1184b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_Graphic): 1185b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_DrawText): 1186b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_Text): 1187b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_Table): 1188b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_OutlineText): 1189b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_Draw): 1190b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_TextObject): 1191b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_Graphic): 1192b9e67834SAndre Fischer break; 1193b9e67834SAndre Fischer 1194b9e67834SAndre Fischer default: 1195b9e67834SAndre Fischer mpToolBoxIncDec->Disable(); 1196b9e67834SAndre Fischer } 1197b9e67834SAndre Fischer if ( eState <= SFX_ITEM_READONLY ) 1198b9e67834SAndre Fischer { 1199b9e67834SAndre Fischer maFontSizeBox.Disable( ); 1200b9e67834SAndre Fischer } 1201b9e67834SAndre Fischer } 1202b9e67834SAndre Fischer break; 1203b9e67834SAndre Fischer case SID_ATTR_CHAR_WEIGHT: 1204b9e67834SAndre Fischer mbWeightAvailable = (eState >= SFX_ITEM_DONTCARE); 1205b9e67834SAndre Fischer if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxWeightItem)) 1206b9e67834SAndre Fischer { 1207b9e67834SAndre Fischer const SvxWeightItem* pItem = (const SvxWeightItem*)pState; 1208b9e67834SAndre Fischer meWeight = (FontWeight)pItem->GetValue(); 1209b9e67834SAndre Fischer TextStyleChanged(); 1210b9e67834SAndre Fischer } 1211b9e67834SAndre Fischer else 1212b9e67834SAndre Fischer { 1213b9e67834SAndre Fischer meWeight = WEIGHT_NORMAL; 1214b9e67834SAndre Fischer TextStyleChanged(); 1215b9e67834SAndre Fischer } 1216b9e67834SAndre Fischer break; 1217b9e67834SAndre Fischer case SID_ATTR_CHAR_POSTURE: 1218b9e67834SAndre Fischer mbPostureAvailable = (eState >= SFX_ITEM_DONTCARE); 1219b9e67834SAndre Fischer if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxPostureItem)) 1220b9e67834SAndre Fischer { 1221b9e67834SAndre Fischer const SvxPostureItem* pItem = (const SvxPostureItem*)pState; 1222b9e67834SAndre Fischer meItalic = (FontItalic)pItem->GetValue(); 1223b9e67834SAndre Fischer TextStyleChanged(); 1224b9e67834SAndre Fischer } 1225b9e67834SAndre Fischer else 1226b9e67834SAndre Fischer { 1227b9e67834SAndre Fischer meItalic = ITALIC_NONE; 1228b9e67834SAndre Fischer TextStyleChanged(); 1229b9e67834SAndre Fischer } 1230b9e67834SAndre Fischer break; 1231b9e67834SAndre Fischer case SID_ATTR_CHAR_UNDERLINE: 1232b9e67834SAndre Fischer if( eState >= SFX_ITEM_DEFAULT) //SvxUnderlineItem 1233b9e67834SAndre Fischer { 1234b9e67834SAndre Fischer //<<delete 1235b9e67834SAndre Fischer //if(pState->ISA(SvxTextLineItem)) 1236b9e67834SAndre Fischer //{ 1237b9e67834SAndre Fischer // const SvxTextLineItem* pItem = (const SvxTextLineItem*)pState; 1238b9e67834SAndre Fischer // meUnderline = (FontUnderline)pItem->GetValue(); 1239b9e67834SAndre Fischer // //add , need to record the underline's color, if not the color will turn to auto 1240b9e67834SAndre Fischer // meUnderlineColor = pItem->GetColor(); 1241b9e67834SAndre Fischer // //add end 1242b9e67834SAndre Fischer //} 1243b9e67834SAndre Fischer //else 1244b9e67834SAndre Fischer //delete end>> 1245b9e67834SAndre Fischer if(pState->ISA(SvxUnderlineItem)) 1246b9e67834SAndre Fischer { 1247b9e67834SAndre Fischer const SvxUnderlineItem* pItem = (const SvxUnderlineItem*)pState; 1248b9e67834SAndre Fischer meUnderline = (FontUnderline)pItem->GetValue(); 1249b9e67834SAndre Fischer //add 1250b9e67834SAndre Fischer meUnderlineColor = pItem->GetColor(); 1251b9e67834SAndre Fischer //add end 1252b9e67834SAndre Fischer } 1253b9e67834SAndre Fischer TextStyleChanged(); 1254b9e67834SAndre Fischer } 1255b9e67834SAndre Fischer else 1256b9e67834SAndre Fischer { 1257b9e67834SAndre Fischer meUnderline = UNDERLINE_NONE; 1258b9e67834SAndre Fischer TextStyleChanged(); 1259b9e67834SAndre Fischer } 1260b9e67834SAndre Fischer break; 1261b9e67834SAndre Fischer case SID_ATTR_CHAR_SHADOWED: 1262b9e67834SAndre Fischer if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxShadowedItem)) 1263b9e67834SAndre Fischer { 1264b9e67834SAndre Fischer const SvxShadowedItem* pItem = (const SvxShadowedItem*)pState; 1265b9e67834SAndre Fischer mbShadow = pItem->GetValue(); 1266b9e67834SAndre Fischer TextStyleChanged(); 1267b9e67834SAndre Fischer } 1268b9e67834SAndre Fischer else 1269b9e67834SAndre Fischer { 1270b9e67834SAndre Fischer mbShadow = false; 1271b9e67834SAndre Fischer TextStyleChanged(); 1272b9e67834SAndre Fischer } 1273b9e67834SAndre Fischer break; 1274b9e67834SAndre Fischer case SID_ATTR_CHAR_STRIKEOUT: 1275b9e67834SAndre Fischer if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxCrossedOutItem)) 1276b9e67834SAndre Fischer { 1277b9e67834SAndre Fischer const SvxCrossedOutItem* pItem = (const SvxCrossedOutItem*)pState; 1278b9e67834SAndre Fischer meStrike = (FontStrikeout)pItem->GetValue(); 1279b9e67834SAndre Fischer 1280b9e67834SAndre Fischer TextStyleChanged(); 1281b9e67834SAndre Fischer } 1282b9e67834SAndre Fischer else 1283b9e67834SAndre Fischer { 1284b9e67834SAndre Fischer meStrike = STRIKEOUT_NONE; 1285b9e67834SAndre Fischer TextStyleChanged(); 1286b9e67834SAndre Fischer } 1287b9e67834SAndre Fischer break; 1288b9e67834SAndre Fischer case SID_ATTR_CHAR_COLOR: 1289b9e67834SAndre Fischer if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxColorItem)) 1290b9e67834SAndre Fischer { 1291d4aefcaeSZheng Fan const SvxColorItem* pItem = (const SvxColorItem*)pState; 1292d4aefcaeSZheng Fan maColor = pItem->GetValue(); 1293b9e67834SAndre Fischer mbColorAvailable = true; 129495a18594SAndre Fischer if (mpFontColorUpdater) 1295b9e67834SAndre Fischer mpFontColorUpdater->Update(maColor); 1296b9e67834SAndre Fischer } 1297b9e67834SAndre Fischer else 1298b9e67834SAndre Fischer { 1299b9e67834SAndre Fischer mbColorAvailable = false; 1300b9e67834SAndre Fischer maColor.SetColor(COL_AUTO); 130195a18594SAndre Fischer if (mpFontColorUpdater) 1302b9e67834SAndre Fischer mpFontColorUpdater->Update(maColor); 1303b9e67834SAndre Fischer } 1304b9e67834SAndre Fischer break; 1305b9e67834SAndre Fischer case SID_ATTR_BRUSH_CHAR: 1306b9e67834SAndre Fischer if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxBrushItem)) 1307b9e67834SAndre Fischer { 1308b9e67834SAndre Fischer const SvxBrushItem* pItem = (const SvxBrushItem*)pState; 1309b9e67834SAndre Fischer maBackColor = pItem->GetColor(); 1310b9e67834SAndre Fischer mbBackColorAvailable = true; 13117a32b0c8SAndre Fischer if (mpHighlightUpdater) 1312b9e67834SAndre Fischer mpHighlightUpdater->Update(maBackColor); 1313b9e67834SAndre Fischer } 1314b9e67834SAndre Fischer else 1315b9e67834SAndre Fischer { 1316b9e67834SAndre Fischer mbBackColorAvailable = false; 1317b9e67834SAndre Fischer maBackColor.SetColor(COL_AUTO); 13187a32b0c8SAndre Fischer if (mpHighlightUpdater) 1319b9e67834SAndre Fischer mpHighlightUpdater->Update(maBackColor); 1320b9e67834SAndre Fischer } 1321b9e67834SAndre Fischer break; 1322b9e67834SAndre Fischer case SID_ATTR_CHAR_ESCAPEMENT: 1323b9e67834SAndre Fischer if( eState == SFX_ITEM_AVAILABLE) 1324b9e67834SAndre Fischer { 1325b9e67834SAndre Fischer if( pState->ISA(SvxEscapementItem)) 1326b9e67834SAndre Fischer { 1327b9e67834SAndre Fischer const SvxEscapementItem* pItem = (const SvxEscapementItem *)pState; 1328b9e67834SAndre Fischer short nEsc = pItem->GetEsc(); 1329b9e67834SAndre Fischer if(nEsc == 0) 1330b9e67834SAndre Fischer meEscape = SVX_ESCAPEMENT_OFF; 1331b9e67834SAndre Fischer else if(nEsc > 0) 1332b9e67834SAndre Fischer meEscape = SVX_ESCAPEMENT_SUPERSCRIPT; 1333b9e67834SAndre Fischer else 1334b9e67834SAndre Fischer meEscape = SVX_ESCAPEMENT_SUBSCRIPT; 1335b9e67834SAndre Fischer } 1336b9e67834SAndre Fischer else 1337b9e67834SAndre Fischer { 1338b9e67834SAndre Fischer meEscape = SVX_ESCAPEMENT_OFF; 1339b9e67834SAndre Fischer } 1340b9e67834SAndre Fischer TextStyleChanged(); 1341b9e67834SAndre Fischer } 1342b9e67834SAndre Fischer else if(eState == SFX_ITEM_DISABLED) 1343b9e67834SAndre Fischer { 1344b9e67834SAndre Fischer mpToolBoxScriptSw->EnableItem(TBI_SUPER,false); 1345b9e67834SAndre Fischer mpToolBoxScriptSw->EnableItem(TBI_SUB,false); 1346b9e67834SAndre Fischer } 1347b9e67834SAndre Fischer else 1348b9e67834SAndre Fischer { 1349b9e67834SAndre Fischer meEscape = SVX_ESCAPEMENT_OFF; 1350b9e67834SAndre Fischer TextStyleChanged(); 1351b9e67834SAndre Fischer } 1352b9e67834SAndre Fischer break; 1353b9e67834SAndre Fischer case SID_SET_SUB_SCRIPT: 1354b9e67834SAndre Fischer if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SfxBoolItem)) 1355b9e67834SAndre Fischer { 1356b9e67834SAndre Fischer const SfxBoolItem* pItem = (const SfxBoolItem*)pState; 1357b9e67834SAndre Fischer mbSub = pItem->GetValue(); 1358b9e67834SAndre Fischer TextStyleChanged(); 1359b9e67834SAndre Fischer } 1360b9e67834SAndre Fischer else 1361b9e67834SAndre Fischer { 1362b9e67834SAndre Fischer mbSub = false; 1363b9e67834SAndre Fischer TextStyleChanged(); 1364b9e67834SAndre Fischer } 1365b9e67834SAndre Fischer break; 1366b9e67834SAndre Fischer case SID_SET_SUPER_SCRIPT: 1367b9e67834SAndre Fischer if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SfxBoolItem)) 1368b9e67834SAndre Fischer { 1369b9e67834SAndre Fischer const SfxBoolItem* pItem = (const SfxBoolItem*)pState; 1370b9e67834SAndre Fischer mbSuper = pItem->GetValue(); 1371b9e67834SAndre Fischer TextStyleChanged(); 1372b9e67834SAndre Fischer } 1373b9e67834SAndre Fischer else 1374b9e67834SAndre Fischer { 1375b9e67834SAndre Fischer mbSuper = false; 1376b9e67834SAndre Fischer TextStyleChanged(); 1377b9e67834SAndre Fischer } 1378b9e67834SAndre Fischer break; 1379b9e67834SAndre Fischer case SID_ATTR_CHAR_KERNING: 1380b9e67834SAndre Fischer if ( SFX_ITEM_AVAILABLE == eState ) 1381b9e67834SAndre Fischer { 1382b9e67834SAndre Fischer mbKernLBAvailable = true; 1383b9e67834SAndre Fischer 1384b9e67834SAndre Fischer if(pState->ISA(SvxKerningItem)) 1385b9e67834SAndre Fischer { 1386b9e67834SAndre Fischer const SvxKerningItem* pKerningItem = (const SvxKerningItem*)pState; 1387b9e67834SAndre Fischer mlKerning = (long)pKerningItem->GetValue(); 1388b9e67834SAndre Fischer mbKernAvailable = true; 1389b9e67834SAndre Fischer } 1390b9e67834SAndre Fischer else 1391b9e67834SAndre Fischer { 1392b9e67834SAndre Fischer mlKerning = 0; 1393b9e67834SAndre Fischer mbKernAvailable =false; 1394b9e67834SAndre Fischer } 1395b9e67834SAndre Fischer } 1396b9e67834SAndre Fischer else if (SFX_ITEM_DISABLED == eState) 1397b9e67834SAndre Fischer { 1398b9e67834SAndre Fischer mbKernLBAvailable = false; 1399b9e67834SAndre Fischer mbKernAvailable = false; 1400b9e67834SAndre Fischer mlKerning = 0; 1401b9e67834SAndre Fischer } 1402b9e67834SAndre Fischer else 1403b9e67834SAndre Fischer { 1404b9e67834SAndre Fischer mbKernLBAvailable = true; 1405b9e67834SAndre Fischer mbKernAvailable = false; 1406b9e67834SAndre Fischer mlKerning = 0; 1407b9e67834SAndre Fischer } 1408b9e67834SAndre Fischer break; 1409b9e67834SAndre Fischer 1410b9e67834SAndre Fischer // font size +/- enhancement in sd 1411b9e67834SAndre Fischer case SID_SHRINK_FONT_SIZE: 1412b9e67834SAndre Fischer case SID_GROW_FONT_SIZE: 1413b9e67834SAndre Fischer switch(maContext.GetCombinedContext()) 1414b9e67834SAndre Fischer { 1415b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_DrawText): 1416b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_Text): 1417b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_Table): 1418b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_OutlineText): 1419b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_Draw): 1420b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_TextObject): 1421b9e67834SAndre Fischer case CombinedEnumContext(Application_Draw, Context_Graphic): 1422b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_DrawText): 1423b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_Text): 1424b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_Table): 1425b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_OutlineText): 1426b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_Draw): 1427b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_TextObject): 1428b9e67834SAndre Fischer case CombinedEnumContext(Application_Impress, Context_Graphic): 1429b9e67834SAndre Fischer if(eState == SFX_ITEM_DISABLED) 1430b9e67834SAndre Fischer { 1431b9e67834SAndre Fischer mpToolBoxIncDec->Disable(); 1432b9e67834SAndre Fischer } 1433b9e67834SAndre Fischer else 1434b9e67834SAndre Fischer { 1435b9e67834SAndre Fischer mpToolBoxIncDec->Enable(); 1436b9e67834SAndre Fischer } 1437b9e67834SAndre Fischer break; 1438b9e67834SAndre Fischer } 1439b9e67834SAndre Fischer break; 1440b9e67834SAndre Fischer } 1441b9e67834SAndre Fischer } 1442b9e67834SAndre Fischer 1443b9e67834SAndre Fischer 1444b9e67834SAndre Fischer 1445b9e67834SAndre Fischer 1446b9e67834SAndre Fischer void TextPropertyPanel::TextStyleChanged() 1447b9e67834SAndre Fischer { 1448b9e67834SAndre Fischer if( !mbWeightAvailable ) 1449b9e67834SAndre Fischer mpToolBoxFont->EnableItem(TBI_BOLD,false); 1450b9e67834SAndre Fischer else 1451b9e67834SAndre Fischer mpToolBoxFont->EnableItem(TBI_BOLD,true); 1452b9e67834SAndre Fischer 1453b9e67834SAndre Fischer if(!mbPostureAvailable ) 1454b9e67834SAndre Fischer mpToolBoxFont->EnableItem(TBI_ITALIC,false); 1455b9e67834SAndre Fischer else 1456b9e67834SAndre Fischer mpToolBoxFont->EnableItem(TBI_ITALIC,true); 1457b9e67834SAndre Fischer 1458b9e67834SAndre Fischer UpdateFontBold(); 1459b9e67834SAndre Fischer UpdateFontItalic(); 1460b9e67834SAndre Fischer UpdateFontUnderline(); 1461b9e67834SAndre Fischer UpdateFontStrikeOut(); 1462b9e67834SAndre Fischer UpdateFontShadowed(); 1463b9e67834SAndre Fischer UpdateFontScript(); 1464b9e67834SAndre Fischer } 1465b9e67834SAndre Fischer 1466b9e67834SAndre Fischer 1467b9e67834SAndre Fischer 1468b9e67834SAndre Fischer 1469b9e67834SAndre Fischer void TextPropertyPanel::UpdateFontBold() 1470b9e67834SAndre Fischer { 1471b9e67834SAndre Fischer if( meWeight == WEIGHT_BOLD ) 1472b9e67834SAndre Fischer { 1473b9e67834SAndre Fischer mpToolBoxFont->SetItemState(TBI_BOLD, STATE_CHECK); 1474b9e67834SAndre Fischer } 1475b9e67834SAndre Fischer else 1476b9e67834SAndre Fischer { 1477b9e67834SAndre Fischer mpToolBoxFont->SetItemState(TBI_BOLD, STATE_NOCHECK); 1478b9e67834SAndre Fischer } 1479b9e67834SAndre Fischer } 1480b9e67834SAndre Fischer void TextPropertyPanel::UpdateFontItalic() 1481b9e67834SAndre Fischer { 1482b9e67834SAndre Fischer if(meItalic == ITALIC_NORMAL) 1483b9e67834SAndre Fischer { 1484b9e67834SAndre Fischer mpToolBoxFont->SetItemState(TBI_ITALIC, STATE_CHECK); 1485b9e67834SAndre Fischer } 1486b9e67834SAndre Fischer else 1487b9e67834SAndre Fischer { 1488b9e67834SAndre Fischer mpToolBoxFont->SetItemState(TBI_ITALIC, STATE_NOCHECK); 1489b9e67834SAndre Fischer } 1490b9e67834SAndre Fischer } 1491b9e67834SAndre Fischer void TextPropertyPanel::UpdateFontUnderline() 1492b9e67834SAndre Fischer { 1493b9e67834SAndre Fischer if(meUnderline == UNDERLINE_NONE) 1494b9e67834SAndre Fischer { 1495b9e67834SAndre Fischer mpToolBoxFont->SetItemState(TBI_UNDERLINE, STATE_NOCHECK); 1496b9e67834SAndre Fischer } 1497b9e67834SAndre Fischer else 1498b9e67834SAndre Fischer { 1499b9e67834SAndre Fischer mpToolBoxFont->SetItemState(TBI_UNDERLINE, STATE_CHECK); 1500b9e67834SAndre Fischer } 1501b9e67834SAndre Fischer } 1502b9e67834SAndre Fischer void TextPropertyPanel::UpdateFontStrikeOut() 1503b9e67834SAndre Fischer { 1504b9e67834SAndre Fischer if(meStrike != STRIKEOUT_NONE && meStrike != STRIKEOUT_DONTKNOW) 1505b9e67834SAndre Fischer { 1506b9e67834SAndre Fischer mpToolBoxFont->SetItemState(TBI_STRIKEOUT, STATE_CHECK); 1507b9e67834SAndre Fischer } 1508b9e67834SAndre Fischer else 1509b9e67834SAndre Fischer { 1510b9e67834SAndre Fischer mpToolBoxFont->SetItemState(TBI_STRIKEOUT, STATE_NOCHECK); 1511b9e67834SAndre Fischer } 1512b9e67834SAndre Fischer } 1513b9e67834SAndre Fischer void TextPropertyPanel::UpdateFontShadowed() 1514b9e67834SAndre Fischer { 1515b9e67834SAndre Fischer if(mbShadow) 1516b9e67834SAndre Fischer { 1517b9e67834SAndre Fischer mpToolBoxFont->SetItemState(TBI_SHADOWED, STATE_CHECK); 1518b9e67834SAndre Fischer } 1519b9e67834SAndre Fischer else 1520b9e67834SAndre Fischer { 1521b9e67834SAndre Fischer mpToolBoxFont->SetItemState(TBI_SHADOWED, STATE_NOCHECK); 1522b9e67834SAndre Fischer } 1523b9e67834SAndre Fischer } 1524b9e67834SAndre Fischer void TextPropertyPanel::UpdateFontScript() 1525b9e67834SAndre Fischer { 1526b9e67834SAndre Fischer //script for sw 1527b9e67834SAndre Fischer mpToolBoxScriptSw->EnableItem(TBI_SUPER,true); 1528b9e67834SAndre Fischer mpToolBoxScriptSw->EnableItem(TBI_SUB,true); 1529b9e67834SAndre Fischer if(meEscape == SVX_ESCAPEMENT_SUPERSCRIPT) 1530b9e67834SAndre Fischer { 1531b9e67834SAndre Fischer mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_CHECK); 1532b9e67834SAndre Fischer mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_NOCHECK); 1533b9e67834SAndre Fischer } 1534b9e67834SAndre Fischer else if(meEscape == SVX_ESCAPEMENT_SUBSCRIPT) 1535b9e67834SAndre Fischer { 1536b9e67834SAndre Fischer mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_NOCHECK); 1537b9e67834SAndre Fischer mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_CHECK); 1538b9e67834SAndre Fischer } 1539b9e67834SAndre Fischer else 1540b9e67834SAndre Fischer { 1541b9e67834SAndre Fischer mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_NOCHECK); 1542b9e67834SAndre Fischer mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_NOCHECK); 1543b9e67834SAndre Fischer } 1544b9e67834SAndre Fischer 1545b9e67834SAndre Fischer //script for sc sd 1546b9e67834SAndre Fischer mpToolBoxScript->EnableItem(TBI_SUPER,true); 1547b9e67834SAndre Fischer mpToolBoxScript->EnableItem(TBI_SUB,true); 1548b9e67834SAndre Fischer if(mbSuper) 1549b9e67834SAndre Fischer { 1550b9e67834SAndre Fischer mpToolBoxScript->SetItemState(TBI_SUPER, STATE_CHECK); 1551b9e67834SAndre Fischer mpToolBoxScript->SetItemState(TBI_SUB, STATE_NOCHECK); 1552b9e67834SAndre Fischer } 1553b9e67834SAndre Fischer else if(mbSub) 1554b9e67834SAndre Fischer { 1555b9e67834SAndre Fischer mpToolBoxScript->SetItemState(TBI_SUPER, STATE_NOCHECK); 1556b9e67834SAndre Fischer mpToolBoxScript->SetItemState(TBI_SUB, STATE_CHECK); 1557b9e67834SAndre Fischer } 1558b9e67834SAndre Fischer else 1559b9e67834SAndre Fischer { 1560b9e67834SAndre Fischer mpToolBoxScript->SetItemState(TBI_SUPER, STATE_NOCHECK); 1561b9e67834SAndre Fischer mpToolBoxScript->SetItemState(TBI_SUB, STATE_NOCHECK); 1562b9e67834SAndre Fischer } 1563b9e67834SAndre Fischer } 1564b9e67834SAndre Fischer 1565d4aefcaeSZheng Fan void TextPropertyPanel::SetFontColor ( 1566a7d1eb6fSPavel Janík const String& /* rsColorName */, 1567d4aefcaeSZheng Fan const Color aColor) 1568d4aefcaeSZheng Fan { 1569d4aefcaeSZheng Fan SvxColorItem aColorItem(aColor, SID_ATTR_CHAR_COLOR); 1570d4aefcaeSZheng Fan mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_COLOR, SFX_CALLMODE_RECORD, &aColorItem, 0L); 1571d4aefcaeSZheng Fan maColor = aColor; 1572d4aefcaeSZheng Fan } 1573d4aefcaeSZheng Fan 1574d4aefcaeSZheng Fan void TextPropertyPanel::SetBrushColor ( 1575a7d1eb6fSPavel Janík const String& /* rsColorName */, 1576d4aefcaeSZheng Fan const Color aColor) 1577d4aefcaeSZheng Fan { 1578d4aefcaeSZheng Fan SvxBrushItem aBrushItem(aColor, SID_ATTR_BRUSH_CHAR); 1579d4aefcaeSZheng Fan mpBindings->GetDispatcher()->Execute(SID_ATTR_BRUSH_CHAR, SFX_CALLMODE_RECORD, &aBrushItem, 0L); 1580d4aefcaeSZheng Fan maBackColor = aColor; 1581d4aefcaeSZheng Fan } 1582d4aefcaeSZheng Fan 1583da72173fSAndre Fischer Color& TextPropertyPanel::GetUnderlineColor() 1584da72173fSAndre Fischer { 1585da72173fSAndre Fischer return meUnderlineColor; 1586da72173fSAndre Fischer } 1587d4aefcaeSZheng Fan 1588da72173fSAndre Fischer void TextPropertyPanel::SetUnderline(FontUnderline eUnderline) 1589da72173fSAndre Fischer { 1590da72173fSAndre Fischer meUnderline = eUnderline; 1591da72173fSAndre Fischer } 1592d4aefcaeSZheng Fan 1593b9e67834SAndre Fischer } } // end of namespace svx::sidebar 1594