1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 #ifndef _SVX_SIDEBAR_LINE_SPACING_CONTROL_HXX_
22 #define _SVX_SIDEBAR_LINE_SPACING_CONTROL_HXX_
23 
24 #include "svx/sidebar/PopupControl.hxx"
25 #include "svx/sidebar/ValueSetWithTextControl.hxx"
26 #include <sfx2/bindings.hxx>
27 #include <svtools/ctrlbox.hxx>
28 #include <svtools/ctrltool.hxx>
29 #include "ParaPropertyPanel.hxx"
30 #include <vcl/fixed.hxx>
31 #include <svl/poolitem.hxx>
32 #include <editeng/lspcitem.hxx>
33 #include <sfx2/sidebar/EnumContext.hxx>
34 
35 
36 namespace svx { namespace sidebar {
37 
38 #define LSP_POS_GLOBAL_VALUE	String("Line_Spacing_Pos", 16, RTL_TEXTENCODING_ASCII_US)
39 #define LSP_LV_GLOBAL_VALUE	    String("Line_Spacing_Lv", 15, RTL_TEXTENCODING_ASCII_US)
40 #define BEGIN_VALUE            28
41 class ParaLineSpacingControl:public svx::sidebar::PopupControl
42 {
43 public:
44 	ParaLineSpacingControl(Window* pParent, svx::sidebar::ParaPropertyPanel& rPanel);
45 	~ParaLineSpacingControl();
46 	void ToGetFocus(bool bType);
47 	void Rearrange(SfxItemState currSPState,FieldUnit currMetricUnit,SvxLineSpacingItem* currSPItem,const ::sfx2::sidebar::EnumContext currentContext);
48 	//virtual void Paint(const Rectangle& rect);
49 
50 	//add
51 	short GetLastCustomState();
52 	long  GetLastCustomValue();
53 	//add end
54 
55 	void ExecuteLineSpace();
56 	void SetLineSpace( SvxLineSpacingItem& rLineSpace,
57 						int eSpace, long lValue = 0 );
58 
59 	void ExecuteLineSpacing( sal_uInt16 aIsCustom, sal_uInt16 aEntry );
60 	void SetAllNoSel();
61 	void PopupModeEndCallback();
62 
63 private:
64 	bool					mbUseLineSPCustom;
65 	bool					mbLineSPDisable;
66 	SfxMapUnit                      m_eLNSpaceUnit;
67 	ParaPropertyPanel&     mrParaPropertyPanel;
68 	SfxBindings*		mpBindings;
69 
70 	long 							nMinFixDist;
71 	Edit*							pActLineDistFld;
72 
73 	ValueSetWithTextControl	maLineSpacing;
74 
75 	FixedText maCustomFT;
76 	FixedText maLSpacingFT;
77 	ListBox					        aLineDist;
78 
79 	FixedText maOfFT;
80 	MetricField			        	aLineDistAtPercentBox;
81 	MetricField	        			aLineDistAtMetricBox;
82 
83 	Image  maSpacing1;
84 	Image  maSpacing115;
85 	Image  maSpacing15;
86 	Image  maSpacing2;
87 	Image  maLPCustom;
88 
89 	Image  maSelSpacing1;
90 	Image  maSelSpacing115;
91 	Image  maSelSpacing15;
92 	Image  maSelSpacing2;
93 	Image  maSelSelHanging;
94 	Image				maImgCus;
95 	Image				maImgCusGrey;
96 	XubString			maStrCus;
97 
98 	Image*				mpImg;
99 	Image*				mpImgSel;
100 	XubString*			mpStr;
101 	XubString*			mpStrTip;
102 	String				maLine;
103 	String				maOf;
104 
105 	sal_Int64             maValue;
106 	sal_uInt16                maPos;
107 private:
108 	void initial();
109 	DECL_LINK(LineSPDistHdl_Impl, ListBox*);
110 	DECL_LINK(LineSPDistAtHdl_Impl, MetricField*);
111 	DECL_LINK(VSSelHdl, void*);
112 };
113 }}
114 
115 #endif
116 
117