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/XSidebar.hpp>
36b9e67834SAndre Fischer 
37b9e67834SAndre Fischer #include <boost/scoped_ptr.hpp>
38d4aefcaeSZheng Fan #include "TextCharacterSpacingPopup.hxx"
39d4aefcaeSZheng Fan #include "TextUnderlinePopup.hxx"
40facb16e7SArmin 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,
5465be1ea2SAndre Fischer       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,
61f79579d2SAndre Fischer         SfxBindings* pBindings);
62b9e67834SAndre Fischer 
63b9e67834SAndre Fischer     virtual void DataChanged (const DataChangedEvent& rEvent);
64d4aefcaeSZheng Fan     ::sfx2::sidebar::ControllerItem& GetSpaceController();
65d4aefcaeSZheng Fan     long GetSelFontSize();
66d4aefcaeSZheng Fan     void SetSpacing(long nKern);
67d4aefcaeSZheng Fan     void EndSpacingPopupMode (void);
68d4aefcaeSZheng Fan     void EndUnderlinePopupMode (void);
69*8ce66e53SOliver-Rainer Wittmann     void SetFontColor (const String& rsColorName,const Color aColor);
70*8ce66e53SOliver-Rainer Wittmann     void SetBrushColor (const String& rsColorName,const Color aColor);
71*8ce66e53SOliver-Rainer Wittmann     void SetUnderline(FontUnderline eUnderline);
72*8ce66e53SOliver-Rainer Wittmann     Color& GetUnderlineColor();
73*8ce66e53SOliver-Rainer Wittmann     void SetDefaultUnderline(FontUnderline eUnderline);
74da72173fSAndre Fischer 
75b9e67834SAndre Fischer 
76b9e67834SAndre Fischer     virtual void HandleContextChange (
77b9e67834SAndre Fischer         const ::sfx2::sidebar::EnumContext aContext);
78b9e67834SAndre Fischer 
7945da7d5eSAndre Fischer 
80b9e67834SAndre Fischer     virtual void NotifyItemUpdate(
81b9e67834SAndre Fischer         const sal_uInt16 nSId,
82b9e67834SAndre Fischer         const SfxItemState eState,
8345da7d5eSAndre Fischer         const SfxPoolItem* pState,
8445da7d5eSAndre Fischer         const bool bIsEnabled);
85b9e67834SAndre Fischer 
86b9e67834SAndre Fischer private:
87*8ce66e53SOliver-Rainer Wittmann     //ui controls
88b9e67834SAndre Fischer     ::boost::scoped_ptr<SvxSBFontNameBox> mpFontNameBox;
89*8ce66e53SOliver-Rainer Wittmann     FontSizeBox maFontSizeBox;
90*8ce66e53SOliver-Rainer Wittmann     ::boost::scoped_ptr<Window> mpToolBoxIncDecBackground;
91*8ce66e53SOliver-Rainer Wittmann     ::boost::scoped_ptr<ToolBox> mpToolBoxIncDec;
92*8ce66e53SOliver-Rainer Wittmann     ::boost::scoped_ptr<Window> mpToolBoxFontBackground;
93*8ce66e53SOliver-Rainer Wittmann     ::boost::scoped_ptr<ToolBox> mpToolBoxFont;
94*8ce66e53SOliver-Rainer Wittmann     ::boost::scoped_ptr<Window> mpToolBoxFontColorBackground;
95*8ce66e53SOliver-Rainer Wittmann     ::boost::scoped_ptr<ToolBox> mpToolBoxFontColor;
96*8ce66e53SOliver-Rainer Wittmann     ::boost::scoped_ptr<Window> mpToolBoxScriptBackground;
97*8ce66e53SOliver-Rainer Wittmann     ::boost::scoped_ptr<ToolBox> mpToolBoxScript;
98*8ce66e53SOliver-Rainer Wittmann     ::boost::scoped_ptr<Window> mpToolBoxScriptSwBackground;
99*8ce66e53SOliver-Rainer Wittmann     ::boost::scoped_ptr<ToolBox> mpToolBoxScriptSw;
100*8ce66e53SOliver-Rainer Wittmann     ::boost::scoped_ptr<Window> mpToolBoxSpacingBackground;
101*8ce66e53SOliver-Rainer Wittmann     ::boost::scoped_ptr<ToolBox> mpToolBoxSpacing;
102*8ce66e53SOliver-Rainer Wittmann     ::boost::scoped_ptr<Window> mpToolBoxHighlightBackground;
103*8ce66e53SOliver-Rainer Wittmann     ::boost::scoped_ptr<ToolBox> mpToolBoxHighlight;
104*8ce66e53SOliver-Rainer Wittmann     ::boost::scoped_ptr<ToolboxButtonColorUpdater> mpFontColorUpdater;
105b9e67834SAndre Fischer     ::boost::scoped_ptr<ToolboxButtonColorUpdater> mpHighlightUpdater;
106b9e67834SAndre Fischer 
107*8ce66e53SOliver-Rainer Wittmann     //control items
108*8ce66e53SOliver-Rainer Wittmann     ::sfx2::sidebar::ControllerItem maFontNameControl;
109*8ce66e53SOliver-Rainer Wittmann     ::sfx2::sidebar::ControllerItem maFontSizeControl;
110*8ce66e53SOliver-Rainer Wittmann     ::sfx2::sidebar::ControllerItem maWeightControl;
111*8ce66e53SOliver-Rainer Wittmann     ::sfx2::sidebar::ControllerItem maItalicControl;
112*8ce66e53SOliver-Rainer Wittmann     ::sfx2::sidebar::ControllerItem maUnderlineControl;
113*8ce66e53SOliver-Rainer Wittmann     ::sfx2::sidebar::ControllerItem maStrikeControl;
114*8ce66e53SOliver-Rainer Wittmann     ::sfx2::sidebar::ControllerItem maShadowControl;
115*8ce66e53SOliver-Rainer Wittmann     ::sfx2::sidebar::ControllerItem maFontColorControl;
116*8ce66e53SOliver-Rainer Wittmann     ::sfx2::sidebar::ControllerItem maScriptControlSw;
117*8ce66e53SOliver-Rainer Wittmann     ::sfx2::sidebar::ControllerItem maSuperScriptControl;
118*8ce66e53SOliver-Rainer Wittmann     ::sfx2::sidebar::ControllerItem maSubScriptControl;
119*8ce66e53SOliver-Rainer Wittmann     ::sfx2::sidebar::ControllerItem maSpacingControl;
120*8ce66e53SOliver-Rainer Wittmann     ::sfx2::sidebar::ControllerItem maHighlightControl;
121*8ce66e53SOliver-Rainer Wittmann     ::sfx2::sidebar::ControllerItem maSDFontGrow;
122*8ce66e53SOliver-Rainer Wittmann     ::sfx2::sidebar::ControllerItem maSDFontShrink;
123*8ce66e53SOliver-Rainer Wittmann 
124*8ce66e53SOliver-Rainer Wittmann     FontWeight					meWeight;
125*8ce66e53SOliver-Rainer Wittmann     FontItalic					meItalic;
126*8ce66e53SOliver-Rainer Wittmann     FontUnderline				meUnderline;
127*8ce66e53SOliver-Rainer Wittmann     Color						meUnderlineColor;
128*8ce66e53SOliver-Rainer Wittmann     bool						mbShadow;
129*8ce66e53SOliver-Rainer Wittmann     FontStrikeout				meStrike;
130*8ce66e53SOliver-Rainer Wittmann     bool mbWeightAvailable;
131*8ce66e53SOliver-Rainer Wittmann     bool mbPostureAvailable;
132*8ce66e53SOliver-Rainer Wittmann     Color						maColor;
133*8ce66e53SOliver-Rainer Wittmann     bool mbColorAvailable;
134*8ce66e53SOliver-Rainer Wittmann     Color						maBackColor;
135*8ce66e53SOliver-Rainer Wittmann     bool mbBackColorAvailable;
136*8ce66e53SOliver-Rainer Wittmann     SvxEscapement				meEscape;  //for sw
137*8ce66e53SOliver-Rainer Wittmann     bool						mbSuper;
138*8ce66e53SOliver-Rainer Wittmann     bool						mbSub;
139*8ce66e53SOliver-Rainer Wittmann     bool						mbKernAvailable;
140*8ce66e53SOliver-Rainer Wittmann     bool						mbKernLBAvailable;
141*8ce66e53SOliver-Rainer Wittmann     long						mlKerning;
142*8ce66e53SOliver-Rainer Wittmann     SvxFontHeightItem*			mpHeightItem;
143*8ce66e53SOliver-Rainer Wittmann 
144*8ce66e53SOliver-Rainer Wittmann     const FontList* mpFontList;
145*8ce66e53SOliver-Rainer Wittmann     bool mbMustDelete;
146*8ce66e53SOliver-Rainer Wittmann     bool mbFocusOnFontSizeCtrl;
147*8ce66e53SOliver-Rainer Wittmann     TextCharacterSpacingPopup maCharSpacePopup;
148*8ce66e53SOliver-Rainer Wittmann     TextUnderlinePopup maUnderlinePopup;
149*8ce66e53SOliver-Rainer Wittmann     ColorPopup maFontColorPopup;
150*8ce66e53SOliver-Rainer Wittmann     ColorPopup maBrushColorPopup;
151b9e67834SAndre Fischer 
15295a18594SAndre Fischer     cssu::Reference<css::frame::XFrame> mxFrame;
153b9e67834SAndre Fischer     ::sfx2::sidebar::EnumContext maContext;
154b9e67834SAndre Fischer     SfxBindings* mpBindings;
15537fee4fdSAndre Fischer 
156b9e67834SAndre Fischer     TextPropertyPanel (
157b9e67834SAndre Fischer         Window* pParent,
158b9e67834SAndre Fischer         const cssu::Reference<css::frame::XFrame>& rxFrame,
159f79579d2SAndre Fischer         SfxBindings* pBindings);
160*8ce66e53SOliver-Rainer Wittmann     virtual ~TextPropertyPanel (void);
161*8ce66e53SOliver-Rainer Wittmann 
162*8ce66e53SOliver-Rainer Wittmann 
163*8ce66e53SOliver-Rainer Wittmann     PopupControl* CreateCharacterSpacingControl (PopupContainer* pParent);
164*8ce66e53SOliver-Rainer Wittmann     PopupControl* CreateFontColorPopupControl (PopupContainer* pParent);
165*8ce66e53SOliver-Rainer Wittmann     PopupControl* CreateBrushColorPopupControl (PopupContainer* pParent);
166*8ce66e53SOliver-Rainer Wittmann     PopupControl* CreateUnderlinePopupControl (PopupContainer* pParent);
167*8ce66e53SOliver-Rainer Wittmann     DECL_LINK(SpacingClickHdl, ToolBox*);
168*8ce66e53SOliver-Rainer Wittmann     DECL_LINK(ToolBoxFontColorDropHdl, ToolBox *); //for new color picker
169*8ce66e53SOliver-Rainer Wittmann     DECL_LINK(ToolBoxHighlightDropHdl, ToolBox *);
170*8ce66e53SOliver-Rainer Wittmann     DECL_LINK(ToolBoxUnderlineClickHdl, ToolBox* );
171*8ce66e53SOliver-Rainer Wittmann 
172*8ce66e53SOliver-Rainer Wittmann     void Initialize (void);
17345da7d5eSAndre Fischer     void SetupToolboxItems (void);
174*8ce66e53SOliver-Rainer Wittmann     void InitToolBoxFont();
175*8ce66e53SOliver-Rainer Wittmann     void InitToolBoxIncDec();
176*8ce66e53SOliver-Rainer Wittmann     void InitToolBoxFontColor();
177*8ce66e53SOliver-Rainer Wittmann     void InitToolBoxScript();
178*8ce66e53SOliver-Rainer Wittmann     void InitToolBoxHighlight();
179*8ce66e53SOliver-Rainer Wittmann     void InitToolBoxSpacing();
180*8ce66e53SOliver-Rainer Wittmann 
181*8ce66e53SOliver-Rainer Wittmann     DECL_LINK(FontSelHdl, FontNameBox *);
182*8ce66e53SOliver-Rainer Wittmann     DECL_LINK(FontSizeModifyHdl, FontSizeBox *);
183*8ce66e53SOliver-Rainer Wittmann     DECL_LINK(FontSizeSelHdl, FontSizeBox *);
184*8ce66e53SOliver-Rainer Wittmann     DECL_LINK(FontSizeLoseFocus, FontSizeBox *);
185*8ce66e53SOliver-Rainer Wittmann     DECL_LINK(ToolboxFontSelectHandler, ToolBox *);
186*8ce66e53SOliver-Rainer Wittmann     DECL_LINK(ToolboxIncDecSelectHdl, ToolBox *);
187*8ce66e53SOliver-Rainer Wittmann     DECL_LINK(ToolBoxSwScriptSelectHdl, ToolBox *);
188*8ce66e53SOliver-Rainer Wittmann     DECL_LINK(ToolBoxScriptSelectHdl, ToolBox *);
18995a18594SAndre Fischer 
19045da7d5eSAndre Fischer     void UpdateItem (const sal_uInt16 nSlotId);
191b9e67834SAndre Fischer };
192b9e67834SAndre Fischer 
193b9e67834SAndre Fischer } } // end of namespace ::svx::sidebar
194b9e67834SAndre Fischer 
195b9e67834SAndre Fischer #endif
196