1766ce4d0SZheng Fan /**************************************************************
2766ce4d0SZheng Fan  *
3766ce4d0SZheng Fan  * Licensed to the Apache Software Foundation (ASF) under one
4766ce4d0SZheng Fan  * or more contributor license agreements.  See the NOTICE file
5766ce4d0SZheng Fan  * distributed with this work for additional information
6766ce4d0SZheng Fan  * regarding copyright ownership.  The ASF licenses this file
7766ce4d0SZheng Fan  * to you under the Apache License, Version 2.0 (the
8766ce4d0SZheng Fan  * "License"); you may not use this file except in compliance
9766ce4d0SZheng Fan  * with the License.  You may obtain a copy of the License at
10766ce4d0SZheng Fan  *
11766ce4d0SZheng Fan  *   http://www.apache.org/licenses/LICENSE-2.0
12766ce4d0SZheng Fan  *
13766ce4d0SZheng Fan  * Unless required by applicable law or agreed to in writing,
14766ce4d0SZheng Fan  * software distributed under the License is distributed on an
15766ce4d0SZheng Fan  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16766ce4d0SZheng Fan  * KIND, either express or implied.  See the License for the
17766ce4d0SZheng Fan  * specific language governing permissions and limitations
18766ce4d0SZheng Fan  * under the License.
19766ce4d0SZheng Fan  *
20766ce4d0SZheng Fan  *************************************************************/
21766ce4d0SZheng Fan 
22766ce4d0SZheng Fan #ifndef SVX_SIDEBAR_PARA_PROPERTY_PAGE_HXX
23766ce4d0SZheng Fan #define SVX_SIDEBAR_PARA_PROPERTY_PAGE_HXX
24766ce4d0SZheng Fan 
25766ce4d0SZheng Fan #include <vcl/ctrl.hxx>
26766ce4d0SZheng Fan #include <sfx2/sidebar/SidebarPanelBase.hxx>
27766ce4d0SZheng Fan #include <sfx2/sidebar/ControllerItem.hxx>
28766ce4d0SZheng Fan #include <sfx2/sidebar/IContextChangeReceiver.hxx>
29766ce4d0SZheng Fan #include <editeng/lspcitem.hxx>
30766ce4d0SZheng Fan #include <svtools/ctrlbox.hxx>
31766ce4d0SZheng Fan #include <svx/tbxcolorupdate.hxx>
32766ce4d0SZheng Fan #include <svx/relfld.hxx>
33766ce4d0SZheng Fan #include <editeng/svxenum.hxx>
34766ce4d0SZheng Fan #include <editeng/fhgtitem.hxx>
35766ce4d0SZheng Fan 
36766ce4d0SZheng Fan #include <com/sun/star/ui/XUIElement.hpp>
37766ce4d0SZheng Fan 
38766ce4d0SZheng Fan #include <boost/scoped_ptr.hpp>
39766ce4d0SZheng Fan 
40766ce4d0SZheng Fan #include <svx/sidebar/ColorPopup.hxx>
41766ce4d0SZheng Fan #include <vcl/vclenum.hxx>
42766ce4d0SZheng Fan #include <vcl/fixed.hxx>
43766ce4d0SZheng Fan #include <svl/poolitem.hxx>
44766ce4d0SZheng Fan #include <tools/fldunit.hxx>
45766ce4d0SZheng Fan 
46766ce4d0SZheng Fan #include "ParaBulletsPopup.hxx"
47*5e9e28d9SOliver-Rainer Wittmann #include "ParaNumberingPopup.hxx"
48766ce4d0SZheng Fan #include "ParaLineSpacingPopup.hxx"
49766ce4d0SZheng Fan 
50766ce4d0SZheng Fan class FloatingWindow;
51766ce4d0SZheng Fan class ToolBox;
52766ce4d0SZheng Fan 
53766ce4d0SZheng Fan namespace svx { namespace sidebar {
54766ce4d0SZheng Fan 
55766ce4d0SZheng Fan class PopupControl;
56766ce4d0SZheng Fan class PopupContainer;
57766ce4d0SZheng Fan 
58766ce4d0SZheng Fan class ParaPropertyPanel
59766ce4d0SZheng Fan     : public Control,
60766ce4d0SZheng Fan       public ::sfx2::sidebar::IContextChangeReceiver,
61766ce4d0SZheng Fan       public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
62766ce4d0SZheng Fan {
63766ce4d0SZheng Fan public:
64766ce4d0SZheng Fan     static ParaPropertyPanel* Create (
65766ce4d0SZheng Fan         Window* pParent,
66766ce4d0SZheng Fan         const cssu::Reference<css::frame::XFrame>& rxFrame,
67766ce4d0SZheng Fan         SfxBindings* pBindings);
68766ce4d0SZheng Fan 
69766ce4d0SZheng Fan 	virtual void DataChanged (const DataChangedEvent& rEvent);
70766ce4d0SZheng Fan 	SfxBindings* GetBindings();
71766ce4d0SZheng Fan 
72766ce4d0SZheng Fan 	virtual void HandleContextChange (
73766ce4d0SZheng Fan 	    const ::sfx2::sidebar::EnumContext aContext);
74766ce4d0SZheng Fan 
75766ce4d0SZheng Fan 	virtual void NotifyItemUpdate(
76766ce4d0SZheng Fan 	    const sal_uInt16 nSId,
77766ce4d0SZheng Fan 	    const SfxItemState eState,
78766ce4d0SZheng Fan 	    const SfxPoolItem* pState);
79766ce4d0SZheng Fan 
80766ce4d0SZheng Fan 	void ShowMenu (void);
81766ce4d0SZheng Fan 	sal_uInt16 GetBulletTypeIndex(){ return nBulletTypeIndex; }
82766ce4d0SZheng Fan 	void SetBulletTypeIndex(sal_uInt16 nInd){ nBulletTypeIndex = nInd; }
83766ce4d0SZheng Fan 	sal_uInt16 GetNumTypeIndex(){ return nNumTypeIndex; }
84766ce4d0SZheng Fan 	void SetNumTypeIndex(sal_uInt16 nInd){ nNumTypeIndex = nInd; }
85766ce4d0SZheng Fan 	//End
86766ce4d0SZheng Fan 	FieldUnit GetCurrentUnit( SfxItemState eState, const SfxPoolItem* pState );
87766ce4d0SZheng Fan 
88766ce4d0SZheng Fan 	void EndSpacingPopupMode (void);
89766ce4d0SZheng Fan 	void EndBulletsPopupMode (void);
90766ce4d0SZheng Fan 	void EndNumberingPopupMode (void);
91766ce4d0SZheng Fan 
92766ce4d0SZheng Fan private:
93766ce4d0SZheng Fan 	/**********************************************************
94766ce4d0SZheng Fan 	 **
95766ce4d0SZheng Fan 	 ** UI controls
96766ce4d0SZheng Fan 	 **
97766ce4d0SZheng Fan 	***********************************************************/
98766ce4d0SZheng Fan 	//Alignment
99766ce4d0SZheng Fan 	::boost::scoped_ptr<Window> 			maAlignToolBoxBackground;
100766ce4d0SZheng Fan 	::boost::scoped_ptr<ToolBox>			maAlignToolBox;
101766ce4d0SZheng Fan 	::boost::scoped_ptr<Window> 			maTBxVertAlignBackground;
102766ce4d0SZheng Fan 	::boost::scoped_ptr<ToolBox>			maTBxVertAlign;
103766ce4d0SZheng Fan 	//NumBullet&Backcolor
104766ce4d0SZheng Fan 	::boost::scoped_ptr<Window> 			maTBxNumBulletBackground;
105766ce4d0SZheng Fan 	::boost::scoped_ptr<ToolBox>			maTBxNumBullet;
106766ce4d0SZheng Fan 	::boost::scoped_ptr<Window> 			maTBxBackColorBackground;
107766ce4d0SZheng Fan 	::boost::scoped_ptr<ToolBox>			maTBxBackColor;
108766ce4d0SZheng Fan 	//Paragraph spacing
109766ce4d0SZheng Fan 	::boost::scoped_ptr<FixedText>			maFTUL;
110766ce4d0SZheng Fan 	::boost::scoped_ptr<Window> 			maTbxUL_IncDecBackground;
111766ce4d0SZheng Fan 	::boost::scoped_ptr<ToolBox>			maTbxUL_IncDec;
112766ce4d0SZheng Fan 	::boost::scoped_ptr<SvxRelativeField>	maTopDist;
113766ce4d0SZheng Fan 	::boost::scoped_ptr<SvxRelativeField>	maBottomDist;
114766ce4d0SZheng Fan 	//Line spacing
115766ce4d0SZheng Fan 	::boost::scoped_ptr<Window> 			maLineSPTbxBackground;
116766ce4d0SZheng Fan 	::boost::scoped_ptr<ToolBox>			maLineSPTbx;
117766ce4d0SZheng Fan 	//Indent
118766ce4d0SZheng Fan 	::boost::scoped_ptr<FixedText>			maFTIndent;
119766ce4d0SZheng Fan 	::boost::scoped_ptr<Window> 			maTbxIndent_IncDecBackground;
120766ce4d0SZheng Fan 	::boost::scoped_ptr<ToolBox>			maTbxIndent_IncDec;
121766ce4d0SZheng Fan 	::boost::scoped_ptr<Window> 			maTbxProDemoteBackground;
122766ce4d0SZheng Fan 	::boost::scoped_ptr<ToolBox>			maTbxProDemote;
123766ce4d0SZheng Fan 	::boost::scoped_ptr<SvxRelativeField>	maLeftIndent;
124766ce4d0SZheng Fan 	::boost::scoped_ptr<SvxRelativeField>	maRightIndent;
125766ce4d0SZheng Fan 	::boost::scoped_ptr<SvxRelativeField>	maFLineIndent;
126*5e9e28d9SOliver-Rainer Wittmann 	::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpColorUpdater;
127766ce4d0SZheng Fan 
128766ce4d0SZheng Fan 	/**********************************************************
129766ce4d0SZheng Fan 	 **
130766ce4d0SZheng Fan 	 ** Resources
131766ce4d0SZheng Fan 	 **
132766ce4d0SZheng Fan 	***********************************************************/
133766ce4d0SZheng Fan 	FixedImage  maFISpace1;
134766ce4d0SZheng Fan 	FixedImage  maFISpace2;
135766ce4d0SZheng Fan 	FixedImage  maFIndent1;
136766ce4d0SZheng Fan 	FixedImage  maFIndent2;
137766ce4d0SZheng Fan 	FixedImage  maFIndent3;
138766ce4d0SZheng Fan 
139766ce4d0SZheng Fan 	Image  maSpace1;
140766ce4d0SZheng Fan 	Image  maSpace2;
141766ce4d0SZheng Fan 	Image  maSpace3;
142766ce4d0SZheng Fan 	Image  maIndent1;
143766ce4d0SZheng Fan 	Image  maIndent2;
144766ce4d0SZheng Fan 	Image  maIndent3;
145766ce4d0SZheng Fan 
146766ce4d0SZheng Fan 	Image  maLeftPara;
147766ce4d0SZheng Fan 	Image  maCentPara;
148766ce4d0SZheng Fan 	Image  maRightPara;
149766ce4d0SZheng Fan 	Image  maJusPara;
150766ce4d0SZheng Fan 
151766ce4d0SZheng Fan 	Image  maIndInc;
152766ce4d0SZheng Fan 	Image  maIndDec;
153766ce4d0SZheng Fan 	Image  maIndInc_BD;
154766ce4d0SZheng Fan 	Image  maIndDec_BD;
155766ce4d0SZheng Fan 	Image  maIndHang;
156766ce4d0SZheng Fan 	Image  maParInc;
157766ce4d0SZheng Fan 	Image  maParDec;
158766ce4d0SZheng Fan 
159766ce4d0SZheng Fan 	ImageList	maVertImageList;
160766ce4d0SZheng Fan 	ImageList	maVertImageListH;
161766ce4d0SZheng Fan 	ImageList	maNumBImageList;
162766ce4d0SZheng Fan 	ImageList	maNumBImageListH;
163766ce4d0SZheng Fan 	ImageList	maNumBImageListRTL;	//sym2_7380
164766ce4d0SZheng Fan 	Image		maImgBackColorHigh;
165766ce4d0SZheng Fan 	Image		maImgBackColor;
166766ce4d0SZheng Fan 
167766ce4d0SZheng Fan 	/****************************************************************
168766ce4d0SZheng Fan 	**
169766ce4d0SZheng Fan 	** Data Member
170766ce4d0SZheng Fan 	**
171766ce4d0SZheng Fan 	*****************************************************************/
172766ce4d0SZheng Fan 	long				maTxtLeft;
173766ce4d0SZheng Fan 	//Line spacing
174766ce4d0SZheng Fan 	SvxLineSpacingItem	*mpLnSPItem;
175766ce4d0SZheng Fan 	SfxItemState			meLnSpState;
176766ce4d0SZheng Fan 	bool					mbOutLineLeft;
177766ce4d0SZheng Fan 	bool					mbOutLineRight;
178766ce4d0SZheng Fan 	long					maUpper;
179766ce4d0SZheng Fan 	long					maLower;
180766ce4d0SZheng Fan 
181766ce4d0SZheng Fan 	sal_uInt16			nBulletTypeIndex;
182766ce4d0SZheng Fan 	sal_uInt16			nNumTypeIndex;
183766ce4d0SZheng Fan 	Color				maColor;
184766ce4d0SZheng Fan 	bool					mbColorAvailable;
185766ce4d0SZheng Fan 	FieldUnit						m_eMetricUnit;
186766ce4d0SZheng Fan 	FieldUnit						m_last_eMetricUnit;
187766ce4d0SZheng Fan 	SfxMapUnit                      m_eLRSpaceUnit;
188766ce4d0SZheng Fan 	SfxMapUnit                      m_eULSpaceUnit;
189766ce4d0SZheng Fan 	/****************************************************************
190766ce4d0SZheng Fan 	**
191766ce4d0SZheng Fan 	** Controll Itemb
192766ce4d0SZheng Fan 	**
193766ce4d0SZheng Fan 	*****************************************************************/
194766ce4d0SZheng Fan 
195766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maLeftAlignControl;
196766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maCenterAlignControl;
197766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maRightAlignControl;
198766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maJustifyAlignControl;
199766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maLRSpaceControl;
200766ce4d0SZheng Fan 	//::sfx2::sidebar::ControllerItem  maLRSpaceControl2;
201766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maLNSpaceControl;
202766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maULSpaceControl;
203766ce4d0SZheng Fan 	//::sfx2::sidebar::ControllerItem  maULSpaceControl2;
204766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maOutLineLeftControl;
205766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maOutLineRightControl;
206766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maDecIndentControl;
207766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maIncIndentControl;
208766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maVertTop;
209766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maVertCenter;
210766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maVertBottom;
211766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maBulletOnOff;
212766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maNumberOnOff;
213766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maBackColorControl;
214766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  m_aMetricCtl;
215766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maBulletNumRuleIndex;
216766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maNumNumRuleIndex;
217766ce4d0SZheng Fan 
218766ce4d0SZheng Fan     cssu::Reference<css::frame::XFrame> mxFrame;
219766ce4d0SZheng Fan     ::sfx2::sidebar::EnumContext maContext;
220766ce4d0SZheng Fan     SfxBindings* mpBindings;
221766ce4d0SZheng Fan 
222766ce4d0SZheng Fan 
223766ce4d0SZheng Fan 	ParaLineSpacingPopup maLineSpacePopup;
224766ce4d0SZheng Fan 	ParaBulletsPopup maBulletsPopup;
225766ce4d0SZheng Fan 	ParaNumberingPopup maNumberingPopup;
226766ce4d0SZheng Fan 	ColorPopup maBGColorPopup;
227766ce4d0SZheng Fan 
228766ce4d0SZheng Fan     ParaPropertyPanel (
229766ce4d0SZheng Fan         Window* pParent,
230766ce4d0SZheng Fan         const cssu::Reference<css::frame::XFrame>& rxFrame,
231766ce4d0SZheng Fan         SfxBindings* pBindings);
232766ce4d0SZheng Fan 	virtual ~ParaPropertyPanel (void);
233766ce4d0SZheng Fan 
234766ce4d0SZheng Fan 	void InitImageList(::boost::scoped_ptr<ToolBox>& rTbx, ImageList& rImglst, ImageList& rImgHlst);
235766ce4d0SZheng Fan 
236766ce4d0SZheng Fan 	DECL_LINK(AlignStyleModifyHdl_Impl, ToolBox*);
237766ce4d0SZheng Fan 	DECL_LINK(VertTbxSelectHandler, ToolBox*);
238766ce4d0SZheng Fan 	DECL_LINK(NumBTbxSelectHandler, ToolBox*);
239766ce4d0SZheng Fan 	DECL_LINK(ModifyIndentHdl_Impl, SvxRelativeField*);
240766ce4d0SZheng Fan 	DECL_LINK(ClickIndent_IncDec_Hdl_Impl, ToolBox*);
241766ce4d0SZheng Fan 	DECL_LINK(ClickProDemote_Hdl_Impl, ToolBox*);
242766ce4d0SZheng Fan 	DECL_LINK(ULSpaceHdl_Impl, SvxRelativeField*);
243766ce4d0SZheng Fan 	DECL_LINK(ClickUL_IncDec_Hdl_Impl, ToolBox*);
244766ce4d0SZheng Fan 	DECL_LINK(ImplPopupModeEndHdl, FloatingWindow* );
245766ce4d0SZheng Fan 
246766ce4d0SZheng Fan 	void VertStateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState);
247766ce4d0SZheng Fan 	void ParaBKGStateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState);
248766ce4d0SZheng Fan 	void StateChangedAlignmentImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
249766ce4d0SZheng Fan 	void StateChangedIndentImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
250766ce4d0SZheng Fan 	void StateChangedLnSPImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
251766ce4d0SZheng Fan 	void StateChangedULImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
252766ce4d0SZheng Fan 	void StateChangeOutLineImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
253766ce4d0SZheng Fan 	void StateChangeIncDecImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
254766ce4d0SZheng Fan 	//Sym3_1093. Add toggle state for numbering and bullet icons
255766ce4d0SZheng Fan 	void StateChangeBulletNumImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
256766ce4d0SZheng Fan 	//Modified for Numbering&Bullets Dialog UX Enh(Story 992) by chengjh,2011.7.5
257766ce4d0SZheng Fan 	//Handing the transferred the num rule index data of the current selection
258766ce4d0SZheng Fan 	void StateChangeBulletNumRuleImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
259766ce4d0SZheng Fan 
260766ce4d0SZheng Fan 	void initial();
261766ce4d0SZheng Fan 	void ReSize(bool bSize);
262766ce4d0SZheng Fan 
263766ce4d0SZheng Fan 
264766ce4d0SZheng Fan 	PopupControl* CreateLineSpacingControl (PopupContainer* pParent);
265766ce4d0SZheng Fan 	PopupControl* CreateBulletsPopupControl (PopupContainer* pParent);
266766ce4d0SZheng Fan 	PopupControl* CreateNumberingPopupControl (PopupContainer* pParent);
267766ce4d0SZheng Fan 	PopupControl* CreateBGColorPopupControl (PopupContainer* pParent);
268766ce4d0SZheng Fan 	DECL_LINK(ClickLineSPDropDownHdl_Impl, ToolBox*);
269766ce4d0SZheng Fan 	DECL_LINK(NumBTbxDDHandler, ToolBox*);
270766ce4d0SZheng Fan 	DECL_LINK(ToolBoxBackColorDDHandler, ToolBox *);
271766ce4d0SZheng Fan 
272766ce4d0SZheng Fan 	void SetupIcons (void);
273766ce4d0SZheng Fan 	void InitToolBoxAlign();
274766ce4d0SZheng Fan 	void InitToolBoxVertAlign();
275766ce4d0SZheng Fan 	void InitToolBoxIndent();
276766ce4d0SZheng Fan 	void InitToolBoxBGColor();
277766ce4d0SZheng Fan 	void InitToolBoxBulletsNumbering();
278766ce4d0SZheng Fan 	void InitToolBoxSpacing();
279766ce4d0SZheng Fan 	void InitToolBoxLineSpacing();
280766ce4d0SZheng Fan 
281766ce4d0SZheng Fan 	Color GetBGColor (void) const;
282766ce4d0SZheng Fan 	void SetBGColor (const String& rsColorName, const Color aColor);
283766ce4d0SZheng Fan };
284766ce4d0SZheng Fan 
285766ce4d0SZheng Fan } } // end of namespace ::svx::sidebar
286766ce4d0SZheng Fan 
287766ce4d0SZheng Fan #endif
288766ce4d0SZheng Fan 
289