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