Line data Source code
1 : /*
2 : * This file is part of the LibreOffice project.
3 : *
4 : * This Source Code Form is subject to the terms of the Mozilla Public
5 : * License, v. 2.0. If a copy of the MPL was not distributed with this
6 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 : *
8 : * This file incorporates work covered by the following license notice:
9 : *
10 : * Licensed to the Apache Software Foundation (ASF) under one or more
11 : * contributor license agreements. See the NOTICE file distributed
12 : * with this work for additional information regarding copyright
13 : * ownership. The ASF licenses this file to you under the Apache
14 : * License, Version 2.0 (the "License"); you may not use this file
15 : * except in compliance with the License. You may obtain a copy of
16 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
17 : */
18 : #ifndef SVX_SIDEBAR_PARA_PROPERTY_PANEL_HXX
19 : #define SVX_SIDEBAR_PARA_PROPERTY_PANEL_HXX
20 :
21 : #include <vcl/ctrl.hxx>
22 : #include <sfx2/sidebar/ControllerItem.hxx>
23 : #include <sfx2/sidebar/IContextChangeReceiver.hxx>
24 : #include <editeng/lspcitem.hxx>
25 : #include <svtools/ctrlbox.hxx>
26 : #include <svx/sidebar/PanelLayout.hxx>
27 : #include <svx/tbxcolorupdate.hxx>
28 : #include <svx/relfld.hxx>
29 : #include <editeng/svxenum.hxx>
30 : #include <editeng/fhgtitem.hxx>
31 :
32 : #include <com/sun/star/frame/XFrame.hpp>
33 : #include <com/sun/star/ui/XSidebar.hpp>
34 :
35 : #include <boost/scoped_ptr.hpp>
36 :
37 : #include <svx/sidebar/ColorPopup.hxx>
38 : #include <vcl/vclenum.hxx>
39 : #include <vcl/fixed.hxx>
40 : #include <svl/poolitem.hxx>
41 : #include <tools/fldunit.hxx>
42 :
43 : #include "ParaBulletsPopup.hxx"
44 : #include "ParaNumberingPopup.hxx"
45 : #include "ParaLineSpacingPopup.hxx"
46 :
47 : class FloatingWindow;
48 : class ToolBox;
49 :
50 : namespace css = ::com::sun::star;
51 : namespace cssu = ::com::sun::star::uno;
52 :
53 :
54 : namespace svx { namespace sidebar {
55 :
56 : class PopupControl;
57 : class PopupContainer;
58 :
59 : class ParaPropertyPanel
60 : : public PanelLayout,
61 : public ::sfx2::sidebar::IContextChangeReceiver,
62 : public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
63 : {
64 : public:
65 : static ParaPropertyPanel* Create (
66 : Window* pParent,
67 : const cssu::Reference<css::frame::XFrame>& rxFrame,
68 : SfxBindings* pBindings,
69 : const cssu::Reference<css::ui::XSidebar>& rxSidebar);
70 :
71 : virtual void DataChanged (const DataChangedEvent& rEvent);
72 : SfxBindings* GetBindings();
73 :
74 : virtual void HandleContextChange (
75 : const ::sfx2::sidebar::EnumContext aContext);
76 :
77 : virtual void NotifyItemUpdate(
78 : const sal_uInt16 nSId,
79 : const SfxItemState eState,
80 : const SfxPoolItem* pState,
81 : const bool bIsEnabled);
82 :
83 : void ShowMenu (void);
84 0 : sal_uInt16 GetBulletTypeIndex(){ return mnBulletTypeIndex; }
85 0 : sal_uInt16 GetNumTypeIndex(){ return mnNumTypeIndex; }
86 : FieldUnit GetCurrentUnit( SfxItemState eState, const SfxPoolItem* pState );
87 :
88 : void EndSpacingPopupMode (void);
89 : void EndBulletsPopupMode (void);
90 : void EndNumberingPopupMode (void);
91 :
92 : private:
93 : /**********************************************************
94 : **
95 : ** UI controls
96 : **
97 : ***********************************************************/
98 : //Alignment
99 : ToolBox* mpAlignToolBox;
100 : ToolBox* mpTBxVertAlign;
101 : //NumBullet&Backcolor
102 : ToolBox* mpTBxNumBullet;
103 : ToolBox* mpTBxBackColor;
104 : //Paragraph spacing
105 : ToolBox* mpTbxUL_IncDec;
106 : SvxRelativeField* mpTopDist;
107 : SvxRelativeField* mpBottomDist;
108 : ToolBox* mpLineSPTbx;
109 : ToolBox* mpTbxIndent_IncDec;
110 : ToolBox* mpTbxProDemote;
111 : SvxRelativeField* mpLeftIndent;
112 : SvxRelativeField* mpRightIndent;
113 : SvxRelativeField* mpFLineIndent;
114 :
115 : ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpColorUpdater;
116 :
117 : /**********************************************************
118 : **
119 : ** Resources
120 : **
121 : ***********************************************************/
122 :
123 : Image maSpace3;
124 : Image maIndHang;
125 :
126 : ImageList maNumBImageList;
127 : ImageList maNumBImageListRTL;
128 : Image maImgBackColorHigh;
129 : Image maImgBackColor;
130 :
131 : /****************************************************************
132 : **
133 : ** Data Member
134 : **
135 : *****************************************************************/
136 : long maTxtLeft;
137 : //Line spacing
138 : SvxLineSpacingItem *mpLnSPItem;
139 : SfxItemState meLnSpState;
140 : bool mbOutLineLeft;
141 : bool mbOutLineRight;
142 : long maUpper;
143 : long maLower;
144 :
145 : sal_uInt16 mnBulletTypeIndex;
146 : sal_uInt16 mnNumTypeIndex;
147 : Color maColor;
148 : bool mbColorAvailable;
149 : FieldUnit m_eMetricUnit;
150 : FieldUnit m_last_eMetricUnit;
151 : SfxMapUnit m_eLRSpaceUnit;
152 : SfxMapUnit m_eULSpaceUnit;
153 : /****************************************************************
154 : **
155 : ** Control Items
156 : **
157 : *****************************************************************/
158 :
159 : ::sfx2::sidebar::ControllerItem maLeftAlignControl;
160 : ::sfx2::sidebar::ControllerItem maCenterAlignControl;
161 : ::sfx2::sidebar::ControllerItem maRightAlignControl;
162 : ::sfx2::sidebar::ControllerItem maJustifyAlignControl;
163 : ::sfx2::sidebar::ControllerItem maLRSpaceControl;
164 : ::sfx2::sidebar::ControllerItem maLNSpaceControl;
165 : ::sfx2::sidebar::ControllerItem maULSpaceControl;
166 : ::sfx2::sidebar::ControllerItem maOutLineLeftControl;
167 : ::sfx2::sidebar::ControllerItem maOutLineRightControl;
168 : ::sfx2::sidebar::ControllerItem maDecIndentControl;
169 : ::sfx2::sidebar::ControllerItem maIncIndentControl;
170 : ::sfx2::sidebar::ControllerItem maVertTop;
171 : ::sfx2::sidebar::ControllerItem maVertCenter;
172 : ::sfx2::sidebar::ControllerItem maVertBottom;
173 : ::sfx2::sidebar::ControllerItem maBulletOnOff;
174 : ::sfx2::sidebar::ControllerItem maNumberOnOff;
175 : ::sfx2::sidebar::ControllerItem maBackColorControl;
176 : ::sfx2::sidebar::ControllerItem m_aMetricCtl;
177 : ::sfx2::sidebar::ControllerItem maBulletNumRuleIndex;
178 : ::sfx2::sidebar::ControllerItem maNumNumRuleIndex;
179 :
180 : cssu::Reference<css::frame::XFrame> mxFrame;
181 : ::sfx2::sidebar::EnumContext maContext;
182 : SfxBindings* mpBindings;
183 : ParaLineSpacingPopup maLineSpacePopup;
184 : ParaBulletsPopup maBulletsPopup;
185 : ParaNumberingPopup maNumberingPopup;
186 : ColorPopup maBGColorPopup;
187 : cssu::Reference<css::ui::XSidebar> mxSidebar;
188 :
189 :
190 : ParaPropertyPanel (
191 : Window* pParent,
192 : const cssu::Reference<css::frame::XFrame>& rxFrame,
193 : SfxBindings* pBindings,
194 : const cssu::Reference<css::ui::XSidebar>& rxSidebar);
195 : virtual ~ParaPropertyPanel (void);
196 :
197 : void InitImageList(::boost::scoped_ptr<ToolBox>& rTbx, ImageList& rImglst, ImageList& rImgHlst);
198 :
199 : DECL_LINK(AlignStyleModifyHdl_Impl, ToolBox*);
200 : DECL_LINK(VertTbxSelectHandler, ToolBox*);
201 : DECL_LINK(NumBTbxSelectHandler, ToolBox*);
202 : DECL_LINK(ModifyIndentHdl_Impl, void*);
203 : DECL_LINK(ClickIndent_IncDec_Hdl_Impl, ToolBox*);
204 : DECL_LINK(ClickProDemote_Hdl_Impl, ToolBox*);
205 : DECL_LINK(ULSpaceHdl_Impl, void*);
206 : DECL_LINK(ClickUL_IncDec_Hdl_Impl, ToolBox*);
207 : DECL_LINK(ImplPopupModeEndHdl, FloatingWindow* );
208 :
209 : void VertStateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState);
210 : void ParaBKGStateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState);
211 : void StateChangedAlignmentImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
212 : void StateChangedIndentImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
213 : void StateChangedLnSPImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
214 : void StateChangedULImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
215 : void StateChangeOutLineImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
216 : void StateChangeIncDecImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
217 : // Add toggle state for numbering and bullet icons
218 : void StateChangeBulletNumImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
219 : //Modified for Numbering&Bullets Dialog UX Enh
220 : //Handing the transferred the num rule index data of the current selection
221 : void StateChangeBulletNumRuleImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
222 :
223 : void initial();
224 : void ReSize(bool bSize);
225 :
226 :
227 : PopupControl* CreateLineSpacingControl (PopupContainer* pParent);
228 : PopupControl* CreateBulletsPopupControl (PopupContainer* pParent);
229 : PopupControl* CreateNumberingPopupControl (PopupContainer* pParent);
230 : PopupControl* CreateBGColorPopupControl (PopupContainer* pParent);
231 : DECL_LINK(ClickLineSPDropDownHdl_Impl, ToolBox*);
232 : DECL_LINK(NumBTbxDDHandler, ToolBox*);
233 : DECL_LINK(ToolBoxBackColorDDHandler, ToolBox *);
234 :
235 : void InitToolBoxAlign();
236 : void InitToolBoxVertAlign();
237 : void InitToolBoxIndent();
238 : void InitToolBoxBGColor();
239 : void InitToolBoxBulletsNumbering();
240 : void InitToolBoxSpacing();
241 : void InitToolBoxLineSpacing();
242 :
243 : void SetBGColor (const String& rsColorName, const Color aColor);
244 : };
245 :
246 : } } // end of namespace ::svx::sidebar
247 :
248 : #endif
249 :
|