1*766ce4d0SZheng Fan /**************************************************************
2*766ce4d0SZheng Fan  *
3*766ce4d0SZheng Fan  * Licensed to the Apache Software Foundation (ASF) under one
4*766ce4d0SZheng Fan  * or more contributor license agreements.  See the NOTICE file
5*766ce4d0SZheng Fan  * distributed with this work for additional information
6*766ce4d0SZheng Fan  * regarding copyright ownership.  The ASF licenses this file
7*766ce4d0SZheng Fan  * to you under the Apache License, Version 2.0 (the
8*766ce4d0SZheng Fan  * "License"); you may not use this file except in compliance
9*766ce4d0SZheng Fan  * with the License.  You may obtain a copy of the License at
10*766ce4d0SZheng Fan  *
11*766ce4d0SZheng Fan  *   http://www.apache.org/licenses/LICENSE-2.0
12*766ce4d0SZheng Fan  *
13*766ce4d0SZheng Fan  * Unless required by applicable law or agreed to in writing,
14*766ce4d0SZheng Fan  * software distributed under the License is distributed on an
15*766ce4d0SZheng Fan  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*766ce4d0SZheng Fan  * KIND, either express or implied.  See the License for the
17*766ce4d0SZheng Fan  * specific language governing permissions and limitations
18*766ce4d0SZheng Fan  * under the License.
19*766ce4d0SZheng Fan  *
20*766ce4d0SZheng Fan  *************************************************************/
21*766ce4d0SZheng Fan 
22*766ce4d0SZheng Fan #ifndef SVX_SIDEBAR_PARA_PROPERTY_PAGE_HXX
23*766ce4d0SZheng Fan #define SVX_SIDEBAR_PARA_PROPERTY_PAGE_HXX
24*766ce4d0SZheng Fan 
25*766ce4d0SZheng Fan #include <vcl/ctrl.hxx>
26*766ce4d0SZheng Fan #include <sfx2/sidebar/SidebarPanelBase.hxx>
27*766ce4d0SZheng Fan #include <sfx2/sidebar/ControllerItem.hxx>
28*766ce4d0SZheng Fan #include <sfx2/sidebar/IContextChangeReceiver.hxx>
29*766ce4d0SZheng Fan #include <editeng/lspcitem.hxx>
30*766ce4d0SZheng Fan #include <svtools/ctrlbox.hxx>
31*766ce4d0SZheng Fan #include <svx/tbxcolorupdate.hxx>
32*766ce4d0SZheng Fan #include <svx/relfld.hxx>
33*766ce4d0SZheng Fan #include <editeng/svxenum.hxx>
34*766ce4d0SZheng Fan #include <editeng/fhgtitem.hxx>
35*766ce4d0SZheng Fan 
36*766ce4d0SZheng Fan #include <com/sun/star/ui/XUIElement.hpp>
37*766ce4d0SZheng Fan 
38*766ce4d0SZheng Fan #include <boost/scoped_ptr.hpp>
39*766ce4d0SZheng Fan 
40*766ce4d0SZheng Fan #include <svx/sidebar/ColorPopup.hxx>
41*766ce4d0SZheng Fan #include <vcl/vclenum.hxx>
42*766ce4d0SZheng Fan #include <vcl/fixed.hxx>
43*766ce4d0SZheng Fan #include <svl/poolitem.hxx>
44*766ce4d0SZheng Fan #include <tools/fldunit.hxx>
45*766ce4d0SZheng Fan 
46*766ce4d0SZheng Fan #include "ParaBulletsPopup.hxx"
47*766ce4d0SZheng Fan #include "ParanumberingPopup.hxx"
48*766ce4d0SZheng Fan #include "ParaLineSpacingPopup.hxx"
49*766ce4d0SZheng Fan 
50*766ce4d0SZheng Fan class FloatingWindow;
51*766ce4d0SZheng Fan class ToolBox;
52*766ce4d0SZheng Fan 
53*766ce4d0SZheng Fan namespace svx { namespace sidebar {
54*766ce4d0SZheng Fan 
55*766ce4d0SZheng Fan class PopupControl;
56*766ce4d0SZheng Fan class PopupContainer;
57*766ce4d0SZheng Fan 
58*766ce4d0SZheng Fan class ParaPropertyPanel
59*766ce4d0SZheng Fan     : public Control,
60*766ce4d0SZheng Fan       public ::sfx2::sidebar::IContextChangeReceiver,
61*766ce4d0SZheng Fan       public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
62*766ce4d0SZheng Fan {
63*766ce4d0SZheng Fan public:
64*766ce4d0SZheng Fan     static ParaPropertyPanel* Create (
65*766ce4d0SZheng Fan         Window* pParent,
66*766ce4d0SZheng Fan         const cssu::Reference<css::frame::XFrame>& rxFrame,
67*766ce4d0SZheng Fan         SfxBindings* pBindings);
68*766ce4d0SZheng Fan 
69*766ce4d0SZheng Fan 	virtual void DataChanged (const DataChangedEvent& rEvent);
70*766ce4d0SZheng Fan 	SfxBindings* GetBindings();
71*766ce4d0SZheng Fan 
72*766ce4d0SZheng Fan 	virtual void HandleContextChange (
73*766ce4d0SZheng Fan 	    const ::sfx2::sidebar::EnumContext aContext);
74*766ce4d0SZheng Fan 
75*766ce4d0SZheng Fan 	virtual void NotifyItemUpdate(
76*766ce4d0SZheng Fan 	    const sal_uInt16 nSId,
77*766ce4d0SZheng Fan 	    const SfxItemState eState,
78*766ce4d0SZheng Fan 	    const SfxPoolItem* pState);
79*766ce4d0SZheng Fan 
80*766ce4d0SZheng Fan 	void ShowMenu (void);
81*766ce4d0SZheng Fan 	sal_uInt16 GetBulletTypeIndex(){ return nBulletTypeIndex; }
82*766ce4d0SZheng Fan 	void SetBulletTypeIndex(sal_uInt16 nInd){ nBulletTypeIndex = nInd; }
83*766ce4d0SZheng Fan 	sal_uInt16 GetNumTypeIndex(){ return nNumTypeIndex; }
84*766ce4d0SZheng Fan 	void SetNumTypeIndex(sal_uInt16 nInd){ nNumTypeIndex = nInd; }
85*766ce4d0SZheng Fan 	//End
86*766ce4d0SZheng Fan 	FieldUnit GetCurrentUnit( SfxItemState eState, const SfxPoolItem* pState );
87*766ce4d0SZheng Fan 
88*766ce4d0SZheng Fan 	void EndSpacingPopupMode (void);
89*766ce4d0SZheng Fan 	void EndBulletsPopupMode (void);
90*766ce4d0SZheng Fan 	void EndNumberingPopupMode (void);
91*766ce4d0SZheng Fan 
92*766ce4d0SZheng Fan private:
93*766ce4d0SZheng Fan 	/**********************************************************
94*766ce4d0SZheng Fan 	 **
95*766ce4d0SZheng Fan 	 ** UI controls
96*766ce4d0SZheng Fan 	 **
97*766ce4d0SZheng Fan 	***********************************************************/
98*766ce4d0SZheng Fan 	//Alignment
99*766ce4d0SZheng Fan 	::boost::scoped_ptr<Window> 			maAlignToolBoxBackground;
100*766ce4d0SZheng Fan 	::boost::scoped_ptr<ToolBox>			maAlignToolBox;
101*766ce4d0SZheng Fan 	::boost::scoped_ptr<Window> 			maTBxVertAlignBackground;
102*766ce4d0SZheng Fan 	::boost::scoped_ptr<ToolBox>			maTBxVertAlign;
103*766ce4d0SZheng Fan 	//NumBullet&Backcolor
104*766ce4d0SZheng Fan 	::boost::scoped_ptr<Window> 			maTBxNumBulletBackground;
105*766ce4d0SZheng Fan 	::boost::scoped_ptr<ToolBox>			maTBxNumBullet;
106*766ce4d0SZheng Fan 	::boost::scoped_ptr<Window> 			maTBxBackColorBackground;
107*766ce4d0SZheng Fan 	::boost::scoped_ptr<ToolBox>			maTBxBackColor;
108*766ce4d0SZheng Fan 	//Paragraph spacing
109*766ce4d0SZheng Fan 	::boost::scoped_ptr<FixedText>			maFTUL;
110*766ce4d0SZheng Fan 	::boost::scoped_ptr<Window> 			maTbxUL_IncDecBackground;
111*766ce4d0SZheng Fan 	::boost::scoped_ptr<ToolBox>			maTbxUL_IncDec;
112*766ce4d0SZheng Fan 	::boost::scoped_ptr<SvxRelativeField>	maTopDist;
113*766ce4d0SZheng Fan 	::boost::scoped_ptr<SvxRelativeField>	maBottomDist;
114*766ce4d0SZheng Fan 	//Line spacing
115*766ce4d0SZheng Fan 	::boost::scoped_ptr<Window> 			maLineSPTbxBackground;
116*766ce4d0SZheng Fan 	::boost::scoped_ptr<ToolBox>			maLineSPTbx;
117*766ce4d0SZheng Fan 	//Indent
118*766ce4d0SZheng Fan 	::boost::scoped_ptr<FixedText>			maFTIndent;
119*766ce4d0SZheng Fan 	::boost::scoped_ptr<Window> 			maTbxIndent_IncDecBackground;
120*766ce4d0SZheng Fan 	::boost::scoped_ptr<ToolBox>			maTbxIndent_IncDec;
121*766ce4d0SZheng Fan 	::boost::scoped_ptr<Window> 			maTbxProDemoteBackground;
122*766ce4d0SZheng Fan 	::boost::scoped_ptr<ToolBox>			maTbxProDemote;
123*766ce4d0SZheng Fan 	::boost::scoped_ptr<SvxRelativeField>	maLeftIndent;
124*766ce4d0SZheng Fan 	::boost::scoped_ptr<SvxRelativeField>	maRightIndent;
125*766ce4d0SZheng Fan 	::boost::scoped_ptr<SvxRelativeField>	maFLineIndent;
126*766ce4d0SZheng Fan 	::boost::scoped_ptr<::svx::ToolboxButtonColorUpdater>	mpColorUpdater;
127*766ce4d0SZheng Fan 
128*766ce4d0SZheng Fan 	/**********************************************************
129*766ce4d0SZheng Fan 	 **
130*766ce4d0SZheng Fan 	 ** Resources
131*766ce4d0SZheng Fan 	 **
132*766ce4d0SZheng Fan 	***********************************************************/
133*766ce4d0SZheng Fan 	FixedImage  maFISpace1;
134*766ce4d0SZheng Fan 	FixedImage  maFISpace2;
135*766ce4d0SZheng Fan 	FixedImage  maFIndent1;
136*766ce4d0SZheng Fan 	FixedImage  maFIndent2;
137*766ce4d0SZheng Fan 	FixedImage  maFIndent3;
138*766ce4d0SZheng Fan 
139*766ce4d0SZheng Fan 	Image  maSpace1;
140*766ce4d0SZheng Fan 	Image  maSpace2;
141*766ce4d0SZheng Fan 	Image  maSpace3;
142*766ce4d0SZheng Fan 	Image  maIndent1;
143*766ce4d0SZheng Fan 	Image  maIndent2;
144*766ce4d0SZheng Fan 	Image  maIndent3;
145*766ce4d0SZheng Fan 
146*766ce4d0SZheng Fan 	Image  maLeftPara;
147*766ce4d0SZheng Fan 	Image  maCentPara;
148*766ce4d0SZheng Fan 	Image  maRightPara;
149*766ce4d0SZheng Fan 	Image  maJusPara;
150*766ce4d0SZheng Fan 
151*766ce4d0SZheng Fan 	Image  maIndInc;
152*766ce4d0SZheng Fan 	Image  maIndDec;
153*766ce4d0SZheng Fan 	Image  maIndInc_BD;
154*766ce4d0SZheng Fan 	Image  maIndDec_BD;
155*766ce4d0SZheng Fan 	Image  maIndHang;
156*766ce4d0SZheng Fan 	Image  maParInc;
157*766ce4d0SZheng Fan 	Image  maParDec;
158*766ce4d0SZheng Fan 
159*766ce4d0SZheng Fan 	ImageList	maVertImageList;
160*766ce4d0SZheng Fan 	ImageList	maVertImageListH;
161*766ce4d0SZheng Fan 	ImageList	maNumBImageList;
162*766ce4d0SZheng Fan 	ImageList	maNumBImageListH;
163*766ce4d0SZheng Fan 	ImageList	maNumBImageListRTL;	//sym2_7380
164*766ce4d0SZheng Fan 	Image		maImgBackColorHigh;
165*766ce4d0SZheng Fan 	Image		maImgBackColor;
166*766ce4d0SZheng Fan 
167*766ce4d0SZheng Fan 	/****************************************************************
168*766ce4d0SZheng Fan 	**
169*766ce4d0SZheng Fan 	** Data Member
170*766ce4d0SZheng Fan 	**
171*766ce4d0SZheng Fan 	*****************************************************************/
172*766ce4d0SZheng Fan 	long				maTxtLeft;
173*766ce4d0SZheng Fan 	//Line spacing
174*766ce4d0SZheng Fan 	SvxLineSpacingItem	*mpLnSPItem;
175*766ce4d0SZheng Fan 	SfxItemState			meLnSpState;
176*766ce4d0SZheng Fan 	bool					mbOutLineLeft;
177*766ce4d0SZheng Fan 	bool					mbOutLineRight;
178*766ce4d0SZheng Fan 	long					maUpper;
179*766ce4d0SZheng Fan 	long					maLower;
180*766ce4d0SZheng Fan 
181*766ce4d0SZheng Fan 	sal_uInt16			nBulletTypeIndex;
182*766ce4d0SZheng Fan 	sal_uInt16			nNumTypeIndex;
183*766ce4d0SZheng Fan 	Color				maColor;
184*766ce4d0SZheng Fan 	bool					mbColorAvailable;
185*766ce4d0SZheng Fan 	FieldUnit						m_eMetricUnit;
186*766ce4d0SZheng Fan 	FieldUnit						m_last_eMetricUnit;
187*766ce4d0SZheng Fan 	SfxMapUnit                      m_eLRSpaceUnit;
188*766ce4d0SZheng Fan 	SfxMapUnit                      m_eULSpaceUnit;
189*766ce4d0SZheng Fan 	/****************************************************************
190*766ce4d0SZheng Fan 	**
191*766ce4d0SZheng Fan 	** Controll Itemb
192*766ce4d0SZheng Fan 	**
193*766ce4d0SZheng Fan 	*****************************************************************/
194*766ce4d0SZheng Fan 
195*766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maLeftAlignControl;
196*766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maCenterAlignControl;
197*766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maRightAlignControl;
198*766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maJustifyAlignControl;
199*766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maLRSpaceControl;
200*766ce4d0SZheng Fan 	//::sfx2::sidebar::ControllerItem  maLRSpaceControl2;
201*766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maLNSpaceControl;
202*766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maULSpaceControl;
203*766ce4d0SZheng Fan 	//::sfx2::sidebar::ControllerItem  maULSpaceControl2;
204*766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maOutLineLeftControl;
205*766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maOutLineRightControl;
206*766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maDecIndentControl;
207*766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maIncIndentControl;
208*766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maVertTop;
209*766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maVertCenter;
210*766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maVertBottom;
211*766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maBulletOnOff;
212*766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maNumberOnOff;
213*766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maBackColorControl;
214*766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  m_aMetricCtl;
215*766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maBulletNumRuleIndex;
216*766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maNumNumRuleIndex;
217*766ce4d0SZheng Fan 
218*766ce4d0SZheng Fan     cssu::Reference<css::frame::XFrame> mxFrame;
219*766ce4d0SZheng Fan     ::sfx2::sidebar::EnumContext maContext;
220*766ce4d0SZheng Fan     SfxBindings* mpBindings;
221*766ce4d0SZheng Fan 
222*766ce4d0SZheng Fan 
223*766ce4d0SZheng Fan 	ParaLineSpacingPopup maLineSpacePopup;
224*766ce4d0SZheng Fan 	ParaBulletsPopup maBulletsPopup;
225*766ce4d0SZheng Fan 	ParaNumberingPopup maNumberingPopup;
226*766ce4d0SZheng Fan 	ColorPopup maBGColorPopup;
227*766ce4d0SZheng Fan 
228*766ce4d0SZheng Fan     ParaPropertyPanel (
229*766ce4d0SZheng Fan         Window* pParent,
230*766ce4d0SZheng Fan         const cssu::Reference<css::frame::XFrame>& rxFrame,
231*766ce4d0SZheng Fan         SfxBindings* pBindings);
232*766ce4d0SZheng Fan 	virtual ~ParaPropertyPanel (void);
233*766ce4d0SZheng Fan 
234*766ce4d0SZheng Fan 	void InitImageList(::boost::scoped_ptr<ToolBox>& rTbx, ImageList& rImglst, ImageList& rImgHlst);
235*766ce4d0SZheng Fan 
236*766ce4d0SZheng Fan 	DECL_LINK(AlignStyleModifyHdl_Impl, ToolBox*);
237*766ce4d0SZheng Fan 	DECL_LINK(VertTbxSelectHandler, ToolBox*);
238*766ce4d0SZheng Fan 	DECL_LINK(NumBTbxSelectHandler, ToolBox*);
239*766ce4d0SZheng Fan 	DECL_LINK(ModifyIndentHdl_Impl, SvxRelativeField*);
240*766ce4d0SZheng Fan 	DECL_LINK(ClickIndent_IncDec_Hdl_Impl, ToolBox*);
241*766ce4d0SZheng Fan 	DECL_LINK(ClickProDemote_Hdl_Impl, ToolBox*);
242*766ce4d0SZheng Fan 	DECL_LINK(ULSpaceHdl_Impl, SvxRelativeField*);
243*766ce4d0SZheng Fan 	DECL_LINK(ClickUL_IncDec_Hdl_Impl, ToolBox*);
244*766ce4d0SZheng Fan 	DECL_LINK(ImplPopupModeEndHdl, FloatingWindow* );
245*766ce4d0SZheng Fan 
246*766ce4d0SZheng Fan 	void VertStateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState);
247*766ce4d0SZheng Fan 	void ParaBKGStateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState);
248*766ce4d0SZheng Fan 	void StateChangedAlignmentImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
249*766ce4d0SZheng Fan 	void StateChangedIndentImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
250*766ce4d0SZheng Fan 	void StateChangedLnSPImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
251*766ce4d0SZheng Fan 	void StateChangedULImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
252*766ce4d0SZheng Fan 	void StateChangeOutLineImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
253*766ce4d0SZheng Fan 	void StateChangeIncDecImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
254*766ce4d0SZheng Fan 	//Sym3_1093. Add toggle state for numbering and bullet icons
255*766ce4d0SZheng Fan 	void StateChangeBulletNumImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
256*766ce4d0SZheng Fan 	//Modified for Numbering&Bullets Dialog UX Enh(Story 992) by chengjh,2011.7.5
257*766ce4d0SZheng Fan 	//Handing the transferred the num rule index data of the current selection
258*766ce4d0SZheng Fan 	void StateChangeBulletNumRuleImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
259*766ce4d0SZheng Fan 
260*766ce4d0SZheng Fan 	void initial();
261*766ce4d0SZheng Fan 	void ReSize(bool bSize);
262*766ce4d0SZheng Fan 
263*766ce4d0SZheng Fan 
264*766ce4d0SZheng Fan 	PopupControl* CreateLineSpacingControl (PopupContainer* pParent);
265*766ce4d0SZheng Fan 	PopupControl* CreateBulletsPopupControl (PopupContainer* pParent);
266*766ce4d0SZheng Fan 	PopupControl* CreateNumberingPopupControl (PopupContainer* pParent);
267*766ce4d0SZheng Fan 	PopupControl* CreateBGColorPopupControl (PopupContainer* pParent);
268*766ce4d0SZheng Fan 	DECL_LINK(ClickLineSPDropDownHdl_Impl, ToolBox*);
269*766ce4d0SZheng Fan 	DECL_LINK(NumBTbxDDHandler, ToolBox*);
270*766ce4d0SZheng Fan 	DECL_LINK(ToolBoxBackColorDDHandler, ToolBox *);
271*766ce4d0SZheng Fan 
272*766ce4d0SZheng Fan 	void SetupIcons (void);
273*766ce4d0SZheng Fan 	void InitToolBoxAlign();
274*766ce4d0SZheng Fan 	void InitToolBoxVertAlign();
275*766ce4d0SZheng Fan 	void InitToolBoxIndent();
276*766ce4d0SZheng Fan 	void InitToolBoxBGColor();
277*766ce4d0SZheng Fan 	void InitToolBoxBulletsNumbering();
278*766ce4d0SZheng Fan 	void InitToolBoxSpacing();
279*766ce4d0SZheng Fan 	void InitToolBoxLineSpacing();
280*766ce4d0SZheng Fan 
281*766ce4d0SZheng Fan 	Color GetBGColor (void) const;
282*766ce4d0SZheng Fan 	void SetBGColor (const String& rsColorName, const Color aColor);
283*766ce4d0SZheng Fan };
284*766ce4d0SZheng Fan 
285*766ce4d0SZheng Fan } } // end of namespace ::svx::sidebar
286*766ce4d0SZheng Fan 
287*766ce4d0SZheng Fan #endif
288*766ce4d0SZheng Fan 
289