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>
47ae13266dSAndre Fischer #include <sfx2/sidebar/ControllerFactory.hxx>
48*6a606da0SAndre Fischer #include <sfx2/sidebar/Layouter.hxx>
49b9e67834SAndre Fischer #include <sfx2/sidebar/Theme.hxx>
50ae13266dSAndre Fischer #include <sfx2/sidebar/SidebarToolBox.hxx>
5195a18594SAndre Fischer #include "sfx2/imagemgr.hxx"
52b9e67834SAndre Fischer #include <svtools/ctrltool.hxx>
53b9e67834SAndre Fischer #include <svtools/unitconv.hxx>
54b9e67834SAndre Fischer
55b9e67834SAndre Fischer #include <vcl/gradient.hxx>
56b9e67834SAndre Fischer #include <vcl/svapp.hxx>
5795a18594SAndre Fischer #include <vcl/toolbox.hxx>
58d4aefcaeSZheng Fan #include "TextCharacterSpacingControl.hxx"
59d4aefcaeSZheng Fan #include "TextCharacterSpacingPopup.hxx"
60d4aefcaeSZheng Fan #include "TextUnderlineControl.hxx"
61d4aefcaeSZheng Fan #include "TextUnderlinePopup.hxx"
62facb16e7SArmin Le Grand #include <svx/sidebar/ColorControl.hxx>
63facb16e7SArmin Le Grand #include <svx/sidebar/PopupContainer.hxx>
64d4aefcaeSZheng Fan
65d4aefcaeSZheng Fan #include <boost/bind.hpp>
66b9e67834SAndre Fischer
67b9e67834SAndre Fischer using namespace css;
68b9e67834SAndre Fischer using namespace cssu;
69*6a606da0SAndre Fischer using namespace ::sfx2::sidebar;
70b9e67834SAndre Fischer using ::sfx2::sidebar::Theme;
717a32b0c8SAndre Fischer using ::sfx2::sidebar::ControlFactory;
72*6a606da0SAndre Fischer using ::sfx2::sidebar::Layouter;
73b9e67834SAndre Fischer
74b9e67834SAndre Fischer #define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
75b9e67834SAndre Fischer
76*6a606da0SAndre Fischer
77*6a606da0SAndre Fischer
78*6a606da0SAndre Fischer
79b9e67834SAndre Fischer namespace svx { namespace sidebar {
80b9e67834SAndre Fischer
81b9e67834SAndre Fischer #undef HAS_IA2
82b9e67834SAndre Fischer
83b9e67834SAndre Fischer
84d4aefcaeSZheng Fan
CreateCharacterSpacingControl(PopupContainer * pParent)85bc7f1831SAndre Fischer PopupControl* TextPropertyPanel::CreateCharacterSpacingControl (PopupContainer* pParent)
86d4aefcaeSZheng Fan {
8745da7d5eSAndre Fischer return new TextCharacterSpacingControl(pParent, *this, mpBindings);
88d4aefcaeSZheng Fan }
89b9e67834SAndre Fischer
CreateUnderlinePopupControl(PopupContainer * pParent)90d4aefcaeSZheng Fan PopupControl* TextPropertyPanel::CreateUnderlinePopupControl (PopupContainer* pParent)
91d4aefcaeSZheng Fan {
9245da7d5eSAndre Fischer return new TextUnderlineControl(pParent, *this, mpBindings);
93d4aefcaeSZheng Fan }
94b9e67834SAndre Fischer
95b7a56e95SArmin Le Grand namespace
96b7a56e95SArmin Le Grand {
GetAutomaticColor(void)97b7a56e95SArmin Le Grand Color GetAutomaticColor(void)
98b7a56e95SArmin Le Grand {
99b7a56e95SArmin Le Grand return COL_AUTO;
100b7a56e95SArmin Le Grand }
101b7a56e95SArmin Le Grand } // end of anonymous namespace
102b7a56e95SArmin Le Grand
GetSelFontSize()103d4aefcaeSZheng Fan long TextPropertyPanel::GetSelFontSize()
104d4aefcaeSZheng Fan {
105d4aefcaeSZheng Fan long nH = 240;
106d4aefcaeSZheng Fan SfxMapUnit eUnit = maSpacingControl.GetCoreMetric();
107d4aefcaeSZheng Fan if (mpHeightItem)
108d4aefcaeSZheng Fan nH = LogicToLogic( mpHeightItem->GetHeight(), (MapUnit)eUnit, MAP_TWIP );
109d4aefcaeSZheng Fan return nH;
110d4aefcaeSZheng Fan }
111b9e67834SAndre Fischer
112b9e67834SAndre Fischer
Create(Window * pParent,const cssu::Reference<css::frame::XFrame> & rxFrame,SfxBindings * pBindings,const::sfx2::sidebar::EnumContext & rContext)11395a18594SAndre Fischer TextPropertyPanel* TextPropertyPanel::Create (
114b9e67834SAndre Fischer Window* pParent,
115b9e67834SAndre Fischer const cssu::Reference<css::frame::XFrame>& rxFrame,
116ae13266dSAndre Fischer SfxBindings* pBindings,
117ae13266dSAndre Fischer const ::sfx2::sidebar::EnumContext& rContext)
118b9e67834SAndre Fischer {
119b9e67834SAndre Fischer if (pParent == NULL)
120b9e67834SAndre Fischer throw lang::IllegalArgumentException(A2S("no parent Window given to TextPropertyPanel::Create"), NULL, 0);
121b9e67834SAndre Fischer if ( ! rxFrame.is())
122b9e67834SAndre Fischer throw lang::IllegalArgumentException(A2S("no XFrame given to TextPropertyPanel::Create"), NULL, 1);
123b9e67834SAndre Fischer if (pBindings == NULL)
124b9e67834SAndre Fischer throw lang::IllegalArgumentException(A2S("no SfxBindings given to TextPropertyPanel::Create"), NULL, 2);
125b9e67834SAndre Fischer
12695a18594SAndre Fischer return new TextPropertyPanel(
12795a18594SAndre Fischer pParent,
12895a18594SAndre Fischer rxFrame,
129ae13266dSAndre Fischer pBindings,
130ae13266dSAndre Fischer rContext);
131b9e67834SAndre Fischer }
132b9e67834SAndre Fischer
133b9e67834SAndre Fischer
GetSpaceController()134d4aefcaeSZheng Fan ::sfx2::sidebar::ControllerItem& TextPropertyPanel::GetSpaceController()
135d4aefcaeSZheng Fan {
136d4aefcaeSZheng Fan return maSpacingControl;
137d4aefcaeSZheng Fan }
138b9e67834SAndre Fischer
TextPropertyPanel(Window * pParent,const cssu::Reference<css::frame::XFrame> & rxFrame,SfxBindings * pBindings,const::sfx2::sidebar::EnumContext & rContext)139b9e67834SAndre Fischer TextPropertyPanel::TextPropertyPanel (
140b9e67834SAndre Fischer Window* pParent,
141b9e67834SAndre Fischer const cssu::Reference<css::frame::XFrame>& rxFrame,
142ae13266dSAndre Fischer SfxBindings* pBindings,
143ae13266dSAndre Fischer const ::sfx2::sidebar::EnumContext& rContext)
1448ce66e53SOliver-Rainer Wittmann : Control(pParent, SVX_RES(RID_SIDEBAR_TEXT_PANEL)),
145b9e67834SAndre Fischer mpFontNameBox (new SvxSBFontNameBox(this, SVX_RES(CB_SBFONT_FONT))),
1468ce66e53SOliver-Rainer Wittmann maFontSizeBox (this, SVX_RES(MB_SBFONT_FONTSIZE)),
1477a32b0c8SAndre Fischer mpToolBoxFontBackground(ControlFactory::CreateToolBoxBackground(this)),
1487a32b0c8SAndre Fischer mpToolBoxFont(ControlFactory::CreateToolBox(
1497a32b0c8SAndre Fischer mpToolBoxFontBackground.get(),
1507a32b0c8SAndre Fischer SVX_RES(TB_FONT))),
15152d13b84SAndre Fischer mpToolBoxIncDecBackground(ControlFactory::CreateToolBoxBackground(this)),
15252d13b84SAndre Fischer mpToolBoxIncDec(ControlFactory::CreateToolBox(
15352d13b84SAndre Fischer mpToolBoxIncDecBackground.get(),
15452d13b84SAndre Fischer SVX_RES(TB_INCREASE_DECREASE))),
1557a32b0c8SAndre Fischer mpToolBoxScriptBackground(ControlFactory::CreateToolBoxBackground(this)),
1567a32b0c8SAndre Fischer mpToolBoxScript(ControlFactory::CreateToolBox(
1577a32b0c8SAndre Fischer mpToolBoxScriptBackground.get(),
1587a32b0c8SAndre Fischer SVX_RES(TB_SCRIPT))),
1597a32b0c8SAndre Fischer mpToolBoxScriptSwBackground(ControlFactory::CreateToolBoxBackground(this)),
1607a32b0c8SAndre Fischer mpToolBoxScriptSw(ControlFactory::CreateToolBox(
1617a32b0c8SAndre Fischer mpToolBoxScriptSwBackground.get(),
1627a32b0c8SAndre Fischer SVX_RES(TB_SCRIPT_SW))),
1637a32b0c8SAndre Fischer mpToolBoxSpacingBackground(ControlFactory::CreateToolBoxBackground(this)),
1647a32b0c8SAndre Fischer mpToolBoxSpacing(ControlFactory::CreateToolBox(
1657a32b0c8SAndre Fischer mpToolBoxSpacingBackground.get(),
1667a32b0c8SAndre Fischer SVX_RES(TB_SPACING))),
16752d13b84SAndre Fischer mpToolBoxFontColorBackground(ControlFactory::CreateToolBoxBackground(this)),
16852d13b84SAndre Fischer mpToolBoxFontColor(ControlFactory::CreateToolBox(
16952d13b84SAndre Fischer mpToolBoxFontColorBackground.get(),
17010405e3bSAndre Fischer SVX_RES(TB_FONTCOLOR),
17110405e3bSAndre Fischer rxFrame)),
17210405e3bSAndre Fischer mpToolBoxFontColorBackgroundSW(ControlFactory::CreateToolBoxBackground(this)),
17310405e3bSAndre Fischer mpToolBoxFontColorSW(ControlFactory::CreateToolBox(
17410405e3bSAndre Fischer mpToolBoxFontColorBackgroundSW.get(),
17510405e3bSAndre Fischer SVX_RES(TB_FONTCOLOR_SW),
17610405e3bSAndre Fischer rxFrame)),
1777a32b0c8SAndre Fischer mpToolBoxHighlightBackground(ControlFactory::CreateToolBoxBackground(this)),
1787a32b0c8SAndre Fischer mpToolBoxHighlight(ControlFactory::CreateToolBox(
1797a32b0c8SAndre Fischer mpToolBoxHighlightBackground.get(),
180ae13266dSAndre Fischer SVX_RES(TB_HIGHLIGHT),
181ae13266dSAndre Fischer rxFrame)),
182b9e67834SAndre Fischer mpFontColorUpdater(),
183b9e67834SAndre Fischer mpHighlightUpdater(),
184b9e67834SAndre Fischer
18545da7d5eSAndre Fischer maFontNameControl (SID_ATTR_CHAR_FONT, *pBindings, *this, A2S("CharFontName"), rxFrame),
18645da7d5eSAndre Fischer maFontSizeControl (SID_ATTR_CHAR_FONTHEIGHT, *pBindings, *this, A2S("FontHeight"), rxFrame),
18745da7d5eSAndre Fischer maWeightControl (SID_ATTR_CHAR_WEIGHT, *pBindings, *this, A2S("Bold"), rxFrame),
18845da7d5eSAndre Fischer maItalicControl (SID_ATTR_CHAR_POSTURE, *pBindings, *this, A2S("Italic"), rxFrame),
18945da7d5eSAndre Fischer maUnderlineControl (SID_ATTR_CHAR_UNDERLINE, *pBindings, *this, A2S("Underline"), rxFrame),
19045da7d5eSAndre Fischer maStrikeControl (SID_ATTR_CHAR_STRIKEOUT, *pBindings, *this, A2S("Strikeout"), rxFrame),
19145da7d5eSAndre Fischer maShadowControl (SID_ATTR_CHAR_SHADOWED, *pBindings, *this, A2S("Shadowed"), rxFrame),
19245da7d5eSAndre Fischer maScriptControlSw (SID_ATTR_CHAR_ESCAPEMENT, *pBindings, *this, A2S("Escapement"), rxFrame),
19345da7d5eSAndre Fischer maSuperScriptControl(SID_SET_SUPER_SCRIPT, *pBindings, *this, A2S("SuperScript"), rxFrame),
19445da7d5eSAndre Fischer maSubScriptControl (SID_SET_SUB_SCRIPT, *pBindings, *this, A2S("SubScript"), rxFrame),
19545da7d5eSAndre Fischer maSpacingControl (SID_ATTR_CHAR_KERNING, *pBindings, *this, A2S("Spacing"), rxFrame),
19645da7d5eSAndre Fischer maSDFontGrow (SID_GROW_FONT_SIZE, *pBindings, *this, A2S("Grow"), rxFrame),
19745da7d5eSAndre Fischer maSDFontShrink (SID_SHRINK_FONT_SIZE, *pBindings, *this, A2S("Shrink"), rxFrame),
198b9e67834SAndre Fischer
199b9e67834SAndre Fischer mpFontList (NULL),
200b9e67834SAndre Fischer mbMustDelete (false),
201b9e67834SAndre Fischer mbFocusOnFontSizeCtrl(false),
20245da7d5eSAndre Fischer maCharSpacePopup(this, ::boost::bind(&TextPropertyPanel::CreateCharacterSpacingControl, this, _1)),
20345da7d5eSAndre Fischer maUnderlinePopup(this, ::boost::bind(&TextPropertyPanel::CreateUnderlinePopupControl, this, _1)),
20495a18594SAndre Fischer mxFrame(rxFrame),
205b9e67834SAndre Fischer maContext(),
206*6a606da0SAndre Fischer mpBindings(pBindings),
207*6a606da0SAndre Fischer maLayouter(*this)
208b9e67834SAndre Fischer {
209b9e67834SAndre Fischer Initialize();
210ae13266dSAndre Fischer
211b9e67834SAndre Fischer FreeResource();
21210405e3bSAndre Fischer
21310405e3bSAndre Fischer UpdateFontColorToolbox(rContext);
214*6a606da0SAndre Fischer
215*6a606da0SAndre Fischer // Setup the grid layouter.
216*6a606da0SAndre Fischer maLayouter.GetCell(0,0).SetControl(*mpFontNameBox).SetMinimumWidth(Layouter::MapWidth(*this,FONTNAME_WIDTH));
217*6a606da0SAndre Fischer maLayouter.GetCell(0,2).SetControl(maFontSizeBox).SetFixedWidth();
218*6a606da0SAndre Fischer
219*6a606da0SAndre Fischer maLayouter.GetCell(1,0).SetControl(*mpToolBoxFontBackground).SetFixedWidth();
220*6a606da0SAndre Fischer maLayouter.GetCell(1,2).SetControl(*mpToolBoxIncDecBackground).SetFixedWidth();
221*6a606da0SAndre Fischer
222*6a606da0SAndre Fischer maLayouter.GetColumn(0)
223*6a606da0SAndre Fischer .SetWeight(1)
224*6a606da0SAndre Fischer .SetLeftPadding(Layouter::MapWidth(*this,SECTIONPAGE_MARGIN_HORIZONTAL));
225*6a606da0SAndre Fischer maLayouter.GetColumn(1)
226*6a606da0SAndre Fischer .SetWeight(0)
227*6a606da0SAndre Fischer .SetMinimumWidth(Layouter::MapWidth(*this, CONTROL_SPACING_HORIZONTAL));
228*6a606da0SAndre Fischer maLayouter.GetColumn(2)
229*6a606da0SAndre Fischer .SetWeight(0)
230*6a606da0SAndre Fischer .SetRightPadding(Layouter::MapWidth(*this,SECTIONPAGE_MARGIN_HORIZONTAL));
231b9e67834SAndre Fischer }
232b9e67834SAndre Fischer
233b9e67834SAndre Fischer
234b9e67834SAndre Fischer
235b9e67834SAndre Fischer
~TextPropertyPanel(void)236b9e67834SAndre Fischer TextPropertyPanel::~TextPropertyPanel (void)
237b9e67834SAndre Fischer {
238b9e67834SAndre Fischer if(mbMustDelete)
239b9e67834SAndre Fischer delete mpFontList;
240b9e67834SAndre Fischer
2417a32b0c8SAndre Fischer // Destroy the toolbox windows.
2427a32b0c8SAndre Fischer mpToolBoxIncDec.reset();
2437a32b0c8SAndre Fischer mpToolBoxFont.reset();
2447a32b0c8SAndre Fischer mpToolBoxFontColor.reset();
24510405e3bSAndre Fischer mpToolBoxFontColorSW.reset();
2467a32b0c8SAndre Fischer mpToolBoxScript.reset();
2477a32b0c8SAndre Fischer mpToolBoxScriptSw.reset();
2487a32b0c8SAndre Fischer mpToolBoxSpacing.reset();
2497a32b0c8SAndre Fischer mpToolBoxHighlight.reset();
2507a32b0c8SAndre Fischer
2517a32b0c8SAndre Fischer // Destroy the background windows of the toolboxes.
2527a32b0c8SAndre Fischer mpToolBoxIncDecBackground.reset();
2537a32b0c8SAndre Fischer mpToolBoxFontBackground.reset();
2547a32b0c8SAndre Fischer mpToolBoxFontColorBackground.reset();
25510405e3bSAndre Fischer mpToolBoxFontColorBackgroundSW.reset();
2567a32b0c8SAndre Fischer mpToolBoxScriptBackground.reset();
2577a32b0c8SAndre Fischer mpToolBoxScriptSwBackground.reset();
2587a32b0c8SAndre Fischer mpToolBoxSpacingBackground.reset();
2597a32b0c8SAndre Fischer mpToolBoxHighlightBackground.reset();
260b9e67834SAndre Fischer }
261b9e67834SAndre Fischer
262b9e67834SAndre Fischer
263b9e67834SAndre Fischer
264b9e67834SAndre Fischer
SetSpacing(long nKern)265d4aefcaeSZheng Fan void TextPropertyPanel::SetSpacing(long nKern)
266d4aefcaeSZheng Fan {
267d4aefcaeSZheng Fan mlKerning = nKern;
268d4aefcaeSZheng Fan }
26995a18594SAndre Fischer
27095a18594SAndre Fischer
HandleContextChange(const::sfx2::sidebar::EnumContext aContext)271b9e67834SAndre Fischer void TextPropertyPanel::HandleContextChange (
272b9e67834SAndre Fischer const ::sfx2::sidebar::EnumContext aContext)
273b9e67834SAndre Fischer {
274b9e67834SAndre Fischer if (maContext == aContext)
275b9e67834SAndre Fischer {
276b9e67834SAndre Fischer // Nothing to do.
277b9e67834SAndre Fischer return;
278b9e67834SAndre Fischer }
279b9e67834SAndre Fischer
280b9e67834SAndre Fischer maContext = aContext;
28165be1ea2SAndre Fischer switch (maContext.GetCombinedContext_DI())
282b9e67834SAndre Fischer {
283b9e67834SAndre Fischer case CombinedEnumContext(Application_Calc, Context_Cell):
284b9e67834SAndre Fischer case CombinedEnumContext(Application_Calc, Context_Pivot):
2858ce66e53SOliver-Rainer Wittmann mpToolBoxScriptSw->Hide();
286b9e67834SAndre Fischer mpToolBoxHighlight->Hide();
287f79579d2SAndre Fischer mpToolBoxScript->Disable();
288f79579d2SAndre Fischer mpToolBoxSpacing->Disable();
289f79579d2SAndre Fischer break;
290f79579d2SAndre Fischer
291f79579d2SAndre Fischer case CombinedEnumContext(Application_Calc, Context_EditCell):
292f79579d2SAndre Fischer case CombinedEnumContext(Application_Calc, Context_DrawText):
293f79579d2SAndre Fischer mpToolBoxScriptSw->Hide();
294f79579d2SAndre Fischer mpToolBoxHighlight->Hide();
295f79579d2SAndre Fischer mpToolBoxScript->Enable();
296f79579d2SAndre Fischer mpToolBoxSpacing->Enable();
297b9e67834SAndre Fischer break;
298b9e67834SAndre Fischer
29985f1aca2SAndre Fischer case CombinedEnumContext(Application_WriterVariants, Context_Text):
30085f1aca2SAndre Fischer case CombinedEnumContext(Application_WriterVariants, Context_Table):
301b9e67834SAndre Fischer mpToolBoxScriptSw->Show();
302b9e67834SAndre Fischer mpToolBoxScript->Hide();
303b9e67834SAndre Fischer mpToolBoxHighlight->Show();
304b9e67834SAndre Fischer mpToolBoxSpacing->Show();
305b9e67834SAndre Fischer break;
306b9e67834SAndre Fischer
30785f1aca2SAndre Fischer case CombinedEnumContext(Application_WriterVariants, Context_DrawText):
30885f1aca2SAndre Fischer case CombinedEnumContext(Application_WriterVariants, Context_Annotation):
309b9e67834SAndre Fischer mpToolBoxScriptSw->Show();
310b9e67834SAndre Fischer mpToolBoxScript->Hide();
311b9e67834SAndre Fischer mpToolBoxSpacing->Show();
312b9e67834SAndre Fischer mpToolBoxHighlight->Hide();
313b9e67834SAndre Fischer break;
314b9e67834SAndre Fischer
31537fee4fdSAndre Fischer case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
31637fee4fdSAndre Fischer case CombinedEnumContext(Application_DrawImpress, Context_Text):
31737fee4fdSAndre Fischer case CombinedEnumContext(Application_DrawImpress, Context_Table):
31837fee4fdSAndre Fischer case CombinedEnumContext(Application_DrawImpress, Context_OutlineText):
31937fee4fdSAndre Fischer case CombinedEnumContext(Application_DrawImpress, Context_Draw):
32037fee4fdSAndre Fischer case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
32137fee4fdSAndre Fischer case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
322b9e67834SAndre Fischer mpToolBoxScriptSw->Hide();
323b9e67834SAndre Fischer mpToolBoxScript->Show();
324b9e67834SAndre Fischer mpToolBoxSpacing->Show();
325b9e67834SAndre Fischer mpToolBoxHighlight->Hide();
326b9e67834SAndre Fischer break;
327b9e67834SAndre Fischer
328b9e67834SAndre Fischer default:
329b9e67834SAndre Fischer break;
330b9e67834SAndre Fischer }
33110405e3bSAndre Fischer
33210405e3bSAndre Fischer UpdateFontColorToolbox(aContext);
33310405e3bSAndre Fischer }
33410405e3bSAndre Fischer
33510405e3bSAndre Fischer
33610405e3bSAndre Fischer
33710405e3bSAndre Fischer
UpdateFontColorToolbox(const::sfx2::sidebar::EnumContext)33810405e3bSAndre Fischer void TextPropertyPanel::UpdateFontColorToolbox (
33927d21f5dSPavel Janík const ::sfx2::sidebar::EnumContext /* aContext */)
34010405e3bSAndre Fischer {
34110405e3bSAndre Fischer bool bIsWriterFontColor (false);
34210405e3bSAndre Fischer if (maContext.GetApplication_DI() == sfx2::sidebar::EnumContext::Application_WriterVariants)
34310405e3bSAndre Fischer if (maContext.GetContext() != sfx2::sidebar::EnumContext::Context_DrawText)
34410405e3bSAndre Fischer bIsWriterFontColor = true;
34510405e3bSAndre Fischer if (bIsWriterFontColor)
34610405e3bSAndre Fischer {
34710405e3bSAndre Fischer mpToolBoxFontColor->Hide();
34810405e3bSAndre Fischer mpToolBoxFontColorSW->Show();
34910405e3bSAndre Fischer }
35010405e3bSAndre Fischer else
35110405e3bSAndre Fischer {
35210405e3bSAndre Fischer mpToolBoxFontColor->Show();
35310405e3bSAndre Fischer mpToolBoxFontColorSW->Hide();
35410405e3bSAndre Fischer }
355b9e67834SAndre Fischer }
356b9e67834SAndre Fischer
35745da7d5eSAndre Fischer
358b9e67834SAndre Fischer
359b9e67834SAndre Fischer
DataChanged(const DataChangedEvent & rEvent)360b9e67834SAndre Fischer void TextPropertyPanel::DataChanged (const DataChangedEvent& rEvent)
361b9e67834SAndre Fischer {
36295a18594SAndre Fischer (void)rEvent;
36395a18594SAndre Fischer
36445da7d5eSAndre Fischer SetupToolboxItems();
365b9e67834SAndre Fischer }
366b9e67834SAndre Fischer
367b9e67834SAndre Fischer
368b9e67834SAndre Fischer
369bc7f1831SAndre Fischer
Initialize(void)370b9e67834SAndre Fischer void TextPropertyPanel::Initialize (void)
371b9e67834SAndre Fischer {
37295a18594SAndre Fischer //<<modify fill font list
37395a18594SAndre Fischer SfxObjectShell* pDocSh = SfxObjectShell::Current();
374b9e67834SAndre Fischer const SfxPoolItem* pItem = NULL;
375b9e67834SAndre Fischer
376b9e67834SAndre Fischer if (pDocSh != NULL)
377b9e67834SAndre Fischer pItem = pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST );
378b9e67834SAndre Fischer if (pItem != NULL)
379b9e67834SAndre Fischer mpFontList = ( (SvxFontListItem*)pItem )->GetFontList();
380b9e67834SAndre Fischer else
381b9e67834SAndre Fischer {
382b9e67834SAndre Fischer mpFontList = new FontList( Application::GetDefaultDevice() );
38345da7d5eSAndre Fischer mbMustDelete = true;
384b9e67834SAndre Fischer }
385b9e67834SAndre Fischer
386b9e67834SAndre Fischer mpFontNameBox->SetAccessibleName(mpFontNameBox->GetQuickHelpText());
38795a18594SAndre Fischer const FontInfo aFontInfo (mpFontList->Get( String::CreateFromAscii( "" ), String::CreateFromAscii( "" )));
38895a18594SAndre Fischer maFontSizeBox.Fill(&aFontInfo,mpFontList);
38995a18594SAndre Fischer maFontSizeBox.SetAccessibleName(maFontSizeBox.GetQuickHelpText());
390b9e67834SAndre Fischer
3918ce66e53SOliver-Rainer Wittmann //toolbox
39245da7d5eSAndre Fischer SetupToolboxItems();
39395a18594SAndre Fischer InitToolBoxIncDec();
39495a18594SAndre Fischer InitToolBoxFont();
39595a18594SAndre Fischer InitToolBoxScript();
39695a18594SAndre Fischer InitToolBoxSpacing();
397b9e67834SAndre Fischer
398b9e67834SAndre Fischer #ifdef HAS_IA2
399d4aefcaeSZheng Fan mpFontNameBox->SetAccRelationLabeledBy(&mpFontNameBox);
400d4aefcaeSZheng Fan mpFontNameBox->SetMpSubEditAccLableBy(&mpFontNameBox);
401b9e67834SAndre Fischer maFontSizeBox.SetAccRelationLabeledBy(&maFontSizeBox);
40295a18594SAndre Fischer maFontSizeBox.SetMpSubEditAccLableBy(&maFontSizeBox);
403d4aefcaeSZheng Fan mpToolBoxFont.SetAccRelationLabeledBy(&mpToolBoxFont);
404d4aefcaeSZheng Fan mpToolBoxIncDec.SetAccRelationLabeledBy(&mpToolBoxIncDec);
405d4aefcaeSZheng Fan mpToolBoxFontColor.SetAccRelationLabeledBy(&mpToolBoxFontColor);
406d4aefcaeSZheng Fan mpToolBoxScript.SetAccRelationLabeledBy(&mpToolBoxScript);
407d4aefcaeSZheng Fan mpToolBoxScriptSw.SetAccRelationLabeledBy(&mpToolBoxScriptSw);
408d4aefcaeSZheng Fan mpToolBoxSpacing.SetAccRelationLabeledBy(&mpToolBoxSpacing);
409d4aefcaeSZheng Fan mpToolBoxHighlight.SetAccRelationLabeledBy(&mpToolBoxHighlight);
410b9e67834SAndre Fischer #endif
411b9e67834SAndre Fischer
41295a18594SAndre Fischer //init state
41395a18594SAndre Fischer mpHeightItem = NULL;
41495a18594SAndre Fischer meWeight = WEIGHT_NORMAL;
41595a18594SAndre Fischer meItalic = ITALIC_NONE;
41695a18594SAndre Fischer mbShadow = false;
41795a18594SAndre Fischer meStrike = STRIKEOUT_NONE;
41895a18594SAndre Fischer mbPostureAvailable = true;
41995a18594SAndre Fischer mbWeightAvailable = true;
42095a18594SAndre Fischer meUnderline = UNDERLINE_NONE;
421ae13266dSAndre Fischer meUnderlineColor = COL_AUTO;
42295a18594SAndre Fischer meEscape = SVX_ESCAPEMENT_OFF;
42395a18594SAndre Fischer mbSuper = false;
42495a18594SAndre Fischer mbSub = false;
42595a18594SAndre Fischer mbKernAvailable = true;
42695a18594SAndre Fischer mbKernLBAvailable = true;
42795a18594SAndre Fischer mlKerning = 0;
428ae13266dSAndre Fischer
42995a18594SAndre Fischer //set handler
43095a18594SAndre Fischer mpFontNameBox->SetBindings(mpBindings);
43195a18594SAndre Fischer Link aLink = LINK(this, TextPropertyPanel, FontSelHdl);
43295a18594SAndre Fischer mpFontNameBox->SetSelectHdl(aLink);
43395a18594SAndre Fischer aLink = LINK(this, TextPropertyPanel, FontSizeModifyHdl);
43495a18594SAndre Fischer maFontSizeBox.SetModifyHdl(aLink);
43595a18594SAndre Fischer aLink = LINK(this, TextPropertyPanel, FontSizeSelHdl);
43695a18594SAndre Fischer maFontSizeBox.SetSelectHdl(aLink);
43795a18594SAndre Fischer aLink = LINK(this, TextPropertyPanel, FontSizeLoseFocus);
43895a18594SAndre Fischer maFontSizeBox.SetLoseFocusHdl(aLink);
439b9e67834SAndre Fischer }
440b9e67834SAndre Fischer
EndSpacingPopupMode(void)441d4aefcaeSZheng Fan void TextPropertyPanel::EndSpacingPopupMode (void)
442d4aefcaeSZheng Fan {
443d4aefcaeSZheng Fan maCharSpacePopup.Hide();
444d4aefcaeSZheng Fan }
445b9e67834SAndre Fischer
EndUnderlinePopupMode(void)446d4aefcaeSZheng Fan void TextPropertyPanel::EndUnderlinePopupMode (void)
447d4aefcaeSZheng Fan {
448d4aefcaeSZheng Fan maUnderlinePopup.Hide();
449d4aefcaeSZheng Fan }
450b9e67834SAndre Fischer
451b9e67834SAndre Fischer
InitToolBoxFont()452b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxFont()
453b9e67834SAndre Fischer {
454b9e67834SAndre Fischer mpToolBoxFont->SetBackground(Wallpaper());
455b9e67834SAndre Fischer mpToolBoxFont->SetPaintTransparent(true);
456b9e67834SAndre Fischer
457b9e67834SAndre Fischer Size aTbxSize( mpToolBoxFont->CalcWindowSizePixel() );
458b9e67834SAndre Fischer mpToolBoxFont->SetOutputSizePixel( aTbxSize );
459b9e67834SAndre Fischer
460b9e67834SAndre Fischer Link aLink = LINK(this, TextPropertyPanel, ToolboxFontSelectHandler);
461b9e67834SAndre Fischer mpToolBoxFont->SetSelectHdl ( aLink );
462b9e67834SAndre Fischer aLink = LINK(this, TextPropertyPanel, ToolBoxUnderlineClickHdl);
463b9e67834SAndre Fischer mpToolBoxFont->SetDropdownClickHdl(aLink);
464b9e67834SAndre Fischer }
465b9e67834SAndre Fischer
466b9e67834SAndre Fischer
467b9e67834SAndre Fischer
468b9e67834SAndre Fischer
InitToolBoxIncDec()469b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxIncDec()
470b9e67834SAndre Fischer {
471b9e67834SAndre Fischer Size aTbxSize( mpToolBoxIncDec->CalcWindowSizePixel() );
472b9e67834SAndre Fischer mpToolBoxIncDec->SetOutputSizePixel( aTbxSize );
473b9e67834SAndre Fischer
474b9e67834SAndre Fischer Link aLink = LINK(this, TextPropertyPanel, ToolboxIncDecSelectHdl);
475b9e67834SAndre Fischer mpToolBoxIncDec->SetSelectHdl ( aLink );
476b9e67834SAndre Fischer }
477b9e67834SAndre Fischer
478b9e67834SAndre Fischer
479b9e67834SAndre Fischer
480b9e67834SAndre Fischer
InitToolBoxScript()481b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxScript()
482b9e67834SAndre Fischer {
483b9e67834SAndre Fischer Size aTbxSize( mpToolBoxScriptSw->CalcWindowSizePixel() );
484b9e67834SAndre Fischer mpToolBoxScriptSw->SetOutputSizePixel( aTbxSize );
485b9e67834SAndre Fischer
486b9e67834SAndre Fischer Link aLink = LINK(this, TextPropertyPanel, ToolBoxSwScriptSelectHdl);
487b9e67834SAndre Fischer mpToolBoxScriptSw->SetSelectHdl ( aLink );
488b9e67834SAndre Fischer
489b9e67834SAndre Fischer aTbxSize = mpToolBoxScript->CalcWindowSizePixel() ;
490b9e67834SAndre Fischer mpToolBoxScript->SetOutputSizePixel( aTbxSize );
491b9e67834SAndre Fischer
492b9e67834SAndre Fischer aLink = LINK(this, TextPropertyPanel, ToolBoxScriptSelectHdl);
493b9e67834SAndre Fischer mpToolBoxScript->SetSelectHdl ( aLink );
494b9e67834SAndre Fischer }
InitToolBoxSpacing()495b9e67834SAndre Fischer void TextPropertyPanel::InitToolBoxSpacing()
496b9e67834SAndre Fischer {
497b9e67834SAndre Fischer Size aTbxSize( mpToolBoxSpacing->CalcWindowSizePixel() );
498b9e67834SAndre Fischer mpToolBoxSpacing->SetOutputSizePixel( aTbxSize );
499b9e67834SAndre Fischer mpToolBoxSpacing->SetItemBits( TBI_SPACING, mpToolBoxSpacing->GetItemBits( TBI_SPACING ) | TIB_DROPDOWNONLY );
500b9e67834SAndre Fischer
501b9e67834SAndre Fischer Link aLink = LINK(this, TextPropertyPanel, SpacingClickHdl);
502b9e67834SAndre Fischer mpToolBoxSpacing->SetDropdownClickHdl ( aLink );
503b9e67834SAndre Fischer mpToolBoxSpacing->SetSelectHdl( aLink );
504b9e67834SAndre Fischer }
505b9e67834SAndre Fischer
506b9e67834SAndre Fischer
507b9e67834SAndre Fischer
508b9e67834SAndre Fischer
SetupToolboxItems(void)50945da7d5eSAndre Fischer void TextPropertyPanel::SetupToolboxItems (void)
510b9e67834SAndre Fischer {
51145da7d5eSAndre Fischer maSDFontGrow.SetupToolBoxItem(*mpToolBoxIncDec, TBI_INCREASE);
51245da7d5eSAndre Fischer maSDFontShrink.SetupToolBoxItem(*mpToolBoxIncDec, TBI_DECREASE);
51345da7d5eSAndre Fischer
51445da7d5eSAndre Fischer maWeightControl.SetupToolBoxItem(*mpToolBoxFont, TBI_BOLD);
5158ce66e53SOliver-Rainer Wittmann maItalicControl.SetupToolBoxItem(*mpToolBoxFont, TBI_ITALIC);
5168ce66e53SOliver-Rainer Wittmann maUnderlineControl.SetupToolBoxItem(*mpToolBoxFont, TBI_UNDERLINE);
5178ce66e53SOliver-Rainer Wittmann maStrikeControl.SetupToolBoxItem(*mpToolBoxFont, TBI_STRIKEOUT);
5188ce66e53SOliver-Rainer Wittmann maShadowControl.SetupToolBoxItem(*mpToolBoxFont, TBI_SHADOWED);
51945da7d5eSAndre Fischer
52045da7d5eSAndre Fischer //for sw
52145da7d5eSAndre Fischer maSuperScriptControl.SetupToolBoxItem(*mpToolBoxScriptSw, TBI_SUPER_SW);
52245da7d5eSAndre Fischer maSubScriptControl.SetupToolBoxItem(*mpToolBoxScriptSw, TBI_SUB_SW);
52345da7d5eSAndre Fischer //for sc and sd
524ccab7bc0SAndre Fischer maSuperScriptControl.SetupToolBoxItem(*mpToolBoxScript, TBI_SUPER);
52545da7d5eSAndre Fischer maSubScriptControl.SetupToolBoxItem(*mpToolBoxScript, TBI_SUB);
52645da7d5eSAndre Fischer maSpacingControl.SetupToolBoxItem(*mpToolBoxSpacing, TBI_SPACING);
527b9e67834SAndre Fischer }
528b9e67834SAndre Fischer
529b9e67834SAndre Fischer
530b9e67834SAndre Fischer
531b9e67834SAndre Fischer
IMPL_LINK(TextPropertyPanel,FontSelHdl,FontNameBox *,pBox)532b9e67834SAndre Fischer IMPL_LINK( TextPropertyPanel, FontSelHdl, FontNameBox*, pBox )
533b9e67834SAndre Fischer {
534b9e67834SAndre Fischer if ( !pBox->IsTravelSelect() )
535b9e67834SAndre Fischer {
536b9e67834SAndre Fischer if( SfxViewShell::Current() )
537b9e67834SAndre Fischer {
538b9e67834SAndre Fischer Window* pShellWnd = SfxViewShell::Current()->GetWindow();
539b9e67834SAndre Fischer
540b9e67834SAndre Fischer if ( pShellWnd )
541b9e67834SAndre Fischer pShellWnd->GrabFocus();
542b9e67834SAndre Fischer }
543b9e67834SAndre Fischer }
544b9e67834SAndre Fischer return 0;
545b9e67834SAndre Fischer }
5468ce66e53SOliver-Rainer Wittmann
IMPL_LINK(TextPropertyPanel,FontSizeModifyHdl,FontSizeBox *,pSizeBox)547b9e67834SAndre Fischer IMPL_LINK( TextPropertyPanel, FontSizeModifyHdl, FontSizeBox*, pSizeBox )
548b9e67834SAndre Fischer {
549b9e67834SAndre Fischer if (pSizeBox == &maFontSizeBox)
550b9e67834SAndre Fischer {
551b9e67834SAndre Fischer long nSize = pSizeBox->GetValue();
552b9e67834SAndre Fischer mbFocusOnFontSizeCtrl = true;
553b9e67834SAndre Fischer
554b9e67834SAndre Fischer float fSize = (float)nSize / 10;
555b9e67834SAndre Fischer SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric();
556b9e67834SAndre Fischer SvxFontHeightItem aItem( CalcToUnit( fSize, eUnit ), 100, SID_ATTR_CHAR_FONTHEIGHT ) ;
557b9e67834SAndre Fischer
558b9e67834SAndre Fischer mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONTHEIGHT, SFX_CALLMODE_RECORD, &aItem, 0L );
559b9e67834SAndre Fischer mpBindings->Invalidate(SID_ATTR_CHAR_FONTHEIGHT,true,false);
560b9e67834SAndre Fischer }
561b9e67834SAndre Fischer return 0;
562b9e67834SAndre Fischer }
5638ce66e53SOliver-Rainer Wittmann
IMPL_LINK(TextPropertyPanel,FontSizeSelHdl,FontSizeBox *,pSizeBox)564b9e67834SAndre Fischer IMPL_LINK( TextPropertyPanel, FontSizeSelHdl, FontSizeBox*, pSizeBox )
565b9e67834SAndre Fischer {
566b9e67834SAndre Fischer if ( !pSizeBox->IsTravelSelect() )
567b9e67834SAndre Fischer {
568b9e67834SAndre Fischer if( SfxViewShell::Current() )
569b9e67834SAndre Fischer {
570b9e67834SAndre Fischer Window* pShellWnd = SfxViewShell::Current()->GetWindow();
571b9e67834SAndre Fischer
572b9e67834SAndre Fischer if ( pShellWnd )
573b9e67834SAndre Fischer pShellWnd->GrabFocus();
574b9e67834SAndre Fischer }
575b9e67834SAndre Fischer }
576b9e67834SAndre Fischer
577b9e67834SAndre Fischer return 0;
578b9e67834SAndre Fischer }
5798ce66e53SOliver-Rainer Wittmann
IMPL_LINK(TextPropertyPanel,FontSizeLoseFocus,FontSizeBox *,pSizeBox)580b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, FontSizeLoseFocus, FontSizeBox*, pSizeBox)
581b9e67834SAndre Fischer {
582b9e67834SAndre Fischer if(pSizeBox == &maFontSizeBox)
583b9e67834SAndre Fischer {
584b9e67834SAndre Fischer mbFocusOnFontSizeCtrl = false;
585b9e67834SAndre Fischer }
586b9e67834SAndre Fischer return 0;
587b9e67834SAndre Fischer }
588b9e67834SAndre Fischer
IMPL_LINK(TextPropertyPanel,ToolboxFontSelectHandler,ToolBox *,pToolBox)589b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolboxFontSelectHandler, ToolBox*, pToolBox)
590b9e67834SAndre Fischer {
5918ce66e53SOliver-Rainer Wittmann const sal_uInt16 nId = pToolBox->GetCurItemId();
592b9e67834SAndre Fischer
5938ce66e53SOliver-Rainer Wittmann switch (nId)
59445da7d5eSAndre Fischer {
59545da7d5eSAndre Fischer case TBI_BOLD:
59645da7d5eSAndre Fischer {
59745da7d5eSAndre Fischer EndTracking();
59845da7d5eSAndre Fischer if(meWeight != WEIGHT_BOLD)
59945da7d5eSAndre Fischer meWeight = WEIGHT_BOLD;
60045da7d5eSAndre Fischer else
60145da7d5eSAndre Fischer meWeight = WEIGHT_NORMAL;
60245da7d5eSAndre Fischer SvxWeightItem aWeightItem(meWeight, SID_ATTR_CHAR_WEIGHT);
60345da7d5eSAndre Fischer mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_WEIGHT, SFX_CALLMODE_RECORD, &aWeightItem, 0L);
60445da7d5eSAndre Fischer UpdateItem(SID_ATTR_CHAR_WEIGHT);
60545da7d5eSAndre Fischer break;
60645da7d5eSAndre Fischer }
60745da7d5eSAndre Fischer case TBI_ITALIC:
60845da7d5eSAndre Fischer {
60945da7d5eSAndre Fischer EndTracking();
61045da7d5eSAndre Fischer if(meItalic != ITALIC_NORMAL)
61145da7d5eSAndre Fischer meItalic = ITALIC_NORMAL;
61245da7d5eSAndre Fischer else
61345da7d5eSAndre Fischer meItalic = ITALIC_NONE;
61445da7d5eSAndre Fischer SvxPostureItem aPostureItem(meItalic, SID_ATTR_CHAR_POSTURE);
61545da7d5eSAndre Fischer mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_POSTURE, SFX_CALLMODE_RECORD, &aPostureItem, 0L);
61645da7d5eSAndre Fischer UpdateItem(SID_ATTR_CHAR_POSTURE);
61745da7d5eSAndre Fischer break;
61845da7d5eSAndre Fischer }
61945da7d5eSAndre Fischer case TBI_UNDERLINE:
62045da7d5eSAndre Fischer {
62145da7d5eSAndre Fischer EndTracking();
62245da7d5eSAndre Fischer if(meUnderline == UNDERLINE_NONE)
62345da7d5eSAndre Fischer {
62445da7d5eSAndre Fischer meUnderline = UNDERLINE_SINGLE;
62545da7d5eSAndre Fischer SvxUnderlineItem aLineItem(meUnderline, SID_ATTR_CHAR_UNDERLINE);
62645da7d5eSAndre Fischer aLineItem.SetColor(meUnderlineColor);
62745da7d5eSAndre Fischer mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_UNDERLINE, SFX_CALLMODE_RECORD, &aLineItem, 0L);
62845da7d5eSAndre Fischer }
62945da7d5eSAndre Fischer else
63045da7d5eSAndre Fischer {
63145da7d5eSAndre Fischer meUnderline = UNDERLINE_NONE;
63245da7d5eSAndre Fischer SvxUnderlineItem aLineItem(meUnderline, SID_ATTR_CHAR_UNDERLINE);
63345da7d5eSAndre Fischer mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_UNDERLINE, SFX_CALLMODE_RECORD, &aLineItem, 0L);
63445da7d5eSAndre Fischer }
63545da7d5eSAndre Fischer UpdateItem(SID_ATTR_CHAR_UNDERLINE);
6368ce66e53SOliver-Rainer Wittmann break;
63745da7d5eSAndre Fischer }
63845da7d5eSAndre Fischer case TBI_STRIKEOUT:
63945da7d5eSAndre Fischer {
64045da7d5eSAndre Fischer EndTracking();
64145da7d5eSAndre Fischer if(meStrike != STRIKEOUT_NONE && meStrike != STRIKEOUT_DONTKNOW)
64245da7d5eSAndre Fischer meStrike = STRIKEOUT_NONE;
64345da7d5eSAndre Fischer else
64445da7d5eSAndre Fischer meStrike = STRIKEOUT_SINGLE;
64545da7d5eSAndre Fischer SvxCrossedOutItem aStrikeItem(meStrike,SID_ATTR_CHAR_STRIKEOUT);
64645da7d5eSAndre Fischer mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_STRIKEOUT, SFX_CALLMODE_RECORD, &aStrikeItem, 0L);
64745da7d5eSAndre Fischer UpdateItem(SID_ATTR_CHAR_STRIKEOUT);
64845da7d5eSAndre Fischer break;
64945da7d5eSAndre Fischer }
65045da7d5eSAndre Fischer case TBI_SHADOWED:
65145da7d5eSAndre Fischer {
65245da7d5eSAndre Fischer EndTracking();
65345da7d5eSAndre Fischer mbShadow = !mbShadow;
65445da7d5eSAndre Fischer SvxShadowedItem aShadowItem(mbShadow, SID_ATTR_CHAR_SHADOWED);
65545da7d5eSAndre Fischer mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_SHADOWED, SFX_CALLMODE_RECORD, &aShadowItem, 0L);
65645da7d5eSAndre Fischer UpdateItem(SID_ATTR_CHAR_SHADOWED);
65745da7d5eSAndre Fischer break;
65845da7d5eSAndre Fischer }
6598ce66e53SOliver-Rainer Wittmann }
6608ce66e53SOliver-Rainer Wittmann return 0;
661b9e67834SAndre Fischer }
662b9e67834SAndre Fischer
663b9e67834SAndre Fischer
664b9e67834SAndre Fischer
665b9e67834SAndre Fischer
IMPL_LINK(TextPropertyPanel,ToolboxIncDecSelectHdl,ToolBox *,pToolBox)666b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolboxIncDecSelectHdl, ToolBox*, pToolBox)
667b9e67834SAndre Fischer {
6688ce66e53SOliver-Rainer Wittmann const sal_uInt16 nId = pToolBox->GetCurItemId();
669b9e67834SAndre Fischer
6708ce66e53SOliver-Rainer Wittmann // font size +/- enhancement in sd
67145da7d5eSAndre Fischer switch (maContext.GetCombinedContext_DI())
672b9e67834SAndre Fischer {
67345da7d5eSAndre Fischer case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
67445da7d5eSAndre Fischer case CombinedEnumContext(Application_DrawImpress, Context_Text):
67545da7d5eSAndre Fischer case CombinedEnumContext(Application_DrawImpress, Context_Table):
67645da7d5eSAndre Fischer case CombinedEnumContext(Application_DrawImpress, Context_OutlineText):
67745da7d5eSAndre Fischer case CombinedEnumContext(Application_DrawImpress, Context_Draw):
67845da7d5eSAndre Fischer case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
67945da7d5eSAndre Fischer case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
680b9e67834SAndre Fischer if(nId == TBI_INCREASE)
681b9e67834SAndre Fischer {
682b9e67834SAndre Fischer EndTracking();
683b9e67834SAndre Fischer SfxVoidItem aItem(SID_GROW_FONT_SIZE);
684b9e67834SAndre Fischer mpBindings->GetDispatcher()->Execute( SID_GROW_FONT_SIZE, SFX_CALLMODE_RECORD, &aItem, 0L );
685b9e67834SAndre Fischer }
686b9e67834SAndre Fischer else if(nId == TBI_DECREASE)
687b9e67834SAndre Fischer {
688b9e67834SAndre Fischer EndTracking();
689b9e67834SAndre Fischer SfxVoidItem aItem(SID_SHRINK_FONT_SIZE);
690b9e67834SAndre Fischer mpBindings->GetDispatcher()->Execute( SID_SHRINK_FONT_SIZE, SFX_CALLMODE_RECORD, &aItem, 0L );
691b9e67834SAndre Fischer }
692b9e67834SAndre Fischer break;
693b9e67834SAndre Fischer
694b9e67834SAndre Fischer default:
695b9e67834SAndre Fischer if(nId == TBI_INCREASE)
696b9e67834SAndre Fischer {
697b9e67834SAndre Fischer EndTracking();
698b9e67834SAndre Fischer mbFocusOnFontSizeCtrl = false;
699b9e67834SAndre Fischer sal_Int64 iValue = maFontSizeBox.GetValue();
700b9e67834SAndre Fischer int iPos = maFontSizeBox.GetValuePos(iValue, FUNIT_NONE);
701b9e67834SAndre Fischer long nSize = iValue;
702b9e67834SAndre Fischer if(iPos != LISTBOX_ENTRY_NOTFOUND)
703b9e67834SAndre Fischer nSize = maFontSizeBox.GetValue(iPos+1 , FUNIT_NONE);
704b9e67834SAndre Fischer else if(iValue >= 100 && iValue < 105)
705b9e67834SAndre Fischer nSize = 105;
706b9e67834SAndre Fischer else if(iValue >= 105 && iValue < 110)
707b9e67834SAndre Fischer nSize = 110;
708b9e67834SAndre Fischer else if(iValue < 960)
709b9e67834SAndre Fischer {
710b9e67834SAndre Fischer nSize = (nSize / 10) * 10 + 10;
711b9e67834SAndre Fischer while(maFontSizeBox.GetValuePos(nSize, FUNIT_NONE) == LISTBOX_ENTRY_NOTFOUND)
712b9e67834SAndre Fischer nSize += 10;
713b9e67834SAndre Fischer }
714b9e67834SAndre Fischer else
715b9e67834SAndre Fischer {
716b9e67834SAndre Fischer nSize = iValue;
717b9e67834SAndre Fischer }
718b9e67834SAndre Fischer
719b9e67834SAndre Fischer float fSize = (float)nSize / 10;
720b9e67834SAndre Fischer
721b9e67834SAndre Fischer SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric();
722b9e67834SAndre Fischer SvxFontHeightItem aItem( CalcToUnit( fSize, eUnit ), 100, SID_ATTR_CHAR_FONTHEIGHT ) ;
723b9e67834SAndre Fischer
724b9e67834SAndre Fischer mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONTHEIGHT, SFX_CALLMODE_RECORD, &aItem, 0L );
725b9e67834SAndre Fischer mpBindings->Invalidate(SID_ATTR_CHAR_FONTHEIGHT,true,false);
726b9e67834SAndre Fischer maFontSizeBox.SetValue( nSize );
727b9e67834SAndre Fischer }
728b9e67834SAndre Fischer else if(nId == TBI_DECREASE)
729b9e67834SAndre Fischer {
730b9e67834SAndre Fischer EndTracking();
731b9e67834SAndre Fischer mbFocusOnFontSizeCtrl = false;
732b9e67834SAndre Fischer sal_Int64 iValue = maFontSizeBox.GetValue();
733b9e67834SAndre Fischer int iPos = maFontSizeBox.GetValuePos(iValue, FUNIT_NONE);
734b9e67834SAndre Fischer long nSize = iValue;
735b9e67834SAndre Fischer if(iPos != LISTBOX_ENTRY_NOTFOUND)
736b9e67834SAndre Fischer nSize = maFontSizeBox.GetValue(iPos-1 , FUNIT_NONE);
737b9e67834SAndre Fischer else if(iValue > 100 && iValue <= 105)
738b9e67834SAndre Fischer nSize = 100;
739b9e67834SAndre Fischer else if(iValue > 105 && iValue <= 110)
740b9e67834SAndre Fischer nSize = 105;
741b9e67834SAndre Fischer else if(iValue > 960)
742b9e67834SAndre Fischer {
743b9e67834SAndre Fischer nSize = 960;
744b9e67834SAndre Fischer }
745b9e67834SAndre Fischer else if(iValue > 60)
746b9e67834SAndre Fischer {
747b9e67834SAndre Fischer nSize = (nSize / 10) * 10 ;
748b9e67834SAndre Fischer while(maFontSizeBox.GetValuePos(nSize, FUNIT_NONE) == LISTBOX_ENTRY_NOTFOUND)
749b9e67834SAndre Fischer nSize -= 10;
750b9e67834SAndre Fischer }
751b9e67834SAndre Fischer else
752b9e67834SAndre Fischer {
753b9e67834SAndre Fischer nSize = iValue;
754b9e67834SAndre Fischer }
755b9e67834SAndre Fischer
756b9e67834SAndre Fischer float fSize = (float)nSize / 10;
757b9e67834SAndre Fischer
758b9e67834SAndre Fischer SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric();
759b9e67834SAndre Fischer SvxFontHeightItem aItem( CalcToUnit( fSize, eUnit ), 100, SID_ATTR_CHAR_FONTHEIGHT ) ;
760b9e67834SAndre Fischer
761b9e67834SAndre Fischer mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONTHEIGHT, SFX_CALLMODE_RECORD, &aItem, 0L );
762b9e67834SAndre Fischer mpBindings->Invalidate(SID_ATTR_CHAR_FONTHEIGHT,true,false);
763b9e67834SAndre Fischer maFontSizeBox.SetValue( nSize );
764b9e67834SAndre Fischer }
765b9e67834SAndre Fischer }
76645da7d5eSAndre Fischer UpdateItem(SID_ATTR_CHAR_FONTHEIGHT);
76745da7d5eSAndre Fischer
768b9e67834SAndre Fischer return 0;
769b9e67834SAndre Fischer }
770b9e67834SAndre Fischer
771b9e67834SAndre Fischer
772b9e67834SAndre Fischer
IMPL_LINK(TextPropertyPanel,ToolBoxUnderlineClickHdl,ToolBox *,pToolBox)773b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolBoxUnderlineClickHdl, ToolBox*, pToolBox)
774b9e67834SAndre Fischer {
775b9e67834SAndre Fischer const sal_uInt16 nId = pToolBox->GetCurItemId();
776d4aefcaeSZheng Fan OSL_ASSERT(nId == TBI_UNDERLINE);
777b9e67834SAndre Fischer if(nId == TBI_UNDERLINE)
778b9e67834SAndre Fischer {
779b9e67834SAndre Fischer pToolBox->SetItemDown( nId, true );
780d4aefcaeSZheng Fan maUnderlinePopup.Rearrange(meUnderline);
781d4aefcaeSZheng Fan maUnderlinePopup.Show(*pToolBox);
782b9e67834SAndre Fischer
783b9e67834SAndre Fischer }
784d4aefcaeSZheng Fan return 0L;
785b9e67834SAndre Fischer }
786b9e67834SAndre Fischer
787b9e67834SAndre Fischer
788b9e67834SAndre Fischer
789b9e67834SAndre Fischer
IMPL_LINK(TextPropertyPanel,ToolBoxSwScriptSelectHdl,ToolBox *,pToolBox)790b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolBoxSwScriptSelectHdl, ToolBox*, pToolBox)
791b9e67834SAndre Fischer {
792b9e67834SAndre Fischer const sal_uInt16 nId = pToolBox->GetCurItemId();
793b9e67834SAndre Fischer if( nId == TBI_SUPER_SW )
794b9e67834SAndre Fischer {
795b9e67834SAndre Fischer if(meEscape != SVX_ESCAPEMENT_SUPERSCRIPT)
796b9e67834SAndre Fischer {
797b9e67834SAndre Fischer meEscape = SVX_ESCAPEMENT_SUPERSCRIPT;
798b9e67834SAndre Fischer SvxEscapementItem aSupItem(DFLT_ESC_SUPER, DFLT_ESC_PROP, SID_ATTR_CHAR_ESCAPEMENT);
799b9e67834SAndre Fischer mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aSupItem, 0L );
800b9e67834SAndre Fischer }
801b9e67834SAndre Fischer else
802b9e67834SAndre Fischer {
803b9e67834SAndre Fischer meEscape = SVX_ESCAPEMENT_OFF;
804b9e67834SAndre Fischer SvxEscapementItem aNoneItem(0, 100, SID_ATTR_CHAR_ESCAPEMENT);
805b9e67834SAndre Fischer mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aNoneItem, 0L );
806b9e67834SAndre Fischer }
807b9e67834SAndre Fischer }
808b9e67834SAndre Fischer else if(TBI_SUB_SW == nId)
809b9e67834SAndre Fischer {
810b9e67834SAndre Fischer if(meEscape != SVX_ESCAPEMENT_SUBSCRIPT)
811b9e67834SAndre Fischer {
812b9e67834SAndre Fischer meEscape = (SvxEscapement)SVX_ESCAPEMENT_SUBSCRIPT;
813b9e67834SAndre Fischer SvxEscapementItem aSubItem(DFLT_ESC_SUB, DFLT_ESC_PROP, SID_ATTR_CHAR_ESCAPEMENT);
814b9e67834SAndre Fischer mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aSubItem, 0L );
815b9e67834SAndre Fischer }
816b9e67834SAndre Fischer else
817b9e67834SAndre Fischer {
818b9e67834SAndre Fischer meEscape = SVX_ESCAPEMENT_OFF;
819b9e67834SAndre Fischer SvxEscapementItem aNoneItem(0, 100, SID_ATTR_CHAR_ESCAPEMENT);
820b9e67834SAndre Fischer mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aNoneItem, 0L );
821b9e67834SAndre Fischer }
822b9e67834SAndre Fischer }
82345da7d5eSAndre Fischer UpdateItem(SID_ATTR_CHAR_ESCAPEMENT);
824b9e67834SAndre Fischer
825b9e67834SAndre Fischer return 0;
826b9e67834SAndre Fischer }
827b9e67834SAndre Fischer
828b9e67834SAndre Fischer
829b9e67834SAndre Fischer
830b9e67834SAndre Fischer
IMPL_LINK(TextPropertyPanel,ToolBoxScriptSelectHdl,ToolBox *,pToolBox)831b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, ToolBoxScriptSelectHdl, ToolBox*, pToolBox)
832b9e67834SAndre Fischer {
833b9e67834SAndre Fischer const sal_uInt16 nId = pToolBox->GetCurItemId();
834b9e67834SAndre Fischer if( nId == TBI_SUPER )
835b9e67834SAndre Fischer {
836b9e67834SAndre Fischer mbSuper = !mbSuper;
837b9e67834SAndre Fischer SfxBoolItem aSupItem(SID_SET_SUPER_SCRIPT, mbSuper);
838b9e67834SAndre Fischer mpBindings->GetDispatcher()->Execute( SID_SET_SUPER_SCRIPT, SFX_CALLMODE_RECORD, &aSupItem, 0L );
83945da7d5eSAndre Fischer UpdateItem(SID_SET_SUPER_SCRIPT);
840b9e67834SAndre Fischer }
841b9e67834SAndre Fischer else if(TBI_SUB == nId)
842b9e67834SAndre Fischer {
843b9e67834SAndre Fischer
844b9e67834SAndre Fischer mbSub = !mbSub;
845b9e67834SAndre Fischer SfxBoolItem aSubItem(SID_SET_SUB_SCRIPT, mbSub );
846b9e67834SAndre Fischer mpBindings->GetDispatcher()->Execute( SID_SET_SUB_SCRIPT, SFX_CALLMODE_RECORD, &aSubItem, 0L );
84745da7d5eSAndre Fischer UpdateItem(SID_SET_SUB_SCRIPT);
848b9e67834SAndre Fischer }
849b9e67834SAndre Fischer return 0;
850b9e67834SAndre Fischer }
851b9e67834SAndre Fischer
852b9e67834SAndre Fischer
853b9e67834SAndre Fischer
854b9e67834SAndre Fischer
IMPL_LINK(TextPropertyPanel,SpacingClickHdl,ToolBox *,pToolBox)855b9e67834SAndre Fischer IMPL_LINK(TextPropertyPanel, SpacingClickHdl, ToolBox*, pToolBox)
856b9e67834SAndre Fischer {
857b9e67834SAndre Fischer const sal_uInt16 nId = pToolBox->GetCurItemId();
858d4aefcaeSZheng Fan OSL_ASSERT(nId == TBI_SPACING);
859b9e67834SAndre Fischer if(nId == TBI_SPACING)
860b9e67834SAndre Fischer {
861b9e67834SAndre Fischer pToolBox->SetItemDown( nId, true );
862d4aefcaeSZheng Fan maCharSpacePopup.Rearrange(mbKernLBAvailable,mbKernAvailable,mlKerning);
863d4aefcaeSZheng Fan maCharSpacePopup.Show(*pToolBox);
864b9e67834SAndre Fischer
865b9e67834SAndre Fischer }
866d4aefcaeSZheng Fan return 0L;
867b9e67834SAndre Fischer }
868b9e67834SAndre Fischer
869b9e67834SAndre Fischer
870b9e67834SAndre Fischer
871b9e67834SAndre Fischer
NotifyItemUpdate(const sal_uInt16 nSID,const SfxItemState eState,const SfxPoolItem * pState,const bool bIsEnabled)872b9e67834SAndre Fischer void TextPropertyPanel::NotifyItemUpdate (
873b9e67834SAndre Fischer const sal_uInt16 nSID,
874b9e67834SAndre Fischer const SfxItemState eState,
87545da7d5eSAndre Fischer const SfxPoolItem* pState,
87645da7d5eSAndre Fischer const bool bIsEnabled)
877b9e67834SAndre Fischer {
8788ce66e53SOliver-Rainer Wittmann switch(nSID)
8798ce66e53SOliver-Rainer Wittmann {
880b9e67834SAndre Fischer case SID_ATTR_CHAR_FONT:
88145da7d5eSAndre Fischer {
88245da7d5eSAndre Fischer bool bIsControlEnabled (bIsEnabled);
883b9e67834SAndre Fischer if ( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxFontItem) )
884b9e67834SAndre Fischer {
885b9e67834SAndre Fischer const SvxFontItem* pFontItem = (const SvxFontItem*)pState;
886b9e67834SAndre Fischer mpFontNameBox->SetText( pFontItem->GetFamilyName() );
887b9e67834SAndre Fischer }
888b9e67834SAndre Fischer else
889b9e67834SAndre Fischer {
890b9e67834SAndre Fischer mpFontNameBox->SetText( String() );
891b9e67834SAndre Fischer if (SFX_ITEM_DISABLED == eState)
89245da7d5eSAndre Fischer bIsControlEnabled = false;
893b9e67834SAndre Fischer }
89445da7d5eSAndre Fischer mpFontNameBox->Enable(bIsControlEnabled);
895b9e67834SAndre Fischer break;
89645da7d5eSAndre Fischer }
897b9e67834SAndre Fischer case SID_ATTR_CHAR_FONTHEIGHT:
89845da7d5eSAndre Fischer {
89945da7d5eSAndre Fischer bool bIsControlEnabled (bIsEnabled);
900b9e67834SAndre Fischer if ( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxFontHeightItem) )
901b9e67834SAndre Fischer {
902b9e67834SAndre Fischer mpHeightItem = (SvxFontHeightItem*)pState;//const SvxFontHeightItem*
903b9e67834SAndre Fischer SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric();
904bc7f1831SAndre Fischer const sal_Int64 nValue (CalcToPoint(mpHeightItem->GetHeight(), eUnit, 10 ));
905b9e67834SAndre Fischer mpToolBoxIncDec->Enable();
906b9e67834SAndre Fischer
907b9e67834SAndre Fischer mpToolBoxIncDec->SetItemState(TBI_INCREASE, STATE_NOCHECK);
908b9e67834SAndre Fischer mpToolBoxIncDec->SetItemState(TBI_DECREASE, STATE_NOCHECK);
909b9e67834SAndre Fischer
910bc7f1831SAndre Fischer // For Writer we have to update the states of the
911bc7f1831SAndre Fischer // increase and decrease buttons here, because we have
912bc7f1831SAndre Fischer // no access to the slots used by Writer.
913bc7f1831SAndre Fischer switch(maContext.GetCombinedContext_DI())
914bc7f1831SAndre Fischer {
915bc7f1831SAndre Fischer case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
916bc7f1831SAndre Fischer case CombinedEnumContext(Application_DrawImpress, Context_Text):
917bc7f1831SAndre Fischer case CombinedEnumContext(Application_DrawImpress, Context_Table):
918bc7f1831SAndre Fischer case CombinedEnumContext(Application_DrawImpress, Context_OutlineText):
919bc7f1831SAndre Fischer case CombinedEnumContext(Application_DrawImpress, Context_Draw):
920bc7f1831SAndre Fischer case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
921bc7f1831SAndre Fischer case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
922bc7f1831SAndre Fischer break;
923bc7f1831SAndre Fischer
924bc7f1831SAndre Fischer default:
925bc7f1831SAndre Fischer {
926bc7f1831SAndre Fischer mpToolBoxIncDec->EnableItem(TBI_INCREASE, bIsEnabled && nValue<960);
927bc7f1831SAndre Fischer mpToolBoxIncDec->EnableItem(TBI_DECREASE, bIsEnabled && nValue>60);
928bc7f1831SAndre Fischer break;
929bc7f1831SAndre Fischer }
930bc7f1831SAndre Fischer }
931bc7f1831SAndre Fischer
932b9e67834SAndre Fischer if( mbFocusOnFontSizeCtrl )
933b9e67834SAndre Fischer return;
934b9e67834SAndre Fischer
935bc7f1831SAndre Fischer maFontSizeBox.SetValue(nValue);
936b9e67834SAndre Fischer maFontSizeBox.LoseFocus();
93745da7d5eSAndre Fischer
93845da7d5eSAndre Fischer UpdateItem(SID_SHRINK_FONT_SIZE);
93945da7d5eSAndre Fischer UpdateItem(SID_GROW_FONT_SIZE);
940b9e67834SAndre Fischer }
941b9e67834SAndre Fischer else
9428ce66e53SOliver-Rainer Wittmann {
943b9e67834SAndre Fischer mpHeightItem = NULL;
944b9e67834SAndre Fischer maFontSizeBox.SetText( String() );
945b9e67834SAndre Fischer //increase decrease diabled when multi-seletion have different font size
9468ce66e53SOliver-Rainer Wittmann
947b9e67834SAndre Fischer // font size +/- enhancement in sd
94845da7d5eSAndre Fischer switch(maContext.GetCombinedContext_DI())
949b9e67834SAndre Fischer {
95045da7d5eSAndre Fischer case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
95145da7d5eSAndre Fischer case CombinedEnumContext(Application_DrawImpress, Context_Text):
95245da7d5eSAndre Fischer case CombinedEnumContext(Application_DrawImpress, Context_Table):
95345da7d5eSAndre Fischer case CombinedEnumContext(Application_DrawImpress, Context_OutlineText):
95445da7d5eSAndre Fischer case CombinedEnumContext(Application_DrawImpress, Context_Draw):
95545da7d5eSAndre Fischer case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
95645da7d5eSAndre Fischer case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
957b9e67834SAndre Fischer break;
958b9e67834SAndre Fischer
959b9e67834SAndre Fischer default:
960b9e67834SAndre Fischer mpToolBoxIncDec->Disable();
961b9e67834SAndre Fischer }
962b9e67834SAndre Fischer if ( eState <= SFX_ITEM_READONLY )
96345da7d5eSAndre Fischer bIsControlEnabled = false;
964b9e67834SAndre Fischer }
96545da7d5eSAndre Fischer maFontSizeBox.Enable(bIsControlEnabled);
96645da7d5eSAndre Fischer break;
96745da7d5eSAndre Fischer }
96845da7d5eSAndre Fischer
969b9e67834SAndre Fischer case SID_ATTR_CHAR_WEIGHT:
970b9e67834SAndre Fischer mbWeightAvailable = (eState >= SFX_ITEM_DONTCARE);
971b9e67834SAndre Fischer if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxWeightItem))
972b9e67834SAndre Fischer {
973b9e67834SAndre Fischer const SvxWeightItem* pItem = (const SvxWeightItem*)pState;
974b9e67834SAndre Fischer meWeight = (FontWeight)pItem->GetValue();
975b9e67834SAndre Fischer }
976b9e67834SAndre Fischer else
977b9e67834SAndre Fischer {
978b9e67834SAndre Fischer meWeight = WEIGHT_NORMAL;
979b9e67834SAndre Fischer }
98045da7d5eSAndre Fischer mpToolBoxFont->EnableItem(TBI_BOLD, mbWeightAvailable && bIsEnabled);
98145da7d5eSAndre Fischer mpToolBoxFont->SetItemState(TBI_BOLD, meWeight==WEIGHT_BOLD ? STATE_CHECK : STATE_NOCHECK);
982b9e67834SAndre Fischer break;
98345da7d5eSAndre Fischer
984b9e67834SAndre Fischer case SID_ATTR_CHAR_POSTURE:
985b9e67834SAndre Fischer mbPostureAvailable = (eState >= SFX_ITEM_DONTCARE);
986b9e67834SAndre Fischer if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxPostureItem))
987b9e67834SAndre Fischer {
988b9e67834SAndre Fischer const SvxPostureItem* pItem = (const SvxPostureItem*)pState;
989b9e67834SAndre Fischer meItalic = (FontItalic)pItem->GetValue();
990b9e67834SAndre Fischer }
991b9e67834SAndre Fischer else
992b9e67834SAndre Fischer {
993b9e67834SAndre Fischer meItalic = ITALIC_NONE;
994b9e67834SAndre Fischer }
99545da7d5eSAndre Fischer mpToolBoxFont->EnableItem(TBI_ITALIC, mbPostureAvailable && bIsEnabled);
99645da7d5eSAndre Fischer mpToolBoxFont->SetItemState(TBI_ITALIC, meItalic==ITALIC_NORMAL ? STATE_CHECK : STATE_NOCHECK);
997b9e67834SAndre Fischer break;
99845da7d5eSAndre Fischer
999b9e67834SAndre Fischer case SID_ATTR_CHAR_UNDERLINE:
100045da7d5eSAndre Fischer if( eState >= SFX_ITEM_DEFAULT)
1001b9e67834SAndre Fischer {
1002b9e67834SAndre Fischer if(pState->ISA(SvxUnderlineItem))
1003b9e67834SAndre Fischer {
1004b9e67834SAndre Fischer const SvxUnderlineItem* pItem = (const SvxUnderlineItem*)pState;
1005b9e67834SAndre Fischer meUnderline = (FontUnderline)pItem->GetValue();
1006b9e67834SAndre Fischer meUnderlineColor = pItem->GetColor();
1007b9e67834SAndre Fischer }
1008b9e67834SAndre Fischer }
1009b9e67834SAndre Fischer else
1010b9e67834SAndre Fischer {
1011b9e67834SAndre Fischer meUnderline = UNDERLINE_NONE;
1012b9e67834SAndre Fischer }
101345da7d5eSAndre Fischer mpToolBoxFont->EnableItem(TBI_UNDERLINE, bIsEnabled);
101445da7d5eSAndre Fischer mpToolBoxFont->SetItemState(TBI_UNDERLINE, meUnderline==UNDERLINE_NONE ? STATE_NOCHECK : STATE_CHECK);
1015b9e67834SAndre Fischer break;
101645da7d5eSAndre Fischer
1017b9e67834SAndre Fischer case SID_ATTR_CHAR_SHADOWED:
1018b9e67834SAndre Fischer if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxShadowedItem))
1019b9e67834SAndre Fischer {
1020b9e67834SAndre Fischer const SvxShadowedItem* pItem = (const SvxShadowedItem*)pState;
1021b9e67834SAndre Fischer mbShadow = pItem->GetValue();
1022b9e67834SAndre Fischer }
1023b9e67834SAndre Fischer else
1024b9e67834SAndre Fischer {
1025b9e67834SAndre Fischer mbShadow = false;
1026b9e67834SAndre Fischer }
102745da7d5eSAndre Fischer mpToolBoxFont->EnableItem(TBI_SHADOWED, bIsEnabled);
102845da7d5eSAndre Fischer mpToolBoxFont->SetItemState(TBI_SHADOWED, mbShadow ? STATE_CHECK : STATE_NOCHECK);
1029b9e67834SAndre Fischer break;
103045da7d5eSAndre Fischer
1031b9e67834SAndre Fischer case SID_ATTR_CHAR_STRIKEOUT:
1032b9e67834SAndre Fischer if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxCrossedOutItem))
1033b9e67834SAndre Fischer {
1034b9e67834SAndre Fischer const SvxCrossedOutItem* pItem = (const SvxCrossedOutItem*)pState;
1035b9e67834SAndre Fischer meStrike = (FontStrikeout)pItem->GetValue();
1036b9e67834SAndre Fischer }
1037b9e67834SAndre Fischer else
1038b9e67834SAndre Fischer {
1039b9e67834SAndre Fischer meStrike = STRIKEOUT_NONE;
1040b9e67834SAndre Fischer }
104145da7d5eSAndre Fischer mpToolBoxFont->EnableItem(TBI_STRIKEOUT, bIsEnabled);
104245da7d5eSAndre Fischer mpToolBoxFont->SetItemState(TBI_STRIKEOUT,
104345da7d5eSAndre Fischer meStrike!=STRIKEOUT_NONE && meStrike!=STRIKEOUT_DONTKNOW
104445da7d5eSAndre Fischer ? STATE_CHECK
104545da7d5eSAndre Fischer : STATE_NOCHECK);
1046b9e67834SAndre Fischer break;
104745da7d5eSAndre Fischer
1048b9e67834SAndre Fischer case SID_ATTR_CHAR_ESCAPEMENT:
104945da7d5eSAndre Fischer {
105045da7d5eSAndre Fischer bool bIsItemEnabled (true);
105145da7d5eSAndre Fischer if (eState == SFX_ITEM_AVAILABLE)
1052b9e67834SAndre Fischer {
105345da7d5eSAndre Fischer if (pState->ISA(SvxEscapementItem))
1054b9e67834SAndre Fischer {
1055b9e67834SAndre Fischer const SvxEscapementItem* pItem = (const SvxEscapementItem *)pState;
1056b9e67834SAndre Fischer short nEsc = pItem->GetEsc();
1057b9e67834SAndre Fischer if(nEsc == 0)
105845da7d5eSAndre Fischer {
1059b9e67834SAndre Fischer meEscape = SVX_ESCAPEMENT_OFF;
106045da7d5eSAndre Fischer mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_NOCHECK);
106145da7d5eSAndre Fischer mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_NOCHECK);
106245da7d5eSAndre Fischer }
1063b9e67834SAndre Fischer else if(nEsc > 0)
106445da7d5eSAndre Fischer {
1065b9e67834SAndre Fischer meEscape = SVX_ESCAPEMENT_SUPERSCRIPT;
106645da7d5eSAndre Fischer mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_CHECK);
1067bc7f1831SAndre Fischer mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_NOCHECK);
106845da7d5eSAndre Fischer }
1069b9e67834SAndre Fischer else
107045da7d5eSAndre Fischer {
1071b9e67834SAndre Fischer meEscape = SVX_ESCAPEMENT_SUBSCRIPT;
107245da7d5eSAndre Fischer mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_NOCHECK);
107345da7d5eSAndre Fischer mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_CHECK);
107445da7d5eSAndre Fischer }
1075b9e67834SAndre Fischer }
1076b9e67834SAndre Fischer else
1077b9e67834SAndre Fischer {
1078b9e67834SAndre Fischer meEscape = SVX_ESCAPEMENT_OFF;
107945da7d5eSAndre Fischer mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_NOCHECK);
108045da7d5eSAndre Fischer mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_NOCHECK);
1081b9e67834SAndre Fischer }
1082b9e67834SAndre Fischer }
108345da7d5eSAndre Fischer else if (eState == SFX_ITEM_DISABLED)
1084b9e67834SAndre Fischer {
108545da7d5eSAndre Fischer bIsItemEnabled = false;
1086b9e67834SAndre Fischer }
1087b9e67834SAndre Fischer else
1088b9e67834SAndre Fischer {
1089b9e67834SAndre Fischer meEscape = SVX_ESCAPEMENT_OFF;
1090b9e67834SAndre Fischer }
1091bc7f1831SAndre Fischer mpToolBoxScriptSw->EnableItem(TBI_SUPER_SW, bIsItemEnabled && bIsEnabled);
1092bc7f1831SAndre Fischer mpToolBoxScriptSw->EnableItem(TBI_SUB_SW, bIsItemEnabled && bIsEnabled);
1093b9e67834SAndre Fischer break;
109445da7d5eSAndre Fischer }
109545da7d5eSAndre Fischer
1096b9e67834SAndre Fischer case SID_SET_SUB_SCRIPT:
1097b9e67834SAndre Fischer if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SfxBoolItem))
1098b9e67834SAndre Fischer {
1099b9e67834SAndre Fischer const SfxBoolItem* pItem = (const SfxBoolItem*)pState;
1100b9e67834SAndre Fischer mbSub = pItem->GetValue();
1101b9e67834SAndre Fischer }
1102b9e67834SAndre Fischer else
1103b9e67834SAndre Fischer {
1104b9e67834SAndre Fischer mbSub = false;
1105b9e67834SAndre Fischer }
110645da7d5eSAndre Fischer mpToolBoxScript->EnableItem(TBI_SUB, bIsEnabled);
110745da7d5eSAndre Fischer mpToolBoxScript->SetItemState(TBI_SUB, mbSub ? STATE_CHECK : STATE_NOCHECK);
1108b9e67834SAndre Fischer break;
110945da7d5eSAndre Fischer
1110b9e67834SAndre Fischer case SID_SET_SUPER_SCRIPT:
1111b9e67834SAndre Fischer if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SfxBoolItem))
1112b9e67834SAndre Fischer {
1113b9e67834SAndre Fischer const SfxBoolItem* pItem = (const SfxBoolItem*)pState;
1114b9e67834SAndre Fischer mbSuper = pItem->GetValue();
1115b9e67834SAndre Fischer }
1116b9e67834SAndre Fischer else
1117b9e67834SAndre Fischer {
1118b9e67834SAndre Fischer mbSuper = false;
1119b9e67834SAndre Fischer }
112045da7d5eSAndre Fischer mpToolBoxScript->EnableItem(TBI_SUPER, bIsEnabled);
112145da7d5eSAndre Fischer mpToolBoxScript->SetItemState(TBI_SUPER, mbSuper ? STATE_CHECK : STATE_NOCHECK);
1122b9e67834SAndre Fischer break;
112345da7d5eSAndre Fischer
1124b9e67834SAndre Fischer case SID_ATTR_CHAR_KERNING:
1125b9e67834SAndre Fischer if ( SFX_ITEM_AVAILABLE == eState )
1126b9e67834SAndre Fischer {
1127b9e67834SAndre Fischer mbKernLBAvailable = true;
1128b9e67834SAndre Fischer
1129b9e67834SAndre Fischer if(pState->ISA(SvxKerningItem))
1130b9e67834SAndre Fischer {
1131b9e67834SAndre Fischer const SvxKerningItem* pKerningItem = (const SvxKerningItem*)pState;
1132b9e67834SAndre Fischer mlKerning = (long)pKerningItem->GetValue();
1133b9e67834SAndre Fischer mbKernAvailable = true;
1134b9e67834SAndre Fischer }
1135b9e67834SAndre Fischer else
1136b9e67834SAndre Fischer {
1137b9e67834SAndre Fischer mlKerning = 0;
1138b9e67834SAndre Fischer mbKernAvailable =false;
1139b9e67834SAndre Fischer }
1140b9e67834SAndre Fischer }
1141b9e67834SAndre Fischer else if (SFX_ITEM_DISABLED == eState)
1142b9e67834SAndre Fischer {
1143b9e67834SAndre Fischer mbKernLBAvailable = false;
1144b9e67834SAndre Fischer mbKernAvailable = false;
1145b9e67834SAndre Fischer mlKerning = 0;
1146b9e67834SAndre Fischer }
1147b9e67834SAndre Fischer else
1148b9e67834SAndre Fischer {
1149b9e67834SAndre Fischer mbKernLBAvailable = true;
1150b9e67834SAndre Fischer mbKernAvailable = false;
1151b9e67834SAndre Fischer mlKerning = 0;
1152b9e67834SAndre Fischer }
115345da7d5eSAndre Fischer mpToolBoxSpacing->EnableItem(TBI_SPACING, bIsEnabled);
1154b9e67834SAndre Fischer break;
1155b9e67834SAndre Fischer
1156b9e67834SAndre Fischer // font size +/- enhancement in sd
1157b9e67834SAndre Fischer case SID_SHRINK_FONT_SIZE:
1158b9e67834SAndre Fischer case SID_GROW_FONT_SIZE:
115945da7d5eSAndre Fischer switch(maContext.GetCombinedContext_DI())
116045da7d5eSAndre Fischer {
116145da7d5eSAndre Fischer case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
116245da7d5eSAndre Fischer case CombinedEnumContext(Application_DrawImpress, Context_Text):
116345da7d5eSAndre Fischer case CombinedEnumContext(Application_DrawImpress, Context_Table):
116445da7d5eSAndre Fischer case CombinedEnumContext(Application_DrawImpress, Context_OutlineText):
116545da7d5eSAndre Fischer case CombinedEnumContext(Application_DrawImpress, Context_Draw):
116645da7d5eSAndre Fischer case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
116745da7d5eSAndre Fischer case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
1168bc7f1831SAndre Fischer {
116945da7d5eSAndre Fischer if(eState == SFX_ITEM_DISABLED)
117045da7d5eSAndre Fischer mpToolBoxIncDec->Disable();
117145da7d5eSAndre Fischer else
117245da7d5eSAndre Fischer mpToolBoxIncDec->Enable();
1173bc7f1831SAndre Fischer const sal_Int64 nSize (maFontSizeBox.GetValue());
1174bc7f1831SAndre Fischer switch(nSID)
1175bc7f1831SAndre Fischer {
1176bc7f1831SAndre Fischer case SID_GROW_FONT_SIZE:
1177bc7f1831SAndre Fischer mpToolBoxIncDec->EnableItem(TBI_INCREASE, bIsEnabled && nSize<960);
1178bc7f1831SAndre Fischer break;
1179bc7f1831SAndre Fischer
1180bc7f1831SAndre Fischer case SID_SHRINK_FONT_SIZE:
1181bc7f1831SAndre Fischer mpToolBoxIncDec->EnableItem(TBI_DECREASE, bIsEnabled && nSize>60);
1182bc7f1831SAndre Fischer break;
1183bc7f1831SAndre Fischer
1184bc7f1831SAndre Fischer default:
1185bc7f1831SAndre Fischer break;
1186bc7f1831SAndre Fischer }
1187bc7f1831SAndre Fischer }
118845da7d5eSAndre Fischer }
118945da7d5eSAndre Fischer break;
1190b9e67834SAndre Fischer }
1191b9e67834SAndre Fischer }
1192b9e67834SAndre Fischer
1193b9e67834SAndre Fischer
1194b9e67834SAndre Fischer
1195b9e67834SAndre Fischer
Resize(void)1196*6a606da0SAndre Fischer void TextPropertyPanel::Resize (void)
1197*6a606da0SAndre Fischer {
1198*6a606da0SAndre Fischer maLayouter.Layout();
1199*6a606da0SAndre Fischer }
1200*6a606da0SAndre Fischer
1201*6a606da0SAndre Fischer
1202*6a606da0SAndre Fischer
1203*6a606da0SAndre Fischer
UpdateItem(const sal_uInt16 nSlotId)120445da7d5eSAndre Fischer void TextPropertyPanel::UpdateItem (const sal_uInt16 nSlotId)
1205b9e67834SAndre Fischer {
120645da7d5eSAndre Fischer switch (nSlotId)
120745da7d5eSAndre Fischer {
120845da7d5eSAndre Fischer case SID_ATTR_CHAR_FONT:
120945da7d5eSAndre Fischer maFontNameControl.RequestUpdate();
121045da7d5eSAndre Fischer break;
121145da7d5eSAndre Fischer case SID_ATTR_CHAR_FONTHEIGHT:
121245da7d5eSAndre Fischer maFontSizeControl.RequestUpdate();
121345da7d5eSAndre Fischer break;
121445da7d5eSAndre Fischer case SID_ATTR_CHAR_WEIGHT:
121545da7d5eSAndre Fischer maWeightControl.RequestUpdate();
121645da7d5eSAndre Fischer break;
121745da7d5eSAndre Fischer case SID_ATTR_CHAR_POSTURE:
121845da7d5eSAndre Fischer maItalicControl.RequestUpdate();
121945da7d5eSAndre Fischer break;
122045da7d5eSAndre Fischer case SID_ATTR_CHAR_UNDERLINE:
122145da7d5eSAndre Fischer maUnderlineControl.RequestUpdate();
122245da7d5eSAndre Fischer break;
122345da7d5eSAndre Fischer case SID_ATTR_CHAR_STRIKEOUT:
122445da7d5eSAndre Fischer maStrikeControl.RequestUpdate();
122545da7d5eSAndre Fischer break;
122645da7d5eSAndre Fischer case SID_ATTR_CHAR_SHADOWED:
122745da7d5eSAndre Fischer maShadowControl.RequestUpdate();
122845da7d5eSAndre Fischer break;
122945da7d5eSAndre Fischer case SID_ATTR_CHAR_ESCAPEMENT:
123045da7d5eSAndre Fischer maScriptControlSw.RequestUpdate();
123145da7d5eSAndre Fischer break;
123245da7d5eSAndre Fischer case SID_SET_SUPER_SCRIPT:
123345da7d5eSAndre Fischer maSuperScriptControl.RequestUpdate();
123445da7d5eSAndre Fischer break;
123545da7d5eSAndre Fischer case SID_SET_SUB_SCRIPT:
123645da7d5eSAndre Fischer maSubScriptControl.RequestUpdate();
123745da7d5eSAndre Fischer break;
123845da7d5eSAndre Fischer case SID_ATTR_CHAR_KERNING:
123945da7d5eSAndre Fischer maSpacingControl.RequestUpdate();
124045da7d5eSAndre Fischer break;
124145da7d5eSAndre Fischer case SID_GROW_FONT_SIZE:
124245da7d5eSAndre Fischer maSDFontGrow.RequestUpdate();
124345da7d5eSAndre Fischer break;
124445da7d5eSAndre Fischer case SID_SHRINK_FONT_SIZE:
124545da7d5eSAndre Fischer maSDFontShrink.RequestUpdate();
124645da7d5eSAndre Fischer break;
124745da7d5eSAndre Fischer }
1248b9e67834SAndre Fischer }
1249b9e67834SAndre Fischer
1250b9e67834SAndre Fischer
1251b9e67834SAndre Fischer
1252b9e67834SAndre Fischer
1253b9e67834SAndre Fischer
GetUnderlineColor()1254d4aefcaeSZheng Fan Color& TextPropertyPanel::GetUnderlineColor()
1255b9e67834SAndre Fischer {
1256d4aefcaeSZheng Fan return meUnderlineColor;
1257b9e67834SAndre Fischer }
1258d4aefcaeSZheng Fan
SetUnderline(FontUnderline eUnderline)1259da72173fSAndre Fischer void TextPropertyPanel::SetUnderline(FontUnderline eUnderline)
1260da72173fSAndre Fischer {
1261da72173fSAndre Fischer meUnderline = eUnderline;
1262da72173fSAndre Fischer }
1263d4aefcaeSZheng Fan
126445da7d5eSAndre Fischer
126545da7d5eSAndre Fischer
1266b9e67834SAndre Fischer } } // end of namespace svx::sidebar
1267