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 
2237fee4fdSAndre Fischer #ifndef SVX_SIDEBAR_PARA_PROPERTY_PANEL_HXX
2337fee4fdSAndre Fischer #define SVX_SIDEBAR_PARA_PROPERTY_PANEL_HXX
24766ce4d0SZheng Fan 
25766ce4d0SZheng Fan #include <vcl/ctrl.hxx>
26766ce4d0SZheng Fan #include <sfx2/sidebar/ControllerItem.hxx>
27766ce4d0SZheng Fan #include <sfx2/sidebar/IContextChangeReceiver.hxx>
28766ce4d0SZheng Fan #include <editeng/lspcitem.hxx>
29766ce4d0SZheng Fan #include <svtools/ctrlbox.hxx>
30766ce4d0SZheng Fan #include <svx/tbxcolorupdate.hxx>
31766ce4d0SZheng Fan #include <svx/relfld.hxx>
32766ce4d0SZheng Fan #include <editeng/svxenum.hxx>
33766ce4d0SZheng Fan #include <editeng/fhgtitem.hxx>
34766ce4d0SZheng Fan 
3537fee4fdSAndre Fischer #include <com/sun/star/frame/XFrame.hpp>
3637fee4fdSAndre Fischer #include <com/sun/star/ui/XSidebar.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"
475e9e28d9SOliver-Rainer Wittmann #include "ParaNumberingPopup.hxx"
48766ce4d0SZheng Fan #include "ParaLineSpacingPopup.hxx"
49766ce4d0SZheng Fan 
50766ce4d0SZheng Fan class FloatingWindow;
51766ce4d0SZheng Fan class ToolBox;
52766ce4d0SZheng Fan 
5337fee4fdSAndre Fischer namespace css = ::com::sun::star;
5437fee4fdSAndre Fischer namespace cssu = ::com::sun::star::uno;
5537fee4fdSAndre Fischer 
5637fee4fdSAndre Fischer 
57766ce4d0SZheng Fan namespace svx { namespace sidebar {
58766ce4d0SZheng Fan 
59766ce4d0SZheng Fan class PopupControl;
60766ce4d0SZheng Fan class PopupContainer;
61766ce4d0SZheng Fan 
62766ce4d0SZheng Fan class ParaPropertyPanel
63766ce4d0SZheng Fan     : public Control,
64766ce4d0SZheng Fan       public ::sfx2::sidebar::IContextChangeReceiver,
65766ce4d0SZheng Fan       public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
66766ce4d0SZheng Fan {
67766ce4d0SZheng Fan public:
68766ce4d0SZheng Fan     static ParaPropertyPanel* Create (
69766ce4d0SZheng Fan         Window* pParent,
70766ce4d0SZheng Fan         const cssu::Reference<css::frame::XFrame>& rxFrame,
7137fee4fdSAndre Fischer         SfxBindings* pBindings,
7237fee4fdSAndre Fischer         const cssu::Reference<css::ui::XSidebar>& rxSidebar);
73766ce4d0SZheng Fan 
74766ce4d0SZheng Fan 	virtual void DataChanged (const DataChangedEvent& rEvent);
75766ce4d0SZheng Fan 	SfxBindings* GetBindings();
76766ce4d0SZheng Fan 
77766ce4d0SZheng Fan 	virtual void HandleContextChange (
78766ce4d0SZheng Fan 	    const ::sfx2::sidebar::EnumContext aContext);
79766ce4d0SZheng Fan 
80766ce4d0SZheng Fan 	virtual void NotifyItemUpdate(
81766ce4d0SZheng Fan 	    const sal_uInt16 nSId,
82766ce4d0SZheng Fan 	    const SfxItemState eState,
8345da7d5eSAndre Fischer 	    const SfxPoolItem* pState,
8445da7d5eSAndre Fischer         const bool bIsEnabled);
85766ce4d0SZheng Fan 
86766ce4d0SZheng Fan 	void ShowMenu (void);
8737fee4fdSAndre Fischer 	sal_uInt16 GetBulletTypeIndex(){ return mnBulletTypeIndex; }
8837fee4fdSAndre Fischer 	sal_uInt16 GetNumTypeIndex(){ return mnNumTypeIndex; }
89766ce4d0SZheng Fan 	FieldUnit GetCurrentUnit( SfxItemState eState, const SfxPoolItem* pState );
90766ce4d0SZheng Fan 
91766ce4d0SZheng Fan 	void EndSpacingPopupMode (void);
92766ce4d0SZheng Fan 	void EndBulletsPopupMode (void);
93766ce4d0SZheng Fan 	void EndNumberingPopupMode (void);
94766ce4d0SZheng Fan 
95766ce4d0SZheng Fan private:
96766ce4d0SZheng Fan 	/**********************************************************
97766ce4d0SZheng Fan 	 **
98766ce4d0SZheng Fan 	 ** UI controls
99766ce4d0SZheng Fan 	 **
100766ce4d0SZheng Fan 	***********************************************************/
101766ce4d0SZheng Fan 	//Alignment
102766ce4d0SZheng Fan 	::boost::scoped_ptr<Window> 			maAlignToolBoxBackground;
103766ce4d0SZheng Fan 	::boost::scoped_ptr<ToolBox>			maAlignToolBox;
104766ce4d0SZheng Fan 	::boost::scoped_ptr<Window> 			maTBxVertAlignBackground;
105766ce4d0SZheng Fan 	::boost::scoped_ptr<ToolBox>			maTBxVertAlign;
106766ce4d0SZheng Fan 	//NumBullet&Backcolor
107766ce4d0SZheng Fan 	::boost::scoped_ptr<Window> 			maTBxNumBulletBackground;
108766ce4d0SZheng Fan 	::boost::scoped_ptr<ToolBox>			maTBxNumBullet;
109766ce4d0SZheng Fan 	::boost::scoped_ptr<Window> 			maTBxBackColorBackground;
110766ce4d0SZheng Fan 	::boost::scoped_ptr<ToolBox>			maTBxBackColor;
111766ce4d0SZheng Fan 	//Paragraph spacing
112766ce4d0SZheng Fan 	::boost::scoped_ptr<FixedText>			maFTUL;
113766ce4d0SZheng Fan 	::boost::scoped_ptr<Window> 			maTbxUL_IncDecBackground;
114766ce4d0SZheng Fan 	::boost::scoped_ptr<ToolBox>			maTbxUL_IncDec;
115766ce4d0SZheng Fan 	::boost::scoped_ptr<SvxRelativeField>	maTopDist;
116766ce4d0SZheng Fan 	::boost::scoped_ptr<SvxRelativeField>	maBottomDist;
117766ce4d0SZheng Fan 	//Line spacing
118766ce4d0SZheng Fan 	::boost::scoped_ptr<Window> 			maLineSPTbxBackground;
119766ce4d0SZheng Fan 	::boost::scoped_ptr<ToolBox>			maLineSPTbx;
120766ce4d0SZheng Fan 	//Indent
121766ce4d0SZheng Fan 	::boost::scoped_ptr<FixedText>			maFTIndent;
122766ce4d0SZheng Fan 	::boost::scoped_ptr<Window> 			maTbxIndent_IncDecBackground;
123766ce4d0SZheng Fan 	::boost::scoped_ptr<ToolBox>			maTbxIndent_IncDec;
124766ce4d0SZheng Fan 	::boost::scoped_ptr<Window> 			maTbxProDemoteBackground;
125766ce4d0SZheng Fan 	::boost::scoped_ptr<ToolBox>			maTbxProDemote;
126766ce4d0SZheng Fan 	::boost::scoped_ptr<SvxRelativeField>	maLeftIndent;
127766ce4d0SZheng Fan 	::boost::scoped_ptr<SvxRelativeField>	maRightIndent;
128766ce4d0SZheng Fan 	::boost::scoped_ptr<SvxRelativeField>	maFLineIndent;
1295e9e28d9SOliver-Rainer Wittmann 	::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpColorUpdater;
130766ce4d0SZheng Fan 
131766ce4d0SZheng Fan 	/**********************************************************
132766ce4d0SZheng Fan 	 **
133766ce4d0SZheng Fan 	 ** Resources
134766ce4d0SZheng Fan 	 **
135766ce4d0SZheng Fan 	***********************************************************/
136766ce4d0SZheng Fan 	FixedImage  maFISpace1;
137766ce4d0SZheng Fan 	FixedImage  maFISpace2;
138766ce4d0SZheng Fan 	FixedImage  maFIndent1;
139766ce4d0SZheng Fan 	FixedImage  maFIndent2;
140766ce4d0SZheng Fan 	FixedImage  maFIndent3;
141766ce4d0SZheng Fan 
142766ce4d0SZheng Fan 	Image  maSpace1;
143766ce4d0SZheng Fan 	Image  maSpace2;
144766ce4d0SZheng Fan 	Image  maSpace3;
145766ce4d0SZheng Fan 	Image  maIndent1;
146766ce4d0SZheng Fan 	Image  maIndent2;
147766ce4d0SZheng Fan 	Image  maIndent3;
148766ce4d0SZheng Fan 
149766ce4d0SZheng Fan 	Image  maLeftPara;
150766ce4d0SZheng Fan 	Image  maCentPara;
151766ce4d0SZheng Fan 	Image  maRightPara;
152766ce4d0SZheng Fan 	Image  maJusPara;
153766ce4d0SZheng Fan 
154766ce4d0SZheng Fan 	Image  maIndInc;
155766ce4d0SZheng Fan 	Image  maIndDec;
156766ce4d0SZheng Fan 	Image  maIndInc_BD;
157766ce4d0SZheng Fan 	Image  maIndDec_BD;
158766ce4d0SZheng Fan 	Image  maIndHang;
159766ce4d0SZheng Fan 	Image  maParInc;
160766ce4d0SZheng Fan 	Image  maParDec;
161766ce4d0SZheng Fan 
162766ce4d0SZheng Fan 	ImageList	maVertImageList;
163766ce4d0SZheng Fan 	ImageList	maVertImageListH;
164766ce4d0SZheng Fan 	ImageList	maNumBImageList;
165766ce4d0SZheng Fan 	ImageList	maNumBImageListH;
16637fee4fdSAndre Fischer 	ImageList	maNumBImageListRTL;
167766ce4d0SZheng Fan 	Image		maImgBackColorHigh;
168766ce4d0SZheng Fan 	Image		maImgBackColor;
169766ce4d0SZheng Fan 
170766ce4d0SZheng Fan 	/****************************************************************
171766ce4d0SZheng Fan 	**
172766ce4d0SZheng Fan 	** Data Member
173766ce4d0SZheng Fan 	**
174766ce4d0SZheng Fan 	*****************************************************************/
175766ce4d0SZheng Fan 	long				maTxtLeft;
176766ce4d0SZheng Fan 	//Line spacing
177766ce4d0SZheng Fan 	SvxLineSpacingItem	*mpLnSPItem;
178766ce4d0SZheng Fan 	SfxItemState			meLnSpState;
179766ce4d0SZheng Fan 	bool					mbOutLineLeft;
180766ce4d0SZheng Fan 	bool					mbOutLineRight;
181766ce4d0SZheng Fan 	long					maUpper;
182766ce4d0SZheng Fan 	long					maLower;
183766ce4d0SZheng Fan 
18437fee4fdSAndre Fischer 	sal_uInt16			mnBulletTypeIndex;
18537fee4fdSAndre Fischer 	sal_uInt16			mnNumTypeIndex;
186766ce4d0SZheng Fan 	Color				maColor;
187766ce4d0SZheng Fan 	bool					mbColorAvailable;
188766ce4d0SZheng Fan 	FieldUnit						m_eMetricUnit;
189766ce4d0SZheng Fan 	FieldUnit						m_last_eMetricUnit;
190766ce4d0SZheng Fan 	SfxMapUnit                      m_eLRSpaceUnit;
191766ce4d0SZheng Fan 	SfxMapUnit                      m_eULSpaceUnit;
192766ce4d0SZheng Fan 	/****************************************************************
193766ce4d0SZheng Fan 	**
19437fee4fdSAndre Fischer 	** Controll Items
195766ce4d0SZheng Fan 	**
196766ce4d0SZheng Fan 	*****************************************************************/
197766ce4d0SZheng Fan 
198766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maLeftAlignControl;
199766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maCenterAlignControl;
200766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maRightAlignControl;
201766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maJustifyAlignControl;
202766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maLRSpaceControl;
203766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maLNSpaceControl;
204766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maULSpaceControl;
205766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maOutLineLeftControl;
206766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maOutLineRightControl;
207766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maDecIndentControl;
208766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maIncIndentControl;
209766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maVertTop;
210766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maVertCenter;
211766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maVertBottom;
212766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maBulletOnOff;
213766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maNumberOnOff;
214766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maBackColorControl;
215766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  m_aMetricCtl;
216766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maBulletNumRuleIndex;
217766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maNumNumRuleIndex;
218766ce4d0SZheng Fan 
219*1e08dc4fSZheng Fan 	//i122166, the icons for numbering or bullets toolbox inside toolbar and sidebar should be the same one
220*1e08dc4fSZheng Fan 	cssu::Reference<css::frame::XFrame> mxFrame;
221*1e08dc4fSZheng Fan 	//End of i122166
222766ce4d0SZheng Fan     ::sfx2::sidebar::EnumContext maContext;
223766ce4d0SZheng Fan     SfxBindings* mpBindings;
224766ce4d0SZheng Fan 	ParaLineSpacingPopup maLineSpacePopup;
225766ce4d0SZheng Fan 	ParaBulletsPopup maBulletsPopup;
226766ce4d0SZheng Fan 	ParaNumberingPopup maNumberingPopup;
227766ce4d0SZheng Fan 	ColorPopup maBGColorPopup;
22837fee4fdSAndre Fischer     cssu::Reference<css::ui::XSidebar> mxSidebar;
22937fee4fdSAndre Fischer 
230766ce4d0SZheng Fan 
231766ce4d0SZheng Fan     ParaPropertyPanel (
232766ce4d0SZheng Fan         Window* pParent,
233766ce4d0SZheng Fan         const cssu::Reference<css::frame::XFrame>& rxFrame,
23437fee4fdSAndre Fischer         SfxBindings* pBindings,
23537fee4fdSAndre Fischer         const cssu::Reference<css::ui::XSidebar>& rxSidebar);
236766ce4d0SZheng Fan 	virtual ~ParaPropertyPanel (void);
237766ce4d0SZheng Fan 
238766ce4d0SZheng Fan 	void InitImageList(::boost::scoped_ptr<ToolBox>& rTbx, ImageList& rImglst, ImageList& rImgHlst);
239766ce4d0SZheng Fan 
240766ce4d0SZheng Fan 	DECL_LINK(AlignStyleModifyHdl_Impl, ToolBox*);
241766ce4d0SZheng Fan 	DECL_LINK(VertTbxSelectHandler, ToolBox*);
242766ce4d0SZheng Fan 	DECL_LINK(NumBTbxSelectHandler, ToolBox*);
243766ce4d0SZheng Fan 	DECL_LINK(ModifyIndentHdl_Impl, SvxRelativeField*);
244766ce4d0SZheng Fan 	DECL_LINK(ClickIndent_IncDec_Hdl_Impl, ToolBox*);
245766ce4d0SZheng Fan 	DECL_LINK(ClickProDemote_Hdl_Impl, ToolBox*);
246766ce4d0SZheng Fan 	DECL_LINK(ULSpaceHdl_Impl, SvxRelativeField*);
247766ce4d0SZheng Fan 	DECL_LINK(ClickUL_IncDec_Hdl_Impl, ToolBox*);
248766ce4d0SZheng Fan 	DECL_LINK(ImplPopupModeEndHdl, FloatingWindow* );
249766ce4d0SZheng Fan 
250766ce4d0SZheng Fan 	void VertStateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState);
251766ce4d0SZheng Fan 	void ParaBKGStateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState);
252766ce4d0SZheng Fan 	void StateChangedAlignmentImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
253766ce4d0SZheng Fan 	void StateChangedIndentImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
254766ce4d0SZheng Fan 	void StateChangedLnSPImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
255766ce4d0SZheng Fan 	void StateChangedULImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
256766ce4d0SZheng Fan 	void StateChangeOutLineImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
257766ce4d0SZheng Fan 	void StateChangeIncDecImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
25837fee4fdSAndre Fischer 	// Add toggle state for numbering and bullet icons
259766ce4d0SZheng Fan 	void StateChangeBulletNumImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
260*1e08dc4fSZheng Fan 	//Modified for Numbering&Bullets Dialog UX Enh
261*1e08dc4fSZheng Fan 	//Handing the transferred the num rule index data of the current selection
262766ce4d0SZheng Fan 	void StateChangeBulletNumRuleImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
263766ce4d0SZheng Fan 
264766ce4d0SZheng Fan 	void initial();
265766ce4d0SZheng Fan 	void ReSize(bool bSize);
266766ce4d0SZheng Fan 
267766ce4d0SZheng Fan 
268766ce4d0SZheng Fan 	PopupControl* CreateLineSpacingControl (PopupContainer* pParent);
269766ce4d0SZheng Fan 	PopupControl* CreateBulletsPopupControl (PopupContainer* pParent);
270766ce4d0SZheng Fan 	PopupControl* CreateNumberingPopupControl (PopupContainer* pParent);
271766ce4d0SZheng Fan 	PopupControl* CreateBGColorPopupControl (PopupContainer* pParent);
272766ce4d0SZheng Fan 	DECL_LINK(ClickLineSPDropDownHdl_Impl, ToolBox*);
273766ce4d0SZheng Fan 	DECL_LINK(NumBTbxDDHandler, ToolBox*);
274766ce4d0SZheng Fan 	DECL_LINK(ToolBoxBackColorDDHandler, ToolBox *);
275766ce4d0SZheng Fan 
276766ce4d0SZheng Fan 	void SetupIcons (void);
277766ce4d0SZheng Fan 	void InitToolBoxAlign();
278766ce4d0SZheng Fan 	void InitToolBoxVertAlign();
279766ce4d0SZheng Fan 	void InitToolBoxIndent();
280766ce4d0SZheng Fan 	void InitToolBoxBGColor();
281766ce4d0SZheng Fan 	void InitToolBoxBulletsNumbering();
282766ce4d0SZheng Fan 	void InitToolBoxSpacing();
283766ce4d0SZheng Fan 	void InitToolBoxLineSpacing();
284766ce4d0SZheng Fan 
285766ce4d0SZheng Fan 	void SetBGColor (const String& rsColorName, const Color aColor);
286766ce4d0SZheng Fan };
287766ce4d0SZheng Fan 
288766ce4d0SZheng Fan } } // end of namespace ::svx::sidebar
289766ce4d0SZheng Fan 
290766ce4d0SZheng Fan #endif
291766ce4d0SZheng Fan 
292