xref: /AOO41X/main/svx/source/sidebar/text/TextPropertyPanel.hxx (revision 10405e3bc4cc025b9f71a00095087e23876a0a35)
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 #ifndef SVX_SIDEBAR_TEXT_PROPERTY_PAGE_HXX
23b9e67834SAndre Fischer #define SVX_SIDEBAR_TEXT_PROPERTY_PAGE_HXX
24b9e67834SAndre Fischer 
2595a18594SAndre Fischer #include <vcl/ctrl.hxx>
26b9e67834SAndre Fischer #include <sfx2/sidebar/SidebarPanelBase.hxx>
27b9e67834SAndre Fischer #include <sfx2/sidebar/ControllerItem.hxx>
28f120fe41SAndre Fischer #include <sfx2/sidebar/IContextChangeReceiver.hxx>
29ae13266dSAndre Fischer #include <sfx2/sidebar/EnumContext.hxx>
30b9e67834SAndre Fischer 
31b9e67834SAndre Fischer #include <svtools/ctrlbox.hxx>
32b9e67834SAndre Fischer #include <svx/tbxcolorupdate.hxx>
33b9e67834SAndre Fischer #include <editeng/svxenum.hxx>
34b9e67834SAndre Fischer #include <editeng/fhgtitem.hxx>
35b9e67834SAndre Fischer 
3637fee4fdSAndre Fischer #include <com/sun/star/ui/XSidebar.hpp>
37ae13266dSAndre Fischer #include <com/sun/star/frame/XToolbarController.hpp>
38b9e67834SAndre Fischer 
39b9e67834SAndre Fischer #include <boost/scoped_ptr.hpp>
40d4aefcaeSZheng Fan #include "TextCharacterSpacingPopup.hxx"
41d4aefcaeSZheng Fan #include "TextUnderlinePopup.hxx"
42facb16e7SArmin Le Grand #include <svx/sidebar/ColorPopup.hxx>
43d4aefcaeSZheng Fan #include <vcl/vclenum.hxx>
44b9e67834SAndre Fischer 
4595a18594SAndre Fischer class FloatingWindow;
4695a18594SAndre Fischer class ToolBox;
4795a18594SAndre Fischer 
48b9e67834SAndre Fischer namespace svx { namespace sidebar {
49b9e67834SAndre Fischer 
50b9e67834SAndre Fischer class SvxSBFontNameBox;
51d4aefcaeSZheng Fan class PopupControl;
52d4aefcaeSZheng Fan class PopupContainer;
53b9e67834SAndre Fischer 
54b9e67834SAndre Fischer class TextPropertyPanel
5595a18594SAndre Fischer     : public Control,
56f120fe41SAndre Fischer       public ::sfx2::sidebar::IContextChangeReceiver,
57b9e67834SAndre Fischer       public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
58b9e67834SAndre Fischer {
59b9e67834SAndre Fischer public:
6095a18594SAndre Fischer     static TextPropertyPanel* Create (
61b9e67834SAndre Fischer         Window* pParent,
62b9e67834SAndre Fischer         const cssu::Reference<css::frame::XFrame>& rxFrame,
63ae13266dSAndre Fischer         SfxBindings* pBindings,
64ae13266dSAndre Fischer         const ::sfx2::sidebar::EnumContext& rContext);
65b9e67834SAndre Fischer 
66b9e67834SAndre Fischer     virtual void DataChanged (const DataChangedEvent& rEvent);
67bc7f1831SAndre Fischer 
68d4aefcaeSZheng Fan     ::sfx2::sidebar::ControllerItem& GetSpaceController();
69d4aefcaeSZheng Fan     long GetSelFontSize();
70d4aefcaeSZheng Fan     void SetSpacing(long nKern);
71d4aefcaeSZheng Fan     void EndSpacingPopupMode (void);
72d4aefcaeSZheng Fan     void EndUnderlinePopupMode (void);
73d4aefcaeSZheng Fan     void SetUnderline(FontUnderline eUnderline);
74d4aefcaeSZheng Fan     Color& GetUnderlineColor();
75d4aefcaeSZheng Fan     void SetDefaultUnderline(FontUnderline eUnderline);
76b9e67834SAndre Fischer 
77b9e67834SAndre Fischer 
78b9e67834SAndre Fischer     virtual void HandleContextChange (
79b9e67834SAndre Fischer         const ::sfx2::sidebar::EnumContext aContext);
80b9e67834SAndre Fischer 
8145da7d5eSAndre Fischer 
82b9e67834SAndre Fischer     virtual void NotifyItemUpdate(
83b9e67834SAndre Fischer         const sal_uInt16 nSId,
84b9e67834SAndre Fischer         const SfxItemState eState,
8545da7d5eSAndre Fischer         const SfxPoolItem* pState,
8645da7d5eSAndre Fischer         const bool bIsEnabled);
87b9e67834SAndre Fischer 
88b9e67834SAndre Fischer private:
89b9e67834SAndre Fischer     //ui controls
90b9e67834SAndre Fischer     ::boost::scoped_ptr<SvxSBFontNameBox> mpFontNameBox;
91b9e67834SAndre Fischer     FontSizeBox maFontSizeBox;
927a32b0c8SAndre Fischer     ::boost::scoped_ptr<Window> mpToolBoxFontBackground;
93b9e67834SAndre Fischer     ::boost::scoped_ptr<ToolBox> mpToolBoxFont;
9452d13b84SAndre Fischer     ::boost::scoped_ptr<Window> mpToolBoxIncDecBackground;
9552d13b84SAndre Fischer     ::boost::scoped_ptr<ToolBox> mpToolBoxIncDec;
967a32b0c8SAndre Fischer     ::boost::scoped_ptr<Window> mpToolBoxScriptBackground;
97b9e67834SAndre Fischer     ::boost::scoped_ptr<ToolBox> mpToolBoxScript;
987a32b0c8SAndre Fischer     ::boost::scoped_ptr<Window> mpToolBoxScriptSwBackground;
99b9e67834SAndre Fischer     ::boost::scoped_ptr<ToolBox> mpToolBoxScriptSw;
1007a32b0c8SAndre Fischer     ::boost::scoped_ptr<Window> mpToolBoxSpacingBackground;
101b9e67834SAndre Fischer     ::boost::scoped_ptr<ToolBox> mpToolBoxSpacing;
10252d13b84SAndre Fischer     ::boost::scoped_ptr<Window> mpToolBoxFontColorBackground;
10352d13b84SAndre Fischer     ::boost::scoped_ptr<ToolBox> mpToolBoxFontColor;
104*10405e3bSAndre Fischer     ::boost::scoped_ptr<Window> mpToolBoxFontColorBackgroundSW;
105*10405e3bSAndre Fischer     ::boost::scoped_ptr<ToolBox> mpToolBoxFontColorSW;
1067a32b0c8SAndre Fischer     ::boost::scoped_ptr<Window> mpToolBoxHighlightBackground;
107b9e67834SAndre Fischer     ::boost::scoped_ptr<ToolBox> mpToolBoxHighlight;
108b9e67834SAndre Fischer     ::boost::scoped_ptr<ToolboxButtonColorUpdater> mpFontColorUpdater;
109b9e67834SAndre Fischer     ::boost::scoped_ptr<ToolboxButtonColorUpdater> mpHighlightUpdater;
110b9e67834SAndre Fischer 
111b9e67834SAndre Fischer     //control items
112b9e67834SAndre Fischer     ::sfx2::sidebar::ControllerItem maFontNameControl;
113b9e67834SAndre Fischer     ::sfx2::sidebar::ControllerItem maFontSizeControl;
114b9e67834SAndre Fischer     ::sfx2::sidebar::ControllerItem maWeightControl;
115b9e67834SAndre Fischer     ::sfx2::sidebar::ControllerItem maItalicControl;
116b9e67834SAndre Fischer     ::sfx2::sidebar::ControllerItem maUnderlineControl;
117b9e67834SAndre Fischer     ::sfx2::sidebar::ControllerItem maStrikeControl;
118b9e67834SAndre Fischer     ::sfx2::sidebar::ControllerItem maShadowControl;
119b9e67834SAndre Fischer     ::sfx2::sidebar::ControllerItem maScriptControlSw;
120b9e67834SAndre Fischer     ::sfx2::sidebar::ControllerItem maSuperScriptControl;
121b9e67834SAndre Fischer     ::sfx2::sidebar::ControllerItem maSubScriptControl;
122b9e67834SAndre Fischer     ::sfx2::sidebar::ControllerItem maSpacingControl;
123b9e67834SAndre Fischer     ::sfx2::sidebar::ControllerItem maSDFontGrow;
124b9e67834SAndre Fischer     ::sfx2::sidebar::ControllerItem maSDFontShrink;
125b9e67834SAndre Fischer 
126b9e67834SAndre Fischer     FontWeight					meWeight;
127b9e67834SAndre Fischer     FontItalic					meItalic;
128b9e67834SAndre Fischer     FontUnderline				meUnderline;
1298ce66e53SOliver-Rainer Wittmann     Color						meUnderlineColor;
130b9e67834SAndre Fischer     bool						mbShadow;
131b9e67834SAndre Fischer     FontStrikeout				meStrike;
132b9e67834SAndre Fischer     bool mbWeightAvailable;
133b9e67834SAndre Fischer     bool mbPostureAvailable;
134b9e67834SAndre Fischer     SvxEscapement				meEscape;  //for sw
135b9e67834SAndre Fischer     bool						mbSuper;
136b9e67834SAndre Fischer     bool						mbSub;
137b9e67834SAndre Fischer     bool						mbKernAvailable;
138b9e67834SAndre Fischer     bool						mbKernLBAvailable;
139b9e67834SAndre Fischer     long						mlKerning;
140b9e67834SAndre Fischer     SvxFontHeightItem*			mpHeightItem;
141b9e67834SAndre Fischer 
142b9e67834SAndre Fischer     const FontList* mpFontList;
143b9e67834SAndre Fischer     bool mbMustDelete;
144b9e67834SAndre Fischer     bool mbFocusOnFontSizeCtrl;
145d4aefcaeSZheng Fan     TextCharacterSpacingPopup maCharSpacePopup;
146d4aefcaeSZheng Fan     TextUnderlinePopup maUnderlinePopup;
147b9e67834SAndre Fischer 
14895a18594SAndre Fischer     cssu::Reference<css::frame::XFrame> mxFrame;
149b9e67834SAndre Fischer     ::sfx2::sidebar::EnumContext maContext;
150b9e67834SAndre Fischer     SfxBindings* mpBindings;
151b9e67834SAndre Fischer 
152b9e67834SAndre Fischer     TextPropertyPanel (
153b9e67834SAndre Fischer         Window* pParent,
154b9e67834SAndre Fischer         const cssu::Reference<css::frame::XFrame>& rxFrame,
155ae13266dSAndre Fischer         SfxBindings* pBindings,
156ae13266dSAndre Fischer         const ::sfx2::sidebar::EnumContext& rContext);
157b9e67834SAndre Fischer     virtual ~TextPropertyPanel (void);
158b9e67834SAndre Fischer 
159d4aefcaeSZheng Fan 
160d4aefcaeSZheng Fan     PopupControl* CreateCharacterSpacingControl (PopupContainer* pParent);
161d4aefcaeSZheng Fan     PopupControl* CreateUnderlinePopupControl (PopupContainer* pParent);
162d4aefcaeSZheng Fan     DECL_LINK(SpacingClickHdl, ToolBox*);
163d4aefcaeSZheng Fan     DECL_LINK(ToolBoxUnderlineClickHdl, ToolBox* );
164d4aefcaeSZheng Fan 
165b9e67834SAndre Fischer     void Initialize (void);
16645da7d5eSAndre Fischer     void SetupToolboxItems (void);
167b9e67834SAndre Fischer     void InitToolBoxFont();
168b9e67834SAndre Fischer     void InitToolBoxIncDec();
169b9e67834SAndre Fischer     void InitToolBoxScript();
170b9e67834SAndre Fischer     void InitToolBoxSpacing();
171b9e67834SAndre Fischer 
172b9e67834SAndre Fischer     DECL_LINK(FontSelHdl, FontNameBox *);
173b9e67834SAndre Fischer     DECL_LINK(FontSizeModifyHdl, FontSizeBox *);
174b9e67834SAndre Fischer     DECL_LINK(FontSizeSelHdl, FontSizeBox *);
175b9e67834SAndre Fischer     DECL_LINK(FontSizeLoseFocus, FontSizeBox *);
176b9e67834SAndre Fischer     DECL_LINK(ToolboxFontSelectHandler, ToolBox *);
177b9e67834SAndre Fischer     DECL_LINK(ToolboxIncDecSelectHdl, ToolBox *);
178b9e67834SAndre Fischer     DECL_LINK(ToolBoxSwScriptSelectHdl, ToolBox *);
179b9e67834SAndre Fischer     DECL_LINK(ToolBoxScriptSelectHdl, ToolBox *);
180d4aefcaeSZheng Fan 
18145da7d5eSAndre Fischer     void UpdateItem (const sal_uInt16 nSlotId);
182*10405e3bSAndre Fischer 
183*10405e3bSAndre Fischer     /** Depending on the given context make one of the toolboxes
184*10405e3bSAndre Fischer         mpToolBoxFontColor and mpToolBoxFontColorSW visible.  Both
185*10405e3bSAndre Fischer         occupy the same space.
186*10405e3bSAndre Fischer     */
187*10405e3bSAndre Fischer     void UpdateFontColorToolbox (
188*10405e3bSAndre Fischer         const ::sfx2::sidebar::EnumContext aContext);
189b9e67834SAndre Fischer };
190b9e67834SAndre Fischer 
191b9e67834SAndre Fischer } } // end of namespace ::svx::sidebar
192b9e67834SAndre Fischer 
193b9e67834SAndre Fischer #endif
194