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
22766ce4d0SZheng Fan #include "precompiled_svx.hxx"
23766ce4d0SZheng Fan #include "ParaLineSpacingControl.hxx"
24766ce4d0SZheng Fan #include "ParaPropertyPanel.hrc"
25d29c2fc2SAndre Fischer #include <sfx2/sidebar/ResourceDefinitions.hrc>
26766ce4d0SZheng Fan #include <svx/dialogs.hrc>
27766ce4d0SZheng Fan #include <svx/dialmgr.hxx>
28766ce4d0SZheng Fan #include <unotools/viewoptions.hxx>
29766ce4d0SZheng Fan #include <editeng/kernitem.hxx>
30766ce4d0SZheng Fan #include <sfx2/bindings.hxx>
31766ce4d0SZheng Fan #include <sfx2/dispatch.hxx>
32766ce4d0SZheng Fan #include <sfx2/sidebar/Theme.hxx>
33766ce4d0SZheng Fan #include <svtools/unitconv.hxx>
34766ce4d0SZheng Fan
35766ce4d0SZheng Fan #define _DEFAULT_LINE_SPACING 200
36766ce4d0SZheng Fan #define FIX_DIST_DEF 283
37766ce4d0SZheng Fan #define LINESPACE_1 100
38766ce4d0SZheng Fan #define LINESPACE_15 150
39766ce4d0SZheng Fan #define LINESPACE_2 200
40766ce4d0SZheng Fan #define LINESPACE_115 115
41766ce4d0SZheng Fan
42766ce4d0SZheng Fan #define LLINESPACE_1 0
43766ce4d0SZheng Fan #define LLINESPACE_15 1
44766ce4d0SZheng Fan #define LLINESPACE_2 2
45766ce4d0SZheng Fan #define LLINESPACE_PROP 3
46766ce4d0SZheng Fan #define LLINESPACE_MIN 4
47766ce4d0SZheng Fan #define LLINESPACE_DURCH 5
48766ce4d0SZheng Fan #define LLINESPACE_FIX 6
49766ce4d0SZheng Fan
50766ce4d0SZheng Fan #define DO_NOT_CUSTOM 0
51766ce4d0SZheng Fan #define USE_CUSTOM 1
52766ce4d0SZheng Fan
53766ce4d0SZheng Fan namespace svx { namespace sidebar {
54766ce4d0SZheng Fan
55766ce4d0SZheng Fan
ParaLineSpacingControl(Window * pParent,svx::sidebar::ParaPropertyPanel & rPanel)56766ce4d0SZheng Fan ParaLineSpacingControl::ParaLineSpacingControl(Window* pParent, svx::sidebar::ParaPropertyPanel& rPanel)
57*d0c67063SPavel Janík : PopupControl( pParent,SVX_RES(RID_POPUPPANEL_PARAPAGE_LINESPACING)),
58*d0c67063SPavel Janík mbUseLineSPCustom (0),
59*d0c67063SPavel Janík mbLineSPDisable (0),
60*d0c67063SPavel Janík mrParaPropertyPanel (rPanel),
61*d0c67063SPavel Janík mpBindings (NULL),
62*d0c67063SPavel Janík nMinFixDist (BEGIN_VALUE),
63*d0c67063SPavel Janík pActLineDistFld (&aLineDistAtPercentBox),
64*d0c67063SPavel Janík maLineSpacing (ValueSetWithTextControl::IMAGE_TEXT,this, SVX_RES(LINE_SPACING)),
65*d0c67063SPavel Janík maCustomFT (this, SVX_RES(FT_CUSTOM)),
66*d0c67063SPavel Janík maLSpacingFT (this, SVX_RES(FT_LINE_SPACING)),
67*d0c67063SPavel Janík aLineDist (this, SVX_RES(LB_LINE_SPACING)),
68*d0c67063SPavel Janík maOfFT (this, SVX_RES(FT_OF)),
69*d0c67063SPavel Janík aLineDistAtPercentBox (this, SVX_RES(ED_SBINDE_LINEDISTPERCENT)),
70*d0c67063SPavel Janík aLineDistAtMetricBox (this, SVX_RES(ED_SBINDE_LINEDISTPOINT)),
71*d0c67063SPavel Janík maSpacing1 (SVX_RES(IMG_SPACING1)),
72*d0c67063SPavel Janík maSpacing115 (SVX_RES(IMG_SPACING115)),
73*d0c67063SPavel Janík maSpacing15 (SVX_RES(IMG_SPACING15)),
74*d0c67063SPavel Janík maSpacing2 (SVX_RES(IMG_SPACING2)),
75*d0c67063SPavel Janík maSelSpacing1 (SVX_RES(IMG_SEL_SPACING1)),
76*d0c67063SPavel Janík maSelSpacing115 (SVX_RES(IMG_SEL_SPACING115)),
77*d0c67063SPavel Janík maSelSpacing15 (SVX_RES(IMG_SEL_SPACING15)),
78*d0c67063SPavel Janík maSelSpacing2 (SVX_RES(IMG_SEL_SPACING2)),
79*d0c67063SPavel Janík maImgCus (SVX_RES(IMG_CUSTOM)),
80*d0c67063SPavel Janík maImgCusGrey (SVX_RES(IMG_CUSTOM_GRAY)),
81*d0c67063SPavel Janík maStrCus (SVX_RES(STR_LCVALUE)),
82*d0c67063SPavel Janík mpImg (NULL),
83*d0c67063SPavel Janík mpImgSel (NULL),
84*d0c67063SPavel Janík mpStr (NULL),
85*d0c67063SPavel Janík mpStrTip (NULL),
86*d0c67063SPavel Janík maLine (SVX_RES(STR_LSPACING)),
87*d0c67063SPavel Janík maOf (SVX_RES(STR_LS_OF)),
88*d0c67063SPavel Janík maValue (0),
89*d0c67063SPavel Janík maPos (0)
90766ce4d0SZheng Fan {
91766ce4d0SZheng Fan initial();
92766ce4d0SZheng Fan FreeResource();
93766ce4d0SZheng Fan mpBindings = mrParaPropertyPanel.GetBindings();
94766ce4d0SZheng Fan // m_eLNSpaceUnit = mrParaPropertyPanel.maLNSpaceControl.GetCoreMetric();
95766ce4d0SZheng Fan m_eLNSpaceUnit = SFX_MAPUNIT_100TH_MM;
96766ce4d0SZheng Fan }
~ParaLineSpacingControl()97766ce4d0SZheng Fan ParaLineSpacingControl::~ParaLineSpacingControl()
98766ce4d0SZheng Fan {
99766ce4d0SZheng Fan delete[] mpImg;
100766ce4d0SZheng Fan delete[] mpImgSel;
101766ce4d0SZheng Fan delete[] mpStr;
102766ce4d0SZheng Fan delete[] mpStrTip;
103766ce4d0SZheng Fan }
104766ce4d0SZheng Fan
initial()105766ce4d0SZheng Fan void ParaLineSpacingControl::initial()
106766ce4d0SZheng Fan {
1073fca590bSOliver-Rainer Wittmann maLineSpacing.SetStyle( maLineSpacing.GetStyle()| WB_3DLOOK | WB_NO_DIRECTSELECT );
1083fca590bSOliver-Rainer Wittmann
1093fca590bSOliver-Rainer Wittmann maLineSpacing.SetControlBackground(
1103fca590bSOliver-Rainer Wittmann GetSettings().GetStyleSettings().GetHighContrastMode()
1113fca590bSOliver-Rainer Wittmann ? GetSettings().GetStyleSettings().GetMenuColor()
1123fca590bSOliver-Rainer Wittmann : sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ));
1133fca590bSOliver-Rainer Wittmann maLineSpacing.SetColor(
1143fca590bSOliver-Rainer Wittmann GetSettings().GetStyleSettings().GetHighContrastMode()
1153fca590bSOliver-Rainer Wittmann ? GetSettings().GetStyleSettings().GetMenuColor()
1163fca590bSOliver-Rainer Wittmann : sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ));
1173fca590bSOliver-Rainer Wittmann maLineSpacing.SetBackground(
1183fca590bSOliver-Rainer Wittmann GetSettings().GetStyleSettings().GetHighContrastMode()
1193fca590bSOliver-Rainer Wittmann ? GetSettings().GetStyleSettings().GetMenuColor()
1203fca590bSOliver-Rainer Wittmann : sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ));
1213fca590bSOliver-Rainer Wittmann
1223fca590bSOliver-Rainer Wittmann mpImg = new Image[4];
1233fca590bSOliver-Rainer Wittmann mpImg[0] = maSpacing1;
1243fca590bSOliver-Rainer Wittmann mpImg[1] = maSpacing115;
1253fca590bSOliver-Rainer Wittmann mpImg[2] = maSpacing15;
1263fca590bSOliver-Rainer Wittmann mpImg[3] = maSpacing2;
1273fca590bSOliver-Rainer Wittmann
1283fca590bSOliver-Rainer Wittmann mpImgSel = new Image[4];
1293fca590bSOliver-Rainer Wittmann mpImgSel[0] = maSelSpacing1;
1303fca590bSOliver-Rainer Wittmann mpImgSel[1] = maSelSpacing115;
1313fca590bSOliver-Rainer Wittmann mpImgSel[2] = maSelSpacing15;
1323fca590bSOliver-Rainer Wittmann mpImgSel[3] = maSelSpacing2;
1333fca590bSOliver-Rainer Wittmann
1343fca590bSOliver-Rainer Wittmann mpStr = new XubString[4];
1353fca590bSOliver-Rainer Wittmann mpStr[0] = XubString(SVX_RES(STR_SPACING1));
1363fca590bSOliver-Rainer Wittmann mpStr[1] = XubString(SVX_RES(STR_SPACING115));
1373fca590bSOliver-Rainer Wittmann mpStr[2] = XubString(SVX_RES(STR_SPACING15));
1383fca590bSOliver-Rainer Wittmann mpStr[3] = XubString(SVX_RES(STR_SPACING2));
1393fca590bSOliver-Rainer Wittmann
1403fca590bSOliver-Rainer Wittmann mpStrTip = new XubString[4];
1413fca590bSOliver-Rainer Wittmann mpStrTip[0] = XubString(SVX_RES(STR_LS_SINGLE));
1423fca590bSOliver-Rainer Wittmann mpStrTip[1] = XubString(SVX_RES(STR_LS_115));
1433fca590bSOliver-Rainer Wittmann mpStrTip[2] = XubString(SVX_RES(STR_LS_15));
1443fca590bSOliver-Rainer Wittmann mpStrTip[3] = XubString(SVX_RES(STR_LS_DOUBLE));
1453fca590bSOliver-Rainer Wittmann for (int i=0;i<4;i++)
1463fca590bSOliver-Rainer Wittmann maLineSpacing.AddItem(mpImg[i], &mpImgSel[i],mpStr[i],&mpStrTip[i]);
1473fca590bSOliver-Rainer Wittmann
1483fca590bSOliver-Rainer Wittmann maLineSpacing.AddItem( maImgCus, 0, maStrCus, 0 );
1493fca590bSOliver-Rainer Wittmann
1503fca590bSOliver-Rainer Wittmann SetAllNoSel();
1513fca590bSOliver-Rainer Wittmann Link aLink = LINK(this, ParaLineSpacingControl,VSSelHdl );
1523fca590bSOliver-Rainer Wittmann maLineSpacing.SetSelectHdl(aLink);
1533fca590bSOliver-Rainer Wittmann maLineSpacing.StartSelection();
1543fca590bSOliver-Rainer Wittmann maLineSpacing.Show();
1553fca590bSOliver-Rainer Wittmann
1563fca590bSOliver-Rainer Wittmann aLink = LINK( this, ParaLineSpacingControl, LineSPDistHdl_Impl );
1573fca590bSOliver-Rainer Wittmann aLineDist.SetSelectHdl(aLink);
1583fca590bSOliver-Rainer Wittmann aLineDist.SelectEntryPos( LLINESPACE_1 ) ;
1593fca590bSOliver-Rainer Wittmann aLink = LINK( this, ParaLineSpacingControl, LineSPDistAtHdl_Impl );
1603fca590bSOliver-Rainer Wittmann aLineDistAtPercentBox.SetModifyHdl( aLink );
1613fca590bSOliver-Rainer Wittmann aLineDistAtMetricBox.SetModifyHdl( aLink );
162766ce4d0SZheng Fan }
163766ce4d0SZheng Fan
1643fca590bSOliver-Rainer Wittmann
PopupModeEndCallback()165766ce4d0SZheng Fan void ParaLineSpacingControl::PopupModeEndCallback()
166766ce4d0SZheng Fan {
167766ce4d0SZheng Fan if( mbUseLineSPCustom )
168766ce4d0SZheng Fan {
169766ce4d0SZheng Fan //maLinePos = mpLineSPPage->maPos;
170766ce4d0SZheng Fan //maLineValue = mpLineSPPage->maValue;
171766ce4d0SZheng Fan
172766ce4d0SZheng Fan SvtViewOptions aWinOpt( E_WINDOW, LSP_POS_GLOBAL_VALUE );
173766ce4d0SZheng Fan ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq(1);
174766ce4d0SZheng Fan aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("maLinePos") );
175766ce4d0SZheng Fan aSeq[0].Value <<= ::rtl::OUString( String::CreateFromInt64( maPos ));
176766ce4d0SZheng Fan aWinOpt.SetUserData( aSeq );
177766ce4d0SZheng Fan
178766ce4d0SZheng Fan SvtViewOptions aWinOpt2( E_WINDOW, LSP_LV_GLOBAL_VALUE );
179766ce4d0SZheng Fan aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("maLineValue") );
180766ce4d0SZheng Fan aSeq[0].Value <<= ::rtl::OUString( String::CreateFromInt64( maValue ));
181766ce4d0SZheng Fan aWinOpt2.SetUserData( aSeq );
182766ce4d0SZheng Fan }
183766ce4d0SZheng Fan }
184766ce4d0SZheng Fan
Rearrange(SfxItemState currSPState,FieldUnit currMetricUnit,SvxLineSpacingItem * currSPItem,const::sfx2::sidebar::EnumContext currentContext)185766ce4d0SZheng Fan void ParaLineSpacingControl::Rearrange(SfxItemState currSPState,FieldUnit currMetricUnit,SvxLineSpacingItem* currSPItem,const ::sfx2::sidebar::EnumContext currentContext)
186766ce4d0SZheng Fan {
187766ce4d0SZheng Fan SvtViewOptions aWinOpt( E_WINDOW, LSP_POS_GLOBAL_VALUE );
188766ce4d0SZheng Fan if ( aWinOpt.Exists() )
189766ce4d0SZheng Fan {
190766ce4d0SZheng Fan ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq = aWinOpt.GetUserData();
191766ce4d0SZheng Fan ::rtl::OUString aTmp;
192766ce4d0SZheng Fan if ( aSeq.getLength())
193766ce4d0SZheng Fan aSeq[0].Value >>= aTmp;
194766ce4d0SZheng Fan
195766ce4d0SZheng Fan String aWinData( aTmp );
196766ce4d0SZheng Fan maPos = (sal_uInt16)aWinData.ToInt32();
197766ce4d0SZheng Fan }
198766ce4d0SZheng Fan
199766ce4d0SZheng Fan SvtViewOptions aWinOpt2( E_WINDOW, LSP_LV_GLOBAL_VALUE );
200766ce4d0SZheng Fan if ( aWinOpt2.Exists() )
201766ce4d0SZheng Fan {
202766ce4d0SZheng Fan ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq = aWinOpt2.GetUserData();
203766ce4d0SZheng Fan ::rtl::OUString aTmp;
204766ce4d0SZheng Fan if ( aSeq.getLength())
205766ce4d0SZheng Fan aSeq[0].Value >>= aTmp;
206766ce4d0SZheng Fan
207766ce4d0SZheng Fan String aWinData( aTmp );
208766ce4d0SZheng Fan maValue = (sal_uInt16)aWinData.ToInt32();
209766ce4d0SZheng Fan }
210766ce4d0SZheng Fan String sHelpText;
211766ce4d0SZheng Fan switch(maPos)
212766ce4d0SZheng Fan {
213766ce4d0SZheng Fan case LLINESPACE_1:
214766ce4d0SZheng Fan sHelpText += mpStrTip[0];
215766ce4d0SZheng Fan break;
216766ce4d0SZheng Fan case LLINESPACE_15:
217766ce4d0SZheng Fan sHelpText += mpStrTip[2];
218766ce4d0SZheng Fan break;
219766ce4d0SZheng Fan case LLINESPACE_2:
220766ce4d0SZheng Fan sHelpText += mpStrTip[3];
221766ce4d0SZheng Fan break;
222766ce4d0SZheng Fan case LLINESPACE_PROP:
223766ce4d0SZheng Fan sHelpText +=maLine;
224766ce4d0SZheng Fan sHelpText.Append(String("Proportion: ", 12, RTL_TEXTENCODING_ASCII_US));
225766ce4d0SZheng Fan sHelpText += maOf;
226766ce4d0SZheng Fan sHelpText.Append( String::CreateFromInt64( maValue ));
227766ce4d0SZheng Fan break;
228766ce4d0SZheng Fan case LLINESPACE_MIN:
229766ce4d0SZheng Fan sHelpText += maLine;
230766ce4d0SZheng Fan sHelpText.Append(String("At Least: ", 10, RTL_TEXTENCODING_ASCII_US));
231766ce4d0SZheng Fan sHelpText += maOf;
232766ce4d0SZheng Fan sHelpText.Append( String::CreateFromInt64( maValue ));
233766ce4d0SZheng Fan break;
234766ce4d0SZheng Fan case LLINESPACE_DURCH:
235766ce4d0SZheng Fan sHelpText += maLine;
236766ce4d0SZheng Fan sHelpText.Append(String("Leading: ", 9, RTL_TEXTENCODING_ASCII_US));
237766ce4d0SZheng Fan sHelpText += maOf;
238766ce4d0SZheng Fan sHelpText.Append( String::CreateFromInt64( maValue ));
239766ce4d0SZheng Fan break;
240766ce4d0SZheng Fan case LLINESPACE_FIX:
241766ce4d0SZheng Fan sHelpText += maLine;
242766ce4d0SZheng Fan sHelpText.Append(String("Fixed: ", 7, RTL_TEXTENCODING_ASCII_US));
243766ce4d0SZheng Fan sHelpText += maOf;
244766ce4d0SZheng Fan sHelpText.Append( String::CreateFromInt64( maValue ));
245766ce4d0SZheng Fan break;
246766ce4d0SZheng Fan }
247766ce4d0SZheng Fan if( !aWinOpt.Exists() && !aWinOpt2.Exists() )
248766ce4d0SZheng Fan mbLineSPDisable = sal_True;
249766ce4d0SZheng Fan else
250766ce4d0SZheng Fan mbLineSPDisable = sal_False;
251766ce4d0SZheng Fan
252766ce4d0SZheng Fan if( mbLineSPDisable )
253c1757099SZheng Fan maLineSpacing.ReplaceItemImages(5, maImgCusGrey,0);
254766ce4d0SZheng Fan else
255766ce4d0SZheng Fan {
256c1757099SZheng Fan maLineSpacing.ReplaceItemImages(5, maImgCus,0);
257c1757099SZheng Fan maLineSpacing.SetItemText(5,sHelpText);
258766ce4d0SZheng Fan }
259766ce4d0SZheng Fan
260766ce4d0SZheng Fan SfxItemState eState = currSPState;
261766ce4d0SZheng Fan
262766ce4d0SZheng Fan SetFieldUnit( aLineDistAtMetricBox, currMetricUnit );
263766ce4d0SZheng Fan
264766ce4d0SZheng Fan // mpLineSPPage->SetAllNoSel();
265766ce4d0SZheng Fan aLineDist.Enable();
266766ce4d0SZheng Fan pActLineDistFld->Enable();
267766ce4d0SZheng Fan pActLineDistFld->SetText( String() );
268766ce4d0SZheng Fan bool bValueSetFocus = sal_False; //wj
269766ce4d0SZheng Fan
270766ce4d0SZheng Fan if( eState >= SFX_ITEM_AVAILABLE )
271766ce4d0SZheng Fan {
272766ce4d0SZheng Fan // SfxMapUnit eUnit = maLNSpaceControl.GetCoreMetric();
273766ce4d0SZheng Fan SfxMapUnit eUnit = SFX_MAPUNIT_100TH_MM;
274766ce4d0SZheng Fan m_eLNSpaceUnit = eUnit;
275766ce4d0SZheng Fan
276766ce4d0SZheng Fan switch( currSPItem->GetLineSpaceRule() )
277766ce4d0SZheng Fan {
278766ce4d0SZheng Fan case SVX_LINE_SPACE_AUTO:
279766ce4d0SZheng Fan {
280766ce4d0SZheng Fan SvxInterLineSpace eInter = currSPItem->GetInterLineSpaceRule();
281766ce4d0SZheng Fan
282766ce4d0SZheng Fan switch( eInter )
283766ce4d0SZheng Fan {
284766ce4d0SZheng Fan case SVX_INTER_LINE_SPACE_OFF:
285766ce4d0SZheng Fan {
286766ce4d0SZheng Fan aLineDist.SelectEntryPos( LLINESPACE_1 );
287766ce4d0SZheng Fan pActLineDistFld->Disable();
288766ce4d0SZheng Fan pActLineDistFld->SetText( String() );
289766ce4d0SZheng Fan mbUseLineSPCustom = DO_NOT_CUSTOM;
290766ce4d0SZheng Fan if ( LINESPACE_1 == currSPItem->GetPropLineSpace() )
291766ce4d0SZheng Fan {
292c1757099SZheng Fan maLineSpacing.SelectItem(1);
293766ce4d0SZheng Fan bValueSetFocus = sal_True; //wj
294766ce4d0SZheng Fan }
295766ce4d0SZheng Fan }
296766ce4d0SZheng Fan break;
297766ce4d0SZheng Fan
298766ce4d0SZheng Fan case SVX_INTER_LINE_SPACE_PROP:
299766ce4d0SZheng Fan {
300766ce4d0SZheng Fan if ( LINESPACE_1 == currSPItem->GetPropLineSpace() )
301766ce4d0SZheng Fan {
302766ce4d0SZheng Fan aLineDist.SelectEntryPos( LLINESPACE_1 );
303766ce4d0SZheng Fan pActLineDistFld->Disable();
304766ce4d0SZheng Fan pActLineDistFld->SetText( String() );
305766ce4d0SZheng Fan mbUseLineSPCustom = DO_NOT_CUSTOM;
306c1757099SZheng Fan maLineSpacing.SelectItem(1);
307766ce4d0SZheng Fan bValueSetFocus = sal_True; //wj
308766ce4d0SZheng Fan break;
309766ce4d0SZheng Fan }
310766ce4d0SZheng Fan if ( LINESPACE_15 == currSPItem->GetPropLineSpace() )
311766ce4d0SZheng Fan {
312766ce4d0SZheng Fan aLineDist.SelectEntryPos( LLINESPACE_15 );
313766ce4d0SZheng Fan pActLineDistFld->Disable();
314766ce4d0SZheng Fan pActLineDistFld->SetText( String() );
315766ce4d0SZheng Fan
316766ce4d0SZheng Fan mbUseLineSPCustom = DO_NOT_CUSTOM;
317c1757099SZheng Fan maLineSpacing.SelectItem(3);
318766ce4d0SZheng Fan bValueSetFocus = sal_True; //wj
319766ce4d0SZheng Fan break;
320766ce4d0SZheng Fan }
321766ce4d0SZheng Fan if ( LINESPACE_2 == currSPItem->GetPropLineSpace() )
322766ce4d0SZheng Fan {
323766ce4d0SZheng Fan aLineDist.SelectEntryPos( LLINESPACE_2 );
324766ce4d0SZheng Fan pActLineDistFld->Disable();
325766ce4d0SZheng Fan pActLineDistFld->SetText( String() );
326766ce4d0SZheng Fan
327766ce4d0SZheng Fan mbUseLineSPCustom = DO_NOT_CUSTOM;
328c1757099SZheng Fan maLineSpacing.SelectItem(4);
329766ce4d0SZheng Fan bValueSetFocus = sal_True; //wj
330766ce4d0SZheng Fan break;
331766ce4d0SZheng Fan }
332766ce4d0SZheng Fan
333766ce4d0SZheng Fan aLineDist.SelectEntryPos( LLINESPACE_PROP );
334766ce4d0SZheng Fan if(pActLineDistFld != &(aLineDistAtPercentBox))
335766ce4d0SZheng Fan {
336766ce4d0SZheng Fan pActLineDistFld->Disable();
337766ce4d0SZheng Fan pActLineDistFld->Hide();
338766ce4d0SZheng Fan pActLineDistFld = &(aLineDistAtPercentBox);
339766ce4d0SZheng Fan }
340766ce4d0SZheng Fan else
341766ce4d0SZheng Fan {
342766ce4d0SZheng Fan pActLineDistFld = &(aLineDistAtMetricBox);
343766ce4d0SZheng Fan pActLineDistFld->Disable();
344766ce4d0SZheng Fan pActLineDistFld->Hide();
345766ce4d0SZheng Fan pActLineDistFld = &(aLineDistAtPercentBox);
346766ce4d0SZheng Fan }
347766ce4d0SZheng Fan pActLineDistFld->Enable();
348766ce4d0SZheng Fan pActLineDistFld->Show();
349766ce4d0SZheng Fan aLineDistAtPercentBox.
350766ce4d0SZheng Fan SetValue( aLineDistAtPercentBox.Normalize(
351766ce4d0SZheng Fan currSPItem->GetPropLineSpace() ) );
352766ce4d0SZheng Fan
353766ce4d0SZheng Fan if( currSPItem->GetPropLineSpace() == LINESPACE_115 )
354766ce4d0SZheng Fan {
355766ce4d0SZheng Fan mbUseLineSPCustom = DO_NOT_CUSTOM;
356c1757099SZheng Fan maLineSpacing.SelectItem(2);
357766ce4d0SZheng Fan bValueSetFocus = sal_True; //wj
358766ce4d0SZheng Fan }
359766ce4d0SZheng Fan else
360766ce4d0SZheng Fan {
361766ce4d0SZheng Fan mbUseLineSPCustom = USE_CUSTOM;
362c1757099SZheng Fan maLineSpacing.SetNoSelection();
363c1757099SZheng Fan maLineSpacing.SelectItem(0);
364766ce4d0SZheng Fan }
365766ce4d0SZheng Fan }
366766ce4d0SZheng Fan break;
367766ce4d0SZheng Fan
368766ce4d0SZheng Fan case SVX_INTER_LINE_SPACE_FIX:
369766ce4d0SZheng Fan {
370766ce4d0SZheng Fan if(pActLineDistFld != &(aLineDistAtMetricBox))
371766ce4d0SZheng Fan {
372766ce4d0SZheng Fan pActLineDistFld->Disable();
373766ce4d0SZheng Fan pActLineDistFld->Hide();
374766ce4d0SZheng Fan pActLineDistFld = &(aLineDistAtMetricBox);
375766ce4d0SZheng Fan }
376766ce4d0SZheng Fan else
377766ce4d0SZheng Fan {
378766ce4d0SZheng Fan pActLineDistFld = &(aLineDistAtPercentBox);
379766ce4d0SZheng Fan pActLineDistFld->Disable();
380766ce4d0SZheng Fan pActLineDistFld->Hide();
381766ce4d0SZheng Fan pActLineDistFld = &(aLineDistAtMetricBox);
382766ce4d0SZheng Fan }
383766ce4d0SZheng Fan pActLineDistFld->Enable();
384766ce4d0SZheng Fan pActLineDistFld->Show();
385c1757099SZheng Fan maLineSpacing.SetNoSelection();
386c1757099SZheng Fan maLineSpacing.SelectItem(0);
387766ce4d0SZheng Fan
388766ce4d0SZheng Fan SetMetricValue( aLineDistAtMetricBox,
389766ce4d0SZheng Fan currSPItem->GetInterLineSpace(), eUnit );
390766ce4d0SZheng Fan aLineDist.SelectEntryPos( LLINESPACE_DURCH );
391766ce4d0SZheng Fan
392766ce4d0SZheng Fan mbUseLineSPCustom = USE_CUSTOM;
393766ce4d0SZheng Fan }
394766ce4d0SZheng Fan break;
395564e397fSPavel Janík default:
396564e397fSPavel Janík break;
397766ce4d0SZheng Fan }
398766ce4d0SZheng Fan }
399766ce4d0SZheng Fan break;
400766ce4d0SZheng Fan case SVX_LINE_SPACE_FIX:
401766ce4d0SZheng Fan {
402766ce4d0SZheng Fan if(pActLineDistFld != &(aLineDistAtMetricBox))
403766ce4d0SZheng Fan {
404766ce4d0SZheng Fan pActLineDistFld->Disable();
405766ce4d0SZheng Fan pActLineDistFld->Hide();
406766ce4d0SZheng Fan pActLineDistFld = &(aLineDistAtMetricBox);
407766ce4d0SZheng Fan }
408766ce4d0SZheng Fan else
409766ce4d0SZheng Fan {
410766ce4d0SZheng Fan pActLineDistFld = &(aLineDistAtPercentBox);
411766ce4d0SZheng Fan pActLineDistFld->Disable();
412766ce4d0SZheng Fan pActLineDistFld->Hide();
413766ce4d0SZheng Fan pActLineDistFld = &(aLineDistAtMetricBox);
414766ce4d0SZheng Fan }
415766ce4d0SZheng Fan pActLineDistFld->Enable();
416766ce4d0SZheng Fan pActLineDistFld->Show();
417c1757099SZheng Fan maLineSpacing.SetNoSelection();
418c1757099SZheng Fan maLineSpacing.SelectItem(0);
419766ce4d0SZheng Fan
420766ce4d0SZheng Fan SetMetricValue(aLineDistAtMetricBox, currSPItem->GetLineHeight(), eUnit);
421766ce4d0SZheng Fan aLineDist.SelectEntryPos( LLINESPACE_FIX );
422766ce4d0SZheng Fan
423766ce4d0SZheng Fan mbUseLineSPCustom = USE_CUSTOM;
424766ce4d0SZheng Fan }
425766ce4d0SZheng Fan break;
426766ce4d0SZheng Fan
427766ce4d0SZheng Fan case SVX_LINE_SPACE_MIN:
428766ce4d0SZheng Fan {
429766ce4d0SZheng Fan if(pActLineDistFld != &(aLineDistAtMetricBox))
430766ce4d0SZheng Fan {
431766ce4d0SZheng Fan pActLineDistFld->Disable();
432766ce4d0SZheng Fan pActLineDistFld->Hide();
433766ce4d0SZheng Fan pActLineDistFld = &(aLineDistAtMetricBox);
434766ce4d0SZheng Fan }
435766ce4d0SZheng Fan else
436766ce4d0SZheng Fan {
437766ce4d0SZheng Fan pActLineDistFld = &(aLineDistAtPercentBox);
438766ce4d0SZheng Fan pActLineDistFld->Disable();
439766ce4d0SZheng Fan pActLineDistFld->Hide();
440766ce4d0SZheng Fan pActLineDistFld = &(aLineDistAtMetricBox);
441766ce4d0SZheng Fan }
442766ce4d0SZheng Fan pActLineDistFld->Enable();
443766ce4d0SZheng Fan pActLineDistFld->Show();
444c1757099SZheng Fan maLineSpacing.SetNoSelection();
445c1757099SZheng Fan maLineSpacing.SelectItem(0);
446766ce4d0SZheng Fan
447766ce4d0SZheng Fan SetMetricValue(aLineDistAtMetricBox, currSPItem->GetLineHeight(), eUnit);
448766ce4d0SZheng Fan aLineDist.SelectEntryPos( LLINESPACE_MIN );
449766ce4d0SZheng Fan mbUseLineSPCustom = USE_CUSTOM;
450766ce4d0SZheng Fan }
451766ce4d0SZheng Fan break;
452564e397fSPavel Janík default:
453564e397fSPavel Janík break;
454766ce4d0SZheng Fan }
455766ce4d0SZheng Fan }
456766ce4d0SZheng Fan else if( eState == SFX_ITEM_DISABLED )
457766ce4d0SZheng Fan {
458766ce4d0SZheng Fan aLineDist.Disable();
459766ce4d0SZheng Fan pActLineDistFld->Enable(sal_False);
460766ce4d0SZheng Fan pActLineDistFld->SetText( String() );
461c1757099SZheng Fan maLineSpacing.SetNoSelection();
462c1757099SZheng Fan maLineSpacing.SelectItem(0);
463766ce4d0SZheng Fan
464766ce4d0SZheng Fan mbUseLineSPCustom = DO_NOT_CUSTOM;
465766ce4d0SZheng Fan }
466766ce4d0SZheng Fan else
467766ce4d0SZheng Fan {
468766ce4d0SZheng Fan pActLineDistFld->Enable(sal_False);
469766ce4d0SZheng Fan pActLineDistFld->SetText( String() );
470766ce4d0SZheng Fan aLineDist.SetNoSelection();
471c1757099SZheng Fan maLineSpacing.SetNoSelection();
472c1757099SZheng Fan maLineSpacing.SelectItem(0);
473766ce4d0SZheng Fan mbUseLineSPCustom = DO_NOT_CUSTOM;
474766ce4d0SZheng Fan }
475766ce4d0SZheng Fan
476766ce4d0SZheng Fan aLineDist.SaveValue();
477766ce4d0SZheng Fan
4788eda4adfSOliver-Rainer Wittmann const sal_uInt16 uCount = aLineDist.GetEntryCount();
4798eda4adfSOliver-Rainer Wittmann if( uCount == LLINESPACE_FIX + 1 )
4808eda4adfSOliver-Rainer Wittmann {
4818eda4adfSOliver-Rainer Wittmann switch (currentContext.GetCombinedContext_DI())
4828eda4adfSOliver-Rainer Wittmann {
4838eda4adfSOliver-Rainer Wittmann case CombinedEnumContext(Application_DrawImpress, Context_Table):
4848eda4adfSOliver-Rainer Wittmann case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
4858eda4adfSOliver-Rainer Wittmann case CombinedEnumContext(Application_DrawImpress, Context_Draw):
4868eda4adfSOliver-Rainer Wittmann case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
4878eda4adfSOliver-Rainer Wittmann case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
4888eda4adfSOliver-Rainer Wittmann case CombinedEnumContext(Application_Calc, Context_DrawText):
4898eda4adfSOliver-Rainer Wittmann case CombinedEnumContext(Application_WriterVariants, Context_DrawText):
4908eda4adfSOliver-Rainer Wittmann case CombinedEnumContext(Application_WriterVariants, Context_Annotation):
4918eda4adfSOliver-Rainer Wittmann {
4928eda4adfSOliver-Rainer Wittmann aLineDist.RemoveEntry(LLINESPACE_FIX);
4938eda4adfSOliver-Rainer Wittmann }
4948eda4adfSOliver-Rainer Wittmann }
4958eda4adfSOliver-Rainer Wittmann }
4968eda4adfSOliver-Rainer Wittmann else if( uCount == LLINESPACE_FIX)
4978eda4adfSOliver-Rainer Wittmann {
4988eda4adfSOliver-Rainer Wittmann switch (currentContext.GetCombinedContext_DI())
4998eda4adfSOliver-Rainer Wittmann {
5008eda4adfSOliver-Rainer Wittmann case CombinedEnumContext(Application_WriterVariants, Context_Default):
5018eda4adfSOliver-Rainer Wittmann case CombinedEnumContext(Application_WriterVariants, Context_Text):
5028eda4adfSOliver-Rainer Wittmann case CombinedEnumContext(Application_WriterVariants, Context_Table):
5038eda4adfSOliver-Rainer Wittmann {
5048eda4adfSOliver-Rainer Wittmann aLineDist.InsertEntry(String::CreateFromAscii("Fixed"), LLINESPACE_FIX);
5058eda4adfSOliver-Rainer Wittmann }
5068eda4adfSOliver-Rainer Wittmann }
5078eda4adfSOliver-Rainer Wittmann }
5088eda4adfSOliver-Rainer Wittmann maLineSpacing.Format();
5098eda4adfSOliver-Rainer Wittmann maLineSpacing.StartSelection();
510766ce4d0SZheng Fan }
511766ce4d0SZheng Fan
SetAllNoSel()512766ce4d0SZheng Fan void ParaLineSpacingControl::SetAllNoSel()
513766ce4d0SZheng Fan {
514c1757099SZheng Fan maLineSpacing.SelectItem(1);
515766ce4d0SZheng Fan maLineSpacing.SetNoSelection();
516766ce4d0SZheng Fan }
517766ce4d0SZheng Fan
IMPL_LINK(ParaLineSpacingControl,LineSPDistHdl_Impl,ListBox *,pBox)518766ce4d0SZheng Fan IMPL_LINK( ParaLineSpacingControl, LineSPDistHdl_Impl, ListBox*, pBox )
519766ce4d0SZheng Fan {
520766ce4d0SZheng Fan maLineSpacing.SetNoSelection();
521c1757099SZheng Fan maLineSpacing.SelectItem(0);
522766ce4d0SZheng Fan maLineSpacing.Format();
523766ce4d0SZheng Fan maLineSpacing.StartSelection();
524766ce4d0SZheng Fan
525766ce4d0SZheng Fan switch( pBox->GetSelectEntryPos() )
526766ce4d0SZheng Fan {
527766ce4d0SZheng Fan case LLINESPACE_1:
528766ce4d0SZheng Fan case LLINESPACE_15:
529766ce4d0SZheng Fan case LLINESPACE_2:
530766ce4d0SZheng Fan pActLineDistFld->Enable(sal_False);
531766ce4d0SZheng Fan pActLineDistFld->SetText( String() );
532766ce4d0SZheng Fan break;
533766ce4d0SZheng Fan
534766ce4d0SZheng Fan case LLINESPACE_DURCH:
535766ce4d0SZheng Fan aLineDistAtPercentBox.Hide();
536766ce4d0SZheng Fan pActLineDistFld = &aLineDistAtMetricBox;
537766ce4d0SZheng Fan aLineDistAtMetricBox.SetMin(0);
538766ce4d0SZheng Fan
539766ce4d0SZheng Fan
540766ce4d0SZheng Fan if ( !aLineDistAtMetricBox.GetText().Len() )
541766ce4d0SZheng Fan aLineDistAtMetricBox.SetValue(
542766ce4d0SZheng Fan aLineDistAtMetricBox.Normalize( 0 ) );
543766ce4d0SZheng Fan aLineDistAtPercentBox.Hide();
544766ce4d0SZheng Fan pActLineDistFld->Show();
545766ce4d0SZheng Fan pActLineDistFld->Enable();
546766ce4d0SZheng Fan break;
547766ce4d0SZheng Fan
548766ce4d0SZheng Fan case LLINESPACE_MIN:
549766ce4d0SZheng Fan aLineDistAtPercentBox.Hide();
550766ce4d0SZheng Fan pActLineDistFld = &aLineDistAtMetricBox;
551766ce4d0SZheng Fan aLineDistAtMetricBox.SetMin(0);
552766ce4d0SZheng Fan
553766ce4d0SZheng Fan if ( !aLineDistAtMetricBox.GetText().Len() )
554766ce4d0SZheng Fan aLineDistAtMetricBox.SetValue(
555766ce4d0SZheng Fan aLineDistAtMetricBox.Normalize( 0 ), FUNIT_TWIP );
556766ce4d0SZheng Fan aLineDistAtPercentBox.Hide();
557766ce4d0SZheng Fan pActLineDistFld->Show();
558766ce4d0SZheng Fan pActLineDistFld->Enable();
559766ce4d0SZheng Fan break;
560766ce4d0SZheng Fan
561766ce4d0SZheng Fan case LLINESPACE_PROP:
562766ce4d0SZheng Fan aLineDistAtMetricBox.Hide();
563766ce4d0SZheng Fan pActLineDistFld = &aLineDistAtPercentBox;
564766ce4d0SZheng Fan
565766ce4d0SZheng Fan if ( !aLineDistAtPercentBox.GetText().Len() )
566766ce4d0SZheng Fan aLineDistAtPercentBox.SetValue(
567766ce4d0SZheng Fan aLineDistAtPercentBox.Normalize( 100 ), FUNIT_TWIP );
568766ce4d0SZheng Fan aLineDistAtMetricBox.Hide();
569766ce4d0SZheng Fan pActLineDistFld->Show();
570766ce4d0SZheng Fan pActLineDistFld->Enable();
571766ce4d0SZheng Fan break;
572766ce4d0SZheng Fan case LLINESPACE_FIX:
573766ce4d0SZheng Fan {
574766ce4d0SZheng Fan aLineDistAtPercentBox.Hide();
575766ce4d0SZheng Fan pActLineDistFld = &aLineDistAtMetricBox;
576766ce4d0SZheng Fan sal_Int64 nTemp = aLineDistAtMetricBox.GetValue();
577766ce4d0SZheng Fan aLineDistAtMetricBox.SetMin(aLineDistAtMetricBox.Normalize(nMinFixDist), FUNIT_TWIP);
578766ce4d0SZheng Fan
579766ce4d0SZheng Fan if ( aLineDistAtMetricBox.GetValue() != nTemp )
580766ce4d0SZheng Fan SetMetricValue( aLineDistAtMetricBox,
581766ce4d0SZheng Fan FIX_DIST_DEF, SFX_MAPUNIT_TWIP );
582766ce4d0SZheng Fan aLineDistAtPercentBox.Hide();
583766ce4d0SZheng Fan pActLineDistFld->Show();
584766ce4d0SZheng Fan pActLineDistFld->Enable();
585766ce4d0SZheng Fan }
586766ce4d0SZheng Fan break;
587766ce4d0SZheng Fan }
588766ce4d0SZheng Fan ExecuteLineSpace();
589766ce4d0SZheng Fan return 0;
590766ce4d0SZheng Fan }
591766ce4d0SZheng Fan
5926870eca3SPavel Janík IMPL_LINK( ParaLineSpacingControl, LineSPDistAtHdl_Impl, MetricField*, /* pBox */ )
593766ce4d0SZheng Fan {
594766ce4d0SZheng Fan ExecuteLineSpace();
595766ce4d0SZheng Fan return (0L);
596766ce4d0SZheng Fan }
597766ce4d0SZheng Fan
ExecuteLineSpace()598766ce4d0SZheng Fan void ParaLineSpacingControl::ExecuteLineSpace()
599766ce4d0SZheng Fan {
600766ce4d0SZheng Fan aLineDist.SaveValue();
601766ce4d0SZheng Fan maLineSpacing.SetNoSelection();
602766ce4d0SZheng Fan
603766ce4d0SZheng Fan SvxLineSpacingItem aSpacing(_DEFAULT_LINE_SPACING, SID_ATTR_PARA_LINESPACE);
604766ce4d0SZheng Fan sal_uInt16 nPos = aLineDist.GetSelectEntryPos();
605766ce4d0SZheng Fan
606766ce4d0SZheng Fan switch ( nPos )
607766ce4d0SZheng Fan {
608766ce4d0SZheng Fan case LLINESPACE_1:
609766ce4d0SZheng Fan case LLINESPACE_15:
610766ce4d0SZheng Fan case LLINESPACE_2:
611766ce4d0SZheng Fan {
612766ce4d0SZheng Fan SetLineSpace( aSpacing, nPos );
613766ce4d0SZheng Fan maPos = nPos;
614766ce4d0SZheng Fan }
615766ce4d0SZheng Fan break;
616766ce4d0SZheng Fan
617766ce4d0SZheng Fan case LLINESPACE_PROP:
618766ce4d0SZheng Fan {
619766ce4d0SZheng Fan SetLineSpace( aSpacing, nPos,
620766ce4d0SZheng Fan aLineDistAtPercentBox.Denormalize(
621766ce4d0SZheng Fan (long)aLineDistAtPercentBox.GetValue() ) );
622766ce4d0SZheng Fan maPos = nPos;
623766ce4d0SZheng Fan maValue =aLineDistAtPercentBox.GetValue();
624766ce4d0SZheng Fan }
625766ce4d0SZheng Fan break;
626766ce4d0SZheng Fan
627766ce4d0SZheng Fan case LLINESPACE_MIN:
628766ce4d0SZheng Fan case LLINESPACE_DURCH:
629766ce4d0SZheng Fan case LLINESPACE_FIX:
630766ce4d0SZheng Fan {
631766ce4d0SZheng Fan SetLineSpace( aSpacing, nPos,
632766ce4d0SZheng Fan GetCoreValue( aLineDistAtMetricBox, m_eLNSpaceUnit ) );
633766ce4d0SZheng Fan maPos = nPos;
634766ce4d0SZheng Fan maValue = GetCoreValue( aLineDistAtMetricBox, m_eLNSpaceUnit );
635766ce4d0SZheng Fan }
636766ce4d0SZheng Fan break;
637766ce4d0SZheng Fan
638766ce4d0SZheng Fan default:
639766ce4d0SZheng Fan DBG_ERROR( "error!!" );
640766ce4d0SZheng Fan break;
641766ce4d0SZheng Fan }
642766ce4d0SZheng Fan
643766ce4d0SZheng Fan mpBindings->GetDispatcher()->Execute(
644766ce4d0SZheng Fan SID_ATTR_PARA_LINESPACE, SFX_CALLMODE_RECORD, &aSpacing, 0L);
645766ce4d0SZheng Fan
646766ce4d0SZheng Fan mbUseLineSPCustom = USE_CUSTOM;
647766ce4d0SZheng Fan }
648766ce4d0SZheng Fan
SetLineSpace(SvxLineSpacingItem & rLineSpace,int eSpace,long lValue)649766ce4d0SZheng Fan void ParaLineSpacingControl::SetLineSpace( SvxLineSpacingItem& rLineSpace,
650766ce4d0SZheng Fan int eSpace, long lValue )
651766ce4d0SZheng Fan {
652766ce4d0SZheng Fan switch ( eSpace )
653766ce4d0SZheng Fan {
654766ce4d0SZheng Fan case LLINESPACE_1:
655766ce4d0SZheng Fan rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
656766ce4d0SZheng Fan rLineSpace.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF;
657766ce4d0SZheng Fan break;
658766ce4d0SZheng Fan
659766ce4d0SZheng Fan case LLINESPACE_15:
660766ce4d0SZheng Fan rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
661766ce4d0SZheng Fan rLineSpace.SetPropLineSpace( LINESPACE_15 );
662766ce4d0SZheng Fan break;
663766ce4d0SZheng Fan
664766ce4d0SZheng Fan case LLINESPACE_2:
665766ce4d0SZheng Fan rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
666766ce4d0SZheng Fan rLineSpace.SetPropLineSpace( LINESPACE_2 );
667766ce4d0SZheng Fan break;
668766ce4d0SZheng Fan
669766ce4d0SZheng Fan case LLINESPACE_PROP:
670766ce4d0SZheng Fan rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
671766ce4d0SZheng Fan rLineSpace.SetPropLineSpace( (sal_uInt8)lValue );
672766ce4d0SZheng Fan break;
673766ce4d0SZheng Fan
674766ce4d0SZheng Fan case LLINESPACE_MIN:
675766ce4d0SZheng Fan rLineSpace.SetLineHeight( (sal_uInt16)lValue );
676766ce4d0SZheng Fan rLineSpace.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF;
677766ce4d0SZheng Fan break;
678766ce4d0SZheng Fan
679766ce4d0SZheng Fan case LLINESPACE_DURCH:
680766ce4d0SZheng Fan rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
681766ce4d0SZheng Fan rLineSpace.SetInterLineSpace( (sal_uInt16)lValue );
682766ce4d0SZheng Fan break;
683766ce4d0SZheng Fan
684766ce4d0SZheng Fan case LLINESPACE_FIX:
685766ce4d0SZheng Fan rLineSpace.SetLineHeight((sal_uInt16)lValue);
686766ce4d0SZheng Fan rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_FIX;
687766ce4d0SZheng Fan rLineSpace.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF;
688766ce4d0SZheng Fan break;
689766ce4d0SZheng Fan }
690766ce4d0SZheng Fan }
691766ce4d0SZheng Fan
IMPL_LINK(ParaLineSpacingControl,VSSelHdl,void *,pControl)692766ce4d0SZheng Fan IMPL_LINK(ParaLineSpacingControl, VSSelHdl, void *, pControl)
693766ce4d0SZheng Fan {
694766ce4d0SZheng Fan maLineSpacing.SetNoSelection();
695766ce4d0SZheng Fan bool bClosePop = true;
696766ce4d0SZheng Fan if(pControl == &maLineSpacing)
697766ce4d0SZheng Fan {
698766ce4d0SZheng Fan sal_uInt16 iPos = maLineSpacing.GetSelectItemId();
699766ce4d0SZheng Fan switch ( iPos )
700766ce4d0SZheng Fan {
701766ce4d0SZheng Fan case 1:
702766ce4d0SZheng Fan ExecuteLineSpacing( 0, 0 );
703766ce4d0SZheng Fan break;
704766ce4d0SZheng Fan case 2:
705766ce4d0SZheng Fan ExecuteLineSpacing( 0, 3 );
706766ce4d0SZheng Fan break;
707766ce4d0SZheng Fan case 3:
708766ce4d0SZheng Fan ExecuteLineSpacing( 0, 1 );
709766ce4d0SZheng Fan break;
710766ce4d0SZheng Fan case 4:
711766ce4d0SZheng Fan ExecuteLineSpacing( 0, 2 );
712766ce4d0SZheng Fan break;
713766ce4d0SZheng Fan case 5:
714766ce4d0SZheng Fan {
715766ce4d0SZheng Fan if(!(mbLineSPDisable))
716766ce4d0SZheng Fan {
717766ce4d0SZheng Fan //maPos = mrParaPropertyPanel.maLinePos;
718766ce4d0SZheng Fan aLineDist.SelectEntryPos( maPos ) ;
719766ce4d0SZheng Fan aLineDist.SaveValue();
720766ce4d0SZheng Fan //maValue = mrParaPropertyPanel.maLineValue;
721766ce4d0SZheng Fan
722766ce4d0SZheng Fan SvxLineSpacingItem aSpacing(_DEFAULT_LINE_SPACING, SID_ATTR_PARA_LINESPACE);
723766ce4d0SZheng Fan switch(maPos)
724766ce4d0SZheng Fan {
725766ce4d0SZheng Fan case LLINESPACE_1:
726766ce4d0SZheng Fan case LLINESPACE_15:
727766ce4d0SZheng Fan case LLINESPACE_2:
728766ce4d0SZheng Fan SetLineSpace( aSpacing, maPos );
729766ce4d0SZheng Fan break;
730766ce4d0SZheng Fan
731766ce4d0SZheng Fan case LLINESPACE_PROP:
732766ce4d0SZheng Fan SetLineSpace( aSpacing, maPos,
733766ce4d0SZheng Fan aLineDistAtPercentBox.Denormalize( (long)maValue ) );
734766ce4d0SZheng Fan break;
735766ce4d0SZheng Fan
736766ce4d0SZheng Fan case LLINESPACE_MIN:
737766ce4d0SZheng Fan case LLINESPACE_DURCH:
738766ce4d0SZheng Fan case LLINESPACE_FIX:
739766ce4d0SZheng Fan SetLineSpace( aSpacing, maPos, (long)maValue );
740766ce4d0SZheng Fan break;
741766ce4d0SZheng Fan }
742766ce4d0SZheng Fan
743766ce4d0SZheng Fan mpBindings->GetDispatcher()->Execute(
744766ce4d0SZheng Fan SID_ATTR_PARA_LINESPACE, SFX_CALLMODE_RECORD, &aSpacing, 0L);
745766ce4d0SZheng Fan
746766ce4d0SZheng Fan ExecuteLineSpacing( USE_CUSTOM, 0 );
747766ce4d0SZheng Fan }
748766ce4d0SZheng Fan else
749766ce4d0SZheng Fan bClosePop = sal_False;
750766ce4d0SZheng Fan }
751766ce4d0SZheng Fan break;
752766ce4d0SZheng Fan }
753766ce4d0SZheng Fan }
754766ce4d0SZheng Fan if(bClosePop)
755766ce4d0SZheng Fan mrParaPropertyPanel.EndSpacingPopupMode();
756766ce4d0SZheng Fan return 0;
757766ce4d0SZheng Fan }
758766ce4d0SZheng Fan
ExecuteLineSpacing(sal_uInt16 aIsCustom,sal_uInt16 aEntry)759766ce4d0SZheng Fan void ParaLineSpacingControl::ExecuteLineSpacing( sal_uInt16 aIsCustom, sal_uInt16 aEntry )
760766ce4d0SZheng Fan {
761766ce4d0SZheng Fan if( !aIsCustom )
762766ce4d0SZheng Fan {
763766ce4d0SZheng Fan aLineDist.SelectEntryPos( aEntry ) ;
764766ce4d0SZheng Fan aLineDist.SaveValue();
765766ce4d0SZheng Fan SvxLineSpacingItem aSpacing(_DEFAULT_LINE_SPACING, SID_ATTR_PARA_LINESPACE);
766766ce4d0SZheng Fan sal_uInt16 nPos = aEntry;
767766ce4d0SZheng Fan if( aEntry == LLINESPACE_PROP )
768766ce4d0SZheng Fan SetLineSpace( aSpacing, nPos, aLineDistAtPercentBox.Denormalize( (long)115 ) );
769766ce4d0SZheng Fan else
770766ce4d0SZheng Fan SetLineSpace( aSpacing, nPos );
771766ce4d0SZheng Fan
772766ce4d0SZheng Fan mpBindings->GetDispatcher()->Execute(
773766ce4d0SZheng Fan SID_ATTR_PARA_LINESPACE, SFX_CALLMODE_RECORD, &aSpacing, 0L);
774766ce4d0SZheng Fan }
775766ce4d0SZheng Fan
776766ce4d0SZheng Fan if( !aIsCustom )
777766ce4d0SZheng Fan {
778766ce4d0SZheng Fan mbUseLineSPCustom = DO_NOT_CUSTOM;
779766ce4d0SZheng Fan mrParaPropertyPanel.EndSpacingPopupMode();
780766ce4d0SZheng Fan }
781766ce4d0SZheng Fan maLineSpacing.SetNoSelection();
782766ce4d0SZheng Fan }
783766ce4d0SZheng Fan
784766ce4d0SZheng Fan }} // end of namespace sidebar
785766ce4d0SZheng Fan
786