xref: /AOO41X/main/svx/source/sidebar/text/TextPropertyPanel.hxx (revision da72173f9f5ebf442a76a058e2275842cbc3d04e)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 #ifndef SVX_SIDEBAR_TEXT_PROPERTY_PAGE_HXX
23 #define SVX_SIDEBAR_TEXT_PROPERTY_PAGE_HXX
24 
25 #include <vcl/ctrl.hxx>
26 #include <sfx2/sidebar/SidebarPanelBase.hxx>
27 #include <sfx2/sidebar/ControllerItem.hxx>
28 #include <sfx2/sidebar/IContextChangeReceiver.hxx>
29 
30 #include <svtools/ctrlbox.hxx>
31 #include <svx/tbxcolorupdate.hxx>
32 #include <editeng/svxenum.hxx>
33 #include <editeng/fhgtitem.hxx>
34 
35 #include <com/sun/star/ui/XUIElement.hpp>
36 
37 #include <boost/scoped_ptr.hpp>
38 
39 
40 class FloatingWindow;
41 class ToolBox;
42 
43 namespace svx { namespace sidebar {
44 
45 class SvxSBFontNameBox;
46 
47 class TextPropertyPanel
48     : public Control,
49       public ::sfx2::sidebar::IContextChangeReceiver,
50       public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
51 {
52 public:
53     static TextPropertyPanel* Create (
54         Window* pParent,
55         const cssu::Reference<css::frame::XFrame>& rxFrame,
56         SfxBindings* pBindings);
57 
58     virtual void DataChanged (const DataChangedEvent& rEvent);
59 
60     //  void SetDefaultUnderline(FontUnderline eUnderline);
61     //  USHORT GetCurrColorType();
62 
63     //  void SetBackColor(Color aCol);
64     //  void SetColor(Color aCol);
65     //  void SetUnderline(FontUnderline eUnderline);
66     //  void SetSpacing(long nKern);
67 
68     /*
69     SvxTextUnderlinePage* GetUnderlinePage();
70     SfxPopupPanelWin* GetUnderlineFloatWin();
71 
72     SvxTextFontColorPage* GetFontColorPage();
73     SfxPopupPanelWin* GetFontColorFloatWin();
74 
75     SvxTextSpacingPage* GetSpacingPage();
76     SfxPopupPanelWin* GetSpacingFloatWin();
77     */
78     //  long GetSelFontSize();
79     //  SfxPropertyPageController GetSpaceController();
80 //  ToolBox* GetSpacingTB();        //removed
81     //  Color& GetUnderlineColor();  //
82 //  void FontListChanged();
83 
84     enum ColorType
85     {
86         FONT_COLOR = 1,
87         BACK_COLOR = 2
88     };
89 
90     virtual void HandleContextChange (
91         const ::sfx2::sidebar::EnumContext aContext);
92 
93     virtual void NotifyItemUpdate(
94         const sal_uInt16 nSId,
95         const SfxItemState eState,
96         const SfxPoolItem* pState);
97 
98 private:
99     //ui controls
100     ::boost::scoped_ptr<SvxSBFontNameBox> mpFontNameBox;
101     FontSizeBox maFontSizeBox;
102     ::boost::scoped_ptr<Window> mpToolBoxIncDecBackground;
103     ::boost::scoped_ptr<ToolBox> mpToolBoxIncDec;
104     ::boost::scoped_ptr<Window> mpToolBoxFontBackground;
105     ::boost::scoped_ptr<ToolBox> mpToolBoxFont;
106     ::boost::scoped_ptr<Window> mpToolBoxFontColorBackground;
107     ::boost::scoped_ptr<ToolBox> mpToolBoxFontColor;
108     ::boost::scoped_ptr<Window> mpToolBoxScriptBackground;
109     ::boost::scoped_ptr<ToolBox> mpToolBoxScript;
110     ::boost::scoped_ptr<Window> mpToolBoxScriptSwBackground;
111     ::boost::scoped_ptr<ToolBox> mpToolBoxScriptSw;
112     ::boost::scoped_ptr<Window> mpToolBoxSpacingBackground;
113     ::boost::scoped_ptr<ToolBox> mpToolBoxSpacing;
114     ::boost::scoped_ptr<Window> mpToolBoxHighlightBackground;
115     ::boost::scoped_ptr<ToolBox> mpToolBoxHighlight;
116     ::boost::scoped_ptr<ToolboxButtonColorUpdater> mpFontColorUpdater;
117     ::boost::scoped_ptr<ToolboxButtonColorUpdater> mpHighlightUpdater;
118 
119     //control items
120     ::sfx2::sidebar::ControllerItem maFontNameControl;
121     ::sfx2::sidebar::ControllerItem maFontSizeControl;
122     ::sfx2::sidebar::ControllerItem maWeightControl;
123     ::sfx2::sidebar::ControllerItem maItalicControl;
124     ::sfx2::sidebar::ControllerItem maUnderlineControl;
125     ::sfx2::sidebar::ControllerItem maStrikeControl;
126     ::sfx2::sidebar::ControllerItem maShadowControl;
127     ::sfx2::sidebar::ControllerItem maFontColorControl;
128     ::sfx2::sidebar::ControllerItem maScriptControlSw;
129     ::sfx2::sidebar::ControllerItem maSuperScriptControl;
130     ::sfx2::sidebar::ControllerItem maSubScriptControl;
131     ::sfx2::sidebar::ControllerItem maSpacingControl;
132     ::sfx2::sidebar::ControllerItem maHighlightControl;
133     ::sfx2::sidebar::ControllerItem maSDFontGrow;
134     ::sfx2::sidebar::ControllerItem maSDFontShrink;
135 
136     //Images
137     Image   maImgIncrease;
138     Image   maImgDecrease;
139     Image   maImgBold;
140     Image   maImgItalic;
141     Image   maImgUnderline;
142     Image   maImgStrike;
143     Image   maImgShadow;
144     Image   maImgFontColor;
145     Image   maImgSupScript;
146     Image   maImgSubScript;
147     Image   maImgHighlight;
148 
149     Image               maImgNormalIcon;
150 
151     Image   maImgIncreaseHigh;
152     Image   maImgDecreaseHigh;
153     Image   maImgBoldHigh;
154     Image   maImgItalicHigh;
155     Image   maImgUnderlineHigh;
156     Image   maImgStrikeHigh;
157     Image   maImgShadowHigh;
158     Image   maImgFontColorHigh;
159     Image   maImgSupScriptHigh;
160     Image   maImgSubScriptHigh;
161 //  Image   maImgSpacingHigh;  //
162     Image   maImgHighlightHigh;
163 
164     FontWeight                  meWeight;
165     FontItalic                  meItalic;
166     FontUnderline               meUnderline;
167     Color                       meUnderlineColor;  //
168     bool                        mbShadow;
169     FontStrikeout               meStrike;
170     bool mbWeightAvailable;
171     bool mbPostureAvailable;
172     Color                       maColor;
173     bool mbColorAvailable;
174     Color                       maBackColor;
175     bool mbBackColorAvailable;
176     ColorType meColorType;
177     SvxEscapement               meEscape;  //for sw
178     bool                        mbSuper;
179     bool                        mbSub;
180     bool                        mbKernAvailable;
181     bool                        mbKernLBAvailable;
182     long                        mlKerning;
183     SvxFontHeightItem*          mpHeightItem;
184 
185     const FontList* mpFontList;
186     bool mbMustDelete;
187     bool mbFocusOnFontSizeCtrl;
188 
189     cssu::Reference<css::frame::XFrame> mxFrame;
190     ::sfx2::sidebar::EnumContext maContext;
191     SfxBindings* mpBindings;
192 
193     TextPropertyPanel (
194         Window* pParent,
195         const cssu::Reference<css::frame::XFrame>& rxFrame,
196         SfxBindings* pBindings);
197     virtual ~TextPropertyPanel (void);
198 
199     void Initialize (void);
200     void SetupIcons (void);
201     void InitToolBoxFont();
202     void InitToolBoxIncDec();
203     void InitToolBoxFontColor();
204     void InitToolBoxScript();
205     void InitToolBoxHighlight();
206     void InitToolBoxSpacing();
207 
208     void UpdateFontBold();
209     void UpdateFontItalic();
210     void UpdateFontUnderline();
211     void UpdateFontStrikeOut();
212     void UpdateFontShadowed();
213     void UpdateFontScript();
214 
215     /*
216     SfxPopupPanelWin*       mpFloatWinUnderline;
217     class SvxTextUnderlinePage;
218     SvxTextUnderlinePage*   mpPageUnderline;
219 
220     SfxPopupPanelWin*       mpFloatWinFontColor;
221     class SvxTextFontColorPage;
222     SvxTextFontColorPage*   mpPageFontColor;
223 
224     SfxPopupPanelWin*       mpFloatWinSpacing;
225     class SvxTextSpacingPage;
226     SvxTextSpacingPage*     mpPageSpacing;
227     */
228     DECL_LINK(FontSelHdl, FontNameBox *);
229     DECL_LINK(FontSizeModifyHdl, FontSizeBox *);
230     DECL_LINK(FontSizeSelHdl, FontSizeBox *);
231     DECL_LINK(FontSizeLoseFocus, FontSizeBox *);
232     DECL_LINK(ToolboxFontSelectHandler, ToolBox *);
233     DECL_LINK(ToolboxIncDecSelectHdl, ToolBox *);
234     DECL_LINK(ToolBoxUnderlineClickHdl, ToolBox* );
235     DECL_LINK(ImplPopupModeEndHdl, FloatingWindow* );
236     DECL_LINK(ImplSpacingPopupModeEndHdl, FloatingWindow* );  //
237     DECL_LINK(ToolBoxFontColorDropHdl, ToolBox *);
238     DECL_LINK(ToolBoxSwScriptSelectHdl, ToolBox *);
239     DECL_LINK(ToolBoxScriptSelectHdl, ToolBox *);
240     DECL_LINK(SpacingClickHdl, ToolBox*);
241     DECL_LINK(ToolBoxHighlightDropHdl, ToolBox *);
242 
243     void TextStyleChanged();
244 
245     Image GetIcon (const ::rtl::OUString& rsURL);
246 };
247 
248 } } // end of namespace ::svx::sidebar
249 
250 #endif
251