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