xref: /trunk/main/svx/source/sidebar/text/TextPropertyPanel.hxx (revision 7a32b0c888def1bf84d1d657c48953bc10dc00c1)
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>
28b9e67834SAndre Fischer 
29b9e67834SAndre Fischer #include <svtools/ctrlbox.hxx>
30b9e67834SAndre Fischer #include <svx/tbxcolorupdate.hxx>
31b9e67834SAndre Fischer #include <editeng/svxenum.hxx>
32b9e67834SAndre Fischer #include <editeng/fhgtitem.hxx>
33b9e67834SAndre Fischer 
34b9e67834SAndre Fischer #include <com/sun/star/ui/XUIElement.hpp>
35b9e67834SAndre Fischer 
36b9e67834SAndre Fischer #include <boost/scoped_ptr.hpp>
37b9e67834SAndre Fischer 
38b9e67834SAndre Fischer 
3995a18594SAndre Fischer class FloatingWindow;
4095a18594SAndre Fischer class ToolBox;
4195a18594SAndre Fischer 
42b9e67834SAndre Fischer namespace svx { namespace sidebar {
43b9e67834SAndre Fischer 
44b9e67834SAndre Fischer class SvxSBFontNameBox;
45b9e67834SAndre Fischer 
46b9e67834SAndre Fischer class TextPropertyPanel
4795a18594SAndre Fischer     : public Control,
4895a18594SAndre Fischer       public ::sfx2::sidebar::SidebarPanelBase::ContextChangeReceiverInterface,
49b9e67834SAndre Fischer       public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
50b9e67834SAndre Fischer {
51b9e67834SAndre Fischer public:
5295a18594SAndre Fischer     static TextPropertyPanel* Create (
53b9e67834SAndre Fischer         Window* pParent,
54b9e67834SAndre Fischer         const cssu::Reference<css::frame::XFrame>& rxFrame,
55b9e67834SAndre Fischer         SfxBindings* pBindings);
56b9e67834SAndre Fischer 
57b9e67834SAndre Fischer     virtual void DataChanged (const DataChangedEvent& rEvent);
58b9e67834SAndre Fischer 
59b9e67834SAndre Fischer     //  void SetDefaultUnderline(FontUnderline eUnderline);
60b9e67834SAndre Fischer     //  USHORT GetCurrColorType();
61b9e67834SAndre Fischer 
62b9e67834SAndre Fischer     //  void SetBackColor(Color aCol);
63b9e67834SAndre Fischer     //  void SetColor(Color aCol);
64b9e67834SAndre Fischer     //  void SetUnderline(FontUnderline eUnderline);
65b9e67834SAndre Fischer     //  void SetSpacing(long nKern);
66b9e67834SAndre Fischer 
67b9e67834SAndre Fischer     /*
68b9e67834SAndre Fischer     SvxTextUnderlinePage* GetUnderlinePage();
69b9e67834SAndre Fischer     SfxPopupPanelWin* GetUnderlineFloatWin();
70b9e67834SAndre Fischer 
71b9e67834SAndre Fischer     SvxTextFontColorPage* GetFontColorPage();
72b9e67834SAndre Fischer     SfxPopupPanelWin* GetFontColorFloatWin();
73b9e67834SAndre Fischer 
74b9e67834SAndre Fischer     SvxTextSpacingPage* GetSpacingPage();
75b9e67834SAndre Fischer     SfxPopupPanelWin* GetSpacingFloatWin();
76b9e67834SAndre Fischer     */
77b9e67834SAndre Fischer     //  long GetSelFontSize();
78b9e67834SAndre Fischer     //  SfxPropertyPageController GetSpaceController();
79b9e67834SAndre Fischer //  ToolBox* GetSpacingTB();        //removed
80b9e67834SAndre Fischer     //  Color& GetUnderlineColor();  //
81b9e67834SAndre Fischer //  void FontListChanged();
82b9e67834SAndre Fischer 
83b9e67834SAndre Fischer     enum ColorType
84b9e67834SAndre Fischer     {
85b9e67834SAndre Fischer         FONT_COLOR = 1,
86b9e67834SAndre Fischer         BACK_COLOR = 2
87b9e67834SAndre Fischer     };
88b9e67834SAndre Fischer 
89b9e67834SAndre Fischer     virtual void HandleContextChange (
90b9e67834SAndre Fischer         const ::sfx2::sidebar::EnumContext aContext);
91b9e67834SAndre Fischer 
92b9e67834SAndre Fischer     virtual void NotifyItemUpdate(
93b9e67834SAndre Fischer         const sal_uInt16 nSId,
94b9e67834SAndre Fischer         const SfxItemState eState,
95b9e67834SAndre Fischer         const SfxPoolItem* pState);
96b9e67834SAndre Fischer 
97*7a32b0c8SAndre Fischer     void ShowMenu (void);
98*7a32b0c8SAndre Fischer 
99b9e67834SAndre Fischer private:
100b9e67834SAndre Fischer     //ui controls
101b9e67834SAndre Fischer     ::boost::scoped_ptr<SvxSBFontNameBox> mpFontNameBox;
102b9e67834SAndre Fischer     FontSizeBox maFontSizeBox;
103*7a32b0c8SAndre Fischer     ::boost::scoped_ptr<Window> mpToolBoxIncDecBackground;
104b9e67834SAndre Fischer     ::boost::scoped_ptr<ToolBox> mpToolBoxIncDec;
105*7a32b0c8SAndre Fischer     ::boost::scoped_ptr<Window> mpToolBoxFontBackground;
106b9e67834SAndre Fischer     ::boost::scoped_ptr<ToolBox> mpToolBoxFont;
107*7a32b0c8SAndre Fischer     ::boost::scoped_ptr<Window> mpToolBoxFontColorBackground;
108b9e67834SAndre Fischer     ::boost::scoped_ptr<ToolBox> mpToolBoxFontColor;
109*7a32b0c8SAndre Fischer     ::boost::scoped_ptr<Window> mpToolBoxScriptBackground;
110b9e67834SAndre Fischer     ::boost::scoped_ptr<ToolBox> mpToolBoxScript;
111*7a32b0c8SAndre Fischer     ::boost::scoped_ptr<Window> mpToolBoxScriptSwBackground;
112b9e67834SAndre Fischer     ::boost::scoped_ptr<ToolBox> mpToolBoxScriptSw;
113*7a32b0c8SAndre Fischer     ::boost::scoped_ptr<Window> mpToolBoxSpacingBackground;
114b9e67834SAndre Fischer     ::boost::scoped_ptr<ToolBox> mpToolBoxSpacing;
115*7a32b0c8SAndre Fischer     ::boost::scoped_ptr<Window> mpToolBoxHighlightBackground;
116b9e67834SAndre Fischer     ::boost::scoped_ptr<ToolBox> mpToolBoxHighlight;
117b9e67834SAndre Fischer     ::boost::scoped_ptr<ToolboxButtonColorUpdater> mpFontColorUpdater;
118b9e67834SAndre Fischer     ::boost::scoped_ptr<ToolboxButtonColorUpdater> mpHighlightUpdater;
119b9e67834SAndre Fischer 
120b9e67834SAndre Fischer     //control items
121b9e67834SAndre Fischer     ::sfx2::sidebar::ControllerItem maFontNameControl;
122b9e67834SAndre Fischer     ::sfx2::sidebar::ControllerItem maFontSizeControl;
123b9e67834SAndre Fischer     ::sfx2::sidebar::ControllerItem maWeightControl;
124b9e67834SAndre Fischer     ::sfx2::sidebar::ControllerItem maItalicControl;
125b9e67834SAndre Fischer     ::sfx2::sidebar::ControllerItem maUnderlineControl;
126b9e67834SAndre Fischer     ::sfx2::sidebar::ControllerItem maStrikeControl;
127b9e67834SAndre Fischer     ::sfx2::sidebar::ControllerItem maShadowControl;
128b9e67834SAndre Fischer     ::sfx2::sidebar::ControllerItem maFontColorControl;
129b9e67834SAndre Fischer     ::sfx2::sidebar::ControllerItem maScriptControlSw;
130b9e67834SAndre Fischer     ::sfx2::sidebar::ControllerItem maSuperScriptControl;
131b9e67834SAndre Fischer     ::sfx2::sidebar::ControllerItem maSubScriptControl;
132b9e67834SAndre Fischer     ::sfx2::sidebar::ControllerItem maSpacingControl;
133b9e67834SAndre Fischer     ::sfx2::sidebar::ControllerItem maHighlightControl;
134b9e67834SAndre Fischer     ::sfx2::sidebar::ControllerItem maSDFontGrow;
135b9e67834SAndre Fischer     ::sfx2::sidebar::ControllerItem maSDFontShrink;
136b9e67834SAndre Fischer 
137b9e67834SAndre Fischer     //Images
138b9e67834SAndre Fischer     Image   maImgIncrease;
139b9e67834SAndre Fischer     Image   maImgDecrease;
140b9e67834SAndre Fischer     Image   maImgBold;
141b9e67834SAndre Fischer     Image   maImgItalic;
142b9e67834SAndre Fischer     Image   maImgUnderline;
143b9e67834SAndre Fischer     Image   maImgStrike;
144b9e67834SAndre Fischer     Image   maImgShadow;
145b9e67834SAndre Fischer     Image   maImgFontColor;
146b9e67834SAndre Fischer     Image   maImgSupScript;
147b9e67834SAndre Fischer     Image   maImgSubScript;
148b9e67834SAndre Fischer     Image   maImgHighlight;
149b9e67834SAndre Fischer 
150b9e67834SAndre Fischer     Image               maImgNormalIcon;
151b9e67834SAndre Fischer 
152b9e67834SAndre Fischer     Image   maImgIncreaseHigh;
153b9e67834SAndre Fischer     Image   maImgDecreaseHigh;
154b9e67834SAndre Fischer     Image   maImgBoldHigh;
155b9e67834SAndre Fischer     Image   maImgItalicHigh;
156b9e67834SAndre Fischer     Image   maImgUnderlineHigh;
157b9e67834SAndre Fischer     Image   maImgStrikeHigh;
158b9e67834SAndre Fischer     Image   maImgShadowHigh;
159b9e67834SAndre Fischer     Image   maImgFontColorHigh;
160b9e67834SAndre Fischer     Image   maImgSupScriptHigh;
161b9e67834SAndre Fischer     Image   maImgSubScriptHigh;
162b9e67834SAndre Fischer //  Image   maImgSpacingHigh;  //
163b9e67834SAndre Fischer     Image   maImgHighlightHigh;
164b9e67834SAndre Fischer 
165b9e67834SAndre Fischer     FontWeight                  meWeight;
166b9e67834SAndre Fischer     FontItalic                  meItalic;
167b9e67834SAndre Fischer     FontUnderline               meUnderline;
168b9e67834SAndre Fischer     Color                       meUnderlineColor;  //
169b9e67834SAndre Fischer     bool                        mbShadow;
170b9e67834SAndre Fischer     FontStrikeout               meStrike;
171b9e67834SAndre Fischer     bool mbWeightAvailable;
172b9e67834SAndre Fischer     bool mbPostureAvailable;
173b9e67834SAndre Fischer     Color                       maColor;
174b9e67834SAndre Fischer     bool mbColorAvailable;
175b9e67834SAndre Fischer     Color                       maBackColor;
176b9e67834SAndre Fischer     bool mbBackColorAvailable;
177b9e67834SAndre Fischer     ColorType meColorType;
178b9e67834SAndre Fischer     SvxEscapement               meEscape;  //for sw
179b9e67834SAndre Fischer     bool                        mbSuper;
180b9e67834SAndre Fischer     bool                        mbSub;
181b9e67834SAndre Fischer     bool                        mbKernAvailable;
182b9e67834SAndre Fischer     bool                        mbKernLBAvailable;
183b9e67834SAndre Fischer     long                        mlKerning;
184b9e67834SAndre Fischer     SvxFontHeightItem*          mpHeightItem;
185b9e67834SAndre Fischer 
186b9e67834SAndre Fischer     const FontList* mpFontList;
187b9e67834SAndre Fischer     bool mbMustDelete;
188b9e67834SAndre Fischer     bool mbFocusOnFontSizeCtrl;
189b9e67834SAndre Fischer 
19095a18594SAndre Fischer     cssu::Reference<css::frame::XFrame> mxFrame;
191b9e67834SAndre Fischer     ::sfx2::sidebar::EnumContext maContext;
192b9e67834SAndre Fischer     SfxBindings* mpBindings;
193b9e67834SAndre Fischer 
194b9e67834SAndre Fischer     TextPropertyPanel (
195b9e67834SAndre Fischer         Window* pParent,
196b9e67834SAndre Fischer         const cssu::Reference<css::frame::XFrame>& rxFrame,
197b9e67834SAndre Fischer         SfxBindings* pBindings);
198b9e67834SAndre Fischer     virtual ~TextPropertyPanel (void);
199b9e67834SAndre Fischer 
200b9e67834SAndre Fischer     void Initialize (void);
201b9e67834SAndre Fischer     void SetupIcons (void);
202b9e67834SAndre Fischer     void InitToolBoxFont();
203b9e67834SAndre Fischer     void InitToolBoxIncDec();
204b9e67834SAndre Fischer     void InitToolBoxFontColor();
205b9e67834SAndre Fischer     void InitToolBoxScript();
206b9e67834SAndre Fischer     void InitToolBoxHighlight();
207b9e67834SAndre Fischer     void InitToolBoxSpacing();
208b9e67834SAndre Fischer 
209b9e67834SAndre Fischer     void UpdateFontBold();
210b9e67834SAndre Fischer     void UpdateFontItalic();
211b9e67834SAndre Fischer     void UpdateFontUnderline();
212b9e67834SAndre Fischer     void UpdateFontStrikeOut();
213b9e67834SAndre Fischer     void UpdateFontShadowed();
214b9e67834SAndre Fischer     void UpdateFontScript();
215b9e67834SAndre Fischer 
216b9e67834SAndre Fischer     /*
217b9e67834SAndre Fischer     SfxPopupPanelWin*       mpFloatWinUnderline;
218b9e67834SAndre Fischer     class SvxTextUnderlinePage;
219b9e67834SAndre Fischer     SvxTextUnderlinePage*   mpPageUnderline;
220b9e67834SAndre Fischer 
221b9e67834SAndre Fischer     SfxPopupPanelWin*       mpFloatWinFontColor;
222b9e67834SAndre Fischer     class SvxTextFontColorPage;
223b9e67834SAndre Fischer     SvxTextFontColorPage*   mpPageFontColor;
224b9e67834SAndre Fischer 
225b9e67834SAndre Fischer     SfxPopupPanelWin*       mpFloatWinSpacing;
226b9e67834SAndre Fischer     class SvxTextSpacingPage;
227b9e67834SAndre Fischer     SvxTextSpacingPage*     mpPageSpacing;
228b9e67834SAndre Fischer     */
229b9e67834SAndre Fischer     DECL_LINK(FontSelHdl, FontNameBox *);
230b9e67834SAndre Fischer     DECL_LINK(FontSizeModifyHdl, FontSizeBox *);
231b9e67834SAndre Fischer     DECL_LINK(FontSizeSelHdl, FontSizeBox *);
232b9e67834SAndre Fischer     DECL_LINK(FontSizeLoseFocus, FontSizeBox *);
233b9e67834SAndre Fischer     DECL_LINK(ToolboxFontSelectHandler, ToolBox *);
234b9e67834SAndre Fischer     DECL_LINK(ToolboxIncDecSelectHdl, ToolBox *);
235b9e67834SAndre Fischer     DECL_LINK(ToolBoxUnderlineClickHdl, ToolBox* );
236b9e67834SAndre Fischer     DECL_LINK(ImplPopupModeEndHdl, FloatingWindow* );
237b9e67834SAndre Fischer     DECL_LINK(ImplSpacingPopupModeEndHdl, FloatingWindow* );  //
238b9e67834SAndre Fischer     DECL_LINK(ToolBoxFontColorDropHdl, ToolBox *);
239b9e67834SAndre Fischer     DECL_LINK(ToolBoxSwScriptSelectHdl, ToolBox *);
240b9e67834SAndre Fischer     DECL_LINK(ToolBoxScriptSelectHdl, ToolBox *);
241b9e67834SAndre Fischer     DECL_LINK(SpacingClickHdl, ToolBox*);
242b9e67834SAndre Fischer     DECL_LINK(ToolBoxHighlightDropHdl, ToolBox *);
243b9e67834SAndre Fischer 
244b9e67834SAndre Fischer     void TextStyleChanged();
24595a18594SAndre Fischer 
24695a18594SAndre Fischer     Image GetIcon (const ::rtl::OUString& rsURL);
247b9e67834SAndre Fischer };
248b9e67834SAndre Fischer 
249b9e67834SAndre Fischer } } // end of namespace ::svx::sidebar
250b9e67834SAndre Fischer 
251b9e67834SAndre Fischer #endif
252