1*766ce4d0SZheng Fan /************************************************************** 2*766ce4d0SZheng Fan * 3*766ce4d0SZheng Fan * Licensed to the Apache Software Foundation (ASF) under one 4*766ce4d0SZheng Fan * or more contributor license agreements. See the NOTICE file 5*766ce4d0SZheng Fan * distributed with this work for additional information 6*766ce4d0SZheng Fan * regarding copyright ownership. The ASF licenses this file 7*766ce4d0SZheng Fan * to you under the Apache License, Version 2.0 (the 8*766ce4d0SZheng Fan * "License"); you may not use this file except in compliance 9*766ce4d0SZheng Fan * with the License. You may obtain a copy of the License at 10*766ce4d0SZheng Fan * 11*766ce4d0SZheng Fan * http://www.apache.org/licenses/LICENSE-2.0 12*766ce4d0SZheng Fan * 13*766ce4d0SZheng Fan * Unless required by applicable law or agreed to in writing, 14*766ce4d0SZheng Fan * software distributed under the License is distributed on an 15*766ce4d0SZheng Fan * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*766ce4d0SZheng Fan * KIND, either express or implied. See the License for the 17*766ce4d0SZheng Fan * specific language governing permissions and limitations 18*766ce4d0SZheng Fan * under the License. 19*766ce4d0SZheng Fan * 20*766ce4d0SZheng Fan *************************************************************/ 21*766ce4d0SZheng Fan 22*766ce4d0SZheng Fan #include "precompiled_svx.hxx" 23*766ce4d0SZheng Fan #include "ParaLineSpacingControl.hxx" 24*766ce4d0SZheng Fan #include "ParaPropertyPanel.hrc" 25*766ce4d0SZheng Fan #include <sfx2/sidebar/propertypanel.hrc> 26*766ce4d0SZheng Fan #include <svx/dialogs.hrc> 27*766ce4d0SZheng Fan #include <svx/dialmgr.hxx> 28*766ce4d0SZheng Fan #include <unotools/viewoptions.hxx> 29*766ce4d0SZheng Fan #include <editeng/kernitem.hxx> 30*766ce4d0SZheng Fan #include <sfx2/bindings.hxx> 31*766ce4d0SZheng Fan #include <sfx2/dispatch.hxx> 32*766ce4d0SZheng Fan #include <sfx2/sidebar/Theme.hxx> 33*766ce4d0SZheng Fan #include <svtools/unitconv.hxx> 34*766ce4d0SZheng Fan 35*766ce4d0SZheng Fan #define _DEFAULT_LINE_SPACING 200 36*766ce4d0SZheng Fan #define FIX_DIST_DEF 283 37*766ce4d0SZheng Fan #define LINESPACE_1 100 38*766ce4d0SZheng Fan #define LINESPACE_15 150 39*766ce4d0SZheng Fan #define LINESPACE_2 200 40*766ce4d0SZheng Fan #define LINESPACE_115 115 41*766ce4d0SZheng Fan 42*766ce4d0SZheng Fan #define LLINESPACE_1 0 43*766ce4d0SZheng Fan #define LLINESPACE_15 1 44*766ce4d0SZheng Fan #define LLINESPACE_2 2 45*766ce4d0SZheng Fan #define LLINESPACE_PROP 3 46*766ce4d0SZheng Fan #define LLINESPACE_MIN 4 47*766ce4d0SZheng Fan #define LLINESPACE_DURCH 5 48*766ce4d0SZheng Fan #define LLINESPACE_FIX 6 49*766ce4d0SZheng Fan 50*766ce4d0SZheng Fan #define DO_NOT_CUSTOM 0 51*766ce4d0SZheng Fan #define USE_CUSTOM 1 52*766ce4d0SZheng Fan 53*766ce4d0SZheng Fan namespace svx { namespace sidebar { 54*766ce4d0SZheng Fan 55*766ce4d0SZheng Fan 56*766ce4d0SZheng Fan ParaLineSpacingControl::ParaLineSpacingControl(Window* pParent, svx::sidebar::ParaPropertyPanel& rPanel) 57*766ce4d0SZheng Fan : PopupControl( pParent,SVX_RES(RID_POPUPPANEL_PARAPAGE_LINESPACING)) 58*766ce4d0SZheng Fan , mrParaPropertyPanel(rPanel) 59*766ce4d0SZheng Fan , mpBindings(NULL) 60*766ce4d0SZheng Fan ,aLineDist ( this, SVX_RES( LB_LINE_SPACING )), 61*766ce4d0SZheng Fan aLineDistAtPercentBox ( this, SVX_RES( ED_SBINDE_LINEDISTPERCENT ) ), 62*766ce4d0SZheng Fan aLineDistAtMetricBox ( this, SVX_RES( ED_SBINDE_LINEDISTPOINT ) ), 63*766ce4d0SZheng Fan maCustomFT ( this, SVX_RES( FT_CUSTOM ) ), 64*766ce4d0SZheng Fan maLSpacingFT ( this, SVX_RES( FT_LINE_SPACING ) ), 65*766ce4d0SZheng Fan maOfFT ( this, SVX_RES( FT_OF ) ), 66*766ce4d0SZheng Fan maSpacing1 (SVX_RES(IMG_SPACING1)), 67*766ce4d0SZheng Fan maSpacing115 (SVX_RES(IMG_SPACING115)), 68*766ce4d0SZheng Fan maSpacing15 (SVX_RES(IMG_SPACING15)), 69*766ce4d0SZheng Fan maSpacing2 (SVX_RES(IMG_SPACING2)), 70*766ce4d0SZheng Fan maLPCustom (SVX_RES(IMG_SPACINGLCUSTOM)), 71*766ce4d0SZheng Fan maSelSpacing1 (SVX_RES(IMG_SEL_SPACING1)), 72*766ce4d0SZheng Fan maSelSpacing115 (SVX_RES(IMG_SEL_SPACING115)), 73*766ce4d0SZheng Fan maSelSpacing15 (SVX_RES(IMG_SEL_SPACING15)), 74*766ce4d0SZheng Fan maSelSpacing2 (SVX_RES(IMG_SEL_SPACING2)), 75*766ce4d0SZheng Fan maImgCusGrey (SVX_RES(IMG_CUSTOM_GRAY)), 76*766ce4d0SZheng Fan maImgCus (SVX_RES(IMG_CUSTOM)), 77*766ce4d0SZheng Fan maStrCus (SVX_RES(STR_LCVALUE)), 78*766ce4d0SZheng Fan pActLineDistFld ( &aLineDistAtPercentBox ), 79*766ce4d0SZheng Fan nMinFixDist ( BEGIN_VALUE ), 80*766ce4d0SZheng Fan maValue ( 0 ), 81*766ce4d0SZheng Fan maPos ( 0 ), 82*766ce4d0SZheng Fan maLineSpacing (ValueSetWithTextControl::IMAGE_TEXT,this, SVX_RES( LINE_SPACING ) ), 83*766ce4d0SZheng Fan mpImg (NULL), 84*766ce4d0SZheng Fan mpImgSel (NULL), 85*766ce4d0SZheng Fan mpStr (NULL), 86*766ce4d0SZheng Fan mpStrTip (NULL), 87*766ce4d0SZheng Fan maLine (SVX_RES(STR_LSPACING)), 88*766ce4d0SZheng Fan maOf (SVX_RES(STR_LS_OF)) 89*766ce4d0SZheng Fan , mbUseLineSPCustom (0) 90*766ce4d0SZheng Fan , mbLineSPDisable (0) 91*766ce4d0SZheng Fan { 92*766ce4d0SZheng Fan initial(); 93*766ce4d0SZheng Fan FreeResource(); 94*766ce4d0SZheng Fan mpBindings = mrParaPropertyPanel.GetBindings(); 95*766ce4d0SZheng Fan // m_eLNSpaceUnit = mrParaPropertyPanel.maLNSpaceControl.GetCoreMetric(); 96*766ce4d0SZheng Fan m_eLNSpaceUnit = SFX_MAPUNIT_100TH_MM; 97*766ce4d0SZheng Fan } 98*766ce4d0SZheng Fan ParaLineSpacingControl::~ParaLineSpacingControl() 99*766ce4d0SZheng Fan { 100*766ce4d0SZheng Fan delete[] mpImg; 101*766ce4d0SZheng Fan delete[] mpImgSel; 102*766ce4d0SZheng Fan delete[] mpStr; 103*766ce4d0SZheng Fan delete[] mpStrTip; 104*766ce4d0SZheng Fan } 105*766ce4d0SZheng Fan 106*766ce4d0SZheng Fan void ParaLineSpacingControl::initial() 107*766ce4d0SZheng Fan { 108*766ce4d0SZheng Fan //maLineSpacing.SetStyle( maLineSpacing.GetStyle()| WB_3DLOOK | WB_NO_DIRECTSELECT ); 109*766ce4d0SZheng Fan //maLineSpacing.SetControlBackground(GetSettings().GetStyleSettings().GetMenuColor()); 110*766ce4d0SZheng Fan //maLineSpacing.SetColor(GetSettings().GetStyleSettings().GetMenuColor()); 111*766ce4d0SZheng Fan //maLineSpacing.SetMinFont(); 112*766ce4d0SZheng Fan 113*766ce4d0SZheng Fan maLineSpacing.SetControlBackground(GetSettings().GetStyleSettings().GetHighContrastMode()? 114*766ce4d0SZheng Fan GetSettings().GetStyleSettings().GetMenuColor(): 115*766ce4d0SZheng Fan sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); 116*766ce4d0SZheng Fan maLineSpacing.SetColor(GetSettings().GetStyleSettings().GetHighContrastMode()? 117*766ce4d0SZheng Fan GetSettings().GetStyleSettings().GetMenuColor(): 118*766ce4d0SZheng Fan sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); 119*766ce4d0SZheng Fan maLineSpacing.SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()? 120*766ce4d0SZheng Fan GetSettings().GetStyleSettings().GetMenuColor(): 121*766ce4d0SZheng Fan sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); 122*766ce4d0SZheng Fan //maFTSpacing.SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()? 123*766ce4d0SZheng Fan //GetSettings().GetStyleSettings().GetMenuColor(): 124*766ce4d0SZheng Fan //sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); 125*766ce4d0SZheng Fan //maFTBy.SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()? 126*766ce4d0SZheng Fan //GetSettings().GetStyleSettings().GetMenuColor(): 127*766ce4d0SZheng Fan //sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); 128*766ce4d0SZheng Fan 129*766ce4d0SZheng Fan mpImg = new Image[4]; 130*766ce4d0SZheng Fan mpImg[0] = maSpacing1; 131*766ce4d0SZheng Fan mpImg[1] = maSpacing115; 132*766ce4d0SZheng Fan mpImg[2] = maSpacing15; 133*766ce4d0SZheng Fan mpImg[3] = maSpacing2; 134*766ce4d0SZheng Fan 135*766ce4d0SZheng Fan mpImgSel = new Image[4]; 136*766ce4d0SZheng Fan mpImgSel[0] = maSelSpacing1; 137*766ce4d0SZheng Fan mpImgSel[1] = maSelSpacing115; 138*766ce4d0SZheng Fan mpImgSel[2] = maSelSpacing15; 139*766ce4d0SZheng Fan mpImgSel[3] = maSelSpacing2; 140*766ce4d0SZheng Fan 141*766ce4d0SZheng Fan mpStr = new XubString[4]; 142*766ce4d0SZheng Fan mpStr[0] = XubString(SVX_RES(STR_SPACING1)); 143*766ce4d0SZheng Fan mpStr[1] = XubString(SVX_RES(STR_SPACING115)); 144*766ce4d0SZheng Fan mpStr[2] = XubString(SVX_RES(STR_SPACING15)); 145*766ce4d0SZheng Fan mpStr[3] = XubString(SVX_RES(STR_SPACING2)); 146*766ce4d0SZheng Fan 147*766ce4d0SZheng Fan mpStrTip = new XubString[4]; 148*766ce4d0SZheng Fan mpStrTip[0] = XubString(SVX_RES(STR_LS_SINGLE)); 149*766ce4d0SZheng Fan mpStrTip[1] = XubString(SVX_RES(STR_LS_115)); 150*766ce4d0SZheng Fan mpStrTip[2] = XubString(SVX_RES(STR_LS_15)); 151*766ce4d0SZheng Fan mpStrTip[3] = XubString(SVX_RES(STR_LS_DOUBLE)); 152*766ce4d0SZheng Fan for (int i=0;i<4;i++) 153*766ce4d0SZheng Fan maLineSpacing.AddItem(mpImg[i], &mpImgSel[i],mpStr[i],&mpStrTip[i]); 154*766ce4d0SZheng Fan 155*766ce4d0SZheng Fan maLineSpacing.InsertCustom(maImgCus, maImgCusGrey, maStrCus); 156*766ce4d0SZheng Fan maLineSpacing.SetCustomTip(maStrCus); //Add 157*766ce4d0SZheng Fan 158*766ce4d0SZheng Fan SetAllNoSel(); 159*766ce4d0SZheng Fan Link aLink = LINK(this, ParaLineSpacingControl,VSSelHdl ); 160*766ce4d0SZheng Fan maLineSpacing.SetSelectHdl(aLink); 161*766ce4d0SZheng Fan maLineSpacing.StartSelection(); 162*766ce4d0SZheng Fan maLineSpacing.Show(); 163*766ce4d0SZheng Fan 164*766ce4d0SZheng Fan aLink = LINK( this, ParaLineSpacingControl, LineSPDistHdl_Impl ); 165*766ce4d0SZheng Fan aLineDist.SetSelectHdl(aLink); 166*766ce4d0SZheng Fan aLineDist.SelectEntryPos( LLINESPACE_1 ) ; 167*766ce4d0SZheng Fan aLink = LINK( this, ParaLineSpacingControl, LineSPDistAtHdl_Impl ); 168*766ce4d0SZheng Fan aLineDistAtPercentBox.SetModifyHdl( aLink ); 169*766ce4d0SZheng Fan aLineDistAtMetricBox.SetModifyHdl( aLink ); 170*766ce4d0SZheng Fan } 171*766ce4d0SZheng Fan void ParaLineSpacingControl::ToGetFocus(bool bType) 172*766ce4d0SZheng Fan { 173*766ce4d0SZheng Fan if(!bType) 174*766ce4d0SZheng Fan aLineDist.GrabFocus(); 175*766ce4d0SZheng Fan else 176*766ce4d0SZheng Fan maLineSpacing.GrabFocus(); //wj 177*766ce4d0SZheng Fan } 178*766ce4d0SZheng Fan 179*766ce4d0SZheng Fan void ParaLineSpacingControl::PopupModeEndCallback() 180*766ce4d0SZheng Fan { 181*766ce4d0SZheng Fan if( mbUseLineSPCustom ) 182*766ce4d0SZheng Fan { 183*766ce4d0SZheng Fan //maLinePos = mpLineSPPage->maPos; 184*766ce4d0SZheng Fan //maLineValue = mpLineSPPage->maValue; 185*766ce4d0SZheng Fan 186*766ce4d0SZheng Fan SvtViewOptions aWinOpt( E_WINDOW, LSP_POS_GLOBAL_VALUE ); 187*766ce4d0SZheng Fan ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq(1); 188*766ce4d0SZheng Fan aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("maLinePos") ); 189*766ce4d0SZheng Fan aSeq[0].Value <<= ::rtl::OUString( String::CreateFromInt64( maPos )); 190*766ce4d0SZheng Fan aWinOpt.SetUserData( aSeq ); 191*766ce4d0SZheng Fan 192*766ce4d0SZheng Fan SvtViewOptions aWinOpt2( E_WINDOW, LSP_LV_GLOBAL_VALUE ); 193*766ce4d0SZheng Fan aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("maLineValue") ); 194*766ce4d0SZheng Fan aSeq[0].Value <<= ::rtl::OUString( String::CreateFromInt64( maValue )); 195*766ce4d0SZheng Fan aWinOpt2.SetUserData( aSeq ); 196*766ce4d0SZheng Fan } 197*766ce4d0SZheng Fan } 198*766ce4d0SZheng Fan 199*766ce4d0SZheng Fan void ParaLineSpacingControl::Rearrange(SfxItemState currSPState,FieldUnit currMetricUnit,SvxLineSpacingItem* currSPItem,const ::sfx2::sidebar::EnumContext currentContext) 200*766ce4d0SZheng Fan { 201*766ce4d0SZheng Fan SvtViewOptions aWinOpt( E_WINDOW, LSP_POS_GLOBAL_VALUE ); 202*766ce4d0SZheng Fan if ( aWinOpt.Exists() ) 203*766ce4d0SZheng Fan { 204*766ce4d0SZheng Fan ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq = aWinOpt.GetUserData(); 205*766ce4d0SZheng Fan ::rtl::OUString aTmp; 206*766ce4d0SZheng Fan if ( aSeq.getLength()) 207*766ce4d0SZheng Fan aSeq[0].Value >>= aTmp; 208*766ce4d0SZheng Fan 209*766ce4d0SZheng Fan String aWinData( aTmp ); 210*766ce4d0SZheng Fan maPos = (sal_uInt16)aWinData.ToInt32(); 211*766ce4d0SZheng Fan } 212*766ce4d0SZheng Fan 213*766ce4d0SZheng Fan SvtViewOptions aWinOpt2( E_WINDOW, LSP_LV_GLOBAL_VALUE ); 214*766ce4d0SZheng Fan if ( aWinOpt2.Exists() ) 215*766ce4d0SZheng Fan { 216*766ce4d0SZheng Fan ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq = aWinOpt2.GetUserData(); 217*766ce4d0SZheng Fan ::rtl::OUString aTmp; 218*766ce4d0SZheng Fan if ( aSeq.getLength()) 219*766ce4d0SZheng Fan aSeq[0].Value >>= aTmp; 220*766ce4d0SZheng Fan 221*766ce4d0SZheng Fan String aWinData( aTmp ); 222*766ce4d0SZheng Fan maValue = (sal_uInt16)aWinData.ToInt32(); 223*766ce4d0SZheng Fan } 224*766ce4d0SZheng Fan String sHelpText; 225*766ce4d0SZheng Fan switch(maPos) 226*766ce4d0SZheng Fan { 227*766ce4d0SZheng Fan case LLINESPACE_1: 228*766ce4d0SZheng Fan sHelpText += mpStrTip[0]; 229*766ce4d0SZheng Fan break; 230*766ce4d0SZheng Fan case LLINESPACE_15: 231*766ce4d0SZheng Fan sHelpText += mpStrTip[2]; 232*766ce4d0SZheng Fan break; 233*766ce4d0SZheng Fan case LLINESPACE_2: 234*766ce4d0SZheng Fan sHelpText += mpStrTip[3]; 235*766ce4d0SZheng Fan break; 236*766ce4d0SZheng Fan case LLINESPACE_PROP: 237*766ce4d0SZheng Fan sHelpText +=maLine; 238*766ce4d0SZheng Fan sHelpText.Append(String("Proportion: ", 12, RTL_TEXTENCODING_ASCII_US)); 239*766ce4d0SZheng Fan sHelpText += maOf; 240*766ce4d0SZheng Fan sHelpText.Append( String::CreateFromInt64( maValue )); 241*766ce4d0SZheng Fan break; 242*766ce4d0SZheng Fan case LLINESPACE_MIN: 243*766ce4d0SZheng Fan sHelpText += maLine; 244*766ce4d0SZheng Fan sHelpText.Append(String("At Least: ", 10, RTL_TEXTENCODING_ASCII_US)); 245*766ce4d0SZheng Fan sHelpText += maOf; 246*766ce4d0SZheng Fan sHelpText.Append( String::CreateFromInt64( maValue )); 247*766ce4d0SZheng Fan break; 248*766ce4d0SZheng Fan case LLINESPACE_DURCH: 249*766ce4d0SZheng Fan sHelpText += maLine; 250*766ce4d0SZheng Fan sHelpText.Append(String("Leading: ", 9, RTL_TEXTENCODING_ASCII_US)); 251*766ce4d0SZheng Fan sHelpText += maOf; 252*766ce4d0SZheng Fan sHelpText.Append( String::CreateFromInt64( maValue )); 253*766ce4d0SZheng Fan break; 254*766ce4d0SZheng Fan case LLINESPACE_FIX: 255*766ce4d0SZheng Fan sHelpText += maLine; 256*766ce4d0SZheng Fan sHelpText.Append(String("Fixed: ", 7, RTL_TEXTENCODING_ASCII_US)); 257*766ce4d0SZheng Fan sHelpText += maOf; 258*766ce4d0SZheng Fan sHelpText.Append( String::CreateFromInt64( maValue )); 259*766ce4d0SZheng Fan break; 260*766ce4d0SZheng Fan } 261*766ce4d0SZheng Fan if( !aWinOpt.Exists() && !aWinOpt2.Exists() ) 262*766ce4d0SZheng Fan mbLineSPDisable = sal_True; 263*766ce4d0SZheng Fan else 264*766ce4d0SZheng Fan mbLineSPDisable = sal_False; 265*766ce4d0SZheng Fan 266*766ce4d0SZheng Fan if( mbLineSPDisable ) 267*766ce4d0SZheng Fan maLineSpacing.SetCusEnable(0); 268*766ce4d0SZheng Fan else 269*766ce4d0SZheng Fan { 270*766ce4d0SZheng Fan maLineSpacing.SetCusEnable(1); 271*766ce4d0SZheng Fan maLineSpacing.SetCustomTip(sHelpText,sal_True);//Modify for Sym2_7266 272*766ce4d0SZheng Fan } 273*766ce4d0SZheng Fan 274*766ce4d0SZheng Fan SfxItemState eState = currSPState; 275*766ce4d0SZheng Fan 276*766ce4d0SZheng Fan SetFieldUnit( aLineDistAtMetricBox, currMetricUnit ); 277*766ce4d0SZheng Fan 278*766ce4d0SZheng Fan // mpLineSPPage->SetAllNoSel(); 279*766ce4d0SZheng Fan aLineDist.Enable(); 280*766ce4d0SZheng Fan pActLineDistFld->Enable(); 281*766ce4d0SZheng Fan pActLineDistFld->SetText( String() ); 282*766ce4d0SZheng Fan bool bValueSetFocus = sal_False; //wj 283*766ce4d0SZheng Fan 284*766ce4d0SZheng Fan if( eState >= SFX_ITEM_AVAILABLE ) 285*766ce4d0SZheng Fan { 286*766ce4d0SZheng Fan // SfxMapUnit eUnit = maLNSpaceControl.GetCoreMetric(); 287*766ce4d0SZheng Fan SfxMapUnit eUnit = SFX_MAPUNIT_100TH_MM; 288*766ce4d0SZheng Fan m_eLNSpaceUnit = eUnit; 289*766ce4d0SZheng Fan 290*766ce4d0SZheng Fan switch( currSPItem->GetLineSpaceRule() ) 291*766ce4d0SZheng Fan { 292*766ce4d0SZheng Fan case SVX_LINE_SPACE_AUTO: 293*766ce4d0SZheng Fan { 294*766ce4d0SZheng Fan SvxInterLineSpace eInter = currSPItem->GetInterLineSpaceRule(); 295*766ce4d0SZheng Fan 296*766ce4d0SZheng Fan switch( eInter ) 297*766ce4d0SZheng Fan { 298*766ce4d0SZheng Fan case SVX_INTER_LINE_SPACE_OFF: 299*766ce4d0SZheng Fan { 300*766ce4d0SZheng Fan aLineDist.SelectEntryPos( LLINESPACE_1 ); 301*766ce4d0SZheng Fan pActLineDistFld->Disable(); 302*766ce4d0SZheng Fan pActLineDistFld->SetText( String() ); 303*766ce4d0SZheng Fan mbUseLineSPCustom = DO_NOT_CUSTOM; 304*766ce4d0SZheng Fan if ( LINESPACE_1 == currSPItem->GetPropLineSpace() ) 305*766ce4d0SZheng Fan { 306*766ce4d0SZheng Fan maLineSpacing.SetSelItem(1); 307*766ce4d0SZheng Fan bValueSetFocus = sal_True; //wj 308*766ce4d0SZheng Fan } 309*766ce4d0SZheng Fan } 310*766ce4d0SZheng Fan break; 311*766ce4d0SZheng Fan 312*766ce4d0SZheng Fan case SVX_INTER_LINE_SPACE_PROP: 313*766ce4d0SZheng Fan { 314*766ce4d0SZheng Fan if ( LINESPACE_1 == currSPItem->GetPropLineSpace() ) 315*766ce4d0SZheng Fan { 316*766ce4d0SZheng Fan aLineDist.SelectEntryPos( LLINESPACE_1 ); 317*766ce4d0SZheng Fan pActLineDistFld->Disable(); 318*766ce4d0SZheng Fan pActLineDistFld->SetText( String() ); 319*766ce4d0SZheng Fan mbUseLineSPCustom = DO_NOT_CUSTOM; 320*766ce4d0SZheng Fan maLineSpacing.SetSelItem(1); 321*766ce4d0SZheng Fan bValueSetFocus = sal_True; //wj 322*766ce4d0SZheng Fan break; 323*766ce4d0SZheng Fan } 324*766ce4d0SZheng Fan if ( LINESPACE_15 == currSPItem->GetPropLineSpace() ) 325*766ce4d0SZheng Fan { 326*766ce4d0SZheng Fan aLineDist.SelectEntryPos( LLINESPACE_15 ); 327*766ce4d0SZheng Fan pActLineDistFld->Disable(); 328*766ce4d0SZheng Fan pActLineDistFld->SetText( String() ); 329*766ce4d0SZheng Fan 330*766ce4d0SZheng Fan mbUseLineSPCustom = DO_NOT_CUSTOM; 331*766ce4d0SZheng Fan maLineSpacing.SetSelItem(3); 332*766ce4d0SZheng Fan bValueSetFocus = sal_True; //wj 333*766ce4d0SZheng Fan break; 334*766ce4d0SZheng Fan } 335*766ce4d0SZheng Fan if ( LINESPACE_2 == currSPItem->GetPropLineSpace() ) 336*766ce4d0SZheng Fan { 337*766ce4d0SZheng Fan aLineDist.SelectEntryPos( LLINESPACE_2 ); 338*766ce4d0SZheng Fan pActLineDistFld->Disable(); 339*766ce4d0SZheng Fan pActLineDistFld->SetText( String() ); 340*766ce4d0SZheng Fan 341*766ce4d0SZheng Fan mbUseLineSPCustom = DO_NOT_CUSTOM; 342*766ce4d0SZheng Fan maLineSpacing.SetSelItem(4); 343*766ce4d0SZheng Fan bValueSetFocus = sal_True; //wj 344*766ce4d0SZheng Fan break; 345*766ce4d0SZheng Fan } 346*766ce4d0SZheng Fan 347*766ce4d0SZheng Fan aLineDist.SelectEntryPos( LLINESPACE_PROP ); 348*766ce4d0SZheng Fan if(pActLineDistFld != &(aLineDistAtPercentBox)) 349*766ce4d0SZheng Fan { 350*766ce4d0SZheng Fan pActLineDistFld->Disable(); 351*766ce4d0SZheng Fan pActLineDistFld->Hide(); 352*766ce4d0SZheng Fan pActLineDistFld = &(aLineDistAtPercentBox); 353*766ce4d0SZheng Fan } 354*766ce4d0SZheng Fan else 355*766ce4d0SZheng Fan { 356*766ce4d0SZheng Fan pActLineDistFld = &(aLineDistAtMetricBox); 357*766ce4d0SZheng Fan pActLineDistFld->Disable(); 358*766ce4d0SZheng Fan pActLineDistFld->Hide(); 359*766ce4d0SZheng Fan pActLineDistFld = &(aLineDistAtPercentBox); 360*766ce4d0SZheng Fan } 361*766ce4d0SZheng Fan pActLineDistFld->Enable(); 362*766ce4d0SZheng Fan pActLineDistFld->Show(); 363*766ce4d0SZheng Fan aLineDistAtPercentBox. 364*766ce4d0SZheng Fan SetValue( aLineDistAtPercentBox.Normalize( 365*766ce4d0SZheng Fan currSPItem->GetPropLineSpace() ) ); 366*766ce4d0SZheng Fan 367*766ce4d0SZheng Fan if( currSPItem->GetPropLineSpace() == LINESPACE_115 ) 368*766ce4d0SZheng Fan { 369*766ce4d0SZheng Fan mbUseLineSPCustom = DO_NOT_CUSTOM; 370*766ce4d0SZheng Fan maLineSpacing.SetSelItem(2); 371*766ce4d0SZheng Fan bValueSetFocus = sal_True; //wj 372*766ce4d0SZheng Fan } 373*766ce4d0SZheng Fan else 374*766ce4d0SZheng Fan { 375*766ce4d0SZheng Fan mbUseLineSPCustom = USE_CUSTOM; 376*766ce4d0SZheng Fan maLineSpacing.SetSelItem(0); 377*766ce4d0SZheng Fan } 378*766ce4d0SZheng Fan } 379*766ce4d0SZheng Fan break; 380*766ce4d0SZheng Fan 381*766ce4d0SZheng Fan case SVX_INTER_LINE_SPACE_FIX: 382*766ce4d0SZheng Fan { 383*766ce4d0SZheng Fan if(pActLineDistFld != &(aLineDistAtMetricBox)) 384*766ce4d0SZheng Fan { 385*766ce4d0SZheng Fan pActLineDistFld->Disable(); 386*766ce4d0SZheng Fan pActLineDistFld->Hide(); 387*766ce4d0SZheng Fan pActLineDistFld = &(aLineDistAtMetricBox); 388*766ce4d0SZheng Fan } 389*766ce4d0SZheng Fan else 390*766ce4d0SZheng Fan { 391*766ce4d0SZheng Fan pActLineDistFld = &(aLineDistAtPercentBox); 392*766ce4d0SZheng Fan pActLineDistFld->Disable(); 393*766ce4d0SZheng Fan pActLineDistFld->Hide(); 394*766ce4d0SZheng Fan pActLineDistFld = &(aLineDistAtMetricBox); 395*766ce4d0SZheng Fan } 396*766ce4d0SZheng Fan pActLineDistFld->Enable(); 397*766ce4d0SZheng Fan pActLineDistFld->Show(); 398*766ce4d0SZheng Fan maLineSpacing.SetSelItem(0); 399*766ce4d0SZheng Fan 400*766ce4d0SZheng Fan SetMetricValue( aLineDistAtMetricBox, 401*766ce4d0SZheng Fan currSPItem->GetInterLineSpace(), eUnit ); 402*766ce4d0SZheng Fan aLineDist.SelectEntryPos( LLINESPACE_DURCH ); 403*766ce4d0SZheng Fan 404*766ce4d0SZheng Fan mbUseLineSPCustom = USE_CUSTOM; 405*766ce4d0SZheng Fan } 406*766ce4d0SZheng Fan break; 407*766ce4d0SZheng Fan } 408*766ce4d0SZheng Fan } 409*766ce4d0SZheng Fan break; 410*766ce4d0SZheng Fan case SVX_LINE_SPACE_FIX: 411*766ce4d0SZheng Fan { 412*766ce4d0SZheng Fan if(pActLineDistFld != &(aLineDistAtMetricBox)) 413*766ce4d0SZheng Fan { 414*766ce4d0SZheng Fan pActLineDistFld->Disable(); 415*766ce4d0SZheng Fan pActLineDistFld->Hide(); 416*766ce4d0SZheng Fan pActLineDistFld = &(aLineDistAtMetricBox); 417*766ce4d0SZheng Fan } 418*766ce4d0SZheng Fan else 419*766ce4d0SZheng Fan { 420*766ce4d0SZheng Fan pActLineDistFld = &(aLineDistAtPercentBox); 421*766ce4d0SZheng Fan pActLineDistFld->Disable(); 422*766ce4d0SZheng Fan pActLineDistFld->Hide(); 423*766ce4d0SZheng Fan pActLineDistFld = &(aLineDistAtMetricBox); 424*766ce4d0SZheng Fan } 425*766ce4d0SZheng Fan pActLineDistFld->Enable(); 426*766ce4d0SZheng Fan pActLineDistFld->Show(); 427*766ce4d0SZheng Fan maLineSpacing.SetSelItem(0); 428*766ce4d0SZheng Fan 429*766ce4d0SZheng Fan SetMetricValue(aLineDistAtMetricBox, currSPItem->GetLineHeight(), eUnit); 430*766ce4d0SZheng Fan aLineDist.SelectEntryPos( LLINESPACE_FIX ); 431*766ce4d0SZheng Fan 432*766ce4d0SZheng Fan mbUseLineSPCustom = USE_CUSTOM; 433*766ce4d0SZheng Fan } 434*766ce4d0SZheng Fan break; 435*766ce4d0SZheng Fan 436*766ce4d0SZheng Fan case SVX_LINE_SPACE_MIN: 437*766ce4d0SZheng Fan { 438*766ce4d0SZheng Fan if(pActLineDistFld != &(aLineDistAtMetricBox)) 439*766ce4d0SZheng Fan { 440*766ce4d0SZheng Fan pActLineDistFld->Disable(); 441*766ce4d0SZheng Fan pActLineDistFld->Hide(); 442*766ce4d0SZheng Fan pActLineDistFld = &(aLineDistAtMetricBox); 443*766ce4d0SZheng Fan } 444*766ce4d0SZheng Fan else 445*766ce4d0SZheng Fan { 446*766ce4d0SZheng Fan pActLineDistFld = &(aLineDistAtPercentBox); 447*766ce4d0SZheng Fan pActLineDistFld->Disable(); 448*766ce4d0SZheng Fan pActLineDistFld->Hide(); 449*766ce4d0SZheng Fan pActLineDistFld = &(aLineDistAtMetricBox); 450*766ce4d0SZheng Fan } 451*766ce4d0SZheng Fan pActLineDistFld->Enable(); 452*766ce4d0SZheng Fan pActLineDistFld->Show(); 453*766ce4d0SZheng Fan maLineSpacing.SetSelItem(0); 454*766ce4d0SZheng Fan 455*766ce4d0SZheng Fan SetMetricValue(aLineDistAtMetricBox, currSPItem->GetLineHeight(), eUnit); 456*766ce4d0SZheng Fan aLineDist.SelectEntryPos( LLINESPACE_MIN ); 457*766ce4d0SZheng Fan mbUseLineSPCustom = USE_CUSTOM; 458*766ce4d0SZheng Fan } 459*766ce4d0SZheng Fan break; 460*766ce4d0SZheng Fan } 461*766ce4d0SZheng Fan } 462*766ce4d0SZheng Fan else if( eState == SFX_ITEM_DISABLED ) 463*766ce4d0SZheng Fan { 464*766ce4d0SZheng Fan aLineDist.Disable(); 465*766ce4d0SZheng Fan pActLineDistFld->Enable(sal_False); 466*766ce4d0SZheng Fan pActLineDistFld->SetText( String() ); 467*766ce4d0SZheng Fan maLineSpacing.SetSelItem(0); 468*766ce4d0SZheng Fan 469*766ce4d0SZheng Fan mbUseLineSPCustom = DO_NOT_CUSTOM; 470*766ce4d0SZheng Fan } 471*766ce4d0SZheng Fan else 472*766ce4d0SZheng Fan { 473*766ce4d0SZheng Fan pActLineDistFld->Enable(sal_False); 474*766ce4d0SZheng Fan pActLineDistFld->SetText( String() ); 475*766ce4d0SZheng Fan aLineDist.SetNoSelection(); 476*766ce4d0SZheng Fan maLineSpacing.SetSelItem(0); 477*766ce4d0SZheng Fan mbUseLineSPCustom = DO_NOT_CUSTOM; 478*766ce4d0SZheng Fan } 479*766ce4d0SZheng Fan 480*766ce4d0SZheng Fan aLineDist.SaveValue(); 481*766ce4d0SZheng Fan 482*766ce4d0SZheng Fan /*sal_uInt16 nID = pBox->GetCurItemId(); 483*766ce4d0SZheng Fan pBox->SetItemDown(nID, sal_True); 484*766ce4d0SZheng Fan 485*766ce4d0SZheng Fan Size aFloatSz = GetOutputSizePixel(); 486*766ce4d0SZheng Fan 487*766ce4d0SZheng Fan GetLineSPFloatWin()->SetSizePixel( aFloatSz ); 488*766ce4d0SZheng Fan 489*766ce4d0SZheng Fan Point aPos=maLineSPTbx->GetPosPixel(); 490*766ce4d0SZheng Fan aPos.setX(aPos.getX()); 491*766ce4d0SZheng Fan aPos = OutputToScreenPixel( aPos ); 492*766ce4d0SZheng Fan Size aSize = maLineSPTbx->GetSizePixel(); 493*766ce4d0SZheng Fan Rectangle aRect( aPos, aSize ); 494*766ce4d0SZheng Fan 495*766ce4d0SZheng Fan GetLineSPFloatWin()->StartPopupMode( aRect, FLOATWIN_POPUPMODE_DOWN | FLOATWIN_POPUPMODE_NOFOCUSCLOSE); 496*766ce4d0SZheng Fan GetLineSPFloatWin()->SetPopupModeFlags(GetLineSPFloatWin()->GetPopupModeFlags() | FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE ); 497*766ce4d0SZheng Fan 498*766ce4d0SZheng Fan pLineSPPage->ToGetFocus(bValueSetFocus); 499*766ce4d0SZheng Fan */ 500*766ce4d0SZheng Fan sal_uInt16 uCount = aLineDist.GetEntryCount(); 501*766ce4d0SZheng Fan if( uCount == LLINESPACE_FIX + 1 ) 502*766ce4d0SZheng Fan { 503*766ce4d0SZheng Fan switch (currentContext.GetCombinedContext()) 504*766ce4d0SZheng Fan { 505*766ce4d0SZheng Fan case CombinedEnumContext(Application_Impress, Context_Table): 506*766ce4d0SZheng Fan case CombinedEnumContext(Application_Draw, Context_Table): 507*766ce4d0SZheng Fan case CombinedEnumContext(Application_Writer, Context_DrawText): 508*766ce4d0SZheng Fan case CombinedEnumContext(Application_Calc, Context_DrawText): 509*766ce4d0SZheng Fan case CombinedEnumContext(Application_Draw, Context_DrawText): 510*766ce4d0SZheng Fan case CombinedEnumContext(Application_Impress, Context_DrawText): 511*766ce4d0SZheng Fan case CombinedEnumContext(Application_Writer, Context_Annotation): 512*766ce4d0SZheng Fan case CombinedEnumContext(Application_Draw, Context_Draw): 513*766ce4d0SZheng Fan case CombinedEnumContext(Application_Draw, Context_TextObject): 514*766ce4d0SZheng Fan case CombinedEnumContext(Application_Draw, Context_Graphic): 515*766ce4d0SZheng Fan case CombinedEnumContext(Application_Impress, Context_Draw): 516*766ce4d0SZheng Fan case CombinedEnumContext(Application_Impress, Context_TextObject): 517*766ce4d0SZheng Fan case CombinedEnumContext(Application_Impress, Context_Graphic): 518*766ce4d0SZheng Fan { 519*766ce4d0SZheng Fan aLineDist.RemoveEntry(LLINESPACE_FIX); 520*766ce4d0SZheng Fan } 521*766ce4d0SZheng Fan } 522*766ce4d0SZheng Fan } 523*766ce4d0SZheng Fan else if( uCount == LLINESPACE_FIX) 524*766ce4d0SZheng Fan { 525*766ce4d0SZheng Fan switch (currentContext.GetCombinedContext()) 526*766ce4d0SZheng Fan { 527*766ce4d0SZheng Fan case CombinedEnumContext(Application_Writer, Context_Default): 528*766ce4d0SZheng Fan case CombinedEnumContext(Application_Writer, Context_Text): 529*766ce4d0SZheng Fan case CombinedEnumContext(Application_Writer, Context_Table): 530*766ce4d0SZheng Fan { 531*766ce4d0SZheng Fan aLineDist.InsertEntry(String::CreateFromAscii("Fixed"), LLINESPACE_FIX); 532*766ce4d0SZheng Fan } 533*766ce4d0SZheng Fan } 534*766ce4d0SZheng Fan } 535*766ce4d0SZheng Fan maLineSpacing.Format(); 536*766ce4d0SZheng Fan maLineSpacing.StartSelection(); 537*766ce4d0SZheng Fan } 538*766ce4d0SZheng Fan 539*766ce4d0SZheng Fan void ParaLineSpacingControl::SetAllNoSel() 540*766ce4d0SZheng Fan { 541*766ce4d0SZheng Fan maLineSpacing.SelectItem(1); //modified by wj for sym2_5397 542*766ce4d0SZheng Fan maLineSpacing.SetNoSelection(); 543*766ce4d0SZheng Fan } 544*766ce4d0SZheng Fan 545*766ce4d0SZheng Fan IMPL_LINK( ParaLineSpacingControl, LineSPDistHdl_Impl, ListBox*, pBox ) 546*766ce4d0SZheng Fan { 547*766ce4d0SZheng Fan maLineSpacing.SetNoSelection(); 548*766ce4d0SZheng Fan maLineSpacing.SetSelItem(0); 549*766ce4d0SZheng Fan maLineSpacing.Format(); 550*766ce4d0SZheng Fan maLineSpacing.StartSelection(); 551*766ce4d0SZheng Fan 552*766ce4d0SZheng Fan switch( pBox->GetSelectEntryPos() ) 553*766ce4d0SZheng Fan { 554*766ce4d0SZheng Fan case LLINESPACE_1: 555*766ce4d0SZheng Fan case LLINESPACE_15: 556*766ce4d0SZheng Fan case LLINESPACE_2: 557*766ce4d0SZheng Fan pActLineDistFld->Enable(sal_False); 558*766ce4d0SZheng Fan pActLineDistFld->SetText( String() ); 559*766ce4d0SZheng Fan break; 560*766ce4d0SZheng Fan 561*766ce4d0SZheng Fan case LLINESPACE_DURCH: 562*766ce4d0SZheng Fan aLineDistAtPercentBox.Hide(); 563*766ce4d0SZheng Fan pActLineDistFld = &aLineDistAtMetricBox; 564*766ce4d0SZheng Fan aLineDistAtMetricBox.SetMin(0); 565*766ce4d0SZheng Fan 566*766ce4d0SZheng Fan 567*766ce4d0SZheng Fan if ( !aLineDistAtMetricBox.GetText().Len() ) 568*766ce4d0SZheng Fan aLineDistAtMetricBox.SetValue( 569*766ce4d0SZheng Fan aLineDistAtMetricBox.Normalize( 0 ) ); 570*766ce4d0SZheng Fan aLineDistAtPercentBox.Hide(); 571*766ce4d0SZheng Fan pActLineDistFld->Show(); 572*766ce4d0SZheng Fan pActLineDistFld->Enable(); 573*766ce4d0SZheng Fan break; 574*766ce4d0SZheng Fan 575*766ce4d0SZheng Fan case LLINESPACE_MIN: 576*766ce4d0SZheng Fan aLineDistAtPercentBox.Hide(); 577*766ce4d0SZheng Fan pActLineDistFld = &aLineDistAtMetricBox; 578*766ce4d0SZheng Fan aLineDistAtMetricBox.SetMin(0); 579*766ce4d0SZheng Fan 580*766ce4d0SZheng Fan if ( !aLineDistAtMetricBox.GetText().Len() ) 581*766ce4d0SZheng Fan aLineDistAtMetricBox.SetValue( 582*766ce4d0SZheng Fan aLineDistAtMetricBox.Normalize( 0 ), FUNIT_TWIP ); 583*766ce4d0SZheng Fan aLineDistAtPercentBox.Hide(); 584*766ce4d0SZheng Fan pActLineDistFld->Show(); 585*766ce4d0SZheng Fan pActLineDistFld->Enable(); 586*766ce4d0SZheng Fan break; 587*766ce4d0SZheng Fan 588*766ce4d0SZheng Fan case LLINESPACE_PROP: 589*766ce4d0SZheng Fan aLineDistAtMetricBox.Hide(); 590*766ce4d0SZheng Fan pActLineDistFld = &aLineDistAtPercentBox; 591*766ce4d0SZheng Fan 592*766ce4d0SZheng Fan if ( !aLineDistAtPercentBox.GetText().Len() ) 593*766ce4d0SZheng Fan aLineDistAtPercentBox.SetValue( 594*766ce4d0SZheng Fan aLineDistAtPercentBox.Normalize( 100 ), FUNIT_TWIP ); 595*766ce4d0SZheng Fan aLineDistAtMetricBox.Hide(); 596*766ce4d0SZheng Fan pActLineDistFld->Show(); 597*766ce4d0SZheng Fan pActLineDistFld->Enable(); 598*766ce4d0SZheng Fan break; 599*766ce4d0SZheng Fan case LLINESPACE_FIX: 600*766ce4d0SZheng Fan { 601*766ce4d0SZheng Fan aLineDistAtPercentBox.Hide(); 602*766ce4d0SZheng Fan pActLineDistFld = &aLineDistAtMetricBox; 603*766ce4d0SZheng Fan sal_Int64 nTemp = aLineDistAtMetricBox.GetValue(); 604*766ce4d0SZheng Fan aLineDistAtMetricBox.SetMin(aLineDistAtMetricBox.Normalize(nMinFixDist), FUNIT_TWIP); 605*766ce4d0SZheng Fan 606*766ce4d0SZheng Fan if ( aLineDistAtMetricBox.GetValue() != nTemp ) 607*766ce4d0SZheng Fan SetMetricValue( aLineDistAtMetricBox, 608*766ce4d0SZheng Fan FIX_DIST_DEF, SFX_MAPUNIT_TWIP ); 609*766ce4d0SZheng Fan aLineDistAtPercentBox.Hide(); 610*766ce4d0SZheng Fan pActLineDistFld->Show(); 611*766ce4d0SZheng Fan pActLineDistFld->Enable(); 612*766ce4d0SZheng Fan } 613*766ce4d0SZheng Fan break; 614*766ce4d0SZheng Fan } 615*766ce4d0SZheng Fan ExecuteLineSpace(); 616*766ce4d0SZheng Fan return 0; 617*766ce4d0SZheng Fan } 618*766ce4d0SZheng Fan 619*766ce4d0SZheng Fan IMPL_LINK( ParaLineSpacingControl, LineSPDistAtHdl_Impl, MetricField*, pBox ) 620*766ce4d0SZheng Fan { 621*766ce4d0SZheng Fan ExecuteLineSpace(); 622*766ce4d0SZheng Fan return (0L); 623*766ce4d0SZheng Fan } 624*766ce4d0SZheng Fan 625*766ce4d0SZheng Fan void ParaLineSpacingControl::ExecuteLineSpace() 626*766ce4d0SZheng Fan { 627*766ce4d0SZheng Fan aLineDist.SaveValue(); 628*766ce4d0SZheng Fan maLineSpacing.SetNoSelection(); 629*766ce4d0SZheng Fan 630*766ce4d0SZheng Fan SvxLineSpacingItem aSpacing(_DEFAULT_LINE_SPACING, SID_ATTR_PARA_LINESPACE); 631*766ce4d0SZheng Fan sal_uInt16 nPos = aLineDist.GetSelectEntryPos(); 632*766ce4d0SZheng Fan 633*766ce4d0SZheng Fan switch ( nPos ) 634*766ce4d0SZheng Fan { 635*766ce4d0SZheng Fan case LLINESPACE_1: 636*766ce4d0SZheng Fan case LLINESPACE_15: 637*766ce4d0SZheng Fan case LLINESPACE_2: 638*766ce4d0SZheng Fan { 639*766ce4d0SZheng Fan SetLineSpace( aSpacing, nPos ); 640*766ce4d0SZheng Fan maPos = nPos; 641*766ce4d0SZheng Fan } 642*766ce4d0SZheng Fan break; 643*766ce4d0SZheng Fan 644*766ce4d0SZheng Fan case LLINESPACE_PROP: 645*766ce4d0SZheng Fan { 646*766ce4d0SZheng Fan SetLineSpace( aSpacing, nPos, 647*766ce4d0SZheng Fan aLineDistAtPercentBox.Denormalize( 648*766ce4d0SZheng Fan (long)aLineDistAtPercentBox.GetValue() ) ); 649*766ce4d0SZheng Fan maPos = nPos; 650*766ce4d0SZheng Fan maValue =aLineDistAtPercentBox.GetValue(); 651*766ce4d0SZheng Fan } 652*766ce4d0SZheng Fan break; 653*766ce4d0SZheng Fan 654*766ce4d0SZheng Fan case LLINESPACE_MIN: 655*766ce4d0SZheng Fan case LLINESPACE_DURCH: 656*766ce4d0SZheng Fan case LLINESPACE_FIX: 657*766ce4d0SZheng Fan { 658*766ce4d0SZheng Fan SetLineSpace( aSpacing, nPos, 659*766ce4d0SZheng Fan GetCoreValue( aLineDistAtMetricBox, m_eLNSpaceUnit ) ); 660*766ce4d0SZheng Fan maPos = nPos; 661*766ce4d0SZheng Fan maValue = GetCoreValue( aLineDistAtMetricBox, m_eLNSpaceUnit ); 662*766ce4d0SZheng Fan } 663*766ce4d0SZheng Fan break; 664*766ce4d0SZheng Fan 665*766ce4d0SZheng Fan default: 666*766ce4d0SZheng Fan DBG_ERROR( "error!!" ); 667*766ce4d0SZheng Fan break; 668*766ce4d0SZheng Fan } 669*766ce4d0SZheng Fan 670*766ce4d0SZheng Fan mpBindings->GetDispatcher()->Execute( 671*766ce4d0SZheng Fan SID_ATTR_PARA_LINESPACE, SFX_CALLMODE_RECORD, &aSpacing, 0L); 672*766ce4d0SZheng Fan 673*766ce4d0SZheng Fan mbUseLineSPCustom = USE_CUSTOM; 674*766ce4d0SZheng Fan } 675*766ce4d0SZheng Fan 676*766ce4d0SZheng Fan void ParaLineSpacingControl::SetLineSpace( SvxLineSpacingItem& rLineSpace, 677*766ce4d0SZheng Fan int eSpace, long lValue ) 678*766ce4d0SZheng Fan { 679*766ce4d0SZheng Fan switch ( eSpace ) 680*766ce4d0SZheng Fan { 681*766ce4d0SZheng Fan case LLINESPACE_1: 682*766ce4d0SZheng Fan rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO; 683*766ce4d0SZheng Fan rLineSpace.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF; 684*766ce4d0SZheng Fan break; 685*766ce4d0SZheng Fan 686*766ce4d0SZheng Fan case LLINESPACE_15: 687*766ce4d0SZheng Fan rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO; 688*766ce4d0SZheng Fan rLineSpace.SetPropLineSpace( LINESPACE_15 ); 689*766ce4d0SZheng Fan break; 690*766ce4d0SZheng Fan 691*766ce4d0SZheng Fan case LLINESPACE_2: 692*766ce4d0SZheng Fan rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO; 693*766ce4d0SZheng Fan rLineSpace.SetPropLineSpace( LINESPACE_2 ); 694*766ce4d0SZheng Fan break; 695*766ce4d0SZheng Fan 696*766ce4d0SZheng Fan case LLINESPACE_PROP: 697*766ce4d0SZheng Fan rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO; 698*766ce4d0SZheng Fan rLineSpace.SetPropLineSpace( (sal_uInt8)lValue ); 699*766ce4d0SZheng Fan break; 700*766ce4d0SZheng Fan 701*766ce4d0SZheng Fan case LLINESPACE_MIN: 702*766ce4d0SZheng Fan rLineSpace.SetLineHeight( (sal_uInt16)lValue ); 703*766ce4d0SZheng Fan rLineSpace.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF; 704*766ce4d0SZheng Fan break; 705*766ce4d0SZheng Fan 706*766ce4d0SZheng Fan case LLINESPACE_DURCH: 707*766ce4d0SZheng Fan rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO; 708*766ce4d0SZheng Fan rLineSpace.SetInterLineSpace( (sal_uInt16)lValue ); 709*766ce4d0SZheng Fan break; 710*766ce4d0SZheng Fan 711*766ce4d0SZheng Fan case LLINESPACE_FIX: 712*766ce4d0SZheng Fan rLineSpace.SetLineHeight((sal_uInt16)lValue); 713*766ce4d0SZheng Fan rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_FIX; 714*766ce4d0SZheng Fan rLineSpace.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF; 715*766ce4d0SZheng Fan break; 716*766ce4d0SZheng Fan } 717*766ce4d0SZheng Fan } 718*766ce4d0SZheng Fan 719*766ce4d0SZheng Fan IMPL_LINK(ParaLineSpacingControl, VSSelHdl, void *, pControl) 720*766ce4d0SZheng Fan { 721*766ce4d0SZheng Fan maLineSpacing.SetNoSelection(); 722*766ce4d0SZheng Fan bool bClosePop = true; 723*766ce4d0SZheng Fan if(pControl == &maLineSpacing) 724*766ce4d0SZheng Fan { 725*766ce4d0SZheng Fan sal_uInt16 iPos = maLineSpacing.GetSelectItemId(); 726*766ce4d0SZheng Fan short nKern = 0; 727*766ce4d0SZheng Fan long nVal = 0; 728*766ce4d0SZheng Fan switch ( iPos ) 729*766ce4d0SZheng Fan { 730*766ce4d0SZheng Fan case 1: 731*766ce4d0SZheng Fan ExecuteLineSpacing( 0, 0 ); 732*766ce4d0SZheng Fan break; 733*766ce4d0SZheng Fan case 2: 734*766ce4d0SZheng Fan ExecuteLineSpacing( 0, 3 ); 735*766ce4d0SZheng Fan break; 736*766ce4d0SZheng Fan case 3: 737*766ce4d0SZheng Fan ExecuteLineSpacing( 0, 1 ); 738*766ce4d0SZheng Fan break; 739*766ce4d0SZheng Fan case 4: 740*766ce4d0SZheng Fan ExecuteLineSpacing( 0, 2 ); 741*766ce4d0SZheng Fan break; 742*766ce4d0SZheng Fan case 5: 743*766ce4d0SZheng Fan { 744*766ce4d0SZheng Fan if(!(mbLineSPDisable)) 745*766ce4d0SZheng Fan { 746*766ce4d0SZheng Fan //maPos = mrParaPropertyPanel.maLinePos; 747*766ce4d0SZheng Fan aLineDist.SelectEntryPos( maPos ) ; 748*766ce4d0SZheng Fan aLineDist.SaveValue(); 749*766ce4d0SZheng Fan //maValue = mrParaPropertyPanel.maLineValue; 750*766ce4d0SZheng Fan 751*766ce4d0SZheng Fan SvxLineSpacingItem aSpacing(_DEFAULT_LINE_SPACING, SID_ATTR_PARA_LINESPACE); 752*766ce4d0SZheng Fan switch(maPos) 753*766ce4d0SZheng Fan { 754*766ce4d0SZheng Fan case LLINESPACE_1: 755*766ce4d0SZheng Fan case LLINESPACE_15: 756*766ce4d0SZheng Fan case LLINESPACE_2: 757*766ce4d0SZheng Fan SetLineSpace( aSpacing, maPos ); 758*766ce4d0SZheng Fan break; 759*766ce4d0SZheng Fan 760*766ce4d0SZheng Fan case LLINESPACE_PROP: 761*766ce4d0SZheng Fan SetLineSpace( aSpacing, maPos, 762*766ce4d0SZheng Fan aLineDistAtPercentBox.Denormalize( (long)maValue ) ); 763*766ce4d0SZheng Fan break; 764*766ce4d0SZheng Fan 765*766ce4d0SZheng Fan case LLINESPACE_MIN: 766*766ce4d0SZheng Fan case LLINESPACE_DURCH: 767*766ce4d0SZheng Fan case LLINESPACE_FIX: 768*766ce4d0SZheng Fan SetLineSpace( aSpacing, maPos, (long)maValue ); 769*766ce4d0SZheng Fan break; 770*766ce4d0SZheng Fan } 771*766ce4d0SZheng Fan 772*766ce4d0SZheng Fan mpBindings->GetDispatcher()->Execute( 773*766ce4d0SZheng Fan SID_ATTR_PARA_LINESPACE, SFX_CALLMODE_RECORD, &aSpacing, 0L); 774*766ce4d0SZheng Fan 775*766ce4d0SZheng Fan ExecuteLineSpacing( USE_CUSTOM, 0 ); 776*766ce4d0SZheng Fan } 777*766ce4d0SZheng Fan else 778*766ce4d0SZheng Fan bClosePop = sal_False; 779*766ce4d0SZheng Fan } 780*766ce4d0SZheng Fan break; 781*766ce4d0SZheng Fan } 782*766ce4d0SZheng Fan } 783*766ce4d0SZheng Fan if(bClosePop) 784*766ce4d0SZheng Fan mrParaPropertyPanel.EndSpacingPopupMode(); 785*766ce4d0SZheng Fan return 0; 786*766ce4d0SZheng Fan } 787*766ce4d0SZheng Fan 788*766ce4d0SZheng Fan void ParaLineSpacingControl::ExecuteLineSpacing( sal_uInt16 aIsCustom, sal_uInt16 aEntry ) 789*766ce4d0SZheng Fan { 790*766ce4d0SZheng Fan if( !aIsCustom ) 791*766ce4d0SZheng Fan { 792*766ce4d0SZheng Fan aLineDist.SelectEntryPos( aEntry ) ; 793*766ce4d0SZheng Fan aLineDist.SaveValue(); 794*766ce4d0SZheng Fan SvxLineSpacingItem aSpacing(_DEFAULT_LINE_SPACING, SID_ATTR_PARA_LINESPACE); 795*766ce4d0SZheng Fan sal_uInt16 nPos = aEntry; 796*766ce4d0SZheng Fan if( aEntry == LLINESPACE_PROP ) 797*766ce4d0SZheng Fan SetLineSpace( aSpacing, nPos, aLineDistAtPercentBox.Denormalize( (long)115 ) ); 798*766ce4d0SZheng Fan else 799*766ce4d0SZheng Fan SetLineSpace( aSpacing, nPos ); 800*766ce4d0SZheng Fan 801*766ce4d0SZheng Fan mpBindings->GetDispatcher()->Execute( 802*766ce4d0SZheng Fan SID_ATTR_PARA_LINESPACE, SFX_CALLMODE_RECORD, &aSpacing, 0L); 803*766ce4d0SZheng Fan } 804*766ce4d0SZheng Fan 805*766ce4d0SZheng Fan if( !aIsCustom ) 806*766ce4d0SZheng Fan { 807*766ce4d0SZheng Fan mbUseLineSPCustom = DO_NOT_CUSTOM; 808*766ce4d0SZheng Fan mrParaPropertyPanel.EndSpacingPopupMode(); 809*766ce4d0SZheng Fan } 810*766ce4d0SZheng Fan maLineSpacing.SetNoSelection(); 811*766ce4d0SZheng Fan } 812*766ce4d0SZheng Fan 813*766ce4d0SZheng Fan }} // end of namespace sidebar 814*766ce4d0SZheng Fan 815