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 INCLUDED_SVX_SOURCE_SIDEBAR_PARAGRAPH_PARAPROPERTYPANEL_HXX
19 : #define INCLUDED_SVX_SOURCE_SIDEBAR_PARAGRAPH_PARAPROPERTYPANEL_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 cssu = ::com::sun::star::uno;
51 :
52 :
53 : namespace svx { namespace sidebar {
54 :
55 : class PopupControl;
56 : class PopupContainer;
57 :
58 : class ParaPropertyPanel
59 : : public PanelLayout,
60 : public ::sfx2::sidebar::IContextChangeReceiver,
61 : public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
62 : {
63 : public:
64 : static ParaPropertyPanel* Create (
65 : Window* pParent,
66 : const cssu::Reference<css::frame::XFrame>& rxFrame,
67 : SfxBindings* pBindings,
68 : const cssu::Reference<css::ui::XSidebar>& rxSidebar);
69 :
70 : virtual void DataChanged (const DataChangedEvent& rEvent) SAL_OVERRIDE;
71 : SfxBindings* GetBindings();
72 :
73 : virtual void HandleContextChange (
74 : const ::sfx2::sidebar::EnumContext aContext) SAL_OVERRIDE;
75 :
76 : virtual void NotifyItemUpdate(
77 : const sal_uInt16 nSId,
78 : const SfxItemState eState,
79 : const SfxPoolItem* pState,
80 : const bool bIsEnabled) SAL_OVERRIDE;
81 :
82 0 : sal_uInt16 GetBulletTypeIndex(){ return mnBulletTypeIndex; }
83 0 : sal_uInt16 GetNumTypeIndex(){ return mnNumTypeIndex; }
84 : FieldUnit GetCurrentUnit( SfxItemState eState, const SfxPoolItem* pState );
85 :
86 : void EndSpacingPopupMode (void);
87 : void EndBulletsPopupMode (void);
88 : void EndNumberingPopupMode (void);
89 :
90 : private:
91 : /**********************************************************
92 : **
93 : ** UI controls
94 : **
95 : ***********************************************************/
96 : //Alignment
97 : ToolBox* mpTBxVertAlign;
98 : //NumBullet&Backcolor
99 : ToolBox* mpTBxNumBullet;
100 : ToolBox* mpTBxBackColor;
101 : //Paragraph spacing
102 : ToolBox* mpTbxUL_IncDec;
103 : SvxRelativeField* mpTopDist;
104 : SvxRelativeField* mpBottomDist;
105 : ToolBox* mpLineSPTbx;
106 : ToolBox* mpTbxIndent_IncDec;
107 : ToolBox* mpTbxProDemote;
108 : SvxRelativeField* mpLeftIndent;
109 : SvxRelativeField* mpRightIndent;
110 : SvxRelativeField* mpFLineIndent;
111 :
112 : ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpColorUpdater;
113 :
114 : /**********************************************************
115 : **
116 : ** Resources
117 : **
118 : ***********************************************************/
119 :
120 : Image maSpace3;
121 : Image maIndHang;
122 :
123 : ImageList maNumBImageList;
124 : ImageList maNumBImageListRTL;
125 :
126 : /****************************************************************
127 : **
128 : ** Data Member
129 : **
130 : *****************************************************************/
131 : long maTxtLeft;
132 : //Line spacing
133 : SvxLineSpacingItem *mpLnSPItem;
134 : SfxItemState meLnSpState;
135 : bool mbOutLineLeft;
136 : bool mbOutLineRight;
137 : long maUpper;
138 : long maLower;
139 :
140 : sal_uInt16 mnBulletTypeIndex;
141 : sal_uInt16 mnNumTypeIndex;
142 : Color maColor;
143 : bool mbColorAvailable;
144 : FieldUnit m_eMetricUnit;
145 : FieldUnit m_last_eMetricUnit;
146 : SfxMapUnit m_eLRSpaceUnit;
147 : SfxMapUnit m_eULSpaceUnit;
148 : /****************************************************************
149 : **
150 : ** Control Items
151 : **
152 : *****************************************************************/
153 :
154 : ::sfx2::sidebar::ControllerItem maLRSpaceControl;
155 : ::sfx2::sidebar::ControllerItem maLNSpaceControl;
156 : ::sfx2::sidebar::ControllerItem maULSpaceControl;
157 : ::sfx2::sidebar::ControllerItem maOutLineLeftControl;
158 : ::sfx2::sidebar::ControllerItem maOutLineRightControl;
159 : ::sfx2::sidebar::ControllerItem maDecIndentControl;
160 : ::sfx2::sidebar::ControllerItem maIncIndentControl;
161 : ::sfx2::sidebar::ControllerItem maBulletOnOff;
162 : ::sfx2::sidebar::ControllerItem maNumberOnOff;
163 : ::sfx2::sidebar::ControllerItem maBackColorControl;
164 : ::sfx2::sidebar::ControllerItem m_aMetricCtl;
165 : ::sfx2::sidebar::ControllerItem maBulletNumRuleIndex;
166 : ::sfx2::sidebar::ControllerItem maNumNumRuleIndex;
167 :
168 : cssu::Reference<css::frame::XFrame> mxFrame;
169 : ::sfx2::sidebar::EnumContext maContext;
170 : SfxBindings* mpBindings;
171 : ParaLineSpacingPopup maLineSpacePopup;
172 : ParaBulletsPopup maBulletsPopup;
173 : ParaNumberingPopup maNumberingPopup;
174 : ColorPopup maBGColorPopup;
175 : cssu::Reference<css::ui::XSidebar> mxSidebar;
176 :
177 :
178 : ParaPropertyPanel (
179 : Window* pParent,
180 : const cssu::Reference<css::frame::XFrame>& rxFrame,
181 : SfxBindings* pBindings,
182 : const cssu::Reference<css::ui::XSidebar>& rxSidebar);
183 : virtual ~ParaPropertyPanel (void);
184 :
185 : DECL_LINK(NumBTbxSelectHandler, ToolBox*);
186 : DECL_LINK(ModifyIndentHdl_Impl, void*);
187 : DECL_LINK(ClickIndent_IncDec_Hdl_Impl, ToolBox*);
188 : DECL_LINK(ClickProDemote_Hdl_Impl, ToolBox*);
189 : DECL_LINK(ULSpaceHdl_Impl, void*);
190 : DECL_LINK(ClickUL_IncDec_Hdl_Impl, ToolBox*);
191 :
192 : void ParaBKGStateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState);
193 : void StateChangedIndentImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
194 : void StateChangedLnSPImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
195 : void StateChangedULImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
196 : void StateChangeOutLineImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
197 : void StateChangeIncDecImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
198 : // Add toggle state for numbering and bullet icons
199 : void StateChangeBulletNumImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
200 : //Modified for Numbering&Bullets Dialog UX Enh
201 : //Handing the transferred the num rule index data of the current selection
202 : void StateChangeBulletNumRuleImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
203 :
204 : void initial();
205 : void ReSize(bool bSize);
206 :
207 :
208 : PopupControl* CreateLineSpacingControl (PopupContainer* pParent);
209 : PopupControl* CreateBulletsPopupControl (PopupContainer* pParent);
210 : PopupControl* CreateNumberingPopupControl (PopupContainer* pParent);
211 : PopupControl* CreateBGColorPopupControl (PopupContainer* pParent);
212 : DECL_LINK(ClickLineSPDropDownHdl_Impl, ToolBox*);
213 : DECL_LINK(NumBTbxDDHandler, ToolBox*);
214 : DECL_LINK(ToolBoxBackColorDDHandler, ToolBox *);
215 :
216 : void InitToolBoxIndent();
217 : void InitToolBoxBGColor();
218 : void InitToolBoxBulletsNumbering();
219 : void InitToolBoxSpacing();
220 : void InitToolBoxLineSpacing();
221 :
222 : void SetBGColor (const OUString& rsColorName, const Color aColor);
223 : };
224 :
225 : } } // end of namespace ::svx::sidebar
226 :
227 : #endif
228 :
|