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