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 Rearrange(SfxItemState currSPState,FieldUnit currMetricUnit,SvxLineSpacingItem* currSPItem,const ::sfx2::sidebar::EnumContext currentContext);
47 	//virtual void Paint(const Rectangle& rect);
48 
49 	//add
50 	short GetLastCustomState();
51 	long  GetLastCustomValue();
52 	//add end
53 
54 	void ExecuteLineSpace();
55 	void SetLineSpace( SvxLineSpacingItem& rLineSpace,
56 						int eSpace, long lValue = 0 );
57 
58 	void ExecuteLineSpacing( sal_uInt16 aIsCustom, sal_uInt16 aEntry );
59 	void SetAllNoSel();
60 	void PopupModeEndCallback();
61 
62 private:
63 	bool					mbUseLineSPCustom;
64 	bool					mbLineSPDisable;
65 	SfxMapUnit                      m_eLNSpaceUnit;
66 	ParaPropertyPanel&     mrParaPropertyPanel;
67 	SfxBindings*		mpBindings;
68 
69 	long 							nMinFixDist;
70 	Edit*							pActLineDistFld;
71 
72 	ValueSetWithTextControl	maLineSpacing;
73 
74 	FixedText maCustomFT;
75 	FixedText maLSpacingFT;
76 	ListBox					        aLineDist;
77 
78 	FixedText maOfFT;
79 	MetricField			        	aLineDistAtPercentBox;
80 	MetricField	        			aLineDistAtMetricBox;
81 
82 	Image  maSpacing1;
83 	Image  maSpacing115;
84 	Image  maSpacing15;
85 	Image  maSpacing2;
86 
87 	Image  maSelSpacing1;
88 	Image  maSelSpacing115;
89 	Image  maSelSpacing15;
90 	Image  maSelSpacing2;
91 	Image  maSelSelHanging;
92 	Image				maImgCus;
93 	Image				maImgCusGrey;
94 	XubString			maStrCus;
95 
96 	Image*				mpImg;
97 	Image*				mpImgSel;
98 	XubString*			mpStr;
99 	XubString*			mpStrTip;
100 	String				maLine;
101 	String				maOf;
102 
103 	sal_Int64             maValue;
104 	sal_uInt16                maPos;
105 private:
106 	void initial();
107 	DECL_LINK(LineSPDistHdl_Impl, ListBox*);
108 	DECL_LINK(LineSPDistAtHdl_Impl, MetricField*);
109 	DECL_LINK(VSSelHdl, void*);
110 };
111 }}
112 
113 #endif
114 
115