xref: /trunk/main/svx/source/sidebar/text/TextPropertyPanel.cxx (revision 45da7d5eec8bb670617c18931b2b362b2fb77cde)
1b9e67834SAndre Fischer /**************************************************************
2b9e67834SAndre Fischer  *
3b9e67834SAndre Fischer  * Licensed to the Apache Software Foundation (ASF) under one
4b9e67834SAndre Fischer  * or more contributor license agreements.  See the NOTICE file
5b9e67834SAndre Fischer  * distributed with this work for additional information
6b9e67834SAndre Fischer  * regarding copyright ownership.  The ASF licenses this file
7b9e67834SAndre Fischer  * to you under the Apache License, Version 2.0 (the
8b9e67834SAndre Fischer  * "License"); you may not use this file except in compliance
9b9e67834SAndre Fischer  * with the License.  You may obtain a copy of the License at
10b9e67834SAndre Fischer  *
11b9e67834SAndre Fischer  *   http://www.apache.org/licenses/LICENSE-2.0
12b9e67834SAndre Fischer  *
13b9e67834SAndre Fischer  * Unless required by applicable law or agreed to in writing,
14b9e67834SAndre Fischer  * software distributed under the License is distributed on an
15b9e67834SAndre Fischer  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16b9e67834SAndre Fischer  * KIND, either express or implied.  See the License for the
17b9e67834SAndre Fischer  * specific language governing permissions and limitations
18b9e67834SAndre Fischer  * under the License.
19b9e67834SAndre Fischer  *
20b9e67834SAndre Fischer  *************************************************************/
21b9e67834SAndre Fischer 
22b9e67834SAndre Fischer #include "precompiled_svx.hxx"
23b9e67834SAndre Fischer 
24b9e67834SAndre Fischer #include "TextPropertyPanel.hrc"
25b9e67834SAndre Fischer #include "TextPropertyPanel.hxx"
26b9e67834SAndre Fischer #include "SvxSBFontNameBox.hxx"
27b9e67834SAndre Fischer 
28b9e67834SAndre Fischer #include "svx/dialmgr.hxx"
29b9e67834SAndre Fischer 
30b9e67834SAndre Fischer #include <editeng/brshitem.hxx>
31b9e67834SAndre Fischer #include <editeng/colritem.hxx>
32b9e67834SAndre Fischer #include <editeng/crsditem.hxx>
33b9e67834SAndre Fischer #include <editeng/escpitem.hxx>
34b9e67834SAndre Fischer #include <editeng/flstitem.hxx>
35b9e67834SAndre Fischer #include <editeng/fontitem.hxx>
36b9e67834SAndre Fischer #include <editeng/kernitem.hxx>
37b9e67834SAndre Fischer #include <editeng/postitem.hxx>
38b9e67834SAndre Fischer #include <editeng/shdditem.hxx>
39b9e67834SAndre Fischer #include <editeng/udlnitem.hxx>
40b9e67834SAndre Fischer #include <editeng/wghtitem.hxx>
41b9e67834SAndre Fischer #include <rtl/ref.hxx>
42b9e67834SAndre Fischer #include <sfx2/dispatch.hxx>
43b9e67834SAndre Fischer #include <sfx2/objsh.hxx>
44b9e67834SAndre Fischer #include <sfx2/viewsh.hxx>
45b9e67834SAndre Fischer #include <sfx2/sidebar/propertypanel.hrc>
46b9e67834SAndre Fischer #include <sfx2/sidebar/ControlFactory.hxx>
47b9e67834SAndre Fischer #include <sfx2/sidebar/Theme.hxx>
4895a18594SAndre Fischer #include "sfx2/imagemgr.hxx"
49b9e67834SAndre Fischer #include <svtools/ctrltool.hxx>
50b9e67834SAndre Fischer #include <svtools/unitconv.hxx>
51b9e67834SAndre Fischer 
52b9e67834SAndre Fischer #include <vcl/gradient.hxx>
53b9e67834SAndre Fischer #include <vcl/svapp.hxx>
5495a18594SAndre Fischer #include <vcl/toolbox.hxx>
55d4aefcaeSZheng Fan #include "TextCharacterSpacingControl.hxx"
56d4aefcaeSZheng Fan #include "TextCharacterSpacingPopup.hxx"
57d4aefcaeSZheng Fan #include "TextUnderlineControl.hxx"
58d4aefcaeSZheng Fan #include "TextUnderlinePopup.hxx"
59facb16e7SArmin Le Grand #include <svx/sidebar/ColorControl.hxx>
60facb16e7SArmin Le Grand #include <svx/sidebar/PopupContainer.hxx>
61d4aefcaeSZheng Fan 
62d4aefcaeSZheng Fan #include <boost/bind.hpp>
63b9e67834SAndre Fischer 
64b9e67834SAndre Fischer using namespace css;
65b9e67834SAndre Fischer using namespace cssu;
66b9e67834SAndre Fischer using ::sfx2::sidebar::Theme;
677a32b0c8SAndre Fischer using ::sfx2::sidebar::ControlFactory;
68b9e67834SAndre Fischer 
69b9e67834SAndre Fischer #define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
70b9e67834SAndre Fischer 
71b9e67834SAndre Fischer namespace svx { namespace sidebar {
72b9e67834SAndre Fischer 
73b9e67834SAndre Fischer #undef HAS_IA2
74b9e67834SAndre Fischer 
75b9e67834SAndre Fischer 
76b9e67834SAndre Fischer #define FONT_CONTROL_WIDTH      160
77b9e67834SAndre Fischer #define SIZE_CONTROL_WIDTH      80
78b9e67834SAndre Fischer #define CONTROL_COMBOX_HEIGHT   20
79b9e67834SAndre Fischer #define CONTROL_HEIGHT_5X       120
80d4aefcaeSZheng Fan 
81d4aefcaeSZheng Fan 
82b9e67834SAndre Fischer #define TEXT_SECTIONPAGE_HEIGHT_S   SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT  + ( TOOLBOX_ITEM_HEIGHT + 2 ) + CONTROL_SPACING_VERTICAL * 1 + SECTIONPAGE_MARGIN_VERTICAL_BOT
83b9e67834SAndre Fischer #define TEXT_SECTIONPAGE_HEIGHT     SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT  + ( TOOLBOX_ITEM_HEIGHT + 2 ) * 2 + CONTROL_SPACING_VERTICAL * 2 + SECTIONPAGE_MARGIN_VERTICAL_BOT
84b9e67834SAndre Fischer 
85b9e67834SAndre Fischer //
86d4aefcaeSZheng Fan 
87b9e67834SAndre Fischer //end
88d4aefcaeSZheng Fan PopupControl* TextPropertyPanel::CreateCharacterSpacingControl (PopupContainer* pParent)
89d4aefcaeSZheng Fan {
90*45da7d5eSAndre Fischer     return new TextCharacterSpacingControl(pParent, *this, mpBindings);
91d4aefcaeSZheng Fan }
92b9e67834SAndre Fischer 
93d4aefcaeSZheng Fan PopupControl* TextPropertyPanel::CreateUnderlinePopupControl (PopupContainer* pParent)
94d4aefcaeSZheng Fan {
95*45da7d5eSAndre Fischer     return new TextUnderlineControl(pParent, *this, mpBindings);
96d4aefcaeSZheng Fan }
97b9e67834SAndre Fischer 
98b7a56e95SArmin Le Grand namespace
99b7a56e95SArmin Le Grand {
100b7a56e95SArmin Le Grand     Color GetAutomaticColor(void)
101b7a56e95SArmin Le Grand     {
102b7a56e95SArmin Le Grand         return COL_AUTO;
103b7a56e95SArmin Le Grand     }
104b7a56e95SArmin Le Grand } // end of anonymous namespace
105b7a56e95SArmin Le Grand 
106d4aefcaeSZheng Fan PopupControl* TextPropertyPanel::CreateFontColorPopupControl (PopupContainer* pParent)
107d4aefcaeSZheng Fan {
108b7a56e95SArmin Le Grand     const ResId aResId(SVX_RES(STR_AUTOMATICE));
109b7a56e95SArmin Le Grand 
110d4aefcaeSZheng Fan     return new ColorControl(
111d4aefcaeSZheng Fan         pParent,
112d4aefcaeSZheng Fan         mpBindings,
113d4aefcaeSZheng Fan         SVX_RES(RID_POPUPPANEL_TEXTPAGE_FONT_COLOR),
114d4aefcaeSZheng Fan         SVX_RES(VS_FONT_COLOR),
115b7a56e95SArmin Le Grand         ::boost::bind(GetAutomaticColor),
116d4aefcaeSZheng Fan         ::boost::bind(&TextPropertyPanel::SetFontColor, this, _1,_2),
117d4aefcaeSZheng Fan         pParent,
118b7a56e95SArmin Le Grand         &aResId);
119d4aefcaeSZheng Fan }
120b9e67834SAndre Fischer 
121d4aefcaeSZheng Fan PopupControl* TextPropertyPanel::CreateBrushColorPopupControl (PopupContainer* pParent)
122d4aefcaeSZheng Fan {
123b7a56e95SArmin Le Grand     const ResId aResId(SVX_RES(STR_AUTOMATICE));
124b7a56e95SArmin Le Grand 
125d4aefcaeSZheng Fan     return new ColorControl(
126d4aefcaeSZheng Fan         pParent,
127d4aefcaeSZheng Fan         mpBindings,
128d4aefcaeSZheng Fan         SVX_RES(RID_POPUPPANEL_TEXTPAGE_FONT_COLOR),
129d4aefcaeSZheng Fan         SVX_RES(VS_FONT_COLOR),
130b7a56e95SArmin Le Grand         ::boost::bind(GetAutomaticColor),
131d4aefcaeSZheng Fan         ::boost::bind(&TextPropertyPanel::SetBrushColor, this, _1,_2),
132d4aefcaeSZheng Fan         pParent,
133b7a56e95SArmin Le Grand         &aResId);
134d4aefcaeSZheng Fan }
135d4aefcaeSZheng Fan 
136d4aefcaeSZheng Fan long TextPropertyPanel::GetSelFontSize()
137d4aefcaeSZheng Fan {
138d4aefcaeSZheng Fan     long nH = 240;
139d4aefcaeSZheng Fan     SfxMapUnit eUnit = maSpacingControl.GetCoreMetric();
140d4aefcaeSZheng Fan     if (mpHeightItem)
141d4aefcaeSZheng Fan         nH = LogicToLogic(  mpHeightItem->GetHeight(), (MapUnit)eUnit, MAP_TWIP );
142d4aefcaeSZheng Fan     return nH;
143d4aefcaeSZheng Fan }
144b9e67834SAndre Fischer 
145b9e67834SAndre Fischer 
14695a18594SAndre Fischer TextPropertyPanel* TextPropertyPanel::Create (
147b9e67834SAndre Fischer     Window* pParent,
148b9e67834SAndre Fischer     const cssu::Reference<css::frame::XFrame>& rxFrame,
14937fee4fdSAndre Fischer     SfxBindings* pBindings,
15037fee4fdSAndre Fischer     const cssu::Reference<css::ui::XSidebar>& rxSidebar)
151b9e67834SAndre Fischer {
152b9e67834SAndre Fischer     if (pParent == NULL)
153b9e67834SAndre Fischer         throw lang::IllegalArgumentException(A2S("no parent Window given to TextPropertyPanel::Create"), NULL, 0);
154b9e67834SAndre Fischer     if ( ! rxFrame.is())
155b9e67834SAndre Fischer         throw lang::IllegalArgumentException(A2S("no XFrame given to TextPropertyPanel::Create"), NULL, 1);
156b9e67834SAndre Fischer     if (pBindings == NULL)
157b9e67834SAndre Fischer         throw lang::IllegalArgumentException(A2S("no SfxBindings given to TextPropertyPanel::Create"), NULL, 2);
158b9e67834SAndre Fischer 
15995a18594SAndre Fischer     return new TextPropertyPanel(
160b9e67834SAndre Fischer         pParent,
161b9e67834SAndre Fischer         rxFrame,
16237fee4fdSAndre Fischer         pBindings,
16337fee4fdSAndre Fischer         rxSidebar);
164b9e67834SAndre Fischer }
165b9e67834SAndre Fischer 
166b9e67834SAndre Fischer 
167d4aefcaeSZheng Fan ::sfx2::sidebar::ControllerItem& TextPropertyPanel::GetSpaceController()
168d4aefcaeSZheng Fan {
169d4aefcaeSZheng Fan     return maSpacingControl;
170d4aefcaeSZheng Fan }
171b9e67834SAndre Fischer 
172b9e67834SAndre Fischer TextPropertyPanel::TextPropertyPanel (
173b9e67834SAndre Fischer     Window* pParent,
174b9e67834SAndre Fischer     const cssu::Reference<css::frame::XFrame>& rxFrame,
17537fee4fdSAndre Fischer     SfxBindings* pBindings,
17637fee4fdSAndre Fischer     const cssu::Reference<css::ui::XSidebar>& rxSidebar)
17795a18594SAndre Fischer     :   Control(pParent, SVX_RES(RID_SIDEBAR_TEXT_PANEL)),
178b9e67834SAndre Fischer         mpFontNameBox (new SvxSBFontNameBox(this, SVX_RES(CB_SBFONT_FONT))),
179b9e67834SAndre Fischer         maFontSizeBox       (this, SVX_RES(MB_SBFONT_FONTSIZE)),
1807a32b0c8SAndre Fischer         mpToolBoxIncDecBackground(ControlFactory::CreateToolBoxBackground(this)),
1817a32b0c8SAndre Fischer         mpToolBoxIncDec(ControlFactory::CreateToolBox(
1827a32b0c8SAndre Fischer                 mpToolBoxIncDecBackground.get(),
1837a32b0c8SAndre Fischer                 SVX_RES(TB_INCREASE_DECREASE))),
1847a32b0c8SAndre Fischer         mpToolBoxFontBackground(ControlFactory::CreateToolBoxBackground(this)),
1857a32b0c8SAndre Fischer         mpToolBoxFont(ControlFactory::CreateToolBox(
1867a32b0c8SAndre Fischer                 mpToolBoxFontBackground.get(),
1877a32b0c8SAndre Fischer                 SVX_RES(TB_FONT))),
1887a32b0c8SAndre Fischer         mpToolBoxFontColorBackground(ControlFactory::CreateToolBoxBackground(this)),
1897a32b0c8SAndre Fischer         mpToolBoxFontColor(ControlFactory::CreateToolBox(
1907a32b0c8SAndre Fischer                 mpToolBoxFontColorBackground.get(),
1917a32b0c8SAndre Fischer                 SVX_RES(TB_FONTCOLOR))),
1927a32b0c8SAndre Fischer         mpToolBoxScriptBackground(ControlFactory::CreateToolBoxBackground(this)),
1937a32b0c8SAndre Fischer         mpToolBoxScript(ControlFactory::CreateToolBox(
1947a32b0c8SAndre Fischer                 mpToolBoxScriptBackground.get(),
1957a32b0c8SAndre Fischer                 SVX_RES(TB_SCRIPT))),
1967a32b0c8SAndre Fischer         mpToolBoxScriptSwBackground(ControlFactory::CreateToolBoxBackground(this)),
1977a32b0c8SAndre Fischer         mpToolBoxScriptSw(ControlFactory::CreateToolBox(
1987a32b0c8SAndre Fischer                 mpToolBoxScriptSwBackground.get(),
1997a32b0c8SAndre Fischer                 SVX_RES(TB_SCRIPT_SW))),
2007a32b0c8SAndre Fischer         mpToolBoxSpacingBackground(ControlFactory::CreateToolBoxBackground(this)),
2017a32b0c8SAndre Fischer         mpToolBoxSpacing(ControlFactory::CreateToolBox(
2027a32b0c8SAndre Fischer                 mpToolBoxSpacingBackground.get(),
2037a32b0c8SAndre Fischer                 SVX_RES(TB_SPACING))),
2047a32b0c8SAndre Fischer         mpToolBoxHighlightBackground(ControlFactory::CreateToolBoxBackground(this)),
2057a32b0c8SAndre Fischer         mpToolBoxHighlight(ControlFactory::CreateToolBox(
2067a32b0c8SAndre Fischer                 mpToolBoxHighlightBackground.get(),
2077a32b0c8SAndre Fischer                 SVX_RES(TB_HIGHLIGHT))),
208b9e67834SAndre Fischer         mpFontColorUpdater(),
209b9e67834SAndre Fischer         mpHighlightUpdater(),
210b9e67834SAndre Fischer 
211*45da7d5eSAndre Fischer         maFontNameControl   (SID_ATTR_CHAR_FONT,        *pBindings, *this, A2S("CharFontName"), rxFrame),
212*45da7d5eSAndre Fischer         maFontSizeControl   (SID_ATTR_CHAR_FONTHEIGHT,  *pBindings, *this, A2S("FontHeight"),   rxFrame),
213*45da7d5eSAndre Fischer         maWeightControl     (SID_ATTR_CHAR_WEIGHT,      *pBindings, *this, A2S("Bold"),         rxFrame),
214*45da7d5eSAndre Fischer         maItalicControl     (SID_ATTR_CHAR_POSTURE,     *pBindings, *this, A2S("Italic"),       rxFrame),
215*45da7d5eSAndre Fischer         maUnderlineControl  (SID_ATTR_CHAR_UNDERLINE,   *pBindings, *this, A2S("Underline"),    rxFrame),
216*45da7d5eSAndre Fischer         maStrikeControl     (SID_ATTR_CHAR_STRIKEOUT,   *pBindings, *this, A2S("Strikeout"),    rxFrame),
217*45da7d5eSAndre Fischer         maShadowControl     (SID_ATTR_CHAR_SHADOWED,    *pBindings, *this, A2S("Shadowed"),     rxFrame),
218*45da7d5eSAndre Fischer         maFontColorControl  (SID_ATTR_CHAR_COLOR,       *pBindings, *this, A2S("Color"),        rxFrame),
219*45da7d5eSAndre Fischer         maScriptControlSw   (SID_ATTR_CHAR_ESCAPEMENT,  *pBindings, *this, A2S("Escapement"),   rxFrame),
220*45da7d5eSAndre Fischer         maSuperScriptControl(SID_SET_SUPER_SCRIPT,      *pBindings, *this, A2S("SuperScript"),  rxFrame),
221*45da7d5eSAndre Fischer         maSubScriptControl  (SID_SET_SUB_SCRIPT,        *pBindings, *this, A2S("SubScript"),    rxFrame),
222*45da7d5eSAndre Fischer         maSpacingControl    (SID_ATTR_CHAR_KERNING,     *pBindings, *this, A2S("Spacing"),      rxFrame),
223*45da7d5eSAndre Fischer         maHighlightControl  (SID_ATTR_BRUSH_CHAR, *pBindings, *this, A2S("CharacterBackgroundPattern"),rxFrame),
224*45da7d5eSAndre Fischer         maSDFontGrow        (SID_GROW_FONT_SIZE,        *pBindings, *this, A2S("Grow"),         rxFrame),
225*45da7d5eSAndre Fischer         maSDFontShrink      (SID_SHRINK_FONT_SIZE,      *pBindings, *this, A2S("Shrink"),       rxFrame),
226b9e67834SAndre Fischer 
227b9e67834SAndre Fischer         mpFontList          (NULL),
228b9e67834SAndre Fischer         mbMustDelete        (false),
229b9e67834SAndre Fischer         mbFocusOnFontSizeCtrl(false),
230a7d1eb6fSPavel Janík         maCharSpacePopup(this, ::boost::bind(&TextPropertyPanel::CreateCharacterSpacingControl, this, _1)),
231a7d1eb6fSPavel Janík         maUnderlinePopup(this, ::boost::bind(&TextPropertyPanel::CreateUnderlinePopupControl, this, _1)),
232a7d1eb6fSPavel Janík         maFontColorPopup(this, ::boost::bind(&TextPropertyPanel::CreateFontColorPopupControl, this, _1)),
233a7d1eb6fSPavel Janík         maBrushColorPopup(this, ::boost::bind(&TextPropertyPanel::CreateBrushColorPopupControl, this, _1)),
23495a18594SAndre Fischer         mxFrame(rxFrame),
235b9e67834SAndre Fischer         maContext(),
23637fee4fdSAndre Fischer         mpBindings(pBindings),
23737fee4fdSAndre Fischer         mxSidebar(rxSidebar)
238b9e67834SAndre Fischer {
239b9e67834SAndre Fischer     Initialize();
240b9e67834SAndre Fischer     FreeResource();
241b9e67834SAndre Fischer }
242b9e67834SAndre Fischer 
243b9e67834SAndre Fischer 
244b9e67834SAndre Fischer 
245b9e67834SAndre Fischer 
246b9e67834SAndre Fischer TextPropertyPanel::~TextPropertyPanel (void)
247b9e67834SAndre Fischer {
248b9e67834SAndre Fischer     if(mbMustDelete)
249b9e67834SAndre Fischer         delete mpFontList;
250b9e67834SAndre Fischer 
2517a32b0c8SAndre Fischer     // Destroy the toolbox windows.
2527a32b0c8SAndre Fischer     mpToolBoxIncDec.reset();
2537a32b0c8SAndre Fischer     mpToolBoxFont.reset();
2547a32b0c8SAndre Fischer     mpToolBoxFontColor.reset();
2557a32b0c8SAndre Fischer     mpToolBoxScript.reset();
2567a32b0c8SAndre Fischer     mpToolBoxScriptSw.reset();
2577a32b0c8SAndre Fischer     mpToolBoxSpacing.reset();
2587a32b0c8SAndre Fischer     mpToolBoxHighlight.reset();
2597a32b0c8SAndre Fischer 
2607a32b0c8SAndre Fischer     // Destroy the background windows of the toolboxes.
2617a32b0c8SAndre Fischer     mpToolBoxIncDecBackground.reset();
2627a32b0c8SAndre Fischer     mpToolBoxFontBackground.reset();
2637a32b0c8SAndre Fischer     mpToolBoxFontColorBackground.reset();
2647a32b0c8SAndre Fischer     mpToolBoxScriptBackground.reset();
2657a32b0c8SAndre Fischer     mpToolBoxScriptSwBackground.reset();
2667a32b0c8SAndre Fischer     mpToolBoxSpacingBackground.reset();
2677a32b0c8SAndre Fischer     mpToolBoxHighlightBackground.reset();
268b9e67834SAndre Fischer }
269b9e67834SAndre Fischer 
270b9e67834SAndre Fischer 
271b9e67834SAndre Fischer 
272b9e67834SAndre Fischer 
273d4aefcaeSZheng Fan void TextPropertyPanel::SetSpacing(long nKern)
274d4aefcaeSZheng Fan {
275d4aefcaeSZheng Fan     mlKerning = nKern;
276d4aefcaeSZheng Fan }
27795a18594SAndre Fischer 
27895a18594SAndre Fischer 
279b9e67834SAndre Fischer void TextPropertyPanel::HandleContextChange (
280b9e67834SAndre Fischer     const ::sfx2::sidebar::EnumContext aContext)
281b9e67834SAndre Fischer {
282b9e67834SAndre Fischer     if (maContext == aContext)
283b9e67834SAndre Fischer     {
284b9e67834SAndre Fischer         // Nothing to do.
285b9e67834SAndre Fischer         return;
286b9e67834SAndre Fischer     }
287b9e67834SAndre Fischer 
288b9e67834SAndre Fischer     maContext = aContext;
28937fee4fdSAndre Fischer     switch (maContext.GetCombinedContext_DI())
290b9e67834SAndre Fischer     {
291b9e67834SAndre Fischer         case CombinedEnumContext(Application_Calc, Context_Cell):
292b9e67834SAndre Fischer         case CombinedEnumContext(Application_Calc, Context_Pivot):
293b9e67834SAndre Fischer         {
294b9e67834SAndre Fischer             mpToolBoxScript->Hide();
295b9e67834SAndre Fischer             mpToolBoxScriptSw->Hide();
296b9e67834SAndre Fischer             mpToolBoxSpacing->Hide();
297b9e67834SAndre Fischer             mpToolBoxHighlight->Hide();
298b9e67834SAndre Fischer 
299b9e67834SAndre Fischer             Size aSize(PROPERTYPAGE_WIDTH,TEXT_SECTIONPAGE_HEIGHT_S);
300b9e67834SAndre Fischer             aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) );
301b9e67834SAndre Fischer             aSize.setWidth(GetOutputSizePixel().Width());
302b9e67834SAndre Fischer             SetSizePixel(aSize);
30337fee4fdSAndre Fischer             if (mxSidebar.is())
30437fee4fdSAndre Fischer                 mxSidebar->requestLayout();
305b9e67834SAndre Fischer             break;
306b9e67834SAndre Fischer         }
307b9e67834SAndre Fischer 
30837fee4fdSAndre Fischer         case CombinedEnumContext(Application_WriterAndWeb, Context_Text):
30937fee4fdSAndre Fischer         case CombinedEnumContext(Application_WriterAndWeb, Context_Table):
310b9e67834SAndre Fischer         {
311b9e67834SAndre Fischer             mpToolBoxScriptSw->Show();
312b9e67834SAndre Fischer             mpToolBoxScript->Hide();
313b9e67834SAndre Fischer             mpToolBoxHighlight->Show();
314b9e67834SAndre Fischer             mpToolBoxSpacing->Show();
315b9e67834SAndre Fischer 
316b9e67834SAndre Fischer             Size aSize(PROPERTYPAGE_WIDTH, TEXT_SECTIONPAGE_HEIGHT);
317b9e67834SAndre Fischer             aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) );
318b9e67834SAndre Fischer             aSize.setWidth(GetOutputSizePixel().Width());
319b9e67834SAndre Fischer             SetSizePixel(aSize);
32037fee4fdSAndre Fischer             if (mxSidebar.is())
32137fee4fdSAndre Fischer                 mxSidebar->requestLayout();
322b9e67834SAndre Fischer             break;
323b9e67834SAndre Fischer         }
324b9e67834SAndre Fischer 
325b9e67834SAndre Fischer         case CombinedEnumContext(Application_Writer, Context_DrawText):
326b9e67834SAndre Fischer         case CombinedEnumContext(Application_Writer, Context_Annotation):
327b9e67834SAndre Fischer         {
328b9e67834SAndre Fischer             mpToolBoxScriptSw->Show();
329b9e67834SAndre Fischer             mpToolBoxScript->Hide();
330b9e67834SAndre Fischer             mpToolBoxSpacing->Show();
331b9e67834SAndre Fischer             mpToolBoxHighlight->Hide();
332b9e67834SAndre Fischer 
333b9e67834SAndre Fischer             Size aSize(PROPERTYPAGE_WIDTH,TEXT_SECTIONPAGE_HEIGHT);
334b9e67834SAndre Fischer             aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) );
335b9e67834SAndre Fischer             aSize.setWidth(GetOutputSizePixel().Width());
336b9e67834SAndre Fischer             SetSizePixel(aSize);
33737fee4fdSAndre Fischer             if (mxSidebar.is())
33837fee4fdSAndre Fischer                 mxSidebar->requestLayout();
339b9e67834SAndre Fischer             break;
340b9e67834SAndre Fischer         }
341b9e67834SAndre Fischer 
342b9e67834SAndre Fischer         case CombinedEnumContext(Application_Calc, Context_EditCell):
343b9e67834SAndre Fischer         case CombinedEnumContext(Application_Calc, Context_DrawText):
34437fee4fdSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
34537fee4fdSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_Text):
34637fee4fdSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_Table):
34737fee4fdSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_OutlineText):
34837fee4fdSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_Draw):
34937fee4fdSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
35037fee4fdSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
351b9e67834SAndre Fischer         {
352b9e67834SAndre Fischer             mpToolBoxScriptSw->Hide();
353b9e67834SAndre Fischer             mpToolBoxScript->Show();
354b9e67834SAndre Fischer             mpToolBoxSpacing->Show();
355b9e67834SAndre Fischer             mpToolBoxHighlight->Hide();
356b9e67834SAndre Fischer 
357b9e67834SAndre Fischer             Size aSize(PROPERTYPAGE_WIDTH,TEXT_SECTIONPAGE_HEIGHT);
358b9e67834SAndre Fischer             aSize = LogicToPixel( aSize,MapMode(MAP_APPFONT) );
359b9e67834SAndre Fischer             aSize.setWidth(GetOutputSizePixel().Width());
360b9e67834SAndre Fischer             SetSizePixel(aSize);
36137fee4fdSAndre Fischer             if (mxSidebar.is())
36237fee4fdSAndre Fischer                 mxSidebar->requestLayout();
363b9e67834SAndre Fischer             break;
364b9e67834SAndre Fischer         }
365b9e67834SAndre Fischer 
366b9e67834SAndre Fischer         default:
367b9e67834SAndre Fischer             break;
368b9e67834SAndre Fischer     }
369b9e67834SAndre Fischer }
370b9e67834SAndre Fischer 
371*45da7d5eSAndre Fischer 
372b9e67834SAndre Fischer 
373b9e67834SAndre Fischer 
374b9e67834SAndre Fischer void TextPropertyPanel::DataChanged (const DataChangedEvent& rEvent)
375b9e67834SAndre Fischer {
37695a18594SAndre Fischer     (void)rEvent;
37795a18594SAndre Fischer 
378*45da7d5eSAndre Fischer     SetupToolboxItems();
379b9e67834SAndre Fischer }
380b9e67834SAndre Fischer 
381b9e67834SAndre Fischer 
382b9e67834SAndre Fischer 
383b9e67834SAndre Fischer void TextPropertyPanel::Initialize (void)
384b9e67834SAndre Fischer {
385b9e67834SAndre Fischer     //<<modify fill font list
386b9e67834SAndre Fischer     SfxObjectShell* pDocSh = SfxObjectShell::Current();
387b9e67834SAndre Fischer     const SfxPoolItem* pItem = NULL;
388b9e67834SAndre Fischer 
389b9e67834SAndre Fischer     if (pDocSh != NULL)
390b9e67834SAndre Fischer         pItem = pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST );
391b9e67834SAndre Fischer     if (pItem != NULL)
392b9e67834SAndre Fischer         mpFontList = ( (SvxFontListItem*)pItem )->GetFontList();
393b9e67834SAndre Fischer     else
394b9e67834SAndre Fischer     {
395b9e67834SAndre Fischer         mpFontList = new FontList( Application::GetDefaultDevice() );
396*45da7d5eSAndre Fischer         mbMustDelete = true;
397b9e67834SAndre Fischer     }
398b9e67834SAndre Fischer 
399b9e67834SAndre Fischer     mpFontNameBox->SetAccessibleName(mpFontNameBox->GetQuickHelpText());
40095a18594SAndre Fischer     const FontInfo aFontInfo (mpFontList->Get( String::CreateFromAscii( "" ), String::CreateFromAscii( "" )));
40195a18594SAndre Fischer     maFontSizeBox.Fill(&aFontInfo,mpFontList);
402b9e67834SAndre Fischer     maFontSizeBox.SetAccessibleName(maFontSizeBox.GetQuickHelpText());
403b9e67834SAndre Fischer 
404b9e67834SAndre Fischer     //toolbox
405*45da7d5eSAndre Fischer     SetupToolboxItems();
406b9e67834SAndre Fischer     InitToolBoxIncDec();
407b9e67834SAndre Fischer     InitToolBoxFont();
408b9e67834SAndre Fischer     InitToolBoxFontColor();
409b9e67834SAndre Fischer     InitToolBoxScript();
410b9e67834SAndre Fischer     InitToolBoxSpacing();
411b9e67834SAndre Fischer     InitToolBoxHighlight();
412b9e67834SAndre Fischer 
413b9e67834SAndre Fischer #ifdef HAS_IA2
414d4aefcaeSZheng Fan     mpFontNameBox->SetAccRelationLabeledBy(&mpFontNameBox);
415d4aefcaeSZheng Fan     mpFontNameBox->SetMpSubEditAccLableBy(&mpFontNameBox);
416b9e67834SAndre Fischer     maFontSizeBox.SetAccRelationLabeledBy(&maFontSizeBox);
417b9e67834SAndre Fischer     maFontSizeBox.SetMpSubEditAccLableBy(&maFontSizeBox);
418d4aefcaeSZheng Fan     mpToolBoxFont.SetAccRelationLabeledBy(&mpToolBoxFont);
419d4aefcaeSZheng Fan     mpToolBoxIncDec.SetAccRelationLabeledBy(&mpToolBoxIncDec);
420d4aefcaeSZheng Fan     mpToolBoxFontColor.SetAccRelationLabeledBy(&mpToolBoxFontColor);
421d4aefcaeSZheng Fan     mpToolBoxScript.SetAccRelationLabeledBy(&mpToolBoxScript);
422d4aefcaeSZheng Fan     mpToolBoxScriptSw.SetAccRelationLabeledBy(&mpToolBoxScriptSw);
423d4aefcaeSZheng Fan     mpToolBoxSpacing.SetAccRelationLabeledBy(&mpToolBoxSpacing);
424d4aefcaeSZheng Fan     mpToolBoxHighlight.SetAccRelationLabeledBy(&mpToolBoxHighlight);
425b9e67834SAndre Fischer #endif
426b9e67834SAndre Fischer 
427b9e67834SAndre Fischer     //init state
428b9e67834SAndre Fischer     mpHeightItem = NULL;
429b9e67834SAndre Fischer     meWeight = WEIGHT_NORMAL;
430b9e67834SAndre Fischer     meItalic = ITALIC_NONE;
431b9e67834SAndre Fischer     mbShadow = false;
432b9e67834SAndre Fischer     meStrike = STRIKEOUT_NONE;
433b9e67834SAndre Fischer     mbPostureAvailable = true;
434b9e67834SAndre Fischer     mbWeightAvailable = true;
435b9e67834SAndre Fischer     meUnderline = UNDERLINE_NONE;
436b9e67834SAndre Fischer     meUnderlineColor = COL_AUTO;   //
437b9e67834SAndre Fischer     maColor = COL_BLACK;
438b9e67834SAndre Fischer     mbColorAvailable = true;
439b9e67834SAndre Fischer     maBackColor = COL_AUTO;
440b9e67834SAndre Fischer     mbBackColorAvailable = true;
441b9e67834SAndre Fischer     meColorType = FONT_COLOR;
442b9e67834SAndre Fischer     meEscape = SVX_ESCAPEMENT_OFF;
443b9e67834SAndre Fischer     mbSuper = false;
444b9e67834SAndre Fischer     mbSub = false;
445b9e67834SAndre Fischer     mbKernAvailable = true;
446b9e67834SAndre Fischer     mbKernLBAvailable = true;
447b9e67834SAndre Fischer     mlKerning = 0;
448b9e67834SAndre Fischer     mpFontColorUpdater.reset(new ToolboxButtonColorUpdater(
449b9e67834SAndre Fischer             SID_ATTR_CHAR_COLOR,
450b9e67834SAndre Fischer             TBI_FONTCOLOR,
451b9e67834SAndre Fischer             mpToolBoxFontColor.get(),
452b9e67834SAndre Fischer             TBX_UPDATER_MODE_CHAR_COLOR_NEW));
453b9e67834SAndre Fischer     mpHighlightUpdater.reset(new ToolboxButtonColorUpdater(
454b9e67834SAndre Fischer             SID_ATTR_BRUSH_CHAR,
455b9e67834SAndre Fischer             TBI_HIGHLIGHT,
456b9e67834SAndre Fischer             mpToolBoxHighlight.get(),
457b9e67834SAndre Fischer             TBX_UPDATER_MODE_CHAR_COLOR_NEW));
458b9e67834SAndre Fischer 
459b9e67834SAndre Fischer     //set handler
460b9e67834SAndre Fischer     mpFontNameBox->SetBindings(mpBindings);
461b9e67834SAndre Fischer     //add
462b9e67834SAndre Fischer     Link aLink = LINK(this, TextPropertyPanel, FontSelHdl);
463b9e67834SAndre Fischer     mpFontNameBox->SetSelectHdl(aLink);
464b9e67834SAndre Fischer     //add end
465b9e67834SAndre Fischer 
466b9e67834SAndre Fischer     aLink = LINK(this, TextPropertyPanel, FontSizeModifyHdl);
467b9e67834SAndre Fischer     maFontSizeBox.SetModifyHdl(aLink);
468b9e67834SAndre Fischer     //add
469b9e67834SAndre Fischer     aLink = LINK(this, TextPropertyPanel, FontSizeSelHdl);
470b9e67834SAndre Fischer     maFontSizeBox.SetSelectHdl(aLink);
471b9e67834SAndre Fischer     //add end
472b9e67834SAndre Fischer     aLink = LINK(this, TextPropertyPanel, FontSizeLoseFocus);
473b9e67834SAndre Fischer     maFontSizeBox.SetLoseFocusHdl(aLink);
474b9e67834SAndre Fischer 
475b9e67834SAndre Fischer     // add
476b9e67834SAndre Fischer     long aSizeBoxHeight = maFontSizeBox.GetSizePixel().getHeight();;
477b9e67834SAndre Fischer     Point aPosFontSize = maFontSizeBox.GetPosPixel();
478b9e67834SAndre Fischer     long aPosY = aPosFontSize.getY();
479b9e67834SAndre Fischer     Point pTBIncDec = mpToolBoxIncDec->GetPosPixel();
480b9e67834SAndre Fischer     long aIncDecHeight = mpToolBoxIncDec->GetSizePixel().getHeight();
481b9e67834SAndre Fischer     pTBIncDec.setY(aPosY+aSizeBoxHeight/2-aIncDecHeight/2);
482b9e67834SAndre Fischer     mpToolBoxIncDec->SetPosPixel(pTBIncDec);
483b9e67834SAndre Fischer     //end
484b9e67834SAndre Fischer }
485b9e67834SAndre Fischer 
486d4aefcaeSZheng Fan void TextPropertyPanel::EndSpacingPopupMode (void)
487d4aefcaeSZheng Fan {
488d4aefcaeSZheng Fan     maCharSpacePopup.Hide();
489d4aefcaeSZheng Fan }
490b9e67834SAndre Fischer 
491d4aefcaeSZheng Fan void TextPropertyPanel::EndUnderlinePopupMode (void)
492d4aefcaeSZheng Fan {
493d4aefcaeSZheng Fan     maUnderlinePopup.Hide();
494d4aefcaeSZheng Fan }
495b9e67834SAndre Fischer 
496b9e67834SAndre Fischer 
497b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxFont()
498b9e67834SAndre Fischer {
499b9e67834SAndre Fischer     mpToolBoxFont->SetBackground(Wallpaper());
500b9e67834SAndre Fischer     mpToolBoxFont->SetPaintTransparent(true);
501b9e67834SAndre Fischer 
502b9e67834SAndre Fischer     Size aTbxSize( mpToolBoxFont->CalcWindowSizePixel() );
503b9e67834SAndre Fischer     mpToolBoxFont->SetOutputSizePixel( aTbxSize );
504b9e67834SAndre Fischer 
505b9e67834SAndre Fischer     Link aLink  = LINK(this, TextPropertyPanel, ToolboxFontSelectHandler);
506b9e67834SAndre Fischer     mpToolBoxFont->SetSelectHdl ( aLink );
507b9e67834SAndre Fischer     aLink = LINK(this, TextPropertyPanel, ToolBoxUnderlineClickHdl);
508b9e67834SAndre Fischer     mpToolBoxFont->SetDropdownClickHdl(aLink);
509b9e67834SAndre Fischer }
510b9e67834SAndre Fischer 
511b9e67834SAndre Fischer 
512b9e67834SAndre Fischer 
513b9e67834SAndre Fischer 
514b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxIncDec()
515b9e67834SAndre Fischer {
516b9e67834SAndre Fischer     Size aTbxSize( mpToolBoxIncDec->CalcWindowSizePixel() );
517b9e67834SAndre Fischer     mpToolBoxIncDec->SetOutputSizePixel( aTbxSize );
518b9e67834SAndre Fischer 
519b9e67834SAndre Fischer     Link aLink = LINK(this, TextPropertyPanel, ToolboxIncDecSelectHdl);
520b9e67834SAndre Fischer     mpToolBoxIncDec->SetSelectHdl ( aLink );
521b9e67834SAndre Fischer }
522b9e67834SAndre Fischer 
523b9e67834SAndre Fischer 
524b9e67834SAndre Fischer 
525b9e67834SAndre Fischer 
526b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxFontColor()
527b9e67834SAndre Fischer {
528b9e67834SAndre Fischer     Size aTbxSize( mpToolBoxFontColor->CalcWindowSizePixel() );
529b9e67834SAndre Fischer     mpToolBoxFontColor->SetOutputSizePixel( aTbxSize );
530b9e67834SAndre Fischer     mpToolBoxFontColor->SetItemBits( TBI_FONTCOLOR, mpToolBoxFontColor->GetItemBits( TBI_FONTCOLOR ) | TIB_DROPDOWNONLY );
531b9e67834SAndre Fischer 
532b9e67834SAndre Fischer     Link aLink = LINK(this, TextPropertyPanel, ToolBoxFontColorDropHdl);
533b9e67834SAndre Fischer     mpToolBoxFontColor->SetDropdownClickHdl ( aLink );
534b9e67834SAndre Fischer     mpToolBoxFontColor->SetSelectHdl ( aLink );
535b9e67834SAndre Fischer 
536b9e67834SAndre Fischer }
537b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxScript()
538b9e67834SAndre Fischer {
539b9e67834SAndre Fischer     Size aTbxSize( mpToolBoxScriptSw->CalcWindowSizePixel() );
540b9e67834SAndre Fischer     mpToolBoxScriptSw->SetOutputSizePixel( aTbxSize );
541b9e67834SAndre Fischer 
542b9e67834SAndre Fischer     Link aLink = LINK(this, TextPropertyPanel, ToolBoxSwScriptSelectHdl);
543b9e67834SAndre Fischer     mpToolBoxScriptSw->SetSelectHdl ( aLink );
544b9e67834SAndre Fischer 
545b9e67834SAndre Fischer     aTbxSize = mpToolBoxScript->CalcWindowSizePixel() ;
546b9e67834SAndre Fischer     mpToolBoxScript->SetOutputSizePixel( aTbxSize );
547b9e67834SAndre Fischer 
548b9e67834SAndre Fischer     aLink = LINK(this, TextPropertyPanel, ToolBoxScriptSelectHdl);
549b9e67834SAndre Fischer     mpToolBoxScript->SetSelectHdl ( aLink );
550b9e67834SAndre Fischer }
551b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxSpacing()
552b9e67834SAndre Fischer {
553b9e67834SAndre Fischer     Size aTbxSize( mpToolBoxSpacing->CalcWindowSizePixel() );
554b9e67834SAndre Fischer     mpToolBoxSpacing->SetOutputSizePixel( aTbxSize );
555b9e67834SAndre Fischer     mpToolBoxSpacing->SetItemBits( TBI_SPACING, mpToolBoxSpacing->GetItemBits( TBI_SPACING ) | TIB_DROPDOWNONLY );
556b9e67834SAndre Fischer 
557b9e67834SAndre Fischer     Link aLink = LINK(this, TextPropertyPanel, SpacingClickHdl);
558b9e67834SAndre Fischer     mpToolBoxSpacing->SetDropdownClickHdl ( aLink );
559b9e67834SAndre Fischer     mpToolBoxSpacing->SetSelectHdl( aLink );
560b9e67834SAndre Fischer }
561b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxHighlight()
562b9e67834SAndre Fischer {
563b9e67834SAndre Fischer     Size aTbxSize( mpToolBoxHighlight->CalcWindowSizePixel() );
564b9e67834SAndre Fischer     mpToolBoxHighlight->SetOutputSizePixel( aTbxSize );
565b9e67834SAndre Fischer     mpToolBoxHighlight->SetItemBits( TBI_HIGHLIGHT, mpToolBoxHighlight->GetItemBits( TBI_HIGHLIGHT ) | TIB_DROPDOWNONLY );
566b9e67834SAndre Fischer 
567b9e67834SAndre Fischer     Link aLink = LINK(this, TextPropertyPanel, ToolBoxHighlightDropHdl);
568b9e67834SAndre Fischer     mpToolBoxHighlight->SetDropdownClickHdl ( aLink );
569b9e67834SAndre Fischer     mpToolBoxHighlight->SetSelectHdl( aLink );
570b9e67834SAndre Fischer }
571b9e67834SAndre Fischer 
572b9e67834SAndre Fischer 
573b9e67834SAndre Fischer 
574b9e67834SAndre Fischer 
575*45da7d5eSAndre Fischer void TextPropertyPanel::SetupToolboxItems (void)
576b9e67834SAndre Fischer {
577*45da7d5eSAndre Fischer     maSDFontGrow.SetupToolBoxItem(*mpToolBoxIncDec, TBI_INCREASE);
578*45da7d5eSAndre Fischer     maSDFontShrink.SetupToolBoxItem(*mpToolBoxIncDec, TBI_DECREASE);
579b9e67834SAndre Fischer 
580*45da7d5eSAndre Fischer     maWeightControl.SetupToolBoxItem(*mpToolBoxFont, TBI_BOLD);
581*45da7d5eSAndre Fischer     maItalicControl.SetupToolBoxItem(*mpToolBoxFont, TBI_ITALIC);
582*45da7d5eSAndre Fischer     maUnderlineControl.SetupToolBoxItem(*mpToolBoxFont, TBI_UNDERLINE);
583*45da7d5eSAndre Fischer     maStrikeControl.SetupToolBoxItem(*mpToolBoxFont, TBI_STRIKEOUT);
584*45da7d5eSAndre Fischer     maShadowControl.SetupToolBoxItem(*mpToolBoxFont, TBI_SHADOWED);
585b9e67834SAndre Fischer 
586*45da7d5eSAndre Fischer     maFontColorControl.SetupToolBoxItem(*mpToolBoxFontColor, TBI_FONTCOLOR);
587b9e67834SAndre Fischer     //for sw
588*45da7d5eSAndre Fischer     maSuperScriptControl.SetupToolBoxItem(*mpToolBoxScriptSw, TBI_SUPER_SW);
589*45da7d5eSAndre Fischer     maSubScriptControl.SetupToolBoxItem(*mpToolBoxScriptSw, TBI_SUB_SW);
590b9e67834SAndre Fischer     //for sc and sd
591*45da7d5eSAndre Fischer     maSubScriptControl.SetupToolBoxItem(*mpToolBoxScript, TBI_SUPER);
592*45da7d5eSAndre Fischer     maSubScriptControl.SetupToolBoxItem(*mpToolBoxScript, TBI_SUB);
593*45da7d5eSAndre Fischer     maSpacingControl.SetupToolBoxItem(*mpToolBoxSpacing, TBI_SPACING);
594*45da7d5eSAndre Fischer     maHighlightControl.SetupToolBoxItem(*mpToolBoxHighlight, TBI_HIGHLIGHT);
595b9e67834SAndre Fischer }
596b9e67834SAndre Fischer 
597b9e67834SAndre Fischer 
598b9e67834SAndre Fischer 
599b9e67834SAndre Fischer 
600b9e67834SAndre Fischer IMPL_LINK( TextPropertyPanel, FontSelHdl, FontNameBox*, pBox )
601b9e67834SAndre Fischer {
602b9e67834SAndre Fischer     if ( !pBox->IsTravelSelect() )
603b9e67834SAndre Fischer     {
604b9e67834SAndre Fischer         if( SfxViewShell::Current() )
605b9e67834SAndre Fischer         {
606b9e67834SAndre Fischer             Window* pShellWnd = SfxViewShell::Current()->GetWindow();
607b9e67834SAndre Fischer 
608b9e67834SAndre Fischer             if ( pShellWnd )
609b9e67834SAndre Fischer                 pShellWnd->GrabFocus();
610b9e67834SAndre Fischer         }
611b9e67834SAndre Fischer     }
612b9e67834SAndre Fischer     return 0;
613b9e67834SAndre Fischer }
614b9e67834SAndre Fischer //add end
615b9e67834SAndre Fischer IMPL_LINK( TextPropertyPanel, FontSizeModifyHdl, FontSizeBox*, pSizeBox )
616b9e67834SAndre Fischer {
617b9e67834SAndre Fischer     if (pSizeBox == &maFontSizeBox)
618b9e67834SAndre Fischer     {
619b9e67834SAndre Fischer         long nSize = pSizeBox->GetValue();
620b9e67834SAndre Fischer         mbFocusOnFontSizeCtrl = true;
621b9e67834SAndre Fischer 
622b9e67834SAndre Fischer         float fSize = (float)nSize / 10;
623b9e67834SAndre Fischer         SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric();
624b9e67834SAndre Fischer         SvxFontHeightItem aItem( CalcToUnit( fSize, eUnit ), 100, SID_ATTR_CHAR_FONTHEIGHT ) ;
625b9e67834SAndre Fischer 
626b9e67834SAndre Fischer         mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONTHEIGHT, SFX_CALLMODE_RECORD, &aItem, 0L );
627b9e67834SAndre Fischer         mpBindings->Invalidate(SID_ATTR_CHAR_FONTHEIGHT,true,false);
628b9e67834SAndre Fischer     }
629b9e67834SAndre Fischer     return 0;
630b9e67834SAndre Fischer }
631b9e67834SAndre Fischer //add
632b9e67834SAndre Fischer IMPL_LINK( TextPropertyPanel, FontSizeSelHdl, FontSizeBox*, pSizeBox )
633b9e67834SAndre Fischer {
634b9e67834SAndre Fischer     if ( !pSizeBox->IsTravelSelect() )
635b9e67834SAndre Fischer     {
636b9e67834SAndre Fischer         if( SfxViewShell::Current() )
637b9e67834SAndre Fischer         {
638b9e67834SAndre Fischer             Window* pShellWnd = SfxViewShell::Current()->GetWindow();
639b9e67834SAndre Fischer 
640b9e67834SAndre Fischer             if ( pShellWnd )
641b9e67834SAndre Fischer                 pShellWnd->GrabFocus();
642b9e67834SAndre Fischer         }
643b9e67834SAndre Fischer     }
644b9e67834SAndre Fischer 
645b9e67834SAndre Fischer     return 0;
646b9e67834SAndre Fischer }
647b9e67834SAndre Fischer //add end
648b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, FontSizeLoseFocus, FontSizeBox*, pSizeBox)
649b9e67834SAndre Fischer {
650b9e67834SAndre Fischer     if(pSizeBox == &maFontSizeBox)
651b9e67834SAndre Fischer     {
652b9e67834SAndre Fischer         mbFocusOnFontSizeCtrl = false;
653b9e67834SAndre Fischer     }
654b9e67834SAndre Fischer     return 0;
655b9e67834SAndre Fischer }
656b9e67834SAndre Fischer 
657b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolboxFontSelectHandler, ToolBox*, pToolBox)
658b9e67834SAndre Fischer {
659b9e67834SAndre Fischer     const sal_uInt16 nId = pToolBox->GetCurItemId();
660b9e67834SAndre Fischer 
661*45da7d5eSAndre Fischer     switch (nId)
662*45da7d5eSAndre Fischer     {
663*45da7d5eSAndre Fischer         case TBI_BOLD:
664b9e67834SAndre Fischer         {
665b9e67834SAndre Fischer             EndTracking();
666b9e67834SAndre Fischer             if(meWeight != WEIGHT_BOLD)
667b9e67834SAndre Fischer                 meWeight = WEIGHT_BOLD;
668b9e67834SAndre Fischer             else
669b9e67834SAndre Fischer                 meWeight = WEIGHT_NORMAL;
670b9e67834SAndre Fischer             SvxWeightItem aWeightItem(meWeight, SID_ATTR_CHAR_WEIGHT);
671b9e67834SAndre Fischer             mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_WEIGHT, SFX_CALLMODE_RECORD, &aWeightItem, 0L);
672*45da7d5eSAndre Fischer             UpdateItem(SID_ATTR_CHAR_WEIGHT);
673*45da7d5eSAndre Fischer             break;
674b9e67834SAndre Fischer         }
675*45da7d5eSAndre Fischer         case TBI_ITALIC:
676b9e67834SAndre Fischer         {
677b9e67834SAndre Fischer             EndTracking();
678b9e67834SAndre Fischer             if(meItalic != ITALIC_NORMAL)
679b9e67834SAndre Fischer                 meItalic = ITALIC_NORMAL;
680b9e67834SAndre Fischer             else
681b9e67834SAndre Fischer                 meItalic = ITALIC_NONE;
682b9e67834SAndre Fischer             SvxPostureItem aPostureItem(meItalic, SID_ATTR_CHAR_POSTURE);
683b9e67834SAndre Fischer             mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_POSTURE, SFX_CALLMODE_RECORD, &aPostureItem, 0L);
684*45da7d5eSAndre Fischer             UpdateItem(SID_ATTR_CHAR_POSTURE);
685*45da7d5eSAndre Fischer             break;
686b9e67834SAndre Fischer         }
687*45da7d5eSAndre Fischer         case TBI_UNDERLINE:
688b9e67834SAndre Fischer         {
689b9e67834SAndre Fischer             EndTracking();
690b9e67834SAndre Fischer             if(meUnderline == UNDERLINE_NONE)
691b9e67834SAndre Fischer             {
69295a18594SAndre Fischer                 meUnderline = UNDERLINE_SINGLE;
693b9e67834SAndre Fischer                 SvxUnderlineItem aLineItem(meUnderline, SID_ATTR_CHAR_UNDERLINE);
694b9e67834SAndre Fischer                 aLineItem.SetColor(meUnderlineColor);
695b9e67834SAndre Fischer                 mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_UNDERLINE, SFX_CALLMODE_RECORD, &aLineItem, 0L);
696b9e67834SAndre Fischer             }
697b9e67834SAndre Fischer             else
698b9e67834SAndre Fischer             {
699b9e67834SAndre Fischer                 meUnderline = UNDERLINE_NONE;
700b9e67834SAndre Fischer                 SvxUnderlineItem aLineItem(meUnderline, SID_ATTR_CHAR_UNDERLINE);
701b9e67834SAndre Fischer                 mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_UNDERLINE, SFX_CALLMODE_RECORD, &aLineItem, 0L);
702b9e67834SAndre Fischer             }
703*45da7d5eSAndre Fischer             UpdateItem(SID_ATTR_CHAR_UNDERLINE);
704b9e67834SAndre Fischer         }
705*45da7d5eSAndre Fischer         case TBI_STRIKEOUT:
706b9e67834SAndre Fischer         {
707b9e67834SAndre Fischer             EndTracking();
708b9e67834SAndre Fischer             if(meStrike !=  STRIKEOUT_NONE && meStrike != STRIKEOUT_DONTKNOW)
709b9e67834SAndre Fischer                 meStrike = STRIKEOUT_NONE;
710b9e67834SAndre Fischer             else
711b9e67834SAndre Fischer                 meStrike = STRIKEOUT_SINGLE;
712b9e67834SAndre Fischer             SvxCrossedOutItem aStrikeItem(meStrike,SID_ATTR_CHAR_STRIKEOUT);
713b9e67834SAndre Fischer             mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_STRIKEOUT, SFX_CALLMODE_RECORD, &aStrikeItem, 0L);
714*45da7d5eSAndre Fischer             UpdateItem(SID_ATTR_CHAR_STRIKEOUT);
715*45da7d5eSAndre Fischer             break;
716b9e67834SAndre Fischer         }
717*45da7d5eSAndre Fischer         case TBI_SHADOWED:
718b9e67834SAndre Fischer         {
719b9e67834SAndre Fischer             EndTracking();
720b9e67834SAndre Fischer             mbShadow = !mbShadow;
721b9e67834SAndre Fischer             SvxShadowedItem aShadowItem(mbShadow, SID_ATTR_CHAR_SHADOWED);
722b9e67834SAndre Fischer             mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_SHADOWED, SFX_CALLMODE_RECORD, &aShadowItem, 0L);
723*45da7d5eSAndre Fischer             UpdateItem(SID_ATTR_CHAR_SHADOWED);
724*45da7d5eSAndre Fischer             break;
725*45da7d5eSAndre Fischer         }
726b9e67834SAndre Fischer     }
727b9e67834SAndre Fischer     return 0;
728b9e67834SAndre Fischer }
729b9e67834SAndre Fischer 
730b9e67834SAndre Fischer 
731b9e67834SAndre Fischer 
732b9e67834SAndre Fischer 
733b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolboxIncDecSelectHdl, ToolBox*, pToolBox)
734b9e67834SAndre Fischer {
735b9e67834SAndre Fischer     const sal_uInt16 nId = pToolBox->GetCurItemId();
736b9e67834SAndre Fischer 
737b9e67834SAndre Fischer     // font size +/- enhancement in sd
738*45da7d5eSAndre Fischer     switch (maContext.GetCombinedContext_DI())
739b9e67834SAndre Fischer     {
740*45da7d5eSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
741*45da7d5eSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_Text):
742*45da7d5eSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_Table):
743*45da7d5eSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_OutlineText):
744*45da7d5eSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_Draw):
745*45da7d5eSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
746*45da7d5eSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
747b9e67834SAndre Fischer             if(nId == TBI_INCREASE)
748b9e67834SAndre Fischer             {
749b9e67834SAndre Fischer                 EndTracking();
750b9e67834SAndre Fischer                 SfxVoidItem aItem(SID_GROW_FONT_SIZE);
751b9e67834SAndre Fischer                 mpBindings->GetDispatcher()->Execute( SID_GROW_FONT_SIZE, SFX_CALLMODE_RECORD, &aItem, 0L );
752b9e67834SAndre Fischer             }
753b9e67834SAndre Fischer             else if(nId == TBI_DECREASE)
754b9e67834SAndre Fischer             {
755b9e67834SAndre Fischer                 EndTracking();
756b9e67834SAndre Fischer                 SfxVoidItem aItem(SID_SHRINK_FONT_SIZE);
757b9e67834SAndre Fischer                 mpBindings->GetDispatcher()->Execute( SID_SHRINK_FONT_SIZE, SFX_CALLMODE_RECORD, &aItem, 0L );
758b9e67834SAndre Fischer             }
759b9e67834SAndre Fischer             break;
760b9e67834SAndre Fischer 
761b9e67834SAndre Fischer         default:
762b9e67834SAndre Fischer             if(nId == TBI_INCREASE)
763b9e67834SAndre Fischer             {
764b9e67834SAndre Fischer                 EndTracking();
765b9e67834SAndre Fischer                 mbFocusOnFontSizeCtrl = false;
766b9e67834SAndre Fischer                 sal_Int64 iValue = maFontSizeBox.GetValue();
767b9e67834SAndre Fischer                 int iPos = maFontSizeBox.GetValuePos(iValue, FUNIT_NONE);
768b9e67834SAndre Fischer                 long nSize = iValue;
769b9e67834SAndre Fischer                 if(iPos != LISTBOX_ENTRY_NOTFOUND)
770b9e67834SAndre Fischer                     nSize = maFontSizeBox.GetValue(iPos+1 , FUNIT_NONE);
771b9e67834SAndre Fischer                 else if(iValue >= 100 && iValue < 105)
772b9e67834SAndre Fischer                     nSize = 105;
773b9e67834SAndre Fischer                 else if(iValue >= 105 && iValue < 110)
774b9e67834SAndre Fischer                     nSize = 110;
775b9e67834SAndre Fischer                 else if(iValue < 960)
776b9e67834SAndre Fischer                 {
777b9e67834SAndre Fischer                     nSize = (nSize / 10) * 10 + 10;
778b9e67834SAndre Fischer                     while(maFontSizeBox.GetValuePos(nSize, FUNIT_NONE) == LISTBOX_ENTRY_NOTFOUND)
779b9e67834SAndre Fischer                         nSize += 10;
780b9e67834SAndre Fischer                 }
781b9e67834SAndre Fischer                 else
782b9e67834SAndre Fischer                 {
783b9e67834SAndre Fischer                     nSize = iValue;
784b9e67834SAndre Fischer                 }
785b9e67834SAndre Fischer 
786b9e67834SAndre Fischer                 float fSize = (float)nSize / 10;
787b9e67834SAndre Fischer 
788b9e67834SAndre Fischer                 SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric();
789b9e67834SAndre Fischer                 SvxFontHeightItem aItem( CalcToUnit( fSize, eUnit ), 100, SID_ATTR_CHAR_FONTHEIGHT ) ;
790b9e67834SAndre Fischer 
791b9e67834SAndre Fischer                 mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONTHEIGHT, SFX_CALLMODE_RECORD, &aItem, 0L );
792b9e67834SAndre Fischer                 mpBindings->Invalidate(SID_ATTR_CHAR_FONTHEIGHT,true,false);
793b9e67834SAndre Fischer                 maFontSizeBox.SetValue( nSize );
794b9e67834SAndre Fischer             }
795b9e67834SAndre Fischer             else if(nId == TBI_DECREASE)
796b9e67834SAndre Fischer             {
797b9e67834SAndre Fischer                 EndTracking();
798b9e67834SAndre Fischer                 mbFocusOnFontSizeCtrl = false;
799b9e67834SAndre Fischer                 sal_Int64 iValue = maFontSizeBox.GetValue();
800b9e67834SAndre Fischer                 int iPos = maFontSizeBox.GetValuePos(iValue, FUNIT_NONE);
801b9e67834SAndre Fischer                 long nSize = iValue;
802b9e67834SAndre Fischer                 if(iPos != LISTBOX_ENTRY_NOTFOUND)
803b9e67834SAndre Fischer                     nSize = maFontSizeBox.GetValue(iPos-1 , FUNIT_NONE);
804b9e67834SAndre Fischer                 else if(iValue > 100 && iValue <= 105)
805b9e67834SAndre Fischer                     nSize = 100;
806b9e67834SAndre Fischer                 else if(iValue > 105 && iValue <= 110)
807b9e67834SAndre Fischer                     nSize = 105;
808b9e67834SAndre Fischer                 else if(iValue > 960)
809b9e67834SAndre Fischer                 {
810b9e67834SAndre Fischer                     nSize = 960;
811b9e67834SAndre Fischer                 }
812b9e67834SAndre Fischer                 else if(iValue > 60)
813b9e67834SAndre Fischer                 {
814b9e67834SAndre Fischer                     nSize = (nSize / 10) * 10 ;
815b9e67834SAndre Fischer                     while(maFontSizeBox.GetValuePos(nSize, FUNIT_NONE) == LISTBOX_ENTRY_NOTFOUND)
816b9e67834SAndre Fischer                         nSize -= 10;
817b9e67834SAndre Fischer                 }
818b9e67834SAndre Fischer                 else
819b9e67834SAndre Fischer                 {
820b9e67834SAndre Fischer                     nSize = iValue;
821b9e67834SAndre Fischer                 }
822b9e67834SAndre Fischer 
823b9e67834SAndre Fischer                 float fSize = (float)nSize / 10;
824b9e67834SAndre Fischer 
825b9e67834SAndre Fischer                 SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric();
826b9e67834SAndre Fischer                 SvxFontHeightItem aItem( CalcToUnit( fSize, eUnit ), 100, SID_ATTR_CHAR_FONTHEIGHT ) ;
827b9e67834SAndre Fischer 
828b9e67834SAndre Fischer                 mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONTHEIGHT, SFX_CALLMODE_RECORD, &aItem, 0L );
829b9e67834SAndre Fischer                 mpBindings->Invalidate(SID_ATTR_CHAR_FONTHEIGHT,true,false);
830b9e67834SAndre Fischer                 maFontSizeBox.SetValue( nSize );
831b9e67834SAndre Fischer             }
832b9e67834SAndre Fischer     }
833*45da7d5eSAndre Fischer     UpdateItem(SID_ATTR_CHAR_FONTHEIGHT);
834*45da7d5eSAndre Fischer 
835b9e67834SAndre Fischer     return 0;
836b9e67834SAndre Fischer }
837b9e67834SAndre Fischer 
838b9e67834SAndre Fischer 
839b9e67834SAndre Fischer 
840b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolBoxUnderlineClickHdl, ToolBox*, pToolBox)
841b9e67834SAndre Fischer {
842b9e67834SAndre Fischer     const sal_uInt16 nId = pToolBox->GetCurItemId();
843d4aefcaeSZheng Fan     OSL_ASSERT(nId == TBI_UNDERLINE);
844b9e67834SAndre Fischer     if(nId == TBI_UNDERLINE)
845b9e67834SAndre Fischer     {
846b9e67834SAndre Fischer         pToolBox->SetItemDown( nId, true );
847d4aefcaeSZheng Fan         maUnderlinePopup.Rearrange(meUnderline);
848d4aefcaeSZheng Fan         maUnderlinePopup.Show(*pToolBox);
849b9e67834SAndre Fischer 
850b9e67834SAndre Fischer     }
851d4aefcaeSZheng Fan     return 0L;
852b9e67834SAndre Fischer }
853b9e67834SAndre Fischer 
854b9e67834SAndre Fischer 
855b9e67834SAndre Fischer 
856b9e67834SAndre Fischer 
857b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolBoxFontColorDropHdl,ToolBox*, pToolBox)
858b9e67834SAndre Fischer {
859b9e67834SAndre Fischer     const sal_uInt16 nId = pToolBox->GetCurItemId();
860b9e67834SAndre Fischer     if(nId == TBI_FONTCOLOR)
861b9e67834SAndre Fischer     {
862b9e67834SAndre Fischer         meColorType = FONT_COLOR;
863b9e67834SAndre Fischer 
864b9e67834SAndre Fischer         pToolBox->SetItemDown( nId, true );
865b9e67834SAndre Fischer 
866d4aefcaeSZheng Fan         maFontColorPopup.Show(*pToolBox);
867d4aefcaeSZheng Fan         maFontColorPopup.SetCurrentColor(maColor, mbColorAvailable);
868b9e67834SAndre Fischer     }
869b9e67834SAndre Fischer     return 0;
870b9e67834SAndre Fischer }
871b9e67834SAndre Fischer 
872b9e67834SAndre Fischer 
873b9e67834SAndre Fischer 
874b9e67834SAndre Fischer 
875b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolBoxSwScriptSelectHdl, ToolBox*, pToolBox)
876b9e67834SAndre Fischer {
877b9e67834SAndre Fischer     const sal_uInt16 nId = pToolBox->GetCurItemId();
878b9e67834SAndre Fischer     if( nId == TBI_SUPER_SW )
879b9e67834SAndre Fischer     {
880b9e67834SAndre Fischer         if(meEscape != SVX_ESCAPEMENT_SUPERSCRIPT)
881b9e67834SAndre Fischer         {
882b9e67834SAndre Fischer             meEscape = SVX_ESCAPEMENT_SUPERSCRIPT;
883b9e67834SAndre Fischer             SvxEscapementItem aSupItem(DFLT_ESC_SUPER, DFLT_ESC_PROP, SID_ATTR_CHAR_ESCAPEMENT);
884b9e67834SAndre Fischer             mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aSupItem, 0L );
885b9e67834SAndre Fischer         }
886b9e67834SAndre Fischer         else
887b9e67834SAndre Fischer         {
888b9e67834SAndre Fischer             meEscape = SVX_ESCAPEMENT_OFF;
889b9e67834SAndre Fischer             SvxEscapementItem aNoneItem(0, 100, SID_ATTR_CHAR_ESCAPEMENT);
890b9e67834SAndre Fischer             mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aNoneItem, 0L );
891b9e67834SAndre Fischer         }
892b9e67834SAndre Fischer     }
893b9e67834SAndre Fischer     else if(TBI_SUB_SW == nId)
894b9e67834SAndre Fischer     {
895b9e67834SAndre Fischer         if(meEscape != SVX_ESCAPEMENT_SUBSCRIPT)
896b9e67834SAndre Fischer         {
897b9e67834SAndre Fischer             meEscape = (SvxEscapement)SVX_ESCAPEMENT_SUBSCRIPT;
898b9e67834SAndre Fischer             SvxEscapementItem aSubItem(DFLT_ESC_SUB, DFLT_ESC_PROP, SID_ATTR_CHAR_ESCAPEMENT);
899b9e67834SAndre Fischer             mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aSubItem, 0L );
900b9e67834SAndre Fischer         }
901b9e67834SAndre Fischer         else
902b9e67834SAndre Fischer         {
903b9e67834SAndre Fischer             meEscape = SVX_ESCAPEMENT_OFF;
904b9e67834SAndre Fischer             SvxEscapementItem aNoneItem(0, 100, SID_ATTR_CHAR_ESCAPEMENT);
905b9e67834SAndre Fischer             mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aNoneItem, 0L );
906b9e67834SAndre Fischer         }
907b9e67834SAndre Fischer     }
908*45da7d5eSAndre Fischer     UpdateItem(SID_ATTR_CHAR_ESCAPEMENT);
909b9e67834SAndre Fischer 
910b9e67834SAndre Fischer     return 0;
911b9e67834SAndre Fischer }
912b9e67834SAndre Fischer 
913b9e67834SAndre Fischer 
914b9e67834SAndre Fischer 
915b9e67834SAndre Fischer 
916b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolBoxScriptSelectHdl, ToolBox*, pToolBox)
917b9e67834SAndre Fischer {
918b9e67834SAndre Fischer     const sal_uInt16 nId = pToolBox->GetCurItemId();
919b9e67834SAndre Fischer     if( nId == TBI_SUPER )
920b9e67834SAndre Fischer     {
921b9e67834SAndre Fischer         mbSuper = !mbSuper;
922b9e67834SAndre Fischer         SfxBoolItem aSupItem(SID_SET_SUPER_SCRIPT, mbSuper);
923b9e67834SAndre Fischer         mpBindings->GetDispatcher()->Execute( SID_SET_SUPER_SCRIPT, SFX_CALLMODE_RECORD, &aSupItem, 0L );
924*45da7d5eSAndre Fischer         UpdateItem(SID_SET_SUPER_SCRIPT);
925b9e67834SAndre Fischer     }
926b9e67834SAndre Fischer     else if(TBI_SUB == nId)
927b9e67834SAndre Fischer     {
928b9e67834SAndre Fischer 
929b9e67834SAndre Fischer         mbSub = !mbSub;
930b9e67834SAndre Fischer         SfxBoolItem aSubItem(SID_SET_SUB_SCRIPT, mbSub );
931b9e67834SAndre Fischer         mpBindings->GetDispatcher()->Execute( SID_SET_SUB_SCRIPT, SFX_CALLMODE_RECORD, &aSubItem, 0L );
932*45da7d5eSAndre Fischer         UpdateItem(SID_SET_SUB_SCRIPT);
933b9e67834SAndre Fischer     }
934b9e67834SAndre Fischer     return 0;
935b9e67834SAndre Fischer }
936b9e67834SAndre Fischer 
937b9e67834SAndre Fischer 
938b9e67834SAndre Fischer 
939b9e67834SAndre Fischer 
940b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolBoxHighlightDropHdl, ToolBox*, pToolBox)
941b9e67834SAndre Fischer {
942b9e67834SAndre Fischer     const sal_uInt16 nId = pToolBox->GetCurItemId();
943b9e67834SAndre Fischer     if(nId == TBI_HIGHLIGHT)
944b9e67834SAndre Fischer     {
945b9e67834SAndre Fischer         meColorType = BACK_COLOR;
946b9e67834SAndre Fischer 
947b9e67834SAndre Fischer         pToolBox->SetItemDown( nId, true );
948d4aefcaeSZheng Fan         maBrushColorPopup.Show(*pToolBox);
949d4aefcaeSZheng Fan         maBrushColorPopup.SetCurrentColor(maBackColor, mbBackColorAvailable);
950b9e67834SAndre Fischer 
951b9e67834SAndre Fischer     }
952b9e67834SAndre Fischer     return 0;
953b9e67834SAndre Fischer }
954b9e67834SAndre Fischer 
955b9e67834SAndre Fischer 
956b9e67834SAndre Fischer 
957b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, SpacingClickHdl, ToolBox*, pToolBox)
958b9e67834SAndre Fischer {
959b9e67834SAndre Fischer     const sal_uInt16 nId = pToolBox->GetCurItemId();
960d4aefcaeSZheng Fan     OSL_ASSERT(nId == TBI_SPACING);
961b9e67834SAndre Fischer     if(nId == TBI_SPACING)
962b9e67834SAndre Fischer     {
963b9e67834SAndre Fischer         pToolBox->SetItemDown( nId, true );
964d4aefcaeSZheng Fan         maCharSpacePopup.Rearrange(mbKernLBAvailable,mbKernAvailable,mlKerning);
965d4aefcaeSZheng Fan         maCharSpacePopup.Show(*pToolBox);
966b9e67834SAndre Fischer 
967b9e67834SAndre Fischer     }
968d4aefcaeSZheng Fan     return 0L;
969b9e67834SAndre Fischer }
970b9e67834SAndre Fischer 
971b9e67834SAndre Fischer 
972b9e67834SAndre Fischer 
973b9e67834SAndre Fischer 
974b9e67834SAndre Fischer IMPL_LINK( TextPropertyPanel, ImplPopupModeEndHdl, FloatingWindow*, EMPTYARG )
975b9e67834SAndre Fischer {
976b9e67834SAndre Fischer     return 0;
977b9e67834SAndre Fischer }
978b9e67834SAndre Fischer 
979b9e67834SAndre Fischer 
980b9e67834SAndre Fischer 
981b9e67834SAndre Fischer 
982b9e67834SAndre Fischer void TextPropertyPanel::NotifyItemUpdate (
983b9e67834SAndre Fischer     const sal_uInt16 nSID,
984b9e67834SAndre Fischer     const SfxItemState eState,
985*45da7d5eSAndre Fischer     const SfxPoolItem* pState,
986*45da7d5eSAndre Fischer     const bool bIsEnabled)
987b9e67834SAndre Fischer {
988b9e67834SAndre Fischer     switch(nSID)
989b9e67834SAndre Fischer     {
990b9e67834SAndre Fischer         case SID_ATTR_CHAR_FONT:
991*45da7d5eSAndre Fischer         {
992*45da7d5eSAndre Fischer             bool bIsControlEnabled (bIsEnabled);
993b9e67834SAndre Fischer             if (  eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxFontItem) )
994b9e67834SAndre Fischer             {
995b9e67834SAndre Fischer                 const SvxFontItem* pFontItem = (const SvxFontItem*)pState;
996b9e67834SAndre Fischer                 mpFontNameBox->SetText( pFontItem->GetFamilyName() );
997b9e67834SAndre Fischer             }
998b9e67834SAndre Fischer             else
999b9e67834SAndre Fischer             {
1000b9e67834SAndre Fischer                 mpFontNameBox->SetText( String() );
1001b9e67834SAndre Fischer                 if (SFX_ITEM_DISABLED == eState)
1002*45da7d5eSAndre Fischer                     bIsControlEnabled = false;
1003b9e67834SAndre Fischer             }
1004*45da7d5eSAndre Fischer             mpFontNameBox->Enable(bIsControlEnabled);
1005b9e67834SAndre Fischer             break;
1006*45da7d5eSAndre Fischer         }
1007b9e67834SAndre Fischer         case SID_ATTR_CHAR_FONTHEIGHT:
1008*45da7d5eSAndre Fischer         {
1009*45da7d5eSAndre Fischer             bool bIsControlEnabled (bIsEnabled);
1010b9e67834SAndre Fischer             if (  eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxFontHeightItem) )
1011b9e67834SAndre Fischer             {
1012b9e67834SAndre Fischer                 mpHeightItem = (SvxFontHeightItem*)pState;//const SvxFontHeightItem*
1013b9e67834SAndre Fischer                 SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric();
1014b9e67834SAndre Fischer                 long iValue = (long)CalcToPoint( mpHeightItem->GetHeight(), eUnit, 10 );
1015b9e67834SAndre Fischer                 mpToolBoxIncDec->Enable();
1016b9e67834SAndre Fischer 
1017b9e67834SAndre Fischer                 mpToolBoxIncDec->SetItemState(TBI_INCREASE, STATE_NOCHECK);
1018b9e67834SAndre Fischer                 mpToolBoxIncDec->SetItemState(TBI_DECREASE, STATE_NOCHECK);
1019b9e67834SAndre Fischer 
1020b9e67834SAndre Fischer                 if( mbFocusOnFontSizeCtrl )
1021b9e67834SAndre Fischer                     return;
1022b9e67834SAndre Fischer 
1023b9e67834SAndre Fischer                 maFontSizeBox.SetValue( iValue );
1024b9e67834SAndre Fischer                 maFontSizeBox.LoseFocus();
1025*45da7d5eSAndre Fischer 
1026*45da7d5eSAndre Fischer                 UpdateItem(SID_SHRINK_FONT_SIZE);
1027*45da7d5eSAndre Fischer                 UpdateItem(SID_GROW_FONT_SIZE);
1028b9e67834SAndre Fischer             }
1029b9e67834SAndre Fischer             else
1030b9e67834SAndre Fischer             {
1031b9e67834SAndre Fischer                 mpHeightItem = NULL;
1032b9e67834SAndre Fischer                 maFontSizeBox.SetText( String() );
1033b9e67834SAndre Fischer                 //increase decrease diabled when multi-seletion have different font size
1034b9e67834SAndre Fischer 
1035b9e67834SAndre Fischer                 // font size +/- enhancement in sd
1036*45da7d5eSAndre Fischer                 switch(maContext.GetCombinedContext_DI())
1037b9e67834SAndre Fischer                 {
1038*45da7d5eSAndre Fischer                     case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
1039*45da7d5eSAndre Fischer                     case CombinedEnumContext(Application_DrawImpress, Context_Text):
1040*45da7d5eSAndre Fischer                     case CombinedEnumContext(Application_DrawImpress, Context_Table):
1041*45da7d5eSAndre Fischer                     case CombinedEnumContext(Application_DrawImpress, Context_OutlineText):
1042*45da7d5eSAndre Fischer                     case CombinedEnumContext(Application_DrawImpress, Context_Draw):
1043*45da7d5eSAndre Fischer                     case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
1044*45da7d5eSAndre Fischer                     case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
1045b9e67834SAndre Fischer                         break;
1046b9e67834SAndre Fischer 
1047b9e67834SAndre Fischer                     default:
1048b9e67834SAndre Fischer                         mpToolBoxIncDec->Disable();
1049b9e67834SAndre Fischer                 }
1050b9e67834SAndre Fischer                 if ( eState <= SFX_ITEM_READONLY )
1051*45da7d5eSAndre Fischer                     bIsControlEnabled = false;
1052b9e67834SAndre Fischer             }
1053*45da7d5eSAndre Fischer             maFontSizeBox.Enable(bIsControlEnabled);
1054b9e67834SAndre Fischer             break;
1055*45da7d5eSAndre Fischer         }
1056*45da7d5eSAndre Fischer 
1057b9e67834SAndre Fischer         case SID_ATTR_CHAR_WEIGHT:
1058b9e67834SAndre Fischer             mbWeightAvailable = (eState >= SFX_ITEM_DONTCARE);
1059b9e67834SAndre Fischer             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxWeightItem))
1060b9e67834SAndre Fischer             {
1061b9e67834SAndre Fischer                 const SvxWeightItem* pItem = (const SvxWeightItem*)pState;
1062b9e67834SAndre Fischer                 meWeight = (FontWeight)pItem->GetValue();
1063b9e67834SAndre Fischer             }
1064b9e67834SAndre Fischer             else
1065b9e67834SAndre Fischer             {
1066b9e67834SAndre Fischer                 meWeight = WEIGHT_NORMAL;
1067b9e67834SAndre Fischer             }
1068*45da7d5eSAndre Fischer             mpToolBoxFont->EnableItem(TBI_BOLD, mbWeightAvailable && bIsEnabled);
1069*45da7d5eSAndre Fischer             mpToolBoxFont->SetItemState(TBI_BOLD, meWeight==WEIGHT_BOLD ? STATE_CHECK : STATE_NOCHECK);
1070b9e67834SAndre Fischer             break;
1071*45da7d5eSAndre Fischer 
1072b9e67834SAndre Fischer         case SID_ATTR_CHAR_POSTURE:
1073b9e67834SAndre Fischer             mbPostureAvailable = (eState >= SFX_ITEM_DONTCARE);
1074b9e67834SAndre Fischer             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxPostureItem))
1075b9e67834SAndre Fischer             {
1076b9e67834SAndre Fischer                 const SvxPostureItem* pItem = (const SvxPostureItem*)pState;
1077b9e67834SAndre Fischer                 meItalic = (FontItalic)pItem->GetValue();
1078b9e67834SAndre Fischer             }
1079b9e67834SAndre Fischer             else
1080b9e67834SAndre Fischer             {
1081b9e67834SAndre Fischer                 meItalic = ITALIC_NONE;
1082b9e67834SAndre Fischer             }
1083*45da7d5eSAndre Fischer             mpToolBoxFont->EnableItem(TBI_ITALIC, mbPostureAvailable && bIsEnabled);
1084*45da7d5eSAndre Fischer             mpToolBoxFont->SetItemState(TBI_ITALIC, meItalic==ITALIC_NORMAL ? STATE_CHECK : STATE_NOCHECK);
1085b9e67834SAndre Fischer             break;
1086*45da7d5eSAndre Fischer 
1087b9e67834SAndre Fischer         case SID_ATTR_CHAR_UNDERLINE:
1088*45da7d5eSAndre Fischer             if( eState >= SFX_ITEM_DEFAULT)
1089b9e67834SAndre Fischer             {
1090b9e67834SAndre Fischer                 if(pState->ISA(SvxUnderlineItem))
1091b9e67834SAndre Fischer                 {
1092b9e67834SAndre Fischer                     const SvxUnderlineItem* pItem = (const SvxUnderlineItem*)pState;
1093b9e67834SAndre Fischer                     meUnderline = (FontUnderline)pItem->GetValue();
1094b9e67834SAndre Fischer                     meUnderlineColor = pItem->GetColor();
1095b9e67834SAndre Fischer                 }
1096b9e67834SAndre Fischer             }
1097b9e67834SAndre Fischer             else
1098b9e67834SAndre Fischer             {
1099b9e67834SAndre Fischer                 meUnderline = UNDERLINE_NONE;
1100b9e67834SAndre Fischer             }
1101*45da7d5eSAndre Fischer             mpToolBoxFont->EnableItem(TBI_UNDERLINE, bIsEnabled);
1102*45da7d5eSAndre Fischer             mpToolBoxFont->SetItemState(TBI_UNDERLINE, meUnderline==UNDERLINE_NONE ? STATE_NOCHECK : STATE_CHECK);
1103b9e67834SAndre Fischer             break;
1104*45da7d5eSAndre Fischer 
1105b9e67834SAndre Fischer         case SID_ATTR_CHAR_SHADOWED:
1106b9e67834SAndre Fischer             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxShadowedItem))
1107b9e67834SAndre Fischer             {
1108b9e67834SAndre Fischer                 const SvxShadowedItem* pItem = (const SvxShadowedItem*)pState;
1109b9e67834SAndre Fischer                 mbShadow = pItem->GetValue();
1110b9e67834SAndre Fischer             }
1111b9e67834SAndre Fischer             else
1112b9e67834SAndre Fischer             {
1113b9e67834SAndre Fischer                 mbShadow = false;
1114b9e67834SAndre Fischer             }
1115*45da7d5eSAndre Fischer             mpToolBoxFont->EnableItem(TBI_SHADOWED, bIsEnabled);
1116*45da7d5eSAndre Fischer             mpToolBoxFont->SetItemState(TBI_SHADOWED, mbShadow ? STATE_CHECK : STATE_NOCHECK);
1117b9e67834SAndre Fischer             break;
1118*45da7d5eSAndre Fischer 
1119b9e67834SAndre Fischer         case SID_ATTR_CHAR_STRIKEOUT:
1120b9e67834SAndre Fischer             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxCrossedOutItem))
1121b9e67834SAndre Fischer             {
1122b9e67834SAndre Fischer                 const SvxCrossedOutItem* pItem = (const SvxCrossedOutItem*)pState;
1123b9e67834SAndre Fischer                 meStrike = (FontStrikeout)pItem->GetValue();
1124b9e67834SAndre Fischer             }
1125b9e67834SAndre Fischer             else
1126b9e67834SAndre Fischer             {
1127b9e67834SAndre Fischer                 meStrike = STRIKEOUT_NONE;
1128b9e67834SAndre Fischer             }
1129*45da7d5eSAndre Fischer             mpToolBoxFont->EnableItem(TBI_STRIKEOUT, bIsEnabled);
1130*45da7d5eSAndre Fischer             mpToolBoxFont->SetItemState(TBI_STRIKEOUT,
1131*45da7d5eSAndre Fischer                 meStrike!=STRIKEOUT_NONE && meStrike!=STRIKEOUT_DONTKNOW
1132*45da7d5eSAndre Fischer                     ? STATE_CHECK
1133*45da7d5eSAndre Fischer                     : STATE_NOCHECK);
1134b9e67834SAndre Fischer             break;
1135*45da7d5eSAndre Fischer 
1136b9e67834SAndre Fischer         case SID_ATTR_CHAR_COLOR:
1137b9e67834SAndre Fischer             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxColorItem))
1138b9e67834SAndre Fischer             {
1139d4aefcaeSZheng Fan                 const SvxColorItem* pItem =  (const SvxColorItem*)pState;
1140d4aefcaeSZheng Fan                 maColor = pItem->GetValue();
1141b9e67834SAndre Fischer                 mbColorAvailable = true;
114295a18594SAndre Fischer                 if (mpFontColorUpdater)
1143b9e67834SAndre Fischer                     mpFontColorUpdater->Update(maColor);
1144b9e67834SAndre Fischer             }
1145b9e67834SAndre Fischer             else
1146b9e67834SAndre Fischer             {
1147b9e67834SAndre Fischer                 mbColorAvailable = false;
1148b9e67834SAndre Fischer                 maColor.SetColor(COL_AUTO);
114995a18594SAndre Fischer                 if (mpFontColorUpdater)
1150b9e67834SAndre Fischer                     mpFontColorUpdater->Update(maColor);
1151b9e67834SAndre Fischer             }
1152*45da7d5eSAndre Fischer             mpToolBoxFontColor->EnableItem(TBI_FONTCOLOR, bIsEnabled);
1153b9e67834SAndre Fischer             break;
1154*45da7d5eSAndre Fischer 
1155b9e67834SAndre Fischer         case SID_ATTR_BRUSH_CHAR:
1156b9e67834SAndre Fischer             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxBrushItem))
1157b9e67834SAndre Fischer             {
1158b9e67834SAndre Fischer                 const SvxBrushItem* pItem =  (const SvxBrushItem*)pState;
1159b9e67834SAndre Fischer                 maBackColor = pItem->GetColor();
1160b9e67834SAndre Fischer                 mbBackColorAvailable = true;
11617a32b0c8SAndre Fischer                 if (mpHighlightUpdater)
1162b9e67834SAndre Fischer                     mpHighlightUpdater->Update(maBackColor);
1163b9e67834SAndre Fischer             }
1164b9e67834SAndre Fischer             else
1165b9e67834SAndre Fischer             {
1166b9e67834SAndre Fischer                 mbBackColorAvailable = false;
1167b9e67834SAndre Fischer                 maBackColor.SetColor(COL_AUTO);
11687a32b0c8SAndre Fischer                 if (mpHighlightUpdater)
1169b9e67834SAndre Fischer                     mpHighlightUpdater->Update(maBackColor);
1170b9e67834SAndre Fischer             }
1171*45da7d5eSAndre Fischer             mpToolBoxHighlight->EnableItem(TBI_HIGHLIGHT, bIsEnabled);
1172b9e67834SAndre Fischer             break;
1173*45da7d5eSAndre Fischer 
1174b9e67834SAndre Fischer         case SID_ATTR_CHAR_ESCAPEMENT:
1175*45da7d5eSAndre Fischer         {
1176*45da7d5eSAndre Fischer             bool bIsItemEnabled (true);
1177b9e67834SAndre Fischer             if (eState == SFX_ITEM_AVAILABLE)
1178b9e67834SAndre Fischer             {
1179b9e67834SAndre Fischer                 if (pState->ISA(SvxEscapementItem))
1180b9e67834SAndre Fischer                 {
1181b9e67834SAndre Fischer                     const SvxEscapementItem* pItem = (const SvxEscapementItem *)pState;
1182b9e67834SAndre Fischer                     short nEsc = pItem->GetEsc();
1183b9e67834SAndre Fischer                     if(nEsc == 0)
1184*45da7d5eSAndre Fischer                     {
1185b9e67834SAndre Fischer                         meEscape = SVX_ESCAPEMENT_OFF;
1186*45da7d5eSAndre Fischer                         mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_NOCHECK);
1187*45da7d5eSAndre Fischer                         mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_NOCHECK);
1188*45da7d5eSAndre Fischer                     }
1189b9e67834SAndre Fischer                     else if(nEsc > 0)
1190*45da7d5eSAndre Fischer                     {
1191b9e67834SAndre Fischer                         meEscape = SVX_ESCAPEMENT_SUPERSCRIPT;
1192*45da7d5eSAndre Fischer                         mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_CHECK);
1193*45da7d5eSAndre Fischer                         mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_NOCHECK);
1194*45da7d5eSAndre Fischer                     }
1195b9e67834SAndre Fischer                     else
1196*45da7d5eSAndre Fischer                     {
1197b9e67834SAndre Fischer                         meEscape = SVX_ESCAPEMENT_SUBSCRIPT;
1198*45da7d5eSAndre Fischer                         mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_NOCHECK);
1199*45da7d5eSAndre Fischer                         mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_CHECK);
1200*45da7d5eSAndre Fischer                     }
1201b9e67834SAndre Fischer                 }
1202b9e67834SAndre Fischer                 else
1203b9e67834SAndre Fischer                 {
1204b9e67834SAndre Fischer                     meEscape = SVX_ESCAPEMENT_OFF;
1205*45da7d5eSAndre Fischer                     mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_NOCHECK);
1206*45da7d5eSAndre Fischer                     mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_NOCHECK);
1207b9e67834SAndre Fischer                 }
1208b9e67834SAndre Fischer             }
1209b9e67834SAndre Fischer             else if (eState == SFX_ITEM_DISABLED)
1210b9e67834SAndre Fischer             {
1211*45da7d5eSAndre Fischer                 bIsItemEnabled = false;
1212b9e67834SAndre Fischer             }
1213b9e67834SAndre Fischer             else
1214b9e67834SAndre Fischer             {
1215b9e67834SAndre Fischer                 meEscape = SVX_ESCAPEMENT_OFF;
1216b9e67834SAndre Fischer             }
1217*45da7d5eSAndre Fischer             mpToolBoxScriptSw->EnableItem(TBI_SUPER, bIsItemEnabled && bIsEnabled);
1218*45da7d5eSAndre Fischer             mpToolBoxScriptSw->EnableItem(TBI_SUB, bIsItemEnabled && bIsEnabled);
1219b9e67834SAndre Fischer             break;
1220*45da7d5eSAndre Fischer         }
1221*45da7d5eSAndre Fischer 
1222b9e67834SAndre Fischer         case SID_SET_SUB_SCRIPT:
1223b9e67834SAndre Fischer             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SfxBoolItem))
1224b9e67834SAndre Fischer             {
1225b9e67834SAndre Fischer                 const SfxBoolItem* pItem = (const SfxBoolItem*)pState;
1226b9e67834SAndre Fischer                 mbSub = pItem->GetValue();
1227b9e67834SAndre Fischer             }
1228b9e67834SAndre Fischer             else
1229b9e67834SAndre Fischer             {
1230b9e67834SAndre Fischer                 mbSub = false;
1231b9e67834SAndre Fischer             }
1232*45da7d5eSAndre Fischer             mpToolBoxScript->EnableItem(TBI_SUB, bIsEnabled);
1233*45da7d5eSAndre Fischer             mpToolBoxScript->SetItemState(TBI_SUB, mbSub ? STATE_CHECK : STATE_NOCHECK);
1234b9e67834SAndre Fischer             break;
1235*45da7d5eSAndre Fischer 
1236b9e67834SAndre Fischer         case SID_SET_SUPER_SCRIPT:
1237b9e67834SAndre Fischer             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SfxBoolItem))
1238b9e67834SAndre Fischer             {
1239b9e67834SAndre Fischer                 const SfxBoolItem* pItem = (const SfxBoolItem*)pState;
1240b9e67834SAndre Fischer                 mbSuper = pItem->GetValue();
1241b9e67834SAndre Fischer             }
1242b9e67834SAndre Fischer             else
1243b9e67834SAndre Fischer             {
1244b9e67834SAndre Fischer                 mbSuper = false;
1245b9e67834SAndre Fischer             }
1246*45da7d5eSAndre Fischer             mpToolBoxScript->EnableItem(TBI_SUPER, bIsEnabled);
1247*45da7d5eSAndre Fischer             mpToolBoxScript->SetItemState(TBI_SUPER, mbSuper ? STATE_CHECK : STATE_NOCHECK);
1248b9e67834SAndre Fischer             break;
1249*45da7d5eSAndre Fischer 
1250b9e67834SAndre Fischer         case SID_ATTR_CHAR_KERNING:
1251b9e67834SAndre Fischer             if ( SFX_ITEM_AVAILABLE == eState )
1252b9e67834SAndre Fischer             {
1253b9e67834SAndre Fischer                 mbKernLBAvailable = true;
1254b9e67834SAndre Fischer 
1255b9e67834SAndre Fischer                 if(pState->ISA(SvxKerningItem))
1256b9e67834SAndre Fischer                 {
1257b9e67834SAndre Fischer                     const SvxKerningItem* pKerningItem  = (const SvxKerningItem*)pState;
1258b9e67834SAndre Fischer                     mlKerning = (long)pKerningItem->GetValue();
1259b9e67834SAndre Fischer                     mbKernAvailable = true;
1260b9e67834SAndre Fischer                 }
1261b9e67834SAndre Fischer                 else
1262b9e67834SAndre Fischer                 {
1263b9e67834SAndre Fischer                     mlKerning = 0;
1264b9e67834SAndre Fischer                     mbKernAvailable =false;
1265b9e67834SAndre Fischer                 }
1266b9e67834SAndre Fischer             }
1267b9e67834SAndre Fischer             else if (SFX_ITEM_DISABLED == eState)
1268b9e67834SAndre Fischer             {
1269b9e67834SAndre Fischer                 mbKernLBAvailable = false;
1270b9e67834SAndre Fischer                 mbKernAvailable = false;
1271b9e67834SAndre Fischer                 mlKerning = 0;
1272b9e67834SAndre Fischer             }
1273b9e67834SAndre Fischer             else
1274b9e67834SAndre Fischer             {
1275b9e67834SAndre Fischer                 mbKernLBAvailable = true;
1276b9e67834SAndre Fischer                 mbKernAvailable = false;
1277b9e67834SAndre Fischer                 mlKerning = 0;
1278b9e67834SAndre Fischer             }
1279*45da7d5eSAndre Fischer             mpToolBoxSpacing->EnableItem(TBI_SPACING, bIsEnabled);
1280b9e67834SAndre Fischer             break;
1281b9e67834SAndre Fischer 
1282b9e67834SAndre Fischer             // font size +/- enhancement in sd
1283b9e67834SAndre Fischer         case SID_SHRINK_FONT_SIZE:
1284b9e67834SAndre Fischer         case SID_GROW_FONT_SIZE:
1285*45da7d5eSAndre Fischer             switch(maContext.GetCombinedContext_DI())
1286b9e67834SAndre Fischer             {
1287*45da7d5eSAndre Fischer                 case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
1288*45da7d5eSAndre Fischer                 case CombinedEnumContext(Application_DrawImpress, Context_Text):
1289*45da7d5eSAndre Fischer                 case CombinedEnumContext(Application_DrawImpress, Context_Table):
1290*45da7d5eSAndre Fischer                 case CombinedEnumContext(Application_DrawImpress, Context_OutlineText):
1291*45da7d5eSAndre Fischer                 case CombinedEnumContext(Application_DrawImpress, Context_Draw):
1292*45da7d5eSAndre Fischer                 case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
1293*45da7d5eSAndre Fischer                 case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
1294b9e67834SAndre Fischer                     if(eState == SFX_ITEM_DISABLED)
1295b9e67834SAndre Fischer                         mpToolBoxIncDec->Disable();
1296b9e67834SAndre Fischer                     else
1297b9e67834SAndre Fischer                         mpToolBoxIncDec->Enable();
1298b9e67834SAndre Fischer                 break;
1299b9e67834SAndre Fischer             }
1300*45da7d5eSAndre Fischer             const sal_Int32 nSize (maFontSizeBox.GetValue());
1301*45da7d5eSAndre Fischer             if (nSID == SID_GROW_FONT_SIZE)
1302*45da7d5eSAndre Fischer                 mpToolBoxIncDec->EnableItem(TBI_INCREASE, bIsEnabled && nSize<960);
1303*45da7d5eSAndre Fischer             else
1304*45da7d5eSAndre Fischer                 mpToolBoxIncDec->EnableItem(TBI_DECREASE, bIsEnabled && nSize>60);
1305b9e67834SAndre Fischer             break;
1306b9e67834SAndre Fischer     }
1307b9e67834SAndre Fischer }
1308b9e67834SAndre Fischer 
1309b9e67834SAndre Fischer 
1310b9e67834SAndre Fischer 
1311b9e67834SAndre Fischer 
1312*45da7d5eSAndre Fischer void TextPropertyPanel::UpdateItem (const sal_uInt16 nSlotId)
1313b9e67834SAndre Fischer {
1314*45da7d5eSAndre Fischer     switch (nSlotId)
1315*45da7d5eSAndre Fischer     {
1316*45da7d5eSAndre Fischer         case SID_ATTR_CHAR_FONT:
1317*45da7d5eSAndre Fischer             maFontNameControl.RequestUpdate();
1318*45da7d5eSAndre Fischer             break;
1319*45da7d5eSAndre Fischer         case SID_ATTR_CHAR_FONTHEIGHT:
1320*45da7d5eSAndre Fischer             maFontSizeControl.RequestUpdate();
1321*45da7d5eSAndre Fischer             break;
1322*45da7d5eSAndre Fischer         case SID_ATTR_CHAR_WEIGHT:
1323*45da7d5eSAndre Fischer             maWeightControl.RequestUpdate();
1324*45da7d5eSAndre Fischer             break;
1325*45da7d5eSAndre Fischer         case SID_ATTR_CHAR_POSTURE:
1326*45da7d5eSAndre Fischer             maItalicControl.RequestUpdate();
1327*45da7d5eSAndre Fischer             break;
1328*45da7d5eSAndre Fischer         case SID_ATTR_CHAR_UNDERLINE:
1329*45da7d5eSAndre Fischer             maUnderlineControl.RequestUpdate();
1330*45da7d5eSAndre Fischer             break;
1331*45da7d5eSAndre Fischer         case SID_ATTR_CHAR_STRIKEOUT:
1332*45da7d5eSAndre Fischer             maStrikeControl.RequestUpdate();
1333*45da7d5eSAndre Fischer             break;
1334*45da7d5eSAndre Fischer         case SID_ATTR_CHAR_SHADOWED:
1335*45da7d5eSAndre Fischer             maShadowControl.RequestUpdate();
1336*45da7d5eSAndre Fischer             break;
1337*45da7d5eSAndre Fischer         case SID_ATTR_CHAR_COLOR:
1338*45da7d5eSAndre Fischer             maFontColorControl.RequestUpdate();
1339*45da7d5eSAndre Fischer             break;
1340*45da7d5eSAndre Fischer         case SID_ATTR_CHAR_ESCAPEMENT:
1341*45da7d5eSAndre Fischer             maScriptControlSw.RequestUpdate();
1342*45da7d5eSAndre Fischer             break;
1343*45da7d5eSAndre Fischer         case SID_SET_SUPER_SCRIPT:
1344*45da7d5eSAndre Fischer             maSuperScriptControl.RequestUpdate();
1345*45da7d5eSAndre Fischer             break;
1346*45da7d5eSAndre Fischer         case SID_SET_SUB_SCRIPT:
1347*45da7d5eSAndre Fischer             maSubScriptControl.RequestUpdate();
1348*45da7d5eSAndre Fischer             break;
1349*45da7d5eSAndre Fischer         case SID_ATTR_CHAR_KERNING:
1350*45da7d5eSAndre Fischer             maSpacingControl.RequestUpdate();
1351*45da7d5eSAndre Fischer             break;
1352*45da7d5eSAndre Fischer         case SID_ATTR_BRUSH_CHAR:
1353*45da7d5eSAndre Fischer             maHighlightControl.RequestUpdate();
1354*45da7d5eSAndre Fischer             break;
1355*45da7d5eSAndre Fischer         case SID_GROW_FONT_SIZE:
1356*45da7d5eSAndre Fischer             maSDFontGrow.RequestUpdate();
1357*45da7d5eSAndre Fischer             break;
1358*45da7d5eSAndre Fischer         case SID_SHRINK_FONT_SIZE:
1359*45da7d5eSAndre Fischer             maSDFontShrink.RequestUpdate();
1360*45da7d5eSAndre Fischer             break;
1361*45da7d5eSAndre Fischer     }
1362b9e67834SAndre Fischer }
1363b9e67834SAndre Fischer 
1364b9e67834SAndre Fischer 
1365b9e67834SAndre Fischer 
1366b9e67834SAndre Fischer 
1367b9e67834SAndre Fischer 
1368d4aefcaeSZheng Fan void TextPropertyPanel::SetFontColor (
1369a7d1eb6fSPavel Janík     const String& /* rsColorName */,
1370d4aefcaeSZheng Fan     const Color aColor)
1371d4aefcaeSZheng Fan {
1372d4aefcaeSZheng Fan     SvxColorItem aColorItem(aColor, SID_ATTR_CHAR_COLOR);
1373d4aefcaeSZheng Fan     mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_COLOR, SFX_CALLMODE_RECORD, &aColorItem, 0L);
1374d4aefcaeSZheng Fan     maColor = aColor;
1375d4aefcaeSZheng Fan }
1376d4aefcaeSZheng Fan 
1377d4aefcaeSZheng Fan void TextPropertyPanel::SetBrushColor (
1378a7d1eb6fSPavel Janík     const String& /* rsColorName */,
1379d4aefcaeSZheng Fan     const Color aColor)
1380d4aefcaeSZheng Fan {
1381d4aefcaeSZheng Fan     SvxBrushItem aBrushItem(aColor, SID_ATTR_BRUSH_CHAR);
1382d4aefcaeSZheng Fan     mpBindings->GetDispatcher()->Execute(SID_ATTR_BRUSH_CHAR, SFX_CALLMODE_RECORD, &aBrushItem, 0L);
1383d4aefcaeSZheng Fan     maBackColor = aColor;
1384d4aefcaeSZheng Fan }
1385d4aefcaeSZheng Fan 
1386da72173fSAndre Fischer Color& TextPropertyPanel::GetUnderlineColor()
1387da72173fSAndre Fischer {
1388da72173fSAndre Fischer     return meUnderlineColor;
1389da72173fSAndre Fischer }
1390d4aefcaeSZheng Fan 
1391da72173fSAndre Fischer void TextPropertyPanel::SetUnderline(FontUnderline  eUnderline)
1392da72173fSAndre Fischer {
1393da72173fSAndre Fischer     meUnderline = eUnderline;
1394da72173fSAndre Fischer }
1395d4aefcaeSZheng Fan 
1396*45da7d5eSAndre Fischer 
1397*45da7d5eSAndre Fischer 
1398b9e67834SAndre Fischer } } // end of namespace svx::sidebar
1399