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