1b9e67834SAndre Fischer /**************************************************************
2b9e67834SAndre Fischer  *
3b9e67834SAndre Fischer  * Licensed to the Apache Software Foundation (ASF) under one
4b9e67834SAndre Fischer  * or more contributor license agreements.  See the NOTICE file
5b9e67834SAndre Fischer  * distributed with this work for additional information
6b9e67834SAndre Fischer  * regarding copyright ownership.  The ASF licenses this file
7b9e67834SAndre Fischer  * to you under the Apache License, Version 2.0 (the
8b9e67834SAndre Fischer  * "License"); you may not use this file except in compliance
9b9e67834SAndre Fischer  * with the License.  You may obtain a copy of the License at
10b9e67834SAndre Fischer  *
11b9e67834SAndre Fischer  *   http://www.apache.org/licenses/LICENSE-2.0
12b9e67834SAndre Fischer  *
13b9e67834SAndre Fischer  * Unless required by applicable law or agreed to in writing,
14b9e67834SAndre Fischer  * software distributed under the License is distributed on an
15b9e67834SAndre Fischer  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16b9e67834SAndre Fischer  * KIND, either express or implied.  See the License for the
17b9e67834SAndre Fischer  * specific language governing permissions and limitations
18b9e67834SAndre Fischer  * under the License.
19b9e67834SAndre Fischer  *
20b9e67834SAndre Fischer  *************************************************************/
21b9e67834SAndre Fischer 
22b9e67834SAndre Fischer #include "precompiled_svx.hxx"
23b9e67834SAndre Fischer 
24b9e67834SAndre Fischer #include "TextPropertyPanel.hrc"
25b9e67834SAndre Fischer #include "TextPropertyPanel.hxx"
26b9e67834SAndre Fischer #include "SvxSBFontNameBox.hxx"
27b9e67834SAndre Fischer 
28b9e67834SAndre Fischer #include "svx/dialmgr.hxx"
29b9e67834SAndre Fischer 
30b9e67834SAndre Fischer #include <editeng/brshitem.hxx>
31b9e67834SAndre Fischer #include <editeng/colritem.hxx>
32b9e67834SAndre Fischer #include <editeng/crsditem.hxx>
33b9e67834SAndre Fischer #include <editeng/escpitem.hxx>
34b9e67834SAndre Fischer #include <editeng/flstitem.hxx>
35b9e67834SAndre Fischer #include <editeng/fontitem.hxx>
36b9e67834SAndre Fischer #include <editeng/kernitem.hxx>
37b9e67834SAndre Fischer #include <editeng/postitem.hxx>
38b9e67834SAndre Fischer #include <editeng/shdditem.hxx>
39b9e67834SAndre Fischer #include <editeng/udlnitem.hxx>
40b9e67834SAndre Fischer #include <editeng/wghtitem.hxx>
41b9e67834SAndre Fischer #include <rtl/ref.hxx>
42b9e67834SAndre Fischer #include <sfx2/dispatch.hxx>
43b9e67834SAndre Fischer #include <sfx2/objsh.hxx>
44b9e67834SAndre Fischer #include <sfx2/viewsh.hxx>
45b9e67834SAndre Fischer #include <sfx2/sidebar/propertypanel.hrc>
46b9e67834SAndre Fischer #include <sfx2/sidebar/ControlFactory.hxx>
47b9e67834SAndre Fischer #include <sfx2/sidebar/Theme.hxx>
4895a18594SAndre Fischer #include "sfx2/imagemgr.hxx"
49b9e67834SAndre Fischer #include <svtools/ctrltool.hxx>
50b9e67834SAndre Fischer #include <svtools/unitconv.hxx>
51b9e67834SAndre Fischer 
52b9e67834SAndre Fischer #include <vcl/gradient.hxx>
53b9e67834SAndre Fischer #include <vcl/svapp.hxx>
5495a18594SAndre Fischer #include <vcl/toolbox.hxx>
55d4aefcaeSZheng Fan #include "TextCharacterSpacingControl.hxx"
56d4aefcaeSZheng Fan #include "TextCharacterSpacingPopup.hxx"
57d4aefcaeSZheng Fan #include "TextUnderlineControl.hxx"
58d4aefcaeSZheng Fan #include "TextUnderlinePopup.hxx"
59facb16e7SArmin Le Grand #include <svx/sidebar/ColorControl.hxx>
60facb16e7SArmin Le Grand #include <svx/sidebar/PopupContainer.hxx>
61d4aefcaeSZheng Fan 
62d4aefcaeSZheng Fan #include <boost/bind.hpp>
63b9e67834SAndre Fischer 
64b9e67834SAndre Fischer using namespace css;
65b9e67834SAndre Fischer using namespace cssu;
66b9e67834SAndre Fischer using ::sfx2::sidebar::Theme;
677a32b0c8SAndre Fischer using ::sfx2::sidebar::ControlFactory;
68b9e67834SAndre Fischer 
69b9e67834SAndre Fischer #define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
70b9e67834SAndre Fischer 
71b9e67834SAndre Fischer namespace svx { namespace sidebar {
72b9e67834SAndre Fischer 
73b9e67834SAndre Fischer #undef HAS_IA2
74b9e67834SAndre Fischer 
75b9e67834SAndre Fischer 
76b9e67834SAndre Fischer #define FONT_CONTROL_WIDTH 		160
77b9e67834SAndre Fischer #define SIZE_CONTROL_WIDTH 		80
78b9e67834SAndre Fischer #define CONTROL_COMBOX_HEIGHT	20
79b9e67834SAndre Fischer #define CONTROL_HEIGHT_5X  		120
80d4aefcaeSZheng Fan 
81d4aefcaeSZheng Fan 
82b9e67834SAndre Fischer #define TEXT_SECTIONPAGE_HEIGHT_S   SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT  + ( TOOLBOX_ITEM_HEIGHT + 2 ) + CONTROL_SPACING_VERTICAL * 1 + SECTIONPAGE_MARGIN_VERTICAL_BOT
83b9e67834SAndre Fischer #define TEXT_SECTIONPAGE_HEIGHT		SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT  + ( TOOLBOX_ITEM_HEIGHT + 2 ) * 2 + CONTROL_SPACING_VERTICAL * 2 + SECTIONPAGE_MARGIN_VERTICAL_BOT
84b9e67834SAndre Fischer 
85b9e67834SAndre Fischer //
86d4aefcaeSZheng Fan 
87b9e67834SAndre Fischer //end
88d4aefcaeSZheng Fan PopupControl* TextPropertyPanel::CreateCharacterSpacingControl (PopupContainer* pParent)
89d4aefcaeSZheng Fan {
9045da7d5eSAndre Fischer     return new TextCharacterSpacingControl(pParent, *this, mpBindings);
91d4aefcaeSZheng Fan }
92b9e67834SAndre Fischer 
93d4aefcaeSZheng Fan PopupControl* TextPropertyPanel::CreateUnderlinePopupControl (PopupContainer* pParent)
94d4aefcaeSZheng Fan {
9545da7d5eSAndre Fischer 	return new TextUnderlineControl(pParent, *this, mpBindings);
96d4aefcaeSZheng Fan }
97b9e67834SAndre Fischer 
98b7a56e95SArmin Le Grand namespace
99b7a56e95SArmin Le Grand {
100b7a56e95SArmin Le Grand     Color GetAutomaticColor(void)
101b7a56e95SArmin Le Grand     {
102b7a56e95SArmin Le Grand         return COL_AUTO;
103b7a56e95SArmin Le Grand     }
104b7a56e95SArmin Le Grand } // end of anonymous namespace
105b7a56e95SArmin Le Grand 
106d4aefcaeSZheng Fan PopupControl* TextPropertyPanel::CreateFontColorPopupControl (PopupContainer* pParent)
107d4aefcaeSZheng Fan {
108b7a56e95SArmin Le Grand     const ResId aResId(SVX_RES(STR_AUTOMATICE));
109b7a56e95SArmin Le Grand 
110d4aefcaeSZheng Fan     return new ColorControl(
111d4aefcaeSZheng Fan         pParent,
112d4aefcaeSZheng Fan         mpBindings,
113d4aefcaeSZheng Fan         SVX_RES(RID_POPUPPANEL_TEXTPAGE_FONT_COLOR),
114d4aefcaeSZheng Fan         SVX_RES(VS_FONT_COLOR),
115b7a56e95SArmin Le Grand         ::boost::bind(GetAutomaticColor),
116d4aefcaeSZheng Fan         ::boost::bind(&TextPropertyPanel::SetFontColor, this, _1,_2),
117d4aefcaeSZheng Fan         pParent,
118b7a56e95SArmin Le Grand         &aResId);
119d4aefcaeSZheng Fan }
120d4aefcaeSZheng Fan 
121d4aefcaeSZheng Fan PopupControl* TextPropertyPanel::CreateBrushColorPopupControl (PopupContainer* pParent)
122d4aefcaeSZheng Fan {
123b7a56e95SArmin Le Grand     const ResId aResId(SVX_RES(STR_AUTOMATICE));
124b7a56e95SArmin Le Grand 
125d4aefcaeSZheng Fan     return new ColorControl(
126d4aefcaeSZheng Fan         pParent,
127d4aefcaeSZheng Fan         mpBindings,
128d4aefcaeSZheng Fan         SVX_RES(RID_POPUPPANEL_TEXTPAGE_FONT_COLOR),
129d4aefcaeSZheng Fan         SVX_RES(VS_FONT_COLOR),
130b7a56e95SArmin Le Grand         ::boost::bind(GetAutomaticColor),
131d4aefcaeSZheng Fan         ::boost::bind(&TextPropertyPanel::SetBrushColor, this, _1,_2),
132d4aefcaeSZheng Fan         pParent,
133b7a56e95SArmin Le Grand         &aResId);
134d4aefcaeSZheng Fan }
135b9e67834SAndre Fischer 
136d4aefcaeSZheng Fan long TextPropertyPanel::GetSelFontSize()
137d4aefcaeSZheng Fan {
138d4aefcaeSZheng Fan     long nH = 240;
139d4aefcaeSZheng Fan     SfxMapUnit eUnit = maSpacingControl.GetCoreMetric();
140d4aefcaeSZheng Fan     if (mpHeightItem)
141d4aefcaeSZheng Fan         nH = LogicToLogic(  mpHeightItem->GetHeight(), (MapUnit)eUnit, MAP_TWIP );
142d4aefcaeSZheng Fan     return nH;
143d4aefcaeSZheng Fan }
144b9e67834SAndre Fischer 
145b9e67834SAndre Fischer 
14695a18594SAndre Fischer TextPropertyPanel* TextPropertyPanel::Create (
147b9e67834SAndre Fischer     Window* pParent,
148b9e67834SAndre Fischer     const cssu::Reference<css::frame::XFrame>& rxFrame,
14937fee4fdSAndre Fischer     SfxBindings* pBindings,
15037fee4fdSAndre Fischer     const cssu::Reference<css::ui::XSidebar>& rxSidebar)
151b9e67834SAndre Fischer {
152b9e67834SAndre Fischer     if (pParent == NULL)
153b9e67834SAndre Fischer         throw lang::IllegalArgumentException(A2S("no parent Window given to TextPropertyPanel::Create"), NULL, 0);
154b9e67834SAndre Fischer     if ( ! rxFrame.is())
155b9e67834SAndre Fischer         throw lang::IllegalArgumentException(A2S("no XFrame given to TextPropertyPanel::Create"), NULL, 1);
156b9e67834SAndre Fischer     if (pBindings == NULL)
157b9e67834SAndre Fischer         throw lang::IllegalArgumentException(A2S("no SfxBindings given to TextPropertyPanel::Create"), NULL, 2);
158b9e67834SAndre Fischer 
15995a18594SAndre Fischer     return new TextPropertyPanel(
16095a18594SAndre Fischer         pParent,
16195a18594SAndre Fischer         rxFrame,
16237fee4fdSAndre Fischer         pBindings,
16337fee4fdSAndre Fischer         rxSidebar);
164b9e67834SAndre Fischer }
165b9e67834SAndre Fischer 
166b9e67834SAndre Fischer 
167d4aefcaeSZheng Fan ::sfx2::sidebar::ControllerItem& TextPropertyPanel::GetSpaceController()
168d4aefcaeSZheng Fan {
169d4aefcaeSZheng Fan 	return maSpacingControl;
170d4aefcaeSZheng Fan }
171b9e67834SAndre Fischer 
172b9e67834SAndre Fischer TextPropertyPanel::TextPropertyPanel (
173b9e67834SAndre Fischer     Window* pParent,
174b9e67834SAndre Fischer     const cssu::Reference<css::frame::XFrame>& rxFrame,
17537fee4fdSAndre Fischer     SfxBindings* pBindings,
17637fee4fdSAndre Fischer     const cssu::Reference<css::ui::XSidebar>& rxSidebar)
17795a18594SAndre Fischer     :	Control(pParent, SVX_RES(RID_SIDEBAR_TEXT_PANEL)),
178b9e67834SAndre Fischer         mpFontNameBox (new SvxSBFontNameBox(this, SVX_RES(CB_SBFONT_FONT))),
179b9e67834SAndre Fischer     	maFontSizeBox		(this, SVX_RES(MB_SBFONT_FONTSIZE)),
1807a32b0c8SAndre Fischer     	mpToolBoxIncDecBackground(ControlFactory::CreateToolBoxBackground(this)),
1817a32b0c8SAndre Fischer     	mpToolBoxIncDec(ControlFactory::CreateToolBox(
1827a32b0c8SAndre Fischer                 mpToolBoxIncDecBackground.get(),
1837a32b0c8SAndre Fischer                 SVX_RES(TB_INCREASE_DECREASE))),
1847a32b0c8SAndre Fischer         mpToolBoxFontBackground(ControlFactory::CreateToolBoxBackground(this)),
1857a32b0c8SAndre Fischer         mpToolBoxFont(ControlFactory::CreateToolBox(
1867a32b0c8SAndre Fischer                 mpToolBoxFontBackground.get(),
1877a32b0c8SAndre Fischer                 SVX_RES(TB_FONT))),
1887a32b0c8SAndre Fischer         mpToolBoxFontColorBackground(ControlFactory::CreateToolBoxBackground(this)),
1897a32b0c8SAndre Fischer         mpToolBoxFontColor(ControlFactory::CreateToolBox(
1907a32b0c8SAndre Fischer                 mpToolBoxFontColorBackground.get(),
1917a32b0c8SAndre Fischer                 SVX_RES(TB_FONTCOLOR))),
1927a32b0c8SAndre Fischer         mpToolBoxScriptBackground(ControlFactory::CreateToolBoxBackground(this)),
1937a32b0c8SAndre Fischer         mpToolBoxScript(ControlFactory::CreateToolBox(
1947a32b0c8SAndre Fischer                 mpToolBoxScriptBackground.get(),
1957a32b0c8SAndre Fischer                 SVX_RES(TB_SCRIPT))),
1967a32b0c8SAndre Fischer         mpToolBoxScriptSwBackground(ControlFactory::CreateToolBoxBackground(this)),
1977a32b0c8SAndre Fischer         mpToolBoxScriptSw(ControlFactory::CreateToolBox(
1987a32b0c8SAndre Fischer                 mpToolBoxScriptSwBackground.get(),
1997a32b0c8SAndre Fischer                 SVX_RES(TB_SCRIPT_SW))),
2007a32b0c8SAndre Fischer         mpToolBoxSpacingBackground(ControlFactory::CreateToolBoxBackground(this)),
2017a32b0c8SAndre Fischer         mpToolBoxSpacing(ControlFactory::CreateToolBox(
2027a32b0c8SAndre Fischer                 mpToolBoxSpacingBackground.get(),
2037a32b0c8SAndre Fischer                 SVX_RES(TB_SPACING))),
2047a32b0c8SAndre Fischer         mpToolBoxHighlightBackground(ControlFactory::CreateToolBoxBackground(this)),
2057a32b0c8SAndre Fischer         mpToolBoxHighlight(ControlFactory::CreateToolBox(
2067a32b0c8SAndre Fischer                 mpToolBoxHighlightBackground.get(),
2077a32b0c8SAndre Fischer                 SVX_RES(TB_HIGHLIGHT))),
208b9e67834SAndre Fischer         mpFontColorUpdater(),
209b9e67834SAndre Fischer         mpHighlightUpdater(),
210b9e67834SAndre Fischer 
21145da7d5eSAndre Fischer         maFontNameControl	(SID_ATTR_CHAR_FONT,		*pBindings, *this, A2S("CharFontName"), rxFrame),
21245da7d5eSAndre Fischer         maFontSizeControl	(SID_ATTR_CHAR_FONTHEIGHT,	*pBindings, *this, A2S("FontHeight"),   rxFrame),
21345da7d5eSAndre Fischer         maWeightControl		(SID_ATTR_CHAR_WEIGHT,		*pBindings, *this, A2S("Bold"),         rxFrame),
21445da7d5eSAndre Fischer         maItalicControl		(SID_ATTR_CHAR_POSTURE,		*pBindings, *this, A2S("Italic"),       rxFrame),
21545da7d5eSAndre Fischer         maUnderlineControl	(SID_ATTR_CHAR_UNDERLINE,	*pBindings, *this, A2S("Underline"),    rxFrame),
21645da7d5eSAndre Fischer         maStrikeControl		(SID_ATTR_CHAR_STRIKEOUT,	*pBindings, *this, A2S("Strikeout"),    rxFrame),
21745da7d5eSAndre Fischer         maShadowControl		(SID_ATTR_CHAR_SHADOWED,	*pBindings, *this, A2S("Shadowed"),     rxFrame),
21845da7d5eSAndre Fischer         maFontColorControl	(SID_ATTR_CHAR_COLOR,		*pBindings, *this, A2S("Color"),        rxFrame),
21945da7d5eSAndre Fischer         maScriptControlSw	(SID_ATTR_CHAR_ESCAPEMENT,	*pBindings, *this, A2S("Escapement"),   rxFrame),
22045da7d5eSAndre Fischer         maSuperScriptControl(SID_SET_SUPER_SCRIPT,		*pBindings, *this, A2S("SuperScript"),  rxFrame),
22145da7d5eSAndre Fischer         maSubScriptControl	(SID_SET_SUB_SCRIPT,		*pBindings, *this, A2S("SubScript"),    rxFrame),
22245da7d5eSAndre Fischer         maSpacingControl	(SID_ATTR_CHAR_KERNING,		*pBindings, *this, A2S("Spacing"),      rxFrame),
22345da7d5eSAndre Fischer         maHighlightControl	(SID_ATTR_BRUSH_CHAR, *pBindings, *this, A2S("CharacterBackgroundPattern"),rxFrame),
22445da7d5eSAndre Fischer         maSDFontGrow		(SID_GROW_FONT_SIZE,		*pBindings, *this, A2S("Grow"),         rxFrame),
22545da7d5eSAndre Fischer         maSDFontShrink		(SID_SHRINK_FONT_SIZE,		*pBindings, *this, A2S("Shrink"),       rxFrame),
226b9e67834SAndre Fischer 
227b9e67834SAndre Fischer         mpFontList			(NULL),
228b9e67834SAndre Fischer         mbMustDelete		(false),
229b9e67834SAndre Fischer         mbFocusOnFontSizeCtrl(false),
23045da7d5eSAndre Fischer         maCharSpacePopup(this, ::boost::bind(&TextPropertyPanel::CreateCharacterSpacingControl, this, _1)),
23145da7d5eSAndre Fischer         maUnderlinePopup(this, ::boost::bind(&TextPropertyPanel::CreateUnderlinePopupControl, this, _1)),
23245da7d5eSAndre Fischer         maFontColorPopup(this, ::boost::bind(&TextPropertyPanel::CreateFontColorPopupControl, this, _1)),
23345da7d5eSAndre Fischer         maBrushColorPopup(this, ::boost::bind(&TextPropertyPanel::CreateBrushColorPopupControl, this, _1)),
23495a18594SAndre Fischer         mxFrame(rxFrame),
235b9e67834SAndre Fischer         maContext(),
23637fee4fdSAndre Fischer         mpBindings(pBindings),
23737fee4fdSAndre Fischer         mxSidebar(rxSidebar)
238b9e67834SAndre Fischer {
239b9e67834SAndre Fischer 	Initialize();
240b9e67834SAndre Fischer 	FreeResource();
241b9e67834SAndre Fischer }
242b9e67834SAndre Fischer 
243b9e67834SAndre Fischer 
244b9e67834SAndre Fischer 
245b9e67834SAndre Fischer 
246b9e67834SAndre Fischer TextPropertyPanel::~TextPropertyPanel (void)
247b9e67834SAndre Fischer {
248b9e67834SAndre Fischer     if(mbMustDelete)
249b9e67834SAndre Fischer         delete mpFontList;
250b9e67834SAndre Fischer 
2517a32b0c8SAndre Fischer     // Destroy the toolbox windows.
2527a32b0c8SAndre Fischer     mpToolBoxIncDec.reset();
2537a32b0c8SAndre Fischer     mpToolBoxFont.reset();
2547a32b0c8SAndre Fischer     mpToolBoxFontColor.reset();
2557a32b0c8SAndre Fischer     mpToolBoxScript.reset();
2567a32b0c8SAndre Fischer     mpToolBoxScriptSw.reset();
2577a32b0c8SAndre Fischer     mpToolBoxSpacing.reset();
2587a32b0c8SAndre Fischer     mpToolBoxHighlight.reset();
2597a32b0c8SAndre Fischer 
2607a32b0c8SAndre Fischer     // Destroy the background windows of the toolboxes.
2617a32b0c8SAndre Fischer     mpToolBoxIncDecBackground.reset();
2627a32b0c8SAndre Fischer     mpToolBoxFontBackground.reset();
2637a32b0c8SAndre Fischer     mpToolBoxFontColorBackground.reset();
2647a32b0c8SAndre Fischer     mpToolBoxScriptBackground.reset();
2657a32b0c8SAndre Fischer     mpToolBoxScriptSwBackground.reset();
2667a32b0c8SAndre Fischer     mpToolBoxSpacingBackground.reset();
2677a32b0c8SAndre Fischer     mpToolBoxHighlightBackground.reset();
268b9e67834SAndre Fischer }
269b9e67834SAndre Fischer 
270b9e67834SAndre Fischer 
271b9e67834SAndre Fischer 
272b9e67834SAndre Fischer 
273d4aefcaeSZheng Fan void TextPropertyPanel::SetSpacing(long nKern)
274d4aefcaeSZheng Fan {
275d4aefcaeSZheng Fan 	mlKerning = nKern;
276d4aefcaeSZheng Fan }
27795a18594SAndre Fischer 
27895a18594SAndre Fischer 
279b9e67834SAndre Fischer void TextPropertyPanel::HandleContextChange (
280b9e67834SAndre Fischer     const ::sfx2::sidebar::EnumContext aContext)
281b9e67834SAndre Fischer {
282b9e67834SAndre Fischer     if (maContext == aContext)
283b9e67834SAndre Fischer     {
284b9e67834SAndre Fischer         // Nothing to do.
285b9e67834SAndre Fischer         return;
286b9e67834SAndre Fischer     }
287b9e67834SAndre Fischer 
288b9e67834SAndre Fischer     maContext = aContext;
28985f1aca2SAndre Fischer     switch (maContext.GetCombinedContext_DI()) //
290b9e67834SAndre Fischer     {
291b9e67834SAndre Fischer         case CombinedEnumContext(Application_Calc, Context_Cell):
292b9e67834SAndre Fischer         case CombinedEnumContext(Application_Calc, Context_Pivot):
293b9e67834SAndre Fischer         {
294b9e67834SAndre Fischer             mpToolBoxScript->Hide();
295b9e67834SAndre Fischer 		    mpToolBoxScriptSw->Hide();
296b9e67834SAndre Fischer             mpToolBoxSpacing->Hide();
297b9e67834SAndre Fischer             mpToolBoxHighlight->Hide();
298b9e67834SAndre Fischer 
299b9e67834SAndre Fischer             Size aSize(PROPERTYPAGE_WIDTH,TEXT_SECTIONPAGE_HEIGHT_S);
300b9e67834SAndre Fischer             aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) );
301b9e67834SAndre Fischer             aSize.setWidth(GetOutputSizePixel().Width());
302b9e67834SAndre Fischer             SetSizePixel(aSize);
30337fee4fdSAndre Fischer             if (mxSidebar.is())
30437fee4fdSAndre Fischer                 mxSidebar->requestLayout();
305b9e67834SAndre Fischer             break;
306b9e67834SAndre Fischer         }
307b9e67834SAndre Fischer 
30885f1aca2SAndre Fischer         case CombinedEnumContext(Application_WriterVariants, Context_Text):
30985f1aca2SAndre Fischer         case CombinedEnumContext(Application_WriterVariants, Context_Table):
310b9e67834SAndre Fischer         {
311b9e67834SAndre Fischer             mpToolBoxScriptSw->Show();
312b9e67834SAndre Fischer             mpToolBoxScript->Hide();
313b9e67834SAndre Fischer             mpToolBoxHighlight->Show();
314b9e67834SAndre Fischer             mpToolBoxSpacing->Show();
315b9e67834SAndre Fischer 
316b9e67834SAndre Fischer             Size aSize(PROPERTYPAGE_WIDTH, TEXT_SECTIONPAGE_HEIGHT);
317b9e67834SAndre Fischer             aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) );
318b9e67834SAndre Fischer             aSize.setWidth(GetOutputSizePixel().Width());
319b9e67834SAndre Fischer             SetSizePixel(aSize);
32037fee4fdSAndre Fischer             if (mxSidebar.is())
32137fee4fdSAndre Fischer                 mxSidebar->requestLayout();
322b9e67834SAndre Fischer             break;
323b9e67834SAndre Fischer         }
324b9e67834SAndre Fischer 
32585f1aca2SAndre Fischer         case CombinedEnumContext(Application_WriterVariants, Context_DrawText):
32685f1aca2SAndre Fischer         case CombinedEnumContext(Application_WriterVariants, Context_Annotation):
327b9e67834SAndre Fischer         {
328b9e67834SAndre Fischer             mpToolBoxScriptSw->Show();
329b9e67834SAndre Fischer             mpToolBoxScript->Hide();
330b9e67834SAndre Fischer             mpToolBoxSpacing->Show();
331b9e67834SAndre Fischer             mpToolBoxHighlight->Hide();
332b9e67834SAndre Fischer 
333b9e67834SAndre Fischer             Size aSize(PROPERTYPAGE_WIDTH,TEXT_SECTIONPAGE_HEIGHT);
334b9e67834SAndre Fischer             aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) );
335b9e67834SAndre Fischer             aSize.setWidth(GetOutputSizePixel().Width());
336b9e67834SAndre Fischer             SetSizePixel(aSize);
33737fee4fdSAndre Fischer             if (mxSidebar.is())
33837fee4fdSAndre Fischer                 mxSidebar->requestLayout();
339b9e67834SAndre Fischer             break;
340b9e67834SAndre Fischer         }
341b9e67834SAndre Fischer 
342b9e67834SAndre Fischer         case CombinedEnumContext(Application_Calc, Context_EditCell):
343b9e67834SAndre Fischer         case CombinedEnumContext(Application_Calc, Context_DrawText):
34437fee4fdSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
34537fee4fdSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_Text):
34637fee4fdSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_Table):
34737fee4fdSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_OutlineText):
34837fee4fdSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_Draw):
34937fee4fdSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
35037fee4fdSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
351b9e67834SAndre Fischer         {
352b9e67834SAndre Fischer             mpToolBoxScriptSw->Hide();
353b9e67834SAndre Fischer             mpToolBoxScript->Show();
354b9e67834SAndre Fischer             mpToolBoxSpacing->Show();
355b9e67834SAndre Fischer             mpToolBoxHighlight->Hide();
356b9e67834SAndre Fischer 
357b9e67834SAndre Fischer             Size aSize(PROPERTYPAGE_WIDTH,TEXT_SECTIONPAGE_HEIGHT);
358b9e67834SAndre Fischer             aSize = LogicToPixel( aSize,MapMode(MAP_APPFONT) );
359b9e67834SAndre Fischer             aSize.setWidth(GetOutputSizePixel().Width());
360b9e67834SAndre Fischer             SetSizePixel(aSize);
36137fee4fdSAndre Fischer             if (mxSidebar.is())
36237fee4fdSAndre Fischer                 mxSidebar->requestLayout();
363b9e67834SAndre Fischer             break;
364b9e67834SAndre Fischer         }
365b9e67834SAndre Fischer 
366b9e67834SAndre Fischer         default:
367b9e67834SAndre Fischer             break;
368b9e67834SAndre Fischer     }
369b9e67834SAndre Fischer }
370b9e67834SAndre Fischer 
37145da7d5eSAndre Fischer 
372b9e67834SAndre Fischer 
373b9e67834SAndre Fischer 
374b9e67834SAndre Fischer void TextPropertyPanel::DataChanged (const DataChangedEvent& rEvent)
375b9e67834SAndre Fischer {
37695a18594SAndre Fischer     (void)rEvent;
37795a18594SAndre Fischer 
37845da7d5eSAndre Fischer     SetupToolboxItems();
379b9e67834SAndre Fischer }
380b9e67834SAndre Fischer 
381b9e67834SAndre Fischer 
382b9e67834SAndre Fischer 
383b9e67834SAndre Fischer void TextPropertyPanel::Initialize (void)
384b9e67834SAndre Fischer {
38595a18594SAndre Fischer     //<<modify fill font list
38695a18594SAndre Fischer     SfxObjectShell* pDocSh = SfxObjectShell::Current();
387b9e67834SAndre Fischer     const SfxPoolItem* pItem = NULL;
388b9e67834SAndre Fischer 
389b9e67834SAndre Fischer     if (pDocSh != NULL)
390b9e67834SAndre Fischer         pItem = pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST );
391b9e67834SAndre Fischer     if (pItem != NULL)
392b9e67834SAndre Fischer         mpFontList = ( (SvxFontListItem*)pItem )->GetFontList();
393b9e67834SAndre Fischer     else
394b9e67834SAndre Fischer     {
395b9e67834SAndre Fischer         mpFontList = new FontList( Application::GetDefaultDevice() );
39645da7d5eSAndre Fischer         mbMustDelete = true;
397b9e67834SAndre Fischer     }
398b9e67834SAndre Fischer 
399b9e67834SAndre Fischer     mpFontNameBox->SetAccessibleName(mpFontNameBox->GetQuickHelpText());
40095a18594SAndre Fischer     const FontInfo aFontInfo (mpFontList->Get( String::CreateFromAscii( "" ), String::CreateFromAscii( "" )));
40195a18594SAndre Fischer     maFontSizeBox.Fill(&aFontInfo,mpFontList);
40295a18594SAndre Fischer     maFontSizeBox.SetAccessibleName(maFontSizeBox.GetQuickHelpText());
403b9e67834SAndre Fischer 
404b9e67834SAndre Fischer 	//toolbox
40545da7d5eSAndre Fischer     SetupToolboxItems();
40695a18594SAndre Fischer     InitToolBoxIncDec();
40795a18594SAndre Fischer     InitToolBoxFont();
40895a18594SAndre Fischer     InitToolBoxFontColor();
40995a18594SAndre Fischer     InitToolBoxScript();
41095a18594SAndre Fischer     InitToolBoxSpacing();
41195a18594SAndre Fischer     InitToolBoxHighlight();
412b9e67834SAndre Fischer 
413b9e67834SAndre Fischer #ifdef HAS_IA2
414d4aefcaeSZheng Fan     mpFontNameBox->SetAccRelationLabeledBy(&mpFontNameBox);
415d4aefcaeSZheng Fan     mpFontNameBox->SetMpSubEditAccLableBy(&mpFontNameBox);
416b9e67834SAndre Fischer     maFontSizeBox.SetAccRelationLabeledBy(&maFontSizeBox);
41795a18594SAndre Fischer     maFontSizeBox.SetMpSubEditAccLableBy(&maFontSizeBox);
418d4aefcaeSZheng Fan     mpToolBoxFont.SetAccRelationLabeledBy(&mpToolBoxFont);
419d4aefcaeSZheng Fan     mpToolBoxIncDec.SetAccRelationLabeledBy(&mpToolBoxIncDec);
420d4aefcaeSZheng Fan     mpToolBoxFontColor.SetAccRelationLabeledBy(&mpToolBoxFontColor);
421d4aefcaeSZheng Fan     mpToolBoxScript.SetAccRelationLabeledBy(&mpToolBoxScript);
422d4aefcaeSZheng Fan     mpToolBoxScriptSw.SetAccRelationLabeledBy(&mpToolBoxScriptSw);
423d4aefcaeSZheng Fan     mpToolBoxSpacing.SetAccRelationLabeledBy(&mpToolBoxSpacing);
424d4aefcaeSZheng Fan     mpToolBoxHighlight.SetAccRelationLabeledBy(&mpToolBoxHighlight);
425b9e67834SAndre Fischer #endif
426b9e67834SAndre Fischer 
42795a18594SAndre Fischer     //init state
42895a18594SAndre Fischer     mpHeightItem = NULL;
42995a18594SAndre Fischer     meWeight = WEIGHT_NORMAL;
43095a18594SAndre Fischer     meItalic = ITALIC_NONE;
43195a18594SAndre Fischer     mbShadow = false;
43295a18594SAndre Fischer     meStrike = STRIKEOUT_NONE;
43395a18594SAndre Fischer     mbPostureAvailable = true;
43495a18594SAndre Fischer     mbWeightAvailable = true;
43595a18594SAndre Fischer     meUnderline = UNDERLINE_NONE;
43695a18594SAndre Fischer     meUnderlineColor = COL_AUTO;   //
43795a18594SAndre Fischer     maColor = COL_BLACK;
43895a18594SAndre Fischer     mbColorAvailable = true;
43995a18594SAndre Fischer     maBackColor = COL_AUTO;
44095a18594SAndre Fischer     mbBackColorAvailable = true;
44195a18594SAndre Fischer     meColorType = FONT_COLOR;
44295a18594SAndre Fischer     meEscape = SVX_ESCAPEMENT_OFF;
44395a18594SAndre Fischer     mbSuper = false;
44495a18594SAndre Fischer     mbSub = false;
44595a18594SAndre Fischer     mbKernAvailable = true;
44695a18594SAndre Fischer     mbKernLBAvailable = true;
44795a18594SAndre Fischer     mlKerning = 0;
44895a18594SAndre Fischer     mpFontColorUpdater.reset(new ToolboxButtonColorUpdater(
449b9e67834SAndre Fischer             SID_ATTR_CHAR_COLOR,
450b9e67834SAndre Fischer             TBI_FONTCOLOR,
451b9e67834SAndre Fischer             mpToolBoxFontColor.get(),
452b9e67834SAndre Fischer             TBX_UPDATER_MODE_CHAR_COLOR_NEW));
453b9e67834SAndre Fischer     mpHighlightUpdater.reset(new ToolboxButtonColorUpdater(
454b9e67834SAndre Fischer             SID_ATTR_BRUSH_CHAR,
455b9e67834SAndre Fischer             TBI_HIGHLIGHT,
456b9e67834SAndre Fischer             mpToolBoxHighlight.get(),
457b9e67834SAndre Fischer             TBX_UPDATER_MODE_CHAR_COLOR_NEW));
458b9e67834SAndre Fischer 
45995a18594SAndre Fischer     //set handler
46095a18594SAndre Fischer     mpFontNameBox->SetBindings(mpBindings);
46195a18594SAndre Fischer     //add
46295a18594SAndre Fischer     Link aLink = LINK(this, TextPropertyPanel, FontSelHdl);
46395a18594SAndre Fischer     mpFontNameBox->SetSelectHdl(aLink);
46495a18594SAndre Fischer     //add end
465b9e67834SAndre Fischer 
46695a18594SAndre Fischer     aLink = LINK(this, TextPropertyPanel, FontSizeModifyHdl);
46795a18594SAndre Fischer     maFontSizeBox.SetModifyHdl(aLink);
46895a18594SAndre Fischer     //add
46995a18594SAndre Fischer     aLink = LINK(this, TextPropertyPanel, FontSizeSelHdl);
47095a18594SAndre Fischer     maFontSizeBox.SetSelectHdl(aLink);
47195a18594SAndre Fischer     //add end
47295a18594SAndre Fischer     aLink = LINK(this, TextPropertyPanel, FontSizeLoseFocus);
47395a18594SAndre Fischer     maFontSizeBox.SetLoseFocusHdl(aLink);
47495a18594SAndre Fischer 
47595a18594SAndre Fischer     // add
47695a18594SAndre Fischer     long aSizeBoxHeight = maFontSizeBox.GetSizePixel().getHeight();;
47795a18594SAndre Fischer     Point aPosFontSize = maFontSizeBox.GetPosPixel();
47895a18594SAndre Fischer     long aPosY = aPosFontSize.getY();
47995a18594SAndre Fischer     Point pTBIncDec = mpToolBoxIncDec->GetPosPixel();
48095a18594SAndre Fischer     long aIncDecHeight = mpToolBoxIncDec->GetSizePixel().getHeight();
48195a18594SAndre Fischer     pTBIncDec.setY(aPosY+aSizeBoxHeight/2-aIncDecHeight/2);
48295a18594SAndre Fischer     mpToolBoxIncDec->SetPosPixel(pTBIncDec);
48395a18594SAndre Fischer     //end
484b9e67834SAndre Fischer }
485b9e67834SAndre Fischer 
486d4aefcaeSZheng Fan void TextPropertyPanel::EndSpacingPopupMode (void)
487d4aefcaeSZheng Fan {
488d4aefcaeSZheng Fan     maCharSpacePopup.Hide();
489d4aefcaeSZheng Fan }
490b9e67834SAndre Fischer 
491d4aefcaeSZheng Fan void TextPropertyPanel::EndUnderlinePopupMode (void)
492d4aefcaeSZheng Fan {
493d4aefcaeSZheng Fan 	maUnderlinePopup.Hide();
494d4aefcaeSZheng Fan }
495b9e67834SAndre Fischer 
496b9e67834SAndre Fischer 
497b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxFont()
498b9e67834SAndre Fischer {
499b9e67834SAndre Fischer 	mpToolBoxFont->SetBackground(Wallpaper());
500b9e67834SAndre Fischer 	mpToolBoxFont->SetPaintTransparent(true);
501b9e67834SAndre Fischer 
502b9e67834SAndre Fischer 	Size aTbxSize( mpToolBoxFont->CalcWindowSizePixel() );
503b9e67834SAndre Fischer 	mpToolBoxFont->SetOutputSizePixel( aTbxSize );
504b9e67834SAndre Fischer 
505b9e67834SAndre Fischer 	Link aLink  = LINK(this, TextPropertyPanel, ToolboxFontSelectHandler);
506b9e67834SAndre Fischer 	mpToolBoxFont->SetSelectHdl ( aLink );
507b9e67834SAndre Fischer 	aLink = LINK(this, TextPropertyPanel, ToolBoxUnderlineClickHdl);
508b9e67834SAndre Fischer 	mpToolBoxFont->SetDropdownClickHdl(aLink);
509b9e67834SAndre Fischer }
510b9e67834SAndre Fischer 
511b9e67834SAndre Fischer 
512b9e67834SAndre Fischer 
513b9e67834SAndre Fischer 
514b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxIncDec()
515b9e67834SAndre Fischer {
516b9e67834SAndre Fischer 	Size aTbxSize( mpToolBoxIncDec->CalcWindowSizePixel() );
517b9e67834SAndre Fischer 	mpToolBoxIncDec->SetOutputSizePixel( aTbxSize );
518b9e67834SAndre Fischer 
519b9e67834SAndre Fischer 	Link aLink = LINK(this, TextPropertyPanel, ToolboxIncDecSelectHdl);
520b9e67834SAndre Fischer     mpToolBoxIncDec->SetSelectHdl ( aLink );
521b9e67834SAndre Fischer }
522b9e67834SAndre Fischer 
523b9e67834SAndre Fischer 
524b9e67834SAndre Fischer 
525b9e67834SAndre Fischer 
526b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxFontColor()
527b9e67834SAndre Fischer {
528b9e67834SAndre Fischer 	Size aTbxSize( mpToolBoxFontColor->CalcWindowSizePixel() );
529b9e67834SAndre Fischer 	mpToolBoxFontColor->SetOutputSizePixel( aTbxSize );
530b9e67834SAndre Fischer 	mpToolBoxFontColor->SetItemBits( TBI_FONTCOLOR, mpToolBoxFontColor->GetItemBits( TBI_FONTCOLOR ) | TIB_DROPDOWNONLY );
531b9e67834SAndre Fischer 
532b9e67834SAndre Fischer 	Link aLink = LINK(this, TextPropertyPanel, ToolBoxFontColorDropHdl);
533b9e67834SAndre Fischer     mpToolBoxFontColor->SetDropdownClickHdl ( aLink );
534b9e67834SAndre Fischer 	mpToolBoxFontColor->SetSelectHdl ( aLink );
535b9e67834SAndre Fischer 
536b9e67834SAndre Fischer }
537b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxScript()
538b9e67834SAndre Fischer {
539b9e67834SAndre Fischer 	Size aTbxSize( mpToolBoxScriptSw->CalcWindowSizePixel() );
540b9e67834SAndre Fischer 	mpToolBoxScriptSw->SetOutputSizePixel( aTbxSize );
541b9e67834SAndre Fischer 
542b9e67834SAndre Fischer 	Link aLink = LINK(this, TextPropertyPanel, ToolBoxSwScriptSelectHdl);
543b9e67834SAndre Fischer     mpToolBoxScriptSw->SetSelectHdl ( aLink );
544b9e67834SAndre Fischer 
545b9e67834SAndre Fischer 	aTbxSize = mpToolBoxScript->CalcWindowSizePixel() ;
546b9e67834SAndre Fischer 	mpToolBoxScript->SetOutputSizePixel( aTbxSize );
547b9e67834SAndre Fischer 
548b9e67834SAndre Fischer 	aLink = LINK(this, TextPropertyPanel, ToolBoxScriptSelectHdl);
549b9e67834SAndre Fischer     mpToolBoxScript->SetSelectHdl ( aLink );
550b9e67834SAndre Fischer }
551b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxSpacing()
552b9e67834SAndre Fischer {
553b9e67834SAndre Fischer 	Size aTbxSize( mpToolBoxSpacing->CalcWindowSizePixel() );
554b9e67834SAndre Fischer 	mpToolBoxSpacing->SetOutputSizePixel( aTbxSize );
555b9e67834SAndre Fischer 	mpToolBoxSpacing->SetItemBits( TBI_SPACING, mpToolBoxSpacing->GetItemBits( TBI_SPACING ) | TIB_DROPDOWNONLY );
556b9e67834SAndre Fischer 
557b9e67834SAndre Fischer 	Link aLink = LINK(this, TextPropertyPanel, SpacingClickHdl);
558b9e67834SAndre Fischer     mpToolBoxSpacing->SetDropdownClickHdl ( aLink );
559b9e67834SAndre Fischer 	mpToolBoxSpacing->SetSelectHdl( aLink );
560b9e67834SAndre Fischer }
561b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxHighlight()
562b9e67834SAndre Fischer {
563b9e67834SAndre Fischer 	Size aTbxSize( mpToolBoxHighlight->CalcWindowSizePixel() );
564b9e67834SAndre Fischer 	mpToolBoxHighlight->SetOutputSizePixel( aTbxSize );
565b9e67834SAndre Fischer 	mpToolBoxHighlight->SetItemBits( TBI_HIGHLIGHT, mpToolBoxHighlight->GetItemBits( TBI_HIGHLIGHT ) | TIB_DROPDOWNONLY );
566b9e67834SAndre Fischer 
567b9e67834SAndre Fischer 	Link aLink = LINK(this, TextPropertyPanel, ToolBoxHighlightDropHdl);
568b9e67834SAndre Fischer     mpToolBoxHighlight->SetDropdownClickHdl ( aLink );
569b9e67834SAndre Fischer 	mpToolBoxHighlight->SetSelectHdl( aLink );
570b9e67834SAndre Fischer }
571b9e67834SAndre Fischer 
572b9e67834SAndre Fischer 
573b9e67834SAndre Fischer 
574b9e67834SAndre Fischer 
57545da7d5eSAndre Fischer void TextPropertyPanel::SetupToolboxItems (void)
576b9e67834SAndre Fischer {
57745da7d5eSAndre Fischer     maSDFontGrow.SetupToolBoxItem(*mpToolBoxIncDec, TBI_INCREASE);
57845da7d5eSAndre Fischer     maSDFontShrink.SetupToolBoxItem(*mpToolBoxIncDec, TBI_DECREASE);
57945da7d5eSAndre Fischer 
58045da7d5eSAndre Fischer     maWeightControl.SetupToolBoxItem(*mpToolBoxFont, TBI_BOLD);
58145da7d5eSAndre Fischer 	maItalicControl.SetupToolBoxItem(*mpToolBoxFont, TBI_ITALIC);
58245da7d5eSAndre Fischer 	maUnderlineControl.SetupToolBoxItem(*mpToolBoxFont, TBI_UNDERLINE);
58345da7d5eSAndre Fischer 	maStrikeControl.SetupToolBoxItem(*mpToolBoxFont, TBI_STRIKEOUT);
58445da7d5eSAndre Fischer 	maShadowControl.SetupToolBoxItem(*mpToolBoxFont, TBI_SHADOWED);
58545da7d5eSAndre Fischer 
58645da7d5eSAndre Fischer     maFontColorControl.SetupToolBoxItem(*mpToolBoxFontColor, TBI_FONTCOLOR);
58745da7d5eSAndre Fischer     //for sw
58845da7d5eSAndre Fischer     maSuperScriptControl.SetupToolBoxItem(*mpToolBoxScriptSw, TBI_SUPER_SW);
58945da7d5eSAndre Fischer     maSubScriptControl.SetupToolBoxItem(*mpToolBoxScriptSw, TBI_SUB_SW);
59045da7d5eSAndre Fischer     //for sc and sd
591*ccab7bc0SAndre Fischer     maSuperScriptControl.SetupToolBoxItem(*mpToolBoxScript, TBI_SUPER);
59245da7d5eSAndre Fischer     maSubScriptControl.SetupToolBoxItem(*mpToolBoxScript, TBI_SUB);
59345da7d5eSAndre Fischer     maSpacingControl.SetupToolBoxItem(*mpToolBoxSpacing, TBI_SPACING);
59445da7d5eSAndre Fischer     maHighlightControl.SetupToolBoxItem(*mpToolBoxHighlight, TBI_HIGHLIGHT);
595b9e67834SAndre Fischer }
596b9e67834SAndre Fischer 
597b9e67834SAndre Fischer 
598b9e67834SAndre Fischer 
599b9e67834SAndre Fischer 
600b9e67834SAndre Fischer IMPL_LINK( TextPropertyPanel, FontSelHdl, FontNameBox*, pBox )
601b9e67834SAndre Fischer {
602b9e67834SAndre Fischer 	if ( !pBox->IsTravelSelect() )
603b9e67834SAndre Fischer 	{
604b9e67834SAndre Fischer 		if( SfxViewShell::Current() )
605b9e67834SAndre Fischer 		{
606b9e67834SAndre Fischer 			Window* pShellWnd = SfxViewShell::Current()->GetWindow();
607b9e67834SAndre Fischer 
608b9e67834SAndre Fischer 			if ( pShellWnd )
609b9e67834SAndre Fischer 				pShellWnd->GrabFocus();
610b9e67834SAndre Fischer 		}
611b9e67834SAndre Fischer 	}
612b9e67834SAndre Fischer 	return 0;
613b9e67834SAndre Fischer }
614b9e67834SAndre Fischer //add end
615b9e67834SAndre Fischer IMPL_LINK( TextPropertyPanel, FontSizeModifyHdl, FontSizeBox*, pSizeBox )
616b9e67834SAndre Fischer {
617b9e67834SAndre Fischer 	if (pSizeBox == &maFontSizeBox)
618b9e67834SAndre Fischer 	{
619b9e67834SAndre Fischer 		long nSize = pSizeBox->GetValue();
620b9e67834SAndre Fischer 		mbFocusOnFontSizeCtrl = true;
621b9e67834SAndre Fischer 
622b9e67834SAndre Fischer 		float fSize = (float)nSize / 10;
623b9e67834SAndre Fischer 		SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric();
624b9e67834SAndre Fischer 		SvxFontHeightItem aItem( CalcToUnit( fSize, eUnit ), 100, SID_ATTR_CHAR_FONTHEIGHT ) ;
625b9e67834SAndre Fischer 
626b9e67834SAndre Fischer 		mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONTHEIGHT, SFX_CALLMODE_RECORD, &aItem, 0L );
627b9e67834SAndre Fischer 		mpBindings->Invalidate(SID_ATTR_CHAR_FONTHEIGHT,true,false);
628b9e67834SAndre Fischer 	}
629b9e67834SAndre Fischer 	return 0;
630b9e67834SAndre Fischer }
631b9e67834SAndre Fischer //add
632b9e67834SAndre Fischer IMPL_LINK( TextPropertyPanel, FontSizeSelHdl, FontSizeBox*, pSizeBox )
633b9e67834SAndre Fischer {
634b9e67834SAndre Fischer 	if ( !pSizeBox->IsTravelSelect() )
635b9e67834SAndre Fischer 	{
636b9e67834SAndre Fischer 		if( SfxViewShell::Current() )
637b9e67834SAndre Fischer 		{
638b9e67834SAndre Fischer 			Window* pShellWnd = SfxViewShell::Current()->GetWindow();
639b9e67834SAndre Fischer 
640b9e67834SAndre Fischer 			if ( pShellWnd )
641b9e67834SAndre Fischer 				pShellWnd->GrabFocus();
642b9e67834SAndre Fischer 		}
643b9e67834SAndre Fischer 	}
644b9e67834SAndre Fischer 
645b9e67834SAndre Fischer 	return 0;
646b9e67834SAndre Fischer }
647b9e67834SAndre Fischer //add end
648b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, FontSizeLoseFocus, FontSizeBox*, pSizeBox)
649b9e67834SAndre Fischer {
650b9e67834SAndre Fischer 	if(pSizeBox == &maFontSizeBox)
651b9e67834SAndre Fischer 	{
652b9e67834SAndre Fischer 		mbFocusOnFontSizeCtrl = false;
653b9e67834SAndre Fischer 	}
654b9e67834SAndre Fischer 	return 0;
655b9e67834SAndre Fischer }
656b9e67834SAndre Fischer 
657b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolboxFontSelectHandler, ToolBox*, pToolBox)
658b9e67834SAndre Fischer {
659b9e67834SAndre Fischer 	const sal_uInt16 nId = pToolBox->GetCurItemId();
660b9e67834SAndre Fischer 
66145da7d5eSAndre Fischer 	switch (nId)
66245da7d5eSAndre Fischer     {
66345da7d5eSAndre Fischer         case TBI_BOLD:
66445da7d5eSAndre Fischer         {
66545da7d5eSAndre Fischer             EndTracking();
66645da7d5eSAndre Fischer             if(meWeight != WEIGHT_BOLD)
66745da7d5eSAndre Fischer                 meWeight = WEIGHT_BOLD;
66845da7d5eSAndre Fischer             else
66945da7d5eSAndre Fischer                 meWeight = WEIGHT_NORMAL;
67045da7d5eSAndre Fischer             SvxWeightItem aWeightItem(meWeight, SID_ATTR_CHAR_WEIGHT);
67145da7d5eSAndre Fischer             mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_WEIGHT, SFX_CALLMODE_RECORD, &aWeightItem, 0L);
67245da7d5eSAndre Fischer             UpdateItem(SID_ATTR_CHAR_WEIGHT);
67345da7d5eSAndre Fischer             break;
67445da7d5eSAndre Fischer         }
67545da7d5eSAndre Fischer         case TBI_ITALIC:
67645da7d5eSAndre Fischer         {
67745da7d5eSAndre Fischer             EndTracking();
67845da7d5eSAndre Fischer             if(meItalic != ITALIC_NORMAL)
67945da7d5eSAndre Fischer                 meItalic = ITALIC_NORMAL;
68045da7d5eSAndre Fischer             else
68145da7d5eSAndre Fischer                 meItalic = ITALIC_NONE;
68245da7d5eSAndre Fischer             SvxPostureItem aPostureItem(meItalic, SID_ATTR_CHAR_POSTURE);
68345da7d5eSAndre Fischer             mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_POSTURE, SFX_CALLMODE_RECORD, &aPostureItem, 0L);
68445da7d5eSAndre Fischer             UpdateItem(SID_ATTR_CHAR_POSTURE);
68545da7d5eSAndre Fischer             break;
68645da7d5eSAndre Fischer         }
68745da7d5eSAndre Fischer         case TBI_UNDERLINE:
68845da7d5eSAndre Fischer         {
68945da7d5eSAndre Fischer             EndTracking();
69045da7d5eSAndre Fischer             if(meUnderline == UNDERLINE_NONE)
69145da7d5eSAndre Fischer             {
69245da7d5eSAndre Fischer                 meUnderline = UNDERLINE_SINGLE;
69345da7d5eSAndre Fischer                 SvxUnderlineItem aLineItem(meUnderline, SID_ATTR_CHAR_UNDERLINE);
69445da7d5eSAndre Fischer                 aLineItem.SetColor(meUnderlineColor);
69545da7d5eSAndre Fischer                 mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_UNDERLINE, SFX_CALLMODE_RECORD, &aLineItem, 0L);
69645da7d5eSAndre Fischer             }
69745da7d5eSAndre Fischer             else
69845da7d5eSAndre Fischer             {
69945da7d5eSAndre Fischer                 meUnderline = UNDERLINE_NONE;
70045da7d5eSAndre Fischer                 SvxUnderlineItem aLineItem(meUnderline, SID_ATTR_CHAR_UNDERLINE);
70145da7d5eSAndre Fischer                 mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_UNDERLINE, SFX_CALLMODE_RECORD, &aLineItem, 0L);
70245da7d5eSAndre Fischer             }
70345da7d5eSAndre Fischer             UpdateItem(SID_ATTR_CHAR_UNDERLINE);
70445da7d5eSAndre Fischer         }
70545da7d5eSAndre Fischer         case TBI_STRIKEOUT:
70645da7d5eSAndre Fischer         {
70745da7d5eSAndre Fischer             EndTracking();
70845da7d5eSAndre Fischer             if(meStrike !=  STRIKEOUT_NONE && meStrike != STRIKEOUT_DONTKNOW)
70945da7d5eSAndre Fischer                 meStrike = STRIKEOUT_NONE;
71045da7d5eSAndre Fischer             else
71145da7d5eSAndre Fischer                 meStrike = STRIKEOUT_SINGLE;
71245da7d5eSAndre Fischer             SvxCrossedOutItem aStrikeItem(meStrike,SID_ATTR_CHAR_STRIKEOUT);
71345da7d5eSAndre Fischer             mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_STRIKEOUT, SFX_CALLMODE_RECORD, &aStrikeItem, 0L);
71445da7d5eSAndre Fischer             UpdateItem(SID_ATTR_CHAR_STRIKEOUT);
71545da7d5eSAndre Fischer             break;
71645da7d5eSAndre Fischer         }
71745da7d5eSAndre Fischer         case TBI_SHADOWED:
71845da7d5eSAndre Fischer         {
71945da7d5eSAndre Fischer             EndTracking();
72045da7d5eSAndre Fischer             mbShadow = !mbShadow;
72145da7d5eSAndre Fischer             SvxShadowedItem aShadowItem(mbShadow, SID_ATTR_CHAR_SHADOWED);
72245da7d5eSAndre Fischer             mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_SHADOWED, SFX_CALLMODE_RECORD, &aShadowItem, 0L);
72345da7d5eSAndre Fischer             UpdateItem(SID_ATTR_CHAR_SHADOWED);
72445da7d5eSAndre Fischer             break;
72545da7d5eSAndre Fischer         }
726b9e67834SAndre Fischer 	}
727b9e67834SAndre Fischer 	return 0;
728b9e67834SAndre Fischer }
729b9e67834SAndre Fischer 
730b9e67834SAndre Fischer 
731b9e67834SAndre Fischer 
732b9e67834SAndre Fischer 
733b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolboxIncDecSelectHdl, ToolBox*, pToolBox)
734b9e67834SAndre Fischer {
735b9e67834SAndre Fischer 	const sal_uInt16 nId = pToolBox->GetCurItemId();
736b9e67834SAndre Fischer 
737b9e67834SAndre Fischer 	// font size +/- enhancement in sd
73845da7d5eSAndre Fischer     switch (maContext.GetCombinedContext_DI())
739b9e67834SAndre Fischer     {
74045da7d5eSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
74145da7d5eSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_Text):
74245da7d5eSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_Table):
74345da7d5eSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_OutlineText):
74445da7d5eSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_Draw):
74545da7d5eSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
74645da7d5eSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
747b9e67834SAndre Fischer             if(nId == TBI_INCREASE)
748b9e67834SAndre Fischer             {
749b9e67834SAndre Fischer                 EndTracking();
750b9e67834SAndre Fischer                 SfxVoidItem aItem(SID_GROW_FONT_SIZE);
751b9e67834SAndre Fischer                 mpBindings->GetDispatcher()->Execute( SID_GROW_FONT_SIZE, SFX_CALLMODE_RECORD, &aItem, 0L );
752b9e67834SAndre Fischer             }
753b9e67834SAndre Fischer             else if(nId == TBI_DECREASE)
754b9e67834SAndre Fischer             {
755b9e67834SAndre Fischer                 EndTracking();
756b9e67834SAndre Fischer                 SfxVoidItem aItem(SID_SHRINK_FONT_SIZE);
757b9e67834SAndre Fischer                 mpBindings->GetDispatcher()->Execute( SID_SHRINK_FONT_SIZE, SFX_CALLMODE_RECORD, &aItem, 0L );
758b9e67834SAndre Fischer             }
759b9e67834SAndre Fischer             break;
760b9e67834SAndre Fischer 
761b9e67834SAndre Fischer         default:
762b9e67834SAndre Fischer             if(nId == TBI_INCREASE)
763b9e67834SAndre Fischer             {
764b9e67834SAndre Fischer                 EndTracking();
765b9e67834SAndre Fischer                 mbFocusOnFontSizeCtrl = false;
766b9e67834SAndre Fischer                 sal_Int64 iValue = maFontSizeBox.GetValue();
767b9e67834SAndre Fischer                 int iPos = maFontSizeBox.GetValuePos(iValue, FUNIT_NONE);
768b9e67834SAndre Fischer                 long nSize = iValue;
769b9e67834SAndre Fischer                 if(iPos != LISTBOX_ENTRY_NOTFOUND)
770b9e67834SAndre Fischer                     nSize = maFontSizeBox.GetValue(iPos+1 , FUNIT_NONE);
771b9e67834SAndre Fischer                 else if(iValue >= 100 && iValue < 105)
772b9e67834SAndre Fischer                     nSize = 105;
773b9e67834SAndre Fischer                 else if(iValue >= 105 && iValue < 110)
774b9e67834SAndre Fischer                     nSize = 110;
775b9e67834SAndre Fischer                 else if(iValue < 960)
776b9e67834SAndre Fischer                 {
777b9e67834SAndre Fischer                     nSize = (nSize / 10) * 10 + 10;
778b9e67834SAndre Fischer                     while(maFontSizeBox.GetValuePos(nSize, FUNIT_NONE) == LISTBOX_ENTRY_NOTFOUND)
779b9e67834SAndre Fischer                         nSize += 10;
780b9e67834SAndre Fischer                 }
781b9e67834SAndre Fischer                 else
782b9e67834SAndre Fischer                 {
783b9e67834SAndre Fischer                     nSize = iValue;
784b9e67834SAndre Fischer                 }
785b9e67834SAndre Fischer 
786b9e67834SAndre Fischer                 float fSize = (float)nSize / 10;
787b9e67834SAndre Fischer 
788b9e67834SAndre Fischer                 SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric();
789b9e67834SAndre Fischer                 SvxFontHeightItem aItem( CalcToUnit( fSize, eUnit ), 100, SID_ATTR_CHAR_FONTHEIGHT ) ;
790b9e67834SAndre Fischer 
791b9e67834SAndre Fischer                 mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONTHEIGHT, SFX_CALLMODE_RECORD, &aItem, 0L );
792b9e67834SAndre Fischer                 mpBindings->Invalidate(SID_ATTR_CHAR_FONTHEIGHT,true,false);
793b9e67834SAndre Fischer                 maFontSizeBox.SetValue( nSize );
794b9e67834SAndre Fischer             }
795b9e67834SAndre Fischer             else if(nId == TBI_DECREASE)
796b9e67834SAndre Fischer             {
797b9e67834SAndre Fischer                 EndTracking();
798b9e67834SAndre Fischer                 mbFocusOnFontSizeCtrl = false;
799b9e67834SAndre Fischer                 sal_Int64 iValue = maFontSizeBox.GetValue();
800b9e67834SAndre Fischer                 int iPos = maFontSizeBox.GetValuePos(iValue, FUNIT_NONE);
801b9e67834SAndre Fischer                 long nSize = iValue;
802b9e67834SAndre Fischer                 if(iPos != LISTBOX_ENTRY_NOTFOUND)
803b9e67834SAndre Fischer                     nSize = maFontSizeBox.GetValue(iPos-1 , FUNIT_NONE);
804b9e67834SAndre Fischer                 else if(iValue > 100 && iValue <= 105)
805b9e67834SAndre Fischer                     nSize = 100;
806b9e67834SAndre Fischer                 else if(iValue > 105 && iValue <= 110)
807b9e67834SAndre Fischer                     nSize = 105;
808b9e67834SAndre Fischer                 else if(iValue > 960)
809b9e67834SAndre Fischer                 {
810b9e67834SAndre Fischer                     nSize = 960;
811b9e67834SAndre Fischer                 }
812b9e67834SAndre Fischer                 else if(iValue > 60)
813b9e67834SAndre Fischer                 {
814b9e67834SAndre Fischer                     nSize = (nSize / 10) * 10 ;
815b9e67834SAndre Fischer                     while(maFontSizeBox.GetValuePos(nSize, FUNIT_NONE) == LISTBOX_ENTRY_NOTFOUND)
816b9e67834SAndre Fischer                         nSize -= 10;
817b9e67834SAndre Fischer                 }
818b9e67834SAndre Fischer                 else
819b9e67834SAndre Fischer                 {
820b9e67834SAndre Fischer                     nSize = iValue;
821b9e67834SAndre Fischer                 }
822b9e67834SAndre Fischer 
823b9e67834SAndre Fischer                 float fSize = (float)nSize / 10;
824b9e67834SAndre Fischer 
825b9e67834SAndre Fischer                 SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric();
826b9e67834SAndre Fischer                 SvxFontHeightItem aItem( CalcToUnit( fSize, eUnit ), 100, SID_ATTR_CHAR_FONTHEIGHT ) ;
827b9e67834SAndre Fischer 
828b9e67834SAndre Fischer                 mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONTHEIGHT, SFX_CALLMODE_RECORD, &aItem, 0L );
829b9e67834SAndre Fischer                 mpBindings->Invalidate(SID_ATTR_CHAR_FONTHEIGHT,true,false);
830b9e67834SAndre Fischer                 maFontSizeBox.SetValue( nSize );
831b9e67834SAndre Fischer             }
832b9e67834SAndre Fischer 	}
83345da7d5eSAndre Fischer     UpdateItem(SID_ATTR_CHAR_FONTHEIGHT);
83445da7d5eSAndre Fischer 
835b9e67834SAndre Fischer 	return 0;
836b9e67834SAndre Fischer }
837b9e67834SAndre Fischer 
838b9e67834SAndre Fischer 
839b9e67834SAndre Fischer 
840b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolBoxUnderlineClickHdl, ToolBox*, pToolBox)
841b9e67834SAndre Fischer {
842b9e67834SAndre Fischer 	const sal_uInt16 nId = pToolBox->GetCurItemId();
843d4aefcaeSZheng Fan 	OSL_ASSERT(nId == TBI_UNDERLINE);
844b9e67834SAndre Fischer 	if(nId == TBI_UNDERLINE)
845b9e67834SAndre Fischer 	{
846b9e67834SAndre Fischer 		pToolBox->SetItemDown( nId, true );
847d4aefcaeSZheng Fan 		maUnderlinePopup.Rearrange(meUnderline);
848d4aefcaeSZheng Fan 		maUnderlinePopup.Show(*pToolBox);
849b9e67834SAndre Fischer 
850b9e67834SAndre Fischer 	}
851d4aefcaeSZheng Fan 	return 0L;
852b9e67834SAndre Fischer }
853b9e67834SAndre Fischer 
854b9e67834SAndre Fischer 
855b9e67834SAndre Fischer 
856b9e67834SAndre Fischer 
857b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolBoxFontColorDropHdl,ToolBox*, pToolBox)
858b9e67834SAndre Fischer {
859b9e67834SAndre Fischer 	const sal_uInt16 nId = pToolBox->GetCurItemId();
860b9e67834SAndre Fischer 	if(nId == TBI_FONTCOLOR)
861b9e67834SAndre Fischer 	{
862b9e67834SAndre Fischer 		meColorType = FONT_COLOR;
863b9e67834SAndre Fischer 
864b9e67834SAndre Fischer 		pToolBox->SetItemDown( nId, true );
865b9e67834SAndre Fischer 
866d4aefcaeSZheng Fan 		maFontColorPopup.Show(*pToolBox);
867d4aefcaeSZheng Fan 		maFontColorPopup.SetCurrentColor(maColor, mbColorAvailable);
868b9e67834SAndre Fischer 	}
869b9e67834SAndre Fischer 	return 0;
870b9e67834SAndre Fischer }
871b9e67834SAndre Fischer 
872b9e67834SAndre Fischer 
873b9e67834SAndre Fischer 
874b9e67834SAndre Fischer 
875b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolBoxSwScriptSelectHdl, ToolBox*, pToolBox)
876b9e67834SAndre Fischer {
877b9e67834SAndre Fischer 	const sal_uInt16 nId = pToolBox->GetCurItemId();
878b9e67834SAndre Fischer 	if( nId == TBI_SUPER_SW )
879b9e67834SAndre Fischer 	{
880b9e67834SAndre Fischer 		if(meEscape != SVX_ESCAPEMENT_SUPERSCRIPT)
881b9e67834SAndre Fischer 		{
882b9e67834SAndre Fischer 			meEscape = SVX_ESCAPEMENT_SUPERSCRIPT;
883b9e67834SAndre Fischer 			SvxEscapementItem aSupItem(DFLT_ESC_SUPER, DFLT_ESC_PROP, SID_ATTR_CHAR_ESCAPEMENT);
884b9e67834SAndre Fischer 			mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aSupItem, 0L );
885b9e67834SAndre Fischer 		}
886b9e67834SAndre Fischer 		else
887b9e67834SAndre Fischer 		{
888b9e67834SAndre Fischer 			meEscape = SVX_ESCAPEMENT_OFF;
889b9e67834SAndre Fischer 			SvxEscapementItem aNoneItem(0, 100, SID_ATTR_CHAR_ESCAPEMENT);
890b9e67834SAndre Fischer 			mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aNoneItem, 0L );
891b9e67834SAndre Fischer 		}
892b9e67834SAndre Fischer 	}
893b9e67834SAndre Fischer 	else if(TBI_SUB_SW == nId)
894b9e67834SAndre Fischer 	{
895b9e67834SAndre Fischer 		if(meEscape != SVX_ESCAPEMENT_SUBSCRIPT)
896b9e67834SAndre Fischer 		{
897b9e67834SAndre Fischer 			meEscape = (SvxEscapement)SVX_ESCAPEMENT_SUBSCRIPT;
898b9e67834SAndre Fischer 			SvxEscapementItem aSubItem(DFLT_ESC_SUB, DFLT_ESC_PROP, SID_ATTR_CHAR_ESCAPEMENT);
899b9e67834SAndre Fischer 			mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aSubItem, 0L );
900b9e67834SAndre Fischer 		}
901b9e67834SAndre Fischer 		else
902b9e67834SAndre Fischer 		{
903b9e67834SAndre Fischer 			meEscape = SVX_ESCAPEMENT_OFF;
904b9e67834SAndre Fischer 			SvxEscapementItem aNoneItem(0, 100, SID_ATTR_CHAR_ESCAPEMENT);
905b9e67834SAndre Fischer 			mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aNoneItem, 0L );
906b9e67834SAndre Fischer 		}
907b9e67834SAndre Fischer 	}
90845da7d5eSAndre Fischer     UpdateItem(SID_ATTR_CHAR_ESCAPEMENT);
909b9e67834SAndre Fischer 
910b9e67834SAndre Fischer 	return 0;
911b9e67834SAndre Fischer }
912b9e67834SAndre Fischer 
913b9e67834SAndre Fischer 
914b9e67834SAndre Fischer 
915b9e67834SAndre Fischer 
916b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolBoxScriptSelectHdl, ToolBox*, pToolBox)
917b9e67834SAndre Fischer {
918b9e67834SAndre Fischer 	const sal_uInt16 nId = pToolBox->GetCurItemId();
919b9e67834SAndre Fischer 	if( nId == TBI_SUPER )
920b9e67834SAndre Fischer 	{
921b9e67834SAndre Fischer 		mbSuper = !mbSuper;
922b9e67834SAndre Fischer 		SfxBoolItem aSupItem(SID_SET_SUPER_SCRIPT, mbSuper);
923b9e67834SAndre Fischer 		mpBindings->GetDispatcher()->Execute( SID_SET_SUPER_SCRIPT, SFX_CALLMODE_RECORD, &aSupItem, 0L );
92445da7d5eSAndre Fischer         UpdateItem(SID_SET_SUPER_SCRIPT);
925b9e67834SAndre Fischer 	}
926b9e67834SAndre Fischer 	else if(TBI_SUB == nId)
927b9e67834SAndre Fischer 	{
928b9e67834SAndre Fischer 
929b9e67834SAndre Fischer 		mbSub = !mbSub;
930b9e67834SAndre Fischer 		SfxBoolItem aSubItem(SID_SET_SUB_SCRIPT, mbSub );
931b9e67834SAndre Fischer 		mpBindings->GetDispatcher()->Execute( SID_SET_SUB_SCRIPT, SFX_CALLMODE_RECORD, &aSubItem, 0L );
93245da7d5eSAndre Fischer         UpdateItem(SID_SET_SUB_SCRIPT);
933b9e67834SAndre Fischer 	}
934b9e67834SAndre Fischer 	return 0;
935b9e67834SAndre Fischer }
936b9e67834SAndre Fischer 
937b9e67834SAndre Fischer 
938b9e67834SAndre Fischer 
939b9e67834SAndre Fischer 
940b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolBoxHighlightDropHdl, ToolBox*, pToolBox)
941b9e67834SAndre Fischer {
942b9e67834SAndre Fischer 	const sal_uInt16 nId = pToolBox->GetCurItemId();
943b9e67834SAndre Fischer 	if(nId == TBI_HIGHLIGHT)
944b9e67834SAndre Fischer 	{
945b9e67834SAndre Fischer 		meColorType = BACK_COLOR;
946b9e67834SAndre Fischer 
947b9e67834SAndre Fischer 		pToolBox->SetItemDown( nId, true );
948d4aefcaeSZheng Fan 		maBrushColorPopup.Show(*pToolBox);
949d4aefcaeSZheng Fan 		maBrushColorPopup.SetCurrentColor(maBackColor, mbBackColorAvailable);
950b9e67834SAndre Fischer 
951b9e67834SAndre Fischer 	}
952b9e67834SAndre Fischer 	return 0;
953b9e67834SAndre Fischer }
954b9e67834SAndre Fischer 
955b9e67834SAndre Fischer 
956b9e67834SAndre Fischer 
957b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, SpacingClickHdl, ToolBox*, pToolBox)
958b9e67834SAndre Fischer {
959b9e67834SAndre Fischer 	const sal_uInt16 nId = pToolBox->GetCurItemId();
960d4aefcaeSZheng Fan 	OSL_ASSERT(nId == TBI_SPACING);
961b9e67834SAndre Fischer 	if(nId == TBI_SPACING)
962b9e67834SAndre Fischer 	{
963b9e67834SAndre Fischer 		pToolBox->SetItemDown( nId, true );
964d4aefcaeSZheng Fan 		maCharSpacePopup.Rearrange(mbKernLBAvailable,mbKernAvailable,mlKerning);
965d4aefcaeSZheng Fan 		maCharSpacePopup.Show(*pToolBox);
966b9e67834SAndre Fischer 
967b9e67834SAndre Fischer 	}
968d4aefcaeSZheng Fan 	return 0L;
969b9e67834SAndre Fischer }
970b9e67834SAndre Fischer 
971b9e67834SAndre Fischer 
972b9e67834SAndre Fischer 
973b9e67834SAndre Fischer 
974b9e67834SAndre Fischer IMPL_LINK( TextPropertyPanel, ImplPopupModeEndHdl, FloatingWindow*, EMPTYARG )
975b9e67834SAndre Fischer {
976b9e67834SAndre Fischer 	return 0;
977b9e67834SAndre Fischer }
978b9e67834SAndre Fischer 
979b9e67834SAndre Fischer 
980b9e67834SAndre Fischer 
981b9e67834SAndre Fischer 
982b9e67834SAndre Fischer void TextPropertyPanel::NotifyItemUpdate (
983b9e67834SAndre Fischer     const sal_uInt16 nSID,
984b9e67834SAndre Fischer     const SfxItemState eState,
98545da7d5eSAndre Fischer     const SfxPoolItem* pState,
98645da7d5eSAndre Fischer     const bool bIsEnabled)
987b9e67834SAndre Fischer {
988b9e67834SAndre Fischer 	switch(nSID)
989b9e67834SAndre Fischer 	{
990b9e67834SAndre Fischer         case SID_ATTR_CHAR_FONT:
99145da7d5eSAndre Fischer         {
99245da7d5eSAndre Fischer             bool bIsControlEnabled (bIsEnabled);
993b9e67834SAndre Fischer             if (  eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxFontItem) )
994b9e67834SAndre Fischer             {
995b9e67834SAndre Fischer                 const SvxFontItem* pFontItem = (const SvxFontItem*)pState;
996b9e67834SAndre Fischer                 mpFontNameBox->SetText( pFontItem->GetFamilyName() );
997b9e67834SAndre Fischer             }
998b9e67834SAndre Fischer             else
999b9e67834SAndre Fischer             {
1000b9e67834SAndre Fischer                 mpFontNameBox->SetText( String() );
1001b9e67834SAndre Fischer                 if (SFX_ITEM_DISABLED == eState)
100245da7d5eSAndre Fischer                     bIsControlEnabled = false;
1003b9e67834SAndre Fischer             }
100445da7d5eSAndre Fischer             mpFontNameBox->Enable(bIsControlEnabled);
1005b9e67834SAndre Fischer             break;
100645da7d5eSAndre Fischer         }
1007b9e67834SAndre Fischer         case SID_ATTR_CHAR_FONTHEIGHT:
100845da7d5eSAndre Fischer         {
100945da7d5eSAndre Fischer             bool bIsControlEnabled (bIsEnabled);
1010b9e67834SAndre Fischer             if (  eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxFontHeightItem) )
1011b9e67834SAndre Fischer             {
1012b9e67834SAndre Fischer                 mpHeightItem = (SvxFontHeightItem*)pState;//const SvxFontHeightItem*
1013b9e67834SAndre Fischer                 SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric();
1014b9e67834SAndre Fischer                 long iValue = (long)CalcToPoint( mpHeightItem->GetHeight(), eUnit, 10 );
1015b9e67834SAndre Fischer                 mpToolBoxIncDec->Enable();
1016b9e67834SAndre Fischer 
1017b9e67834SAndre Fischer                 mpToolBoxIncDec->SetItemState(TBI_INCREASE, STATE_NOCHECK);
1018b9e67834SAndre Fischer                 mpToolBoxIncDec->SetItemState(TBI_DECREASE, STATE_NOCHECK);
1019b9e67834SAndre Fischer 
1020b9e67834SAndre Fischer                 if( mbFocusOnFontSizeCtrl )
1021b9e67834SAndre Fischer                     return;
1022b9e67834SAndre Fischer 
1023b9e67834SAndre Fischer                 maFontSizeBox.SetValue( iValue );
1024b9e67834SAndre Fischer                 maFontSizeBox.LoseFocus();
102545da7d5eSAndre Fischer 
102645da7d5eSAndre Fischer                 UpdateItem(SID_SHRINK_FONT_SIZE);
102745da7d5eSAndre Fischer                 UpdateItem(SID_GROW_FONT_SIZE);
1028b9e67834SAndre Fischer             }
1029b9e67834SAndre Fischer             else
1030b9e67834SAndre Fischer             {
1031b9e67834SAndre Fischer                 mpHeightItem = NULL;
1032b9e67834SAndre Fischer                 maFontSizeBox.SetText( String() );
1033b9e67834SAndre Fischer                 //increase decrease diabled when multi-seletion have different font size
1034b9e67834SAndre Fischer 
1035b9e67834SAndre Fischer                 // font size +/- enhancement in sd
103645da7d5eSAndre Fischer                 switch(maContext.GetCombinedContext_DI())
1037b9e67834SAndre Fischer                 {
103845da7d5eSAndre Fischer                     case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
103945da7d5eSAndre Fischer                     case CombinedEnumContext(Application_DrawImpress, Context_Text):
104045da7d5eSAndre Fischer                     case CombinedEnumContext(Application_DrawImpress, Context_Table):
104145da7d5eSAndre Fischer                     case CombinedEnumContext(Application_DrawImpress, Context_OutlineText):
104245da7d5eSAndre Fischer                     case CombinedEnumContext(Application_DrawImpress, Context_Draw):
104345da7d5eSAndre Fischer                     case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
104445da7d5eSAndre Fischer                     case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
1045b9e67834SAndre Fischer                         break;
1046b9e67834SAndre Fischer 
1047b9e67834SAndre Fischer                     default:
1048b9e67834SAndre Fischer                         mpToolBoxIncDec->Disable();
1049b9e67834SAndre Fischer                 }
1050b9e67834SAndre Fischer                 if ( eState <= SFX_ITEM_READONLY )
105145da7d5eSAndre Fischer                     bIsControlEnabled = false;
1052b9e67834SAndre Fischer             }
105345da7d5eSAndre Fischer             maFontSizeBox.Enable(bIsControlEnabled);
105445da7d5eSAndre Fischer             break;
105545da7d5eSAndre Fischer         }
105645da7d5eSAndre Fischer 
1057b9e67834SAndre Fischer         case SID_ATTR_CHAR_WEIGHT:
1058b9e67834SAndre Fischer             mbWeightAvailable = (eState >= SFX_ITEM_DONTCARE);
1059b9e67834SAndre Fischer             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxWeightItem))
1060b9e67834SAndre Fischer             {
1061b9e67834SAndre Fischer                 const SvxWeightItem* pItem = (const SvxWeightItem*)pState;
1062b9e67834SAndre Fischer                 meWeight = (FontWeight)pItem->GetValue();
1063b9e67834SAndre Fischer             }
1064b9e67834SAndre Fischer             else
1065b9e67834SAndre Fischer             {
1066b9e67834SAndre Fischer                 meWeight = WEIGHT_NORMAL;
1067b9e67834SAndre Fischer             }
106845da7d5eSAndre Fischer             mpToolBoxFont->EnableItem(TBI_BOLD, mbWeightAvailable && bIsEnabled);
106945da7d5eSAndre Fischer             mpToolBoxFont->SetItemState(TBI_BOLD, meWeight==WEIGHT_BOLD ? STATE_CHECK : STATE_NOCHECK);
1070b9e67834SAndre Fischer             break;
107145da7d5eSAndre Fischer 
1072b9e67834SAndre Fischer         case SID_ATTR_CHAR_POSTURE:
1073b9e67834SAndre Fischer             mbPostureAvailable = (eState >= SFX_ITEM_DONTCARE);
1074b9e67834SAndre Fischer             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxPostureItem))
1075b9e67834SAndre Fischer             {
1076b9e67834SAndre Fischer                 const SvxPostureItem* pItem = (const SvxPostureItem*)pState;
1077b9e67834SAndre Fischer                 meItalic = (FontItalic)pItem->GetValue();
1078b9e67834SAndre Fischer             }
1079b9e67834SAndre Fischer             else
1080b9e67834SAndre Fischer             {
1081b9e67834SAndre Fischer                 meItalic = ITALIC_NONE;
1082b9e67834SAndre Fischer             }
108345da7d5eSAndre Fischer             mpToolBoxFont->EnableItem(TBI_ITALIC, mbPostureAvailable && bIsEnabled);
108445da7d5eSAndre Fischer             mpToolBoxFont->SetItemState(TBI_ITALIC,	meItalic==ITALIC_NORMAL ? STATE_CHECK : STATE_NOCHECK);
1085b9e67834SAndre Fischer             break;
108645da7d5eSAndre Fischer 
1087b9e67834SAndre Fischer         case SID_ATTR_CHAR_UNDERLINE:
108845da7d5eSAndre Fischer             if( eState >= SFX_ITEM_DEFAULT)
1089b9e67834SAndre Fischer             {
1090b9e67834SAndre Fischer                 if(pState->ISA(SvxUnderlineItem))
1091b9e67834SAndre Fischer                 {
1092b9e67834SAndre Fischer                     const SvxUnderlineItem* pItem = (const SvxUnderlineItem*)pState;
1093b9e67834SAndre Fischer                     meUnderline = (FontUnderline)pItem->GetValue();
1094b9e67834SAndre Fischer                     meUnderlineColor = pItem->GetColor();
1095b9e67834SAndre Fischer                 }
1096b9e67834SAndre Fischer             }
1097b9e67834SAndre Fischer             else
1098b9e67834SAndre Fischer             {
1099b9e67834SAndre Fischer                 meUnderline = UNDERLINE_NONE;
1100b9e67834SAndre Fischer             }
110145da7d5eSAndre Fischer             mpToolBoxFont->EnableItem(TBI_UNDERLINE, bIsEnabled);
110245da7d5eSAndre Fischer             mpToolBoxFont->SetItemState(TBI_UNDERLINE, meUnderline==UNDERLINE_NONE ? STATE_NOCHECK : STATE_CHECK);
1103b9e67834SAndre Fischer             break;
110445da7d5eSAndre Fischer 
1105b9e67834SAndre Fischer         case SID_ATTR_CHAR_SHADOWED:
1106b9e67834SAndre Fischer             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxShadowedItem))
1107b9e67834SAndre Fischer             {
1108b9e67834SAndre Fischer                 const SvxShadowedItem* pItem = (const SvxShadowedItem*)pState;
1109b9e67834SAndre Fischer                 mbShadow = pItem->GetValue();
1110b9e67834SAndre Fischer             }
1111b9e67834SAndre Fischer             else
1112b9e67834SAndre Fischer             {
1113b9e67834SAndre Fischer                 mbShadow = false;
1114b9e67834SAndre Fischer             }
111545da7d5eSAndre Fischer             mpToolBoxFont->EnableItem(TBI_SHADOWED, bIsEnabled);
111645da7d5eSAndre Fischer             mpToolBoxFont->SetItemState(TBI_SHADOWED, mbShadow ? STATE_CHECK : STATE_NOCHECK);
1117b9e67834SAndre Fischer             break;
111845da7d5eSAndre Fischer 
1119b9e67834SAndre Fischer         case SID_ATTR_CHAR_STRIKEOUT:
1120b9e67834SAndre Fischer             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxCrossedOutItem))
1121b9e67834SAndre Fischer             {
1122b9e67834SAndre Fischer                 const SvxCrossedOutItem* pItem = (const SvxCrossedOutItem*)pState;
1123b9e67834SAndre Fischer                 meStrike = (FontStrikeout)pItem->GetValue();
1124b9e67834SAndre Fischer             }
1125b9e67834SAndre Fischer             else
1126b9e67834SAndre Fischer             {
1127b9e67834SAndre Fischer                 meStrike = STRIKEOUT_NONE;
1128b9e67834SAndre Fischer             }
112945da7d5eSAndre Fischer             mpToolBoxFont->EnableItem(TBI_STRIKEOUT, bIsEnabled);
113045da7d5eSAndre Fischer             mpToolBoxFont->SetItemState(TBI_STRIKEOUT,
113145da7d5eSAndre Fischer                 meStrike!=STRIKEOUT_NONE && meStrike!=STRIKEOUT_DONTKNOW
113245da7d5eSAndre Fischer                     ? STATE_CHECK
113345da7d5eSAndre Fischer                     : STATE_NOCHECK);
1134b9e67834SAndre Fischer             break;
113545da7d5eSAndre Fischer 
1136b9e67834SAndre Fischer         case SID_ATTR_CHAR_COLOR:
1137b9e67834SAndre Fischer             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxColorItem))
1138b9e67834SAndre Fischer             {
1139d4aefcaeSZheng Fan                 const SvxColorItem* pItem =  (const SvxColorItem*)pState;
1140d4aefcaeSZheng Fan                 maColor = pItem->GetValue();
1141b9e67834SAndre Fischer                 mbColorAvailable = true;
114295a18594SAndre Fischer 				if (mpFontColorUpdater)
114395a18594SAndre Fischer 	                mpFontColorUpdater->Update(maColor);
1144b9e67834SAndre Fischer             }
1145b9e67834SAndre Fischer             else
1146b9e67834SAndre Fischer             {
1147b9e67834SAndre Fischer                 mbColorAvailable = false;
1148b9e67834SAndre Fischer                 maColor.SetColor(COL_AUTO);
114995a18594SAndre Fischer 				if (mpFontColorUpdater)
115095a18594SAndre Fischer 					mpFontColorUpdater->Update(maColor);
1151b9e67834SAndre Fischer             }
115245da7d5eSAndre Fischer             mpToolBoxFontColor->EnableItem(TBI_FONTCOLOR, bIsEnabled);
1153b9e67834SAndre Fischer             break;
115445da7d5eSAndre Fischer 
1155b9e67834SAndre Fischer         case SID_ATTR_BRUSH_CHAR:
1156b9e67834SAndre Fischer             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxBrushItem))
1157b9e67834SAndre Fischer             {
1158b9e67834SAndre Fischer                 const SvxBrushItem* pItem =  (const SvxBrushItem*)pState;
1159b9e67834SAndre Fischer                 maBackColor = pItem->GetColor();
1160b9e67834SAndre Fischer                 mbBackColorAvailable = true;
11617a32b0c8SAndre Fischer                 if (mpHighlightUpdater)
11627a32b0c8SAndre Fischer                     mpHighlightUpdater->Update(maBackColor);
1163b9e67834SAndre Fischer             }
1164b9e67834SAndre Fischer             else
1165b9e67834SAndre Fischer             {
1166b9e67834SAndre Fischer                 mbBackColorAvailable = false;
1167b9e67834SAndre Fischer                 maBackColor.SetColor(COL_AUTO);
11687a32b0c8SAndre Fischer                 if (mpHighlightUpdater)
11697a32b0c8SAndre Fischer                     mpHighlightUpdater->Update(maBackColor);
1170b9e67834SAndre Fischer             }
117145da7d5eSAndre Fischer             mpToolBoxHighlight->EnableItem(TBI_HIGHLIGHT, bIsEnabled);
1172b9e67834SAndre Fischer             break;
117345da7d5eSAndre Fischer 
1174b9e67834SAndre Fischer         case SID_ATTR_CHAR_ESCAPEMENT:
117545da7d5eSAndre Fischer         {
117645da7d5eSAndre Fischer             bool bIsItemEnabled (true);
117745da7d5eSAndre Fischer             if (eState == SFX_ITEM_AVAILABLE)
1178b9e67834SAndre Fischer             {
117945da7d5eSAndre Fischer                 if (pState->ISA(SvxEscapementItem))
1180b9e67834SAndre Fischer                 {
1181b9e67834SAndre Fischer                     const SvxEscapementItem* pItem = (const SvxEscapementItem *)pState;
1182b9e67834SAndre Fischer                     short nEsc = pItem->GetEsc();
1183b9e67834SAndre Fischer                     if(nEsc == 0)
118445da7d5eSAndre Fischer                     {
1185b9e67834SAndre Fischer                         meEscape = SVX_ESCAPEMENT_OFF;
118645da7d5eSAndre Fischer                         mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_NOCHECK);
118745da7d5eSAndre Fischer                         mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_NOCHECK);
118845da7d5eSAndre Fischer                     }
1189b9e67834SAndre Fischer                     else if(nEsc > 0)
119045da7d5eSAndre Fischer                     {
1191b9e67834SAndre Fischer                         meEscape = SVX_ESCAPEMENT_SUPERSCRIPT;
119245da7d5eSAndre Fischer                         mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_CHECK);
119345da7d5eSAndre Fischer                         mpToolBoxScriptSw->SetItemState(TBI_SUB_SW,	STATE_NOCHECK);
119445da7d5eSAndre Fischer                     }
1195b9e67834SAndre Fischer                     else
119645da7d5eSAndre Fischer                     {
1197b9e67834SAndre Fischer                         meEscape = SVX_ESCAPEMENT_SUBSCRIPT;
119845da7d5eSAndre Fischer                         mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_NOCHECK);
119945da7d5eSAndre Fischer                         mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_CHECK);
120045da7d5eSAndre Fischer                     }
1201b9e67834SAndre Fischer                 }
1202b9e67834SAndre Fischer                 else
1203b9e67834SAndre Fischer                 {
1204b9e67834SAndre Fischer                     meEscape = SVX_ESCAPEMENT_OFF;
120545da7d5eSAndre Fischer                     mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_NOCHECK);
120645da7d5eSAndre Fischer                     mpToolBoxScriptSw->SetItemState(TBI_SUB_SW,	STATE_NOCHECK);
1207b9e67834SAndre Fischer                 }
1208b9e67834SAndre Fischer             }
120945da7d5eSAndre Fischer             else if (eState == SFX_ITEM_DISABLED)
1210b9e67834SAndre Fischer             {
121145da7d5eSAndre Fischer                 bIsItemEnabled = false;
1212b9e67834SAndre Fischer             }
1213b9e67834SAndre Fischer             else
1214b9e67834SAndre Fischer             {
1215b9e67834SAndre Fischer                 meEscape = SVX_ESCAPEMENT_OFF;
1216b9e67834SAndre Fischer             }
121745da7d5eSAndre Fischer             mpToolBoxScriptSw->EnableItem(TBI_SUPER, bIsItemEnabled && bIsEnabled);
121845da7d5eSAndre Fischer             mpToolBoxScriptSw->EnableItem(TBI_SUB, bIsItemEnabled && bIsEnabled);
1219b9e67834SAndre Fischer             break;
122045da7d5eSAndre Fischer         }
122145da7d5eSAndre Fischer 
1222b9e67834SAndre Fischer         case SID_SET_SUB_SCRIPT:
1223b9e67834SAndre Fischer             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SfxBoolItem))
1224b9e67834SAndre Fischer             {
1225b9e67834SAndre Fischer                 const SfxBoolItem* pItem = (const SfxBoolItem*)pState;
1226b9e67834SAndre Fischer                 mbSub = pItem->GetValue();
1227b9e67834SAndre Fischer             }
1228b9e67834SAndre Fischer             else
1229b9e67834SAndre Fischer             {
1230b9e67834SAndre Fischer                 mbSub = false;
1231b9e67834SAndre Fischer             }
123245da7d5eSAndre Fischer             mpToolBoxScript->EnableItem(TBI_SUB, bIsEnabled);
123345da7d5eSAndre Fischer             mpToolBoxScript->SetItemState(TBI_SUB, mbSub ? STATE_CHECK : STATE_NOCHECK);
1234b9e67834SAndre Fischer             break;
123545da7d5eSAndre Fischer 
1236b9e67834SAndre Fischer         case SID_SET_SUPER_SCRIPT:
1237b9e67834SAndre Fischer             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SfxBoolItem))
1238b9e67834SAndre Fischer             {
1239b9e67834SAndre Fischer                 const SfxBoolItem* pItem = (const SfxBoolItem*)pState;
1240b9e67834SAndre Fischer                 mbSuper = pItem->GetValue();
1241b9e67834SAndre Fischer             }
1242b9e67834SAndre Fischer             else
1243b9e67834SAndre Fischer             {
1244b9e67834SAndre Fischer                 mbSuper = false;
1245b9e67834SAndre Fischer             }
124645da7d5eSAndre Fischer             mpToolBoxScript->EnableItem(TBI_SUPER, bIsEnabled);
124745da7d5eSAndre Fischer             mpToolBoxScript->SetItemState(TBI_SUPER, mbSuper ? STATE_CHECK : STATE_NOCHECK);
1248b9e67834SAndre Fischer             break;
124945da7d5eSAndre Fischer 
1250b9e67834SAndre Fischer         case SID_ATTR_CHAR_KERNING:
1251b9e67834SAndre Fischer             if ( SFX_ITEM_AVAILABLE == eState )
1252b9e67834SAndre Fischer             {
1253b9e67834SAndre Fischer                 mbKernLBAvailable = true;
1254b9e67834SAndre Fischer 
1255b9e67834SAndre Fischer                 if(pState->ISA(SvxKerningItem))
1256b9e67834SAndre Fischer                 {
1257b9e67834SAndre Fischer                     const SvxKerningItem* pKerningItem  = (const SvxKerningItem*)pState;
1258b9e67834SAndre Fischer                     mlKerning = (long)pKerningItem->GetValue();
1259b9e67834SAndre Fischer                     mbKernAvailable = true;
1260b9e67834SAndre Fischer                 }
1261b9e67834SAndre Fischer                 else
1262b9e67834SAndre Fischer                 {
1263b9e67834SAndre Fischer                     mlKerning = 0;
1264b9e67834SAndre Fischer                     mbKernAvailable =false;
1265b9e67834SAndre Fischer                 }
1266b9e67834SAndre Fischer             }
1267b9e67834SAndre Fischer             else if (SFX_ITEM_DISABLED == eState)
1268b9e67834SAndre Fischer             {
1269b9e67834SAndre Fischer                 mbKernLBAvailable = false;
1270b9e67834SAndre Fischer                 mbKernAvailable = false;
1271b9e67834SAndre Fischer                 mlKerning = 0;
1272b9e67834SAndre Fischer             }
1273b9e67834SAndre Fischer             else
1274b9e67834SAndre Fischer             {
1275b9e67834SAndre Fischer                 mbKernLBAvailable = true;
1276b9e67834SAndre Fischer                 mbKernAvailable = false;
1277b9e67834SAndre Fischer                 mlKerning = 0;
1278b9e67834SAndre Fischer             }
127945da7d5eSAndre Fischer             mpToolBoxSpacing->EnableItem(TBI_SPACING, bIsEnabled);
1280b9e67834SAndre Fischer             break;
1281b9e67834SAndre Fischer 
1282b9e67834SAndre Fischer             // font size +/- enhancement in sd
1283b9e67834SAndre Fischer         case SID_SHRINK_FONT_SIZE:
1284b9e67834SAndre Fischer         case SID_GROW_FONT_SIZE:
128545da7d5eSAndre Fischer             switch(maContext.GetCombinedContext_DI())
128645da7d5eSAndre Fischer             {
128745da7d5eSAndre Fischer                 case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
128845da7d5eSAndre Fischer                 case CombinedEnumContext(Application_DrawImpress, Context_Text):
128945da7d5eSAndre Fischer                 case CombinedEnumContext(Application_DrawImpress, Context_Table):
129045da7d5eSAndre Fischer                 case CombinedEnumContext(Application_DrawImpress, Context_OutlineText):
129145da7d5eSAndre Fischer                 case CombinedEnumContext(Application_DrawImpress, Context_Draw):
129245da7d5eSAndre Fischer                 case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
129345da7d5eSAndre Fischer                 case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
129445da7d5eSAndre Fischer                     if(eState == SFX_ITEM_DISABLED)
129545da7d5eSAndre Fischer                         mpToolBoxIncDec->Disable();
129645da7d5eSAndre Fischer                     else
129745da7d5eSAndre Fischer                         mpToolBoxIncDec->Enable();
1298b9e67834SAndre Fischer                 break;
129945da7d5eSAndre Fischer             }
130045da7d5eSAndre Fischer             const sal_Int32 nSize (maFontSizeBox.GetValue());
130145da7d5eSAndre Fischer             if (nSID == SID_GROW_FONT_SIZE)
130245da7d5eSAndre Fischer                 mpToolBoxIncDec->EnableItem(TBI_INCREASE, bIsEnabled && nSize<960);
130345da7d5eSAndre Fischer             else
130445da7d5eSAndre Fischer                 mpToolBoxIncDec->EnableItem(TBI_DECREASE, bIsEnabled && nSize>60);
130545da7d5eSAndre Fischer             break;
1306b9e67834SAndre Fischer     }
1307b9e67834SAndre Fischer }
1308b9e67834SAndre Fischer 
1309b9e67834SAndre Fischer 
1310b9e67834SAndre Fischer 
1311b9e67834SAndre Fischer 
131245da7d5eSAndre Fischer void TextPropertyPanel::UpdateItem (const sal_uInt16 nSlotId)
1313b9e67834SAndre Fischer {
131445da7d5eSAndre Fischer     switch (nSlotId)
131545da7d5eSAndre Fischer     {
131645da7d5eSAndre Fischer         case SID_ATTR_CHAR_FONT:
131745da7d5eSAndre Fischer             maFontNameControl.RequestUpdate();
131845da7d5eSAndre Fischer             break;
131945da7d5eSAndre Fischer         case SID_ATTR_CHAR_FONTHEIGHT:
132045da7d5eSAndre Fischer             maFontSizeControl.RequestUpdate();
132145da7d5eSAndre Fischer             break;
132245da7d5eSAndre Fischer         case SID_ATTR_CHAR_WEIGHT:
132345da7d5eSAndre Fischer             maWeightControl.RequestUpdate();
132445da7d5eSAndre Fischer             break;
132545da7d5eSAndre Fischer         case SID_ATTR_CHAR_POSTURE:
132645da7d5eSAndre Fischer             maItalicControl.RequestUpdate();
132745da7d5eSAndre Fischer             break;
132845da7d5eSAndre Fischer         case SID_ATTR_CHAR_UNDERLINE:
132945da7d5eSAndre Fischer             maUnderlineControl.RequestUpdate();
133045da7d5eSAndre Fischer             break;
133145da7d5eSAndre Fischer         case SID_ATTR_CHAR_STRIKEOUT:
133245da7d5eSAndre Fischer             maStrikeControl.RequestUpdate();
133345da7d5eSAndre Fischer             break;
133445da7d5eSAndre Fischer         case SID_ATTR_CHAR_SHADOWED:
133545da7d5eSAndre Fischer             maShadowControl.RequestUpdate();
133645da7d5eSAndre Fischer             break;
133745da7d5eSAndre Fischer         case SID_ATTR_CHAR_COLOR:
133845da7d5eSAndre Fischer             maFontColorControl.RequestUpdate();
133945da7d5eSAndre Fischer             break;
134045da7d5eSAndre Fischer         case SID_ATTR_CHAR_ESCAPEMENT:
134145da7d5eSAndre Fischer             maScriptControlSw.RequestUpdate();
134245da7d5eSAndre Fischer             break;
134345da7d5eSAndre Fischer         case SID_SET_SUPER_SCRIPT:
134445da7d5eSAndre Fischer             maSuperScriptControl.RequestUpdate();
134545da7d5eSAndre Fischer             break;
134645da7d5eSAndre Fischer         case SID_SET_SUB_SCRIPT:
134745da7d5eSAndre Fischer             maSubScriptControl.RequestUpdate();
134845da7d5eSAndre Fischer             break;
134945da7d5eSAndre Fischer         case SID_ATTR_CHAR_KERNING:
135045da7d5eSAndre Fischer             maSpacingControl.RequestUpdate();
135145da7d5eSAndre Fischer             break;
135245da7d5eSAndre Fischer         case SID_ATTR_BRUSH_CHAR:
135345da7d5eSAndre Fischer             maHighlightControl.RequestUpdate();
135445da7d5eSAndre Fischer             break;
135545da7d5eSAndre Fischer         case SID_GROW_FONT_SIZE:
135645da7d5eSAndre Fischer             maSDFontGrow.RequestUpdate();
135745da7d5eSAndre Fischer             break;
135845da7d5eSAndre Fischer         case SID_SHRINK_FONT_SIZE:
135945da7d5eSAndre Fischer             maSDFontShrink.RequestUpdate();
136045da7d5eSAndre Fischer             break;
136145da7d5eSAndre Fischer     }
1362b9e67834SAndre Fischer }
1363b9e67834SAndre Fischer 
1364b9e67834SAndre Fischer 
1365b9e67834SAndre Fischer 
1366b9e67834SAndre Fischer 
1367b9e67834SAndre Fischer 
1368d4aefcaeSZheng Fan void TextPropertyPanel::SetFontColor (
1369a7d1eb6fSPavel Janík     const String& /* rsColorName */,
1370d4aefcaeSZheng Fan     const Color aColor)
1371b9e67834SAndre Fischer {
1372d4aefcaeSZheng Fan 	SvxColorItem aColorItem(aColor, SID_ATTR_CHAR_COLOR);
1373d4aefcaeSZheng Fan 	mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_COLOR, SFX_CALLMODE_RECORD, &aColorItem, 0L);
1374d4aefcaeSZheng Fan 	maColor = aColor;
1375b9e67834SAndre Fischer }
1376b9e67834SAndre Fischer 
1377d4aefcaeSZheng Fan void TextPropertyPanel::SetBrushColor (
1378a7d1eb6fSPavel Janík     const String& /* rsColorName */,
1379d4aefcaeSZheng Fan     const Color aColor)
1380b9e67834SAndre Fischer {
1381d4aefcaeSZheng Fan 	SvxBrushItem aBrushItem(aColor, SID_ATTR_BRUSH_CHAR);
1382d4aefcaeSZheng Fan 	mpBindings->GetDispatcher()->Execute(SID_ATTR_BRUSH_CHAR, SFX_CALLMODE_RECORD, &aBrushItem, 0L);
1383d4aefcaeSZheng Fan 	maBackColor = aColor;
1384b9e67834SAndre Fischer }
1385d4aefcaeSZheng Fan 
1386d4aefcaeSZheng Fan Color& TextPropertyPanel::GetUnderlineColor()
1387b9e67834SAndre Fischer {
1388d4aefcaeSZheng Fan 	return meUnderlineColor;
1389b9e67834SAndre Fischer }
1390d4aefcaeSZheng Fan 
1391da72173fSAndre Fischer void TextPropertyPanel::SetUnderline(FontUnderline	eUnderline)
1392da72173fSAndre Fischer {
1393da72173fSAndre Fischer 	meUnderline = eUnderline;
1394da72173fSAndre Fischer }
1395d4aefcaeSZheng Fan 
139645da7d5eSAndre Fischer 
139745da7d5eSAndre Fischer 
1398b9e67834SAndre Fischer } } // end of namespace svx::sidebar
1399