xref: /AOO41X/main/svx/source/sidebar/text/TextPropertyPanel.cxx (revision 8ce66e530e7af9da934e3889a9f7d8deb65120ea)
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>
45d29c2fc2SAndre Fischer #include <sfx2/sidebar/ResourceDefinitions.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 
85d4aefcaeSZheng Fan 
86d4aefcaeSZheng Fan     PopupControl* TextPropertyPanel::CreateCharacterSpacingControl (PopupContainer* pParent)
87d4aefcaeSZheng Fan {
8845da7d5eSAndre Fischer     return new TextCharacterSpacingControl(pParent, *this, mpBindings);
89d4aefcaeSZheng Fan }
90b9e67834SAndre Fischer 
91d4aefcaeSZheng Fan PopupControl* TextPropertyPanel::CreateUnderlinePopupControl (PopupContainer* pParent)
92d4aefcaeSZheng Fan {
9345da7d5eSAndre Fischer     return new TextUnderlineControl(pParent, *this, mpBindings);
94d4aefcaeSZheng Fan }
95b9e67834SAndre Fischer 
96b7a56e95SArmin Le Grand namespace
97b7a56e95SArmin Le Grand {
98b7a56e95SArmin Le Grand     Color GetAutomaticColor(void)
99b7a56e95SArmin Le Grand     {
100b7a56e95SArmin Le Grand         return COL_AUTO;
101b7a56e95SArmin Le Grand     }
102b7a56e95SArmin Le Grand } // end of anonymous namespace
103b7a56e95SArmin Le Grand 
104d4aefcaeSZheng Fan PopupControl* TextPropertyPanel::CreateFontColorPopupControl (PopupContainer* pParent)
105d4aefcaeSZheng Fan {
106b7a56e95SArmin Le Grand     const ResId aResId(SVX_RES(STR_AUTOMATICE));
107b7a56e95SArmin Le Grand 
108d4aefcaeSZheng Fan     return new ColorControl(
109d4aefcaeSZheng Fan         pParent,
110d4aefcaeSZheng Fan         mpBindings,
111d4aefcaeSZheng Fan         SVX_RES(RID_POPUPPANEL_TEXTPAGE_FONT_COLOR),
112d4aefcaeSZheng Fan         SVX_RES(VS_FONT_COLOR),
113b7a56e95SArmin Le Grand         ::boost::bind(GetAutomaticColor),
114d4aefcaeSZheng Fan         ::boost::bind(&TextPropertyPanel::SetFontColor, this, _1,_2),
115d4aefcaeSZheng Fan         pParent,
116b7a56e95SArmin Le Grand         &aResId);
117d4aefcaeSZheng Fan }
118b9e67834SAndre Fischer 
119d4aefcaeSZheng Fan PopupControl* TextPropertyPanel::CreateBrushColorPopupControl (PopupContainer* pParent)
120d4aefcaeSZheng Fan {
121b7a56e95SArmin Le Grand     const ResId aResId(SVX_RES(STR_AUTOMATICE));
122b7a56e95SArmin Le Grand 
123d4aefcaeSZheng Fan     return new ColorControl(
124d4aefcaeSZheng Fan         pParent,
125d4aefcaeSZheng Fan         mpBindings,
126d4aefcaeSZheng Fan         SVX_RES(RID_POPUPPANEL_TEXTPAGE_FONT_COLOR),
127d4aefcaeSZheng Fan         SVX_RES(VS_FONT_COLOR),
128b7a56e95SArmin Le Grand         ::boost::bind(GetAutomaticColor),
129d4aefcaeSZheng Fan         ::boost::bind(&TextPropertyPanel::SetBrushColor, this, _1,_2),
130d4aefcaeSZheng Fan         pParent,
131b7a56e95SArmin Le Grand         &aResId);
132d4aefcaeSZheng Fan }
133d4aefcaeSZheng Fan 
134d4aefcaeSZheng Fan long TextPropertyPanel::GetSelFontSize()
135d4aefcaeSZheng Fan {
136d4aefcaeSZheng Fan     long nH = 240;
137d4aefcaeSZheng Fan     SfxMapUnit eUnit = maSpacingControl.GetCoreMetric();
138d4aefcaeSZheng Fan     if (mpHeightItem)
139d4aefcaeSZheng Fan         nH = LogicToLogic(  mpHeightItem->GetHeight(), (MapUnit)eUnit, MAP_TWIP );
140d4aefcaeSZheng Fan     return nH;
141d4aefcaeSZheng Fan }
142b9e67834SAndre Fischer 
143b9e67834SAndre Fischer 
14495a18594SAndre Fischer TextPropertyPanel* TextPropertyPanel::Create (
145b9e67834SAndre Fischer     Window* pParent,
146b9e67834SAndre Fischer     const cssu::Reference<css::frame::XFrame>& rxFrame,
147f79579d2SAndre Fischer     SfxBindings* pBindings)
148b9e67834SAndre Fischer {
149b9e67834SAndre Fischer     if (pParent == NULL)
150b9e67834SAndre Fischer         throw lang::IllegalArgumentException(A2S("no parent Window given to TextPropertyPanel::Create"), NULL, 0);
151b9e67834SAndre Fischer     if ( ! rxFrame.is())
152b9e67834SAndre Fischer         throw lang::IllegalArgumentException(A2S("no XFrame given to TextPropertyPanel::Create"), NULL, 1);
153b9e67834SAndre Fischer     if (pBindings == NULL)
154b9e67834SAndre Fischer         throw lang::IllegalArgumentException(A2S("no SfxBindings given to TextPropertyPanel::Create"), NULL, 2);
155b9e67834SAndre Fischer 
15695a18594SAndre Fischer     return new TextPropertyPanel(
157b9e67834SAndre Fischer         pParent,
158b9e67834SAndre Fischer         rxFrame,
159f79579d2SAndre Fischer         pBindings);
160b9e67834SAndre Fischer }
161b9e67834SAndre Fischer 
162b9e67834SAndre Fischer 
163d4aefcaeSZheng Fan ::sfx2::sidebar::ControllerItem& TextPropertyPanel::GetSpaceController()
164d4aefcaeSZheng Fan {
165d4aefcaeSZheng Fan     return maSpacingControl;
166d4aefcaeSZheng Fan }
167b9e67834SAndre Fischer 
168b9e67834SAndre Fischer TextPropertyPanel::TextPropertyPanel (
169b9e67834SAndre Fischer     Window* pParent,
170b9e67834SAndre Fischer     const cssu::Reference<css::frame::XFrame>& rxFrame,
171f79579d2SAndre Fischer     SfxBindings* pBindings)
17295a18594SAndre Fischer     :   Control(pParent, SVX_RES(RID_SIDEBAR_TEXT_PANEL)),
173b9e67834SAndre Fischer         mpFontNameBox (new SvxSBFontNameBox(this, SVX_RES(CB_SBFONT_FONT))),
174b9e67834SAndre Fischer         maFontSizeBox       (this, SVX_RES(MB_SBFONT_FONTSIZE)),
1757a32b0c8SAndre Fischer         mpToolBoxIncDecBackground(ControlFactory::CreateToolBoxBackground(this)),
1767a32b0c8SAndre Fischer         mpToolBoxIncDec(ControlFactory::CreateToolBox(
1777a32b0c8SAndre Fischer                 mpToolBoxIncDecBackground.get(),
1787a32b0c8SAndre Fischer                 SVX_RES(TB_INCREASE_DECREASE))),
1797a32b0c8SAndre Fischer         mpToolBoxFontBackground(ControlFactory::CreateToolBoxBackground(this)),
1807a32b0c8SAndre Fischer         mpToolBoxFont(ControlFactory::CreateToolBox(
1817a32b0c8SAndre Fischer                 mpToolBoxFontBackground.get(),
1827a32b0c8SAndre Fischer                 SVX_RES(TB_FONT))),
1837a32b0c8SAndre Fischer         mpToolBoxFontColorBackground(ControlFactory::CreateToolBoxBackground(this)),
1847a32b0c8SAndre Fischer         mpToolBoxFontColor(ControlFactory::CreateToolBox(
1857a32b0c8SAndre Fischer                 mpToolBoxFontColorBackground.get(),
1867a32b0c8SAndre Fischer                 SVX_RES(TB_FONTCOLOR))),
1877a32b0c8SAndre Fischer         mpToolBoxScriptBackground(ControlFactory::CreateToolBoxBackground(this)),
1887a32b0c8SAndre Fischer         mpToolBoxScript(ControlFactory::CreateToolBox(
1897a32b0c8SAndre Fischer                 mpToolBoxScriptBackground.get(),
1907a32b0c8SAndre Fischer                 SVX_RES(TB_SCRIPT))),
1917a32b0c8SAndre Fischer         mpToolBoxScriptSwBackground(ControlFactory::CreateToolBoxBackground(this)),
1927a32b0c8SAndre Fischer         mpToolBoxScriptSw(ControlFactory::CreateToolBox(
1937a32b0c8SAndre Fischer                 mpToolBoxScriptSwBackground.get(),
1947a32b0c8SAndre Fischer                 SVX_RES(TB_SCRIPT_SW))),
1957a32b0c8SAndre Fischer         mpToolBoxSpacingBackground(ControlFactory::CreateToolBoxBackground(this)),
1967a32b0c8SAndre Fischer         mpToolBoxSpacing(ControlFactory::CreateToolBox(
1977a32b0c8SAndre Fischer                 mpToolBoxSpacingBackground.get(),
1987a32b0c8SAndre Fischer                 SVX_RES(TB_SPACING))),
1997a32b0c8SAndre Fischer         mpToolBoxHighlightBackground(ControlFactory::CreateToolBoxBackground(this)),
2007a32b0c8SAndre Fischer         mpToolBoxHighlight(ControlFactory::CreateToolBox(
2017a32b0c8SAndre Fischer                 mpToolBoxHighlightBackground.get(),
2027a32b0c8SAndre Fischer                 SVX_RES(TB_HIGHLIGHT))),
203b9e67834SAndre Fischer         mpFontColorUpdater(),
204b9e67834SAndre Fischer         mpHighlightUpdater(),
205b9e67834SAndre Fischer 
20645da7d5eSAndre Fischer         maFontNameControl   (SID_ATTR_CHAR_FONT,        *pBindings, *this, A2S("CharFontName"), rxFrame),
20745da7d5eSAndre Fischer         maFontSizeControl   (SID_ATTR_CHAR_FONTHEIGHT,  *pBindings, *this, A2S("FontHeight"),   rxFrame),
20845da7d5eSAndre Fischer         maWeightControl     (SID_ATTR_CHAR_WEIGHT,      *pBindings, *this, A2S("Bold"),         rxFrame),
20945da7d5eSAndre Fischer         maItalicControl     (SID_ATTR_CHAR_POSTURE,     *pBindings, *this, A2S("Italic"),       rxFrame),
21045da7d5eSAndre Fischer         maUnderlineControl  (SID_ATTR_CHAR_UNDERLINE,   *pBindings, *this, A2S("Underline"),    rxFrame),
21145da7d5eSAndre Fischer         maStrikeControl     (SID_ATTR_CHAR_STRIKEOUT,   *pBindings, *this, A2S("Strikeout"),    rxFrame),
21245da7d5eSAndre Fischer         maShadowControl     (SID_ATTR_CHAR_SHADOWED,    *pBindings, *this, A2S("Shadowed"),     rxFrame),
21345da7d5eSAndre Fischer         maFontColorControl  (SID_ATTR_CHAR_COLOR,       *pBindings, *this, A2S("Color"),        rxFrame),
21445da7d5eSAndre Fischer         maScriptControlSw   (SID_ATTR_CHAR_ESCAPEMENT,  *pBindings, *this, A2S("Escapement"),   rxFrame),
21545da7d5eSAndre Fischer         maSuperScriptControl(SID_SET_SUPER_SCRIPT,      *pBindings, *this, A2S("SuperScript"),  rxFrame),
21645da7d5eSAndre Fischer         maSubScriptControl  (SID_SET_SUB_SCRIPT,        *pBindings, *this, A2S("SubScript"),    rxFrame),
21745da7d5eSAndre Fischer         maSpacingControl    (SID_ATTR_CHAR_KERNING,     *pBindings, *this, A2S("Spacing"),      rxFrame),
21845da7d5eSAndre Fischer         maHighlightControl  (SID_ATTR_BRUSH_CHAR, *pBindings, *this, A2S("CharacterBackgroundPattern"),rxFrame),
21945da7d5eSAndre Fischer         maSDFontGrow        (SID_GROW_FONT_SIZE,        *pBindings, *this, A2S("Grow"),         rxFrame),
22045da7d5eSAndre Fischer         maSDFontShrink      (SID_SHRINK_FONT_SIZE,      *pBindings, *this, A2S("Shrink"),       rxFrame),
221b9e67834SAndre Fischer 
222b9e67834SAndre Fischer         mpFontList          (NULL),
223b9e67834SAndre Fischer         mbMustDelete        (false),
224b9e67834SAndre Fischer         mbFocusOnFontSizeCtrl(false),
225a7d1eb6fSPavel Janík         maCharSpacePopup(this, ::boost::bind(&TextPropertyPanel::CreateCharacterSpacingControl, this, _1)),
226a7d1eb6fSPavel Janík         maUnderlinePopup(this, ::boost::bind(&TextPropertyPanel::CreateUnderlinePopupControl, this, _1)),
227a7d1eb6fSPavel Janík         maFontColorPopup(this, ::boost::bind(&TextPropertyPanel::CreateFontColorPopupControl, this, _1)),
228a7d1eb6fSPavel Janík         maBrushColorPopup(this, ::boost::bind(&TextPropertyPanel::CreateBrushColorPopupControl, this, _1)),
22995a18594SAndre Fischer         mxFrame(rxFrame),
230b9e67834SAndre Fischer         maContext(),
231f79579d2SAndre Fischer         mpBindings(pBindings)
232b9e67834SAndre Fischer {
233b9e67834SAndre Fischer     Initialize();
234b9e67834SAndre Fischer     FreeResource();
235b9e67834SAndre Fischer }
236b9e67834SAndre Fischer 
237b9e67834SAndre Fischer 
238b9e67834SAndre Fischer 
239b9e67834SAndre Fischer 
240b9e67834SAndre Fischer TextPropertyPanel::~TextPropertyPanel (void)
241b9e67834SAndre Fischer {
242b9e67834SAndre Fischer     if(mbMustDelete)
243b9e67834SAndre Fischer         delete mpFontList;
244b9e67834SAndre Fischer 
2457a32b0c8SAndre Fischer     // Destroy the toolbox windows.
2467a32b0c8SAndre Fischer     mpToolBoxIncDec.reset();
2477a32b0c8SAndre Fischer     mpToolBoxFont.reset();
2487a32b0c8SAndre Fischer     mpToolBoxFontColor.reset();
2497a32b0c8SAndre Fischer     mpToolBoxScript.reset();
2507a32b0c8SAndre Fischer     mpToolBoxScriptSw.reset();
2517a32b0c8SAndre Fischer     mpToolBoxSpacing.reset();
2527a32b0c8SAndre Fischer     mpToolBoxHighlight.reset();
2537a32b0c8SAndre Fischer 
2547a32b0c8SAndre Fischer     // Destroy the background windows of the toolboxes.
2557a32b0c8SAndre Fischer     mpToolBoxIncDecBackground.reset();
2567a32b0c8SAndre Fischer     mpToolBoxFontBackground.reset();
2577a32b0c8SAndre Fischer     mpToolBoxFontColorBackground.reset();
2587a32b0c8SAndre Fischer     mpToolBoxScriptBackground.reset();
2597a32b0c8SAndre Fischer     mpToolBoxScriptSwBackground.reset();
2607a32b0c8SAndre Fischer     mpToolBoxSpacingBackground.reset();
2617a32b0c8SAndre Fischer     mpToolBoxHighlightBackground.reset();
262b9e67834SAndre Fischer }
263b9e67834SAndre Fischer 
264b9e67834SAndre Fischer 
265b9e67834SAndre Fischer 
266b9e67834SAndre Fischer 
267d4aefcaeSZheng Fan void TextPropertyPanel::SetSpacing(long nKern)
268d4aefcaeSZheng Fan {
269d4aefcaeSZheng Fan     mlKerning = nKern;
270d4aefcaeSZheng Fan }
27195a18594SAndre Fischer 
27295a18594SAndre Fischer 
273b9e67834SAndre Fischer void TextPropertyPanel::HandleContextChange (
274b9e67834SAndre Fischer     const ::sfx2::sidebar::EnumContext aContext)
275b9e67834SAndre Fischer {
276b9e67834SAndre Fischer     if (maContext == aContext)
277b9e67834SAndre Fischer     {
278b9e67834SAndre Fischer         // Nothing to do.
279b9e67834SAndre Fischer         return;
280b9e67834SAndre Fischer     }
281b9e67834SAndre Fischer 
282b9e67834SAndre Fischer     maContext = aContext;
28365be1ea2SAndre Fischer     switch (maContext.GetCombinedContext_DI())
284b9e67834SAndre Fischer     {
285b9e67834SAndre Fischer         case CombinedEnumContext(Application_Calc, Context_Cell):
286b9e67834SAndre Fischer         case CombinedEnumContext(Application_Calc, Context_Pivot):
287b9e67834SAndre Fischer             mpToolBoxScriptSw->Hide();
288b9e67834SAndre Fischer             mpToolBoxHighlight->Hide();
289f79579d2SAndre Fischer             mpToolBoxScript->Disable();
290f79579d2SAndre Fischer             mpToolBoxSpacing->Disable();
291b9e67834SAndre Fischer             break;
292f79579d2SAndre Fischer 
293f79579d2SAndre Fischer         case CombinedEnumContext(Application_Calc, Context_EditCell):
294f79579d2SAndre Fischer         case CombinedEnumContext(Application_Calc, Context_DrawText):
295f79579d2SAndre Fischer             mpToolBoxScriptSw->Hide();
296f79579d2SAndre Fischer             mpToolBoxHighlight->Hide();
297f79579d2SAndre Fischer             mpToolBoxScript->Enable();
298f79579d2SAndre Fischer             mpToolBoxSpacing->Enable();
299f79579d2SAndre Fischer             break;
300b9e67834SAndre Fischer 
30185f1aca2SAndre Fischer         case CombinedEnumContext(Application_WriterVariants, Context_Text):
30285f1aca2SAndre Fischer         case CombinedEnumContext(Application_WriterVariants, Context_Table):
303b9e67834SAndre Fischer             mpToolBoxScriptSw->Show();
304b9e67834SAndre Fischer             mpToolBoxScript->Hide();
305b9e67834SAndre Fischer             mpToolBoxHighlight->Show();
306b9e67834SAndre Fischer             mpToolBoxSpacing->Show();
307b9e67834SAndre Fischer             break;
308b9e67834SAndre Fischer 
30985f1aca2SAndre Fischer         case CombinedEnumContext(Application_WriterVariants, Context_DrawText):
31085f1aca2SAndre Fischer         case CombinedEnumContext(Application_WriterVariants, Context_Annotation):
311b9e67834SAndre Fischer             mpToolBoxScriptSw->Show();
312b9e67834SAndre Fischer             mpToolBoxScript->Hide();
313b9e67834SAndre Fischer             mpToolBoxSpacing->Show();
314b9e67834SAndre Fischer             mpToolBoxHighlight->Hide();
315b9e67834SAndre Fischer             break;
316b9e67834SAndre Fischer 
31737fee4fdSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
31837fee4fdSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_Text):
31937fee4fdSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_Table):
32037fee4fdSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_OutlineText):
32137fee4fdSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_Draw):
32237fee4fdSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
32337fee4fdSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
324b9e67834SAndre Fischer             mpToolBoxScriptSw->Hide();
325b9e67834SAndre Fischer             mpToolBoxScript->Show();
326b9e67834SAndre Fischer             mpToolBoxSpacing->Show();
327b9e67834SAndre Fischer             mpToolBoxHighlight->Hide();
328b9e67834SAndre Fischer             break;
329b9e67834SAndre Fischer 
330b9e67834SAndre Fischer         default:
331b9e67834SAndre Fischer             break;
332b9e67834SAndre Fischer     }
333b9e67834SAndre Fischer }
334b9e67834SAndre Fischer 
33545da7d5eSAndre Fischer 
336b9e67834SAndre Fischer 
337b9e67834SAndre Fischer 
338b9e67834SAndre Fischer void TextPropertyPanel::DataChanged (const DataChangedEvent& rEvent)
339b9e67834SAndre Fischer {
34095a18594SAndre Fischer     (void)rEvent;
34195a18594SAndre Fischer 
34245da7d5eSAndre Fischer     SetupToolboxItems();
343b9e67834SAndre Fischer }
344b9e67834SAndre Fischer 
345b9e67834SAndre Fischer 
346b9e67834SAndre Fischer 
347b9e67834SAndre Fischer void TextPropertyPanel::Initialize (void)
348b9e67834SAndre Fischer {
349b9e67834SAndre Fischer     //<<modify fill font list
350b9e67834SAndre Fischer     SfxObjectShell* pDocSh = SfxObjectShell::Current();
351b9e67834SAndre Fischer     const SfxPoolItem* pItem = NULL;
352b9e67834SAndre Fischer 
353b9e67834SAndre Fischer     if (pDocSh != NULL)
354b9e67834SAndre Fischer         pItem = pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST );
355b9e67834SAndre Fischer     if (pItem != NULL)
356b9e67834SAndre Fischer         mpFontList = ( (SvxFontListItem*)pItem )->GetFontList();
357b9e67834SAndre Fischer     else
358b9e67834SAndre Fischer     {
359b9e67834SAndre Fischer         mpFontList = new FontList( Application::GetDefaultDevice() );
36045da7d5eSAndre Fischer         mbMustDelete = true;
361b9e67834SAndre Fischer     }
362b9e67834SAndre Fischer 
363b9e67834SAndre Fischer     mpFontNameBox->SetAccessibleName(mpFontNameBox->GetQuickHelpText());
36495a18594SAndre Fischer     const FontInfo aFontInfo (mpFontList->Get( String::CreateFromAscii( "" ), String::CreateFromAscii( "" )));
36595a18594SAndre Fischer     maFontSizeBox.Fill(&aFontInfo,mpFontList);
366b9e67834SAndre Fischer     maFontSizeBox.SetAccessibleName(maFontSizeBox.GetQuickHelpText());
367b9e67834SAndre Fischer 
368b9e67834SAndre Fischer     //toolbox
36945da7d5eSAndre Fischer     SetupToolboxItems();
370b9e67834SAndre Fischer     InitToolBoxIncDec();
371b9e67834SAndre Fischer     InitToolBoxFont();
372b9e67834SAndre Fischer     InitToolBoxFontColor();
373b9e67834SAndre Fischer     InitToolBoxScript();
374b9e67834SAndre Fischer     InitToolBoxSpacing();
375b9e67834SAndre Fischer     InitToolBoxHighlight();
376b9e67834SAndre Fischer 
377b9e67834SAndre Fischer #ifdef HAS_IA2
378d4aefcaeSZheng Fan     mpFontNameBox->SetAccRelationLabeledBy(&mpFontNameBox);
379d4aefcaeSZheng Fan     mpFontNameBox->SetMpSubEditAccLableBy(&mpFontNameBox);
380b9e67834SAndre Fischer     maFontSizeBox.SetAccRelationLabeledBy(&maFontSizeBox);
381b9e67834SAndre Fischer     maFontSizeBox.SetMpSubEditAccLableBy(&maFontSizeBox);
382d4aefcaeSZheng Fan     mpToolBoxFont.SetAccRelationLabeledBy(&mpToolBoxFont);
383d4aefcaeSZheng Fan     mpToolBoxIncDec.SetAccRelationLabeledBy(&mpToolBoxIncDec);
384d4aefcaeSZheng Fan     mpToolBoxFontColor.SetAccRelationLabeledBy(&mpToolBoxFontColor);
385d4aefcaeSZheng Fan     mpToolBoxScript.SetAccRelationLabeledBy(&mpToolBoxScript);
386d4aefcaeSZheng Fan     mpToolBoxScriptSw.SetAccRelationLabeledBy(&mpToolBoxScriptSw);
387d4aefcaeSZheng Fan     mpToolBoxSpacing.SetAccRelationLabeledBy(&mpToolBoxSpacing);
388d4aefcaeSZheng Fan     mpToolBoxHighlight.SetAccRelationLabeledBy(&mpToolBoxHighlight);
389b9e67834SAndre Fischer #endif
390b9e67834SAndre Fischer 
391b9e67834SAndre Fischer     //init state
392b9e67834SAndre Fischer     mpHeightItem = NULL;
393b9e67834SAndre Fischer     meWeight = WEIGHT_NORMAL;
394b9e67834SAndre Fischer     meItalic = ITALIC_NONE;
395b9e67834SAndre Fischer     mbShadow = false;
396b9e67834SAndre Fischer     meStrike = STRIKEOUT_NONE;
397b9e67834SAndre Fischer     mbPostureAvailable = true;
398b9e67834SAndre Fischer     mbWeightAvailable = true;
399b9e67834SAndre Fischer     meUnderline = UNDERLINE_NONE;
400b9e67834SAndre Fischer     meUnderlineColor = COL_AUTO;   //
401b9e67834SAndre Fischer     maColor = COL_BLACK;
402b9e67834SAndre Fischer     mbColorAvailable = true;
403b9e67834SAndre Fischer     maBackColor = COL_AUTO;
404b9e67834SAndre Fischer     mbBackColorAvailable = true;
405b9e67834SAndre Fischer     meEscape = SVX_ESCAPEMENT_OFF;
406b9e67834SAndre Fischer     mbSuper = false;
407b9e67834SAndre Fischer     mbSub = false;
408b9e67834SAndre Fischer     mbKernAvailable = true;
409b9e67834SAndre Fischer     mbKernLBAvailable = true;
410b9e67834SAndre Fischer     mlKerning = 0;
411b9e67834SAndre Fischer     mpFontColorUpdater.reset(new ToolboxButtonColorUpdater(
412b9e67834SAndre Fischer             SID_ATTR_CHAR_COLOR,
413b9e67834SAndre Fischer             TBI_FONTCOLOR,
414b9e67834SAndre Fischer             mpToolBoxFontColor.get(),
415b9e67834SAndre Fischer             TBX_UPDATER_MODE_CHAR_COLOR_NEW));
416b9e67834SAndre Fischer     mpHighlightUpdater.reset(new ToolboxButtonColorUpdater(
417b9e67834SAndre Fischer             SID_ATTR_BRUSH_CHAR,
418b9e67834SAndre Fischer             TBI_HIGHLIGHT,
419b9e67834SAndre Fischer             mpToolBoxHighlight.get(),
420b9e67834SAndre Fischer             TBX_UPDATER_MODE_CHAR_COLOR_NEW));
421b9e67834SAndre Fischer 
422b9e67834SAndre Fischer     //set handler
423b9e67834SAndre Fischer     mpFontNameBox->SetBindings(mpBindings);
424b9e67834SAndre Fischer     Link aLink = LINK(this, TextPropertyPanel, FontSelHdl);
425b9e67834SAndre Fischer     mpFontNameBox->SetSelectHdl(aLink);
426b9e67834SAndre Fischer     aLink = LINK(this, TextPropertyPanel, FontSizeModifyHdl);
427b9e67834SAndre Fischer     maFontSizeBox.SetModifyHdl(aLink);
428b9e67834SAndre Fischer     aLink = LINK(this, TextPropertyPanel, FontSizeSelHdl);
429b9e67834SAndre Fischer     maFontSizeBox.SetSelectHdl(aLink);
430b9e67834SAndre Fischer     aLink = LINK(this, TextPropertyPanel, FontSizeLoseFocus);
431b9e67834SAndre Fischer     maFontSizeBox.SetLoseFocusHdl(aLink);
432b9e67834SAndre Fischer 
433f79579d2SAndre Fischer     Size aSize(PROPERTYPAGE_WIDTH, TEXT_SECTIONPAGE_HEIGHT);
434f79579d2SAndre Fischer     aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) );
435f79579d2SAndre Fischer     aSize.setWidth(GetOutputSizePixel().Width());
436f79579d2SAndre Fischer     SetSizePixel(aSize);
437b9e67834SAndre Fischer }
438b9e67834SAndre Fischer 
439d4aefcaeSZheng Fan void TextPropertyPanel::EndSpacingPopupMode (void)
440d4aefcaeSZheng Fan {
441d4aefcaeSZheng Fan     maCharSpacePopup.Hide();
442d4aefcaeSZheng Fan }
443b9e67834SAndre Fischer 
444d4aefcaeSZheng Fan void TextPropertyPanel::EndUnderlinePopupMode (void)
445d4aefcaeSZheng Fan {
446d4aefcaeSZheng Fan     maUnderlinePopup.Hide();
447d4aefcaeSZheng Fan }
448b9e67834SAndre Fischer 
449b9e67834SAndre Fischer 
450b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxFont()
451b9e67834SAndre Fischer {
452b9e67834SAndre Fischer     mpToolBoxFont->SetBackground(Wallpaper());
453b9e67834SAndre Fischer     mpToolBoxFont->SetPaintTransparent(true);
454b9e67834SAndre Fischer 
455b9e67834SAndre Fischer     Size aTbxSize( mpToolBoxFont->CalcWindowSizePixel() );
456b9e67834SAndre Fischer     mpToolBoxFont->SetOutputSizePixel( aTbxSize );
457b9e67834SAndre Fischer 
458b9e67834SAndre Fischer     Link aLink  = LINK(this, TextPropertyPanel, ToolboxFontSelectHandler);
459b9e67834SAndre Fischer     mpToolBoxFont->SetSelectHdl ( aLink );
460b9e67834SAndre Fischer     aLink = LINK(this, TextPropertyPanel, ToolBoxUnderlineClickHdl);
461b9e67834SAndre Fischer     mpToolBoxFont->SetDropdownClickHdl(aLink);
462b9e67834SAndre Fischer }
463b9e67834SAndre Fischer 
464b9e67834SAndre Fischer 
465b9e67834SAndre Fischer 
466b9e67834SAndre Fischer 
467b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxIncDec()
468b9e67834SAndre Fischer {
469b9e67834SAndre Fischer     Size aTbxSize( mpToolBoxIncDec->CalcWindowSizePixel() );
470b9e67834SAndre Fischer     mpToolBoxIncDec->SetOutputSizePixel( aTbxSize );
471b9e67834SAndre Fischer 
472b9e67834SAndre Fischer     Link aLink = LINK(this, TextPropertyPanel, ToolboxIncDecSelectHdl);
473b9e67834SAndre Fischer     mpToolBoxIncDec->SetSelectHdl ( aLink );
474b9e67834SAndre Fischer }
475b9e67834SAndre Fischer 
476b9e67834SAndre Fischer 
477b9e67834SAndre Fischer 
478b9e67834SAndre Fischer 
479b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxFontColor()
480b9e67834SAndre Fischer {
481b9e67834SAndre Fischer     Size aTbxSize( mpToolBoxFontColor->CalcWindowSizePixel() );
482b9e67834SAndre Fischer     mpToolBoxFontColor->SetOutputSizePixel( aTbxSize );
483b9e67834SAndre Fischer     mpToolBoxFontColor->SetItemBits( TBI_FONTCOLOR, mpToolBoxFontColor->GetItemBits( TBI_FONTCOLOR ) | TIB_DROPDOWNONLY );
484b9e67834SAndre Fischer 
485b9e67834SAndre Fischer     Link aLink = LINK(this, TextPropertyPanel, ToolBoxFontColorDropHdl);
486b9e67834SAndre Fischer     mpToolBoxFontColor->SetDropdownClickHdl ( aLink );
487b9e67834SAndre Fischer     mpToolBoxFontColor->SetSelectHdl ( aLink );
488b9e67834SAndre Fischer 
489b9e67834SAndre Fischer }
490b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxScript()
491b9e67834SAndre Fischer {
492b9e67834SAndre Fischer     Size aTbxSize( mpToolBoxScriptSw->CalcWindowSizePixel() );
493b9e67834SAndre Fischer     mpToolBoxScriptSw->SetOutputSizePixel( aTbxSize );
494b9e67834SAndre Fischer 
495b9e67834SAndre Fischer     Link aLink = LINK(this, TextPropertyPanel, ToolBoxSwScriptSelectHdl);
496b9e67834SAndre Fischer     mpToolBoxScriptSw->SetSelectHdl ( aLink );
497b9e67834SAndre Fischer 
498b9e67834SAndre Fischer     aTbxSize = mpToolBoxScript->CalcWindowSizePixel() ;
499b9e67834SAndre Fischer     mpToolBoxScript->SetOutputSizePixel( aTbxSize );
500b9e67834SAndre Fischer 
501b9e67834SAndre Fischer     aLink = LINK(this, TextPropertyPanel, ToolBoxScriptSelectHdl);
502b9e67834SAndre Fischer     mpToolBoxScript->SetSelectHdl ( aLink );
503b9e67834SAndre Fischer }
504b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxSpacing()
505b9e67834SAndre Fischer {
506b9e67834SAndre Fischer     Size aTbxSize( mpToolBoxSpacing->CalcWindowSizePixel() );
507b9e67834SAndre Fischer     mpToolBoxSpacing->SetOutputSizePixel( aTbxSize );
508b9e67834SAndre Fischer     mpToolBoxSpacing->SetItemBits( TBI_SPACING, mpToolBoxSpacing->GetItemBits( TBI_SPACING ) | TIB_DROPDOWNONLY );
509b9e67834SAndre Fischer 
510b9e67834SAndre Fischer     Link aLink = LINK(this, TextPropertyPanel, SpacingClickHdl);
511b9e67834SAndre Fischer     mpToolBoxSpacing->SetDropdownClickHdl ( aLink );
512b9e67834SAndre Fischer     mpToolBoxSpacing->SetSelectHdl( aLink );
513b9e67834SAndre Fischer }
514b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxHighlight()
515b9e67834SAndre Fischer {
516b9e67834SAndre Fischer     Size aTbxSize( mpToolBoxHighlight->CalcWindowSizePixel() );
517b9e67834SAndre Fischer     mpToolBoxHighlight->SetOutputSizePixel( aTbxSize );
518b9e67834SAndre Fischer     mpToolBoxHighlight->SetItemBits( TBI_HIGHLIGHT, mpToolBoxHighlight->GetItemBits( TBI_HIGHLIGHT ) | TIB_DROPDOWNONLY );
519b9e67834SAndre Fischer 
520b9e67834SAndre Fischer     Link aLink = LINK(this, TextPropertyPanel, ToolBoxHighlightDropHdl);
521b9e67834SAndre Fischer     mpToolBoxHighlight->SetDropdownClickHdl ( aLink );
522b9e67834SAndre Fischer     mpToolBoxHighlight->SetSelectHdl( aLink );
523b9e67834SAndre Fischer }
524b9e67834SAndre Fischer 
525b9e67834SAndre Fischer 
526b9e67834SAndre Fischer 
527b9e67834SAndre Fischer 
52845da7d5eSAndre Fischer void TextPropertyPanel::SetupToolboxItems (void)
529b9e67834SAndre Fischer {
53045da7d5eSAndre Fischer     maSDFontGrow.SetupToolBoxItem(*mpToolBoxIncDec, TBI_INCREASE);
53145da7d5eSAndre Fischer     maSDFontShrink.SetupToolBoxItem(*mpToolBoxIncDec, TBI_DECREASE);
532b9e67834SAndre Fischer 
53345da7d5eSAndre Fischer     maWeightControl.SetupToolBoxItem(*mpToolBoxFont, TBI_BOLD);
53445da7d5eSAndre Fischer     maItalicControl.SetupToolBoxItem(*mpToolBoxFont, TBI_ITALIC);
53545da7d5eSAndre Fischer     maUnderlineControl.SetupToolBoxItem(*mpToolBoxFont, TBI_UNDERLINE);
53645da7d5eSAndre Fischer     maStrikeControl.SetupToolBoxItem(*mpToolBoxFont, TBI_STRIKEOUT);
53745da7d5eSAndre Fischer     maShadowControl.SetupToolBoxItem(*mpToolBoxFont, TBI_SHADOWED);
538b9e67834SAndre Fischer 
53945da7d5eSAndre Fischer     maFontColorControl.SetupToolBoxItem(*mpToolBoxFontColor, TBI_FONTCOLOR);
540b9e67834SAndre Fischer     //for sw
54145da7d5eSAndre Fischer     maSuperScriptControl.SetupToolBoxItem(*mpToolBoxScriptSw, TBI_SUPER_SW);
54245da7d5eSAndre Fischer     maSubScriptControl.SetupToolBoxItem(*mpToolBoxScriptSw, TBI_SUB_SW);
543b9e67834SAndre Fischer     //for sc and sd
544ccab7bc0SAndre Fischer     maSuperScriptControl.SetupToolBoxItem(*mpToolBoxScript, TBI_SUPER);
54545da7d5eSAndre Fischer     maSubScriptControl.SetupToolBoxItem(*mpToolBoxScript, TBI_SUB);
54645da7d5eSAndre Fischer     maSpacingControl.SetupToolBoxItem(*mpToolBoxSpacing, TBI_SPACING);
54745da7d5eSAndre Fischer     maHighlightControl.SetupToolBoxItem(*mpToolBoxHighlight, TBI_HIGHLIGHT);
548b9e67834SAndre Fischer }
549b9e67834SAndre Fischer 
550b9e67834SAndre Fischer 
551b9e67834SAndre Fischer 
552b9e67834SAndre Fischer 
553b9e67834SAndre Fischer IMPL_LINK( TextPropertyPanel, FontSelHdl, FontNameBox*, pBox )
554b9e67834SAndre Fischer {
555b9e67834SAndre Fischer     if ( !pBox->IsTravelSelect() )
556b9e67834SAndre Fischer     {
557b9e67834SAndre Fischer         if( SfxViewShell::Current() )
558b9e67834SAndre Fischer         {
559b9e67834SAndre Fischer             Window* pShellWnd = SfxViewShell::Current()->GetWindow();
560b9e67834SAndre Fischer 
561b9e67834SAndre Fischer             if ( pShellWnd )
562b9e67834SAndre Fischer                 pShellWnd->GrabFocus();
563b9e67834SAndre Fischer         }
564b9e67834SAndre Fischer     }
565b9e67834SAndre Fischer     return 0;
566b9e67834SAndre Fischer }
567*8ce66e53SOliver-Rainer Wittmann 
568b9e67834SAndre Fischer IMPL_LINK( TextPropertyPanel, FontSizeModifyHdl, FontSizeBox*, pSizeBox )
569b9e67834SAndre Fischer {
570b9e67834SAndre Fischer     if (pSizeBox == &maFontSizeBox)
571b9e67834SAndre Fischer     {
572b9e67834SAndre Fischer         long nSize = pSizeBox->GetValue();
573b9e67834SAndre Fischer         mbFocusOnFontSizeCtrl = true;
574b9e67834SAndre Fischer 
575b9e67834SAndre Fischer         float fSize = (float)nSize / 10;
576b9e67834SAndre Fischer         SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric();
577b9e67834SAndre Fischer         SvxFontHeightItem aItem( CalcToUnit( fSize, eUnit ), 100, SID_ATTR_CHAR_FONTHEIGHT ) ;
578b9e67834SAndre Fischer 
579b9e67834SAndre Fischer         mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONTHEIGHT, SFX_CALLMODE_RECORD, &aItem, 0L );
580b9e67834SAndre Fischer         mpBindings->Invalidate(SID_ATTR_CHAR_FONTHEIGHT,true,false);
581b9e67834SAndre Fischer     }
582b9e67834SAndre Fischer     return 0;
583b9e67834SAndre Fischer }
584*8ce66e53SOliver-Rainer Wittmann 
585b9e67834SAndre Fischer IMPL_LINK( TextPropertyPanel, FontSizeSelHdl, FontSizeBox*, pSizeBox )
586b9e67834SAndre Fischer {
587b9e67834SAndre Fischer     if ( !pSizeBox->IsTravelSelect() )
588b9e67834SAndre Fischer     {
589b9e67834SAndre Fischer         if( SfxViewShell::Current() )
590b9e67834SAndre Fischer         {
591b9e67834SAndre Fischer             Window* pShellWnd = SfxViewShell::Current()->GetWindow();
592b9e67834SAndre Fischer 
593b9e67834SAndre Fischer             if ( pShellWnd )
594b9e67834SAndre Fischer                 pShellWnd->GrabFocus();
595b9e67834SAndre Fischer         }
596b9e67834SAndre Fischer     }
597b9e67834SAndre Fischer 
598b9e67834SAndre Fischer     return 0;
599b9e67834SAndre Fischer }
600*8ce66e53SOliver-Rainer Wittmann 
601b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, FontSizeLoseFocus, FontSizeBox*, pSizeBox)
602b9e67834SAndre Fischer {
603b9e67834SAndre Fischer     if(pSizeBox == &maFontSizeBox)
604b9e67834SAndre Fischer     {
605b9e67834SAndre Fischer         mbFocusOnFontSizeCtrl = false;
606b9e67834SAndre Fischer     }
607b9e67834SAndre Fischer     return 0;
608b9e67834SAndre Fischer }
609b9e67834SAndre Fischer 
610b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolboxFontSelectHandler, ToolBox*, pToolBox)
611b9e67834SAndre Fischer {
612b9e67834SAndre Fischer     const sal_uInt16 nId = pToolBox->GetCurItemId();
613b9e67834SAndre Fischer 
61445da7d5eSAndre Fischer     switch (nId)
61545da7d5eSAndre Fischer     {
61645da7d5eSAndre Fischer         case TBI_BOLD:
617b9e67834SAndre Fischer         {
618b9e67834SAndre Fischer             EndTracking();
619b9e67834SAndre Fischer             if(meWeight != WEIGHT_BOLD)
620b9e67834SAndre Fischer                 meWeight = WEIGHT_BOLD;
621b9e67834SAndre Fischer             else
622b9e67834SAndre Fischer                 meWeight = WEIGHT_NORMAL;
623b9e67834SAndre Fischer             SvxWeightItem aWeightItem(meWeight, SID_ATTR_CHAR_WEIGHT);
624b9e67834SAndre Fischer             mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_WEIGHT, SFX_CALLMODE_RECORD, &aWeightItem, 0L);
62545da7d5eSAndre Fischer             UpdateItem(SID_ATTR_CHAR_WEIGHT);
62645da7d5eSAndre Fischer             break;
627b9e67834SAndre Fischer         }
62845da7d5eSAndre Fischer         case TBI_ITALIC:
629b9e67834SAndre Fischer         {
630b9e67834SAndre Fischer             EndTracking();
631b9e67834SAndre Fischer             if(meItalic != ITALIC_NORMAL)
632b9e67834SAndre Fischer                 meItalic = ITALIC_NORMAL;
633b9e67834SAndre Fischer             else
634b9e67834SAndre Fischer                 meItalic = ITALIC_NONE;
635b9e67834SAndre Fischer             SvxPostureItem aPostureItem(meItalic, SID_ATTR_CHAR_POSTURE);
636b9e67834SAndre Fischer             mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_POSTURE, SFX_CALLMODE_RECORD, &aPostureItem, 0L);
63745da7d5eSAndre Fischer             UpdateItem(SID_ATTR_CHAR_POSTURE);
63845da7d5eSAndre Fischer             break;
639b9e67834SAndre Fischer         }
64045da7d5eSAndre Fischer         case TBI_UNDERLINE:
641b9e67834SAndre Fischer         {
642b9e67834SAndre Fischer             EndTracking();
643b9e67834SAndre Fischer             if(meUnderline == UNDERLINE_NONE)
644b9e67834SAndre Fischer             {
64595a18594SAndre Fischer                 meUnderline = UNDERLINE_SINGLE;
646b9e67834SAndre Fischer                 SvxUnderlineItem aLineItem(meUnderline, SID_ATTR_CHAR_UNDERLINE);
647b9e67834SAndre Fischer                 aLineItem.SetColor(meUnderlineColor);
648b9e67834SAndre Fischer                 mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_UNDERLINE, SFX_CALLMODE_RECORD, &aLineItem, 0L);
649b9e67834SAndre Fischer             }
650b9e67834SAndre Fischer             else
651b9e67834SAndre Fischer             {
652b9e67834SAndre Fischer                 meUnderline = UNDERLINE_NONE;
653b9e67834SAndre Fischer                 SvxUnderlineItem aLineItem(meUnderline, SID_ATTR_CHAR_UNDERLINE);
654b9e67834SAndre Fischer                 mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_UNDERLINE, SFX_CALLMODE_RECORD, &aLineItem, 0L);
655b9e67834SAndre Fischer             }
65645da7d5eSAndre Fischer             UpdateItem(SID_ATTR_CHAR_UNDERLINE);
657*8ce66e53SOliver-Rainer Wittmann             break;
658b9e67834SAndre Fischer         }
65945da7d5eSAndre Fischer         case TBI_STRIKEOUT:
660b9e67834SAndre Fischer         {
661b9e67834SAndre Fischer             EndTracking();
662b9e67834SAndre Fischer             if(meStrike !=  STRIKEOUT_NONE && meStrike != STRIKEOUT_DONTKNOW)
663b9e67834SAndre Fischer                 meStrike = STRIKEOUT_NONE;
664b9e67834SAndre Fischer             else
665b9e67834SAndre Fischer                 meStrike = STRIKEOUT_SINGLE;
666b9e67834SAndre Fischer             SvxCrossedOutItem aStrikeItem(meStrike,SID_ATTR_CHAR_STRIKEOUT);
667b9e67834SAndre Fischer             mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_STRIKEOUT, SFX_CALLMODE_RECORD, &aStrikeItem, 0L);
66845da7d5eSAndre Fischer             UpdateItem(SID_ATTR_CHAR_STRIKEOUT);
66945da7d5eSAndre Fischer             break;
670b9e67834SAndre Fischer         }
67145da7d5eSAndre Fischer         case TBI_SHADOWED:
672b9e67834SAndre Fischer         {
673b9e67834SAndre Fischer             EndTracking();
674b9e67834SAndre Fischer             mbShadow = !mbShadow;
675b9e67834SAndre Fischer             SvxShadowedItem aShadowItem(mbShadow, SID_ATTR_CHAR_SHADOWED);
676b9e67834SAndre Fischer             mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_SHADOWED, SFX_CALLMODE_RECORD, &aShadowItem, 0L);
67745da7d5eSAndre Fischer             UpdateItem(SID_ATTR_CHAR_SHADOWED);
67845da7d5eSAndre Fischer             break;
67945da7d5eSAndre Fischer         }
680b9e67834SAndre Fischer     }
681b9e67834SAndre Fischer     return 0;
682b9e67834SAndre Fischer }
683b9e67834SAndre Fischer 
684b9e67834SAndre Fischer 
685b9e67834SAndre Fischer 
686b9e67834SAndre Fischer 
687b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolboxIncDecSelectHdl, ToolBox*, pToolBox)
688b9e67834SAndre Fischer {
689b9e67834SAndre Fischer     const sal_uInt16 nId = pToolBox->GetCurItemId();
690b9e67834SAndre Fischer 
691b9e67834SAndre Fischer     // font size +/- enhancement in sd
69245da7d5eSAndre Fischer     switch (maContext.GetCombinedContext_DI())
693b9e67834SAndre Fischer     {
69445da7d5eSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
69545da7d5eSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_Text):
69645da7d5eSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_Table):
69745da7d5eSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_OutlineText):
69845da7d5eSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_Draw):
69945da7d5eSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
70045da7d5eSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
701b9e67834SAndre Fischer             if(nId == TBI_INCREASE)
702b9e67834SAndre Fischer             {
703b9e67834SAndre Fischer                 EndTracking();
704b9e67834SAndre Fischer                 SfxVoidItem aItem(SID_GROW_FONT_SIZE);
705b9e67834SAndre Fischer                 mpBindings->GetDispatcher()->Execute( SID_GROW_FONT_SIZE, SFX_CALLMODE_RECORD, &aItem, 0L );
706b9e67834SAndre Fischer             }
707b9e67834SAndre Fischer             else if(nId == TBI_DECREASE)
708b9e67834SAndre Fischer             {
709b9e67834SAndre Fischer                 EndTracking();
710b9e67834SAndre Fischer                 SfxVoidItem aItem(SID_SHRINK_FONT_SIZE);
711b9e67834SAndre Fischer                 mpBindings->GetDispatcher()->Execute( SID_SHRINK_FONT_SIZE, SFX_CALLMODE_RECORD, &aItem, 0L );
712b9e67834SAndre Fischer             }
713b9e67834SAndre Fischer             break;
714b9e67834SAndre Fischer 
715b9e67834SAndre Fischer         default:
716b9e67834SAndre Fischer             if(nId == TBI_INCREASE)
717b9e67834SAndre Fischer             {
718b9e67834SAndre Fischer                 EndTracking();
719b9e67834SAndre Fischer                 mbFocusOnFontSizeCtrl = false;
720b9e67834SAndre Fischer                 sal_Int64 iValue = maFontSizeBox.GetValue();
721b9e67834SAndre Fischer                 int iPos = maFontSizeBox.GetValuePos(iValue, FUNIT_NONE);
722b9e67834SAndre Fischer                 long nSize = iValue;
723b9e67834SAndre Fischer                 if(iPos != LISTBOX_ENTRY_NOTFOUND)
724b9e67834SAndre Fischer                     nSize = maFontSizeBox.GetValue(iPos+1 , FUNIT_NONE);
725b9e67834SAndre Fischer                 else if(iValue >= 100 && iValue < 105)
726b9e67834SAndre Fischer                     nSize = 105;
727b9e67834SAndre Fischer                 else if(iValue >= 105 && iValue < 110)
728b9e67834SAndre Fischer                     nSize = 110;
729b9e67834SAndre Fischer                 else if(iValue < 960)
730b9e67834SAndre Fischer                 {
731b9e67834SAndre Fischer                     nSize = (nSize / 10) * 10 + 10;
732b9e67834SAndre Fischer                     while(maFontSizeBox.GetValuePos(nSize, FUNIT_NONE) == LISTBOX_ENTRY_NOTFOUND)
733b9e67834SAndre Fischer                         nSize += 10;
734b9e67834SAndre Fischer                 }
735b9e67834SAndre Fischer                 else
736b9e67834SAndre Fischer                 {
737b9e67834SAndre Fischer                     nSize = iValue;
738b9e67834SAndre Fischer                 }
739b9e67834SAndre Fischer 
740b9e67834SAndre Fischer                 float fSize = (float)nSize / 10;
741b9e67834SAndre Fischer 
742b9e67834SAndre Fischer                 SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric();
743b9e67834SAndre Fischer                 SvxFontHeightItem aItem( CalcToUnit( fSize, eUnit ), 100, SID_ATTR_CHAR_FONTHEIGHT ) ;
744b9e67834SAndre Fischer 
745b9e67834SAndre Fischer                 mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONTHEIGHT, SFX_CALLMODE_RECORD, &aItem, 0L );
746b9e67834SAndre Fischer                 mpBindings->Invalidate(SID_ATTR_CHAR_FONTHEIGHT,true,false);
747b9e67834SAndre Fischer                 maFontSizeBox.SetValue( nSize );
748b9e67834SAndre Fischer             }
749b9e67834SAndre Fischer             else if(nId == TBI_DECREASE)
750b9e67834SAndre Fischer             {
751b9e67834SAndre Fischer                 EndTracking();
752b9e67834SAndre Fischer                 mbFocusOnFontSizeCtrl = false;
753b9e67834SAndre Fischer                 sal_Int64 iValue = maFontSizeBox.GetValue();
754b9e67834SAndre Fischer                 int iPos = maFontSizeBox.GetValuePos(iValue, FUNIT_NONE);
755b9e67834SAndre Fischer                 long nSize = iValue;
756b9e67834SAndre Fischer                 if(iPos != LISTBOX_ENTRY_NOTFOUND)
757b9e67834SAndre Fischer                     nSize = maFontSizeBox.GetValue(iPos-1 , FUNIT_NONE);
758b9e67834SAndre Fischer                 else if(iValue > 100 && iValue <= 105)
759b9e67834SAndre Fischer                     nSize = 100;
760b9e67834SAndre Fischer                 else if(iValue > 105 && iValue <= 110)
761b9e67834SAndre Fischer                     nSize = 105;
762b9e67834SAndre Fischer                 else if(iValue > 960)
763b9e67834SAndre Fischer                 {
764b9e67834SAndre Fischer                     nSize = 960;
765b9e67834SAndre Fischer                 }
766b9e67834SAndre Fischer                 else if(iValue > 60)
767b9e67834SAndre Fischer                 {
768b9e67834SAndre Fischer                     nSize = (nSize / 10) * 10 ;
769b9e67834SAndre Fischer                     while(maFontSizeBox.GetValuePos(nSize, FUNIT_NONE) == LISTBOX_ENTRY_NOTFOUND)
770b9e67834SAndre Fischer                         nSize -= 10;
771b9e67834SAndre Fischer                 }
772b9e67834SAndre Fischer                 else
773b9e67834SAndre Fischer                 {
774b9e67834SAndre Fischer                     nSize = iValue;
775b9e67834SAndre Fischer                 }
776b9e67834SAndre Fischer 
777b9e67834SAndre Fischer                 float fSize = (float)nSize / 10;
778b9e67834SAndre Fischer 
779b9e67834SAndre Fischer                 SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric();
780b9e67834SAndre Fischer                 SvxFontHeightItem aItem( CalcToUnit( fSize, eUnit ), 100, SID_ATTR_CHAR_FONTHEIGHT ) ;
781b9e67834SAndre Fischer 
782b9e67834SAndre Fischer                 mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONTHEIGHT, SFX_CALLMODE_RECORD, &aItem, 0L );
783b9e67834SAndre Fischer                 mpBindings->Invalidate(SID_ATTR_CHAR_FONTHEIGHT,true,false);
784b9e67834SAndre Fischer                 maFontSizeBox.SetValue( nSize );
785b9e67834SAndre Fischer             }
786b9e67834SAndre Fischer     }
78745da7d5eSAndre Fischer     UpdateItem(SID_ATTR_CHAR_FONTHEIGHT);
78845da7d5eSAndre Fischer 
789b9e67834SAndre Fischer     return 0;
790b9e67834SAndre Fischer }
791b9e67834SAndre Fischer 
792b9e67834SAndre Fischer 
793b9e67834SAndre Fischer 
794b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolBoxUnderlineClickHdl, ToolBox*, pToolBox)
795b9e67834SAndre Fischer {
796b9e67834SAndre Fischer     const sal_uInt16 nId = pToolBox->GetCurItemId();
797d4aefcaeSZheng Fan     OSL_ASSERT(nId == TBI_UNDERLINE);
798b9e67834SAndre Fischer     if(nId == TBI_UNDERLINE)
799b9e67834SAndre Fischer     {
800b9e67834SAndre Fischer         pToolBox->SetItemDown( nId, true );
801d4aefcaeSZheng Fan         maUnderlinePopup.Rearrange(meUnderline);
802d4aefcaeSZheng Fan         maUnderlinePopup.Show(*pToolBox);
803b9e67834SAndre Fischer 
804b9e67834SAndre Fischer     }
805d4aefcaeSZheng Fan     return 0L;
806b9e67834SAndre Fischer }
807b9e67834SAndre Fischer 
808b9e67834SAndre Fischer 
809b9e67834SAndre Fischer 
810b9e67834SAndre Fischer 
811b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolBoxFontColorDropHdl,ToolBox*, pToolBox)
812b9e67834SAndre Fischer {
813b9e67834SAndre Fischer     const sal_uInt16 nId = pToolBox->GetCurItemId();
814b9e67834SAndre Fischer     if(nId == TBI_FONTCOLOR)
815b9e67834SAndre Fischer     {
816b9e67834SAndre Fischer         pToolBox->SetItemDown( nId, true );
817b9e67834SAndre Fischer 
818d4aefcaeSZheng Fan         maFontColorPopup.Show(*pToolBox);
819d4aefcaeSZheng Fan         maFontColorPopup.SetCurrentColor(maColor, mbColorAvailable);
820b9e67834SAndre Fischer     }
821b9e67834SAndre Fischer     return 0;
822b9e67834SAndre Fischer }
823b9e67834SAndre Fischer 
824b9e67834SAndre Fischer 
825b9e67834SAndre Fischer 
826b9e67834SAndre Fischer 
827b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolBoxSwScriptSelectHdl, ToolBox*, pToolBox)
828b9e67834SAndre Fischer {
829b9e67834SAndre Fischer     const sal_uInt16 nId = pToolBox->GetCurItemId();
830b9e67834SAndre Fischer     if( nId == TBI_SUPER_SW )
831b9e67834SAndre Fischer     {
832b9e67834SAndre Fischer         if(meEscape != SVX_ESCAPEMENT_SUPERSCRIPT)
833b9e67834SAndre Fischer         {
834b9e67834SAndre Fischer             meEscape = SVX_ESCAPEMENT_SUPERSCRIPT;
835b9e67834SAndre Fischer             SvxEscapementItem aSupItem(DFLT_ESC_SUPER, DFLT_ESC_PROP, SID_ATTR_CHAR_ESCAPEMENT);
836b9e67834SAndre Fischer             mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aSupItem, 0L );
837b9e67834SAndre Fischer         }
838b9e67834SAndre Fischer         else
839b9e67834SAndre Fischer         {
840b9e67834SAndre Fischer             meEscape = SVX_ESCAPEMENT_OFF;
841b9e67834SAndre Fischer             SvxEscapementItem aNoneItem(0, 100, SID_ATTR_CHAR_ESCAPEMENT);
842b9e67834SAndre Fischer             mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aNoneItem, 0L );
843b9e67834SAndre Fischer         }
844b9e67834SAndre Fischer     }
845b9e67834SAndre Fischer     else if(TBI_SUB_SW == nId)
846b9e67834SAndre Fischer     {
847b9e67834SAndre Fischer         if(meEscape != SVX_ESCAPEMENT_SUBSCRIPT)
848b9e67834SAndre Fischer         {
849b9e67834SAndre Fischer             meEscape = (SvxEscapement)SVX_ESCAPEMENT_SUBSCRIPT;
850b9e67834SAndre Fischer             SvxEscapementItem aSubItem(DFLT_ESC_SUB, DFLT_ESC_PROP, SID_ATTR_CHAR_ESCAPEMENT);
851b9e67834SAndre Fischer             mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aSubItem, 0L );
852b9e67834SAndre Fischer         }
853b9e67834SAndre Fischer         else
854b9e67834SAndre Fischer         {
855b9e67834SAndre Fischer             meEscape = SVX_ESCAPEMENT_OFF;
856b9e67834SAndre Fischer             SvxEscapementItem aNoneItem(0, 100, SID_ATTR_CHAR_ESCAPEMENT);
857b9e67834SAndre Fischer             mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aNoneItem, 0L );
858b9e67834SAndre Fischer         }
859b9e67834SAndre Fischer     }
86045da7d5eSAndre Fischer     UpdateItem(SID_ATTR_CHAR_ESCAPEMENT);
861b9e67834SAndre Fischer 
862b9e67834SAndre Fischer     return 0;
863b9e67834SAndre Fischer }
864b9e67834SAndre Fischer 
865b9e67834SAndre Fischer 
866b9e67834SAndre Fischer 
867b9e67834SAndre Fischer 
868b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolBoxScriptSelectHdl, ToolBox*, pToolBox)
869b9e67834SAndre Fischer {
870b9e67834SAndre Fischer     const sal_uInt16 nId = pToolBox->GetCurItemId();
871b9e67834SAndre Fischer     if( nId == TBI_SUPER )
872b9e67834SAndre Fischer     {
873b9e67834SAndre Fischer         mbSuper = !mbSuper;
874b9e67834SAndre Fischer         SfxBoolItem aSupItem(SID_SET_SUPER_SCRIPT, mbSuper);
875b9e67834SAndre Fischer         mpBindings->GetDispatcher()->Execute( SID_SET_SUPER_SCRIPT, SFX_CALLMODE_RECORD, &aSupItem, 0L );
87645da7d5eSAndre Fischer         UpdateItem(SID_SET_SUPER_SCRIPT);
877b9e67834SAndre Fischer     }
878b9e67834SAndre Fischer     else if(TBI_SUB == nId)
879b9e67834SAndre Fischer     {
880b9e67834SAndre Fischer 
881b9e67834SAndre Fischer         mbSub = !mbSub;
882b9e67834SAndre Fischer         SfxBoolItem aSubItem(SID_SET_SUB_SCRIPT, mbSub );
883b9e67834SAndre Fischer         mpBindings->GetDispatcher()->Execute( SID_SET_SUB_SCRIPT, SFX_CALLMODE_RECORD, &aSubItem, 0L );
88445da7d5eSAndre Fischer         UpdateItem(SID_SET_SUB_SCRIPT);
885b9e67834SAndre Fischer     }
886b9e67834SAndre Fischer     return 0;
887b9e67834SAndre Fischer }
888b9e67834SAndre Fischer 
889b9e67834SAndre Fischer 
890b9e67834SAndre Fischer 
891b9e67834SAndre Fischer 
892b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolBoxHighlightDropHdl, ToolBox*, pToolBox)
893b9e67834SAndre Fischer {
894b9e67834SAndre Fischer     const sal_uInt16 nId = pToolBox->GetCurItemId();
895b9e67834SAndre Fischer     if(nId == TBI_HIGHLIGHT)
896b9e67834SAndre Fischer     {
897b9e67834SAndre Fischer         pToolBox->SetItemDown( nId, true );
898d4aefcaeSZheng Fan         maBrushColorPopup.Show(*pToolBox);
899d4aefcaeSZheng Fan         maBrushColorPopup.SetCurrentColor(maBackColor, mbBackColorAvailable);
900b9e67834SAndre Fischer 
901b9e67834SAndre Fischer     }
902b9e67834SAndre Fischer     return 0;
903b9e67834SAndre Fischer }
904b9e67834SAndre Fischer 
905b9e67834SAndre Fischer 
906b9e67834SAndre Fischer 
907b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, SpacingClickHdl, ToolBox*, pToolBox)
908b9e67834SAndre Fischer {
909b9e67834SAndre Fischer     const sal_uInt16 nId = pToolBox->GetCurItemId();
910d4aefcaeSZheng Fan     OSL_ASSERT(nId == TBI_SPACING);
911b9e67834SAndre Fischer     if(nId == TBI_SPACING)
912b9e67834SAndre Fischer     {
913b9e67834SAndre Fischer         pToolBox->SetItemDown( nId, true );
914d4aefcaeSZheng Fan         maCharSpacePopup.Rearrange(mbKernLBAvailable,mbKernAvailable,mlKerning);
915d4aefcaeSZheng Fan         maCharSpacePopup.Show(*pToolBox);
916b9e67834SAndre Fischer 
917b9e67834SAndre Fischer     }
918d4aefcaeSZheng Fan     return 0L;
919b9e67834SAndre Fischer }
920b9e67834SAndre Fischer 
921b9e67834SAndre Fischer 
922b9e67834SAndre Fischer 
923b9e67834SAndre Fischer 
924b9e67834SAndre Fischer void TextPropertyPanel::NotifyItemUpdate (
925b9e67834SAndre Fischer     const sal_uInt16 nSID,
926b9e67834SAndre Fischer     const SfxItemState eState,
92745da7d5eSAndre Fischer     const SfxPoolItem* pState,
92845da7d5eSAndre Fischer     const bool bIsEnabled)
929b9e67834SAndre Fischer {
930b9e67834SAndre Fischer     switch(nSID)
931b9e67834SAndre Fischer     {
932b9e67834SAndre Fischer         case SID_ATTR_CHAR_FONT:
93345da7d5eSAndre Fischer         {
93445da7d5eSAndre Fischer             bool bIsControlEnabled (bIsEnabled);
935b9e67834SAndre Fischer             if (  eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxFontItem) )
936b9e67834SAndre Fischer             {
937b9e67834SAndre Fischer                 const SvxFontItem* pFontItem = (const SvxFontItem*)pState;
938b9e67834SAndre Fischer                 mpFontNameBox->SetText( pFontItem->GetFamilyName() );
939b9e67834SAndre Fischer             }
940b9e67834SAndre Fischer             else
941b9e67834SAndre Fischer             {
942b9e67834SAndre Fischer                 mpFontNameBox->SetText( String() );
943b9e67834SAndre Fischer                 if (SFX_ITEM_DISABLED == eState)
94445da7d5eSAndre Fischer                     bIsControlEnabled = false;
945b9e67834SAndre Fischer             }
94645da7d5eSAndre Fischer             mpFontNameBox->Enable(bIsControlEnabled);
947b9e67834SAndre Fischer             break;
94845da7d5eSAndre Fischer         }
949b9e67834SAndre Fischer         case SID_ATTR_CHAR_FONTHEIGHT:
95045da7d5eSAndre Fischer         {
95145da7d5eSAndre Fischer             bool bIsControlEnabled (bIsEnabled);
952b9e67834SAndre Fischer             if (  eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxFontHeightItem) )
953b9e67834SAndre Fischer             {
954b9e67834SAndre Fischer                 mpHeightItem = (SvxFontHeightItem*)pState;//const SvxFontHeightItem*
955b9e67834SAndre Fischer                 SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric();
956b9e67834SAndre Fischer                 long iValue = (long)CalcToPoint( mpHeightItem->GetHeight(), eUnit, 10 );
957b9e67834SAndre Fischer                 mpToolBoxIncDec->Enable();
958b9e67834SAndre Fischer 
959b9e67834SAndre Fischer                 mpToolBoxIncDec->SetItemState(TBI_INCREASE, STATE_NOCHECK);
960b9e67834SAndre Fischer                 mpToolBoxIncDec->SetItemState(TBI_DECREASE, STATE_NOCHECK);
961b9e67834SAndre Fischer 
962b9e67834SAndre Fischer                 if( mbFocusOnFontSizeCtrl )
963b9e67834SAndre Fischer                     return;
964b9e67834SAndre Fischer 
965b9e67834SAndre Fischer                 maFontSizeBox.SetValue( iValue );
966b9e67834SAndre Fischer                 maFontSizeBox.LoseFocus();
96745da7d5eSAndre Fischer 
96845da7d5eSAndre Fischer                 UpdateItem(SID_SHRINK_FONT_SIZE);
96945da7d5eSAndre Fischer                 UpdateItem(SID_GROW_FONT_SIZE);
970b9e67834SAndre Fischer             }
971b9e67834SAndre Fischer             else
972b9e67834SAndre Fischer             {
973b9e67834SAndre Fischer                 mpHeightItem = NULL;
974b9e67834SAndre Fischer                 maFontSizeBox.SetText( String() );
975b9e67834SAndre Fischer                 //increase decrease diabled when multi-seletion have different font size
976b9e67834SAndre Fischer 
977b9e67834SAndre Fischer                 // font size +/- enhancement in sd
97845da7d5eSAndre Fischer                 switch(maContext.GetCombinedContext_DI())
979b9e67834SAndre Fischer                 {
98045da7d5eSAndre Fischer                     case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
98145da7d5eSAndre Fischer                     case CombinedEnumContext(Application_DrawImpress, Context_Text):
98245da7d5eSAndre Fischer                     case CombinedEnumContext(Application_DrawImpress, Context_Table):
98345da7d5eSAndre Fischer                     case CombinedEnumContext(Application_DrawImpress, Context_OutlineText):
98445da7d5eSAndre Fischer                     case CombinedEnumContext(Application_DrawImpress, Context_Draw):
98545da7d5eSAndre Fischer                     case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
98645da7d5eSAndre Fischer                     case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
987b9e67834SAndre Fischer                         break;
988b9e67834SAndre Fischer 
989b9e67834SAndre Fischer                     default:
990b9e67834SAndre Fischer                         mpToolBoxIncDec->Disable();
991b9e67834SAndre Fischer                 }
992b9e67834SAndre Fischer                 if ( eState <= SFX_ITEM_READONLY )
99345da7d5eSAndre Fischer                     bIsControlEnabled = false;
994b9e67834SAndre Fischer             }
99545da7d5eSAndre Fischer             maFontSizeBox.Enable(bIsControlEnabled);
996b9e67834SAndre Fischer             break;
99745da7d5eSAndre Fischer         }
99845da7d5eSAndre Fischer 
999b9e67834SAndre Fischer         case SID_ATTR_CHAR_WEIGHT:
1000b9e67834SAndre Fischer             mbWeightAvailable = (eState >= SFX_ITEM_DONTCARE);
1001b9e67834SAndre Fischer             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxWeightItem))
1002b9e67834SAndre Fischer             {
1003b9e67834SAndre Fischer                 const SvxWeightItem* pItem = (const SvxWeightItem*)pState;
1004b9e67834SAndre Fischer                 meWeight = (FontWeight)pItem->GetValue();
1005b9e67834SAndre Fischer             }
1006b9e67834SAndre Fischer             else
1007b9e67834SAndre Fischer             {
1008b9e67834SAndre Fischer                 meWeight = WEIGHT_NORMAL;
1009b9e67834SAndre Fischer             }
101045da7d5eSAndre Fischer             mpToolBoxFont->EnableItem(TBI_BOLD, mbWeightAvailable && bIsEnabled);
101145da7d5eSAndre Fischer             mpToolBoxFont->SetItemState(TBI_BOLD, meWeight==WEIGHT_BOLD ? STATE_CHECK : STATE_NOCHECK);
1012b9e67834SAndre Fischer             break;
101345da7d5eSAndre Fischer 
1014b9e67834SAndre Fischer         case SID_ATTR_CHAR_POSTURE:
1015b9e67834SAndre Fischer             mbPostureAvailable = (eState >= SFX_ITEM_DONTCARE);
1016b9e67834SAndre Fischer             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxPostureItem))
1017b9e67834SAndre Fischer             {
1018b9e67834SAndre Fischer                 const SvxPostureItem* pItem = (const SvxPostureItem*)pState;
1019b9e67834SAndre Fischer                 meItalic = (FontItalic)pItem->GetValue();
1020b9e67834SAndre Fischer             }
1021b9e67834SAndre Fischer             else
1022b9e67834SAndre Fischer             {
1023b9e67834SAndre Fischer                 meItalic = ITALIC_NONE;
1024b9e67834SAndre Fischer             }
102545da7d5eSAndre Fischer             mpToolBoxFont->EnableItem(TBI_ITALIC, mbPostureAvailable && bIsEnabled);
102645da7d5eSAndre Fischer             mpToolBoxFont->SetItemState(TBI_ITALIC, meItalic==ITALIC_NORMAL ? STATE_CHECK : STATE_NOCHECK);
1027b9e67834SAndre Fischer             break;
102845da7d5eSAndre Fischer 
1029b9e67834SAndre Fischer         case SID_ATTR_CHAR_UNDERLINE:
103045da7d5eSAndre Fischer             if( eState >= SFX_ITEM_DEFAULT)
1031b9e67834SAndre Fischer             {
1032b9e67834SAndre Fischer                 if(pState->ISA(SvxUnderlineItem))
1033b9e67834SAndre Fischer                 {
1034b9e67834SAndre Fischer                     const SvxUnderlineItem* pItem = (const SvxUnderlineItem*)pState;
1035b9e67834SAndre Fischer                     meUnderline = (FontUnderline)pItem->GetValue();
1036b9e67834SAndre Fischer                     meUnderlineColor = pItem->GetColor();
1037b9e67834SAndre Fischer                 }
1038b9e67834SAndre Fischer             }
1039b9e67834SAndre Fischer             else
1040b9e67834SAndre Fischer             {
1041b9e67834SAndre Fischer                 meUnderline = UNDERLINE_NONE;
1042b9e67834SAndre Fischer             }
104345da7d5eSAndre Fischer             mpToolBoxFont->EnableItem(TBI_UNDERLINE, bIsEnabled);
104445da7d5eSAndre Fischer             mpToolBoxFont->SetItemState(TBI_UNDERLINE, meUnderline==UNDERLINE_NONE ? STATE_NOCHECK : STATE_CHECK);
1045b9e67834SAndre Fischer             break;
104645da7d5eSAndre Fischer 
1047b9e67834SAndre Fischer         case SID_ATTR_CHAR_SHADOWED:
1048b9e67834SAndre Fischer             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxShadowedItem))
1049b9e67834SAndre Fischer             {
1050b9e67834SAndre Fischer                 const SvxShadowedItem* pItem = (const SvxShadowedItem*)pState;
1051b9e67834SAndre Fischer                 mbShadow = pItem->GetValue();
1052b9e67834SAndre Fischer             }
1053b9e67834SAndre Fischer             else
1054b9e67834SAndre Fischer             {
1055b9e67834SAndre Fischer                 mbShadow = false;
1056b9e67834SAndre Fischer             }
105745da7d5eSAndre Fischer             mpToolBoxFont->EnableItem(TBI_SHADOWED, bIsEnabled);
105845da7d5eSAndre Fischer             mpToolBoxFont->SetItemState(TBI_SHADOWED, mbShadow ? STATE_CHECK : STATE_NOCHECK);
1059b9e67834SAndre Fischer             break;
106045da7d5eSAndre Fischer 
1061b9e67834SAndre Fischer         case SID_ATTR_CHAR_STRIKEOUT:
1062b9e67834SAndre Fischer             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxCrossedOutItem))
1063b9e67834SAndre Fischer             {
1064b9e67834SAndre Fischer                 const SvxCrossedOutItem* pItem = (const SvxCrossedOutItem*)pState;
1065b9e67834SAndre Fischer                 meStrike = (FontStrikeout)pItem->GetValue();
1066b9e67834SAndre Fischer             }
1067b9e67834SAndre Fischer             else
1068b9e67834SAndre Fischer             {
1069b9e67834SAndre Fischer                 meStrike = STRIKEOUT_NONE;
1070b9e67834SAndre Fischer             }
107145da7d5eSAndre Fischer             mpToolBoxFont->EnableItem(TBI_STRIKEOUT, bIsEnabled);
107245da7d5eSAndre Fischer             mpToolBoxFont->SetItemState(TBI_STRIKEOUT,
107345da7d5eSAndre Fischer                 meStrike!=STRIKEOUT_NONE && meStrike!=STRIKEOUT_DONTKNOW
107445da7d5eSAndre Fischer                     ? STATE_CHECK
107545da7d5eSAndre Fischer                     : STATE_NOCHECK);
1076b9e67834SAndre Fischer             break;
107745da7d5eSAndre Fischer 
1078b9e67834SAndre Fischer         case SID_ATTR_CHAR_COLOR:
1079b9e67834SAndre Fischer             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxColorItem))
1080b9e67834SAndre Fischer             {
1081d4aefcaeSZheng Fan                 const SvxColorItem* pItem =  (const SvxColorItem*)pState;
1082d4aefcaeSZheng Fan                 maColor = pItem->GetValue();
1083b9e67834SAndre Fischer                 mbColorAvailable = true;
108495a18594SAndre Fischer                 if (mpFontColorUpdater)
1085b9e67834SAndre Fischer                     mpFontColorUpdater->Update(maColor);
1086b9e67834SAndre Fischer             }
1087b9e67834SAndre Fischer             else
1088b9e67834SAndre Fischer             {
1089b9e67834SAndre Fischer                 mbColorAvailable = false;
1090b9e67834SAndre Fischer                 maColor.SetColor(COL_AUTO);
109195a18594SAndre Fischer                 if (mpFontColorUpdater)
1092b9e67834SAndre Fischer                     mpFontColorUpdater->Update(maColor);
1093b9e67834SAndre Fischer             }
109445da7d5eSAndre Fischer             mpToolBoxFontColor->EnableItem(TBI_FONTCOLOR, bIsEnabled);
1095b9e67834SAndre Fischer             break;
109645da7d5eSAndre Fischer 
1097b9e67834SAndre Fischer         case SID_ATTR_BRUSH_CHAR:
1098b9e67834SAndre Fischer             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxBrushItem))
1099b9e67834SAndre Fischer             {
1100b9e67834SAndre Fischer                 const SvxBrushItem* pItem =  (const SvxBrushItem*)pState;
1101b9e67834SAndre Fischer                 maBackColor = pItem->GetColor();
1102b9e67834SAndre Fischer                 mbBackColorAvailable = true;
11037a32b0c8SAndre Fischer                 if (mpHighlightUpdater)
1104b9e67834SAndre Fischer                     mpHighlightUpdater->Update(maBackColor);
1105b9e67834SAndre Fischer             }
1106b9e67834SAndre Fischer             else
1107b9e67834SAndre Fischer             {
1108b9e67834SAndre Fischer                 mbBackColorAvailable = false;
1109b9e67834SAndre Fischer                 maBackColor.SetColor(COL_AUTO);
11107a32b0c8SAndre Fischer                 if (mpHighlightUpdater)
1111b9e67834SAndre Fischer                     mpHighlightUpdater->Update(maBackColor);
1112b9e67834SAndre Fischer             }
111345da7d5eSAndre Fischer             mpToolBoxHighlight->EnableItem(TBI_HIGHLIGHT, bIsEnabled);
1114b9e67834SAndre Fischer             break;
111545da7d5eSAndre Fischer 
1116b9e67834SAndre Fischer         case SID_ATTR_CHAR_ESCAPEMENT:
111745da7d5eSAndre Fischer         {
111845da7d5eSAndre Fischer             bool bIsItemEnabled (true);
1119b9e67834SAndre Fischer             if (eState == SFX_ITEM_AVAILABLE)
1120b9e67834SAndre Fischer             {
1121b9e67834SAndre Fischer                 if (pState->ISA(SvxEscapementItem))
1122b9e67834SAndre Fischer                 {
1123b9e67834SAndre Fischer                     const SvxEscapementItem* pItem = (const SvxEscapementItem *)pState;
1124b9e67834SAndre Fischer                     short nEsc = pItem->GetEsc();
1125b9e67834SAndre Fischer                     if(nEsc == 0)
112645da7d5eSAndre Fischer                     {
1127b9e67834SAndre Fischer                         meEscape = SVX_ESCAPEMENT_OFF;
112845da7d5eSAndre Fischer                         mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_NOCHECK);
112945da7d5eSAndre Fischer                         mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_NOCHECK);
113045da7d5eSAndre Fischer                     }
1131b9e67834SAndre Fischer                     else if(nEsc > 0)
113245da7d5eSAndre Fischer                     {
1133b9e67834SAndre Fischer                         meEscape = SVX_ESCAPEMENT_SUPERSCRIPT;
113445da7d5eSAndre Fischer                         mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_CHECK);
113545da7d5eSAndre Fischer                         mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_NOCHECK);
113645da7d5eSAndre Fischer                     }
1137b9e67834SAndre Fischer                     else
113845da7d5eSAndre Fischer                     {
1139b9e67834SAndre Fischer                         meEscape = SVX_ESCAPEMENT_SUBSCRIPT;
114045da7d5eSAndre Fischer                         mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_NOCHECK);
114145da7d5eSAndre Fischer                         mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_CHECK);
114245da7d5eSAndre Fischer                     }
1143b9e67834SAndre Fischer                 }
1144b9e67834SAndre Fischer                 else
1145b9e67834SAndre 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);
1149b9e67834SAndre Fischer                 }
1150b9e67834SAndre Fischer             }
1151b9e67834SAndre Fischer             else if (eState == SFX_ITEM_DISABLED)
1152b9e67834SAndre Fischer             {
115345da7d5eSAndre Fischer                 bIsItemEnabled = false;
1154b9e67834SAndre Fischer             }
1155b9e67834SAndre Fischer             else
1156b9e67834SAndre Fischer             {
1157b9e67834SAndre Fischer                 meEscape = SVX_ESCAPEMENT_OFF;
1158b9e67834SAndre Fischer             }
115945da7d5eSAndre Fischer             mpToolBoxScriptSw->EnableItem(TBI_SUPER, bIsItemEnabled && bIsEnabled);
116045da7d5eSAndre Fischer             mpToolBoxScriptSw->EnableItem(TBI_SUB, bIsItemEnabled && bIsEnabled);
1161b9e67834SAndre Fischer             break;
116245da7d5eSAndre Fischer         }
116345da7d5eSAndre Fischer 
1164b9e67834SAndre Fischer         case SID_SET_SUB_SCRIPT:
1165b9e67834SAndre Fischer             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SfxBoolItem))
1166b9e67834SAndre Fischer             {
1167b9e67834SAndre Fischer                 const SfxBoolItem* pItem = (const SfxBoolItem*)pState;
1168b9e67834SAndre Fischer                 mbSub = pItem->GetValue();
1169b9e67834SAndre Fischer             }
1170b9e67834SAndre Fischer             else
1171b9e67834SAndre Fischer             {
1172b9e67834SAndre Fischer                 mbSub = false;
1173b9e67834SAndre Fischer             }
117445da7d5eSAndre Fischer             mpToolBoxScript->EnableItem(TBI_SUB, bIsEnabled);
117545da7d5eSAndre Fischer             mpToolBoxScript->SetItemState(TBI_SUB, mbSub ? STATE_CHECK : STATE_NOCHECK);
1176b9e67834SAndre Fischer             break;
117745da7d5eSAndre Fischer 
1178b9e67834SAndre Fischer         case SID_SET_SUPER_SCRIPT:
1179b9e67834SAndre Fischer             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SfxBoolItem))
1180b9e67834SAndre Fischer             {
1181b9e67834SAndre Fischer                 const SfxBoolItem* pItem = (const SfxBoolItem*)pState;
1182b9e67834SAndre Fischer                 mbSuper = pItem->GetValue();
1183b9e67834SAndre Fischer             }
1184b9e67834SAndre Fischer             else
1185b9e67834SAndre Fischer             {
1186b9e67834SAndre Fischer                 mbSuper = false;
1187b9e67834SAndre Fischer             }
118845da7d5eSAndre Fischer             mpToolBoxScript->EnableItem(TBI_SUPER, bIsEnabled);
118945da7d5eSAndre Fischer             mpToolBoxScript->SetItemState(TBI_SUPER, mbSuper ? STATE_CHECK : STATE_NOCHECK);
1190b9e67834SAndre Fischer             break;
119145da7d5eSAndre Fischer 
1192b9e67834SAndre Fischer         case SID_ATTR_CHAR_KERNING:
1193b9e67834SAndre Fischer             if ( SFX_ITEM_AVAILABLE == eState )
1194b9e67834SAndre Fischer             {
1195b9e67834SAndre Fischer                 mbKernLBAvailable = true;
1196b9e67834SAndre Fischer 
1197b9e67834SAndre Fischer                 if(pState->ISA(SvxKerningItem))
1198b9e67834SAndre Fischer                 {
1199b9e67834SAndre Fischer                     const SvxKerningItem* pKerningItem  = (const SvxKerningItem*)pState;
1200b9e67834SAndre Fischer                     mlKerning = (long)pKerningItem->GetValue();
1201b9e67834SAndre Fischer                     mbKernAvailable = true;
1202b9e67834SAndre Fischer                 }
1203b9e67834SAndre Fischer                 else
1204b9e67834SAndre Fischer                 {
1205b9e67834SAndre Fischer                     mlKerning = 0;
1206b9e67834SAndre Fischer                     mbKernAvailable =false;
1207b9e67834SAndre Fischer                 }
1208b9e67834SAndre Fischer             }
1209b9e67834SAndre Fischer             else if (SFX_ITEM_DISABLED == eState)
1210b9e67834SAndre Fischer             {
1211b9e67834SAndre Fischer                 mbKernLBAvailable = false;
1212b9e67834SAndre Fischer                 mbKernAvailable = false;
1213b9e67834SAndre Fischer                 mlKerning = 0;
1214b9e67834SAndre Fischer             }
1215b9e67834SAndre Fischer             else
1216b9e67834SAndre Fischer             {
1217b9e67834SAndre Fischer                 mbKernLBAvailable = true;
1218b9e67834SAndre Fischer                 mbKernAvailable = false;
1219b9e67834SAndre Fischer                 mlKerning = 0;
1220b9e67834SAndre Fischer             }
122145da7d5eSAndre Fischer             mpToolBoxSpacing->EnableItem(TBI_SPACING, bIsEnabled);
1222b9e67834SAndre Fischer             break;
1223b9e67834SAndre Fischer 
1224b9e67834SAndre Fischer             // font size +/- enhancement in sd
1225b9e67834SAndre Fischer         case SID_SHRINK_FONT_SIZE:
1226b9e67834SAndre Fischer         case SID_GROW_FONT_SIZE:
122745da7d5eSAndre Fischer             switch(maContext.GetCombinedContext_DI())
1228b9e67834SAndre Fischer             {
122945da7d5eSAndre Fischer                 case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
123045da7d5eSAndre Fischer                 case CombinedEnumContext(Application_DrawImpress, Context_Text):
123145da7d5eSAndre Fischer                 case CombinedEnumContext(Application_DrawImpress, Context_Table):
123245da7d5eSAndre Fischer                 case CombinedEnumContext(Application_DrawImpress, Context_OutlineText):
123345da7d5eSAndre Fischer                 case CombinedEnumContext(Application_DrawImpress, Context_Draw):
123445da7d5eSAndre Fischer                 case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
123545da7d5eSAndre Fischer                 case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
1236b9e67834SAndre Fischer                     if(eState == SFX_ITEM_DISABLED)
1237b9e67834SAndre Fischer                         mpToolBoxIncDec->Disable();
1238b9e67834SAndre Fischer                     else
1239b9e67834SAndre Fischer                         mpToolBoxIncDec->Enable();
1240b9e67834SAndre Fischer                 break;
1241b9e67834SAndre Fischer             }
124245da7d5eSAndre Fischer             const sal_Int32 nSize (maFontSizeBox.GetValue());
124345da7d5eSAndre Fischer             if (nSID == SID_GROW_FONT_SIZE)
124445da7d5eSAndre Fischer                 mpToolBoxIncDec->EnableItem(TBI_INCREASE, bIsEnabled && nSize<960);
124545da7d5eSAndre Fischer             else
124645da7d5eSAndre Fischer                 mpToolBoxIncDec->EnableItem(TBI_DECREASE, bIsEnabled && nSize>60);
1247b9e67834SAndre Fischer             break;
1248b9e67834SAndre Fischer     }
1249b9e67834SAndre Fischer }
1250b9e67834SAndre Fischer 
1251b9e67834SAndre Fischer 
1252b9e67834SAndre Fischer 
1253b9e67834SAndre Fischer 
125445da7d5eSAndre Fischer void TextPropertyPanel::UpdateItem (const sal_uInt16 nSlotId)
1255b9e67834SAndre Fischer {
125645da7d5eSAndre Fischer     switch (nSlotId)
125745da7d5eSAndre Fischer     {
125845da7d5eSAndre Fischer         case SID_ATTR_CHAR_FONT:
125945da7d5eSAndre Fischer             maFontNameControl.RequestUpdate();
126045da7d5eSAndre Fischer             break;
126145da7d5eSAndre Fischer         case SID_ATTR_CHAR_FONTHEIGHT:
126245da7d5eSAndre Fischer             maFontSizeControl.RequestUpdate();
126345da7d5eSAndre Fischer             break;
126445da7d5eSAndre Fischer         case SID_ATTR_CHAR_WEIGHT:
126545da7d5eSAndre Fischer             maWeightControl.RequestUpdate();
126645da7d5eSAndre Fischer             break;
126745da7d5eSAndre Fischer         case SID_ATTR_CHAR_POSTURE:
126845da7d5eSAndre Fischer             maItalicControl.RequestUpdate();
126945da7d5eSAndre Fischer             break;
127045da7d5eSAndre Fischer         case SID_ATTR_CHAR_UNDERLINE:
127145da7d5eSAndre Fischer             maUnderlineControl.RequestUpdate();
127245da7d5eSAndre Fischer             break;
127345da7d5eSAndre Fischer         case SID_ATTR_CHAR_STRIKEOUT:
127445da7d5eSAndre Fischer             maStrikeControl.RequestUpdate();
127545da7d5eSAndre Fischer             break;
127645da7d5eSAndre Fischer         case SID_ATTR_CHAR_SHADOWED:
127745da7d5eSAndre Fischer             maShadowControl.RequestUpdate();
127845da7d5eSAndre Fischer             break;
127945da7d5eSAndre Fischer         case SID_ATTR_CHAR_COLOR:
128045da7d5eSAndre Fischer             maFontColorControl.RequestUpdate();
128145da7d5eSAndre Fischer             break;
128245da7d5eSAndre Fischer         case SID_ATTR_CHAR_ESCAPEMENT:
128345da7d5eSAndre Fischer             maScriptControlSw.RequestUpdate();
128445da7d5eSAndre Fischer             break;
128545da7d5eSAndre Fischer         case SID_SET_SUPER_SCRIPT:
128645da7d5eSAndre Fischer             maSuperScriptControl.RequestUpdate();
128745da7d5eSAndre Fischer             break;
128845da7d5eSAndre Fischer         case SID_SET_SUB_SCRIPT:
128945da7d5eSAndre Fischer             maSubScriptControl.RequestUpdate();
129045da7d5eSAndre Fischer             break;
129145da7d5eSAndre Fischer         case SID_ATTR_CHAR_KERNING:
129245da7d5eSAndre Fischer             maSpacingControl.RequestUpdate();
129345da7d5eSAndre Fischer             break;
129445da7d5eSAndre Fischer         case SID_ATTR_BRUSH_CHAR:
129545da7d5eSAndre Fischer             maHighlightControl.RequestUpdate();
129645da7d5eSAndre Fischer             break;
129745da7d5eSAndre Fischer         case SID_GROW_FONT_SIZE:
129845da7d5eSAndre Fischer             maSDFontGrow.RequestUpdate();
129945da7d5eSAndre Fischer             break;
130045da7d5eSAndre Fischer         case SID_SHRINK_FONT_SIZE:
130145da7d5eSAndre Fischer             maSDFontShrink.RequestUpdate();
130245da7d5eSAndre Fischer             break;
130345da7d5eSAndre Fischer     }
1304b9e67834SAndre Fischer }
1305b9e67834SAndre Fischer 
1306b9e67834SAndre Fischer 
1307b9e67834SAndre Fischer 
1308b9e67834SAndre Fischer 
1309b9e67834SAndre Fischer 
1310d4aefcaeSZheng Fan void TextPropertyPanel::SetFontColor (
1311a7d1eb6fSPavel Janík     const String& /* rsColorName */,
1312d4aefcaeSZheng Fan     const Color aColor)
1313d4aefcaeSZheng Fan {
1314d4aefcaeSZheng Fan     SvxColorItem aColorItem(aColor, SID_ATTR_CHAR_COLOR);
1315d4aefcaeSZheng Fan     mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_COLOR, SFX_CALLMODE_RECORD, &aColorItem, 0L);
1316d4aefcaeSZheng Fan     maColor = aColor;
1317d4aefcaeSZheng Fan }
1318d4aefcaeSZheng Fan 
1319d4aefcaeSZheng Fan void TextPropertyPanel::SetBrushColor (
1320a7d1eb6fSPavel Janík     const String& /* rsColorName */,
1321d4aefcaeSZheng Fan     const Color aColor)
1322d4aefcaeSZheng Fan {
1323d4aefcaeSZheng Fan     SvxBrushItem aBrushItem(aColor, SID_ATTR_BRUSH_CHAR);
1324d4aefcaeSZheng Fan     mpBindings->GetDispatcher()->Execute(SID_ATTR_BRUSH_CHAR, SFX_CALLMODE_RECORD, &aBrushItem, 0L);
1325d4aefcaeSZheng Fan     maBackColor = aColor;
1326d4aefcaeSZheng Fan }
1327d4aefcaeSZheng Fan 
1328da72173fSAndre Fischer Color& TextPropertyPanel::GetUnderlineColor()
1329da72173fSAndre Fischer {
1330da72173fSAndre Fischer     return meUnderlineColor;
1331da72173fSAndre Fischer }
1332d4aefcaeSZheng Fan 
1333da72173fSAndre Fischer void TextPropertyPanel::SetUnderline(FontUnderline  eUnderline)
1334da72173fSAndre Fischer {
1335da72173fSAndre Fischer     meUnderline = eUnderline;
1336da72173fSAndre Fischer }
1337d4aefcaeSZheng Fan 
133845da7d5eSAndre Fischer 
133945da7d5eSAndre Fischer 
1340b9e67834SAndre Fischer } } // end of namespace svx::sidebar
1341