xref: /AOO41X/main/svx/source/sidebar/text/TextPropertyPanel.hxx (revision 66c1fc23d43db82fc6b202f8cf67166abcf1ab96)
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 
29 #include <svtools/ctrlbox.hxx>
30 #include <svx/tbxcolorupdate.hxx>
31 #include <editeng/svxenum.hxx>
32 #include <editeng/fhgtitem.hxx>
33 
34 #include <com/sun/star/ui/XUIElement.hpp>
35 
36 #include <boost/scoped_ptr.hpp>
37 
38 
39 class FloatingWindow;
40 class ToolBox;
41 
42 
43 namespace svx { namespace sidebar {
44 
45 class SvxSBFontNameBox;
46 
47 class TextPropertyPanel
48     : public Control,
49       public ::sfx2::sidebar::SidebarPanelBase::ContextChangeReceiverInterface,
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<ToolBox> mpToolBoxIncDec;
103     ::boost::scoped_ptr<ToolBox> mpToolBoxFont;
104     ::boost::scoped_ptr<ToolBox> mpToolBoxFontColor;
105     ::boost::scoped_ptr<ToolBox> mpToolBoxScript;
106     ::boost::scoped_ptr<ToolBox> mpToolBoxScriptSw;
107     ::boost::scoped_ptr<ToolBox> mpToolBoxSpacing;
108     ::boost::scoped_ptr<ToolBox> mpToolBoxHighlight;
109     ::boost::scoped_ptr<ToolboxButtonColorUpdater> mpFontColorUpdater;
110     ::boost::scoped_ptr<ToolboxButtonColorUpdater> mpHighlightUpdater;
111 
112     //control items
113     ::sfx2::sidebar::ControllerItem maFontNameControl;
114     ::sfx2::sidebar::ControllerItem maFontSizeControl;
115     ::sfx2::sidebar::ControllerItem maWeightControl;
116     ::sfx2::sidebar::ControllerItem maItalicControl;
117     ::sfx2::sidebar::ControllerItem maUnderlineControl;
118     ::sfx2::sidebar::ControllerItem maStrikeControl;
119     ::sfx2::sidebar::ControllerItem maShadowControl;
120     ::sfx2::sidebar::ControllerItem maFontColorControl;
121     ::sfx2::sidebar::ControllerItem maScriptControlSw;
122     ::sfx2::sidebar::ControllerItem maSuperScriptControl;
123     ::sfx2::sidebar::ControllerItem maSubScriptControl;
124     ::sfx2::sidebar::ControllerItem maSpacingControl;
125     ::sfx2::sidebar::ControllerItem maHighlightControl;
126     ::sfx2::sidebar::ControllerItem maSDFontGrow;
127     ::sfx2::sidebar::ControllerItem maSDFontShrink;
128 
129     //Images
130     Image   maImgIncrease;
131     Image   maImgDecrease;
132     Image   maImgBold;
133     Image   maImgItalic;
134     Image   maImgUnderline;
135     Image   maImgStrike;
136     Image   maImgShadow;
137     Image   maImgFontColor;
138     Image   maImgSupScript;
139     Image   maImgSubScript;
140     Image   maImgHighlight;
141 
142     Image               maImgNormalIcon;
143 
144     Image   maImgIncreaseHigh;
145     Image   maImgDecreaseHigh;
146     Image   maImgBoldHigh;
147     Image   maImgItalicHigh;
148     Image   maImgUnderlineHigh;
149     Image   maImgStrikeHigh;
150     Image   maImgShadowHigh;
151     Image   maImgFontColorHigh;
152     Image   maImgSupScriptHigh;
153     Image   maImgSubScriptHigh;
154 //  Image   maImgSpacingHigh;  //
155     Image   maImgHighlightHigh;
156 
157     FontWeight                  meWeight;
158     FontItalic                  meItalic;
159     FontUnderline               meUnderline;
160     Color                       meUnderlineColor;  //
161     bool                        mbShadow;
162     FontStrikeout               meStrike;
163     bool mbWeightAvailable;
164     bool mbPostureAvailable;
165     Color                       maColor;
166     bool mbColorAvailable;
167     Color                       maBackColor;
168     bool mbBackColorAvailable;
169     ColorType meColorType;
170     SvxEscapement               meEscape;  //for sw
171     bool                        mbSuper;
172     bool                        mbSub;
173     bool                        mbKernAvailable;
174     bool                        mbKernLBAvailable;
175     long                        mlKerning;
176     SvxFontHeightItem*          mpHeightItem;
177 
178     const FontList* mpFontList;
179     bool mbMustDelete;
180     bool mbFocusOnFontSizeCtrl;
181 
182     cssu::Reference<css::frame::XFrame> mxFrame;
183     ::sfx2::sidebar::EnumContext maContext;
184     SfxBindings* mpBindings;
185 
186     TextPropertyPanel (
187         Window* pParent,
188         const cssu::Reference<css::frame::XFrame>& rxFrame,
189         SfxBindings* pBindings);
190     virtual ~TextPropertyPanel (void);
191 
192     void Initialize (void);
193     void SetupIcons (void);
194     void InitToolBoxFont();
195     void InitToolBoxIncDec();
196     void InitToolBoxFontColor();
197     void InitToolBoxScript();
198     void InitToolBoxHighlight();
199     void InitToolBoxSpacing();
200 
201     void UpdateFontBold();
202     void UpdateFontItalic();
203     void UpdateFontUnderline();
204     void UpdateFontStrikeOut();
205     void UpdateFontShadowed();
206     void UpdateFontScript();
207 
208     /*
209     SfxPopupPanelWin*       mpFloatWinUnderline;
210     class SvxTextUnderlinePage;
211     SvxTextUnderlinePage*   mpPageUnderline;
212 
213     SfxPopupPanelWin*       mpFloatWinFontColor;
214     class SvxTextFontColorPage;
215     SvxTextFontColorPage*   mpPageFontColor;
216 
217     SfxPopupPanelWin*       mpFloatWinSpacing;
218     class SvxTextSpacingPage;
219     SvxTextSpacingPage*     mpPageSpacing;
220     */
221     DECL_LINK(FontSelHdl, FontNameBox *);
222     DECL_LINK(FontSizeModifyHdl, FontSizeBox *);
223     DECL_LINK(FontSizeSelHdl, FontSizeBox *);
224     DECL_LINK(FontSizeLoseFocus, FontSizeBox *);
225     DECL_LINK(ToolboxFontSelectHandler, ToolBox *);
226     DECL_LINK(ToolboxIncDecSelectHdl, ToolBox *);
227     DECL_LINK(ToolBoxUnderlineClickHdl, ToolBox* );
228     DECL_LINK(ImplPopupModeEndHdl, FloatingWindow* );
229     DECL_LINK(ImplSpacingPopupModeEndHdl, FloatingWindow* );  //
230     DECL_LINK(ToolBoxFontColorDropHdl, ToolBox *);
231     DECL_LINK(ToolBoxSwScriptSelectHdl, ToolBox *);
232     DECL_LINK(ToolBoxScriptSelectHdl, ToolBox *);
233     DECL_LINK(SpacingClickHdl, ToolBox*);
234     DECL_LINK(ToolBoxHighlightDropHdl, ToolBox *);
235 
236     void TextStyleChanged();
237 
238     Image GetIcon (const ::rtl::OUString& rsURL);
239 };
240 
241 } } // end of namespace ::svx::sidebar
242 
243 #endif
244