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