xref: /trunk/main/svx/source/sidebar/text/TextPropertyPanel.cxx (revision f79579d236f343ae3312b2cfaff8b5fda5535fe2)
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 }
120b9e67834SAndre Fischer 
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 }
135d4aefcaeSZheng Fan 
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,
149*f79579d2SAndre Fischer     SfxBindings* pBindings)
150b9e67834SAndre Fischer {
151b9e67834SAndre Fischer     if (pParent == NULL)
152b9e67834SAndre Fischer         throw lang::IllegalArgumentException(A2S("no parent Window given to TextPropertyPanel::Create"), NULL, 0);
153b9e67834SAndre Fischer     if ( ! rxFrame.is())
154b9e67834SAndre Fischer         throw lang::IllegalArgumentException(A2S("no XFrame given to TextPropertyPanel::Create"), NULL, 1);
155b9e67834SAndre Fischer     if (pBindings == NULL)
156b9e67834SAndre Fischer         throw lang::IllegalArgumentException(A2S("no SfxBindings given to TextPropertyPanel::Create"), NULL, 2);
157b9e67834SAndre Fischer 
15895a18594SAndre Fischer     return new TextPropertyPanel(
159b9e67834SAndre Fischer         pParent,
160b9e67834SAndre Fischer         rxFrame,
161*f79579d2SAndre Fischer         pBindings);
162b9e67834SAndre Fischer }
163b9e67834SAndre Fischer 
164b9e67834SAndre Fischer 
165d4aefcaeSZheng Fan ::sfx2::sidebar::ControllerItem& TextPropertyPanel::GetSpaceController()
166d4aefcaeSZheng Fan {
167d4aefcaeSZheng Fan     return maSpacingControl;
168d4aefcaeSZheng Fan }
169b9e67834SAndre Fischer 
170b9e67834SAndre Fischer TextPropertyPanel::TextPropertyPanel (
171b9e67834SAndre Fischer     Window* pParent,
172b9e67834SAndre Fischer     const cssu::Reference<css::frame::XFrame>& rxFrame,
173*f79579d2SAndre Fischer     SfxBindings* pBindings)
17495a18594SAndre Fischer     :   Control(pParent, SVX_RES(RID_SIDEBAR_TEXT_PANEL)),
175b9e67834SAndre Fischer         mpFontNameBox (new SvxSBFontNameBox(this, SVX_RES(CB_SBFONT_FONT))),
176b9e67834SAndre Fischer         maFontSizeBox       (this, SVX_RES(MB_SBFONT_FONTSIZE)),
1777a32b0c8SAndre Fischer         mpToolBoxIncDecBackground(ControlFactory::CreateToolBoxBackground(this)),
1787a32b0c8SAndre Fischer         mpToolBoxIncDec(ControlFactory::CreateToolBox(
1797a32b0c8SAndre Fischer                 mpToolBoxIncDecBackground.get(),
1807a32b0c8SAndre Fischer                 SVX_RES(TB_INCREASE_DECREASE))),
1817a32b0c8SAndre Fischer         mpToolBoxFontBackground(ControlFactory::CreateToolBoxBackground(this)),
1827a32b0c8SAndre Fischer         mpToolBoxFont(ControlFactory::CreateToolBox(
1837a32b0c8SAndre Fischer                 mpToolBoxFontBackground.get(),
1847a32b0c8SAndre Fischer                 SVX_RES(TB_FONT))),
1857a32b0c8SAndre Fischer         mpToolBoxFontColorBackground(ControlFactory::CreateToolBoxBackground(this)),
1867a32b0c8SAndre Fischer         mpToolBoxFontColor(ControlFactory::CreateToolBox(
1877a32b0c8SAndre Fischer                 mpToolBoxFontColorBackground.get(),
1887a32b0c8SAndre Fischer                 SVX_RES(TB_FONTCOLOR))),
1897a32b0c8SAndre Fischer         mpToolBoxScriptBackground(ControlFactory::CreateToolBoxBackground(this)),
1907a32b0c8SAndre Fischer         mpToolBoxScript(ControlFactory::CreateToolBox(
1917a32b0c8SAndre Fischer                 mpToolBoxScriptBackground.get(),
1927a32b0c8SAndre Fischer                 SVX_RES(TB_SCRIPT))),
1937a32b0c8SAndre Fischer         mpToolBoxScriptSwBackground(ControlFactory::CreateToolBoxBackground(this)),
1947a32b0c8SAndre Fischer         mpToolBoxScriptSw(ControlFactory::CreateToolBox(
1957a32b0c8SAndre Fischer                 mpToolBoxScriptSwBackground.get(),
1967a32b0c8SAndre Fischer                 SVX_RES(TB_SCRIPT_SW))),
1977a32b0c8SAndre Fischer         mpToolBoxSpacingBackground(ControlFactory::CreateToolBoxBackground(this)),
1987a32b0c8SAndre Fischer         mpToolBoxSpacing(ControlFactory::CreateToolBox(
1997a32b0c8SAndre Fischer                 mpToolBoxSpacingBackground.get(),
2007a32b0c8SAndre Fischer                 SVX_RES(TB_SPACING))),
2017a32b0c8SAndre Fischer         mpToolBoxHighlightBackground(ControlFactory::CreateToolBoxBackground(this)),
2027a32b0c8SAndre Fischer         mpToolBoxHighlight(ControlFactory::CreateToolBox(
2037a32b0c8SAndre Fischer                 mpToolBoxHighlightBackground.get(),
2047a32b0c8SAndre Fischer                 SVX_RES(TB_HIGHLIGHT))),
205b9e67834SAndre Fischer         mpFontColorUpdater(),
206b9e67834SAndre Fischer         mpHighlightUpdater(),
207b9e67834SAndre Fischer 
20845da7d5eSAndre Fischer         maFontNameControl   (SID_ATTR_CHAR_FONT,        *pBindings, *this, A2S("CharFontName"), rxFrame),
20945da7d5eSAndre Fischer         maFontSizeControl   (SID_ATTR_CHAR_FONTHEIGHT,  *pBindings, *this, A2S("FontHeight"),   rxFrame),
21045da7d5eSAndre Fischer         maWeightControl     (SID_ATTR_CHAR_WEIGHT,      *pBindings, *this, A2S("Bold"),         rxFrame),
21145da7d5eSAndre Fischer         maItalicControl     (SID_ATTR_CHAR_POSTURE,     *pBindings, *this, A2S("Italic"),       rxFrame),
21245da7d5eSAndre Fischer         maUnderlineControl  (SID_ATTR_CHAR_UNDERLINE,   *pBindings, *this, A2S("Underline"),    rxFrame),
21345da7d5eSAndre Fischer         maStrikeControl     (SID_ATTR_CHAR_STRIKEOUT,   *pBindings, *this, A2S("Strikeout"),    rxFrame),
21445da7d5eSAndre Fischer         maShadowControl     (SID_ATTR_CHAR_SHADOWED,    *pBindings, *this, A2S("Shadowed"),     rxFrame),
21545da7d5eSAndre Fischer         maFontColorControl  (SID_ATTR_CHAR_COLOR,       *pBindings, *this, A2S("Color"),        rxFrame),
21645da7d5eSAndre Fischer         maScriptControlSw   (SID_ATTR_CHAR_ESCAPEMENT,  *pBindings, *this, A2S("Escapement"),   rxFrame),
21745da7d5eSAndre Fischer         maSuperScriptControl(SID_SET_SUPER_SCRIPT,      *pBindings, *this, A2S("SuperScript"),  rxFrame),
21845da7d5eSAndre Fischer         maSubScriptControl  (SID_SET_SUB_SCRIPT,        *pBindings, *this, A2S("SubScript"),    rxFrame),
21945da7d5eSAndre Fischer         maSpacingControl    (SID_ATTR_CHAR_KERNING,     *pBindings, *this, A2S("Spacing"),      rxFrame),
22045da7d5eSAndre Fischer         maHighlightControl  (SID_ATTR_BRUSH_CHAR, *pBindings, *this, A2S("CharacterBackgroundPattern"),rxFrame),
22145da7d5eSAndre Fischer         maSDFontGrow        (SID_GROW_FONT_SIZE,        *pBindings, *this, A2S("Grow"),         rxFrame),
22245da7d5eSAndre Fischer         maSDFontShrink      (SID_SHRINK_FONT_SIZE,      *pBindings, *this, A2S("Shrink"),       rxFrame),
223b9e67834SAndre Fischer 
224b9e67834SAndre Fischer         mpFontList          (NULL),
225b9e67834SAndre Fischer         mbMustDelete        (false),
226b9e67834SAndre Fischer         mbFocusOnFontSizeCtrl(false),
227a7d1eb6fSPavel Janík         maCharSpacePopup(this, ::boost::bind(&TextPropertyPanel::CreateCharacterSpacingControl, this, _1)),
228a7d1eb6fSPavel Janík         maUnderlinePopup(this, ::boost::bind(&TextPropertyPanel::CreateUnderlinePopupControl, this, _1)),
229a7d1eb6fSPavel Janík         maFontColorPopup(this, ::boost::bind(&TextPropertyPanel::CreateFontColorPopupControl, this, _1)),
230a7d1eb6fSPavel Janík         maBrushColorPopup(this, ::boost::bind(&TextPropertyPanel::CreateBrushColorPopupControl, this, _1)),
23195a18594SAndre Fischer         mxFrame(rxFrame),
232b9e67834SAndre Fischer         maContext(),
233*f79579d2SAndre Fischer         mpBindings(pBindings)
234b9e67834SAndre Fischer {
235b9e67834SAndre Fischer     Initialize();
236b9e67834SAndre Fischer     FreeResource();
237b9e67834SAndre Fischer }
238b9e67834SAndre Fischer 
239b9e67834SAndre Fischer 
240b9e67834SAndre Fischer 
241b9e67834SAndre Fischer 
242b9e67834SAndre Fischer TextPropertyPanel::~TextPropertyPanel (void)
243b9e67834SAndre Fischer {
244b9e67834SAndre Fischer     if(mbMustDelete)
245b9e67834SAndre Fischer         delete mpFontList;
246b9e67834SAndre Fischer 
2477a32b0c8SAndre Fischer     // Destroy the toolbox windows.
2487a32b0c8SAndre Fischer     mpToolBoxIncDec.reset();
2497a32b0c8SAndre Fischer     mpToolBoxFont.reset();
2507a32b0c8SAndre Fischer     mpToolBoxFontColor.reset();
2517a32b0c8SAndre Fischer     mpToolBoxScript.reset();
2527a32b0c8SAndre Fischer     mpToolBoxScriptSw.reset();
2537a32b0c8SAndre Fischer     mpToolBoxSpacing.reset();
2547a32b0c8SAndre Fischer     mpToolBoxHighlight.reset();
2557a32b0c8SAndre Fischer 
2567a32b0c8SAndre Fischer     // Destroy the background windows of the toolboxes.
2577a32b0c8SAndre Fischer     mpToolBoxIncDecBackground.reset();
2587a32b0c8SAndre Fischer     mpToolBoxFontBackground.reset();
2597a32b0c8SAndre Fischer     mpToolBoxFontColorBackground.reset();
2607a32b0c8SAndre Fischer     mpToolBoxScriptBackground.reset();
2617a32b0c8SAndre Fischer     mpToolBoxScriptSwBackground.reset();
2627a32b0c8SAndre Fischer     mpToolBoxSpacingBackground.reset();
2637a32b0c8SAndre Fischer     mpToolBoxHighlightBackground.reset();
264b9e67834SAndre Fischer }
265b9e67834SAndre Fischer 
266b9e67834SAndre Fischer 
267b9e67834SAndre Fischer 
268b9e67834SAndre Fischer 
269d4aefcaeSZheng Fan void TextPropertyPanel::SetSpacing(long nKern)
270d4aefcaeSZheng Fan {
271d4aefcaeSZheng Fan     mlKerning = nKern;
272d4aefcaeSZheng Fan }
27395a18594SAndre Fischer 
27495a18594SAndre Fischer 
275b9e67834SAndre Fischer void TextPropertyPanel::HandleContextChange (
276b9e67834SAndre Fischer     const ::sfx2::sidebar::EnumContext aContext)
277b9e67834SAndre Fischer {
278b9e67834SAndre Fischer     if (maContext == aContext)
279b9e67834SAndre Fischer     {
280b9e67834SAndre Fischer         // Nothing to do.
281b9e67834SAndre Fischer         return;
282b9e67834SAndre Fischer     }
283b9e67834SAndre Fischer 
284b9e67834SAndre Fischer     maContext = aContext;
28565be1ea2SAndre Fischer     switch (maContext.GetCombinedContext_DI())
286b9e67834SAndre Fischer     {
287b9e67834SAndre Fischer         case CombinedEnumContext(Application_Calc, Context_Cell):
288b9e67834SAndre Fischer         case CombinedEnumContext(Application_Calc, Context_Pivot):
289b9e67834SAndre Fischer             mpToolBoxScriptSw->Hide();
290b9e67834SAndre Fischer             mpToolBoxHighlight->Hide();
291*f79579d2SAndre Fischer             mpToolBoxScript->Disable();
292*f79579d2SAndre Fischer             mpToolBoxSpacing->Disable();
293b9e67834SAndre Fischer             break;
294*f79579d2SAndre Fischer 
295*f79579d2SAndre Fischer         case CombinedEnumContext(Application_Calc, Context_EditCell):
296*f79579d2SAndre Fischer         case CombinedEnumContext(Application_Calc, Context_DrawText):
297*f79579d2SAndre Fischer             mpToolBoxScriptSw->Hide();
298*f79579d2SAndre Fischer             mpToolBoxHighlight->Hide();
299*f79579d2SAndre Fischer             mpToolBoxScript->Enable();
300*f79579d2SAndre Fischer             mpToolBoxSpacing->Enable();
301*f79579d2SAndre Fischer             break;
302b9e67834SAndre Fischer 
30385f1aca2SAndre Fischer         case CombinedEnumContext(Application_WriterVariants, Context_Text):
30485f1aca2SAndre Fischer         case CombinedEnumContext(Application_WriterVariants, Context_Table):
305b9e67834SAndre Fischer             mpToolBoxScriptSw->Show();
306b9e67834SAndre Fischer             mpToolBoxScript->Hide();
307b9e67834SAndre Fischer             mpToolBoxHighlight->Show();
308b9e67834SAndre Fischer             mpToolBoxSpacing->Show();
309b9e67834SAndre Fischer             break;
310b9e67834SAndre Fischer 
31185f1aca2SAndre Fischer         case CombinedEnumContext(Application_WriterVariants, Context_DrawText):
31285f1aca2SAndre Fischer         case CombinedEnumContext(Application_WriterVariants, Context_Annotation):
313b9e67834SAndre Fischer             mpToolBoxScriptSw->Show();
314b9e67834SAndre Fischer             mpToolBoxScript->Hide();
315b9e67834SAndre Fischer             mpToolBoxSpacing->Show();
316b9e67834SAndre Fischer             mpToolBoxHighlight->Hide();
317b9e67834SAndre Fischer             break;
318b9e67834SAndre Fischer 
31937fee4fdSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
32037fee4fdSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_Text):
32137fee4fdSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_Table):
32237fee4fdSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_OutlineText):
32337fee4fdSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_Draw):
32437fee4fdSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
32537fee4fdSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
326b9e67834SAndre Fischer             mpToolBoxScriptSw->Hide();
327b9e67834SAndre Fischer             mpToolBoxScript->Show();
328b9e67834SAndre Fischer             mpToolBoxSpacing->Show();
329b9e67834SAndre Fischer             mpToolBoxHighlight->Hide();
330b9e67834SAndre Fischer             break;
331b9e67834SAndre Fischer 
332b9e67834SAndre Fischer         default:
333b9e67834SAndre Fischer             break;
334b9e67834SAndre Fischer     }
335b9e67834SAndre Fischer }
336b9e67834SAndre Fischer 
33745da7d5eSAndre Fischer 
338b9e67834SAndre Fischer 
339b9e67834SAndre Fischer 
340b9e67834SAndre Fischer void TextPropertyPanel::DataChanged (const DataChangedEvent& rEvent)
341b9e67834SAndre Fischer {
34295a18594SAndre Fischer     (void)rEvent;
34395a18594SAndre Fischer 
34445da7d5eSAndre Fischer     SetupToolboxItems();
345b9e67834SAndre Fischer }
346b9e67834SAndre Fischer 
347b9e67834SAndre Fischer 
348b9e67834SAndre Fischer 
349b9e67834SAndre Fischer void TextPropertyPanel::Initialize (void)
350b9e67834SAndre Fischer {
351b9e67834SAndre Fischer     //<<modify fill font list
352b9e67834SAndre Fischer     SfxObjectShell* pDocSh = SfxObjectShell::Current();
353b9e67834SAndre Fischer     const SfxPoolItem* pItem = NULL;
354b9e67834SAndre Fischer 
355b9e67834SAndre Fischer     if (pDocSh != NULL)
356b9e67834SAndre Fischer         pItem = pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST );
357b9e67834SAndre Fischer     if (pItem != NULL)
358b9e67834SAndre Fischer         mpFontList = ( (SvxFontListItem*)pItem )->GetFontList();
359b9e67834SAndre Fischer     else
360b9e67834SAndre Fischer     {
361b9e67834SAndre Fischer         mpFontList = new FontList( Application::GetDefaultDevice() );
36245da7d5eSAndre Fischer         mbMustDelete = true;
363b9e67834SAndre Fischer     }
364b9e67834SAndre Fischer 
365b9e67834SAndre Fischer     mpFontNameBox->SetAccessibleName(mpFontNameBox->GetQuickHelpText());
36695a18594SAndre Fischer     const FontInfo aFontInfo (mpFontList->Get( String::CreateFromAscii( "" ), String::CreateFromAscii( "" )));
36795a18594SAndre Fischer     maFontSizeBox.Fill(&aFontInfo,mpFontList);
368b9e67834SAndre Fischer     maFontSizeBox.SetAccessibleName(maFontSizeBox.GetQuickHelpText());
369b9e67834SAndre Fischer 
370b9e67834SAndre Fischer     //toolbox
37145da7d5eSAndre Fischer     SetupToolboxItems();
372b9e67834SAndre Fischer     InitToolBoxIncDec();
373b9e67834SAndre Fischer     InitToolBoxFont();
374b9e67834SAndre Fischer     InitToolBoxFontColor();
375b9e67834SAndre Fischer     InitToolBoxScript();
376b9e67834SAndre Fischer     InitToolBoxSpacing();
377b9e67834SAndre Fischer     InitToolBoxHighlight();
378b9e67834SAndre Fischer 
379b9e67834SAndre Fischer #ifdef HAS_IA2
380d4aefcaeSZheng Fan     mpFontNameBox->SetAccRelationLabeledBy(&mpFontNameBox);
381d4aefcaeSZheng Fan     mpFontNameBox->SetMpSubEditAccLableBy(&mpFontNameBox);
382b9e67834SAndre Fischer     maFontSizeBox.SetAccRelationLabeledBy(&maFontSizeBox);
383b9e67834SAndre Fischer     maFontSizeBox.SetMpSubEditAccLableBy(&maFontSizeBox);
384d4aefcaeSZheng Fan     mpToolBoxFont.SetAccRelationLabeledBy(&mpToolBoxFont);
385d4aefcaeSZheng Fan     mpToolBoxIncDec.SetAccRelationLabeledBy(&mpToolBoxIncDec);
386d4aefcaeSZheng Fan     mpToolBoxFontColor.SetAccRelationLabeledBy(&mpToolBoxFontColor);
387d4aefcaeSZheng Fan     mpToolBoxScript.SetAccRelationLabeledBy(&mpToolBoxScript);
388d4aefcaeSZheng Fan     mpToolBoxScriptSw.SetAccRelationLabeledBy(&mpToolBoxScriptSw);
389d4aefcaeSZheng Fan     mpToolBoxSpacing.SetAccRelationLabeledBy(&mpToolBoxSpacing);
390d4aefcaeSZheng Fan     mpToolBoxHighlight.SetAccRelationLabeledBy(&mpToolBoxHighlight);
391b9e67834SAndre Fischer #endif
392b9e67834SAndre Fischer 
393b9e67834SAndre Fischer     //init state
394b9e67834SAndre Fischer     mpHeightItem = NULL;
395b9e67834SAndre Fischer     meWeight = WEIGHT_NORMAL;
396b9e67834SAndre Fischer     meItalic = ITALIC_NONE;
397b9e67834SAndre Fischer     mbShadow = false;
398b9e67834SAndre Fischer     meStrike = STRIKEOUT_NONE;
399b9e67834SAndre Fischer     mbPostureAvailable = true;
400b9e67834SAndre Fischer     mbWeightAvailable = true;
401b9e67834SAndre Fischer     meUnderline = UNDERLINE_NONE;
402b9e67834SAndre Fischer     meUnderlineColor = COL_AUTO;   //
403b9e67834SAndre Fischer     maColor = COL_BLACK;
404b9e67834SAndre Fischer     mbColorAvailable = true;
405b9e67834SAndre Fischer     maBackColor = COL_AUTO;
406b9e67834SAndre Fischer     mbBackColorAvailable = true;
407b9e67834SAndre Fischer     meColorType = FONT_COLOR;
408b9e67834SAndre Fischer     meEscape = SVX_ESCAPEMENT_OFF;
409b9e67834SAndre Fischer     mbSuper = false;
410b9e67834SAndre Fischer     mbSub = false;
411b9e67834SAndre Fischer     mbKernAvailable = true;
412b9e67834SAndre Fischer     mbKernLBAvailable = true;
413b9e67834SAndre Fischer     mlKerning = 0;
414b9e67834SAndre Fischer     mpFontColorUpdater.reset(new ToolboxButtonColorUpdater(
415b9e67834SAndre Fischer             SID_ATTR_CHAR_COLOR,
416b9e67834SAndre Fischer             TBI_FONTCOLOR,
417b9e67834SAndre Fischer             mpToolBoxFontColor.get(),
418b9e67834SAndre Fischer             TBX_UPDATER_MODE_CHAR_COLOR_NEW));
419b9e67834SAndre Fischer     mpHighlightUpdater.reset(new ToolboxButtonColorUpdater(
420b9e67834SAndre Fischer             SID_ATTR_BRUSH_CHAR,
421b9e67834SAndre Fischer             TBI_HIGHLIGHT,
422b9e67834SAndre Fischer             mpToolBoxHighlight.get(),
423b9e67834SAndre Fischer             TBX_UPDATER_MODE_CHAR_COLOR_NEW));
424b9e67834SAndre Fischer 
425b9e67834SAndre Fischer     //set handler
426b9e67834SAndre Fischer     mpFontNameBox->SetBindings(mpBindings);
427b9e67834SAndre Fischer     //add
428b9e67834SAndre Fischer     Link aLink = LINK(this, TextPropertyPanel, FontSelHdl);
429b9e67834SAndre Fischer     mpFontNameBox->SetSelectHdl(aLink);
430b9e67834SAndre Fischer     //add end
431b9e67834SAndre Fischer 
432b9e67834SAndre Fischer     aLink = LINK(this, TextPropertyPanel, FontSizeModifyHdl);
433b9e67834SAndre Fischer     maFontSizeBox.SetModifyHdl(aLink);
434b9e67834SAndre Fischer     //add
435b9e67834SAndre Fischer     aLink = LINK(this, TextPropertyPanel, FontSizeSelHdl);
436b9e67834SAndre Fischer     maFontSizeBox.SetSelectHdl(aLink);
437b9e67834SAndre Fischer     //add end
438b9e67834SAndre Fischer     aLink = LINK(this, TextPropertyPanel, FontSizeLoseFocus);
439b9e67834SAndre Fischer     maFontSizeBox.SetLoseFocusHdl(aLink);
440b9e67834SAndre Fischer 
441*f79579d2SAndre Fischer     Size aSize(PROPERTYPAGE_WIDTH, TEXT_SECTIONPAGE_HEIGHT);
442*f79579d2SAndre Fischer     aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) );
443*f79579d2SAndre Fischer     aSize.setWidth(GetOutputSizePixel().Width());
444*f79579d2SAndre Fischer     SetSizePixel(aSize);
445b9e67834SAndre Fischer }
446b9e67834SAndre Fischer 
447d4aefcaeSZheng Fan void TextPropertyPanel::EndSpacingPopupMode (void)
448d4aefcaeSZheng Fan {
449d4aefcaeSZheng Fan     maCharSpacePopup.Hide();
450d4aefcaeSZheng Fan }
451b9e67834SAndre Fischer 
452d4aefcaeSZheng Fan void TextPropertyPanel::EndUnderlinePopupMode (void)
453d4aefcaeSZheng Fan {
454d4aefcaeSZheng Fan     maUnderlinePopup.Hide();
455d4aefcaeSZheng Fan }
456b9e67834SAndre Fischer 
457b9e67834SAndre Fischer 
458b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxFont()
459b9e67834SAndre Fischer {
460b9e67834SAndre Fischer     mpToolBoxFont->SetBackground(Wallpaper());
461b9e67834SAndre Fischer     mpToolBoxFont->SetPaintTransparent(true);
462b9e67834SAndre Fischer 
463b9e67834SAndre Fischer     Size aTbxSize( mpToolBoxFont->CalcWindowSizePixel() );
464b9e67834SAndre Fischer     mpToolBoxFont->SetOutputSizePixel( aTbxSize );
465b9e67834SAndre Fischer 
466b9e67834SAndre Fischer     Link aLink  = LINK(this, TextPropertyPanel, ToolboxFontSelectHandler);
467b9e67834SAndre Fischer     mpToolBoxFont->SetSelectHdl ( aLink );
468b9e67834SAndre Fischer     aLink = LINK(this, TextPropertyPanel, ToolBoxUnderlineClickHdl);
469b9e67834SAndre Fischer     mpToolBoxFont->SetDropdownClickHdl(aLink);
470b9e67834SAndre Fischer }
471b9e67834SAndre Fischer 
472b9e67834SAndre Fischer 
473b9e67834SAndre Fischer 
474b9e67834SAndre Fischer 
475b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxIncDec()
476b9e67834SAndre Fischer {
477b9e67834SAndre Fischer     Size aTbxSize( mpToolBoxIncDec->CalcWindowSizePixel() );
478b9e67834SAndre Fischer     mpToolBoxIncDec->SetOutputSizePixel( aTbxSize );
479b9e67834SAndre Fischer 
480b9e67834SAndre Fischer     Link aLink = LINK(this, TextPropertyPanel, ToolboxIncDecSelectHdl);
481b9e67834SAndre Fischer     mpToolBoxIncDec->SetSelectHdl ( aLink );
482b9e67834SAndre Fischer }
483b9e67834SAndre Fischer 
484b9e67834SAndre Fischer 
485b9e67834SAndre Fischer 
486b9e67834SAndre Fischer 
487b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxFontColor()
488b9e67834SAndre Fischer {
489b9e67834SAndre Fischer     Size aTbxSize( mpToolBoxFontColor->CalcWindowSizePixel() );
490b9e67834SAndre Fischer     mpToolBoxFontColor->SetOutputSizePixel( aTbxSize );
491b9e67834SAndre Fischer     mpToolBoxFontColor->SetItemBits( TBI_FONTCOLOR, mpToolBoxFontColor->GetItemBits( TBI_FONTCOLOR ) | TIB_DROPDOWNONLY );
492b9e67834SAndre Fischer 
493b9e67834SAndre Fischer     Link aLink = LINK(this, TextPropertyPanel, ToolBoxFontColorDropHdl);
494b9e67834SAndre Fischer     mpToolBoxFontColor->SetDropdownClickHdl ( aLink );
495b9e67834SAndre Fischer     mpToolBoxFontColor->SetSelectHdl ( aLink );
496b9e67834SAndre Fischer 
497b9e67834SAndre Fischer }
498b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxScript()
499b9e67834SAndre Fischer {
500b9e67834SAndre Fischer     Size aTbxSize( mpToolBoxScriptSw->CalcWindowSizePixel() );
501b9e67834SAndre Fischer     mpToolBoxScriptSw->SetOutputSizePixel( aTbxSize );
502b9e67834SAndre Fischer 
503b9e67834SAndre Fischer     Link aLink = LINK(this, TextPropertyPanel, ToolBoxSwScriptSelectHdl);
504b9e67834SAndre Fischer     mpToolBoxScriptSw->SetSelectHdl ( aLink );
505b9e67834SAndre Fischer 
506b9e67834SAndre Fischer     aTbxSize = mpToolBoxScript->CalcWindowSizePixel() ;
507b9e67834SAndre Fischer     mpToolBoxScript->SetOutputSizePixel( aTbxSize );
508b9e67834SAndre Fischer 
509b9e67834SAndre Fischer     aLink = LINK(this, TextPropertyPanel, ToolBoxScriptSelectHdl);
510b9e67834SAndre Fischer     mpToolBoxScript->SetSelectHdl ( aLink );
511b9e67834SAndre Fischer }
512b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxSpacing()
513b9e67834SAndre Fischer {
514b9e67834SAndre Fischer     Size aTbxSize( mpToolBoxSpacing->CalcWindowSizePixel() );
515b9e67834SAndre Fischer     mpToolBoxSpacing->SetOutputSizePixel( aTbxSize );
516b9e67834SAndre Fischer     mpToolBoxSpacing->SetItemBits( TBI_SPACING, mpToolBoxSpacing->GetItemBits( TBI_SPACING ) | TIB_DROPDOWNONLY );
517b9e67834SAndre Fischer 
518b9e67834SAndre Fischer     Link aLink = LINK(this, TextPropertyPanel, SpacingClickHdl);
519b9e67834SAndre Fischer     mpToolBoxSpacing->SetDropdownClickHdl ( aLink );
520b9e67834SAndre Fischer     mpToolBoxSpacing->SetSelectHdl( aLink );
521b9e67834SAndre Fischer }
522b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxHighlight()
523b9e67834SAndre Fischer {
524b9e67834SAndre Fischer     Size aTbxSize( mpToolBoxHighlight->CalcWindowSizePixel() );
525b9e67834SAndre Fischer     mpToolBoxHighlight->SetOutputSizePixel( aTbxSize );
526b9e67834SAndre Fischer     mpToolBoxHighlight->SetItemBits( TBI_HIGHLIGHT, mpToolBoxHighlight->GetItemBits( TBI_HIGHLIGHT ) | TIB_DROPDOWNONLY );
527b9e67834SAndre Fischer 
528b9e67834SAndre Fischer     Link aLink = LINK(this, TextPropertyPanel, ToolBoxHighlightDropHdl);
529b9e67834SAndre Fischer     mpToolBoxHighlight->SetDropdownClickHdl ( aLink );
530b9e67834SAndre Fischer     mpToolBoxHighlight->SetSelectHdl( aLink );
531b9e67834SAndre Fischer }
532b9e67834SAndre Fischer 
533b9e67834SAndre Fischer 
534b9e67834SAndre Fischer 
535b9e67834SAndre Fischer 
53645da7d5eSAndre Fischer void TextPropertyPanel::SetupToolboxItems (void)
537b9e67834SAndre Fischer {
53845da7d5eSAndre Fischer     maSDFontGrow.SetupToolBoxItem(*mpToolBoxIncDec, TBI_INCREASE);
53945da7d5eSAndre Fischer     maSDFontShrink.SetupToolBoxItem(*mpToolBoxIncDec, TBI_DECREASE);
540b9e67834SAndre Fischer 
54145da7d5eSAndre Fischer     maWeightControl.SetupToolBoxItem(*mpToolBoxFont, TBI_BOLD);
54245da7d5eSAndre Fischer     maItalicControl.SetupToolBoxItem(*mpToolBoxFont, TBI_ITALIC);
54345da7d5eSAndre Fischer     maUnderlineControl.SetupToolBoxItem(*mpToolBoxFont, TBI_UNDERLINE);
54445da7d5eSAndre Fischer     maStrikeControl.SetupToolBoxItem(*mpToolBoxFont, TBI_STRIKEOUT);
54545da7d5eSAndre Fischer     maShadowControl.SetupToolBoxItem(*mpToolBoxFont, TBI_SHADOWED);
546b9e67834SAndre Fischer 
54745da7d5eSAndre Fischer     maFontColorControl.SetupToolBoxItem(*mpToolBoxFontColor, TBI_FONTCOLOR);
548b9e67834SAndre Fischer     //for sw
54945da7d5eSAndre Fischer     maSuperScriptControl.SetupToolBoxItem(*mpToolBoxScriptSw, TBI_SUPER_SW);
55045da7d5eSAndre Fischer     maSubScriptControl.SetupToolBoxItem(*mpToolBoxScriptSw, TBI_SUB_SW);
551b9e67834SAndre Fischer     //for sc and sd
552ccab7bc0SAndre Fischer     maSuperScriptControl.SetupToolBoxItem(*mpToolBoxScript, TBI_SUPER);
55345da7d5eSAndre Fischer     maSubScriptControl.SetupToolBoxItem(*mpToolBoxScript, TBI_SUB);
55445da7d5eSAndre Fischer     maSpacingControl.SetupToolBoxItem(*mpToolBoxSpacing, TBI_SPACING);
55545da7d5eSAndre Fischer     maHighlightControl.SetupToolBoxItem(*mpToolBoxHighlight, TBI_HIGHLIGHT);
556b9e67834SAndre Fischer }
557b9e67834SAndre Fischer 
558b9e67834SAndre Fischer 
559b9e67834SAndre Fischer 
560b9e67834SAndre Fischer 
561b9e67834SAndre Fischer IMPL_LINK( TextPropertyPanel, FontSelHdl, FontNameBox*, pBox )
562b9e67834SAndre Fischer {
563b9e67834SAndre Fischer     if ( !pBox->IsTravelSelect() )
564b9e67834SAndre Fischer     {
565b9e67834SAndre Fischer         if( SfxViewShell::Current() )
566b9e67834SAndre Fischer         {
567b9e67834SAndre Fischer             Window* pShellWnd = SfxViewShell::Current()->GetWindow();
568b9e67834SAndre Fischer 
569b9e67834SAndre Fischer             if ( pShellWnd )
570b9e67834SAndre Fischer                 pShellWnd->GrabFocus();
571b9e67834SAndre Fischer         }
572b9e67834SAndre Fischer     }
573b9e67834SAndre Fischer     return 0;
574b9e67834SAndre Fischer }
575b9e67834SAndre Fischer //add end
576b9e67834SAndre Fischer IMPL_LINK( TextPropertyPanel, FontSizeModifyHdl, FontSizeBox*, pSizeBox )
577b9e67834SAndre Fischer {
578b9e67834SAndre Fischer     if (pSizeBox == &maFontSizeBox)
579b9e67834SAndre Fischer     {
580b9e67834SAndre Fischer         long nSize = pSizeBox->GetValue();
581b9e67834SAndre Fischer         mbFocusOnFontSizeCtrl = true;
582b9e67834SAndre Fischer 
583b9e67834SAndre Fischer         float fSize = (float)nSize / 10;
584b9e67834SAndre Fischer         SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric();
585b9e67834SAndre Fischer         SvxFontHeightItem aItem( CalcToUnit( fSize, eUnit ), 100, SID_ATTR_CHAR_FONTHEIGHT ) ;
586b9e67834SAndre Fischer 
587b9e67834SAndre Fischer         mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONTHEIGHT, SFX_CALLMODE_RECORD, &aItem, 0L );
588b9e67834SAndre Fischer         mpBindings->Invalidate(SID_ATTR_CHAR_FONTHEIGHT,true,false);
589b9e67834SAndre Fischer     }
590b9e67834SAndre Fischer     return 0;
591b9e67834SAndre Fischer }
592b9e67834SAndre Fischer //add
593b9e67834SAndre Fischer IMPL_LINK( TextPropertyPanel, FontSizeSelHdl, FontSizeBox*, pSizeBox )
594b9e67834SAndre Fischer {
595b9e67834SAndre Fischer     if ( !pSizeBox->IsTravelSelect() )
596b9e67834SAndre Fischer     {
597b9e67834SAndre Fischer         if( SfxViewShell::Current() )
598b9e67834SAndre Fischer         {
599b9e67834SAndre Fischer             Window* pShellWnd = SfxViewShell::Current()->GetWindow();
600b9e67834SAndre Fischer 
601b9e67834SAndre Fischer             if ( pShellWnd )
602b9e67834SAndre Fischer                 pShellWnd->GrabFocus();
603b9e67834SAndre Fischer         }
604b9e67834SAndre Fischer     }
605b9e67834SAndre Fischer 
606b9e67834SAndre Fischer     return 0;
607b9e67834SAndre Fischer }
608b9e67834SAndre Fischer //add end
609b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, FontSizeLoseFocus, FontSizeBox*, pSizeBox)
610b9e67834SAndre Fischer {
611b9e67834SAndre Fischer     if(pSizeBox == &maFontSizeBox)
612b9e67834SAndre Fischer     {
613b9e67834SAndre Fischer         mbFocusOnFontSizeCtrl = false;
614b9e67834SAndre Fischer     }
615b9e67834SAndre Fischer     return 0;
616b9e67834SAndre Fischer }
617b9e67834SAndre Fischer 
618b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolboxFontSelectHandler, ToolBox*, pToolBox)
619b9e67834SAndre Fischer {
620b9e67834SAndre Fischer     const sal_uInt16 nId = pToolBox->GetCurItemId();
621b9e67834SAndre Fischer 
62245da7d5eSAndre Fischer     switch (nId)
62345da7d5eSAndre Fischer     {
62445da7d5eSAndre Fischer         case TBI_BOLD:
625b9e67834SAndre Fischer         {
626b9e67834SAndre Fischer             EndTracking();
627b9e67834SAndre Fischer             if(meWeight != WEIGHT_BOLD)
628b9e67834SAndre Fischer                 meWeight = WEIGHT_BOLD;
629b9e67834SAndre Fischer             else
630b9e67834SAndre Fischer                 meWeight = WEIGHT_NORMAL;
631b9e67834SAndre Fischer             SvxWeightItem aWeightItem(meWeight, SID_ATTR_CHAR_WEIGHT);
632b9e67834SAndre Fischer             mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_WEIGHT, SFX_CALLMODE_RECORD, &aWeightItem, 0L);
63345da7d5eSAndre Fischer             UpdateItem(SID_ATTR_CHAR_WEIGHT);
63445da7d5eSAndre Fischer             break;
635b9e67834SAndre Fischer         }
63645da7d5eSAndre Fischer         case TBI_ITALIC:
637b9e67834SAndre Fischer         {
638b9e67834SAndre Fischer             EndTracking();
639b9e67834SAndre Fischer             if(meItalic != ITALIC_NORMAL)
640b9e67834SAndre Fischer                 meItalic = ITALIC_NORMAL;
641b9e67834SAndre Fischer             else
642b9e67834SAndre Fischer                 meItalic = ITALIC_NONE;
643b9e67834SAndre Fischer             SvxPostureItem aPostureItem(meItalic, SID_ATTR_CHAR_POSTURE);
644b9e67834SAndre Fischer             mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_POSTURE, SFX_CALLMODE_RECORD, &aPostureItem, 0L);
64545da7d5eSAndre Fischer             UpdateItem(SID_ATTR_CHAR_POSTURE);
64645da7d5eSAndre Fischer             break;
647b9e67834SAndre Fischer         }
64845da7d5eSAndre Fischer         case TBI_UNDERLINE:
649b9e67834SAndre Fischer         {
650b9e67834SAndre Fischer             EndTracking();
651b9e67834SAndre Fischer             if(meUnderline == UNDERLINE_NONE)
652b9e67834SAndre Fischer             {
65395a18594SAndre Fischer                 meUnderline = UNDERLINE_SINGLE;
654b9e67834SAndre Fischer                 SvxUnderlineItem aLineItem(meUnderline, SID_ATTR_CHAR_UNDERLINE);
655b9e67834SAndre Fischer                 aLineItem.SetColor(meUnderlineColor);
656b9e67834SAndre Fischer                 mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_UNDERLINE, SFX_CALLMODE_RECORD, &aLineItem, 0L);
657b9e67834SAndre Fischer             }
658b9e67834SAndre Fischer             else
659b9e67834SAndre Fischer             {
660b9e67834SAndre Fischer                 meUnderline = UNDERLINE_NONE;
661b9e67834SAndre Fischer                 SvxUnderlineItem aLineItem(meUnderline, SID_ATTR_CHAR_UNDERLINE);
662b9e67834SAndre Fischer                 mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_UNDERLINE, SFX_CALLMODE_RECORD, &aLineItem, 0L);
663b9e67834SAndre Fischer             }
66445da7d5eSAndre Fischer             UpdateItem(SID_ATTR_CHAR_UNDERLINE);
665b9e67834SAndre Fischer         }
66645da7d5eSAndre Fischer         case TBI_STRIKEOUT:
667b9e67834SAndre Fischer         {
668b9e67834SAndre Fischer             EndTracking();
669b9e67834SAndre Fischer             if(meStrike !=  STRIKEOUT_NONE && meStrike != STRIKEOUT_DONTKNOW)
670b9e67834SAndre Fischer                 meStrike = STRIKEOUT_NONE;
671b9e67834SAndre Fischer             else
672b9e67834SAndre Fischer                 meStrike = STRIKEOUT_SINGLE;
673b9e67834SAndre Fischer             SvxCrossedOutItem aStrikeItem(meStrike,SID_ATTR_CHAR_STRIKEOUT);
674b9e67834SAndre Fischer             mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_STRIKEOUT, SFX_CALLMODE_RECORD, &aStrikeItem, 0L);
67545da7d5eSAndre Fischer             UpdateItem(SID_ATTR_CHAR_STRIKEOUT);
67645da7d5eSAndre Fischer             break;
677b9e67834SAndre Fischer         }
67845da7d5eSAndre Fischer         case TBI_SHADOWED:
679b9e67834SAndre Fischer         {
680b9e67834SAndre Fischer             EndTracking();
681b9e67834SAndre Fischer             mbShadow = !mbShadow;
682b9e67834SAndre Fischer             SvxShadowedItem aShadowItem(mbShadow, SID_ATTR_CHAR_SHADOWED);
683b9e67834SAndre Fischer             mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_SHADOWED, SFX_CALLMODE_RECORD, &aShadowItem, 0L);
68445da7d5eSAndre Fischer             UpdateItem(SID_ATTR_CHAR_SHADOWED);
68545da7d5eSAndre Fischer             break;
68645da7d5eSAndre Fischer         }
687b9e67834SAndre Fischer     }
688b9e67834SAndre Fischer     return 0;
689b9e67834SAndre Fischer }
690b9e67834SAndre Fischer 
691b9e67834SAndre Fischer 
692b9e67834SAndre Fischer 
693b9e67834SAndre Fischer 
694b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolboxIncDecSelectHdl, ToolBox*, pToolBox)
695b9e67834SAndre Fischer {
696b9e67834SAndre Fischer     const sal_uInt16 nId = pToolBox->GetCurItemId();
697b9e67834SAndre Fischer 
698b9e67834SAndre Fischer     // font size +/- enhancement in sd
69945da7d5eSAndre Fischer     switch (maContext.GetCombinedContext_DI())
700b9e67834SAndre Fischer     {
70145da7d5eSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
70245da7d5eSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_Text):
70345da7d5eSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_Table):
70445da7d5eSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_OutlineText):
70545da7d5eSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_Draw):
70645da7d5eSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
70745da7d5eSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
708b9e67834SAndre Fischer             if(nId == TBI_INCREASE)
709b9e67834SAndre Fischer             {
710b9e67834SAndre Fischer                 EndTracking();
711b9e67834SAndre Fischer                 SfxVoidItem aItem(SID_GROW_FONT_SIZE);
712b9e67834SAndre Fischer                 mpBindings->GetDispatcher()->Execute( SID_GROW_FONT_SIZE, SFX_CALLMODE_RECORD, &aItem, 0L );
713b9e67834SAndre Fischer             }
714b9e67834SAndre Fischer             else if(nId == TBI_DECREASE)
715b9e67834SAndre Fischer             {
716b9e67834SAndre Fischer                 EndTracking();
717b9e67834SAndre Fischer                 SfxVoidItem aItem(SID_SHRINK_FONT_SIZE);
718b9e67834SAndre Fischer                 mpBindings->GetDispatcher()->Execute( SID_SHRINK_FONT_SIZE, SFX_CALLMODE_RECORD, &aItem, 0L );
719b9e67834SAndre Fischer             }
720b9e67834SAndre Fischer             break;
721b9e67834SAndre Fischer 
722b9e67834SAndre Fischer         default:
723b9e67834SAndre Fischer             if(nId == TBI_INCREASE)
724b9e67834SAndre Fischer             {
725b9e67834SAndre Fischer                 EndTracking();
726b9e67834SAndre Fischer                 mbFocusOnFontSizeCtrl = false;
727b9e67834SAndre Fischer                 sal_Int64 iValue = maFontSizeBox.GetValue();
728b9e67834SAndre Fischer                 int iPos = maFontSizeBox.GetValuePos(iValue, FUNIT_NONE);
729b9e67834SAndre Fischer                 long nSize = iValue;
730b9e67834SAndre Fischer                 if(iPos != LISTBOX_ENTRY_NOTFOUND)
731b9e67834SAndre Fischer                     nSize = maFontSizeBox.GetValue(iPos+1 , FUNIT_NONE);
732b9e67834SAndre Fischer                 else if(iValue >= 100 && iValue < 105)
733b9e67834SAndre Fischer                     nSize = 105;
734b9e67834SAndre Fischer                 else if(iValue >= 105 && iValue < 110)
735b9e67834SAndre Fischer                     nSize = 110;
736b9e67834SAndre Fischer                 else if(iValue < 960)
737b9e67834SAndre Fischer                 {
738b9e67834SAndre Fischer                     nSize = (nSize / 10) * 10 + 10;
739b9e67834SAndre Fischer                     while(maFontSizeBox.GetValuePos(nSize, FUNIT_NONE) == LISTBOX_ENTRY_NOTFOUND)
740b9e67834SAndre Fischer                         nSize += 10;
741b9e67834SAndre Fischer                 }
742b9e67834SAndre Fischer                 else
743b9e67834SAndre Fischer                 {
744b9e67834SAndre Fischer                     nSize = iValue;
745b9e67834SAndre Fischer                 }
746b9e67834SAndre Fischer 
747b9e67834SAndre Fischer                 float fSize = (float)nSize / 10;
748b9e67834SAndre Fischer 
749b9e67834SAndre Fischer                 SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric();
750b9e67834SAndre Fischer                 SvxFontHeightItem aItem( CalcToUnit( fSize, eUnit ), 100, SID_ATTR_CHAR_FONTHEIGHT ) ;
751b9e67834SAndre Fischer 
752b9e67834SAndre Fischer                 mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONTHEIGHT, SFX_CALLMODE_RECORD, &aItem, 0L );
753b9e67834SAndre Fischer                 mpBindings->Invalidate(SID_ATTR_CHAR_FONTHEIGHT,true,false);
754b9e67834SAndre Fischer                 maFontSizeBox.SetValue( nSize );
755b9e67834SAndre Fischer             }
756b9e67834SAndre Fischer             else if(nId == TBI_DECREASE)
757b9e67834SAndre Fischer             {
758b9e67834SAndre Fischer                 EndTracking();
759b9e67834SAndre Fischer                 mbFocusOnFontSizeCtrl = false;
760b9e67834SAndre Fischer                 sal_Int64 iValue = maFontSizeBox.GetValue();
761b9e67834SAndre Fischer                 int iPos = maFontSizeBox.GetValuePos(iValue, FUNIT_NONE);
762b9e67834SAndre Fischer                 long nSize = iValue;
763b9e67834SAndre Fischer                 if(iPos != LISTBOX_ENTRY_NOTFOUND)
764b9e67834SAndre Fischer                     nSize = maFontSizeBox.GetValue(iPos-1 , FUNIT_NONE);
765b9e67834SAndre Fischer                 else if(iValue > 100 && iValue <= 105)
766b9e67834SAndre Fischer                     nSize = 100;
767b9e67834SAndre Fischer                 else if(iValue > 105 && iValue <= 110)
768b9e67834SAndre Fischer                     nSize = 105;
769b9e67834SAndre Fischer                 else if(iValue > 960)
770b9e67834SAndre Fischer                 {
771b9e67834SAndre Fischer                     nSize = 960;
772b9e67834SAndre Fischer                 }
773b9e67834SAndre Fischer                 else if(iValue > 60)
774b9e67834SAndre Fischer                 {
775b9e67834SAndre Fischer                     nSize = (nSize / 10) * 10 ;
776b9e67834SAndre Fischer                     while(maFontSizeBox.GetValuePos(nSize, FUNIT_NONE) == LISTBOX_ENTRY_NOTFOUND)
777b9e67834SAndre Fischer                         nSize -= 10;
778b9e67834SAndre Fischer                 }
779b9e67834SAndre Fischer                 else
780b9e67834SAndre Fischer                 {
781b9e67834SAndre Fischer                     nSize = iValue;
782b9e67834SAndre Fischer                 }
783b9e67834SAndre Fischer 
784b9e67834SAndre Fischer                 float fSize = (float)nSize / 10;
785b9e67834SAndre Fischer 
786b9e67834SAndre Fischer                 SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric();
787b9e67834SAndre Fischer                 SvxFontHeightItem aItem( CalcToUnit( fSize, eUnit ), 100, SID_ATTR_CHAR_FONTHEIGHT ) ;
788b9e67834SAndre Fischer 
789b9e67834SAndre Fischer                 mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONTHEIGHT, SFX_CALLMODE_RECORD, &aItem, 0L );
790b9e67834SAndre Fischer                 mpBindings->Invalidate(SID_ATTR_CHAR_FONTHEIGHT,true,false);
791b9e67834SAndre Fischer                 maFontSizeBox.SetValue( nSize );
792b9e67834SAndre Fischer             }
793b9e67834SAndre Fischer     }
79445da7d5eSAndre Fischer     UpdateItem(SID_ATTR_CHAR_FONTHEIGHT);
79545da7d5eSAndre Fischer 
796b9e67834SAndre Fischer     return 0;
797b9e67834SAndre Fischer }
798b9e67834SAndre Fischer 
799b9e67834SAndre Fischer 
800b9e67834SAndre Fischer 
801b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolBoxUnderlineClickHdl, ToolBox*, pToolBox)
802b9e67834SAndre Fischer {
803b9e67834SAndre Fischer     const sal_uInt16 nId = pToolBox->GetCurItemId();
804d4aefcaeSZheng Fan     OSL_ASSERT(nId == TBI_UNDERLINE);
805b9e67834SAndre Fischer     if(nId == TBI_UNDERLINE)
806b9e67834SAndre Fischer     {
807b9e67834SAndre Fischer         pToolBox->SetItemDown( nId, true );
808d4aefcaeSZheng Fan         maUnderlinePopup.Rearrange(meUnderline);
809d4aefcaeSZheng Fan         maUnderlinePopup.Show(*pToolBox);
810b9e67834SAndre Fischer 
811b9e67834SAndre Fischer     }
812d4aefcaeSZheng Fan     return 0L;
813b9e67834SAndre Fischer }
814b9e67834SAndre Fischer 
815b9e67834SAndre Fischer 
816b9e67834SAndre Fischer 
817b9e67834SAndre Fischer 
818b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolBoxFontColorDropHdl,ToolBox*, pToolBox)
819b9e67834SAndre Fischer {
820b9e67834SAndre Fischer     const sal_uInt16 nId = pToolBox->GetCurItemId();
821b9e67834SAndre Fischer     if(nId == TBI_FONTCOLOR)
822b9e67834SAndre Fischer     {
823b9e67834SAndre Fischer         meColorType = FONT_COLOR;
824b9e67834SAndre Fischer 
825b9e67834SAndre Fischer         pToolBox->SetItemDown( nId, true );
826b9e67834SAndre Fischer 
827d4aefcaeSZheng Fan         maFontColorPopup.Show(*pToolBox);
828d4aefcaeSZheng Fan         maFontColorPopup.SetCurrentColor(maColor, mbColorAvailable);
829b9e67834SAndre Fischer     }
830b9e67834SAndre Fischer     return 0;
831b9e67834SAndre Fischer }
832b9e67834SAndre Fischer 
833b9e67834SAndre Fischer 
834b9e67834SAndre Fischer 
835b9e67834SAndre Fischer 
836b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolBoxSwScriptSelectHdl, ToolBox*, pToolBox)
837b9e67834SAndre Fischer {
838b9e67834SAndre Fischer     const sal_uInt16 nId = pToolBox->GetCurItemId();
839b9e67834SAndre Fischer     if( nId == TBI_SUPER_SW )
840b9e67834SAndre Fischer     {
841b9e67834SAndre Fischer         if(meEscape != SVX_ESCAPEMENT_SUPERSCRIPT)
842b9e67834SAndre Fischer         {
843b9e67834SAndre Fischer             meEscape = SVX_ESCAPEMENT_SUPERSCRIPT;
844b9e67834SAndre Fischer             SvxEscapementItem aSupItem(DFLT_ESC_SUPER, DFLT_ESC_PROP, SID_ATTR_CHAR_ESCAPEMENT);
845b9e67834SAndre Fischer             mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aSupItem, 0L );
846b9e67834SAndre Fischer         }
847b9e67834SAndre Fischer         else
848b9e67834SAndre Fischer         {
849b9e67834SAndre Fischer             meEscape = SVX_ESCAPEMENT_OFF;
850b9e67834SAndre Fischer             SvxEscapementItem aNoneItem(0, 100, SID_ATTR_CHAR_ESCAPEMENT);
851b9e67834SAndre Fischer             mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aNoneItem, 0L );
852b9e67834SAndre Fischer         }
853b9e67834SAndre Fischer     }
854b9e67834SAndre Fischer     else if(TBI_SUB_SW == nId)
855b9e67834SAndre Fischer     {
856b9e67834SAndre Fischer         if(meEscape != SVX_ESCAPEMENT_SUBSCRIPT)
857b9e67834SAndre Fischer         {
858b9e67834SAndre Fischer             meEscape = (SvxEscapement)SVX_ESCAPEMENT_SUBSCRIPT;
859b9e67834SAndre Fischer             SvxEscapementItem aSubItem(DFLT_ESC_SUB, DFLT_ESC_PROP, SID_ATTR_CHAR_ESCAPEMENT);
860b9e67834SAndre Fischer             mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aSubItem, 0L );
861b9e67834SAndre Fischer         }
862b9e67834SAndre Fischer         else
863b9e67834SAndre Fischer         {
864b9e67834SAndre Fischer             meEscape = SVX_ESCAPEMENT_OFF;
865b9e67834SAndre Fischer             SvxEscapementItem aNoneItem(0, 100, SID_ATTR_CHAR_ESCAPEMENT);
866b9e67834SAndre Fischer             mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aNoneItem, 0L );
867b9e67834SAndre Fischer         }
868b9e67834SAndre Fischer     }
86945da7d5eSAndre Fischer     UpdateItem(SID_ATTR_CHAR_ESCAPEMENT);
870b9e67834SAndre Fischer 
871b9e67834SAndre Fischer     return 0;
872b9e67834SAndre Fischer }
873b9e67834SAndre Fischer 
874b9e67834SAndre Fischer 
875b9e67834SAndre Fischer 
876b9e67834SAndre Fischer 
877b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolBoxScriptSelectHdl, ToolBox*, pToolBox)
878b9e67834SAndre Fischer {
879b9e67834SAndre Fischer     const sal_uInt16 nId = pToolBox->GetCurItemId();
880b9e67834SAndre Fischer     if( nId == TBI_SUPER )
881b9e67834SAndre Fischer     {
882b9e67834SAndre Fischer         mbSuper = !mbSuper;
883b9e67834SAndre Fischer         SfxBoolItem aSupItem(SID_SET_SUPER_SCRIPT, mbSuper);
884b9e67834SAndre Fischer         mpBindings->GetDispatcher()->Execute( SID_SET_SUPER_SCRIPT, SFX_CALLMODE_RECORD, &aSupItem, 0L );
88545da7d5eSAndre Fischer         UpdateItem(SID_SET_SUPER_SCRIPT);
886b9e67834SAndre Fischer     }
887b9e67834SAndre Fischer     else if(TBI_SUB == nId)
888b9e67834SAndre Fischer     {
889b9e67834SAndre Fischer 
890b9e67834SAndre Fischer         mbSub = !mbSub;
891b9e67834SAndre Fischer         SfxBoolItem aSubItem(SID_SET_SUB_SCRIPT, mbSub );
892b9e67834SAndre Fischer         mpBindings->GetDispatcher()->Execute( SID_SET_SUB_SCRIPT, SFX_CALLMODE_RECORD, &aSubItem, 0L );
89345da7d5eSAndre Fischer         UpdateItem(SID_SET_SUB_SCRIPT);
894b9e67834SAndre Fischer     }
895b9e67834SAndre Fischer     return 0;
896b9e67834SAndre Fischer }
897b9e67834SAndre Fischer 
898b9e67834SAndre Fischer 
899b9e67834SAndre Fischer 
900b9e67834SAndre Fischer 
901b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolBoxHighlightDropHdl, ToolBox*, pToolBox)
902b9e67834SAndre Fischer {
903b9e67834SAndre Fischer     const sal_uInt16 nId = pToolBox->GetCurItemId();
904b9e67834SAndre Fischer     if(nId == TBI_HIGHLIGHT)
905b9e67834SAndre Fischer     {
906b9e67834SAndre Fischer         meColorType = BACK_COLOR;
907b9e67834SAndre Fischer 
908b9e67834SAndre Fischer         pToolBox->SetItemDown( nId, true );
909d4aefcaeSZheng Fan         maBrushColorPopup.Show(*pToolBox);
910d4aefcaeSZheng Fan         maBrushColorPopup.SetCurrentColor(maBackColor, mbBackColorAvailable);
911b9e67834SAndre Fischer 
912b9e67834SAndre Fischer     }
913b9e67834SAndre Fischer     return 0;
914b9e67834SAndre Fischer }
915b9e67834SAndre Fischer 
916b9e67834SAndre Fischer 
917b9e67834SAndre Fischer 
918b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, SpacingClickHdl, ToolBox*, pToolBox)
919b9e67834SAndre Fischer {
920b9e67834SAndre Fischer     const sal_uInt16 nId = pToolBox->GetCurItemId();
921d4aefcaeSZheng Fan     OSL_ASSERT(nId == TBI_SPACING);
922b9e67834SAndre Fischer     if(nId == TBI_SPACING)
923b9e67834SAndre Fischer     {
924b9e67834SAndre Fischer         pToolBox->SetItemDown( nId, true );
925d4aefcaeSZheng Fan         maCharSpacePopup.Rearrange(mbKernLBAvailable,mbKernAvailable,mlKerning);
926d4aefcaeSZheng Fan         maCharSpacePopup.Show(*pToolBox);
927b9e67834SAndre Fischer 
928b9e67834SAndre Fischer     }
929d4aefcaeSZheng Fan     return 0L;
930b9e67834SAndre Fischer }
931b9e67834SAndre Fischer 
932b9e67834SAndre Fischer 
933b9e67834SAndre Fischer 
934b9e67834SAndre Fischer 
935b9e67834SAndre Fischer IMPL_LINK( TextPropertyPanel, ImplPopupModeEndHdl, FloatingWindow*, EMPTYARG )
936b9e67834SAndre Fischer {
937b9e67834SAndre Fischer     return 0;
938b9e67834SAndre Fischer }
939b9e67834SAndre Fischer 
940b9e67834SAndre Fischer 
941b9e67834SAndre Fischer 
942b9e67834SAndre Fischer 
943b9e67834SAndre Fischer void TextPropertyPanel::NotifyItemUpdate (
944b9e67834SAndre Fischer     const sal_uInt16 nSID,
945b9e67834SAndre Fischer     const SfxItemState eState,
94645da7d5eSAndre Fischer     const SfxPoolItem* pState,
94745da7d5eSAndre Fischer     const bool bIsEnabled)
948b9e67834SAndre Fischer {
949b9e67834SAndre Fischer     switch(nSID)
950b9e67834SAndre Fischer     {
951b9e67834SAndre Fischer         case SID_ATTR_CHAR_FONT:
95245da7d5eSAndre Fischer         {
95345da7d5eSAndre Fischer             bool bIsControlEnabled (bIsEnabled);
954b9e67834SAndre Fischer             if (  eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxFontItem) )
955b9e67834SAndre Fischer             {
956b9e67834SAndre Fischer                 const SvxFontItem* pFontItem = (const SvxFontItem*)pState;
957b9e67834SAndre Fischer                 mpFontNameBox->SetText( pFontItem->GetFamilyName() );
958b9e67834SAndre Fischer             }
959b9e67834SAndre Fischer             else
960b9e67834SAndre Fischer             {
961b9e67834SAndre Fischer                 mpFontNameBox->SetText( String() );
962b9e67834SAndre Fischer                 if (SFX_ITEM_DISABLED == eState)
96345da7d5eSAndre Fischer                     bIsControlEnabled = false;
964b9e67834SAndre Fischer             }
96545da7d5eSAndre Fischer             mpFontNameBox->Enable(bIsControlEnabled);
966b9e67834SAndre Fischer             break;
96745da7d5eSAndre Fischer         }
968b9e67834SAndre Fischer         case SID_ATTR_CHAR_FONTHEIGHT:
96945da7d5eSAndre Fischer         {
97045da7d5eSAndre Fischer             bool bIsControlEnabled (bIsEnabled);
971b9e67834SAndre Fischer             if (  eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxFontHeightItem) )
972b9e67834SAndre Fischer             {
973b9e67834SAndre Fischer                 mpHeightItem = (SvxFontHeightItem*)pState;//const SvxFontHeightItem*
974b9e67834SAndre Fischer                 SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric();
975b9e67834SAndre Fischer                 long iValue = (long)CalcToPoint( mpHeightItem->GetHeight(), eUnit, 10 );
976b9e67834SAndre Fischer                 mpToolBoxIncDec->Enable();
977b9e67834SAndre Fischer 
978b9e67834SAndre Fischer                 mpToolBoxIncDec->SetItemState(TBI_INCREASE, STATE_NOCHECK);
979b9e67834SAndre Fischer                 mpToolBoxIncDec->SetItemState(TBI_DECREASE, STATE_NOCHECK);
980b9e67834SAndre Fischer 
981b9e67834SAndre Fischer                 if( mbFocusOnFontSizeCtrl )
982b9e67834SAndre Fischer                     return;
983b9e67834SAndre Fischer 
984b9e67834SAndre Fischer                 maFontSizeBox.SetValue( iValue );
985b9e67834SAndre Fischer                 maFontSizeBox.LoseFocus();
98645da7d5eSAndre Fischer 
98745da7d5eSAndre Fischer                 UpdateItem(SID_SHRINK_FONT_SIZE);
98845da7d5eSAndre Fischer                 UpdateItem(SID_GROW_FONT_SIZE);
989b9e67834SAndre Fischer             }
990b9e67834SAndre Fischer             else
991b9e67834SAndre Fischer             {
992b9e67834SAndre Fischer                 mpHeightItem = NULL;
993b9e67834SAndre Fischer                 maFontSizeBox.SetText( String() );
994b9e67834SAndre Fischer                 //increase decrease diabled when multi-seletion have different font size
995b9e67834SAndre Fischer 
996b9e67834SAndre Fischer                 // font size +/- enhancement in sd
99745da7d5eSAndre Fischer                 switch(maContext.GetCombinedContext_DI())
998b9e67834SAndre Fischer                 {
99945da7d5eSAndre Fischer                     case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
100045da7d5eSAndre Fischer                     case CombinedEnumContext(Application_DrawImpress, Context_Text):
100145da7d5eSAndre Fischer                     case CombinedEnumContext(Application_DrawImpress, Context_Table):
100245da7d5eSAndre Fischer                     case CombinedEnumContext(Application_DrawImpress, Context_OutlineText):
100345da7d5eSAndre Fischer                     case CombinedEnumContext(Application_DrawImpress, Context_Draw):
100445da7d5eSAndre Fischer                     case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
100545da7d5eSAndre Fischer                     case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
1006b9e67834SAndre Fischer                         break;
1007b9e67834SAndre Fischer 
1008b9e67834SAndre Fischer                     default:
1009b9e67834SAndre Fischer                         mpToolBoxIncDec->Disable();
1010b9e67834SAndre Fischer                 }
1011b9e67834SAndre Fischer                 if ( eState <= SFX_ITEM_READONLY )
101245da7d5eSAndre Fischer                     bIsControlEnabled = false;
1013b9e67834SAndre Fischer             }
101445da7d5eSAndre Fischer             maFontSizeBox.Enable(bIsControlEnabled);
1015b9e67834SAndre Fischer             break;
101645da7d5eSAndre Fischer         }
101745da7d5eSAndre Fischer 
1018b9e67834SAndre Fischer         case SID_ATTR_CHAR_WEIGHT:
1019b9e67834SAndre Fischer             mbWeightAvailable = (eState >= SFX_ITEM_DONTCARE);
1020b9e67834SAndre Fischer             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxWeightItem))
1021b9e67834SAndre Fischer             {
1022b9e67834SAndre Fischer                 const SvxWeightItem* pItem = (const SvxWeightItem*)pState;
1023b9e67834SAndre Fischer                 meWeight = (FontWeight)pItem->GetValue();
1024b9e67834SAndre Fischer             }
1025b9e67834SAndre Fischer             else
1026b9e67834SAndre Fischer             {
1027b9e67834SAndre Fischer                 meWeight = WEIGHT_NORMAL;
1028b9e67834SAndre Fischer             }
102945da7d5eSAndre Fischer             mpToolBoxFont->EnableItem(TBI_BOLD, mbWeightAvailable && bIsEnabled);
103045da7d5eSAndre Fischer             mpToolBoxFont->SetItemState(TBI_BOLD, meWeight==WEIGHT_BOLD ? STATE_CHECK : STATE_NOCHECK);
1031b9e67834SAndre Fischer             break;
103245da7d5eSAndre Fischer 
1033b9e67834SAndre Fischer         case SID_ATTR_CHAR_POSTURE:
1034b9e67834SAndre Fischer             mbPostureAvailable = (eState >= SFX_ITEM_DONTCARE);
1035b9e67834SAndre Fischer             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxPostureItem))
1036b9e67834SAndre Fischer             {
1037b9e67834SAndre Fischer                 const SvxPostureItem* pItem = (const SvxPostureItem*)pState;
1038b9e67834SAndre Fischer                 meItalic = (FontItalic)pItem->GetValue();
1039b9e67834SAndre Fischer             }
1040b9e67834SAndre Fischer             else
1041b9e67834SAndre Fischer             {
1042b9e67834SAndre Fischer                 meItalic = ITALIC_NONE;
1043b9e67834SAndre Fischer             }
104445da7d5eSAndre Fischer             mpToolBoxFont->EnableItem(TBI_ITALIC, mbPostureAvailable && bIsEnabled);
104545da7d5eSAndre Fischer             mpToolBoxFont->SetItemState(TBI_ITALIC, meItalic==ITALIC_NORMAL ? STATE_CHECK : STATE_NOCHECK);
1046b9e67834SAndre Fischer             break;
104745da7d5eSAndre Fischer 
1048b9e67834SAndre Fischer         case SID_ATTR_CHAR_UNDERLINE:
104945da7d5eSAndre Fischer             if( eState >= SFX_ITEM_DEFAULT)
1050b9e67834SAndre Fischer             {
1051b9e67834SAndre Fischer                 if(pState->ISA(SvxUnderlineItem))
1052b9e67834SAndre Fischer                 {
1053b9e67834SAndre Fischer                     const SvxUnderlineItem* pItem = (const SvxUnderlineItem*)pState;
1054b9e67834SAndre Fischer                     meUnderline = (FontUnderline)pItem->GetValue();
1055b9e67834SAndre Fischer                     meUnderlineColor = pItem->GetColor();
1056b9e67834SAndre Fischer                 }
1057b9e67834SAndre Fischer             }
1058b9e67834SAndre Fischer             else
1059b9e67834SAndre Fischer             {
1060b9e67834SAndre Fischer                 meUnderline = UNDERLINE_NONE;
1061b9e67834SAndre Fischer             }
106245da7d5eSAndre Fischer             mpToolBoxFont->EnableItem(TBI_UNDERLINE, bIsEnabled);
106345da7d5eSAndre Fischer             mpToolBoxFont->SetItemState(TBI_UNDERLINE, meUnderline==UNDERLINE_NONE ? STATE_NOCHECK : STATE_CHECK);
1064b9e67834SAndre Fischer             break;
106545da7d5eSAndre Fischer 
1066b9e67834SAndre Fischer         case SID_ATTR_CHAR_SHADOWED:
1067b9e67834SAndre Fischer             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxShadowedItem))
1068b9e67834SAndre Fischer             {
1069b9e67834SAndre Fischer                 const SvxShadowedItem* pItem = (const SvxShadowedItem*)pState;
1070b9e67834SAndre Fischer                 mbShadow = pItem->GetValue();
1071b9e67834SAndre Fischer             }
1072b9e67834SAndre Fischer             else
1073b9e67834SAndre Fischer             {
1074b9e67834SAndre Fischer                 mbShadow = false;
1075b9e67834SAndre Fischer             }
107645da7d5eSAndre Fischer             mpToolBoxFont->EnableItem(TBI_SHADOWED, bIsEnabled);
107745da7d5eSAndre Fischer             mpToolBoxFont->SetItemState(TBI_SHADOWED, mbShadow ? STATE_CHECK : STATE_NOCHECK);
1078b9e67834SAndre Fischer             break;
107945da7d5eSAndre Fischer 
1080b9e67834SAndre Fischer         case SID_ATTR_CHAR_STRIKEOUT:
1081b9e67834SAndre Fischer             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxCrossedOutItem))
1082b9e67834SAndre Fischer             {
1083b9e67834SAndre Fischer                 const SvxCrossedOutItem* pItem = (const SvxCrossedOutItem*)pState;
1084b9e67834SAndre Fischer                 meStrike = (FontStrikeout)pItem->GetValue();
1085b9e67834SAndre Fischer             }
1086b9e67834SAndre Fischer             else
1087b9e67834SAndre Fischer             {
1088b9e67834SAndre Fischer                 meStrike = STRIKEOUT_NONE;
1089b9e67834SAndre Fischer             }
109045da7d5eSAndre Fischer             mpToolBoxFont->EnableItem(TBI_STRIKEOUT, bIsEnabled);
109145da7d5eSAndre Fischer             mpToolBoxFont->SetItemState(TBI_STRIKEOUT,
109245da7d5eSAndre Fischer                 meStrike!=STRIKEOUT_NONE && meStrike!=STRIKEOUT_DONTKNOW
109345da7d5eSAndre Fischer                     ? STATE_CHECK
109445da7d5eSAndre Fischer                     : STATE_NOCHECK);
1095b9e67834SAndre Fischer             break;
109645da7d5eSAndre Fischer 
1097b9e67834SAndre Fischer         case SID_ATTR_CHAR_COLOR:
1098b9e67834SAndre Fischer             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxColorItem))
1099b9e67834SAndre Fischer             {
1100d4aefcaeSZheng Fan                 const SvxColorItem* pItem =  (const SvxColorItem*)pState;
1101d4aefcaeSZheng Fan                 maColor = pItem->GetValue();
1102b9e67834SAndre Fischer                 mbColorAvailable = true;
110395a18594SAndre Fischer                 if (mpFontColorUpdater)
1104b9e67834SAndre Fischer                     mpFontColorUpdater->Update(maColor);
1105b9e67834SAndre Fischer             }
1106b9e67834SAndre Fischer             else
1107b9e67834SAndre Fischer             {
1108b9e67834SAndre Fischer                 mbColorAvailable = false;
1109b9e67834SAndre Fischer                 maColor.SetColor(COL_AUTO);
111095a18594SAndre Fischer                 if (mpFontColorUpdater)
1111b9e67834SAndre Fischer                     mpFontColorUpdater->Update(maColor);
1112b9e67834SAndre Fischer             }
111345da7d5eSAndre Fischer             mpToolBoxFontColor->EnableItem(TBI_FONTCOLOR, bIsEnabled);
1114b9e67834SAndre Fischer             break;
111545da7d5eSAndre Fischer 
1116b9e67834SAndre Fischer         case SID_ATTR_BRUSH_CHAR:
1117b9e67834SAndre Fischer             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxBrushItem))
1118b9e67834SAndre Fischer             {
1119b9e67834SAndre Fischer                 const SvxBrushItem* pItem =  (const SvxBrushItem*)pState;
1120b9e67834SAndre Fischer                 maBackColor = pItem->GetColor();
1121b9e67834SAndre Fischer                 mbBackColorAvailable = true;
11227a32b0c8SAndre Fischer                 if (mpHighlightUpdater)
1123b9e67834SAndre Fischer                     mpHighlightUpdater->Update(maBackColor);
1124b9e67834SAndre Fischer             }
1125b9e67834SAndre Fischer             else
1126b9e67834SAndre Fischer             {
1127b9e67834SAndre Fischer                 mbBackColorAvailable = false;
1128b9e67834SAndre Fischer                 maBackColor.SetColor(COL_AUTO);
11297a32b0c8SAndre Fischer                 if (mpHighlightUpdater)
1130b9e67834SAndre Fischer                     mpHighlightUpdater->Update(maBackColor);
1131b9e67834SAndre Fischer             }
113245da7d5eSAndre Fischer             mpToolBoxHighlight->EnableItem(TBI_HIGHLIGHT, bIsEnabled);
1133b9e67834SAndre Fischer             break;
113445da7d5eSAndre Fischer 
1135b9e67834SAndre Fischer         case SID_ATTR_CHAR_ESCAPEMENT:
113645da7d5eSAndre Fischer         {
113745da7d5eSAndre Fischer             bool bIsItemEnabled (true);
1138b9e67834SAndre Fischer             if (eState == SFX_ITEM_AVAILABLE)
1139b9e67834SAndre Fischer             {
1140b9e67834SAndre Fischer                 if (pState->ISA(SvxEscapementItem))
1141b9e67834SAndre Fischer                 {
1142b9e67834SAndre Fischer                     const SvxEscapementItem* pItem = (const SvxEscapementItem *)pState;
1143b9e67834SAndre Fischer                     short nEsc = pItem->GetEsc();
1144b9e67834SAndre Fischer                     if(nEsc == 0)
114545da7d5eSAndre Fischer                     {
1146b9e67834SAndre Fischer                         meEscape = SVX_ESCAPEMENT_OFF;
114745da7d5eSAndre Fischer                         mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_NOCHECK);
114845da7d5eSAndre Fischer                         mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_NOCHECK);
114945da7d5eSAndre Fischer                     }
1150b9e67834SAndre Fischer                     else if(nEsc > 0)
115145da7d5eSAndre Fischer                     {
1152b9e67834SAndre Fischer                         meEscape = SVX_ESCAPEMENT_SUPERSCRIPT;
115345da7d5eSAndre Fischer                         mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_CHECK);
115445da7d5eSAndre Fischer                         mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_NOCHECK);
115545da7d5eSAndre Fischer                     }
1156b9e67834SAndre Fischer                     else
115745da7d5eSAndre Fischer                     {
1158b9e67834SAndre Fischer                         meEscape = SVX_ESCAPEMENT_SUBSCRIPT;
115945da7d5eSAndre Fischer                         mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_NOCHECK);
116045da7d5eSAndre Fischer                         mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_CHECK);
116145da7d5eSAndre Fischer                     }
1162b9e67834SAndre Fischer                 }
1163b9e67834SAndre Fischer                 else
1164b9e67834SAndre Fischer                 {
1165b9e67834SAndre Fischer                     meEscape = SVX_ESCAPEMENT_OFF;
116645da7d5eSAndre Fischer                     mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_NOCHECK);
116745da7d5eSAndre Fischer                     mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_NOCHECK);
1168b9e67834SAndre Fischer                 }
1169b9e67834SAndre Fischer             }
1170b9e67834SAndre Fischer             else if (eState == SFX_ITEM_DISABLED)
1171b9e67834SAndre Fischer             {
117245da7d5eSAndre Fischer                 bIsItemEnabled = false;
1173b9e67834SAndre Fischer             }
1174b9e67834SAndre Fischer             else
1175b9e67834SAndre Fischer             {
1176b9e67834SAndre Fischer                 meEscape = SVX_ESCAPEMENT_OFF;
1177b9e67834SAndre Fischer             }
117845da7d5eSAndre Fischer             mpToolBoxScriptSw->EnableItem(TBI_SUPER, bIsItemEnabled && bIsEnabled);
117945da7d5eSAndre Fischer             mpToolBoxScriptSw->EnableItem(TBI_SUB, bIsItemEnabled && bIsEnabled);
1180b9e67834SAndre Fischer             break;
118145da7d5eSAndre Fischer         }
118245da7d5eSAndre Fischer 
1183b9e67834SAndre Fischer         case SID_SET_SUB_SCRIPT:
1184b9e67834SAndre Fischer             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SfxBoolItem))
1185b9e67834SAndre Fischer             {
1186b9e67834SAndre Fischer                 const SfxBoolItem* pItem = (const SfxBoolItem*)pState;
1187b9e67834SAndre Fischer                 mbSub = pItem->GetValue();
1188b9e67834SAndre Fischer             }
1189b9e67834SAndre Fischer             else
1190b9e67834SAndre Fischer             {
1191b9e67834SAndre Fischer                 mbSub = false;
1192b9e67834SAndre Fischer             }
119345da7d5eSAndre Fischer             mpToolBoxScript->EnableItem(TBI_SUB, bIsEnabled);
119445da7d5eSAndre Fischer             mpToolBoxScript->SetItemState(TBI_SUB, mbSub ? STATE_CHECK : STATE_NOCHECK);
1195b9e67834SAndre Fischer             break;
119645da7d5eSAndre Fischer 
1197b9e67834SAndre Fischer         case SID_SET_SUPER_SCRIPT:
1198b9e67834SAndre Fischer             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SfxBoolItem))
1199b9e67834SAndre Fischer             {
1200b9e67834SAndre Fischer                 const SfxBoolItem* pItem = (const SfxBoolItem*)pState;
1201b9e67834SAndre Fischer                 mbSuper = pItem->GetValue();
1202b9e67834SAndre Fischer             }
1203b9e67834SAndre Fischer             else
1204b9e67834SAndre Fischer             {
1205b9e67834SAndre Fischer                 mbSuper = false;
1206b9e67834SAndre Fischer             }
120745da7d5eSAndre Fischer             mpToolBoxScript->EnableItem(TBI_SUPER, bIsEnabled);
120845da7d5eSAndre Fischer             mpToolBoxScript->SetItemState(TBI_SUPER, mbSuper ? STATE_CHECK : STATE_NOCHECK);
1209b9e67834SAndre Fischer             break;
121045da7d5eSAndre Fischer 
1211b9e67834SAndre Fischer         case SID_ATTR_CHAR_KERNING:
1212b9e67834SAndre Fischer             if ( SFX_ITEM_AVAILABLE == eState )
1213b9e67834SAndre Fischer             {
1214b9e67834SAndre Fischer                 mbKernLBAvailable = true;
1215b9e67834SAndre Fischer 
1216b9e67834SAndre Fischer                 if(pState->ISA(SvxKerningItem))
1217b9e67834SAndre Fischer                 {
1218b9e67834SAndre Fischer                     const SvxKerningItem* pKerningItem  = (const SvxKerningItem*)pState;
1219b9e67834SAndre Fischer                     mlKerning = (long)pKerningItem->GetValue();
1220b9e67834SAndre Fischer                     mbKernAvailable = true;
1221b9e67834SAndre Fischer                 }
1222b9e67834SAndre Fischer                 else
1223b9e67834SAndre Fischer                 {
1224b9e67834SAndre Fischer                     mlKerning = 0;
1225b9e67834SAndre Fischer                     mbKernAvailable =false;
1226b9e67834SAndre Fischer                 }
1227b9e67834SAndre Fischer             }
1228b9e67834SAndre Fischer             else if (SFX_ITEM_DISABLED == eState)
1229b9e67834SAndre Fischer             {
1230b9e67834SAndre Fischer                 mbKernLBAvailable = false;
1231b9e67834SAndre Fischer                 mbKernAvailable = false;
1232b9e67834SAndre Fischer                 mlKerning = 0;
1233b9e67834SAndre Fischer             }
1234b9e67834SAndre Fischer             else
1235b9e67834SAndre Fischer             {
1236b9e67834SAndre Fischer                 mbKernLBAvailable = true;
1237b9e67834SAndre Fischer                 mbKernAvailable = false;
1238b9e67834SAndre Fischer                 mlKerning = 0;
1239b9e67834SAndre Fischer             }
124045da7d5eSAndre Fischer             mpToolBoxSpacing->EnableItem(TBI_SPACING, bIsEnabled);
1241b9e67834SAndre Fischer             break;
1242b9e67834SAndre Fischer 
1243b9e67834SAndre Fischer             // font size +/- enhancement in sd
1244b9e67834SAndre Fischer         case SID_SHRINK_FONT_SIZE:
1245b9e67834SAndre Fischer         case SID_GROW_FONT_SIZE:
124645da7d5eSAndre Fischer             switch(maContext.GetCombinedContext_DI())
1247b9e67834SAndre Fischer             {
124845da7d5eSAndre Fischer                 case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
124945da7d5eSAndre Fischer                 case CombinedEnumContext(Application_DrawImpress, Context_Text):
125045da7d5eSAndre Fischer                 case CombinedEnumContext(Application_DrawImpress, Context_Table):
125145da7d5eSAndre Fischer                 case CombinedEnumContext(Application_DrawImpress, Context_OutlineText):
125245da7d5eSAndre Fischer                 case CombinedEnumContext(Application_DrawImpress, Context_Draw):
125345da7d5eSAndre Fischer                 case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
125445da7d5eSAndre Fischer                 case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
1255b9e67834SAndre Fischer                     if(eState == SFX_ITEM_DISABLED)
1256b9e67834SAndre Fischer                         mpToolBoxIncDec->Disable();
1257b9e67834SAndre Fischer                     else
1258b9e67834SAndre Fischer                         mpToolBoxIncDec->Enable();
1259b9e67834SAndre Fischer                 break;
1260b9e67834SAndre Fischer             }
126145da7d5eSAndre Fischer             const sal_Int32 nSize (maFontSizeBox.GetValue());
126245da7d5eSAndre Fischer             if (nSID == SID_GROW_FONT_SIZE)
126345da7d5eSAndre Fischer                 mpToolBoxIncDec->EnableItem(TBI_INCREASE, bIsEnabled && nSize<960);
126445da7d5eSAndre Fischer             else
126545da7d5eSAndre Fischer                 mpToolBoxIncDec->EnableItem(TBI_DECREASE, bIsEnabled && nSize>60);
1266b9e67834SAndre Fischer             break;
1267b9e67834SAndre Fischer     }
1268b9e67834SAndre Fischer }
1269b9e67834SAndre Fischer 
1270b9e67834SAndre Fischer 
1271b9e67834SAndre Fischer 
1272b9e67834SAndre Fischer 
127345da7d5eSAndre Fischer void TextPropertyPanel::UpdateItem (const sal_uInt16 nSlotId)
1274b9e67834SAndre Fischer {
127545da7d5eSAndre Fischer     switch (nSlotId)
127645da7d5eSAndre Fischer     {
127745da7d5eSAndre Fischer         case SID_ATTR_CHAR_FONT:
127845da7d5eSAndre Fischer             maFontNameControl.RequestUpdate();
127945da7d5eSAndre Fischer             break;
128045da7d5eSAndre Fischer         case SID_ATTR_CHAR_FONTHEIGHT:
128145da7d5eSAndre Fischer             maFontSizeControl.RequestUpdate();
128245da7d5eSAndre Fischer             break;
128345da7d5eSAndre Fischer         case SID_ATTR_CHAR_WEIGHT:
128445da7d5eSAndre Fischer             maWeightControl.RequestUpdate();
128545da7d5eSAndre Fischer             break;
128645da7d5eSAndre Fischer         case SID_ATTR_CHAR_POSTURE:
128745da7d5eSAndre Fischer             maItalicControl.RequestUpdate();
128845da7d5eSAndre Fischer             break;
128945da7d5eSAndre Fischer         case SID_ATTR_CHAR_UNDERLINE:
129045da7d5eSAndre Fischer             maUnderlineControl.RequestUpdate();
129145da7d5eSAndre Fischer             break;
129245da7d5eSAndre Fischer         case SID_ATTR_CHAR_STRIKEOUT:
129345da7d5eSAndre Fischer             maStrikeControl.RequestUpdate();
129445da7d5eSAndre Fischer             break;
129545da7d5eSAndre Fischer         case SID_ATTR_CHAR_SHADOWED:
129645da7d5eSAndre Fischer             maShadowControl.RequestUpdate();
129745da7d5eSAndre Fischer             break;
129845da7d5eSAndre Fischer         case SID_ATTR_CHAR_COLOR:
129945da7d5eSAndre Fischer             maFontColorControl.RequestUpdate();
130045da7d5eSAndre Fischer             break;
130145da7d5eSAndre Fischer         case SID_ATTR_CHAR_ESCAPEMENT:
130245da7d5eSAndre Fischer             maScriptControlSw.RequestUpdate();
130345da7d5eSAndre Fischer             break;
130445da7d5eSAndre Fischer         case SID_SET_SUPER_SCRIPT:
130545da7d5eSAndre Fischer             maSuperScriptControl.RequestUpdate();
130645da7d5eSAndre Fischer             break;
130745da7d5eSAndre Fischer         case SID_SET_SUB_SCRIPT:
130845da7d5eSAndre Fischer             maSubScriptControl.RequestUpdate();
130945da7d5eSAndre Fischer             break;
131045da7d5eSAndre Fischer         case SID_ATTR_CHAR_KERNING:
131145da7d5eSAndre Fischer             maSpacingControl.RequestUpdate();
131245da7d5eSAndre Fischer             break;
131345da7d5eSAndre Fischer         case SID_ATTR_BRUSH_CHAR:
131445da7d5eSAndre Fischer             maHighlightControl.RequestUpdate();
131545da7d5eSAndre Fischer             break;
131645da7d5eSAndre Fischer         case SID_GROW_FONT_SIZE:
131745da7d5eSAndre Fischer             maSDFontGrow.RequestUpdate();
131845da7d5eSAndre Fischer             break;
131945da7d5eSAndre Fischer         case SID_SHRINK_FONT_SIZE:
132045da7d5eSAndre Fischer             maSDFontShrink.RequestUpdate();
132145da7d5eSAndre Fischer             break;
132245da7d5eSAndre Fischer     }
1323b9e67834SAndre Fischer }
1324b9e67834SAndre Fischer 
1325b9e67834SAndre Fischer 
1326b9e67834SAndre Fischer 
1327b9e67834SAndre Fischer 
1328b9e67834SAndre Fischer 
1329d4aefcaeSZheng Fan void TextPropertyPanel::SetFontColor (
1330a7d1eb6fSPavel Janík     const String& /* rsColorName */,
1331d4aefcaeSZheng Fan     const Color aColor)
1332d4aefcaeSZheng Fan {
1333d4aefcaeSZheng Fan     SvxColorItem aColorItem(aColor, SID_ATTR_CHAR_COLOR);
1334d4aefcaeSZheng Fan     mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_COLOR, SFX_CALLMODE_RECORD, &aColorItem, 0L);
1335d4aefcaeSZheng Fan     maColor = aColor;
1336d4aefcaeSZheng Fan }
1337d4aefcaeSZheng Fan 
1338d4aefcaeSZheng Fan void TextPropertyPanel::SetBrushColor (
1339a7d1eb6fSPavel Janík     const String& /* rsColorName */,
1340d4aefcaeSZheng Fan     const Color aColor)
1341d4aefcaeSZheng Fan {
1342d4aefcaeSZheng Fan     SvxBrushItem aBrushItem(aColor, SID_ATTR_BRUSH_CHAR);
1343d4aefcaeSZheng Fan     mpBindings->GetDispatcher()->Execute(SID_ATTR_BRUSH_CHAR, SFX_CALLMODE_RECORD, &aBrushItem, 0L);
1344d4aefcaeSZheng Fan     maBackColor = aColor;
1345d4aefcaeSZheng Fan }
1346d4aefcaeSZheng Fan 
1347da72173fSAndre Fischer Color& TextPropertyPanel::GetUnderlineColor()
1348da72173fSAndre Fischer {
1349da72173fSAndre Fischer     return meUnderlineColor;
1350da72173fSAndre Fischer }
1351d4aefcaeSZheng Fan 
1352da72173fSAndre Fischer void TextPropertyPanel::SetUnderline(FontUnderline  eUnderline)
1353da72173fSAndre Fischer {
1354da72173fSAndre Fischer     meUnderline = eUnderline;
1355da72173fSAndre Fischer }
1356d4aefcaeSZheng Fan 
135745da7d5eSAndre Fischer 
135845da7d5eSAndre Fischer 
1359b9e67834SAndre Fischer } } // end of namespace svx::sidebar
1360