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>
29ae13266dSAndre Fischer #include <sfx2/sidebar/EnumContext.hxx>
30*6a606da0SAndre Fischer #include <sfx2/sidebar/GridLayouter.hxx>
31b9e67834SAndre Fischer 
32b9e67834SAndre Fischer #include <svtools/ctrlbox.hxx>
33b9e67834SAndre Fischer #include <svx/tbxcolorupdate.hxx>
34b9e67834SAndre Fischer #include <editeng/svxenum.hxx>
35b9e67834SAndre Fischer #include <editeng/fhgtitem.hxx>
36b9e67834SAndre Fischer 
3737fee4fdSAndre Fischer #include <com/sun/star/ui/XSidebar.hpp>
38ae13266dSAndre Fischer #include <com/sun/star/frame/XToolbarController.hpp>
39b9e67834SAndre Fischer 
40b9e67834SAndre Fischer #include <boost/scoped_ptr.hpp>
41d4aefcaeSZheng Fan #include "TextCharacterSpacingPopup.hxx"
42d4aefcaeSZheng Fan #include "TextUnderlinePopup.hxx"
43facb16e7SArmin Le Grand #include <svx/sidebar/ColorPopup.hxx>
44d4aefcaeSZheng Fan #include <vcl/vclenum.hxx>
45b9e67834SAndre Fischer 
4695a18594SAndre Fischer class FloatingWindow;
4795a18594SAndre Fischer class ToolBox;
4895a18594SAndre Fischer 
49b9e67834SAndre Fischer namespace svx { namespace sidebar {
50b9e67834SAndre Fischer 
51b9e67834SAndre Fischer class SvxSBFontNameBox;
52d4aefcaeSZheng Fan class PopupControl;
53d4aefcaeSZheng Fan class PopupContainer;
54b9e67834SAndre Fischer 
55b9e67834SAndre Fischer class TextPropertyPanel
5695a18594SAndre Fischer     : public Control,
5765be1ea2SAndre Fischer       public ::sfx2::sidebar::IContextChangeReceiver,
58b9e67834SAndre Fischer       public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
59b9e67834SAndre Fischer {
60b9e67834SAndre Fischer public:
6195a18594SAndre Fischer     static TextPropertyPanel* Create (
62b9e67834SAndre Fischer         Window* pParent,
63b9e67834SAndre Fischer         const cssu::Reference<css::frame::XFrame>& rxFrame,
64ae13266dSAndre Fischer         SfxBindings* pBindings,
65ae13266dSAndre Fischer         const ::sfx2::sidebar::EnumContext& rContext);
66b9e67834SAndre Fischer 
67b9e67834SAndre Fischer     virtual void DataChanged (const DataChangedEvent& rEvent);
68bc7f1831SAndre Fischer 
69d4aefcaeSZheng Fan     ::sfx2::sidebar::ControllerItem& GetSpaceController();
70d4aefcaeSZheng Fan     long GetSelFontSize();
71d4aefcaeSZheng Fan     void SetSpacing(long nKern);
72d4aefcaeSZheng Fan     void EndSpacingPopupMode (void);
73d4aefcaeSZheng Fan     void EndUnderlinePopupMode (void);
748ce66e53SOliver-Rainer Wittmann     void SetUnderline(FontUnderline eUnderline);
758ce66e53SOliver-Rainer Wittmann     Color& GetUnderlineColor();
768ce66e53SOliver-Rainer Wittmann     void SetDefaultUnderline(FontUnderline eUnderline);
77da72173fSAndre Fischer 
78b9e67834SAndre Fischer 
79b9e67834SAndre Fischer     virtual void HandleContextChange (
80b9e67834SAndre Fischer         const ::sfx2::sidebar::EnumContext aContext);
81b9e67834SAndre Fischer 
8245da7d5eSAndre Fischer 
83b9e67834SAndre Fischer     virtual void NotifyItemUpdate(
84b9e67834SAndre Fischer         const sal_uInt16 nSId,
85b9e67834SAndre Fischer         const SfxItemState eState,
8645da7d5eSAndre Fischer         const SfxPoolItem* pState,
8745da7d5eSAndre Fischer         const bool bIsEnabled);
88b9e67834SAndre Fischer 
89*6a606da0SAndre Fischer     // Inherited from vcl Window.
90*6a606da0SAndre Fischer     virtual void Resize (void);
91*6a606da0SAndre Fischer 
92b9e67834SAndre Fischer private:
938ce66e53SOliver-Rainer Wittmann     //ui controls
94b9e67834SAndre Fischer     ::boost::scoped_ptr<SvxSBFontNameBox> mpFontNameBox;
958ce66e53SOliver-Rainer Wittmann     FontSizeBox maFontSizeBox;
968ce66e53SOliver-Rainer Wittmann     ::boost::scoped_ptr<Window> mpToolBoxFontBackground;
978ce66e53SOliver-Rainer Wittmann     ::boost::scoped_ptr<ToolBox> mpToolBoxFont;
9852d13b84SAndre Fischer     ::boost::scoped_ptr<Window> mpToolBoxIncDecBackground;
9952d13b84SAndre Fischer     ::boost::scoped_ptr<ToolBox> mpToolBoxIncDec;
1008ce66e53SOliver-Rainer Wittmann     ::boost::scoped_ptr<Window> mpToolBoxScriptBackground;
1018ce66e53SOliver-Rainer Wittmann     ::boost::scoped_ptr<ToolBox> mpToolBoxScript;
1028ce66e53SOliver-Rainer Wittmann     ::boost::scoped_ptr<Window> mpToolBoxScriptSwBackground;
1038ce66e53SOliver-Rainer Wittmann     ::boost::scoped_ptr<ToolBox> mpToolBoxScriptSw;
1048ce66e53SOliver-Rainer Wittmann     ::boost::scoped_ptr<Window> mpToolBoxSpacingBackground;
1058ce66e53SOliver-Rainer Wittmann     ::boost::scoped_ptr<ToolBox> mpToolBoxSpacing;
10652d13b84SAndre Fischer     ::boost::scoped_ptr<Window> mpToolBoxFontColorBackground;
10752d13b84SAndre Fischer     ::boost::scoped_ptr<ToolBox> mpToolBoxFontColor;
10810405e3bSAndre Fischer     ::boost::scoped_ptr<Window> mpToolBoxFontColorBackgroundSW;
10910405e3bSAndre Fischer     ::boost::scoped_ptr<ToolBox> mpToolBoxFontColorSW;
1108ce66e53SOliver-Rainer Wittmann     ::boost::scoped_ptr<Window> mpToolBoxHighlightBackground;
1118ce66e53SOliver-Rainer Wittmann     ::boost::scoped_ptr<ToolBox> mpToolBoxHighlight;
1128ce66e53SOliver-Rainer Wittmann     ::boost::scoped_ptr<ToolboxButtonColorUpdater> mpFontColorUpdater;
113b9e67834SAndre Fischer     ::boost::scoped_ptr<ToolboxButtonColorUpdater> mpHighlightUpdater;
114b9e67834SAndre Fischer 
1158ce66e53SOliver-Rainer Wittmann     //control items
1168ce66e53SOliver-Rainer Wittmann     ::sfx2::sidebar::ControllerItem maFontNameControl;
1178ce66e53SOliver-Rainer Wittmann     ::sfx2::sidebar::ControllerItem maFontSizeControl;
1188ce66e53SOliver-Rainer Wittmann     ::sfx2::sidebar::ControllerItem maWeightControl;
1198ce66e53SOliver-Rainer Wittmann     ::sfx2::sidebar::ControllerItem maItalicControl;
1208ce66e53SOliver-Rainer Wittmann     ::sfx2::sidebar::ControllerItem maUnderlineControl;
1218ce66e53SOliver-Rainer Wittmann     ::sfx2::sidebar::ControllerItem maStrikeControl;
1228ce66e53SOliver-Rainer Wittmann     ::sfx2::sidebar::ControllerItem maShadowControl;
1238ce66e53SOliver-Rainer Wittmann     ::sfx2::sidebar::ControllerItem maScriptControlSw;
1248ce66e53SOliver-Rainer Wittmann     ::sfx2::sidebar::ControllerItem maSuperScriptControl;
1258ce66e53SOliver-Rainer Wittmann     ::sfx2::sidebar::ControllerItem maSubScriptControl;
1268ce66e53SOliver-Rainer Wittmann     ::sfx2::sidebar::ControllerItem maSpacingControl;
1278ce66e53SOliver-Rainer Wittmann     ::sfx2::sidebar::ControllerItem maSDFontGrow;
1288ce66e53SOliver-Rainer Wittmann     ::sfx2::sidebar::ControllerItem maSDFontShrink;
1298ce66e53SOliver-Rainer Wittmann 
1308ce66e53SOliver-Rainer Wittmann     FontWeight					meWeight;
1318ce66e53SOliver-Rainer Wittmann     FontItalic					meItalic;
1328ce66e53SOliver-Rainer Wittmann     FontUnderline				meUnderline;
1338ce66e53SOliver-Rainer Wittmann     Color						meUnderlineColor;
1348ce66e53SOliver-Rainer Wittmann     bool						mbShadow;
1358ce66e53SOliver-Rainer Wittmann     FontStrikeout				meStrike;
1368ce66e53SOliver-Rainer Wittmann     bool mbWeightAvailable;
1378ce66e53SOliver-Rainer Wittmann     bool mbPostureAvailable;
1388ce66e53SOliver-Rainer Wittmann     SvxEscapement				meEscape;  //for sw
1398ce66e53SOliver-Rainer Wittmann     bool						mbSuper;
1408ce66e53SOliver-Rainer Wittmann     bool						mbSub;
1418ce66e53SOliver-Rainer Wittmann     bool						mbKernAvailable;
1428ce66e53SOliver-Rainer Wittmann     bool						mbKernLBAvailable;
1438ce66e53SOliver-Rainer Wittmann     long						mlKerning;
1448ce66e53SOliver-Rainer Wittmann     SvxFontHeightItem*			mpHeightItem;
1458ce66e53SOliver-Rainer Wittmann 
1468ce66e53SOliver-Rainer Wittmann     const FontList* mpFontList;
1478ce66e53SOliver-Rainer Wittmann     bool mbMustDelete;
1488ce66e53SOliver-Rainer Wittmann     bool mbFocusOnFontSizeCtrl;
1498ce66e53SOliver-Rainer Wittmann     TextCharacterSpacingPopup maCharSpacePopup;
1508ce66e53SOliver-Rainer Wittmann     TextUnderlinePopup maUnderlinePopup;
151b9e67834SAndre Fischer 
15295a18594SAndre Fischer     cssu::Reference<css::frame::XFrame> mxFrame;
153b9e67834SAndre Fischer     ::sfx2::sidebar::EnumContext maContext;
154b9e67834SAndre Fischer     SfxBindings* mpBindings;
155*6a606da0SAndre Fischer     ::sfx2::sidebar::GridLayouter maLayouter;
156*6a606da0SAndre Fischer 
157b9e67834SAndre Fischer     TextPropertyPanel (
158b9e67834SAndre Fischer         Window* pParent,
159b9e67834SAndre Fischer         const cssu::Reference<css::frame::XFrame>& rxFrame,
160ae13266dSAndre Fischer         SfxBindings* pBindings,
161ae13266dSAndre Fischer         const ::sfx2::sidebar::EnumContext& rContext);
1628ce66e53SOliver-Rainer Wittmann     virtual ~TextPropertyPanel (void);
1638ce66e53SOliver-Rainer Wittmann 
1648ce66e53SOliver-Rainer Wittmann 
1658ce66e53SOliver-Rainer Wittmann     PopupControl* CreateCharacterSpacingControl (PopupContainer* pParent);
1668ce66e53SOliver-Rainer Wittmann     PopupControl* CreateUnderlinePopupControl (PopupContainer* pParent);
1678ce66e53SOliver-Rainer Wittmann     DECL_LINK(SpacingClickHdl, ToolBox*);
1688ce66e53SOliver-Rainer Wittmann     DECL_LINK(ToolBoxUnderlineClickHdl, ToolBox* );
1698ce66e53SOliver-Rainer Wittmann 
1708ce66e53SOliver-Rainer Wittmann     void Initialize (void);
17145da7d5eSAndre Fischer     void SetupToolboxItems (void);
1728ce66e53SOliver-Rainer Wittmann     void InitToolBoxFont();
1738ce66e53SOliver-Rainer Wittmann     void InitToolBoxIncDec();
1748ce66e53SOliver-Rainer Wittmann     void InitToolBoxScript();
1758ce66e53SOliver-Rainer Wittmann     void InitToolBoxSpacing();
1768ce66e53SOliver-Rainer Wittmann 
1778ce66e53SOliver-Rainer Wittmann     DECL_LINK(FontSelHdl, FontNameBox *);
1788ce66e53SOliver-Rainer Wittmann     DECL_LINK(FontSizeModifyHdl, FontSizeBox *);
1798ce66e53SOliver-Rainer Wittmann     DECL_LINK(FontSizeSelHdl, FontSizeBox *);
1808ce66e53SOliver-Rainer Wittmann     DECL_LINK(FontSizeLoseFocus, FontSizeBox *);
1818ce66e53SOliver-Rainer Wittmann     DECL_LINK(ToolboxFontSelectHandler, ToolBox *);
1828ce66e53SOliver-Rainer Wittmann     DECL_LINK(ToolboxIncDecSelectHdl, ToolBox *);
1838ce66e53SOliver-Rainer Wittmann     DECL_LINK(ToolBoxSwScriptSelectHdl, ToolBox *);
1848ce66e53SOliver-Rainer Wittmann     DECL_LINK(ToolBoxScriptSelectHdl, ToolBox *);
18595a18594SAndre Fischer 
18645da7d5eSAndre Fischer     void UpdateItem (const sal_uInt16 nSlotId);
18710405e3bSAndre Fischer 
18810405e3bSAndre Fischer     /** Depending on the given context make one of the toolboxes
18910405e3bSAndre Fischer         mpToolBoxFontColor and mpToolBoxFontColorSW visible.  Both
19010405e3bSAndre Fischer         occupy the same space.
19110405e3bSAndre Fischer     */
19210405e3bSAndre Fischer     void UpdateFontColorToolbox (
19310405e3bSAndre Fischer         const ::sfx2::sidebar::EnumContext aContext);
194b9e67834SAndre Fischer };
195b9e67834SAndre Fischer 
196b9e67834SAndre Fischer } } // end of namespace ::svx::sidebar
197b9e67834SAndre Fischer 
198b9e67834SAndre Fischer #endif
199