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 
3537fee4fdSAndre Fischer //#include <com/sun/star/ui/XUIElement.hpp>
3637fee4fdSAndre Fischer #include <com/sun/star/ui/XSidebar.hpp>
37b9e67834SAndre Fischer 
38b9e67834SAndre Fischer #include <boost/scoped_ptr.hpp>
39d4aefcaeSZheng Fan #include "TextCharacterSpacingPopup.hxx"
40d4aefcaeSZheng Fan #include "TextUnderlinePopup.hxx"
41facb16e7SArmin Le Grand #include <svx/sidebar/ColorPopup.hxx>
42d4aefcaeSZheng Fan #include <vcl/vclenum.hxx>
43b9e67834SAndre Fischer 
4495a18594SAndre Fischer class FloatingWindow;
4595a18594SAndre Fischer class ToolBox;
4695a18594SAndre Fischer 
47b9e67834SAndre Fischer namespace svx { namespace sidebar {
48b9e67834SAndre Fischer 
49b9e67834SAndre Fischer class SvxSBFontNameBox;
50d4aefcaeSZheng Fan class PopupControl;
51d4aefcaeSZheng Fan class PopupContainer;
52b9e67834SAndre Fischer 
53b9e67834SAndre Fischer class TextPropertyPanel
5495a18594SAndre Fischer     : public Control,
5565be1ea2SAndre Fischer       public ::sfx2::sidebar::IContextChangeReceiver,
56b9e67834SAndre Fischer       public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
57b9e67834SAndre Fischer {
58b9e67834SAndre Fischer public:
5995a18594SAndre Fischer     static TextPropertyPanel* Create (
60b9e67834SAndre Fischer         Window* pParent,
61b9e67834SAndre Fischer         const cssu::Reference<css::frame::XFrame>& rxFrame,
62*f79579d2SAndre Fischer         SfxBindings* pBindings);
63b9e67834SAndre Fischer 
64b9e67834SAndre Fischer     virtual void DataChanged (const DataChangedEvent& rEvent);
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 	void SetFontColor (const String& rsColorName,const Color aColor);
71d4aefcaeSZheng Fan 	void SetBrushColor (const String& rsColorName,const Color aColor);
72d4aefcaeSZheng Fan 	void SetUnderline(FontUnderline	eUnderline);
73d4aefcaeSZheng Fan 	Color& GetUnderlineColor();
74d4aefcaeSZheng Fan 	void SetDefaultUnderline(FontUnderline eUnderline);
75da72173fSAndre Fischer 
76b9e67834SAndre Fischer 
77b9e67834SAndre Fischer     enum ColorType
78b9e67834SAndre Fischer     {
79b9e67834SAndre Fischer         FONT_COLOR = 1,
80b9e67834SAndre Fischer         BACK_COLOR = 2
81b9e67834SAndre Fischer     };
82b9e67834SAndre Fischer 
83b9e67834SAndre Fischer     virtual void HandleContextChange (
84b9e67834SAndre Fischer         const ::sfx2::sidebar::EnumContext aContext);
85b9e67834SAndre Fischer 
8645da7d5eSAndre Fischer 
8745da7d5eSAndre Fischer     // ControllerItem::ItemUpdateReceiverInterface
8845da7d5eSAndre Fischer 
89b9e67834SAndre Fischer     virtual void NotifyItemUpdate(
90b9e67834SAndre Fischer         const sal_uInt16 nSId,
91b9e67834SAndre Fischer         const SfxItemState eState,
9245da7d5eSAndre Fischer         const SfxPoolItem* pState,
9345da7d5eSAndre Fischer         const bool bIsEnabled);
94b9e67834SAndre Fischer 
95b9e67834SAndre Fischer private:
96b9e67834SAndre Fischer 	//ui controls
97b9e67834SAndre Fischer     ::boost::scoped_ptr<SvxSBFontNameBox> mpFontNameBox;
98b9e67834SAndre Fischer 	FontSizeBox maFontSizeBox;
997a32b0c8SAndre Fischer 	::boost::scoped_ptr<Window> mpToolBoxIncDecBackground;
1007a32b0c8SAndre Fischer 	::boost::scoped_ptr<ToolBox> mpToolBoxIncDec;
1017a32b0c8SAndre Fischer 	::boost::scoped_ptr<Window> mpToolBoxFontBackground;
102b9e67834SAndre Fischer 	::boost::scoped_ptr<ToolBox> mpToolBoxFont;
1037a32b0c8SAndre Fischer 	::boost::scoped_ptr<Window> mpToolBoxFontColorBackground;
104b9e67834SAndre Fischer 	::boost::scoped_ptr<ToolBox> mpToolBoxFontColor;
1057a32b0c8SAndre Fischer 	::boost::scoped_ptr<Window> mpToolBoxScriptBackground;
106b9e67834SAndre Fischer 	::boost::scoped_ptr<ToolBox> mpToolBoxScript;
1077a32b0c8SAndre Fischer 	::boost::scoped_ptr<Window> mpToolBoxScriptSwBackground;
108b9e67834SAndre Fischer 	::boost::scoped_ptr<ToolBox> mpToolBoxScriptSw;
1097a32b0c8SAndre Fischer 	::boost::scoped_ptr<Window> mpToolBoxSpacingBackground;
110b9e67834SAndre Fischer 	::boost::scoped_ptr<ToolBox> mpToolBoxSpacing;
1117a32b0c8SAndre Fischer 	::boost::scoped_ptr<Window> mpToolBoxHighlightBackground;
112b9e67834SAndre Fischer 	::boost::scoped_ptr<ToolBox> mpToolBoxHighlight;
113b9e67834SAndre Fischer 	::boost::scoped_ptr<ToolboxButtonColorUpdater> mpFontColorUpdater;
114b9e67834SAndre Fischer     ::boost::scoped_ptr<ToolboxButtonColorUpdater> mpHighlightUpdater;
115b9e67834SAndre Fischer 
116b9e67834SAndre Fischer 	//control items
117b9e67834SAndre Fischer 	::sfx2::sidebar::ControllerItem maFontNameControl;
118b9e67834SAndre Fischer 	::sfx2::sidebar::ControllerItem maFontSizeControl;
119b9e67834SAndre Fischer 	::sfx2::sidebar::ControllerItem maWeightControl;
120b9e67834SAndre Fischer 	::sfx2::sidebar::ControllerItem maItalicControl;
121b9e67834SAndre Fischer 	::sfx2::sidebar::ControllerItem maUnderlineControl;
122b9e67834SAndre Fischer 	::sfx2::sidebar::ControllerItem maStrikeControl;
123b9e67834SAndre Fischer 	::sfx2::sidebar::ControllerItem maShadowControl;
124b9e67834SAndre Fischer 	::sfx2::sidebar::ControllerItem maFontColorControl;
125b9e67834SAndre Fischer 	::sfx2::sidebar::ControllerItem maScriptControlSw;
126b9e67834SAndre Fischer 	::sfx2::sidebar::ControllerItem maSuperScriptControl;
127b9e67834SAndre Fischer 	::sfx2::sidebar::ControllerItem maSubScriptControl;
128b9e67834SAndre Fischer 	::sfx2::sidebar::ControllerItem maSpacingControl;
129b9e67834SAndre Fischer 	::sfx2::sidebar::ControllerItem maHighlightControl;
130b9e67834SAndre Fischer 	::sfx2::sidebar::ControllerItem maSDFontGrow;
131b9e67834SAndre Fischer 	::sfx2::sidebar::ControllerItem maSDFontShrink;
132b9e67834SAndre Fischer 
133b9e67834SAndre Fischer 	FontWeight					meWeight;
134b9e67834SAndre Fischer 	FontItalic					meItalic;
135b9e67834SAndre Fischer 	FontUnderline				meUnderline;
136b9e67834SAndre Fischer 	Color						meUnderlineColor;  //
137b9e67834SAndre Fischer 	bool						mbShadow;
138b9e67834SAndre Fischer 	FontStrikeout				meStrike;
139b9e67834SAndre Fischer 	bool mbWeightAvailable;
140b9e67834SAndre Fischer 	bool mbPostureAvailable;
141b9e67834SAndre Fischer 	Color						maColor;
142b9e67834SAndre Fischer 	bool mbColorAvailable;
143b9e67834SAndre Fischer 	Color						maBackColor;
144b9e67834SAndre Fischer 	bool mbBackColorAvailable;
145b9e67834SAndre Fischer 	ColorType meColorType;
146b9e67834SAndre Fischer 	SvxEscapement				meEscape;  //for sw
147b9e67834SAndre Fischer 	bool						mbSuper;
148b9e67834SAndre Fischer 	bool						mbSub;
149b9e67834SAndre Fischer 	bool						mbKernAvailable;
150b9e67834SAndre Fischer 	bool						mbKernLBAvailable;
151b9e67834SAndre Fischer 	long						mlKerning;
152b9e67834SAndre Fischer 	SvxFontHeightItem*			mpHeightItem;
153b9e67834SAndre Fischer 
154b9e67834SAndre Fischer 	const FontList* mpFontList;
155b9e67834SAndre Fischer 	bool mbMustDelete;
156b9e67834SAndre Fischer 	bool mbFocusOnFontSizeCtrl;
157d4aefcaeSZheng Fan 	TextCharacterSpacingPopup maCharSpacePopup;
158d4aefcaeSZheng Fan 	TextUnderlinePopup maUnderlinePopup;
159d4aefcaeSZheng Fan 	ColorPopup maFontColorPopup;
160d4aefcaeSZheng Fan 	ColorPopup maBrushColorPopup;
161b9e67834SAndre Fischer 
16295a18594SAndre Fischer     cssu::Reference<css::frame::XFrame> mxFrame;
163b9e67834SAndre Fischer     ::sfx2::sidebar::EnumContext maContext;
164b9e67834SAndre Fischer     SfxBindings* mpBindings;
16537fee4fdSAndre Fischer 
166b9e67834SAndre Fischer     TextPropertyPanel (
167b9e67834SAndre Fischer         Window* pParent,
168b9e67834SAndre Fischer         const cssu::Reference<css::frame::XFrame>& rxFrame,
169*f79579d2SAndre Fischer         SfxBindings* pBindings);
170d4aefcaeSZheng Fan 	virtual ~TextPropertyPanel (void);
171d4aefcaeSZheng Fan 
172d4aefcaeSZheng Fan 
173d4aefcaeSZheng Fan 	PopupControl* CreateCharacterSpacingControl (PopupContainer* pParent);
174d4aefcaeSZheng Fan 	PopupControl* CreateFontColorPopupControl (PopupContainer* pParent);
175d4aefcaeSZheng Fan 	PopupControl* CreateBrushColorPopupControl (PopupContainer* pParent);
176d4aefcaeSZheng Fan 	PopupControl* CreateUnderlinePopupControl (PopupContainer* pParent);
177d4aefcaeSZheng Fan 	DECL_LINK(SpacingClickHdl, ToolBox*);
178d4aefcaeSZheng Fan 	DECL_LINK(ToolBoxFontColorDropHdl, ToolBox *); //for new color picker
179d4aefcaeSZheng Fan 	DECL_LINK(ToolBoxHighlightDropHdl, ToolBox *);
180d4aefcaeSZheng Fan 	DECL_LINK(ToolBoxUnderlineClickHdl, ToolBox* );
181b9e67834SAndre Fischer 
182b9e67834SAndre Fischer 	void Initialize (void);
18345da7d5eSAndre Fischer     void SetupToolboxItems (void);
184b9e67834SAndre Fischer 	void InitToolBoxFont();
185b9e67834SAndre Fischer 	void InitToolBoxIncDec();
186b9e67834SAndre Fischer 	void InitToolBoxFontColor();
187b9e67834SAndre Fischer 	void InitToolBoxScript();
188b9e67834SAndre Fischer 	void InitToolBoxHighlight();
189b9e67834SAndre Fischer 	void InitToolBoxSpacing();
190b9e67834SAndre Fischer 
191b9e67834SAndre Fischer 	DECL_LINK(FontSelHdl, FontNameBox *);
192b9e67834SAndre Fischer 	DECL_LINK(FontSizeModifyHdl, FontSizeBox *);
193b9e67834SAndre Fischer 	DECL_LINK(FontSizeSelHdl, FontSizeBox *);
194b9e67834SAndre Fischer 	DECL_LINK(FontSizeLoseFocus, FontSizeBox *);
195b9e67834SAndre Fischer 	DECL_LINK(ToolboxFontSelectHandler, ToolBox *);
196b9e67834SAndre Fischer 	DECL_LINK(ToolboxIncDecSelectHdl, ToolBox *);
197b9e67834SAndre Fischer 	DECL_LINK(ImplPopupModeEndHdl, FloatingWindow* );
198b9e67834SAndre Fischer 	DECL_LINK(ToolBoxSwScriptSelectHdl, ToolBox *);
199b9e67834SAndre Fischer 	DECL_LINK(ToolBoxScriptSelectHdl, ToolBox *);
20095a18594SAndre Fischer 
20145da7d5eSAndre Fischer     void UpdateItem (const sal_uInt16 nSlotId);
202b9e67834SAndre Fischer };
203b9e67834SAndre Fischer 
204b9e67834SAndre Fischer } } // end of namespace ::svx::sidebar
205b9e67834SAndre Fischer 
206b9e67834SAndre Fischer #endif
207