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