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>
29b9e67834SAndre Fischer 
30b9e67834SAndre Fischer #include <svtools/ctrlbox.hxx>
31b9e67834SAndre Fischer #include <svx/tbxcolorupdate.hxx>
32b9e67834SAndre Fischer #include <editeng/svxenum.hxx>
33b9e67834SAndre Fischer #include <editeng/fhgtitem.hxx>
34b9e67834SAndre Fischer 
35b9e67834SAndre Fischer #include <com/sun/star/ui/XUIElement.hpp>
36b9e67834SAndre Fischer 
37b9e67834SAndre Fischer #include <boost/scoped_ptr.hpp>
38d4aefcaeSZheng Fan #include "TextCharacterSpacingPopup.hxx"
39d4aefcaeSZheng Fan #include "TextUnderlinePopup.hxx"
40*facb16e7SArmin Le Grand #include <svx/sidebar/ColorPopup.hxx>
41d4aefcaeSZheng Fan #include <vcl/vclenum.hxx>
42b9e67834SAndre Fischer 
4395a18594SAndre Fischer class FloatingWindow;
4495a18594SAndre Fischer class ToolBox;
4595a18594SAndre Fischer 
46b9e67834SAndre Fischer namespace svx { namespace sidebar {
47b9e67834SAndre Fischer 
48b9e67834SAndre Fischer class SvxSBFontNameBox;
49d4aefcaeSZheng Fan class PopupControl;
50d4aefcaeSZheng Fan class PopupContainer;
51b9e67834SAndre Fischer 
52b9e67834SAndre Fischer class TextPropertyPanel
5395a18594SAndre Fischer     : public Control,
54d4aefcaeSZheng Fan        public ::sfx2::sidebar::IContextChangeReceiver,
55b9e67834SAndre Fischer       public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
56b9e67834SAndre Fischer {
57b9e67834SAndre Fischer public:
5895a18594SAndre Fischer     static TextPropertyPanel* Create (
59b9e67834SAndre Fischer         Window* pParent,
60b9e67834SAndre Fischer         const cssu::Reference<css::frame::XFrame>& rxFrame,
61b9e67834SAndre Fischer         SfxBindings* pBindings);
62b9e67834SAndre Fischer 
63b9e67834SAndre Fischer     virtual void DataChanged (const DataChangedEvent& rEvent);
64d4aefcaeSZheng Fan     SfxBindings* GetBindings();
65d4aefcaeSZheng Fan     ::sfx2::sidebar::ControllerItem& GetSpaceController();
66d4aefcaeSZheng Fan     long GetSelFontSize();
67d4aefcaeSZheng Fan     void SetSpacing(long nKern);
68d4aefcaeSZheng Fan     void EndSpacingPopupMode (void);
69d4aefcaeSZheng Fan     void EndUnderlinePopupMode (void);
70d4aefcaeSZheng Fan 	Color GetFontColor (void) const;
71d4aefcaeSZheng Fan 	void SetFontColor (const String& rsColorName,const Color aColor);
72d4aefcaeSZheng Fan 	Color GetBrushColor (void) const;
73d4aefcaeSZheng Fan 	void SetBrushColor (const String& rsColorName,const Color aColor);
74d4aefcaeSZheng Fan 	void SetUnderline(FontUnderline	eUnderline);
75d4aefcaeSZheng Fan 	Color& GetUnderlineColor();
76d4aefcaeSZheng Fan 	void SetDefaultUnderline(FontUnderline eUnderline);
77da72173fSAndre Fischer 
78b9e67834SAndre Fischer 
79b9e67834SAndre Fischer     enum ColorType
80b9e67834SAndre Fischer     {
81b9e67834SAndre Fischer         FONT_COLOR = 1,
82b9e67834SAndre Fischer         BACK_COLOR = 2
83b9e67834SAndre Fischer     };
84b9e67834SAndre Fischer 
85b9e67834SAndre Fischer     virtual void HandleContextChange (
86b9e67834SAndre Fischer         const ::sfx2::sidebar::EnumContext aContext);
87b9e67834SAndre Fischer 
88b9e67834SAndre Fischer     virtual void NotifyItemUpdate(
89b9e67834SAndre Fischer         const sal_uInt16 nSId,
90b9e67834SAndre Fischer         const SfxItemState eState,
91b9e67834SAndre Fischer         const SfxPoolItem* pState);
92b9e67834SAndre Fischer 
93b9e67834SAndre Fischer private:
94b9e67834SAndre Fischer 	//ui controls
95b9e67834SAndre Fischer     ::boost::scoped_ptr<SvxSBFontNameBox> mpFontNameBox;
96b9e67834SAndre Fischer 	FontSizeBox maFontSizeBox;
977a32b0c8SAndre Fischer 	::boost::scoped_ptr<Window> mpToolBoxIncDecBackground;
987a32b0c8SAndre Fischer 	::boost::scoped_ptr<ToolBox> mpToolBoxIncDec;
997a32b0c8SAndre Fischer 	::boost::scoped_ptr<Window> mpToolBoxFontBackground;
100b9e67834SAndre Fischer 	::boost::scoped_ptr<ToolBox> mpToolBoxFont;
1017a32b0c8SAndre Fischer 	::boost::scoped_ptr<Window> mpToolBoxFontColorBackground;
102b9e67834SAndre Fischer 	::boost::scoped_ptr<ToolBox> mpToolBoxFontColor;
1037a32b0c8SAndre Fischer 	::boost::scoped_ptr<Window> mpToolBoxScriptBackground;
104b9e67834SAndre Fischer 	::boost::scoped_ptr<ToolBox> mpToolBoxScript;
1057a32b0c8SAndre Fischer 	::boost::scoped_ptr<Window> mpToolBoxScriptSwBackground;
106b9e67834SAndre Fischer 	::boost::scoped_ptr<ToolBox> mpToolBoxScriptSw;
1077a32b0c8SAndre Fischer 	::boost::scoped_ptr<Window> mpToolBoxSpacingBackground;
108b9e67834SAndre Fischer 	::boost::scoped_ptr<ToolBox> mpToolBoxSpacing;
1097a32b0c8SAndre Fischer 	::boost::scoped_ptr<Window> mpToolBoxHighlightBackground;
110b9e67834SAndre Fischer 	::boost::scoped_ptr<ToolBox> mpToolBoxHighlight;
111b9e67834SAndre Fischer 	::boost::scoped_ptr<ToolboxButtonColorUpdater> mpFontColorUpdater;
112b9e67834SAndre Fischer     ::boost::scoped_ptr<ToolboxButtonColorUpdater> mpHighlightUpdater;
113b9e67834SAndre Fischer 
114b9e67834SAndre Fischer 	//control items
115b9e67834SAndre Fischer 	::sfx2::sidebar::ControllerItem maFontNameControl;
116b9e67834SAndre Fischer 	::sfx2::sidebar::ControllerItem maFontSizeControl;
117b9e67834SAndre Fischer 	::sfx2::sidebar::ControllerItem maWeightControl;
118b9e67834SAndre Fischer 	::sfx2::sidebar::ControllerItem maItalicControl;
119b9e67834SAndre Fischer 	::sfx2::sidebar::ControllerItem maUnderlineControl;
120b9e67834SAndre Fischer 	::sfx2::sidebar::ControllerItem maStrikeControl;
121b9e67834SAndre Fischer 	::sfx2::sidebar::ControllerItem maShadowControl;
122b9e67834SAndre Fischer 	::sfx2::sidebar::ControllerItem maFontColorControl;
123b9e67834SAndre Fischer 	::sfx2::sidebar::ControllerItem maScriptControlSw;
124b9e67834SAndre Fischer 	::sfx2::sidebar::ControllerItem maSuperScriptControl;
125b9e67834SAndre Fischer 	::sfx2::sidebar::ControllerItem maSubScriptControl;
126b9e67834SAndre Fischer 	::sfx2::sidebar::ControllerItem maSpacingControl;
127b9e67834SAndre Fischer 	::sfx2::sidebar::ControllerItem maHighlightControl;
128b9e67834SAndre Fischer 	::sfx2::sidebar::ControllerItem maSDFontGrow;
129b9e67834SAndre Fischer 	::sfx2::sidebar::ControllerItem maSDFontShrink;
130b9e67834SAndre Fischer 
131b9e67834SAndre Fischer 	//Images
132b9e67834SAndre Fischer 	Image	maImgIncrease;
133b9e67834SAndre Fischer 	Image	maImgDecrease;
134b9e67834SAndre Fischer 	Image	maImgBold;
135b9e67834SAndre Fischer 	Image	maImgItalic;
136b9e67834SAndre Fischer 	Image	maImgUnderline;
137b9e67834SAndre Fischer 	Image	maImgStrike;
138b9e67834SAndre Fischer 	Image	maImgShadow;
139b9e67834SAndre Fischer 	Image	maImgFontColor;
140b9e67834SAndre Fischer 	Image	maImgSupScript;
141b9e67834SAndre Fischer 	Image	maImgSubScript;
142b9e67834SAndre Fischer 	Image   maImgHighlight;
143b9e67834SAndre Fischer 
144b9e67834SAndre Fischer 	Image				maImgNormalIcon;
145b9e67834SAndre Fischer 
146b9e67834SAndre Fischer 	Image	maImgIncreaseHigh;
147b9e67834SAndre Fischer 	Image	maImgDecreaseHigh;
148b9e67834SAndre Fischer 	Image	maImgBoldHigh;
149b9e67834SAndre Fischer 	Image	maImgItalicHigh;
150b9e67834SAndre Fischer 	Image	maImgUnderlineHigh;
151b9e67834SAndre Fischer 	Image	maImgStrikeHigh;
152b9e67834SAndre Fischer 	Image	maImgShadowHigh;
153b9e67834SAndre Fischer 	Image	maImgFontColorHigh;
154b9e67834SAndre Fischer 	Image	maImgSupScriptHigh;
155b9e67834SAndre Fischer 	Image	maImgSubScriptHigh;
156b9e67834SAndre Fischer //	Image	maImgSpacingHigh;  //
157b9e67834SAndre Fischer 	Image   maImgHighlightHigh;
158b9e67834SAndre Fischer 
159b9e67834SAndre Fischer 	FontWeight					meWeight;
160b9e67834SAndre Fischer 	FontItalic					meItalic;
161b9e67834SAndre Fischer 	FontUnderline				meUnderline;
162b9e67834SAndre Fischer 	Color						meUnderlineColor;  //
163b9e67834SAndre Fischer 	bool						mbShadow;
164b9e67834SAndre Fischer 	FontStrikeout				meStrike;
165b9e67834SAndre Fischer 	bool mbWeightAvailable;
166b9e67834SAndre Fischer 	bool mbPostureAvailable;
167b9e67834SAndre Fischer 	Color						maColor;
168b9e67834SAndre Fischer 	bool mbColorAvailable;
169b9e67834SAndre Fischer 	Color						maBackColor;
170b9e67834SAndre Fischer 	bool mbBackColorAvailable;
171b9e67834SAndre Fischer 	ColorType meColorType;
172b9e67834SAndre Fischer 	SvxEscapement				meEscape;  //for sw
173b9e67834SAndre Fischer 	bool						mbSuper;
174b9e67834SAndre Fischer 	bool						mbSub;
175b9e67834SAndre Fischer 	bool						mbKernAvailable;
176b9e67834SAndre Fischer 	bool						mbKernLBAvailable;
177b9e67834SAndre Fischer 	long						mlKerning;
178b9e67834SAndre Fischer 	SvxFontHeightItem*			mpHeightItem;
179b9e67834SAndre Fischer 
180b9e67834SAndre Fischer 	const FontList* mpFontList;
181b9e67834SAndre Fischer 	bool mbMustDelete;
182b9e67834SAndre Fischer 	bool mbFocusOnFontSizeCtrl;
183d4aefcaeSZheng Fan 	TextCharacterSpacingPopup maCharSpacePopup;
184d4aefcaeSZheng Fan 	TextUnderlinePopup maUnderlinePopup;
185d4aefcaeSZheng Fan 	ColorPopup maFontColorPopup;
186d4aefcaeSZheng Fan 	ColorPopup maBrushColorPopup;
187b9e67834SAndre Fischer 
18895a18594SAndre Fischer     cssu::Reference<css::frame::XFrame> mxFrame;
189b9e67834SAndre Fischer     ::sfx2::sidebar::EnumContext maContext;
190b9e67834SAndre Fischer     SfxBindings* mpBindings;
191b9e67834SAndre Fischer 
192b9e67834SAndre Fischer     TextPropertyPanel (
193b9e67834SAndre Fischer         Window* pParent,
194b9e67834SAndre Fischer         const cssu::Reference<css::frame::XFrame>& rxFrame,
195b9e67834SAndre Fischer         SfxBindings* pBindings);
196d4aefcaeSZheng Fan 	virtual ~TextPropertyPanel (void);
197d4aefcaeSZheng Fan 
198d4aefcaeSZheng Fan 
199d4aefcaeSZheng Fan 	PopupControl* CreateCharacterSpacingControl (PopupContainer* pParent);
200d4aefcaeSZheng Fan 	PopupControl* CreateFontColorPopupControl (PopupContainer* pParent);
201d4aefcaeSZheng Fan 	PopupControl* CreateBrushColorPopupControl (PopupContainer* pParent);
202d4aefcaeSZheng Fan 	PopupControl* CreateUnderlinePopupControl (PopupContainer* pParent);
203d4aefcaeSZheng Fan 	DECL_LINK(SpacingClickHdl, ToolBox*);
204d4aefcaeSZheng Fan 	DECL_LINK(ToolBoxFontColorDropHdl, ToolBox *); //for new color picker
205d4aefcaeSZheng Fan 	DECL_LINK(ToolBoxHighlightDropHdl, ToolBox *);
206d4aefcaeSZheng Fan 	DECL_LINK(ToolBoxUnderlineClickHdl, ToolBox* );
207b9e67834SAndre Fischer 
208b9e67834SAndre Fischer 	void Initialize (void);
209b9e67834SAndre Fischer     void SetupIcons (void);
210b9e67834SAndre Fischer 	void InitToolBoxFont();
211b9e67834SAndre Fischer 	void InitToolBoxIncDec();
212b9e67834SAndre Fischer 	void InitToolBoxFontColor();
213b9e67834SAndre Fischer 	void InitToolBoxScript();
214b9e67834SAndre Fischer 	void InitToolBoxHighlight();
215b9e67834SAndre Fischer 	void InitToolBoxSpacing();
216b9e67834SAndre Fischer 
217b9e67834SAndre Fischer 	void UpdateFontBold();
218b9e67834SAndre Fischer 	void UpdateFontItalic();
219b9e67834SAndre Fischer 	void UpdateFontUnderline();
220b9e67834SAndre Fischer 	void UpdateFontStrikeOut();
221b9e67834SAndre Fischer 	void UpdateFontShadowed();
222b9e67834SAndre Fischer 	void UpdateFontScript();
223b9e67834SAndre Fischer 
224b9e67834SAndre Fischer 	DECL_LINK(FontSelHdl, FontNameBox *);
225b9e67834SAndre Fischer 	DECL_LINK(FontSizeModifyHdl, FontSizeBox *);
226b9e67834SAndre Fischer 	DECL_LINK(FontSizeSelHdl, FontSizeBox *);
227b9e67834SAndre Fischer 	DECL_LINK(FontSizeLoseFocus, FontSizeBox *);
228b9e67834SAndre Fischer 	DECL_LINK(ToolboxFontSelectHandler, ToolBox *);
229b9e67834SAndre Fischer 	DECL_LINK(ToolboxIncDecSelectHdl, ToolBox *);
230b9e67834SAndre Fischer 	DECL_LINK(ImplPopupModeEndHdl, FloatingWindow* );
231b9e67834SAndre Fischer 	DECL_LINK(ToolBoxSwScriptSelectHdl, ToolBox *);
232b9e67834SAndre Fischer 	DECL_LINK(ToolBoxScriptSelectHdl, ToolBox *);
233d4aefcaeSZheng Fan 
234d4aefcaeSZheng Fan 
235b9e67834SAndre Fischer 
236b9e67834SAndre Fischer 	void TextStyleChanged();
23795a18594SAndre Fischer 
23895a18594SAndre Fischer     Image GetIcon (const ::rtl::OUString& rsURL);
239b9e67834SAndre Fischer };
240b9e67834SAndre Fischer 
241b9e67834SAndre Fischer } } // end of namespace ::svx::sidebar
242b9e67834SAndre Fischer 
243b9e67834SAndre Fischer #endif
244