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