xref: /AOO42X/main/svx/source/sidebar/text/TextPropertyPanel.cxx (revision bc7f1831fa10457dc889bb38a14096cfe219057f)
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>
48*bc7f1831SAndre Fischer #include <sfx2/sidebar/PanelLayouter.hxx>
4995a18594SAndre Fischer #include "sfx2/imagemgr.hxx"
50b9e67834SAndre Fischer #include <svtools/ctrltool.hxx>
51b9e67834SAndre Fischer #include <svtools/unitconv.hxx>
52b9e67834SAndre Fischer 
53b9e67834SAndre Fischer #include <vcl/gradient.hxx>
54b9e67834SAndre Fischer #include <vcl/svapp.hxx>
5595a18594SAndre Fischer #include <vcl/toolbox.hxx>
56d4aefcaeSZheng Fan #include "TextCharacterSpacingControl.hxx"
57d4aefcaeSZheng Fan #include "TextCharacterSpacingPopup.hxx"
58d4aefcaeSZheng Fan #include "TextUnderlineControl.hxx"
59d4aefcaeSZheng Fan #include "TextUnderlinePopup.hxx"
60facb16e7SArmin Le Grand #include <svx/sidebar/ColorControl.hxx>
61facb16e7SArmin Le Grand #include <svx/sidebar/PopupContainer.hxx>
62d4aefcaeSZheng Fan 
63d4aefcaeSZheng Fan #include <boost/bind.hpp>
64b9e67834SAndre Fischer 
65b9e67834SAndre Fischer using namespace css;
66b9e67834SAndre Fischer using namespace cssu;
67b9e67834SAndre Fischer using ::sfx2::sidebar::Theme;
687a32b0c8SAndre Fischer using ::sfx2::sidebar::ControlFactory;
69b9e67834SAndre Fischer 
70b9e67834SAndre Fischer #define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
71b9e67834SAndre Fischer 
72b9e67834SAndre Fischer namespace svx { namespace sidebar {
73b9e67834SAndre Fischer 
74b9e67834SAndre Fischer #undef HAS_IA2
75b9e67834SAndre Fischer 
76b9e67834SAndre Fischer 
77d4aefcaeSZheng Fan 
78d4aefcaeSZheng Fan PopupControl* TextPropertyPanel::CreateCharacterSpacingControl (PopupContainer* pParent)
79d4aefcaeSZheng Fan {
8045da7d5eSAndre Fischer     return new TextCharacterSpacingControl(pParent, *this, mpBindings);
81d4aefcaeSZheng Fan }
82b9e67834SAndre Fischer 
83d4aefcaeSZheng Fan PopupControl* TextPropertyPanel::CreateUnderlinePopupControl (PopupContainer* pParent)
84d4aefcaeSZheng Fan {
8545da7d5eSAndre Fischer     return new TextUnderlineControl(pParent, *this, mpBindings);
86d4aefcaeSZheng Fan }
87b9e67834SAndre Fischer 
88b7a56e95SArmin Le Grand namespace
89b7a56e95SArmin Le Grand {
90b7a56e95SArmin Le Grand     Color GetAutomaticColor(void)
91b7a56e95SArmin Le Grand     {
92b7a56e95SArmin Le Grand         return COL_AUTO;
93b7a56e95SArmin Le Grand     }
94b7a56e95SArmin Le Grand } // end of anonymous namespace
95b7a56e95SArmin Le Grand 
96d4aefcaeSZheng Fan PopupControl* TextPropertyPanel::CreateFontColorPopupControl (PopupContainer* pParent)
97d4aefcaeSZheng Fan {
98b7a56e95SArmin Le Grand     const ResId aResId(SVX_RES(STR_AUTOMATICE));
99b7a56e95SArmin Le Grand 
100d4aefcaeSZheng Fan     return new ColorControl(
101d4aefcaeSZheng Fan         pParent,
102d4aefcaeSZheng Fan         mpBindings,
103d4aefcaeSZheng Fan         SVX_RES(RID_POPUPPANEL_TEXTPAGE_FONT_COLOR),
104d4aefcaeSZheng Fan         SVX_RES(VS_FONT_COLOR),
105b7a56e95SArmin Le Grand         ::boost::bind(GetAutomaticColor),
106d4aefcaeSZheng Fan         ::boost::bind(&TextPropertyPanel::SetFontColor, this, _1,_2),
107d4aefcaeSZheng Fan         pParent,
108b7a56e95SArmin Le Grand         &aResId);
109d4aefcaeSZheng Fan }
110b9e67834SAndre Fischer 
111d4aefcaeSZheng Fan PopupControl* TextPropertyPanel::CreateBrushColorPopupControl (PopupContainer* pParent)
112d4aefcaeSZheng Fan {
113b7a56e95SArmin Le Grand     const ResId aResId(SVX_RES(STR_AUTOMATICE));
114b7a56e95SArmin Le Grand 
115d4aefcaeSZheng Fan     return new ColorControl(
116d4aefcaeSZheng Fan         pParent,
117d4aefcaeSZheng Fan         mpBindings,
118d4aefcaeSZheng Fan         SVX_RES(RID_POPUPPANEL_TEXTPAGE_FONT_COLOR),
119d4aefcaeSZheng Fan         SVX_RES(VS_FONT_COLOR),
120b7a56e95SArmin Le Grand         ::boost::bind(GetAutomaticColor),
121d4aefcaeSZheng Fan         ::boost::bind(&TextPropertyPanel::SetBrushColor, this, _1,_2),
122d4aefcaeSZheng Fan         pParent,
123b7a56e95SArmin Le Grand         &aResId);
124d4aefcaeSZheng Fan }
125d4aefcaeSZheng Fan 
126d4aefcaeSZheng Fan long TextPropertyPanel::GetSelFontSize()
127d4aefcaeSZheng Fan {
128d4aefcaeSZheng Fan     long nH = 240;
129d4aefcaeSZheng Fan     SfxMapUnit eUnit = maSpacingControl.GetCoreMetric();
130d4aefcaeSZheng Fan     if (mpHeightItem)
131d4aefcaeSZheng Fan         nH = LogicToLogic(  mpHeightItem->GetHeight(), (MapUnit)eUnit, MAP_TWIP );
132d4aefcaeSZheng Fan     return nH;
133d4aefcaeSZheng Fan }
134b9e67834SAndre Fischer 
135b9e67834SAndre Fischer 
13695a18594SAndre Fischer TextPropertyPanel* TextPropertyPanel::Create (
137b9e67834SAndre Fischer     Window* pParent,
138b9e67834SAndre Fischer     const cssu::Reference<css::frame::XFrame>& rxFrame,
139f79579d2SAndre Fischer     SfxBindings* pBindings)
140b9e67834SAndre Fischer {
141b9e67834SAndre Fischer     if (pParent == NULL)
142b9e67834SAndre Fischer         throw lang::IllegalArgumentException(A2S("no parent Window given to TextPropertyPanel::Create"), NULL, 0);
143b9e67834SAndre Fischer     if ( ! rxFrame.is())
144b9e67834SAndre Fischer         throw lang::IllegalArgumentException(A2S("no XFrame given to TextPropertyPanel::Create"), NULL, 1);
145b9e67834SAndre Fischer     if (pBindings == NULL)
146b9e67834SAndre Fischer         throw lang::IllegalArgumentException(A2S("no SfxBindings given to TextPropertyPanel::Create"), NULL, 2);
147b9e67834SAndre Fischer 
14895a18594SAndre Fischer     return new TextPropertyPanel(
149b9e67834SAndre Fischer         pParent,
150b9e67834SAndre Fischer         rxFrame,
151f79579d2SAndre Fischer         pBindings);
152b9e67834SAndre Fischer }
153b9e67834SAndre Fischer 
154b9e67834SAndre Fischer 
155d4aefcaeSZheng Fan ::sfx2::sidebar::ControllerItem& TextPropertyPanel::GetSpaceController()
156d4aefcaeSZheng Fan {
157d4aefcaeSZheng Fan     return maSpacingControl;
158d4aefcaeSZheng Fan }
159b9e67834SAndre Fischer 
160b9e67834SAndre Fischer TextPropertyPanel::TextPropertyPanel (
161b9e67834SAndre Fischer     Window* pParent,
162b9e67834SAndre Fischer     const cssu::Reference<css::frame::XFrame>& rxFrame,
163f79579d2SAndre Fischer     SfxBindings* pBindings)
16495a18594SAndre Fischer     :   Control(pParent, SVX_RES(RID_SIDEBAR_TEXT_PANEL)),
165b9e67834SAndre Fischer         mpFontNameBox (new SvxSBFontNameBox(this, SVX_RES(CB_SBFONT_FONT))),
166b9e67834SAndre Fischer         maFontSizeBox       (this, SVX_RES(MB_SBFONT_FONTSIZE)),
1677a32b0c8SAndre Fischer         mpToolBoxFontBackground(ControlFactory::CreateToolBoxBackground(this)),
1687a32b0c8SAndre Fischer         mpToolBoxFont(ControlFactory::CreateToolBox(
1697a32b0c8SAndre Fischer                 mpToolBoxFontBackground.get(),
1707a32b0c8SAndre Fischer                 SVX_RES(TB_FONT))),
17152d13b84SAndre Fischer         mpToolBoxIncDecBackground(ControlFactory::CreateToolBoxBackground(this)),
17252d13b84SAndre Fischer         mpToolBoxIncDec(ControlFactory::CreateToolBox(
17352d13b84SAndre Fischer                 mpToolBoxIncDecBackground.get(),
17452d13b84SAndre Fischer                 SVX_RES(TB_INCREASE_DECREASE))),
1757a32b0c8SAndre Fischer         mpToolBoxScriptBackground(ControlFactory::CreateToolBoxBackground(this)),
1767a32b0c8SAndre Fischer         mpToolBoxScript(ControlFactory::CreateToolBox(
1777a32b0c8SAndre Fischer                 mpToolBoxScriptBackground.get(),
1787a32b0c8SAndre Fischer                 SVX_RES(TB_SCRIPT))),
1797a32b0c8SAndre Fischer         mpToolBoxScriptSwBackground(ControlFactory::CreateToolBoxBackground(this)),
1807a32b0c8SAndre Fischer         mpToolBoxScriptSw(ControlFactory::CreateToolBox(
1817a32b0c8SAndre Fischer                 mpToolBoxScriptSwBackground.get(),
1827a32b0c8SAndre Fischer                 SVX_RES(TB_SCRIPT_SW))),
1837a32b0c8SAndre Fischer         mpToolBoxSpacingBackground(ControlFactory::CreateToolBoxBackground(this)),
1847a32b0c8SAndre Fischer         mpToolBoxSpacing(ControlFactory::CreateToolBox(
1857a32b0c8SAndre Fischer                 mpToolBoxSpacingBackground.get(),
1867a32b0c8SAndre Fischer                 SVX_RES(TB_SPACING))),
18752d13b84SAndre Fischer         mpToolBoxFontColorBackground(ControlFactory::CreateToolBoxBackground(this)),
18852d13b84SAndre Fischer         mpToolBoxFontColor(ControlFactory::CreateToolBox(
18952d13b84SAndre Fischer                 mpToolBoxFontColorBackground.get(),
19052d13b84SAndre Fischer                 SVX_RES(TB_FONTCOLOR))),
1917a32b0c8SAndre Fischer         mpToolBoxHighlightBackground(ControlFactory::CreateToolBoxBackground(this)),
1927a32b0c8SAndre Fischer         mpToolBoxHighlight(ControlFactory::CreateToolBox(
1937a32b0c8SAndre Fischer                 mpToolBoxHighlightBackground.get(),
1947a32b0c8SAndre Fischer                 SVX_RES(TB_HIGHLIGHT))),
195b9e67834SAndre Fischer         mpFontColorUpdater(),
196b9e67834SAndre Fischer         mpHighlightUpdater(),
197b9e67834SAndre Fischer 
19845da7d5eSAndre Fischer         maFontNameControl   (SID_ATTR_CHAR_FONT,        *pBindings, *this, A2S("CharFontName"), rxFrame),
19945da7d5eSAndre Fischer         maFontSizeControl   (SID_ATTR_CHAR_FONTHEIGHT,  *pBindings, *this, A2S("FontHeight"),   rxFrame),
20045da7d5eSAndre Fischer         maWeightControl     (SID_ATTR_CHAR_WEIGHT,      *pBindings, *this, A2S("Bold"),         rxFrame),
20145da7d5eSAndre Fischer         maItalicControl     (SID_ATTR_CHAR_POSTURE,     *pBindings, *this, A2S("Italic"),       rxFrame),
20245da7d5eSAndre Fischer         maUnderlineControl  (SID_ATTR_CHAR_UNDERLINE,   *pBindings, *this, A2S("Underline"),    rxFrame),
20345da7d5eSAndre Fischer         maStrikeControl     (SID_ATTR_CHAR_STRIKEOUT,   *pBindings, *this, A2S("Strikeout"),    rxFrame),
20445da7d5eSAndre Fischer         maShadowControl     (SID_ATTR_CHAR_SHADOWED,    *pBindings, *this, A2S("Shadowed"),     rxFrame),
20545da7d5eSAndre Fischer         maFontColorControl  (SID_ATTR_CHAR_COLOR,       *pBindings, *this, A2S("Color"),        rxFrame),
20645da7d5eSAndre Fischer         maScriptControlSw   (SID_ATTR_CHAR_ESCAPEMENT,  *pBindings, *this, A2S("Escapement"),   rxFrame),
20745da7d5eSAndre Fischer         maSuperScriptControl(SID_SET_SUPER_SCRIPT,      *pBindings, *this, A2S("SuperScript"),  rxFrame),
20845da7d5eSAndre Fischer         maSubScriptControl  (SID_SET_SUB_SCRIPT,        *pBindings, *this, A2S("SubScript"),    rxFrame),
20945da7d5eSAndre Fischer         maSpacingControl    (SID_ATTR_CHAR_KERNING,     *pBindings, *this, A2S("Spacing"),      rxFrame),
21045da7d5eSAndre Fischer         maHighlightControl  (SID_ATTR_BRUSH_CHAR, *pBindings, *this, A2S("CharacterBackgroundPattern"),rxFrame),
21145da7d5eSAndre Fischer         maSDFontGrow        (SID_GROW_FONT_SIZE,        *pBindings, *this, A2S("Grow"),         rxFrame),
21245da7d5eSAndre Fischer         maSDFontShrink      (SID_SHRINK_FONT_SIZE,      *pBindings, *this, A2S("Shrink"),       rxFrame),
213b9e67834SAndre Fischer 
214b9e67834SAndre Fischer         mpFontList          (NULL),
215b9e67834SAndre Fischer         mbMustDelete        (false),
216b9e67834SAndre Fischer         mbFocusOnFontSizeCtrl(false),
217a7d1eb6fSPavel Janík         maCharSpacePopup(this, ::boost::bind(&TextPropertyPanel::CreateCharacterSpacingControl, this, _1)),
218a7d1eb6fSPavel Janík         maUnderlinePopup(this, ::boost::bind(&TextPropertyPanel::CreateUnderlinePopupControl, this, _1)),
219a7d1eb6fSPavel Janík         maFontColorPopup(this, ::boost::bind(&TextPropertyPanel::CreateFontColorPopupControl, this, _1)),
220a7d1eb6fSPavel Janík         maBrushColorPopup(this, ::boost::bind(&TextPropertyPanel::CreateBrushColorPopupControl, this, _1)),
22195a18594SAndre Fischer         mxFrame(rxFrame),
222b9e67834SAndre Fischer         maContext(),
223f79579d2SAndre Fischer         mpBindings(pBindings)
224b9e67834SAndre Fischer {
225b9e67834SAndre Fischer     Initialize();
226b9e67834SAndre Fischer     FreeResource();
227b9e67834SAndre Fischer }
228b9e67834SAndre Fischer 
229b9e67834SAndre Fischer 
230b9e67834SAndre Fischer 
231b9e67834SAndre Fischer 
232b9e67834SAndre Fischer TextPropertyPanel::~TextPropertyPanel (void)
233b9e67834SAndre Fischer {
234b9e67834SAndre Fischer     if(mbMustDelete)
235b9e67834SAndre Fischer         delete mpFontList;
236b9e67834SAndre Fischer 
2377a32b0c8SAndre Fischer     // Destroy the toolbox windows.
2387a32b0c8SAndre Fischer     mpToolBoxIncDec.reset();
2397a32b0c8SAndre Fischer     mpToolBoxFont.reset();
2407a32b0c8SAndre Fischer     mpToolBoxFontColor.reset();
2417a32b0c8SAndre Fischer     mpToolBoxScript.reset();
2427a32b0c8SAndre Fischer     mpToolBoxScriptSw.reset();
2437a32b0c8SAndre Fischer     mpToolBoxSpacing.reset();
2447a32b0c8SAndre Fischer     mpToolBoxHighlight.reset();
2457a32b0c8SAndre Fischer 
2467a32b0c8SAndre Fischer     // Destroy the background windows of the toolboxes.
2477a32b0c8SAndre Fischer     mpToolBoxIncDecBackground.reset();
2487a32b0c8SAndre Fischer     mpToolBoxFontBackground.reset();
2497a32b0c8SAndre Fischer     mpToolBoxFontColorBackground.reset();
2507a32b0c8SAndre Fischer     mpToolBoxScriptBackground.reset();
2517a32b0c8SAndre Fischer     mpToolBoxScriptSwBackground.reset();
2527a32b0c8SAndre Fischer     mpToolBoxSpacingBackground.reset();
2537a32b0c8SAndre Fischer     mpToolBoxHighlightBackground.reset();
254b9e67834SAndre Fischer }
255b9e67834SAndre Fischer 
256b9e67834SAndre Fischer 
257b9e67834SAndre Fischer 
258b9e67834SAndre Fischer 
259d4aefcaeSZheng Fan void TextPropertyPanel::SetSpacing(long nKern)
260d4aefcaeSZheng Fan {
261d4aefcaeSZheng Fan     mlKerning = nKern;
262d4aefcaeSZheng Fan }
26395a18594SAndre Fischer 
26495a18594SAndre Fischer 
265b9e67834SAndre Fischer void TextPropertyPanel::HandleContextChange (
266b9e67834SAndre Fischer     const ::sfx2::sidebar::EnumContext aContext)
267b9e67834SAndre Fischer {
268b9e67834SAndre Fischer     if (maContext == aContext)
269b9e67834SAndre Fischer     {
270b9e67834SAndre Fischer         // Nothing to do.
271b9e67834SAndre Fischer         return;
272b9e67834SAndre Fischer     }
273b9e67834SAndre Fischer 
274b9e67834SAndre Fischer     maContext = aContext;
27565be1ea2SAndre Fischer     switch (maContext.GetCombinedContext_DI())
276b9e67834SAndre Fischer     {
277b9e67834SAndre Fischer         case CombinedEnumContext(Application_Calc, Context_Cell):
278b9e67834SAndre Fischer         case CombinedEnumContext(Application_Calc, Context_Pivot):
279b9e67834SAndre Fischer             mpToolBoxScriptSw->Hide();
280b9e67834SAndre Fischer             mpToolBoxHighlight->Hide();
281f79579d2SAndre Fischer             mpToolBoxScript->Disable();
282f79579d2SAndre Fischer             mpToolBoxSpacing->Disable();
283b9e67834SAndre Fischer             break;
284f79579d2SAndre Fischer 
285f79579d2SAndre Fischer         case CombinedEnumContext(Application_Calc, Context_EditCell):
286f79579d2SAndre Fischer         case CombinedEnumContext(Application_Calc, Context_DrawText):
287f79579d2SAndre Fischer             mpToolBoxScriptSw->Hide();
288f79579d2SAndre Fischer             mpToolBoxHighlight->Hide();
289f79579d2SAndre Fischer             mpToolBoxScript->Enable();
290f79579d2SAndre Fischer             mpToolBoxSpacing->Enable();
291f79579d2SAndre Fischer             break;
292b9e67834SAndre Fischer 
29385f1aca2SAndre Fischer         case CombinedEnumContext(Application_WriterVariants, Context_Text):
29485f1aca2SAndre Fischer         case CombinedEnumContext(Application_WriterVariants, Context_Table):
295b9e67834SAndre Fischer             mpToolBoxScriptSw->Show();
296b9e67834SAndre Fischer             mpToolBoxScript->Hide();
297b9e67834SAndre Fischer             mpToolBoxHighlight->Show();
298b9e67834SAndre Fischer             mpToolBoxSpacing->Show();
299b9e67834SAndre Fischer             break;
300b9e67834SAndre Fischer 
30185f1aca2SAndre Fischer         case CombinedEnumContext(Application_WriterVariants, Context_DrawText):
30285f1aca2SAndre Fischer         case CombinedEnumContext(Application_WriterVariants, Context_Annotation):
303b9e67834SAndre Fischer             mpToolBoxScriptSw->Show();
304b9e67834SAndre Fischer             mpToolBoxScript->Hide();
305b9e67834SAndre Fischer             mpToolBoxSpacing->Show();
306b9e67834SAndre Fischer             mpToolBoxHighlight->Hide();
307b9e67834SAndre Fischer             break;
308b9e67834SAndre Fischer 
30937fee4fdSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
31037fee4fdSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_Text):
31137fee4fdSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_Table):
31237fee4fdSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_OutlineText):
31337fee4fdSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_Draw):
31437fee4fdSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
31537fee4fdSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
316b9e67834SAndre Fischer             mpToolBoxScriptSw->Hide();
317b9e67834SAndre Fischer             mpToolBoxScript->Show();
318b9e67834SAndre Fischer             mpToolBoxSpacing->Show();
319b9e67834SAndre Fischer             mpToolBoxHighlight->Hide();
320b9e67834SAndre Fischer             break;
321b9e67834SAndre Fischer 
322b9e67834SAndre Fischer         default:
323b9e67834SAndre Fischer             break;
324b9e67834SAndre Fischer     }
325b9e67834SAndre Fischer }
326b9e67834SAndre Fischer 
32745da7d5eSAndre Fischer 
328b9e67834SAndre Fischer 
329b9e67834SAndre Fischer 
330b9e67834SAndre Fischer void TextPropertyPanel::DataChanged (const DataChangedEvent& rEvent)
331b9e67834SAndre Fischer {
33295a18594SAndre Fischer     (void)rEvent;
33395a18594SAndre Fischer 
33445da7d5eSAndre Fischer     SetupToolboxItems();
335b9e67834SAndre Fischer }
336b9e67834SAndre Fischer 
337b9e67834SAndre Fischer 
338b9e67834SAndre Fischer 
339*bc7f1831SAndre Fischer 
340b9e67834SAndre Fischer void TextPropertyPanel::Initialize (void)
341b9e67834SAndre Fischer {
342b9e67834SAndre Fischer     //<<modify fill font list
343b9e67834SAndre Fischer     SfxObjectShell* pDocSh = SfxObjectShell::Current();
344b9e67834SAndre Fischer     const SfxPoolItem* pItem = NULL;
345b9e67834SAndre Fischer 
346b9e67834SAndre Fischer     if (pDocSh != NULL)
347b9e67834SAndre Fischer         pItem = pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST );
348b9e67834SAndre Fischer     if (pItem != NULL)
349b9e67834SAndre Fischer         mpFontList = ( (SvxFontListItem*)pItem )->GetFontList();
350b9e67834SAndre Fischer     else
351b9e67834SAndre Fischer     {
352b9e67834SAndre Fischer         mpFontList = new FontList( Application::GetDefaultDevice() );
35345da7d5eSAndre Fischer         mbMustDelete = true;
354b9e67834SAndre Fischer     }
355b9e67834SAndre Fischer 
356b9e67834SAndre Fischer     mpFontNameBox->SetAccessibleName(mpFontNameBox->GetQuickHelpText());
35795a18594SAndre Fischer     const FontInfo aFontInfo (mpFontList->Get( String::CreateFromAscii( "" ), String::CreateFromAscii( "" )));
35895a18594SAndre Fischer     maFontSizeBox.Fill(&aFontInfo,mpFontList);
359b9e67834SAndre Fischer     maFontSizeBox.SetAccessibleName(maFontSizeBox.GetQuickHelpText());
360b9e67834SAndre Fischer 
361b9e67834SAndre Fischer     //toolbox
36245da7d5eSAndre Fischer     SetupToolboxItems();
363b9e67834SAndre Fischer     InitToolBoxIncDec();
364b9e67834SAndre Fischer     InitToolBoxFont();
365b9e67834SAndre Fischer     InitToolBoxFontColor();
366b9e67834SAndre Fischer     InitToolBoxScript();
367b9e67834SAndre Fischer     InitToolBoxSpacing();
368b9e67834SAndre Fischer     InitToolBoxHighlight();
369b9e67834SAndre Fischer 
370b9e67834SAndre Fischer #ifdef HAS_IA2
371d4aefcaeSZheng Fan     mpFontNameBox->SetAccRelationLabeledBy(&mpFontNameBox);
372d4aefcaeSZheng Fan     mpFontNameBox->SetMpSubEditAccLableBy(&mpFontNameBox);
373b9e67834SAndre Fischer     maFontSizeBox.SetAccRelationLabeledBy(&maFontSizeBox);
374b9e67834SAndre Fischer     maFontSizeBox.SetMpSubEditAccLableBy(&maFontSizeBox);
375d4aefcaeSZheng Fan     mpToolBoxFont.SetAccRelationLabeledBy(&mpToolBoxFont);
376d4aefcaeSZheng Fan     mpToolBoxIncDec.SetAccRelationLabeledBy(&mpToolBoxIncDec);
377d4aefcaeSZheng Fan     mpToolBoxFontColor.SetAccRelationLabeledBy(&mpToolBoxFontColor);
378d4aefcaeSZheng Fan     mpToolBoxScript.SetAccRelationLabeledBy(&mpToolBoxScript);
379d4aefcaeSZheng Fan     mpToolBoxScriptSw.SetAccRelationLabeledBy(&mpToolBoxScriptSw);
380d4aefcaeSZheng Fan     mpToolBoxSpacing.SetAccRelationLabeledBy(&mpToolBoxSpacing);
381d4aefcaeSZheng Fan     mpToolBoxHighlight.SetAccRelationLabeledBy(&mpToolBoxHighlight);
382b9e67834SAndre Fischer #endif
383b9e67834SAndre Fischer 
384b9e67834SAndre Fischer     //init state
385b9e67834SAndre Fischer     mpHeightItem = NULL;
386b9e67834SAndre Fischer     meWeight = WEIGHT_NORMAL;
387b9e67834SAndre Fischer     meItalic = ITALIC_NONE;
388b9e67834SAndre Fischer     mbShadow = false;
389b9e67834SAndre Fischer     meStrike = STRIKEOUT_NONE;
390b9e67834SAndre Fischer     mbPostureAvailable = true;
391b9e67834SAndre Fischer     mbWeightAvailable = true;
392b9e67834SAndre Fischer     meUnderline = UNDERLINE_NONE;
393b9e67834SAndre Fischer     meUnderlineColor = COL_AUTO;   //
394b9e67834SAndre Fischer     maColor = COL_BLACK;
395b9e67834SAndre Fischer     mbColorAvailable = true;
396b9e67834SAndre Fischer     maBackColor = COL_AUTO;
397b9e67834SAndre Fischer     mbBackColorAvailable = true;
398b9e67834SAndre Fischer     meEscape = SVX_ESCAPEMENT_OFF;
399b9e67834SAndre Fischer     mbSuper = false;
400b9e67834SAndre Fischer     mbSub = false;
401b9e67834SAndre Fischer     mbKernAvailable = true;
402b9e67834SAndre Fischer     mbKernLBAvailable = true;
403b9e67834SAndre Fischer     mlKerning = 0;
404b9e67834SAndre Fischer     mpFontColorUpdater.reset(new ToolboxButtonColorUpdater(
405b9e67834SAndre Fischer             SID_ATTR_CHAR_COLOR,
406b9e67834SAndre Fischer             TBI_FONTCOLOR,
407b9e67834SAndre Fischer             mpToolBoxFontColor.get(),
408b9e67834SAndre Fischer             TBX_UPDATER_MODE_CHAR_COLOR_NEW));
409b9e67834SAndre Fischer     mpHighlightUpdater.reset(new ToolboxButtonColorUpdater(
410b9e67834SAndre Fischer             SID_ATTR_BRUSH_CHAR,
411b9e67834SAndre Fischer             TBI_HIGHLIGHT,
412b9e67834SAndre Fischer             mpToolBoxHighlight.get(),
413b9e67834SAndre Fischer             TBX_UPDATER_MODE_CHAR_COLOR_NEW));
414b9e67834SAndre Fischer 
415b9e67834SAndre Fischer     //set handler
416b9e67834SAndre Fischer     mpFontNameBox->SetBindings(mpBindings);
417b9e67834SAndre Fischer     Link aLink = LINK(this, TextPropertyPanel, FontSelHdl);
418b9e67834SAndre Fischer     mpFontNameBox->SetSelectHdl(aLink);
419b9e67834SAndre Fischer     aLink = LINK(this, TextPropertyPanel, FontSizeModifyHdl);
420b9e67834SAndre Fischer     maFontSizeBox.SetModifyHdl(aLink);
421b9e67834SAndre Fischer     aLink = LINK(this, TextPropertyPanel, FontSizeSelHdl);
422b9e67834SAndre Fischer     maFontSizeBox.SetSelectHdl(aLink);
423b9e67834SAndre Fischer     aLink = LINK(this, TextPropertyPanel, FontSizeLoseFocus);
424b9e67834SAndre Fischer     maFontSizeBox.SetLoseFocusHdl(aLink);
425b9e67834SAndre Fischer }
426b9e67834SAndre Fischer 
427d4aefcaeSZheng Fan void TextPropertyPanel::EndSpacingPopupMode (void)
428d4aefcaeSZheng Fan {
429d4aefcaeSZheng Fan     maCharSpacePopup.Hide();
430d4aefcaeSZheng Fan }
431b9e67834SAndre Fischer 
432d4aefcaeSZheng Fan void TextPropertyPanel::EndUnderlinePopupMode (void)
433d4aefcaeSZheng Fan {
434d4aefcaeSZheng Fan     maUnderlinePopup.Hide();
435d4aefcaeSZheng Fan }
436b9e67834SAndre Fischer 
437b9e67834SAndre Fischer 
438b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxFont()
439b9e67834SAndre Fischer {
440b9e67834SAndre Fischer     mpToolBoxFont->SetBackground(Wallpaper());
441b9e67834SAndre Fischer     mpToolBoxFont->SetPaintTransparent(true);
442b9e67834SAndre Fischer 
443b9e67834SAndre Fischer     Size aTbxSize( mpToolBoxFont->CalcWindowSizePixel() );
444b9e67834SAndre Fischer     mpToolBoxFont->SetOutputSizePixel( aTbxSize );
445b9e67834SAndre Fischer 
446b9e67834SAndre Fischer     Link aLink  = LINK(this, TextPropertyPanel, ToolboxFontSelectHandler);
447b9e67834SAndre Fischer     mpToolBoxFont->SetSelectHdl ( aLink );
448b9e67834SAndre Fischer     aLink = LINK(this, TextPropertyPanel, ToolBoxUnderlineClickHdl);
449b9e67834SAndre Fischer     mpToolBoxFont->SetDropdownClickHdl(aLink);
450b9e67834SAndre Fischer }
451b9e67834SAndre Fischer 
452b9e67834SAndre Fischer 
453b9e67834SAndre Fischer 
454b9e67834SAndre Fischer 
455b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxIncDec()
456b9e67834SAndre Fischer {
457b9e67834SAndre Fischer     Size aTbxSize( mpToolBoxIncDec->CalcWindowSizePixel() );
458b9e67834SAndre Fischer     mpToolBoxIncDec->SetOutputSizePixel( aTbxSize );
459b9e67834SAndre Fischer 
460b9e67834SAndre Fischer     Link aLink = LINK(this, TextPropertyPanel, ToolboxIncDecSelectHdl);
461b9e67834SAndre Fischer     mpToolBoxIncDec->SetSelectHdl ( aLink );
462b9e67834SAndre Fischer }
463b9e67834SAndre Fischer 
464b9e67834SAndre Fischer 
465b9e67834SAndre Fischer 
466b9e67834SAndre Fischer 
467b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxFontColor()
468b9e67834SAndre Fischer {
469b9e67834SAndre Fischer     Size aTbxSize( mpToolBoxFontColor->CalcWindowSizePixel() );
470b9e67834SAndre Fischer     mpToolBoxFontColor->SetOutputSizePixel( aTbxSize );
471b9e67834SAndre Fischer     mpToolBoxFontColor->SetItemBits( TBI_FONTCOLOR, mpToolBoxFontColor->GetItemBits( TBI_FONTCOLOR ) | TIB_DROPDOWNONLY );
472b9e67834SAndre Fischer 
473b9e67834SAndre Fischer     Link aLink = LINK(this, TextPropertyPanel, ToolBoxFontColorDropHdl);
474b9e67834SAndre Fischer     mpToolBoxFontColor->SetDropdownClickHdl ( aLink );
475b9e67834SAndre Fischer     mpToolBoxFontColor->SetSelectHdl ( aLink );
476b9e67834SAndre Fischer 
477b9e67834SAndre Fischer }
478b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxScript()
479b9e67834SAndre Fischer {
480b9e67834SAndre Fischer     Size aTbxSize( mpToolBoxScriptSw->CalcWindowSizePixel() );
481b9e67834SAndre Fischer     mpToolBoxScriptSw->SetOutputSizePixel( aTbxSize );
482b9e67834SAndre Fischer 
483b9e67834SAndre Fischer     Link aLink = LINK(this, TextPropertyPanel, ToolBoxSwScriptSelectHdl);
484b9e67834SAndre Fischer     mpToolBoxScriptSw->SetSelectHdl ( aLink );
485b9e67834SAndre Fischer 
486b9e67834SAndre Fischer     aTbxSize = mpToolBoxScript->CalcWindowSizePixel() ;
487b9e67834SAndre Fischer     mpToolBoxScript->SetOutputSizePixel( aTbxSize );
488b9e67834SAndre Fischer 
489b9e67834SAndre Fischer     aLink = LINK(this, TextPropertyPanel, ToolBoxScriptSelectHdl);
490b9e67834SAndre Fischer     mpToolBoxScript->SetSelectHdl ( aLink );
491b9e67834SAndre Fischer }
492b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxSpacing()
493b9e67834SAndre Fischer {
494b9e67834SAndre Fischer     Size aTbxSize( mpToolBoxSpacing->CalcWindowSizePixel() );
495b9e67834SAndre Fischer     mpToolBoxSpacing->SetOutputSizePixel( aTbxSize );
496b9e67834SAndre Fischer     mpToolBoxSpacing->SetItemBits( TBI_SPACING, mpToolBoxSpacing->GetItemBits( TBI_SPACING ) | TIB_DROPDOWNONLY );
497b9e67834SAndre Fischer 
498b9e67834SAndre Fischer     Link aLink = LINK(this, TextPropertyPanel, SpacingClickHdl);
499b9e67834SAndre Fischer     mpToolBoxSpacing->SetDropdownClickHdl ( aLink );
500b9e67834SAndre Fischer     mpToolBoxSpacing->SetSelectHdl( aLink );
501b9e67834SAndre Fischer }
502b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxHighlight()
503b9e67834SAndre Fischer {
504b9e67834SAndre Fischer     Size aTbxSize( mpToolBoxHighlight->CalcWindowSizePixel() );
505b9e67834SAndre Fischer     mpToolBoxHighlight->SetOutputSizePixel( aTbxSize );
506b9e67834SAndre Fischer     mpToolBoxHighlight->SetItemBits( TBI_HIGHLIGHT, mpToolBoxHighlight->GetItemBits( TBI_HIGHLIGHT ) | TIB_DROPDOWNONLY );
507b9e67834SAndre Fischer 
508b9e67834SAndre Fischer     Link aLink = LINK(this, TextPropertyPanel, ToolBoxHighlightDropHdl);
509b9e67834SAndre Fischer     mpToolBoxHighlight->SetDropdownClickHdl ( aLink );
510b9e67834SAndre Fischer     mpToolBoxHighlight->SetSelectHdl( aLink );
511b9e67834SAndre Fischer }
512b9e67834SAndre Fischer 
513b9e67834SAndre Fischer 
514b9e67834SAndre Fischer 
515b9e67834SAndre Fischer 
51645da7d5eSAndre Fischer void TextPropertyPanel::SetupToolboxItems (void)
517b9e67834SAndre Fischer {
51845da7d5eSAndre Fischer     maSDFontGrow.SetupToolBoxItem(*mpToolBoxIncDec, TBI_INCREASE);
51945da7d5eSAndre Fischer     maSDFontShrink.SetupToolBoxItem(*mpToolBoxIncDec, TBI_DECREASE);
520b9e67834SAndre Fischer 
52145da7d5eSAndre Fischer     maWeightControl.SetupToolBoxItem(*mpToolBoxFont, TBI_BOLD);
52245da7d5eSAndre Fischer     maItalicControl.SetupToolBoxItem(*mpToolBoxFont, TBI_ITALIC);
52345da7d5eSAndre Fischer     maUnderlineControl.SetupToolBoxItem(*mpToolBoxFont, TBI_UNDERLINE);
52445da7d5eSAndre Fischer     maStrikeControl.SetupToolBoxItem(*mpToolBoxFont, TBI_STRIKEOUT);
52545da7d5eSAndre Fischer     maShadowControl.SetupToolBoxItem(*mpToolBoxFont, TBI_SHADOWED);
526b9e67834SAndre Fischer 
52745da7d5eSAndre Fischer     maFontColorControl.SetupToolBoxItem(*mpToolBoxFontColor, TBI_FONTCOLOR);
528b9e67834SAndre Fischer     //for sw
52945da7d5eSAndre Fischer     maSuperScriptControl.SetupToolBoxItem(*mpToolBoxScriptSw, TBI_SUPER_SW);
53045da7d5eSAndre Fischer     maSubScriptControl.SetupToolBoxItem(*mpToolBoxScriptSw, TBI_SUB_SW);
531b9e67834SAndre Fischer     //for sc and sd
532ccab7bc0SAndre Fischer     maSuperScriptControl.SetupToolBoxItem(*mpToolBoxScript, TBI_SUPER);
53345da7d5eSAndre Fischer     maSubScriptControl.SetupToolBoxItem(*mpToolBoxScript, TBI_SUB);
53445da7d5eSAndre Fischer     maSpacingControl.SetupToolBoxItem(*mpToolBoxSpacing, TBI_SPACING);
53545da7d5eSAndre Fischer     maHighlightControl.SetupToolBoxItem(*mpToolBoxHighlight, TBI_HIGHLIGHT);
536b9e67834SAndre Fischer }
537b9e67834SAndre Fischer 
538b9e67834SAndre Fischer 
539b9e67834SAndre Fischer 
540b9e67834SAndre Fischer 
541b9e67834SAndre Fischer IMPL_LINK( TextPropertyPanel, FontSelHdl, FontNameBox*, pBox )
542b9e67834SAndre Fischer {
543b9e67834SAndre Fischer     if ( !pBox->IsTravelSelect() )
544b9e67834SAndre Fischer     {
545b9e67834SAndre Fischer         if( SfxViewShell::Current() )
546b9e67834SAndre Fischer         {
547b9e67834SAndre Fischer             Window* pShellWnd = SfxViewShell::Current()->GetWindow();
548b9e67834SAndre Fischer 
549b9e67834SAndre Fischer             if ( pShellWnd )
550b9e67834SAndre Fischer                 pShellWnd->GrabFocus();
551b9e67834SAndre Fischer         }
552b9e67834SAndre Fischer     }
553b9e67834SAndre Fischer     return 0;
554b9e67834SAndre Fischer }
5558ce66e53SOliver-Rainer Wittmann 
556b9e67834SAndre Fischer IMPL_LINK( TextPropertyPanel, FontSizeModifyHdl, FontSizeBox*, pSizeBox )
557b9e67834SAndre Fischer {
558b9e67834SAndre Fischer     if (pSizeBox == &maFontSizeBox)
559b9e67834SAndre Fischer     {
560b9e67834SAndre Fischer         long nSize = pSizeBox->GetValue();
561b9e67834SAndre Fischer         mbFocusOnFontSizeCtrl = true;
562b9e67834SAndre Fischer 
563b9e67834SAndre Fischer         float fSize = (float)nSize / 10;
564b9e67834SAndre Fischer         SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric();
565b9e67834SAndre Fischer         SvxFontHeightItem aItem( CalcToUnit( fSize, eUnit ), 100, SID_ATTR_CHAR_FONTHEIGHT ) ;
566b9e67834SAndre Fischer 
567b9e67834SAndre Fischer         mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONTHEIGHT, SFX_CALLMODE_RECORD, &aItem, 0L );
568b9e67834SAndre Fischer         mpBindings->Invalidate(SID_ATTR_CHAR_FONTHEIGHT,true,false);
569b9e67834SAndre Fischer     }
570b9e67834SAndre Fischer     return 0;
571b9e67834SAndre Fischer }
5728ce66e53SOliver-Rainer Wittmann 
573b9e67834SAndre Fischer IMPL_LINK( TextPropertyPanel, FontSizeSelHdl, FontSizeBox*, pSizeBox )
574b9e67834SAndre Fischer {
575b9e67834SAndre Fischer     if ( !pSizeBox->IsTravelSelect() )
576b9e67834SAndre Fischer     {
577b9e67834SAndre Fischer         if( SfxViewShell::Current() )
578b9e67834SAndre Fischer         {
579b9e67834SAndre Fischer             Window* pShellWnd = SfxViewShell::Current()->GetWindow();
580b9e67834SAndre Fischer 
581b9e67834SAndre Fischer             if ( pShellWnd )
582b9e67834SAndre Fischer                 pShellWnd->GrabFocus();
583b9e67834SAndre Fischer         }
584b9e67834SAndre Fischer     }
585b9e67834SAndre Fischer 
586b9e67834SAndre Fischer     return 0;
587b9e67834SAndre Fischer }
5888ce66e53SOliver-Rainer Wittmann 
589b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, FontSizeLoseFocus, FontSizeBox*, pSizeBox)
590b9e67834SAndre Fischer {
591b9e67834SAndre Fischer     if(pSizeBox == &maFontSizeBox)
592b9e67834SAndre Fischer     {
593b9e67834SAndre Fischer         mbFocusOnFontSizeCtrl = false;
594b9e67834SAndre Fischer     }
595b9e67834SAndre Fischer     return 0;
596b9e67834SAndre Fischer }
597b9e67834SAndre Fischer 
598b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolboxFontSelectHandler, ToolBox*, pToolBox)
599b9e67834SAndre Fischer {
600b9e67834SAndre Fischer     const sal_uInt16 nId = pToolBox->GetCurItemId();
601b9e67834SAndre Fischer 
60245da7d5eSAndre Fischer     switch (nId)
60345da7d5eSAndre Fischer     {
60445da7d5eSAndre Fischer         case TBI_BOLD:
605b9e67834SAndre Fischer         {
606b9e67834SAndre Fischer             EndTracking();
607b9e67834SAndre Fischer             if(meWeight != WEIGHT_BOLD)
608b9e67834SAndre Fischer                 meWeight = WEIGHT_BOLD;
609b9e67834SAndre Fischer             else
610b9e67834SAndre Fischer                 meWeight = WEIGHT_NORMAL;
611b9e67834SAndre Fischer             SvxWeightItem aWeightItem(meWeight, SID_ATTR_CHAR_WEIGHT);
612b9e67834SAndre Fischer             mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_WEIGHT, SFX_CALLMODE_RECORD, &aWeightItem, 0L);
61345da7d5eSAndre Fischer             UpdateItem(SID_ATTR_CHAR_WEIGHT);
61445da7d5eSAndre Fischer             break;
615b9e67834SAndre Fischer         }
61645da7d5eSAndre Fischer         case TBI_ITALIC:
617b9e67834SAndre Fischer         {
618b9e67834SAndre Fischer             EndTracking();
619b9e67834SAndre Fischer             if(meItalic != ITALIC_NORMAL)
620b9e67834SAndre Fischer                 meItalic = ITALIC_NORMAL;
621b9e67834SAndre Fischer             else
622b9e67834SAndre Fischer                 meItalic = ITALIC_NONE;
623b9e67834SAndre Fischer             SvxPostureItem aPostureItem(meItalic, SID_ATTR_CHAR_POSTURE);
624b9e67834SAndre Fischer             mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_POSTURE, SFX_CALLMODE_RECORD, &aPostureItem, 0L);
62545da7d5eSAndre Fischer             UpdateItem(SID_ATTR_CHAR_POSTURE);
62645da7d5eSAndre Fischer             break;
627b9e67834SAndre Fischer         }
62845da7d5eSAndre Fischer         case TBI_UNDERLINE:
629b9e67834SAndre Fischer         {
630b9e67834SAndre Fischer             EndTracking();
631b9e67834SAndre Fischer             if(meUnderline == UNDERLINE_NONE)
632b9e67834SAndre Fischer             {
63395a18594SAndre Fischer                 meUnderline = UNDERLINE_SINGLE;
634b9e67834SAndre Fischer                 SvxUnderlineItem aLineItem(meUnderline, SID_ATTR_CHAR_UNDERLINE);
635b9e67834SAndre Fischer                 aLineItem.SetColor(meUnderlineColor);
636b9e67834SAndre Fischer                 mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_UNDERLINE, SFX_CALLMODE_RECORD, &aLineItem, 0L);
637b9e67834SAndre Fischer             }
638b9e67834SAndre Fischer             else
639b9e67834SAndre Fischer             {
640b9e67834SAndre Fischer                 meUnderline = UNDERLINE_NONE;
641b9e67834SAndre Fischer                 SvxUnderlineItem aLineItem(meUnderline, SID_ATTR_CHAR_UNDERLINE);
642b9e67834SAndre Fischer                 mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_UNDERLINE, SFX_CALLMODE_RECORD, &aLineItem, 0L);
643b9e67834SAndre Fischer             }
64445da7d5eSAndre Fischer             UpdateItem(SID_ATTR_CHAR_UNDERLINE);
6458ce66e53SOliver-Rainer Wittmann             break;
646b9e67834SAndre Fischer         }
64745da7d5eSAndre Fischer         case TBI_STRIKEOUT:
648b9e67834SAndre Fischer         {
649b9e67834SAndre Fischer             EndTracking();
650b9e67834SAndre Fischer             if(meStrike !=  STRIKEOUT_NONE && meStrike != STRIKEOUT_DONTKNOW)
651b9e67834SAndre Fischer                 meStrike = STRIKEOUT_NONE;
652b9e67834SAndre Fischer             else
653b9e67834SAndre Fischer                 meStrike = STRIKEOUT_SINGLE;
654b9e67834SAndre Fischer             SvxCrossedOutItem aStrikeItem(meStrike,SID_ATTR_CHAR_STRIKEOUT);
655b9e67834SAndre Fischer             mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_STRIKEOUT, SFX_CALLMODE_RECORD, &aStrikeItem, 0L);
65645da7d5eSAndre Fischer             UpdateItem(SID_ATTR_CHAR_STRIKEOUT);
65745da7d5eSAndre Fischer             break;
658b9e67834SAndre Fischer         }
65945da7d5eSAndre Fischer         case TBI_SHADOWED:
660b9e67834SAndre Fischer         {
661b9e67834SAndre Fischer             EndTracking();
662b9e67834SAndre Fischer             mbShadow = !mbShadow;
663b9e67834SAndre Fischer             SvxShadowedItem aShadowItem(mbShadow, SID_ATTR_CHAR_SHADOWED);
664b9e67834SAndre Fischer             mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_SHADOWED, SFX_CALLMODE_RECORD, &aShadowItem, 0L);
66545da7d5eSAndre Fischer             UpdateItem(SID_ATTR_CHAR_SHADOWED);
66645da7d5eSAndre Fischer             break;
66745da7d5eSAndre Fischer         }
668b9e67834SAndre Fischer     }
669b9e67834SAndre Fischer     return 0;
670b9e67834SAndre Fischer }
671b9e67834SAndre Fischer 
672b9e67834SAndre Fischer 
673b9e67834SAndre Fischer 
674b9e67834SAndre Fischer 
675b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolboxIncDecSelectHdl, ToolBox*, pToolBox)
676b9e67834SAndre Fischer {
677b9e67834SAndre Fischer     const sal_uInt16 nId = pToolBox->GetCurItemId();
678b9e67834SAndre Fischer 
679b9e67834SAndre Fischer     // font size +/- enhancement in sd
68045da7d5eSAndre Fischer     switch (maContext.GetCombinedContext_DI())
681b9e67834SAndre Fischer     {
68245da7d5eSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
68345da7d5eSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_Text):
68445da7d5eSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_Table):
68545da7d5eSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_OutlineText):
68645da7d5eSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_Draw):
68745da7d5eSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
68845da7d5eSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
689b9e67834SAndre Fischer             if(nId == TBI_INCREASE)
690b9e67834SAndre Fischer             {
691b9e67834SAndre Fischer                 EndTracking();
692b9e67834SAndre Fischer                 SfxVoidItem aItem(SID_GROW_FONT_SIZE);
693b9e67834SAndre Fischer                 mpBindings->GetDispatcher()->Execute( SID_GROW_FONT_SIZE, SFX_CALLMODE_RECORD, &aItem, 0L );
694b9e67834SAndre Fischer             }
695b9e67834SAndre Fischer             else if(nId == TBI_DECREASE)
696b9e67834SAndre Fischer             {
697b9e67834SAndre Fischer                 EndTracking();
698b9e67834SAndre Fischer                 SfxVoidItem aItem(SID_SHRINK_FONT_SIZE);
699b9e67834SAndre Fischer                 mpBindings->GetDispatcher()->Execute( SID_SHRINK_FONT_SIZE, SFX_CALLMODE_RECORD, &aItem, 0L );
700b9e67834SAndre Fischer             }
701b9e67834SAndre Fischer             break;
702b9e67834SAndre Fischer 
703b9e67834SAndre Fischer         default:
704b9e67834SAndre Fischer             if(nId == TBI_INCREASE)
705b9e67834SAndre Fischer             {
706b9e67834SAndre Fischer                 EndTracking();
707b9e67834SAndre Fischer                 mbFocusOnFontSizeCtrl = false;
708b9e67834SAndre Fischer                 sal_Int64 iValue = maFontSizeBox.GetValue();
709b9e67834SAndre Fischer                 int iPos = maFontSizeBox.GetValuePos(iValue, FUNIT_NONE);
710b9e67834SAndre Fischer                 long nSize = iValue;
711b9e67834SAndre Fischer                 if(iPos != LISTBOX_ENTRY_NOTFOUND)
712b9e67834SAndre Fischer                     nSize = maFontSizeBox.GetValue(iPos+1 , FUNIT_NONE);
713b9e67834SAndre Fischer                 else if(iValue >= 100 && iValue < 105)
714b9e67834SAndre Fischer                     nSize = 105;
715b9e67834SAndre Fischer                 else if(iValue >= 105 && iValue < 110)
716b9e67834SAndre Fischer                     nSize = 110;
717b9e67834SAndre Fischer                 else if(iValue < 960)
718b9e67834SAndre Fischer                 {
719b9e67834SAndre Fischer                     nSize = (nSize / 10) * 10 + 10;
720b9e67834SAndre Fischer                     while(maFontSizeBox.GetValuePos(nSize, FUNIT_NONE) == LISTBOX_ENTRY_NOTFOUND)
721b9e67834SAndre Fischer                         nSize += 10;
722b9e67834SAndre Fischer                 }
723b9e67834SAndre Fischer                 else
724b9e67834SAndre Fischer                 {
725b9e67834SAndre Fischer                     nSize = iValue;
726b9e67834SAndre Fischer                 }
727b9e67834SAndre Fischer 
728b9e67834SAndre Fischer                 float fSize = (float)nSize / 10;
729b9e67834SAndre Fischer 
730b9e67834SAndre Fischer                 SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric();
731b9e67834SAndre Fischer                 SvxFontHeightItem aItem( CalcToUnit( fSize, eUnit ), 100, SID_ATTR_CHAR_FONTHEIGHT ) ;
732b9e67834SAndre Fischer 
733b9e67834SAndre Fischer                 mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONTHEIGHT, SFX_CALLMODE_RECORD, &aItem, 0L );
734b9e67834SAndre Fischer                 mpBindings->Invalidate(SID_ATTR_CHAR_FONTHEIGHT,true,false);
735b9e67834SAndre Fischer                 maFontSizeBox.SetValue( nSize );
736b9e67834SAndre Fischer             }
737b9e67834SAndre Fischer             else if(nId == TBI_DECREASE)
738b9e67834SAndre Fischer             {
739b9e67834SAndre Fischer                 EndTracking();
740b9e67834SAndre Fischer                 mbFocusOnFontSizeCtrl = false;
741b9e67834SAndre Fischer                 sal_Int64 iValue = maFontSizeBox.GetValue();
742b9e67834SAndre Fischer                 int iPos = maFontSizeBox.GetValuePos(iValue, FUNIT_NONE);
743b9e67834SAndre Fischer                 long nSize = iValue;
744b9e67834SAndre Fischer                 if(iPos != LISTBOX_ENTRY_NOTFOUND)
745b9e67834SAndre Fischer                     nSize = maFontSizeBox.GetValue(iPos-1 , FUNIT_NONE);
746b9e67834SAndre Fischer                 else if(iValue > 100 && iValue <= 105)
747b9e67834SAndre Fischer                     nSize = 100;
748b9e67834SAndre Fischer                 else if(iValue > 105 && iValue <= 110)
749b9e67834SAndre Fischer                     nSize = 105;
750b9e67834SAndre Fischer                 else if(iValue > 960)
751b9e67834SAndre Fischer                 {
752b9e67834SAndre Fischer                     nSize = 960;
753b9e67834SAndre Fischer                 }
754b9e67834SAndre Fischer                 else if(iValue > 60)
755b9e67834SAndre Fischer                 {
756b9e67834SAndre Fischer                     nSize = (nSize / 10) * 10 ;
757b9e67834SAndre Fischer                     while(maFontSizeBox.GetValuePos(nSize, FUNIT_NONE) == LISTBOX_ENTRY_NOTFOUND)
758b9e67834SAndre Fischer                         nSize -= 10;
759b9e67834SAndre Fischer                 }
760b9e67834SAndre Fischer                 else
761b9e67834SAndre Fischer                 {
762b9e67834SAndre Fischer                     nSize = iValue;
763b9e67834SAndre Fischer                 }
764b9e67834SAndre Fischer 
765b9e67834SAndre Fischer                 float fSize = (float)nSize / 10;
766b9e67834SAndre Fischer 
767b9e67834SAndre Fischer                 SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric();
768b9e67834SAndre Fischer                 SvxFontHeightItem aItem( CalcToUnit( fSize, eUnit ), 100, SID_ATTR_CHAR_FONTHEIGHT ) ;
769b9e67834SAndre Fischer 
770b9e67834SAndre Fischer                 mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONTHEIGHT, SFX_CALLMODE_RECORD, &aItem, 0L );
771b9e67834SAndre Fischer                 mpBindings->Invalidate(SID_ATTR_CHAR_FONTHEIGHT,true,false);
772b9e67834SAndre Fischer                 maFontSizeBox.SetValue( nSize );
773b9e67834SAndre Fischer             }
774b9e67834SAndre Fischer     }
77545da7d5eSAndre Fischer     UpdateItem(SID_ATTR_CHAR_FONTHEIGHT);
77645da7d5eSAndre Fischer 
777b9e67834SAndre Fischer     return 0;
778b9e67834SAndre Fischer }
779b9e67834SAndre Fischer 
780b9e67834SAndre Fischer 
781b9e67834SAndre Fischer 
782b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolBoxUnderlineClickHdl, ToolBox*, pToolBox)
783b9e67834SAndre Fischer {
784b9e67834SAndre Fischer     const sal_uInt16 nId = pToolBox->GetCurItemId();
785d4aefcaeSZheng Fan     OSL_ASSERT(nId == TBI_UNDERLINE);
786b9e67834SAndre Fischer     if(nId == TBI_UNDERLINE)
787b9e67834SAndre Fischer     {
788b9e67834SAndre Fischer         pToolBox->SetItemDown( nId, true );
789d4aefcaeSZheng Fan         maUnderlinePopup.Rearrange(meUnderline);
790d4aefcaeSZheng Fan         maUnderlinePopup.Show(*pToolBox);
791b9e67834SAndre Fischer 
792b9e67834SAndre Fischer     }
793d4aefcaeSZheng Fan     return 0L;
794b9e67834SAndre Fischer }
795b9e67834SAndre Fischer 
796b9e67834SAndre Fischer 
797b9e67834SAndre Fischer 
798b9e67834SAndre Fischer 
799b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolBoxFontColorDropHdl,ToolBox*, pToolBox)
800b9e67834SAndre Fischer {
801b9e67834SAndre Fischer     const sal_uInt16 nId = pToolBox->GetCurItemId();
802b9e67834SAndre Fischer     if(nId == TBI_FONTCOLOR)
803b9e67834SAndre Fischer     {
804b9e67834SAndre Fischer         pToolBox->SetItemDown( nId, true );
805b9e67834SAndre Fischer 
806d4aefcaeSZheng Fan         maFontColorPopup.Show(*pToolBox);
807d4aefcaeSZheng Fan         maFontColorPopup.SetCurrentColor(maColor, mbColorAvailable);
808b9e67834SAndre Fischer     }
809b9e67834SAndre Fischer     return 0;
810b9e67834SAndre Fischer }
811b9e67834SAndre Fischer 
812b9e67834SAndre Fischer 
813b9e67834SAndre Fischer 
814b9e67834SAndre Fischer 
815b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolBoxSwScriptSelectHdl, ToolBox*, pToolBox)
816b9e67834SAndre Fischer {
817b9e67834SAndre Fischer     const sal_uInt16 nId = pToolBox->GetCurItemId();
818b9e67834SAndre Fischer     if( nId == TBI_SUPER_SW )
819b9e67834SAndre Fischer     {
820b9e67834SAndre Fischer         if(meEscape != SVX_ESCAPEMENT_SUPERSCRIPT)
821b9e67834SAndre Fischer         {
822b9e67834SAndre Fischer             meEscape = SVX_ESCAPEMENT_SUPERSCRIPT;
823b9e67834SAndre Fischer             SvxEscapementItem aSupItem(DFLT_ESC_SUPER, DFLT_ESC_PROP, SID_ATTR_CHAR_ESCAPEMENT);
824b9e67834SAndre Fischer             mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aSupItem, 0L );
825b9e67834SAndre Fischer         }
826b9e67834SAndre Fischer         else
827b9e67834SAndre Fischer         {
828b9e67834SAndre Fischer             meEscape = SVX_ESCAPEMENT_OFF;
829b9e67834SAndre Fischer             SvxEscapementItem aNoneItem(0, 100, SID_ATTR_CHAR_ESCAPEMENT);
830b9e67834SAndre Fischer             mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aNoneItem, 0L );
831b9e67834SAndre Fischer         }
832b9e67834SAndre Fischer     }
833b9e67834SAndre Fischer     else if(TBI_SUB_SW == nId)
834b9e67834SAndre Fischer     {
835b9e67834SAndre Fischer         if(meEscape != SVX_ESCAPEMENT_SUBSCRIPT)
836b9e67834SAndre Fischer         {
837b9e67834SAndre Fischer             meEscape = (SvxEscapement)SVX_ESCAPEMENT_SUBSCRIPT;
838b9e67834SAndre Fischer             SvxEscapementItem aSubItem(DFLT_ESC_SUB, DFLT_ESC_PROP, SID_ATTR_CHAR_ESCAPEMENT);
839b9e67834SAndre Fischer             mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aSubItem, 0L );
840b9e67834SAndre Fischer         }
841b9e67834SAndre Fischer         else
842b9e67834SAndre Fischer         {
843b9e67834SAndre Fischer             meEscape = SVX_ESCAPEMENT_OFF;
844b9e67834SAndre Fischer             SvxEscapementItem aNoneItem(0, 100, SID_ATTR_CHAR_ESCAPEMENT);
845b9e67834SAndre Fischer             mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aNoneItem, 0L );
846b9e67834SAndre Fischer         }
847b9e67834SAndre Fischer     }
84845da7d5eSAndre Fischer     UpdateItem(SID_ATTR_CHAR_ESCAPEMENT);
849b9e67834SAndre Fischer 
850b9e67834SAndre Fischer     return 0;
851b9e67834SAndre Fischer }
852b9e67834SAndre Fischer 
853b9e67834SAndre Fischer 
854b9e67834SAndre Fischer 
855b9e67834SAndre Fischer 
856b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolBoxScriptSelectHdl, ToolBox*, pToolBox)
857b9e67834SAndre Fischer {
858b9e67834SAndre Fischer     const sal_uInt16 nId = pToolBox->GetCurItemId();
859b9e67834SAndre Fischer     if( nId == TBI_SUPER )
860b9e67834SAndre Fischer     {
861b9e67834SAndre Fischer         mbSuper = !mbSuper;
862b9e67834SAndre Fischer         SfxBoolItem aSupItem(SID_SET_SUPER_SCRIPT, mbSuper);
863b9e67834SAndre Fischer         mpBindings->GetDispatcher()->Execute( SID_SET_SUPER_SCRIPT, SFX_CALLMODE_RECORD, &aSupItem, 0L );
86445da7d5eSAndre Fischer         UpdateItem(SID_SET_SUPER_SCRIPT);
865b9e67834SAndre Fischer     }
866b9e67834SAndre Fischer     else if(TBI_SUB == nId)
867b9e67834SAndre Fischer     {
868b9e67834SAndre Fischer 
869b9e67834SAndre Fischer         mbSub = !mbSub;
870b9e67834SAndre Fischer         SfxBoolItem aSubItem(SID_SET_SUB_SCRIPT, mbSub );
871b9e67834SAndre Fischer         mpBindings->GetDispatcher()->Execute( SID_SET_SUB_SCRIPT, SFX_CALLMODE_RECORD, &aSubItem, 0L );
87245da7d5eSAndre Fischer         UpdateItem(SID_SET_SUB_SCRIPT);
873b9e67834SAndre Fischer     }
874b9e67834SAndre Fischer     return 0;
875b9e67834SAndre Fischer }
876b9e67834SAndre Fischer 
877b9e67834SAndre Fischer 
878b9e67834SAndre Fischer 
879b9e67834SAndre Fischer 
880b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolBoxHighlightDropHdl, ToolBox*, pToolBox)
881b9e67834SAndre Fischer {
882b9e67834SAndre Fischer     const sal_uInt16 nId = pToolBox->GetCurItemId();
883b9e67834SAndre Fischer     if(nId == TBI_HIGHLIGHT)
884b9e67834SAndre Fischer     {
885b9e67834SAndre Fischer         pToolBox->SetItemDown( nId, true );
886d4aefcaeSZheng Fan         maBrushColorPopup.Show(*pToolBox);
887d4aefcaeSZheng Fan         maBrushColorPopup.SetCurrentColor(maBackColor, mbBackColorAvailable);
888b9e67834SAndre Fischer 
889b9e67834SAndre Fischer     }
890b9e67834SAndre Fischer     return 0;
891b9e67834SAndre Fischer }
892b9e67834SAndre Fischer 
893b9e67834SAndre Fischer 
894b9e67834SAndre Fischer 
895b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, SpacingClickHdl, ToolBox*, pToolBox)
896b9e67834SAndre Fischer {
897b9e67834SAndre Fischer     const sal_uInt16 nId = pToolBox->GetCurItemId();
898d4aefcaeSZheng Fan     OSL_ASSERT(nId == TBI_SPACING);
899b9e67834SAndre Fischer     if(nId == TBI_SPACING)
900b9e67834SAndre Fischer     {
901b9e67834SAndre Fischer         pToolBox->SetItemDown( nId, true );
902d4aefcaeSZheng Fan         maCharSpacePopup.Rearrange(mbKernLBAvailable,mbKernAvailable,mlKerning);
903d4aefcaeSZheng Fan         maCharSpacePopup.Show(*pToolBox);
904b9e67834SAndre Fischer 
905b9e67834SAndre Fischer     }
906d4aefcaeSZheng Fan     return 0L;
907b9e67834SAndre Fischer }
908b9e67834SAndre Fischer 
909b9e67834SAndre Fischer 
910b9e67834SAndre Fischer 
911b9e67834SAndre Fischer 
912b9e67834SAndre Fischer void TextPropertyPanel::NotifyItemUpdate (
913b9e67834SAndre Fischer     const sal_uInt16 nSID,
914b9e67834SAndre Fischer     const SfxItemState eState,
91545da7d5eSAndre Fischer     const SfxPoolItem* pState,
91645da7d5eSAndre Fischer     const bool bIsEnabled)
917b9e67834SAndre Fischer {
918b9e67834SAndre Fischer     switch(nSID)
919b9e67834SAndre Fischer     {
920b9e67834SAndre Fischer         case SID_ATTR_CHAR_FONT:
92145da7d5eSAndre Fischer         {
92245da7d5eSAndre Fischer             bool bIsControlEnabled (bIsEnabled);
923b9e67834SAndre Fischer             if (  eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxFontItem) )
924b9e67834SAndre Fischer             {
925b9e67834SAndre Fischer                 const SvxFontItem* pFontItem = (const SvxFontItem*)pState;
926b9e67834SAndre Fischer                 mpFontNameBox->SetText( pFontItem->GetFamilyName() );
927b9e67834SAndre Fischer             }
928b9e67834SAndre Fischer             else
929b9e67834SAndre Fischer             {
930b9e67834SAndre Fischer                 mpFontNameBox->SetText( String() );
931b9e67834SAndre Fischer                 if (SFX_ITEM_DISABLED == eState)
93245da7d5eSAndre Fischer                     bIsControlEnabled = false;
933b9e67834SAndre Fischer             }
93445da7d5eSAndre Fischer             mpFontNameBox->Enable(bIsControlEnabled);
935b9e67834SAndre Fischer             break;
93645da7d5eSAndre Fischer         }
937b9e67834SAndre Fischer         case SID_ATTR_CHAR_FONTHEIGHT:
93845da7d5eSAndre Fischer         {
93945da7d5eSAndre Fischer             bool bIsControlEnabled (bIsEnabled);
940b9e67834SAndre Fischer             if (  eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxFontHeightItem) )
941b9e67834SAndre Fischer             {
942b9e67834SAndre Fischer                 mpHeightItem = (SvxFontHeightItem*)pState;//const SvxFontHeightItem*
943b9e67834SAndre Fischer                 SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric();
944*bc7f1831SAndre Fischer                 const sal_Int64 nValue (CalcToPoint(mpHeightItem->GetHeight(), eUnit, 10 ));
945b9e67834SAndre Fischer                 mpToolBoxIncDec->Enable();
946b9e67834SAndre Fischer 
947b9e67834SAndre Fischer                 mpToolBoxIncDec->SetItemState(TBI_INCREASE, STATE_NOCHECK);
948b9e67834SAndre Fischer                 mpToolBoxIncDec->SetItemState(TBI_DECREASE, STATE_NOCHECK);
949b9e67834SAndre Fischer 
950*bc7f1831SAndre Fischer                 // For Writer we have to update the states of the
951*bc7f1831SAndre Fischer                 // increase and decrease buttons here, because we have
952*bc7f1831SAndre Fischer                 // no access to the slots used by Writer.
953*bc7f1831SAndre Fischer                 switch(maContext.GetCombinedContext_DI())
954*bc7f1831SAndre Fischer                 {
955*bc7f1831SAndre Fischer                     case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
956*bc7f1831SAndre Fischer                     case CombinedEnumContext(Application_DrawImpress, Context_Text):
957*bc7f1831SAndre Fischer                     case CombinedEnumContext(Application_DrawImpress, Context_Table):
958*bc7f1831SAndre Fischer                     case CombinedEnumContext(Application_DrawImpress, Context_OutlineText):
959*bc7f1831SAndre Fischer                     case CombinedEnumContext(Application_DrawImpress, Context_Draw):
960*bc7f1831SAndre Fischer                     case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
961*bc7f1831SAndre Fischer                     case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
962*bc7f1831SAndre Fischer                         break;
963*bc7f1831SAndre Fischer 
964*bc7f1831SAndre Fischer                     default:
965*bc7f1831SAndre Fischer                     {
966*bc7f1831SAndre Fischer                         mpToolBoxIncDec->EnableItem(TBI_INCREASE, bIsEnabled && nValue<960);
967*bc7f1831SAndre Fischer                         mpToolBoxIncDec->EnableItem(TBI_DECREASE, bIsEnabled && nValue>60);
968*bc7f1831SAndre Fischer                         break;
969*bc7f1831SAndre Fischer                     }
970*bc7f1831SAndre Fischer                 }
971*bc7f1831SAndre Fischer 
972b9e67834SAndre Fischer                 if( mbFocusOnFontSizeCtrl )
973b9e67834SAndre Fischer                     return;
974b9e67834SAndre Fischer 
975*bc7f1831SAndre Fischer                 maFontSizeBox.SetValue(nValue);
976b9e67834SAndre Fischer                 maFontSizeBox.LoseFocus();
97745da7d5eSAndre Fischer 
97845da7d5eSAndre Fischer                 UpdateItem(SID_SHRINK_FONT_SIZE);
97945da7d5eSAndre Fischer                 UpdateItem(SID_GROW_FONT_SIZE);
980b9e67834SAndre Fischer             }
981b9e67834SAndre Fischer             else
982b9e67834SAndre Fischer             {
983b9e67834SAndre Fischer                 mpHeightItem = NULL;
984b9e67834SAndre Fischer                 maFontSizeBox.SetText( String() );
985b9e67834SAndre Fischer                 //increase decrease diabled when multi-seletion have different font size
986b9e67834SAndre Fischer 
987b9e67834SAndre Fischer                 // font size +/- enhancement in sd
98845da7d5eSAndre Fischer                 switch(maContext.GetCombinedContext_DI())
989b9e67834SAndre Fischer                 {
99045da7d5eSAndre Fischer                     case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
99145da7d5eSAndre Fischer                     case CombinedEnumContext(Application_DrawImpress, Context_Text):
99245da7d5eSAndre Fischer                     case CombinedEnumContext(Application_DrawImpress, Context_Table):
99345da7d5eSAndre Fischer                     case CombinedEnumContext(Application_DrawImpress, Context_OutlineText):
99445da7d5eSAndre Fischer                     case CombinedEnumContext(Application_DrawImpress, Context_Draw):
99545da7d5eSAndre Fischer                     case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
99645da7d5eSAndre Fischer                     case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
997b9e67834SAndre Fischer                         break;
998b9e67834SAndre Fischer 
999b9e67834SAndre Fischer                     default:
1000b9e67834SAndre Fischer                         mpToolBoxIncDec->Disable();
1001b9e67834SAndre Fischer                 }
1002b9e67834SAndre Fischer                 if ( eState <= SFX_ITEM_READONLY )
100345da7d5eSAndre Fischer                     bIsControlEnabled = false;
1004b9e67834SAndre Fischer             }
100545da7d5eSAndre Fischer             maFontSizeBox.Enable(bIsControlEnabled);
1006b9e67834SAndre Fischer             break;
100745da7d5eSAndre Fischer         }
100845da7d5eSAndre Fischer 
1009b9e67834SAndre Fischer         case SID_ATTR_CHAR_WEIGHT:
1010b9e67834SAndre Fischer             mbWeightAvailable = (eState >= SFX_ITEM_DONTCARE);
1011b9e67834SAndre Fischer             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxWeightItem))
1012b9e67834SAndre Fischer             {
1013b9e67834SAndre Fischer                 const SvxWeightItem* pItem = (const SvxWeightItem*)pState;
1014b9e67834SAndre Fischer                 meWeight = (FontWeight)pItem->GetValue();
1015b9e67834SAndre Fischer             }
1016b9e67834SAndre Fischer             else
1017b9e67834SAndre Fischer             {
1018b9e67834SAndre Fischer                 meWeight = WEIGHT_NORMAL;
1019b9e67834SAndre Fischer             }
102045da7d5eSAndre Fischer             mpToolBoxFont->EnableItem(TBI_BOLD, mbWeightAvailable && bIsEnabled);
102145da7d5eSAndre Fischer             mpToolBoxFont->SetItemState(TBI_BOLD, meWeight==WEIGHT_BOLD ? STATE_CHECK : STATE_NOCHECK);
1022b9e67834SAndre Fischer             break;
102345da7d5eSAndre Fischer 
1024b9e67834SAndre Fischer         case SID_ATTR_CHAR_POSTURE:
1025b9e67834SAndre Fischer             mbPostureAvailable = (eState >= SFX_ITEM_DONTCARE);
1026b9e67834SAndre Fischer             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxPostureItem))
1027b9e67834SAndre Fischer             {
1028b9e67834SAndre Fischer                 const SvxPostureItem* pItem = (const SvxPostureItem*)pState;
1029b9e67834SAndre Fischer                 meItalic = (FontItalic)pItem->GetValue();
1030b9e67834SAndre Fischer             }
1031b9e67834SAndre Fischer             else
1032b9e67834SAndre Fischer             {
1033b9e67834SAndre Fischer                 meItalic = ITALIC_NONE;
1034b9e67834SAndre Fischer             }
103545da7d5eSAndre Fischer             mpToolBoxFont->EnableItem(TBI_ITALIC, mbPostureAvailable && bIsEnabled);
103645da7d5eSAndre Fischer             mpToolBoxFont->SetItemState(TBI_ITALIC, meItalic==ITALIC_NORMAL ? STATE_CHECK : STATE_NOCHECK);
1037b9e67834SAndre Fischer             break;
103845da7d5eSAndre Fischer 
1039b9e67834SAndre Fischer         case SID_ATTR_CHAR_UNDERLINE:
104045da7d5eSAndre Fischer             if( eState >= SFX_ITEM_DEFAULT)
1041b9e67834SAndre Fischer             {
1042b9e67834SAndre Fischer                 if(pState->ISA(SvxUnderlineItem))
1043b9e67834SAndre Fischer                 {
1044b9e67834SAndre Fischer                     const SvxUnderlineItem* pItem = (const SvxUnderlineItem*)pState;
1045b9e67834SAndre Fischer                     meUnderline = (FontUnderline)pItem->GetValue();
1046b9e67834SAndre Fischer                     meUnderlineColor = pItem->GetColor();
1047b9e67834SAndre Fischer                 }
1048b9e67834SAndre Fischer             }
1049b9e67834SAndre Fischer             else
1050b9e67834SAndre Fischer             {
1051b9e67834SAndre Fischer                 meUnderline = UNDERLINE_NONE;
1052b9e67834SAndre Fischer             }
105345da7d5eSAndre Fischer             mpToolBoxFont->EnableItem(TBI_UNDERLINE, bIsEnabled);
105445da7d5eSAndre Fischer             mpToolBoxFont->SetItemState(TBI_UNDERLINE, meUnderline==UNDERLINE_NONE ? STATE_NOCHECK : STATE_CHECK);
1055b9e67834SAndre Fischer             break;
105645da7d5eSAndre Fischer 
1057b9e67834SAndre Fischer         case SID_ATTR_CHAR_SHADOWED:
1058b9e67834SAndre Fischer             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxShadowedItem))
1059b9e67834SAndre Fischer             {
1060b9e67834SAndre Fischer                 const SvxShadowedItem* pItem = (const SvxShadowedItem*)pState;
1061b9e67834SAndre Fischer                 mbShadow = pItem->GetValue();
1062b9e67834SAndre Fischer             }
1063b9e67834SAndre Fischer             else
1064b9e67834SAndre Fischer             {
1065b9e67834SAndre Fischer                 mbShadow = false;
1066b9e67834SAndre Fischer             }
106745da7d5eSAndre Fischer             mpToolBoxFont->EnableItem(TBI_SHADOWED, bIsEnabled);
106845da7d5eSAndre Fischer             mpToolBoxFont->SetItemState(TBI_SHADOWED, mbShadow ? STATE_CHECK : STATE_NOCHECK);
1069b9e67834SAndre Fischer             break;
107045da7d5eSAndre Fischer 
1071b9e67834SAndre Fischer         case SID_ATTR_CHAR_STRIKEOUT:
1072b9e67834SAndre Fischer             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxCrossedOutItem))
1073b9e67834SAndre Fischer             {
1074b9e67834SAndre Fischer                 const SvxCrossedOutItem* pItem = (const SvxCrossedOutItem*)pState;
1075b9e67834SAndre Fischer                 meStrike = (FontStrikeout)pItem->GetValue();
1076b9e67834SAndre Fischer             }
1077b9e67834SAndre Fischer             else
1078b9e67834SAndre Fischer             {
1079b9e67834SAndre Fischer                 meStrike = STRIKEOUT_NONE;
1080b9e67834SAndre Fischer             }
108145da7d5eSAndre Fischer             mpToolBoxFont->EnableItem(TBI_STRIKEOUT, bIsEnabled);
108245da7d5eSAndre Fischer             mpToolBoxFont->SetItemState(TBI_STRIKEOUT,
108345da7d5eSAndre Fischer                 meStrike!=STRIKEOUT_NONE && meStrike!=STRIKEOUT_DONTKNOW
108445da7d5eSAndre Fischer                     ? STATE_CHECK
108545da7d5eSAndre Fischer                     : STATE_NOCHECK);
1086b9e67834SAndre Fischer             break;
108745da7d5eSAndre Fischer 
1088b9e67834SAndre Fischer         case SID_ATTR_CHAR_COLOR:
1089b9e67834SAndre Fischer             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxColorItem))
1090b9e67834SAndre Fischer             {
1091d4aefcaeSZheng Fan                 const SvxColorItem* pItem =  (const SvxColorItem*)pState;
1092d4aefcaeSZheng Fan                 maColor = pItem->GetValue();
1093b9e67834SAndre Fischer                 mbColorAvailable = true;
109495a18594SAndre Fischer                 if (mpFontColorUpdater)
1095b9e67834SAndre Fischer                     mpFontColorUpdater->Update(maColor);
1096b9e67834SAndre Fischer             }
1097b9e67834SAndre Fischer             else
1098b9e67834SAndre Fischer             {
1099b9e67834SAndre Fischer                 mbColorAvailable = false;
1100b9e67834SAndre Fischer                 maColor.SetColor(COL_AUTO);
110195a18594SAndre Fischer                 if (mpFontColorUpdater)
1102b9e67834SAndre Fischer                     mpFontColorUpdater->Update(maColor);
1103b9e67834SAndre Fischer             }
110445da7d5eSAndre Fischer             mpToolBoxFontColor->EnableItem(TBI_FONTCOLOR, bIsEnabled);
1105b9e67834SAndre Fischer             break;
110645da7d5eSAndre Fischer 
1107b9e67834SAndre Fischer         case SID_ATTR_BRUSH_CHAR:
1108b9e67834SAndre Fischer             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxBrushItem))
1109b9e67834SAndre Fischer             {
1110b9e67834SAndre Fischer                 const SvxBrushItem* pItem =  (const SvxBrushItem*)pState;
1111b9e67834SAndre Fischer                 maBackColor = pItem->GetColor();
1112b9e67834SAndre Fischer                 mbBackColorAvailable = true;
11137a32b0c8SAndre Fischer                 if (mpHighlightUpdater)
1114b9e67834SAndre Fischer                     mpHighlightUpdater->Update(maBackColor);
1115b9e67834SAndre Fischer             }
1116b9e67834SAndre Fischer             else
1117b9e67834SAndre Fischer             {
1118b9e67834SAndre Fischer                 mbBackColorAvailable = false;
1119b9e67834SAndre Fischer                 maBackColor.SetColor(COL_AUTO);
11207a32b0c8SAndre Fischer                 if (mpHighlightUpdater)
1121b9e67834SAndre Fischer                     mpHighlightUpdater->Update(maBackColor);
1122b9e67834SAndre Fischer             }
112345da7d5eSAndre Fischer             mpToolBoxHighlight->EnableItem(TBI_HIGHLIGHT, bIsEnabled);
1124b9e67834SAndre Fischer             break;
112545da7d5eSAndre Fischer 
1126b9e67834SAndre Fischer         case SID_ATTR_CHAR_ESCAPEMENT:
112745da7d5eSAndre Fischer         {
112845da7d5eSAndre Fischer             bool bIsItemEnabled (true);
1129b9e67834SAndre Fischer             if (eState == SFX_ITEM_AVAILABLE)
1130b9e67834SAndre Fischer             {
1131b9e67834SAndre Fischer                 if (pState->ISA(SvxEscapementItem))
1132b9e67834SAndre Fischer                 {
1133b9e67834SAndre Fischer                     const SvxEscapementItem* pItem = (const SvxEscapementItem *)pState;
1134b9e67834SAndre Fischer                     short nEsc = pItem->GetEsc();
1135b9e67834SAndre Fischer                     if(nEsc == 0)
113645da7d5eSAndre Fischer                     {
1137b9e67834SAndre Fischer                         meEscape = SVX_ESCAPEMENT_OFF;
113845da7d5eSAndre Fischer                         mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_NOCHECK);
113945da7d5eSAndre Fischer                         mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_NOCHECK);
114045da7d5eSAndre Fischer                     }
1141b9e67834SAndre Fischer                     else if(nEsc > 0)
114245da7d5eSAndre Fischer                     {
1143b9e67834SAndre Fischer                         meEscape = SVX_ESCAPEMENT_SUPERSCRIPT;
114445da7d5eSAndre Fischer                         mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_CHECK);
114545da7d5eSAndre Fischer                         mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_NOCHECK);
114645da7d5eSAndre Fischer                     }
1147b9e67834SAndre Fischer                     else
114845da7d5eSAndre Fischer                     {
1149b9e67834SAndre Fischer                         meEscape = SVX_ESCAPEMENT_SUBSCRIPT;
115045da7d5eSAndre Fischer                         mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_NOCHECK);
115145da7d5eSAndre Fischer                         mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_CHECK);
115245da7d5eSAndre Fischer                     }
1153b9e67834SAndre Fischer                 }
1154b9e67834SAndre Fischer                 else
1155b9e67834SAndre Fischer                 {
1156b9e67834SAndre Fischer                     meEscape = SVX_ESCAPEMENT_OFF;
115745da7d5eSAndre Fischer                     mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_NOCHECK);
115845da7d5eSAndre Fischer                     mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_NOCHECK);
1159b9e67834SAndre Fischer                 }
1160b9e67834SAndre Fischer             }
1161b9e67834SAndre Fischer             else if (eState == SFX_ITEM_DISABLED)
1162b9e67834SAndre Fischer             {
116345da7d5eSAndre Fischer                 bIsItemEnabled = false;
1164b9e67834SAndre Fischer             }
1165b9e67834SAndre Fischer             else
1166b9e67834SAndre Fischer             {
1167b9e67834SAndre Fischer                 meEscape = SVX_ESCAPEMENT_OFF;
1168b9e67834SAndre Fischer             }
1169*bc7f1831SAndre Fischer             mpToolBoxScriptSw->EnableItem(TBI_SUPER_SW, bIsItemEnabled && bIsEnabled);
1170*bc7f1831SAndre Fischer             mpToolBoxScriptSw->EnableItem(TBI_SUB_SW, bIsItemEnabled && bIsEnabled);
1171b9e67834SAndre Fischer             break;
117245da7d5eSAndre Fischer         }
117345da7d5eSAndre Fischer 
1174b9e67834SAndre Fischer         case SID_SET_SUB_SCRIPT:
1175b9e67834SAndre Fischer             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SfxBoolItem))
1176b9e67834SAndre Fischer             {
1177b9e67834SAndre Fischer                 const SfxBoolItem* pItem = (const SfxBoolItem*)pState;
1178b9e67834SAndre Fischer                 mbSub = pItem->GetValue();
1179b9e67834SAndre Fischer             }
1180b9e67834SAndre Fischer             else
1181b9e67834SAndre Fischer             {
1182b9e67834SAndre Fischer                 mbSub = false;
1183b9e67834SAndre Fischer             }
118445da7d5eSAndre Fischer             mpToolBoxScript->EnableItem(TBI_SUB, bIsEnabled);
118545da7d5eSAndre Fischer             mpToolBoxScript->SetItemState(TBI_SUB, mbSub ? STATE_CHECK : STATE_NOCHECK);
1186b9e67834SAndre Fischer             break;
118745da7d5eSAndre Fischer 
1188b9e67834SAndre Fischer         case SID_SET_SUPER_SCRIPT:
1189b9e67834SAndre Fischer             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SfxBoolItem))
1190b9e67834SAndre Fischer             {
1191b9e67834SAndre Fischer                 const SfxBoolItem* pItem = (const SfxBoolItem*)pState;
1192b9e67834SAndre Fischer                 mbSuper = pItem->GetValue();
1193b9e67834SAndre Fischer             }
1194b9e67834SAndre Fischer             else
1195b9e67834SAndre Fischer             {
1196b9e67834SAndre Fischer                 mbSuper = false;
1197b9e67834SAndre Fischer             }
119845da7d5eSAndre Fischer             mpToolBoxScript->EnableItem(TBI_SUPER, bIsEnabled);
119945da7d5eSAndre Fischer             mpToolBoxScript->SetItemState(TBI_SUPER, mbSuper ? STATE_CHECK : STATE_NOCHECK);
1200b9e67834SAndre Fischer             break;
120145da7d5eSAndre Fischer 
1202b9e67834SAndre Fischer         case SID_ATTR_CHAR_KERNING:
1203b9e67834SAndre Fischer             if ( SFX_ITEM_AVAILABLE == eState )
1204b9e67834SAndre Fischer             {
1205b9e67834SAndre Fischer                 mbKernLBAvailable = true;
1206b9e67834SAndre Fischer 
1207b9e67834SAndre Fischer                 if(pState->ISA(SvxKerningItem))
1208b9e67834SAndre Fischer                 {
1209b9e67834SAndre Fischer                     const SvxKerningItem* pKerningItem  = (const SvxKerningItem*)pState;
1210b9e67834SAndre Fischer                     mlKerning = (long)pKerningItem->GetValue();
1211b9e67834SAndre Fischer                     mbKernAvailable = true;
1212b9e67834SAndre Fischer                 }
1213b9e67834SAndre Fischer                 else
1214b9e67834SAndre Fischer                 {
1215b9e67834SAndre Fischer                     mlKerning = 0;
1216b9e67834SAndre Fischer                     mbKernAvailable =false;
1217b9e67834SAndre Fischer                 }
1218b9e67834SAndre Fischer             }
1219b9e67834SAndre Fischer             else if (SFX_ITEM_DISABLED == eState)
1220b9e67834SAndre Fischer             {
1221b9e67834SAndre Fischer                 mbKernLBAvailable = false;
1222b9e67834SAndre Fischer                 mbKernAvailable = false;
1223b9e67834SAndre Fischer                 mlKerning = 0;
1224b9e67834SAndre Fischer             }
1225b9e67834SAndre Fischer             else
1226b9e67834SAndre Fischer             {
1227b9e67834SAndre Fischer                 mbKernLBAvailable = true;
1228b9e67834SAndre Fischer                 mbKernAvailable = false;
1229b9e67834SAndre Fischer                 mlKerning = 0;
1230b9e67834SAndre Fischer             }
123145da7d5eSAndre Fischer             mpToolBoxSpacing->EnableItem(TBI_SPACING, bIsEnabled);
1232b9e67834SAndre Fischer             break;
1233b9e67834SAndre Fischer 
1234b9e67834SAndre Fischer             // font size +/- enhancement in sd
1235b9e67834SAndre Fischer         case SID_SHRINK_FONT_SIZE:
1236b9e67834SAndre Fischer         case SID_GROW_FONT_SIZE:
123745da7d5eSAndre Fischer             switch(maContext.GetCombinedContext_DI())
1238b9e67834SAndre Fischer             {
123945da7d5eSAndre Fischer                 case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
124045da7d5eSAndre Fischer                 case CombinedEnumContext(Application_DrawImpress, Context_Text):
124145da7d5eSAndre Fischer                 case CombinedEnumContext(Application_DrawImpress, Context_Table):
124245da7d5eSAndre Fischer                 case CombinedEnumContext(Application_DrawImpress, Context_OutlineText):
124345da7d5eSAndre Fischer                 case CombinedEnumContext(Application_DrawImpress, Context_Draw):
124445da7d5eSAndre Fischer                 case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
124545da7d5eSAndre Fischer                 case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
1246*bc7f1831SAndre Fischer                 {
1247b9e67834SAndre Fischer                     if(eState == SFX_ITEM_DISABLED)
1248b9e67834SAndre Fischer                         mpToolBoxIncDec->Disable();
1249b9e67834SAndre Fischer                     else
1250b9e67834SAndre Fischer                         mpToolBoxIncDec->Enable();
1251*bc7f1831SAndre Fischer                     const sal_Int64 nSize (maFontSizeBox.GetValue());
1252*bc7f1831SAndre Fischer                     switch(nSID)
1253*bc7f1831SAndre Fischer                     {
1254*bc7f1831SAndre Fischer                         case SID_GROW_FONT_SIZE:
1255*bc7f1831SAndre Fischer                             mpToolBoxIncDec->EnableItem(TBI_INCREASE, bIsEnabled && nSize<960);
1256*bc7f1831SAndre Fischer                             break;
1257*bc7f1831SAndre Fischer 
1258*bc7f1831SAndre Fischer                         case SID_SHRINK_FONT_SIZE:
1259*bc7f1831SAndre Fischer                             mpToolBoxIncDec->EnableItem(TBI_DECREASE, bIsEnabled && nSize>60);
1260*bc7f1831SAndre Fischer                             break;
1261*bc7f1831SAndre Fischer 
1262*bc7f1831SAndre Fischer                         default:
1263b9e67834SAndre Fischer                             break;
1264b9e67834SAndre Fischer                     }
1265*bc7f1831SAndre Fischer                 }
1266*bc7f1831SAndre Fischer             }
1267b9e67834SAndre Fischer             break;
1268b9e67834SAndre Fischer     }
1269b9e67834SAndre Fischer }
1270b9e67834SAndre Fischer 
1271b9e67834SAndre Fischer 
1272b9e67834SAndre Fischer 
1273b9e67834SAndre Fischer 
127445da7d5eSAndre Fischer void TextPropertyPanel::UpdateItem (const sal_uInt16 nSlotId)
1275b9e67834SAndre Fischer {
127645da7d5eSAndre Fischer     switch (nSlotId)
127745da7d5eSAndre Fischer     {
127845da7d5eSAndre Fischer         case SID_ATTR_CHAR_FONT:
127945da7d5eSAndre Fischer             maFontNameControl.RequestUpdate();
128045da7d5eSAndre Fischer             break;
128145da7d5eSAndre Fischer         case SID_ATTR_CHAR_FONTHEIGHT:
128245da7d5eSAndre Fischer             maFontSizeControl.RequestUpdate();
128345da7d5eSAndre Fischer             break;
128445da7d5eSAndre Fischer         case SID_ATTR_CHAR_WEIGHT:
128545da7d5eSAndre Fischer             maWeightControl.RequestUpdate();
128645da7d5eSAndre Fischer             break;
128745da7d5eSAndre Fischer         case SID_ATTR_CHAR_POSTURE:
128845da7d5eSAndre Fischer             maItalicControl.RequestUpdate();
128945da7d5eSAndre Fischer             break;
129045da7d5eSAndre Fischer         case SID_ATTR_CHAR_UNDERLINE:
129145da7d5eSAndre Fischer             maUnderlineControl.RequestUpdate();
129245da7d5eSAndre Fischer             break;
129345da7d5eSAndre Fischer         case SID_ATTR_CHAR_STRIKEOUT:
129445da7d5eSAndre Fischer             maStrikeControl.RequestUpdate();
129545da7d5eSAndre Fischer             break;
129645da7d5eSAndre Fischer         case SID_ATTR_CHAR_SHADOWED:
129745da7d5eSAndre Fischer             maShadowControl.RequestUpdate();
129845da7d5eSAndre Fischer             break;
129945da7d5eSAndre Fischer         case SID_ATTR_CHAR_COLOR:
130045da7d5eSAndre Fischer             maFontColorControl.RequestUpdate();
130145da7d5eSAndre Fischer             break;
130245da7d5eSAndre Fischer         case SID_ATTR_CHAR_ESCAPEMENT:
130345da7d5eSAndre Fischer             maScriptControlSw.RequestUpdate();
130445da7d5eSAndre Fischer             break;
130545da7d5eSAndre Fischer         case SID_SET_SUPER_SCRIPT:
130645da7d5eSAndre Fischer             maSuperScriptControl.RequestUpdate();
130745da7d5eSAndre Fischer             break;
130845da7d5eSAndre Fischer         case SID_SET_SUB_SCRIPT:
130945da7d5eSAndre Fischer             maSubScriptControl.RequestUpdate();
131045da7d5eSAndre Fischer             break;
131145da7d5eSAndre Fischer         case SID_ATTR_CHAR_KERNING:
131245da7d5eSAndre Fischer             maSpacingControl.RequestUpdate();
131345da7d5eSAndre Fischer             break;
131445da7d5eSAndre Fischer         case SID_ATTR_BRUSH_CHAR:
131545da7d5eSAndre Fischer             maHighlightControl.RequestUpdate();
131645da7d5eSAndre Fischer             break;
131745da7d5eSAndre Fischer         case SID_GROW_FONT_SIZE:
131845da7d5eSAndre Fischer             maSDFontGrow.RequestUpdate();
131945da7d5eSAndre Fischer             break;
132045da7d5eSAndre Fischer         case SID_SHRINK_FONT_SIZE:
132145da7d5eSAndre Fischer             maSDFontShrink.RequestUpdate();
132245da7d5eSAndre Fischer             break;
132345da7d5eSAndre Fischer     }
1324b9e67834SAndre Fischer }
1325b9e67834SAndre Fischer 
1326b9e67834SAndre Fischer 
1327b9e67834SAndre Fischer 
1328b9e67834SAndre Fischer 
1329b9e67834SAndre Fischer 
1330d4aefcaeSZheng Fan void TextPropertyPanel::SetFontColor (
1331a7d1eb6fSPavel Janík     const String& /* rsColorName */,
1332d4aefcaeSZheng Fan     const Color aColor)
1333d4aefcaeSZheng Fan {
1334d4aefcaeSZheng Fan     SvxColorItem aColorItem(aColor, SID_ATTR_CHAR_COLOR);
1335d4aefcaeSZheng Fan     mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_COLOR, SFX_CALLMODE_RECORD, &aColorItem, 0L);
1336d4aefcaeSZheng Fan     maColor = aColor;
1337d4aefcaeSZheng Fan }
1338d4aefcaeSZheng Fan 
1339d4aefcaeSZheng Fan void TextPropertyPanel::SetBrushColor (
1340a7d1eb6fSPavel Janík     const String& /* rsColorName */,
1341d4aefcaeSZheng Fan     const Color aColor)
1342d4aefcaeSZheng Fan {
1343d4aefcaeSZheng Fan     SvxBrushItem aBrushItem(aColor, SID_ATTR_BRUSH_CHAR);
1344d4aefcaeSZheng Fan     mpBindings->GetDispatcher()->Execute(SID_ATTR_BRUSH_CHAR, SFX_CALLMODE_RECORD, &aBrushItem, 0L);
1345d4aefcaeSZheng Fan     maBackColor = aColor;
1346d4aefcaeSZheng Fan }
1347d4aefcaeSZheng Fan 
1348da72173fSAndre Fischer Color& TextPropertyPanel::GetUnderlineColor()
1349da72173fSAndre Fischer {
1350da72173fSAndre Fischer     return meUnderlineColor;
1351da72173fSAndre Fischer }
1352d4aefcaeSZheng Fan 
1353da72173fSAndre Fischer void TextPropertyPanel::SetUnderline(FontUnderline  eUnderline)
1354da72173fSAndre Fischer {
1355da72173fSAndre Fischer     meUnderline = eUnderline;
1356da72173fSAndre Fischer }
1357d4aefcaeSZheng Fan 
135845da7d5eSAndre Fischer 
135945da7d5eSAndre Fischer 
1360b9e67834SAndre Fischer } } // end of namespace svx::sidebar
1361