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