xref: /AOO41X/main/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx (revision fe617e93560c0575040cf13b538ba840fa9e2479)
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 
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     Image  maLPCustom;
87 
88     Image  maSelSpacing1;
89     Image  maSelSpacing115;
90     Image  maSelSpacing15;
91     Image  maSelSpacing2;
92     Image  maSelSelHanging;
93     Image               maImgCus;
94     Image               maImgCusGrey;
95     XubString           maStrCus;
96 
97     Image*              mpImg;
98     Image*              mpImgSel;
99     XubString*          mpStr;
100     XubString*          mpStrTip;
101     String              maLine;
102     String              maOf;
103 
104     sal_Int64             maValue;
105     sal_uInt16                maPos;
106 private:
107     void initial();
108     DECL_LINK(LineSPDistHdl_Impl, ListBox*);
109     DECL_LINK(LineSPDistAtHdl_Impl, MetricField*);
110     DECL_LINK(VSSelHdl, void*);
111 };
112 }}
113 
114 #endif
115 
116