xref: /AOO41X/main/svx/source/sidebar/text/TextPropertyPanel.hxx (revision b9e67834aa136f0c8550ba8a880ab75deaeb26df)
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 <sfx2/sidebar/SidebarPanelBase.hxx>
26 #include <sfx2/sidebar/ControllerItem.hxx>
27 
28 #include <svtools/ctrlbox.hxx>
29 #include <vcl/toolbox.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 namespace svx { namespace sidebar {
40 
41 class SvxSBFontNameBox;
42 
43 class TextPropertyPanel
44     : public ::sfx2::sidebar::SidebarPanelBase,
45       public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
46 {
47 public:
48     static cssu::Reference<css::ui::XUIElement> Create (
49         const ::rtl::OUString& rsResourceURL,
50         Window* pParent,
51         const cssu::Reference<css::frame::XFrame>& rxFrame,
52         SfxBindings* pBindings);
53 
54     //  SVX_DLLPUBLIC static SfxSectionPage* createSectionPage(Window* pParent, SfxPropertyPanel* pPanel, PropertySectionType nPageId);
55 
56     virtual void Paint (const Rectangle &rRect);
57     virtual void DataChanged (const DataChangedEvent& rEvent);
58 
59     //  void SetDefaultUnderline(FontUnderline eUnderline);
60     //  USHORT GetCurrColorType();
61 
62     //  void SetBackColor(Color aCol);
63     //  void SetColor(Color aCol);
64     //  void SetUnderline(FontUnderline eUnderline);
65     //  void SetSpacing(long nKern);
66 
67     /*
68     SvxTextUnderlinePage* GetUnderlinePage();
69     SfxPopupPanelWin* GetUnderlineFloatWin();
70 
71     SvxTextFontColorPage* GetFontColorPage();
72     SfxPopupPanelWin* GetFontColorFloatWin();
73 
74     SvxTextSpacingPage* GetSpacingPage();
75     SfxPopupPanelWin* GetSpacingFloatWin();
76     */
77     //  long GetSelFontSize();
78     //  SfxPropertyPageController GetSpaceController();
79 //  ToolBox* GetSpacingTB();        //removed
80     //  Color& GetUnderlineColor();  //
81 //  void FontListChanged();
82 
83     enum ColorType
84     {
85         FONT_COLOR = 1,
86         BACK_COLOR = 2
87     };
88 
89 protected:
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     ::sfx2::sidebar::EnumContext maContext;
183     SfxBindings* mpBindings;
184 
185     TextPropertyPanel (
186         const ::rtl::OUString& rsResourceURL,
187         Window* pParent,
188         const cssu::Reference<css::frame::XFrame>& rxFrame,
189         SfxBindings* pBindings);
190     virtual ~TextPropertyPanel (void);
191 
192     void PaintRect(const ToolBox &rTB);
193     void Initialize (void);
194     void SetupIcons (void);
195     void InitToolBoxFont();
196     void InitToolBoxIncDec();
197     void InitToolBoxFontColor();
198     void InitToolBoxScript();
199     void InitToolBoxHighlight();
200     void InitToolBoxSpacing();
201 
202     void UpdateFontBold();
203     void UpdateFontItalic();
204     void UpdateFontUnderline();
205     void UpdateFontStrikeOut();
206     void UpdateFontShadowed();
207     void UpdateFontScript();
208 
209     /*
210     SfxPopupPanelWin*       mpFloatWinUnderline;
211     class SvxTextUnderlinePage;
212     SvxTextUnderlinePage*   mpPageUnderline;
213 
214     SfxPopupPanelWin*       mpFloatWinFontColor;
215     class SvxTextFontColorPage;
216     SvxTextFontColorPage*   mpPageFontColor;
217 
218     SfxPopupPanelWin*       mpFloatWinSpacing;
219     class SvxTextSpacingPage;
220     SvxTextSpacingPage*     mpPageSpacing;
221     */
222     DECL_LINK(FontSelHdl, FontNameBox *);
223     DECL_LINK(FontSizeModifyHdl, FontSizeBox *);
224     DECL_LINK(FontSizeSelHdl, FontSizeBox *);
225     DECL_LINK(FontSizeLoseFocus, FontSizeBox *);
226     DECL_LINK(ToolboxFontSelectHandler, ToolBox *);
227     DECL_LINK(ToolboxIncDecSelectHdl, ToolBox *);
228     DECL_LINK(ToolBoxUnderlineClickHdl, ToolBox* );
229     DECL_LINK(ImplPopupModeEndHdl, FloatingWindow* );
230     DECL_LINK(ImplSpacingPopupModeEndHdl, FloatingWindow* );  //
231     DECL_LINK(ToolBoxFontColorDropHdl, ToolBox *);
232     DECL_LINK(ToolBoxSwScriptSelectHdl, ToolBox *);
233     DECL_LINK(ToolBoxScriptSelectHdl, ToolBox *);
234     DECL_LINK(SpacingClickHdl, ToolBox*);
235     DECL_LINK(ToolBoxHighlightDropHdl, ToolBox *);
236 
237     void TextStyleChanged();
238 };
239 
240 } } // end of namespace ::svx::sidebar
241 
242 #endif
243