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