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>
28*6a606da0SAndre Fischer #include <sfx2/sidebar/GridLayouter.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 
3637fee4fdSAndre Fischer #include <com/sun/star/frame/XFrame.hpp>
3737fee4fdSAndre Fischer #include <com/sun/star/ui/XSidebar.hpp>
38766ce4d0SZheng Fan 
39766ce4d0SZheng Fan #include <boost/scoped_ptr.hpp>
40766ce4d0SZheng Fan 
41766ce4d0SZheng Fan #include <svx/sidebar/ColorPopup.hxx>
42766ce4d0SZheng Fan #include <vcl/vclenum.hxx>
43766ce4d0SZheng Fan #include <vcl/fixed.hxx>
44766ce4d0SZheng Fan #include <svl/poolitem.hxx>
45766ce4d0SZheng Fan #include <tools/fldunit.hxx>
46766ce4d0SZheng Fan 
47766ce4d0SZheng Fan #include "ParaBulletsPopup.hxx"
485e9e28d9SOliver-Rainer Wittmann #include "ParaNumberingPopup.hxx"
49766ce4d0SZheng Fan #include "ParaLineSpacingPopup.hxx"
50766ce4d0SZheng Fan 
51766ce4d0SZheng Fan class FloatingWindow;
52766ce4d0SZheng Fan class ToolBox;
53766ce4d0SZheng Fan 
5437fee4fdSAndre Fischer namespace css = ::com::sun::star;
5537fee4fdSAndre Fischer namespace cssu = ::com::sun::star::uno;
5637fee4fdSAndre Fischer 
5737fee4fdSAndre Fischer 
58766ce4d0SZheng Fan namespace svx { namespace sidebar {
59766ce4d0SZheng Fan 
60766ce4d0SZheng Fan class PopupControl;
61766ce4d0SZheng Fan class PopupContainer;
62766ce4d0SZheng Fan 
63766ce4d0SZheng Fan class ParaPropertyPanel
64766ce4d0SZheng Fan     : public Control,
65766ce4d0SZheng Fan       public ::sfx2::sidebar::IContextChangeReceiver,
66766ce4d0SZheng Fan       public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
67766ce4d0SZheng Fan {
68766ce4d0SZheng Fan public:
69766ce4d0SZheng Fan     static ParaPropertyPanel* Create (
70766ce4d0SZheng Fan         Window* pParent,
71766ce4d0SZheng Fan         const cssu::Reference<css::frame::XFrame>& rxFrame,
7237fee4fdSAndre Fischer         SfxBindings* pBindings,
7337fee4fdSAndre Fischer         const cssu::Reference<css::ui::XSidebar>& rxSidebar);
74766ce4d0SZheng Fan 
75766ce4d0SZheng Fan 	virtual void DataChanged (const DataChangedEvent& rEvent);
76766ce4d0SZheng Fan 	SfxBindings* GetBindings();
77766ce4d0SZheng Fan 
78766ce4d0SZheng Fan 	virtual void HandleContextChange (
79766ce4d0SZheng Fan 	    const ::sfx2::sidebar::EnumContext aContext);
80766ce4d0SZheng Fan 
81766ce4d0SZheng Fan 	virtual void NotifyItemUpdate(
82766ce4d0SZheng Fan 	    const sal_uInt16 nSId,
83766ce4d0SZheng Fan 	    const SfxItemState eState,
8445da7d5eSAndre Fischer 	    const SfxPoolItem* pState,
8545da7d5eSAndre Fischer         const bool bIsEnabled);
86766ce4d0SZheng Fan 
87766ce4d0SZheng Fan 	void ShowMenu (void);
GetBulletTypeIndex()8837fee4fdSAndre Fischer 	sal_uInt16 GetBulletTypeIndex(){ return mnBulletTypeIndex; }
GetNumTypeIndex()8937fee4fdSAndre Fischer 	sal_uInt16 GetNumTypeIndex(){ return mnNumTypeIndex; }
90766ce4d0SZheng Fan 	FieldUnit GetCurrentUnit( SfxItemState eState, const SfxPoolItem* pState );
91766ce4d0SZheng Fan 
92766ce4d0SZheng Fan 	void EndSpacingPopupMode (void);
93766ce4d0SZheng Fan 	void EndBulletsPopupMode (void);
94766ce4d0SZheng Fan 	void EndNumberingPopupMode (void);
95766ce4d0SZheng Fan 
96766ce4d0SZheng Fan private:
97766ce4d0SZheng Fan 	/**********************************************************
98766ce4d0SZheng Fan 	 **
99766ce4d0SZheng Fan 	 ** UI controls
100766ce4d0SZheng Fan 	 **
101766ce4d0SZheng Fan 	***********************************************************/
102766ce4d0SZheng Fan 	//Alignment
103b6ab65a3SAndre Fischer 	::boost::scoped_ptr<Window> 			mpAlignToolBoxBackground;
104b6ab65a3SAndre Fischer 	::boost::scoped_ptr<ToolBox>			mpAlignToolBox;
105b6ab65a3SAndre Fischer 	::boost::scoped_ptr<Window> 			mpTBxVertAlignBackground;
106b6ab65a3SAndre Fischer 	::boost::scoped_ptr<ToolBox>			mpTBxVertAlign;
107766ce4d0SZheng Fan 	//NumBullet&Backcolor
108b6ab65a3SAndre Fischer 	::boost::scoped_ptr<Window> 			mpTBxNumBulletBackground;
109b6ab65a3SAndre Fischer 	::boost::scoped_ptr<ToolBox>			mpTBxNumBullet;
110b6ab65a3SAndre Fischer 	::boost::scoped_ptr<Window> 			mpTBxBackColorBackground;
111b6ab65a3SAndre Fischer 	::boost::scoped_ptr<ToolBox>			mpTBxBackColor;
112766ce4d0SZheng Fan 	//Paragraph spacing
113b6ab65a3SAndre Fischer 	::boost::scoped_ptr<FixedText>			mpFTUL;
114b6ab65a3SAndre Fischer 	::boost::scoped_ptr<Window> 			mpTbxUL_IncDecBackground;
115b6ab65a3SAndre Fischer 	::boost::scoped_ptr<ToolBox>			mpTbxUL_IncDec;
116b6ab65a3SAndre Fischer     ::boost::scoped_ptr<SvxRelativeField>	mpTopDist;
117b6ab65a3SAndre Fischer 	::boost::scoped_ptr<SvxRelativeField>	mpBottomDist;
118b6ab65a3SAndre Fischer 	::boost::scoped_ptr<Window> 			mpLineSPTbxBackground;
119b6ab65a3SAndre Fischer 	::boost::scoped_ptr<ToolBox>			mpLineSPTbx;
120b6ab65a3SAndre Fischer     ::boost::scoped_ptr<FixedText>			mpFTIndent;
121b6ab65a3SAndre Fischer 	::boost::scoped_ptr<Window> 			mpTbxIndent_IncDecBackground;
122b6ab65a3SAndre Fischer 	::boost::scoped_ptr<ToolBox>			mpTbxIndent_IncDec;
123b6ab65a3SAndre Fischer 	::boost::scoped_ptr<Window> 			mpTbxProDemoteBackground;
124b6ab65a3SAndre Fischer 	::boost::scoped_ptr<ToolBox>			mpTbxProDemote;
125b6ab65a3SAndre Fischer     ::boost::scoped_ptr<SvxRelativeField>	mpLeftIndent;
126b6ab65a3SAndre Fischer     ::boost::scoped_ptr<SvxRelativeField>	mpRightIndent;
127b6ab65a3SAndre Fischer 	::boost::scoped_ptr<SvxRelativeField>	mpFLineIndent;
128b6ab65a3SAndre Fischer 
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  maIndHang;
150766ce4d0SZheng Fan 
151766ce4d0SZheng Fan 	ImageList	maNumBImageList;
152766ce4d0SZheng Fan 	ImageList	maNumBImageListH;
15337fee4fdSAndre Fischer 	ImageList	maNumBImageListRTL;
154766ce4d0SZheng Fan 	Image		maImgBackColorHigh;
155766ce4d0SZheng Fan 	Image		maImgBackColor;
156766ce4d0SZheng Fan 
157766ce4d0SZheng Fan 	/****************************************************************
158766ce4d0SZheng Fan 	**
159766ce4d0SZheng Fan 	** Data Member
160766ce4d0SZheng Fan 	**
161766ce4d0SZheng Fan 	*****************************************************************/
162766ce4d0SZheng Fan 	long				maTxtLeft;
163766ce4d0SZheng Fan 	//Line spacing
164766ce4d0SZheng Fan 	SvxLineSpacingItem	*mpLnSPItem;
165766ce4d0SZheng Fan 	SfxItemState			meLnSpState;
166766ce4d0SZheng Fan 	bool					mbOutLineLeft;
167766ce4d0SZheng Fan 	bool					mbOutLineRight;
168766ce4d0SZheng Fan 	long					maUpper;
169766ce4d0SZheng Fan 	long					maLower;
170766ce4d0SZheng Fan 
17137fee4fdSAndre Fischer 	sal_uInt16			mnBulletTypeIndex;
17237fee4fdSAndre Fischer 	sal_uInt16			mnNumTypeIndex;
173766ce4d0SZheng Fan 	Color				maColor;
174766ce4d0SZheng Fan 	bool					mbColorAvailable;
175766ce4d0SZheng Fan 	FieldUnit						m_eMetricUnit;
176766ce4d0SZheng Fan 	FieldUnit						m_last_eMetricUnit;
177766ce4d0SZheng Fan 	SfxMapUnit                      m_eLRSpaceUnit;
178766ce4d0SZheng Fan 	SfxMapUnit                      m_eULSpaceUnit;
179766ce4d0SZheng Fan 	/****************************************************************
180766ce4d0SZheng Fan 	**
18137fee4fdSAndre Fischer 	** Controll Items
182766ce4d0SZheng Fan 	**
183766ce4d0SZheng Fan 	*****************************************************************/
184766ce4d0SZheng Fan 
185766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maLeftAlignControl;
186766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maCenterAlignControl;
187766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maRightAlignControl;
188766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maJustifyAlignControl;
189766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maLRSpaceControl;
190766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maLNSpaceControl;
191766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maULSpaceControl;
192766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maOutLineLeftControl;
193766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maOutLineRightControl;
194766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maDecIndentControl;
195766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maIncIndentControl;
196766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maVertTop;
197766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maVertCenter;
198766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maVertBottom;
199766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maBulletOnOff;
200766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maNumberOnOff;
201766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maBackColorControl;
202766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  m_aMetricCtl;
203766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maBulletNumRuleIndex;
204766ce4d0SZheng Fan 	::sfx2::sidebar::ControllerItem  maNumNumRuleIndex;
205766ce4d0SZheng Fan 
2063c37ea99SAriel Constenla-Haile     cssu::Reference<css::frame::XFrame> mxFrame;
207766ce4d0SZheng Fan     ::sfx2::sidebar::EnumContext maContext;
208766ce4d0SZheng Fan     SfxBindings* mpBindings;
209766ce4d0SZheng Fan 	ParaLineSpacingPopup maLineSpacePopup;
210766ce4d0SZheng Fan 	ParaBulletsPopup maBulletsPopup;
211766ce4d0SZheng Fan 	ParaNumberingPopup maNumberingPopup;
212766ce4d0SZheng Fan 	ColorPopup maBGColorPopup;
21337fee4fdSAndre Fischer     cssu::Reference<css::ui::XSidebar> mxSidebar;
214*6a606da0SAndre Fischer     ::sfx2::sidebar::GridLayouter maLayouter;
215766ce4d0SZheng Fan 
216766ce4d0SZheng Fan     ParaPropertyPanel (
217766ce4d0SZheng Fan         Window* pParent,
218766ce4d0SZheng Fan         const cssu::Reference<css::frame::XFrame>& rxFrame,
21937fee4fdSAndre Fischer         SfxBindings* pBindings,
22037fee4fdSAndre Fischer         const cssu::Reference<css::ui::XSidebar>& rxSidebar);
221766ce4d0SZheng Fan 	virtual ~ParaPropertyPanel (void);
222766ce4d0SZheng Fan 
223766ce4d0SZheng Fan 	void InitImageList(::boost::scoped_ptr<ToolBox>& rTbx, ImageList& rImglst, ImageList& rImgHlst);
224766ce4d0SZheng Fan 
225766ce4d0SZheng Fan 	DECL_LINK(AlignStyleModifyHdl_Impl, ToolBox*);
226766ce4d0SZheng Fan 	DECL_LINK(VertTbxSelectHandler, ToolBox*);
227766ce4d0SZheng Fan 	DECL_LINK(NumBTbxSelectHandler, ToolBox*);
228766ce4d0SZheng Fan 	DECL_LINK(ModifyIndentHdl_Impl, SvxRelativeField*);
229766ce4d0SZheng Fan 	DECL_LINK(ClickIndent_IncDec_Hdl_Impl, ToolBox*);
230766ce4d0SZheng Fan 	DECL_LINK(ClickProDemote_Hdl_Impl, ToolBox*);
231766ce4d0SZheng Fan 	DECL_LINK(ULSpaceHdl_Impl, SvxRelativeField*);
232766ce4d0SZheng Fan 	DECL_LINK(ClickUL_IncDec_Hdl_Impl, ToolBox*);
233766ce4d0SZheng Fan 	DECL_LINK(ImplPopupModeEndHdl, FloatingWindow* );
234766ce4d0SZheng Fan 
235766ce4d0SZheng Fan 	void VertStateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState);
236766ce4d0SZheng Fan 	void ParaBKGStateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState);
237766ce4d0SZheng Fan 	void StateChangedAlignmentImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
238766ce4d0SZheng Fan 	void StateChangedIndentImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
239766ce4d0SZheng Fan 	void StateChangedLnSPImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
240766ce4d0SZheng Fan 	void StateChangedULImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
241766ce4d0SZheng Fan 	void StateChangeOutLineImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
242766ce4d0SZheng Fan 	void StateChangeIncDecImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
24337fee4fdSAndre Fischer 	// Add toggle state for numbering and bullet icons
244766ce4d0SZheng Fan 	void StateChangeBulletNumImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
2451e08dc4fSZheng Fan 	//Modified for Numbering&Bullets Dialog UX Enh
2461e08dc4fSZheng Fan 	//Handing the transferred the num rule index data of the current selection
247766ce4d0SZheng Fan 	void StateChangeBulletNumRuleImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
248766ce4d0SZheng Fan 
249766ce4d0SZheng Fan 	void initial();
250766ce4d0SZheng Fan 	void ReSize(bool bSize);
251766ce4d0SZheng Fan 
252*6a606da0SAndre Fischer     // Inherited from vcl Window.
253*6a606da0SAndre Fischer     virtual void Resize (void);
254766ce4d0SZheng Fan 
255766ce4d0SZheng Fan 	PopupControl* CreateLineSpacingControl (PopupContainer* pParent);
256766ce4d0SZheng Fan 	PopupControl* CreateBulletsPopupControl (PopupContainer* pParent);
257766ce4d0SZheng Fan 	PopupControl* CreateNumberingPopupControl (PopupContainer* pParent);
258766ce4d0SZheng Fan 	PopupControl* CreateBGColorPopupControl (PopupContainer* pParent);
259766ce4d0SZheng Fan 	DECL_LINK(ClickLineSPDropDownHdl_Impl, ToolBox*);
260766ce4d0SZheng Fan 	DECL_LINK(NumBTbxDDHandler, ToolBox*);
261766ce4d0SZheng Fan 	DECL_LINK(ToolBoxBackColorDDHandler, ToolBox *);
262766ce4d0SZheng Fan 
263766ce4d0SZheng Fan 	void InitToolBoxAlign();
264766ce4d0SZheng Fan 	void InitToolBoxVertAlign();
265766ce4d0SZheng Fan 	void InitToolBoxIndent();
266766ce4d0SZheng Fan 	void InitToolBoxBGColor();
267766ce4d0SZheng Fan 	void InitToolBoxBulletsNumbering();
268766ce4d0SZheng Fan 	void InitToolBoxSpacing();
269766ce4d0SZheng Fan 	void InitToolBoxLineSpacing();
270766ce4d0SZheng Fan 
271766ce4d0SZheng Fan 	void SetBGColor (const String& rsColorName, const Color aColor);
272766ce4d0SZheng Fan };
273766ce4d0SZheng Fan 
274766ce4d0SZheng Fan } } // end of namespace ::svx::sidebar
275766ce4d0SZheng Fan 
276766ce4d0SZheng Fan #endif
277766ce4d0SZheng Fan 
278