1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_cui.hxx" 30 31 #include <svl/style.hxx> 32 #include <sfx2/app.hxx> 33 #include <sfx2/objsh.hxx> 34 #include <sfx2/module.hxx> 35 #include <vcl/mnemonic.hxx> 36 #include <svx/dialogs.hrc> 37 38 #define _SVX_PARAGRPH_CXX 0 39 40 #include <svl/languageoptions.hxx> 41 #include <editeng/pgrditem.hxx> 42 #include <cuires.hrc> 43 #include "paragrph.hrc" 44 #include "paragrph.hxx" 45 #include <editeng/frmdiritem.hxx> 46 #include <editeng/lspcitem.hxx> 47 #include <editeng/adjitem.hxx> 48 #include <editeng/orphitem.hxx> 49 #include <editeng/widwitem.hxx> 50 #include <editeng/tstpitem.hxx> 51 #include <editeng/pmdlitem.hxx> 52 #include <editeng/spltitem.hxx> 53 #include <editeng/hyznitem.hxx> 54 #include <editeng/ulspitem.hxx> 55 #include <editeng/lrspitem.hxx> 56 #include <editeng/brkitem.hxx> 57 #include <editeng/keepitem.hxx> 58 #include "svx/dlgutil.hxx" 59 #include <dialmgr.hxx> 60 #include "svx/htmlmode.hxx" 61 #include <editeng/paravertalignitem.hxx> 62 #include <svl/eitem.hxx> //add CHINA001 63 #include <sfx2/request.hxx> //add CHINA001 64 #include <svl/intitem.hxx> //add CHINA001 65 66 // static ---------------------------------------------------------------- 67 68 static sal_uInt16 pStdRanges[] = 69 { 70 SID_ATTR_PARA_LINESPACE, // 10033 71 SID_ATTR_PARA_LINESPACE, 72 SID_ATTR_LRSPACE, // 10048 - 73 SID_ATTR_ULSPACE, // 10049 74 SID_ATTR_PARA_REGISTER, // 10413 75 SID_ATTR_PARA_REGISTER, 76 0 77 }; 78 79 static sal_uInt16 pAlignRanges[] = 80 { 81 SID_ATTR_PARA_ADJUST, // 10027 82 SID_ATTR_PARA_ADJUST, 83 0 84 }; 85 86 static sal_uInt16 pExtRanges[] = 87 { 88 SID_ATTR_PARA_PAGEBREAK, // 10037 - 89 SID_ATTR_PARA_WIDOWS, // 10041 90 SID_ATTR_PARA_MODEL, // 10065 - 91 SID_ATTR_PARA_KEEP, // 10066 92 0 93 }; 94 95 // define ---------------------------------------------------------------- 96 97 #define MAX_DURCH 5670 // 10 cm ist sinnvoll als maximaler Durchschuss 98 // laut BP 99 #define FIX_DIST_DEF 283 // Standard-Fix-Abstand 0,5cm 100 101 // enum ------------------------------------------------------------------ 102 103 enum LineSpaceList 104 { 105 LLINESPACE_1 = 0, 106 LLINESPACE_15 = 1, 107 LLINESPACE_2 = 2, 108 LLINESPACE_PROP = 3, 109 LLINESPACE_MIN = 4, 110 LLINESPACE_DURCH= 5, 111 LLINESPACE_FIX = 6, 112 LLINESPACE_END 113 }; 114 115 // C-Funktion ------------------------------------------------------------ 116 117 void SetLineSpace_Impl( SvxLineSpacingItem&, int, long lValue = 0 ); 118 119 void SetLineSpace_Impl( SvxLineSpacingItem& rLineSpace, 120 int eSpace, long lValue ) 121 { 122 switch ( eSpace ) 123 { 124 case LLINESPACE_1: 125 rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO; 126 rLineSpace.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF; 127 break; 128 129 case LLINESPACE_15: 130 rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO; 131 rLineSpace.SetPropLineSpace( 150 ); 132 break; 133 134 case LLINESPACE_2: 135 rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO; 136 rLineSpace.SetPropLineSpace( 200 ); 137 break; 138 139 case LLINESPACE_PROP: 140 rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO; 141 rLineSpace.SetPropLineSpace( (sal_uInt8)lValue ); 142 break; 143 144 case LLINESPACE_MIN: 145 rLineSpace.SetLineHeight( (sal_uInt16)lValue ); 146 rLineSpace.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF; 147 break; 148 149 case LLINESPACE_DURCH: 150 rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO; 151 rLineSpace.SetInterLineSpace( (sal_uInt16)lValue ); 152 break; 153 154 case LLINESPACE_FIX: 155 rLineSpace.SetLineHeight((sal_uInt16)lValue); 156 rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_FIX; 157 rLineSpace.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF; 158 break; 159 } 160 } 161 162 163 sal_uInt16 GetHtmlMode_Impl(const SfxItemSet& rSet) 164 { 165 sal_uInt16 nHtmlMode = 0; 166 const SfxPoolItem* pItem = 0; 167 SfxObjectShell* pShell; 168 if(SFX_ITEM_SET == rSet.GetItemState(SID_HTML_MODE, sal_False, &pItem) || 169 ( 0 != (pShell = SfxObjectShell::Current()) && 170 0 != (pItem = pShell->GetItem(SID_HTML_MODE)))) 171 { 172 nHtmlMode = ((SfxUInt16Item*)pItem)->GetValue(); 173 } 174 return nHtmlMode; 175 176 } 177 178 // class SvxStdParagraphTabPage ------------------------------------------ 179 180 IMPL_LINK( SvxStdParagraphTabPage, ELRLoseFocusHdl, Edit *, EMPTYARG ) 181 { 182 //! if ( aLeftIndent.IsRelativeMode() ) 183 //! return 0; //!!! 184 185 SfxItemPool* pPool = GetItemSet().GetPool(); 186 DBG_ASSERT( pPool, "Wo ist der Pool" ); 187 FieldUnit eUnit = 188 MapToFieldUnit( pPool->GetMetric( GetWhich( SID_ATTR_LRSPACE ) ) ); 189 190 sal_Int64 nL = aLeftIndent.Denormalize( aLeftIndent.GetValue( eUnit ) ); 191 sal_Int64 nR = aRightIndent.Denormalize( aRightIndent.GetValue( eUnit ) ); 192 String aTmp = aFLineIndent.GetText(); 193 194 // Erstzeilen Einzug 195 if( aLeftIndent.GetMin() < 0 ) 196 aFLineIndent.SetMin( -99999, FUNIT_MM ); 197 else 198 aFLineIndent.SetMin( aFLineIndent.Normalize( -nL ), eUnit ); 199 200 // Check nur fuer konkrete Breite (Shell) 201 sal_Int64 nTmp = nWidth - nL - nR - MM50; 202 aFLineIndent.SetMax( aFLineIndent.Normalize( nTmp ), eUnit ); 203 204 if ( !aTmp.Len() ) 205 aFLineIndent.SetEmptyFieldValue(); 206 // Maximum Links Rechts 207 aTmp = aLeftIndent.GetText(); 208 nTmp = nWidth - nR - MM50; 209 aLeftIndent.SetMax( aLeftIndent.Normalize( nTmp ), eUnit ); 210 211 if ( !aTmp.Len() ) 212 aLeftIndent.SetEmptyFieldValue(); 213 aTmp = aRightIndent.GetText(); 214 nTmp = nWidth - nL - MM50; 215 aRightIndent.SetMax( aRightIndent.Normalize( nTmp ), eUnit ); 216 217 if ( !aTmp.Len() ) 218 aRightIndent.SetEmptyFieldValue(); 219 return 0; 220 } 221 222 // ----------------------------------------------------------------------- 223 224 SfxTabPage* SvxStdParagraphTabPage::Create( Window* pParent, 225 const SfxItemSet& rSet) 226 { 227 return new SvxStdParagraphTabPage( pParent, rSet ); 228 } 229 230 // ----------------------------------------------------------------------- 231 232 sal_Bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet& rOutSet ) 233 { 234 SfxItemState eState = SFX_ITEM_UNKNOWN; 235 const SfxPoolItem* pOld = 0; 236 SfxItemPool* pPool = rOutSet.GetPool(); 237 DBG_ASSERT( pPool, "Wo ist der Pool" ); 238 239 sal_Bool bModified = sal_False; 240 sal_uInt16 nWhich; 241 sal_uInt16 nPos = aLineDist.GetSelectEntryPos(); 242 243 if ( LISTBOX_ENTRY_NOTFOUND != nPos && 244 ( nPos != aLineDist.GetSavedValue() || 245 aLineDistAtPercentBox.IsValueModified() || 246 aLineDistAtMetricBox.IsValueModified() ) ) 247 { 248 nWhich = GetWhich( SID_ATTR_PARA_LINESPACE ); 249 SfxMapUnit eUnit = pPool->GetMetric( nWhich ); 250 SvxLineSpacingItem aSpacing( 251 (const SvxLineSpacingItem&)GetItemSet().Get( nWhich ) ); 252 253 switch ( nPos ) 254 { 255 case LLINESPACE_1: 256 case LLINESPACE_15: 257 case LLINESPACE_2: 258 SetLineSpace_Impl( aSpacing, nPos ); 259 break; 260 261 case LLINESPACE_PROP: 262 SetLineSpace_Impl( aSpacing, nPos, 263 static_cast<long>(aLineDistAtPercentBox.Denormalize( 264 aLineDistAtPercentBox.GetValue() )) ); 265 break; 266 267 case LLINESPACE_MIN: 268 case LLINESPACE_DURCH: 269 case LLINESPACE_FIX: 270 SetLineSpace_Impl( aSpacing, nPos, 271 GetCoreValue( aLineDistAtMetricBox, eUnit ) ); 272 break; 273 274 default: 275 DBG_ERROR( "unbekannter Type fuer Zeilenabstand." ); 276 break; 277 } 278 eState = GetItemSet().GetItemState( nWhich ); 279 pOld = GetOldItem( rOutSet, SID_ATTR_PARA_LINESPACE ); 280 281 if ( !pOld || !( *(const SvxLineSpacingItem*)pOld == aSpacing ) || 282 SFX_ITEM_DONTCARE == eState ) 283 { 284 rOutSet.Put( aSpacing ); 285 bModified |= sal_True; 286 } 287 } 288 289 if ( aTopDist.IsValueModified() || aBottomDist.IsValueModified() ) 290 { 291 nWhich = GetWhich( SID_ATTR_ULSPACE ); 292 SfxMapUnit eUnit = pPool->GetMetric( nWhich ); 293 pOld = GetOldItem( rOutSet, SID_ATTR_ULSPACE ); 294 SvxULSpaceItem aMargin( nWhich ); 295 296 if ( bRelativeMode ) 297 { 298 DBG_ASSERT( GetItemSet().GetParent(), "No ParentSet" ); 299 300 const SvxULSpaceItem& rOldItem = 301 (const SvxULSpaceItem&)GetItemSet().GetParent()->Get( nWhich ); 302 303 if ( aTopDist.IsRelative() ) 304 aMargin.SetUpper( rOldItem.GetUpper(), 305 (sal_uInt16)aTopDist.GetValue() ); 306 else 307 aMargin.SetUpper( (sal_uInt16)GetCoreValue( aTopDist, eUnit ) ); 308 309 if ( aBottomDist.IsRelative() ) 310 aMargin.SetLower( rOldItem.GetLower(), 311 (sal_uInt16)aBottomDist.GetValue() ); 312 else 313 aMargin.SetLower( (sal_uInt16)GetCoreValue( aBottomDist, eUnit ) ); 314 315 } 316 else 317 { 318 aMargin.SetUpper( (sal_uInt16)GetCoreValue( aTopDist, eUnit ) ); 319 aMargin.SetLower( (sal_uInt16)GetCoreValue( aBottomDist, eUnit ) ); 320 } 321 eState = GetItemSet().GetItemState( nWhich ); 322 323 if ( !pOld || !( *(const SvxULSpaceItem*)pOld == aMargin ) || 324 SFX_ITEM_DONTCARE == eState ) 325 { 326 rOutSet.Put( aMargin ); 327 bModified |= sal_True; 328 } 329 } 330 FASTBOOL bNullTab = sal_False; 331 332 if ( aLeftIndent.IsValueModified() || 333 aFLineIndent.IsValueModified() || 334 aRightIndent.IsValueModified() 335 || aAutoCB.GetSavedValue() != aAutoCB.IsChecked() ) 336 { 337 nWhich = GetWhich( SID_ATTR_LRSPACE ); 338 SfxMapUnit eUnit = pPool->GetMetric( nWhich ); 339 SvxLRSpaceItem aMargin( nWhich ); 340 pOld = GetOldItem( rOutSet, SID_ATTR_LRSPACE ); 341 342 if ( bRelativeMode ) 343 { 344 DBG_ASSERT( GetItemSet().GetParent(), "No ParentSet" ); 345 346 const SvxLRSpaceItem& rOldItem = 347 (const SvxLRSpaceItem&)GetItemSet().GetParent()->Get( nWhich ); 348 349 if ( aLeftIndent.IsRelative() ) 350 aMargin.SetTxtLeft( rOldItem.GetTxtLeft(), 351 (sal_uInt16)aLeftIndent.GetValue() ); 352 else 353 aMargin.SetTxtLeft( GetCoreValue( aLeftIndent, eUnit ) ); 354 355 if ( aRightIndent.IsRelative() ) 356 aMargin.SetRight( rOldItem.GetRight(), 357 (sal_uInt16)aRightIndent.GetValue() ); 358 else 359 aMargin.SetRight( GetCoreValue( aRightIndent, eUnit ) ); 360 361 if ( aFLineIndent.IsRelative() ) 362 aMargin.SetTxtFirstLineOfst( rOldItem.GetTxtFirstLineOfst(), 363 (sal_uInt16)aFLineIndent.GetValue() ); 364 else 365 aMargin.SetTxtFirstLineOfst( 366 (sal_uInt16)GetCoreValue( aFLineIndent, eUnit ) ); 367 } 368 else 369 { 370 aMargin.SetTxtLeft( GetCoreValue( aLeftIndent, eUnit ) ); 371 aMargin.SetRight( GetCoreValue( aRightIndent, eUnit ) ); 372 aMargin.SetTxtFirstLineOfst( 373 (sal_uInt16)GetCoreValue( aFLineIndent, eUnit ) ); 374 } 375 aMargin.SetAutoFirst(aAutoCB.IsChecked()); 376 if ( aMargin.GetTxtFirstLineOfst() < 0 ) 377 bNullTab = sal_True; 378 eState = GetItemSet().GetItemState( nWhich ); 379 380 if ( !pOld || !( *(const SvxLRSpaceItem*)pOld == aMargin ) || 381 SFX_ITEM_DONTCARE == eState ) 382 { 383 rOutSet.Put( aMargin ); 384 bModified |= sal_True; 385 } 386 } 387 388 if ( bNullTab ) 389 { 390 MapUnit eUnit = (MapUnit)pPool->GetMetric( GetWhich( SID_ATTR_TABSTOP ) ); 391 if ( MAP_100TH_MM != eUnit ) 392 { 393 394 // negativer Erstzeileneinzug -> ggf. Null Default-Tabstop setzen 395 sal_uInt16 _nWhich = GetWhich( SID_ATTR_TABSTOP ); 396 const SfxItemSet& rInSet = GetItemSet(); 397 398 if ( rInSet.GetItemState( _nWhich ) >= SFX_ITEM_AVAILABLE ) 399 { 400 const SvxTabStopItem& rTabItem = 401 (const SvxTabStopItem&)rInSet.Get( _nWhich ); 402 SvxTabStopItem aNullTab( rTabItem ); 403 SvxTabStop aNull( 0, SVX_TAB_ADJUST_DEFAULT ); 404 aNullTab.Insert( aNull ); 405 rOutSet.Put( aNullTab ); 406 } 407 } 408 } 409 if( aRegisterCB.IsVisible()) 410 { 411 const SfxBoolItem* pBoolItem = (SfxBoolItem*)GetOldItem( 412 rOutSet, SID_ATTR_PARA_REGISTER); 413 SfxBoolItem* pRegItem = (SfxBoolItem*)pBoolItem->Clone(); 414 sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_REGISTER ); 415 sal_Bool bSet = pRegItem->GetValue(); 416 417 if(aRegisterCB.IsChecked() != bSet ) 418 { 419 pRegItem->SetValue(!bSet); 420 rOutSet.Put(*pRegItem); 421 bModified |= sal_True; 422 } 423 else if ( SFX_ITEM_DEFAULT == GetItemSet().GetItemState( _nWhich, sal_False ) ) 424 rOutSet.ClearItem(_nWhich); 425 delete pRegItem; 426 } 427 428 return bModified; 429 } 430 431 // ----------------------------------------------------------------------- 432 433 void SvxStdParagraphTabPage::Reset( const SfxItemSet& rSet ) 434 { 435 SfxItemPool* pPool = rSet.GetPool(); 436 DBG_ASSERT( pPool, "Wo ist der Pool?" ); 437 String aEmpty; 438 439 // Metrik einstellen 440 FieldUnit eFUnit = GetModuleFieldUnit( rSet ); 441 SetFieldUnit( aLeftIndent, eFUnit ); 442 SetFieldUnit( aRightIndent, eFUnit ); 443 SetFieldUnit( aFLineIndent, eFUnit ); 444 SetFieldUnit( aTopDist, eFUnit ); 445 SetFieldUnit( aBottomDist, eFUnit ); 446 SetFieldUnit( aLineDistAtMetricBox, eFUnit ); 447 448 sal_uInt16 _nWhich = GetWhich( SID_ATTR_LRSPACE ); 449 SfxItemState eItemState = rSet.GetItemState( _nWhich ); 450 451 if ( eItemState >= SFX_ITEM_AVAILABLE ) 452 { 453 SfxMapUnit eUnit = pPool->GetMetric( _nWhich ); 454 455 if ( bRelativeMode ) 456 { 457 const SvxLRSpaceItem& rOldItem = 458 (const SvxLRSpaceItem&)rSet.Get( _nWhich ); 459 460 if ( rOldItem.GetPropLeft() != 100 ) 461 { 462 aLeftIndent.SetRelative( sal_True ); 463 aLeftIndent.SetValue( rOldItem.GetPropLeft() ); 464 } 465 else 466 { 467 aLeftIndent.SetRelative(); 468 SetFieldUnit( aLeftIndent, eFUnit ); 469 SetMetricValue( aLeftIndent, rOldItem.GetTxtLeft(), eUnit ); 470 } 471 472 if ( rOldItem.GetPropRight() != 100 ) 473 { 474 aRightIndent.SetRelative( sal_True ); 475 aRightIndent.SetValue( rOldItem.GetPropRight() ); 476 } 477 else 478 { 479 aRightIndent.SetRelative(); 480 SetFieldUnit( aRightIndent, eFUnit ); 481 SetMetricValue( aRightIndent, rOldItem.GetRight(), eUnit ); 482 } 483 484 if ( rOldItem.GetPropTxtFirstLineOfst() != 100 ) 485 { 486 aFLineIndent.SetRelative( sal_True ); 487 aFLineIndent.SetValue( rOldItem.GetPropTxtFirstLineOfst() ); 488 } 489 else 490 { 491 aFLineIndent.SetRelative(); 492 aFLineIndent.SetMin(-9999); 493 SetFieldUnit( aFLineIndent, eFUnit ); 494 SetMetricValue( aFLineIndent, rOldItem.GetTxtFirstLineOfst(), 495 eUnit ); 496 } 497 aAutoCB.Check(rOldItem.IsAutoFirst()); 498 } 499 else 500 { 501 const SvxLRSpaceItem& rSpace = 502 (const SvxLRSpaceItem&)rSet.Get( _nWhich ); 503 504 SetMetricValue( aLeftIndent, rSpace.GetTxtLeft(), eUnit ); 505 SetMetricValue( aRightIndent, rSpace.GetRight(), eUnit ); 506 SetMetricValue( aFLineIndent, rSpace.GetTxtFirstLineOfst(), eUnit ); 507 aAutoCB.Check(rSpace.IsAutoFirst()); 508 } 509 AutoHdl_Impl(&aAutoCB); 510 } 511 else 512 { 513 aLeftIndent.SetEmptyFieldValue(); 514 aRightIndent.SetEmptyFieldValue(); 515 aFLineIndent.SetEmptyFieldValue(); 516 } 517 518 _nWhich = GetWhich( SID_ATTR_ULSPACE ); 519 eItemState = rSet.GetItemState( _nWhich ); 520 521 if ( eItemState >= SFX_ITEM_AVAILABLE ) 522 { 523 SfxMapUnit eUnit = pPool->GetMetric( _nWhich ); 524 525 if ( bRelativeMode ) 526 { 527 const SvxULSpaceItem& rOldItem = 528 (const SvxULSpaceItem&)rSet.Get( _nWhich ); 529 530 if ( rOldItem.GetPropUpper() != 100 ) 531 { 532 aTopDist.SetRelative( sal_True ); 533 aTopDist.SetValue( rOldItem.GetPropUpper() ); 534 } 535 else 536 { 537 aTopDist.SetRelative(); 538 SetFieldUnit( aTopDist, eFUnit ); 539 SetMetricValue( aTopDist, rOldItem.GetUpper(), eUnit ); 540 } 541 542 if ( rOldItem.GetPropLower() != 100 ) 543 { 544 aBottomDist.SetRelative( sal_True ); 545 aBottomDist.SetValue( rOldItem.GetPropLower() ); 546 } 547 else 548 { 549 aBottomDist.SetRelative(); 550 SetFieldUnit( aBottomDist, eFUnit ); 551 SetMetricValue( aBottomDist, rOldItem.GetLower(), eUnit ); 552 } 553 } 554 else 555 { 556 const SvxULSpaceItem& rTopMargin = 557 (const SvxULSpaceItem&)rSet.Get( _nWhich ); 558 SetMetricValue( aTopDist, rTopMargin.GetUpper(), eUnit ); 559 SetMetricValue( aBottomDist, rTopMargin.GetLower(), eUnit ); 560 } 561 } 562 else 563 { 564 aTopDist.SetEmptyFieldValue(); 565 aBottomDist.SetEmptyFieldValue(); 566 } 567 568 _nWhich = GetWhich( SID_ATTR_PARA_LINESPACE ); 569 eItemState = rSet.GetItemState( _nWhich ); 570 571 if ( eItemState >= SFX_ITEM_AVAILABLE ) 572 SetLineSpacing_Impl( (const SvxLineSpacingItem &)rSet.Get( _nWhich ) ); 573 else 574 aLineDist.SetNoSelection(); 575 576 577 _nWhich = GetWhich( SID_ATTR_PARA_REGISTER ); 578 eItemState = rSet.GetItemState( _nWhich ); 579 580 if ( eItemState >= SFX_ITEM_AVAILABLE ) 581 aRegisterCB.Check( ((const SfxBoolItem &)rSet.Get( _nWhich )).GetValue()); 582 aRegisterCB.SaveValue(); 583 sal_uInt16 nHtmlMode = GetHtmlMode_Impl(rSet); 584 if(nHtmlMode & HTMLMODE_ON) 585 { 586 aRegisterCB.Hide(); 587 aRegisterFL.Hide(); 588 aAutoCB.Hide(); 589 if(!(nHtmlMode & HTMLMODE_SOME_STYLES)) // IE oder SW 590 { 591 aRightLabel.Disable(); 592 aRightIndent.Disable(); 593 aTopDist.Disable(); //HTML3.2 und NS 3.0 594 aBottomDist.Disable(); 595 if(!(nHtmlMode & HTMLMODE_FIRSTLINE)) //NS 3.0 596 { 597 aFLineIndent.Disable(); 598 aFLineLabel.Disable(); 599 } 600 } 601 } 602 603 ELRLoseFocusHdl( NULL ); 604 aAutoCB.SaveValue(); 605 aLineDist.SaveValue(); 606 } 607 608 // ----------------------------------------------------------------------- 609 610 void SvxStdParagraphTabPage::EnableRelativeMode() 611 { 612 DBG_ASSERT( GetItemSet().GetParent(), "RelativeMode, but no parent-set!" ); 613 614 aLeftIndent.EnableRelativeMode( 0, 999 ); 615 aFLineIndent.EnableRelativeMode( 0, 999 ); 616 aRightIndent.EnableRelativeMode( 0, 999 ); 617 aTopDist.EnableRelativeMode( 0, 999 ); 618 aBottomDist.EnableRelativeMode( 0, 999 ); 619 bRelativeMode = sal_True; 620 } 621 622 // ----------------------------------------------------------------------- 623 624 int SvxStdParagraphTabPage::DeactivatePage( SfxItemSet* _pSet ) 625 { 626 ELRLoseFocusHdl( NULL ); 627 628 if ( _pSet ) 629 FillItemSet( *_pSet ); 630 return LEAVE_PAGE; 631 } 632 633 // ----------------------------------------------------------------------- 634 635 SvxStdParagraphTabPage::SvxStdParagraphTabPage( Window* pParent, 636 const SfxItemSet& rAttr ) : 637 638 SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_STD_PARAGRAPH ), rAttr ), 639 640 aIndentFrm ( this, CUI_RES( FL_INDENT ) ), 641 aLeftLabel ( this, CUI_RES( FT_LEFTINDENT ) ), 642 aLeftIndent ( this, CUI_RES( ED_LEFTINDENT ) ), 643 aRightLabel ( this, CUI_RES( FT_RIGHTINDENT ) ), 644 aRightIndent ( this, CUI_RES( ED_RIGHTINDENT ) ), 645 646 aFLineLabel ( this, CUI_RES( FT_FLINEINDENT ) ), 647 aFLineIndent ( this, CUI_RES( ED_FLINEINDENT ) ), 648 aAutoCB ( this, CUI_RES( CB_AUTO ) ), 649 aDistFrm ( this, CUI_RES( FL_DIST ) ), 650 aTopLabel ( this, CUI_RES( FT_TOPDIST ) ), 651 aTopDist ( this, CUI_RES( ED_TOPDIST ) ), 652 aBottomLabel ( this, CUI_RES( FT_BOTTOMDIST ) ), 653 aBottomDist ( this, CUI_RES( ED_BOTTOMDIST ) ), 654 655 aLineDistFrm ( this, CUI_RES( FL_LINEDIST ) ), 656 aLineDist ( this, CUI_RES( LB_LINEDIST ) ), 657 aLineDistAtLabel ( this, CUI_RES( FT_LINEDIST ) ), 658 aLineDistAtPercentBox ( this, CUI_RES( ED_LINEDISTPERCENT ) ), 659 aLineDistAtMetricBox ( this, CUI_RES( ED_LINEDISTMETRIC ) ), 660 sAbsDist ( CUI_RES(ST_LINEDIST_ABS) ), 661 aExampleWin ( this, CUI_RES( WN_EXAMPLE ) ), 662 aRegisterFL ( this, CUI_RES( FL_REGISTER ) ), 663 aRegisterCB ( this, CUI_RES( CB_REGISTER ) ), 664 pActLineDistFld ( &aLineDistAtPercentBox ), 665 nAbst ( MAX_DURCH ), 666 nWidth ( 11905 /*567 * 50*/ ), 667 nMinFixDist(0L), 668 669 bRelativeMode ( sal_False ), 670 bNegativeIndents(sal_False) 671 672 { 673 // diese Page braucht ExchangeSupport 674 SetExchangeSupport(); 675 676 aLineDistAtMetricBox.Hide(); 677 FreeResource(); 678 Init_Impl(); 679 aFLineIndent.SetMin(-9999); // wird default auf 0 gesetzt 680 681 aExampleWin.SetAccessibleName(String(CUI_RES(STR_EXAMPLE))); 682 683 } 684 685 686 // ----------------------------------------------------------------------- 687 688 void SvxStdParagraphTabPage::EnableNegativeMode() 689 { 690 aLeftIndent.SetMin(-9999); 691 aRightIndent.SetMin(-9999); 692 aRightIndent.EnableNegativeMode(); 693 aLeftIndent.EnableNegativeMode(); 694 bNegativeIndents = sal_True; 695 } 696 697 // ----------------------------------------------------------------------- 698 699 sal_uInt16* SvxStdParagraphTabPage::GetRanges() 700 { 701 return pStdRanges; 702 } 703 704 // ----------------------------------------------------------------------- 705 706 void SvxStdParagraphTabPage::SetLineSpacing_Impl 707 ( 708 const SvxLineSpacingItem &rAttr 709 ) 710 { 711 SfxMapUnit eUnit = GetItemSet().GetPool()->GetMetric( rAttr.Which() ); 712 713 switch( rAttr.GetLineSpaceRule() ) 714 { 715 case SVX_LINE_SPACE_AUTO: 716 { 717 SvxInterLineSpace eInter = rAttr.GetInterLineSpaceRule(); 718 719 switch( eInter ) 720 { 721 // Default einzeilig 722 case SVX_INTER_LINE_SPACE_OFF: 723 aLineDist.SelectEntryPos( LLINESPACE_1 ); 724 break; 725 726 // Default einzeilig 727 case SVX_INTER_LINE_SPACE_PROP: 728 if ( 100 == rAttr.GetPropLineSpace() ) 729 { 730 aLineDist.SelectEntryPos( LLINESPACE_1 ); 731 break; 732 } 733 // 1.5zeilig 734 if ( 150 == rAttr.GetPropLineSpace() ) 735 { 736 aLineDist.SelectEntryPos( LLINESPACE_15 ); 737 break; 738 } 739 // 2zeilig 740 if ( 200 == rAttr.GetPropLineSpace() ) 741 { 742 aLineDist.SelectEntryPos( LLINESPACE_2 ); 743 break; 744 } 745 // eingestellter Prozentwert 746 aLineDistAtPercentBox. 747 SetValue( aLineDistAtPercentBox.Normalize( 748 rAttr.GetPropLineSpace() ) ); 749 aLineDist.SelectEntryPos( LLINESPACE_PROP ); 750 break; 751 752 case SVX_INTER_LINE_SPACE_FIX: 753 SetMetricValue( aLineDistAtMetricBox, 754 rAttr.GetInterLineSpace(), eUnit ); 755 aLineDist.SelectEntryPos( LLINESPACE_DURCH ); 756 break; 757 default: ;//prevent warning 758 } 759 } 760 break; 761 case SVX_LINE_SPACE_FIX: 762 SetMetricValue(aLineDistAtMetricBox, rAttr.GetLineHeight(), eUnit); 763 aLineDist.SelectEntryPos( LLINESPACE_FIX ); 764 break; 765 766 case SVX_LINE_SPACE_MIN: 767 SetMetricValue(aLineDistAtMetricBox, rAttr.GetLineHeight(), eUnit); 768 aLineDist.SelectEntryPos( LLINESPACE_MIN ); 769 break; 770 default: ;//prevent warning 771 } 772 LineDistHdl_Impl( &aLineDist ); 773 } 774 775 // ----------------------------------------------------------------------- 776 777 IMPL_LINK( SvxStdParagraphTabPage, LineDistHdl_Impl, ListBox *, pBox ) 778 { 779 switch( pBox->GetSelectEntryPos() ) 780 { 781 case LLINESPACE_1: 782 case LLINESPACE_15: 783 case LLINESPACE_2: 784 aLineDistAtLabel.Enable(sal_False); 785 pActLineDistFld->Enable(sal_False); 786 pActLineDistFld->SetText( String() ); 787 break; 788 789 case LLINESPACE_DURCH: 790 // Setzen eines sinnvollen Defaults? 791 // MS Begrenzen min(10, aPageSize) 792 aLineDistAtPercentBox.Hide(); 793 pActLineDistFld = &aLineDistAtMetricBox; 794 aLineDistAtMetricBox.SetMin(0); 795 796 797 if ( !aLineDistAtMetricBox.GetText().Len() ) 798 aLineDistAtMetricBox.SetValue( 799 aLineDistAtMetricBox.Normalize( 1 ) ); 800 aLineDistAtPercentBox.Hide(); 801 pActLineDistFld->Show(); 802 pActLineDistFld->Enable(); 803 aLineDistAtLabel.Enable(); 804 break; 805 806 case LLINESPACE_MIN: 807 aLineDistAtPercentBox.Hide(); 808 pActLineDistFld = &aLineDistAtMetricBox; 809 aLineDistAtMetricBox.SetMin(0); 810 811 if ( !aLineDistAtMetricBox.GetText().Len() ) 812 aLineDistAtMetricBox.SetValue( 813 aLineDistAtMetricBox.Normalize( 10 ), FUNIT_TWIP ); 814 aLineDistAtPercentBox.Hide(); 815 pActLineDistFld->Show(); 816 pActLineDistFld->Enable(); 817 aLineDistAtLabel.Enable(); 818 break; 819 820 case LLINESPACE_PROP: 821 aLineDistAtMetricBox.Hide(); 822 pActLineDistFld = &aLineDistAtPercentBox; 823 824 if ( !aLineDistAtPercentBox.GetText().Len() ) 825 aLineDistAtPercentBox.SetValue( 826 aLineDistAtPercentBox.Normalize( 100 ), FUNIT_TWIP ); 827 aLineDistAtMetricBox.Hide(); 828 pActLineDistFld->Show(); 829 pActLineDistFld->Enable(); 830 aLineDistAtLabel.Enable(); 831 break; 832 case LLINESPACE_FIX: 833 { 834 aLineDistAtPercentBox.Hide(); 835 pActLineDistFld = &aLineDistAtMetricBox; 836 sal_Int64 nTemp = aLineDistAtMetricBox.GetValue(); 837 aLineDistAtMetricBox.SetMin(aLineDistAtMetricBox.Normalize(nMinFixDist), FUNIT_TWIP); 838 839 // wurde der Wert beim SetMin veraendert, dann ist es Zeit 840 // fuer den default 841 if ( aLineDistAtMetricBox.GetValue() != nTemp ) 842 SetMetricValue( aLineDistAtMetricBox, 843 FIX_DIST_DEF, SFX_MAPUNIT_TWIP ); // fix gibt's nur im Writer 844 aLineDistAtPercentBox.Hide(); 845 pActLineDistFld->Show(); 846 pActLineDistFld->Enable(); 847 aLineDistAtLabel.Enable(); 848 } 849 break; 850 } 851 UpdateExample_Impl( sal_True ); 852 return 0; 853 } 854 855 // ----------------------------------------------------------------------- 856 857 IMPL_LINK_INLINE_START( SvxStdParagraphTabPage, ModifyHdl_Impl, SvxRelativeField *, EMPTYARG ) 858 { 859 UpdateExample_Impl(); 860 return 0; 861 } 862 IMPL_LINK_INLINE_END( SvxStdParagraphTabPage, ModifyHdl_Impl, SvxRelativeField *, EMPTYARG ) 863 864 // ----------------------------------------------------------------------- 865 866 void SvxStdParagraphTabPage::Init_Impl() 867 { 868 aLineDist.SetSelectHdl( 869 LINK( this, SvxStdParagraphTabPage, LineDistHdl_Impl ) ); 870 871 Link aLink = LINK( this, SvxStdParagraphTabPage, ELRLoseFocusHdl ); 872 aFLineIndent.SetLoseFocusHdl( aLink ); 873 aLeftIndent.SetLoseFocusHdl( aLink ); 874 aRightIndent.SetLoseFocusHdl( aLink ); 875 876 aLink = LINK( this, SvxStdParagraphTabPage, ModifyHdl_Impl ); 877 aFLineIndent.SetModifyHdl( aLink ); 878 aLeftIndent.SetModifyHdl( aLink ); 879 aRightIndent.SetModifyHdl( aLink ); 880 aTopDist.SetModifyHdl( aLink ); 881 aBottomDist.SetModifyHdl( aLink ); 882 883 aAutoCB.SetClickHdl( LINK( this, SvxStdParagraphTabPage, AutoHdl_Impl )); 884 SfxItemPool* pPool = GetItemSet().GetPool(); 885 DBG_ASSERT( pPool, "Wo ist der Pool" ); 886 FieldUnit eUnit = 887 MapToFieldUnit( pPool->GetMetric( GetWhich( SID_ATTR_LRSPACE ) ) ); 888 889 aTopDist.SetMax( aTopDist.Normalize( nAbst ), eUnit ); 890 aBottomDist.SetMax( aBottomDist.Normalize( nAbst ), eUnit ); 891 aLineDistAtMetricBox.SetMax( 892 aLineDistAtMetricBox.Normalize( nAbst ), eUnit ); 893 } 894 895 // ----------------------------------------------------------------------- 896 897 void SvxStdParagraphTabPage::UpdateExample_Impl( sal_Bool bAll ) 898 { 899 aExampleWin.SetFirstLineOfst( 900 (short)aFLineIndent.Denormalize( aFLineIndent.GetValue( FUNIT_TWIP ) ) ); 901 aExampleWin.SetLeftMargin( 902 static_cast<long>(aLeftIndent.Denormalize( aLeftIndent.GetValue( FUNIT_TWIP ) ) ) ); 903 aExampleWin.SetRightMargin( 904 static_cast<long>(aRightIndent.Denormalize( aRightIndent.GetValue( FUNIT_TWIP ) ) ) ); 905 aExampleWin.SetUpper( 906 (sal_uInt16)aTopDist.Denormalize( aTopDist.GetValue( FUNIT_TWIP ) ) ); 907 aExampleWin.SetLower( 908 (sal_uInt16)aBottomDist.Denormalize( aBottomDist.GetValue( FUNIT_TWIP ) ) ); 909 910 911 912 sal_uInt16 nPos = aLineDist.GetSelectEntryPos(); 913 914 switch ( nPos ) 915 { 916 case LLINESPACE_1: 917 case LLINESPACE_15: 918 case LLINESPACE_2: 919 aExampleWin.SetLineSpace( (SvxPrevLineSpace)nPos ); 920 break; 921 922 case LLINESPACE_PROP: 923 aExampleWin.SetLineSpace( (SvxPrevLineSpace)nPos, 924 (sal_uInt16)aLineDistAtPercentBox.Denormalize( 925 aLineDistAtPercentBox.GetValue() ) ); 926 break; 927 928 case LLINESPACE_MIN: 929 case LLINESPACE_DURCH: 930 case LLINESPACE_FIX: 931 aExampleWin.SetLineSpace( (SvxPrevLineSpace)nPos, 932 (sal_uInt16)GetCoreValue( aLineDistAtMetricBox, SFX_MAPUNIT_TWIP ) ); 933 break; 934 } 935 aExampleWin.Draw( bAll ); 936 } 937 938 // ----------------------------------------------------------------------- 939 940 void SvxStdParagraphTabPage::EnableRegisterMode() 941 { 942 aRegisterCB.Show(); 943 aRegisterFL.Show(); 944 } 945 946 /*-----------------16.01.97 19.54------------------- 947 948 --------------------------------------------------*/ 949 IMPL_LINK( SvxStdParagraphTabPage, AutoHdl_Impl, CheckBox*, pBox ) 950 { 951 sal_Bool bEnable = !pBox->IsChecked(); 952 aFLineLabel .Enable(bEnable); 953 aFLineIndent.Enable(bEnable); 954 return 0; 955 } 956 957 /*-----------------16.01.97 18.00------------------- 958 959 --------------------------------------------------*/ 960 void SvxStdParagraphTabPage::SetPageWidth( sal_uInt16 nPageWidth ) 961 { 962 nWidth = nPageWidth; 963 } 964 965 /*-----------------17.01.97 08.11------------------- 966 967 --------------------------------------------------*/ 968 void SvxStdParagraphTabPage::EnableAutoFirstLine() 969 { 970 aAutoCB.Show(); 971 } 972 973 /*-----------------11.06.97 11.48------------------- 974 absoluter Zeilenabstand 975 --------------------------------------------------*/ 976 void SvxStdParagraphTabPage::EnableAbsLineDist(long nMinTwip) 977 { 978 aLineDist.InsertEntry(sAbsDist); 979 nMinFixDist = nMinTwip; 980 } 981 982 //addd CHINA001 begin 983 void SvxStdParagraphTabPage::PageCreated(SfxAllItemSet aSet) 984 { 985 986 /* CHINA001 different bit represent call to different method of SvxStdParagraphTabPage 987 0x0001 --->EnableRelativeMode() 988 0x0002 --->EnableRegisterMode() 989 0x0004 --->EnableAutoFirstLine() 990 0x0008 --->EnableNegativeMode() 991 992 993 */ 994 SFX_ITEMSET_ARG (&aSet,pPageWidthItem,SfxUInt16Item,SID_SVXSTDPARAGRAPHTABPAGE_PAGEWIDTH,sal_False); 995 SFX_ITEMSET_ARG (&aSet,pFlagSetItem,SfxUInt32Item,SID_SVXSTDPARAGRAPHTABPAGE_FLAGSET,sal_False); 996 SFX_ITEMSET_ARG (&aSet,pLineDistItem,SfxUInt32Item,SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST,sal_False); 997 998 if (pPageWidthItem) 999 SetPageWidth(pPageWidthItem->GetValue()); 1000 1001 if (pFlagSetItem ) 1002 if (( 0x0001 & pFlagSetItem->GetValue())== 0x0001 ) 1003 EnableRelativeMode(); 1004 1005 if (pFlagSetItem) 1006 if (( 0x0002 & pFlagSetItem->GetValue())== 0x0002 ) 1007 EnableRegisterMode(); 1008 1009 if (pFlagSetItem) 1010 if ( ( 0x0004 & pFlagSetItem->GetValue())== 0x0004 ) 1011 EnableAutoFirstLine(); 1012 1013 if(pLineDistItem) 1014 EnableAbsLineDist(pLineDistItem->GetValue()); 1015 1016 if (pFlagSetItem) 1017 if (( 0x0008 & pFlagSetItem->GetValue()) == 0x0008 ) 1018 EnableNegativeMode(); 1019 1020 } 1021 //end of CHINA001 1022 1023 #define LASTLINEPOS_DEFAULT 0 1024 #define LASTLINEPOS_LEFT 1 1025 1026 #define LASTLINECOUNT_OLD 3 1027 #define LASTLINECOUNT_NEW 4 1028 1029 // class SvxParaAlignTabPage ------------------------------------------------ 1030 1031 /*-----------------16.01.97 19.34------------------- 1032 1033 --------------------------------------------------*/ 1034 SvxParaAlignTabPage::SvxParaAlignTabPage( Window* pParent, const SfxItemSet& rSet ) 1035 : SfxTabPage(pParent, CUI_RES( RID_SVXPAGE_ALIGN_PARAGRAPH ),rSet), 1036 aAlignFrm ( this, CUI_RES( FL_ALIGN ) ), 1037 aLeft ( this, CUI_RES( BTN_LEFTALIGN ) ), 1038 aRight ( this, CUI_RES( BTN_RIGHTALIGN ) ), 1039 aCenter ( this, CUI_RES( BTN_CENTERALIGN ) ), 1040 aJustify ( this, CUI_RES( BTN_JUSTIFYALIGN ) ), 1041 aLastLineFT ( this, CUI_RES( FT_LASTLINE ) ), 1042 aLastLineLB ( this, CUI_RES( LB_LASTLINE ) ), 1043 aExpandCB ( this, CUI_RES( CB_EXPAND ) ), 1044 aSnapToGridCB ( this, CUI_RES( CB_SNAP ) ), 1045 aExampleWin ( this, CUI_RES( WN_EXAMPLE ) ), 1046 1047 aVertAlignFL ( this, CUI_RES( FL_VERTALIGN ) ), 1048 aVertAlignFT ( this, CUI_RES( FT_VERTALIGN ) ), 1049 aVertAlignLB ( this, CUI_RES( LB_VERTALIGN ) ), 1050 1051 aPropertiesFL ( this, CUI_RES( FL_PROPERTIES )), 1052 aTextDirectionFT ( this, CUI_RES( FT_TEXTDIRECTION )), 1053 aTextDirectionLB ( this, CUI_RES( LB_TEXTDIRECTION )) 1054 { 1055 SvtLanguageOptions aLangOptions; 1056 sal_uInt16 nLastLinePos = LASTLINEPOS_DEFAULT; 1057 1058 if ( aLangOptions.IsAsianTypographyEnabled() ) 1059 { 1060 String sLeft(CUI_RES(ST_LEFTALIGN_ASIAN)); 1061 aLeft.SetText(sLeft); 1062 aRight.SetText(String(CUI_RES(ST_RIGHTALIGN_ASIAN))); 1063 sLeft = MnemonicGenerator::EraseAllMnemonicChars( sLeft ); 1064 1065 if ( aLastLineLB.GetEntryCount() == LASTLINECOUNT_OLD ) 1066 { 1067 aLastLineLB.RemoveEntry( 0 ); 1068 aLastLineLB.InsertEntry( sLeft, 0 ); 1069 } 1070 else 1071 nLastLinePos = LASTLINEPOS_LEFT; 1072 } 1073 // remove "Default" or "Left" entry, depends on CJKOptions 1074 if ( aLastLineLB.GetEntryCount() == LASTLINECOUNT_NEW ) 1075 aLastLineLB.RemoveEntry( nLastLinePos ); 1076 1077 FreeResource(); 1078 Link aLink = LINK( this, SvxParaAlignTabPage, AlignHdl_Impl ); 1079 aLeft.SetClickHdl( aLink ); 1080 aRight.SetClickHdl( aLink ); 1081 aCenter.SetClickHdl( aLink ); 1082 aJustify.SetClickHdl( aLink ); 1083 aLastLineLB.SetSelectHdl( LINK( this, SvxParaAlignTabPage, LastLineHdl_Impl ) ); 1084 aTextDirectionLB.SetSelectHdl( LINK( this, SvxParaAlignTabPage, TextDirectionHdl_Impl ) ); 1085 1086 sal_uInt16 nHtmlMode = GetHtmlMode_Impl(rSet); 1087 if(!(nHtmlMode & HTMLMODE_ON) || (0 != (nHtmlMode & HTMLMODE_SOME_STYLES)) ) 1088 { 1089 if( aLangOptions.IsCTLFontEnabled() ) 1090 { 1091 aTextDirectionLB.InsertEntryValue( CUI_RESSTR( RID_SVXSTR_FRAMEDIR_LTR ), FRMDIR_HORI_LEFT_TOP ); 1092 aTextDirectionLB.InsertEntryValue( CUI_RESSTR( RID_SVXSTR_FRAMEDIR_RTL ), FRMDIR_HORI_RIGHT_TOP ); 1093 aTextDirectionLB.InsertEntryValue( CUI_RESSTR( RID_SVXSTR_FRAMEDIR_SUPER ), FRMDIR_ENVIRONMENT ); 1094 1095 aPropertiesFL.Show(); 1096 aTextDirectionFT.Show(); 1097 aTextDirectionLB.Show(); 1098 } 1099 } 1100 1101 aExampleWin.SetAccessibleName(String(CUI_RES(STR_EXAMPLE))); 1102 1103 } 1104 1105 /*-----------------16.01.97 19.33------------------- 1106 1107 --------------------------------------------------*/ 1108 SvxParaAlignTabPage::~SvxParaAlignTabPage() 1109 { 1110 } 1111 1112 /*-----------------16.01.97 19.33------------------- 1113 1114 --------------------------------------------------*/ 1115 int SvxParaAlignTabPage::DeactivatePage( SfxItemSet* _pSet ) 1116 { 1117 if ( _pSet ) 1118 FillItemSet( *_pSet ); 1119 return LEAVE_PAGE; 1120 } 1121 1122 /*-----------------16.01.97 19.33------------------- 1123 1124 --------------------------------------------------*/ 1125 SfxTabPage* SvxParaAlignTabPage::Create( Window* pParent, const SfxItemSet& rSet ) 1126 { 1127 return new SvxParaAlignTabPage(pParent, rSet); 1128 } 1129 1130 /*-----------------16.01.97 19.33------------------- 1131 1132 --------------------------------------------------*/ 1133 sal_uInt16* SvxParaAlignTabPage::GetRanges() 1134 { 1135 return pAlignRanges; 1136 1137 } 1138 1139 /*-----------------16.01.97 19.33------------------- 1140 1141 --------------------------------------------------*/ 1142 sal_Bool SvxParaAlignTabPage::FillItemSet( SfxItemSet& rOutSet ) 1143 { 1144 sal_Bool bModified = sal_False; 1145 1146 FASTBOOL bAdj = sal_False, bChecked = sal_False; 1147 SvxAdjust eAdjust = SVX_ADJUST_LEFT; 1148 1149 if ( aLeft.IsChecked() ) 1150 { 1151 eAdjust = SVX_ADJUST_LEFT; 1152 bAdj = !aLeft.GetSavedValue(); 1153 bChecked = sal_True; 1154 } 1155 else if ( aRight.IsChecked() ) 1156 { 1157 eAdjust = SVX_ADJUST_RIGHT; 1158 bAdj = !aRight.GetSavedValue(); 1159 bChecked = sal_True; 1160 } 1161 else if ( aCenter.IsChecked() ) 1162 { 1163 eAdjust = SVX_ADJUST_CENTER; 1164 bAdj = !aCenter.GetSavedValue(); 1165 bChecked = sal_True; 1166 } 1167 else if ( aJustify.IsChecked() ) 1168 { 1169 eAdjust = SVX_ADJUST_BLOCK; 1170 bAdj = !aJustify.GetSavedValue() || 1171 aExpandCB.IsChecked() != aExpandCB.GetSavedValue() || 1172 aLastLineLB.GetSelectEntryPos() != aLastLineLB.GetSavedValue(); 1173 bChecked = sal_True; 1174 } 1175 sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_ADJUST ); 1176 1177 if ( bAdj ) 1178 { 1179 const SvxAdjustItem* pOld = 1180 (const SvxAdjustItem*)GetOldItem( rOutSet, SID_ATTR_PARA_ADJUST ); 1181 SvxAdjust eOneWord = aExpandCB.IsChecked() ? SVX_ADJUST_BLOCK 1182 : SVX_ADJUST_LEFT; 1183 sal_uInt16 nLBPos = aLastLineLB.GetSelectEntryPos(); 1184 SvxAdjust eLastBlock = SVX_ADJUST_LEFT; 1185 1186 if ( 1 == nLBPos ) 1187 eLastBlock = SVX_ADJUST_CENTER; 1188 else if ( 2 == nLBPos ) 1189 eLastBlock = SVX_ADJUST_BLOCK; 1190 1191 FASTBOOL bNothingWasChecked = 1192 !aLeft.GetSavedValue() && !aRight.GetSavedValue() && 1193 !aCenter.GetSavedValue() && !aJustify.GetSavedValue(); 1194 1195 if ( !pOld || pOld->GetAdjust() != eAdjust || 1196 pOld->GetOneWord() != eOneWord || 1197 pOld->GetLastBlock() != eLastBlock || 1198 ( bChecked && bNothingWasChecked ) ) 1199 { 1200 bModified |= sal_True; 1201 SvxAdjustItem aAdj( 1202 (const SvxAdjustItem&)GetItemSet().Get( _nWhich ) ); 1203 aAdj.SetAdjust( eAdjust ); 1204 aAdj.SetOneWord( eOneWord ); 1205 aAdj.SetLastBlock( eLastBlock ); 1206 rOutSet.Put( aAdj ); 1207 } 1208 } 1209 if(aSnapToGridCB.IsChecked() != aSnapToGridCB.GetSavedValue()) 1210 { 1211 rOutSet.Put(SvxParaGridItem(aSnapToGridCB.IsChecked(), GetWhich( SID_ATTR_PARA_SNAPTOGRID ))); 1212 bModified = sal_True; 1213 } 1214 if(aVertAlignLB.GetSavedValue() != aVertAlignLB.GetSelectEntryPos()) 1215 { 1216 rOutSet.Put(SvxParaVertAlignItem(aVertAlignLB.GetSelectEntryPos(), GetWhich( SID_PARA_VERTALIGN ))); 1217 bModified = sal_True; 1218 } 1219 1220 if( aTextDirectionLB.IsVisible() ) 1221 { 1222 SvxFrameDirection eDir = aTextDirectionLB.GetSelectEntryValue(); 1223 if( eDir != aTextDirectionLB.GetSavedValue() ) 1224 { 1225 rOutSet.Put( SvxFrameDirectionItem( eDir, GetWhich( SID_ATTR_FRAMEDIRECTION ) ) ); 1226 bModified = sal_True; 1227 } 1228 } 1229 1230 return bModified; 1231 } 1232 1233 /*-----------------16.01.97 19.33------------------- 1234 1235 --------------------------------------------------*/ 1236 void SvxParaAlignTabPage::Reset( const SfxItemSet& rSet ) 1237 { 1238 sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_ADJUST ); 1239 SfxItemState eItemState = rSet.GetItemState( _nWhich ); 1240 1241 sal_uInt16 nLBSelect = 0; 1242 if ( eItemState >= SFX_ITEM_AVAILABLE ) 1243 { 1244 const SvxAdjustItem& rAdj = (const SvxAdjustItem&)rSet.Get( _nWhich ); 1245 1246 switch ( rAdj.GetAdjust() /*!!! VB fragen rAdj.GetLastBlock()*/ ) 1247 { 1248 case SVX_ADJUST_LEFT: aLeft.Check(); break; 1249 1250 case SVX_ADJUST_RIGHT: aRight.Check(); break; 1251 1252 case SVX_ADJUST_CENTER: aCenter.Check(); break; 1253 1254 case SVX_ADJUST_BLOCK: aJustify.Check(); break; 1255 default: ; //prevent warning 1256 } 1257 sal_Bool bEnable = aJustify.IsChecked(); 1258 aLastLineFT.Enable(bEnable); 1259 aLastLineLB.Enable(bEnable); 1260 aExpandCB .Enable(bEnable); 1261 1262 aExpandCB.Check(SVX_ADJUST_BLOCK == rAdj.GetOneWord()); 1263 switch(rAdj.GetLastBlock()) 1264 { 1265 case SVX_ADJUST_LEFT: nLBSelect = 0; break; 1266 1267 case SVX_ADJUST_CENTER: nLBSelect = 1; break; 1268 1269 case SVX_ADJUST_BLOCK: nLBSelect = 2; break; 1270 default: ; //prevent warning 1271 } 1272 } 1273 else 1274 { 1275 aLeft.Check( sal_False ); 1276 aRight.Check( sal_False ); 1277 aCenter.Check( sal_False ); 1278 aJustify.Check( sal_False ); 1279 } 1280 aLastLineLB.SelectEntryPos(nLBSelect); 1281 1282 sal_uInt16 nHtmlMode = GetHtmlMode_Impl(rSet); 1283 if(nHtmlMode & HTMLMODE_ON) 1284 { 1285 aLastLineLB.Hide(); 1286 aLastLineFT.Hide(); 1287 aExpandCB.Hide(); 1288 if(!(nHtmlMode & (HTMLMODE_FULL_STYLES|HTMLMODE_FIRSTLINE)) ) 1289 aJustify.Disable(); 1290 aSnapToGridCB.Show(sal_False); 1291 } 1292 _nWhich = GetWhich(SID_ATTR_PARA_SNAPTOGRID); 1293 eItemState = rSet.GetItemState( _nWhich ); 1294 if ( eItemState >= SFX_ITEM_AVAILABLE ) 1295 { 1296 const SvxParaGridItem& rSnap = (const SvxParaGridItem&)rSet.Get( _nWhich ); 1297 aSnapToGridCB.Check(rSnap.GetValue()); 1298 } 1299 1300 _nWhich = GetWhich( SID_PARA_VERTALIGN ); 1301 eItemState = rSet.GetItemState( _nWhich ); 1302 1303 if ( eItemState >= SFX_ITEM_AVAILABLE ) 1304 { 1305 aVertAlignLB.Show(); 1306 aVertAlignFL.Show(); 1307 aVertAlignFT.Show(); 1308 1309 const SvxParaVertAlignItem& rAlign = (const SvxParaVertAlignItem&)rSet.Get( _nWhich ); 1310 aVertAlignLB.SelectEntryPos(rAlign.GetValue()); 1311 } 1312 1313 _nWhich = GetWhich( SID_ATTR_FRAMEDIRECTION ); 1314 //text direction 1315 if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( _nWhich ) ) 1316 { 1317 const SvxFrameDirectionItem& rFrameDirItem = ( const SvxFrameDirectionItem& ) rSet.Get( _nWhich ); 1318 aTextDirectionLB.SelectEntryValue( (SvxFrameDirection)rFrameDirItem.GetValue() ); 1319 aTextDirectionLB.SaveValue(); 1320 } 1321 1322 aSnapToGridCB.SaveValue(); 1323 aVertAlignLB.SaveValue(); 1324 aLeft.SaveValue(); 1325 aRight.SaveValue(); 1326 aCenter.SaveValue(); 1327 aJustify.SaveValue(); 1328 aLastLineLB.SaveValue(); 1329 aExpandCB.SaveValue(); 1330 1331 UpdateExample_Impl(sal_True); 1332 } 1333 1334 /*-----------------17.01.97 08.06------------------- 1335 1336 --------------------------------------------------*/ 1337 IMPL_LINK( SvxParaAlignTabPage, AlignHdl_Impl, RadioButton*, EMPTYARG ) 1338 { 1339 sal_Bool bJustify = aJustify.IsChecked(); 1340 aLastLineFT.Enable(bJustify); 1341 aLastLineLB.Enable(bJustify); 1342 aExpandCB.Enable(bJustify); 1343 UpdateExample_Impl(sal_False); 1344 return 0; 1345 } 1346 1347 IMPL_LINK( SvxParaAlignTabPage, LastLineHdl_Impl, ListBox*, EMPTYARG ) 1348 { 1349 UpdateExample_Impl(sal_False); 1350 return 0; 1351 } 1352 1353 IMPL_LINK( SvxParaAlignTabPage, TextDirectionHdl_Impl, ListBox*, EMPTYARG ) 1354 { 1355 SvxFrameDirection eDir = aTextDirectionLB.GetSelectEntryValue(); 1356 switch ( eDir ) 1357 { 1358 // check the default alignment for this text direction 1359 case FRMDIR_HORI_LEFT_TOP : aLeft.Check( sal_True ); break; 1360 case FRMDIR_HORI_RIGHT_TOP : aRight.Check( sal_True ); break; 1361 case FRMDIR_ENVIRONMENT : /* do nothing */ break; 1362 default: 1363 { 1364 DBG_ERRORFILE( "SvxParaAlignTabPage::TextDirectionHdl_Impl(): other directions not supported" ); 1365 } 1366 } 1367 1368 return 0; 1369 } 1370 1371 /*-----------------16.01.97 19.34------------------- 1372 1373 --------------------------------------------------*/ 1374 void SvxParaAlignTabPage::UpdateExample_Impl( sal_Bool bAll ) 1375 { 1376 if ( aLeft.IsChecked() ) 1377 aExampleWin.SetAdjust( SVX_ADJUST_LEFT ); 1378 else if ( aRight.IsChecked() ) 1379 aExampleWin.SetAdjust( SVX_ADJUST_RIGHT ); 1380 else if ( aCenter.IsChecked() ) 1381 aExampleWin.SetAdjust( SVX_ADJUST_CENTER ); 1382 else if ( aJustify.IsChecked() ) 1383 { 1384 aExampleWin.SetAdjust( SVX_ADJUST_BLOCK ); 1385 SvxAdjust eLastBlock = SVX_ADJUST_LEFT; 1386 sal_uInt16 nLBPos = aLastLineLB.GetSelectEntryPos(); 1387 if(nLBPos == 1) 1388 eLastBlock = SVX_ADJUST_CENTER; 1389 else if(nLBPos == 2) 1390 eLastBlock = SVX_ADJUST_BLOCK; 1391 aExampleWin.SetLastLine( eLastBlock ); 1392 } 1393 1394 aExampleWin.Draw( bAll ); 1395 } 1396 /*-----------------17.01.97 08.04------------------- 1397 Erweiterungen fuer den Blocksatz einschalten 1398 --------------------------------------------------*/ 1399 void SvxParaAlignTabPage::EnableJustifyExt() 1400 { 1401 aLastLineFT.Show(); 1402 aLastLineLB.Show(); 1403 aExpandCB .Show(); 1404 SvtLanguageOptions aCJKOptions; 1405 if(aCJKOptions.IsAsianTypographyEnabled()) 1406 aSnapToGridCB.Show(); 1407 1408 } 1409 //add CHINA001 begin 1410 void SvxParaAlignTabPage::PageCreated (SfxAllItemSet aSet) 1411 { 1412 SFX_ITEMSET_ARG (&aSet,pBoolItem,SfxBoolItem,SID_SVXPARAALIGNTABPAGE_ENABLEJUSTIFYEXT,sal_False); 1413 if (pBoolItem) 1414 if(pBoolItem->GetValue()) 1415 EnableJustifyExt(); 1416 } 1417 //end of CHINA001 1418 // class SvxExtParagraphTabPage ------------------------------------------ 1419 1420 SfxTabPage* SvxExtParagraphTabPage::Create( Window* pParent, 1421 const SfxItemSet& rSet ) 1422 { 1423 return new SvxExtParagraphTabPage( pParent, rSet ); 1424 } 1425 1426 // ----------------------------------------------------------------------- 1427 1428 sal_Bool SvxExtParagraphTabPage::FillItemSet( SfxItemSet& rOutSet ) 1429 { 1430 sal_Bool bModified = sal_False; 1431 sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_HYPHENZONE ); 1432 const TriState eHyphenState = aHyphenBox.GetState(); 1433 const SfxPoolItem* pOld = GetOldItem( rOutSet, SID_ATTR_PARA_HYPHENZONE ); 1434 1435 if ( eHyphenState != aHyphenBox.GetSavedValue() || 1436 aExtHyphenBeforeBox.IsValueModified() || 1437 aExtHyphenAfterBox.IsValueModified() || 1438 aMaxHyphenEdit.IsValueModified() ) 1439 { 1440 SvxHyphenZoneItem aHyphen( 1441 (const SvxHyphenZoneItem&)GetItemSet().Get( _nWhich ) ); 1442 aHyphen.SetHyphen( eHyphenState == STATE_CHECK ); 1443 1444 if ( eHyphenState == STATE_CHECK ) 1445 { 1446 aHyphen.GetMinLead() = (sal_uInt8)aExtHyphenBeforeBox.GetValue(); 1447 aHyphen.GetMinTrail() = (sal_uInt8)aExtHyphenAfterBox.GetValue(); 1448 } 1449 aHyphen.GetMaxHyphens() = (sal_uInt8)aMaxHyphenEdit.GetValue(); 1450 1451 if ( !pOld || 1452 !( *(SvxHyphenZoneItem*)pOld == aHyphen ) || 1453 eHyphenState != aHyphenBox.GetSavedValue()) 1454 { 1455 rOutSet.Put( aHyphen ); 1456 bModified |= sal_True; 1457 } 1458 } 1459 1460 if (aPagenumEdit.IsEnabled() && aPagenumEdit.IsValueModified()) 1461 { 1462 SfxUInt16Item aPageNum( SID_ATTR_PARA_PAGENUM, 1463 (sal_uInt16)aPagenumEdit.GetValue() ); 1464 1465 pOld = GetOldItem( rOutSet, SID_ATTR_PARA_PAGENUM ); 1466 1467 if ( !pOld || ( (const SfxUInt16Item*)pOld )->GetValue() != aPageNum.GetValue() ) 1468 { 1469 rOutSet.Put( aPageNum ); 1470 bModified |= sal_True; 1471 } 1472 } 1473 1474 // Seitenumbruch 1475 1476 TriState eState = aApplyCollBtn.GetState(); 1477 FASTBOOL bIsPageModel = sal_False; 1478 1479 _nWhich = GetWhich( SID_ATTR_PARA_MODEL ); 1480 String sPage; 1481 if ( eState != aApplyCollBtn.GetSavedValue() || 1482 ( STATE_CHECK == eState && 1483 aApplyCollBox.GetSelectEntryPos() != aApplyCollBox.GetSavedValue() ) ) 1484 { 1485 if ( eState == STATE_CHECK ) 1486 { 1487 sPage = aApplyCollBox.GetSelectEntry(); 1488 bIsPageModel = 0 != sPage.Len(); 1489 } 1490 pOld = GetOldItem( rOutSet, SID_ATTR_PARA_MODEL ); 1491 1492 if ( !pOld || ( (const SvxPageModelItem*)pOld )->GetValue() != sPage ) 1493 { 1494 rOutSet.Put( SvxPageModelItem( sPage, sal_False, _nWhich ) ); 1495 bModified |= sal_True; 1496 } 1497 else 1498 bIsPageModel = sal_False; 1499 } 1500 else if(STATE_CHECK == eState && aApplyCollBtn.IsEnabled()) 1501 bIsPageModel = sal_True; 1502 else 1503 rOutSet.Put( SvxPageModelItem( sPage, sal_False, _nWhich ) ); 1504 1505 _nWhich = GetWhich( SID_ATTR_PARA_PAGEBREAK ); 1506 1507 if ( bIsPageModel ) 1508 // wird PageModel eingeschaltet, dann immer PageBreak ausschalten 1509 rOutSet.Put( SvxFmtBreakItem( SVX_BREAK_NONE, _nWhich ) ); 1510 else 1511 { 1512 eState = aPageBreakBox.GetState(); 1513 SfxItemState eModelState = GetItemSet().GetItemState(SID_ATTR_PARA_MODEL, sal_False); 1514 1515 if ( (eModelState == SFX_ITEM_SET && STATE_CHECK == aPageBreakBox.GetState()) || 1516 eState != aPageBreakBox.GetSavedValue() || 1517 aBreakTypeLB.GetSelectEntryPos() != aBreakTypeLB.GetSavedValue() || 1518 aBreakPositionLB.GetSelectEntryPos() != aBreakPositionLB.GetSavedValue() ) 1519 { 1520 const SvxFmtBreakItem rOldBreak( 1521 (const SvxFmtBreakItem&)GetItemSet().Get( _nWhich )); 1522 SvxFmtBreakItem aBreak(rOldBreak.GetBreak(), rOldBreak.Which()); 1523 1524 switch ( eState ) 1525 { 1526 case STATE_CHECK: 1527 { 1528 sal_Bool bBefore = aBreakPositionLB.GetSelectEntryPos() == 0; 1529 1530 if ( aBreakTypeLB.GetSelectEntryPos() == 0 ) 1531 { 1532 if ( bBefore ) 1533 aBreak.SetValue( SVX_BREAK_PAGE_BEFORE ); 1534 else 1535 aBreak.SetValue( SVX_BREAK_PAGE_AFTER ); 1536 } 1537 else 1538 { 1539 if ( bBefore ) 1540 aBreak.SetValue( SVX_BREAK_COLUMN_BEFORE ); 1541 else 1542 aBreak.SetValue( SVX_BREAK_COLUMN_AFTER ); 1543 } 1544 break; 1545 } 1546 1547 case STATE_NOCHECK: 1548 aBreak.SetValue( SVX_BREAK_NONE ); 1549 break; 1550 default: ; //prevent warning 1551 } 1552 pOld = GetOldItem( rOutSet, SID_ATTR_PARA_PAGEBREAK ); 1553 1554 if ( eState != aPageBreakBox.GetSavedValue() || 1555 !pOld || !( *(const SvxFmtBreakItem*)pOld == aBreak ) ) 1556 { 1557 bModified |= sal_True; 1558 rOutSet.Put( aBreak ); 1559 } 1560 } 1561 } 1562 1563 1564 // Absatztrennung 1565 _nWhich = GetWhich( SID_ATTR_PARA_SPLIT ); 1566 eState = aKeepTogetherBox.GetState(); 1567 1568 if ( eState != aKeepTogetherBox.GetSavedValue() ) 1569 { 1570 pOld = GetOldItem( rOutSet, SID_ATTR_PARA_SPLIT ); 1571 1572 if ( !pOld || ( (const SvxFmtSplitItem*)pOld )->GetValue() != 1573 ( eState == STATE_NOCHECK ) ) 1574 { 1575 rOutSet.Put( SvxFmtSplitItem( eState == STATE_NOCHECK, _nWhich ) ); 1576 bModified |= sal_True; 1577 } 1578 } 1579 1580 // Absaetze zusammenhalten 1581 _nWhich = GetWhich( SID_ATTR_PARA_KEEP ); 1582 eState = aKeepParaBox.GetState(); 1583 1584 if ( eState != aKeepParaBox.GetSavedValue() ) 1585 { 1586 pOld = GetOldItem( rOutSet, SID_ATTR_PARA_KEEP ); 1587 1588 // hat sich der Status geaendert, muss immer geputtet werden 1589 rOutSet.Put( SvxFmtKeepItem( eState == STATE_CHECK, _nWhich ) ); 1590 bModified |= sal_True; 1591 } 1592 1593 // Witwen und Waisen 1594 _nWhich = GetWhich( SID_ATTR_PARA_WIDOWS ); 1595 eState = aWidowBox.GetState(); 1596 1597 if ( eState != aWidowBox.GetSavedValue() || 1598 aWidowRowNo.IsValueModified() ) 1599 { 1600 SvxWidowsItem rItem( eState == STATE_CHECK ? 1601 (sal_uInt8)aWidowRowNo.GetValue() : 0, _nWhich ); 1602 pOld = GetOldItem( rOutSet, SID_ATTR_PARA_WIDOWS ); 1603 1604 if ( eState != aWidowBox.GetSavedValue() || !pOld || !( *(const SvxWidowsItem*)pOld == rItem ) ) 1605 { 1606 rOutSet.Put( rItem ); 1607 bModified |= sal_True; 1608 } 1609 } 1610 1611 _nWhich = GetWhich( SID_ATTR_PARA_ORPHANS ); 1612 eState = aOrphanBox.GetState(); 1613 1614 if ( eState != aOrphanBox.GetSavedValue() || 1615 aOrphanRowNo.IsValueModified() ) 1616 { 1617 SvxOrphansItem rItem( eState == STATE_CHECK ? 1618 (sal_uInt8)aOrphanRowNo.GetValue() : 0, _nWhich ); 1619 pOld = GetOldItem( rOutSet, SID_ATTR_PARA_ORPHANS ); 1620 1621 if ( eState != aOrphanBox.GetSavedValue() || 1622 !pOld || 1623 !( *(const SvxOrphansItem*)pOld == rItem ) ) 1624 { 1625 rOutSet.Put( rItem ); 1626 bModified |= sal_True; 1627 } 1628 } 1629 1630 return bModified; 1631 } 1632 1633 // ----------------------------------------------------------------------- 1634 1635 void SvxExtParagraphTabPage::Reset( const SfxItemSet& rSet ) 1636 { 1637 sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_HYPHENZONE ); 1638 SfxItemState eItemState = rSet.GetItemState( _nWhich ); 1639 1640 sal_Bool bItemAvailable = eItemState >= SFX_ITEM_AVAILABLE; 1641 sal_Bool bIsHyphen = sal_False; 1642 if( !bHtmlMode && bItemAvailable ) 1643 { 1644 const SvxHyphenZoneItem& rHyphen = 1645 (const SvxHyphenZoneItem&)rSet.Get( _nWhich ); 1646 aHyphenBox.EnableTriState( sal_False ); 1647 1648 bIsHyphen = rHyphen.IsHyphen(); 1649 aHyphenBox.SetState( bIsHyphen ? STATE_CHECK : STATE_NOCHECK ); 1650 1651 aExtHyphenBeforeBox.SetValue( rHyphen.GetMinLead() ); 1652 aExtHyphenAfterBox.SetValue( rHyphen.GetMinTrail() ); 1653 aMaxHyphenEdit.SetValue( rHyphen.GetMaxHyphens() ); 1654 } 1655 else 1656 { 1657 aHyphenBox.SetState( STATE_DONTKNOW ); 1658 } 1659 sal_Bool bEnable = bItemAvailable && bIsHyphen; 1660 aExtHyphenBeforeBox.Enable(bEnable); 1661 aExtHyphenAfterBox.Enable(bEnable); 1662 aBeforeText.Enable(bEnable); 1663 aAfterText.Enable(bEnable); 1664 aMaxHyphenLabel.Enable(bEnable); 1665 aMaxHyphenEdit.Enable(bEnable); 1666 1667 _nWhich = GetWhich( SID_ATTR_PARA_PAGENUM ); 1668 1669 if ( rSet.GetItemState(_nWhich) >= SFX_ITEM_AVAILABLE ) 1670 { 1671 const sal_uInt16 nPageNum = 1672 ( (const SfxUInt16Item&)rSet.Get( _nWhich ) ).GetValue(); 1673 aPagenumEdit.SetValue( nPageNum ); 1674 } 1675 1676 if ( bPageBreak ) 1677 { 1678 // zuerst PageModel behandeln 1679 _nWhich = GetWhich( SID_ATTR_PARA_MODEL ); 1680 sal_Bool bIsPageModel = sal_False; 1681 eItemState = rSet.GetItemState( _nWhich ); 1682 1683 if ( eItemState >= SFX_ITEM_SET ) 1684 { 1685 aApplyCollBtn.EnableTriState( sal_False ); 1686 1687 const SvxPageModelItem& rModel = 1688 (const SvxPageModelItem&)rSet.Get( _nWhich ); 1689 String aStr( rModel.GetValue() ); 1690 1691 if ( aStr.Len() && 1692 aApplyCollBox.GetEntryPos( aStr ) != LISTBOX_ENTRY_NOTFOUND ) 1693 { 1694 aApplyCollBox.SelectEntry( aStr ); 1695 aApplyCollBtn.SetState( STATE_CHECK ); 1696 bIsPageModel = sal_True; 1697 1698 aPageBreakBox.Enable(); 1699 aPageBreakBox.EnableTriState( sal_False ); 1700 aBreakTypeFT.Enable(); 1701 aBreakTypeLB.Enable(); 1702 aBreakPositionFT.Enable(); 1703 aBreakPositionLB.Enable(); 1704 aApplyCollBtn.Enable(); 1705 aPageBreakBox.SetState( STATE_CHECK ); 1706 1707 //select page break 1708 aBreakTypeLB.SelectEntryPos(0); 1709 //select break before 1710 aBreakPositionLB.SelectEntryPos(0); 1711 } 1712 else 1713 { 1714 aApplyCollBox.SetNoSelection(); 1715 aApplyCollBtn.SetState( STATE_NOCHECK ); 1716 } 1717 } 1718 else if ( SFX_ITEM_DONTCARE == eItemState ) 1719 { 1720 aApplyCollBtn.EnableTriState( sal_True ); 1721 aApplyCollBtn.SetState( STATE_DONTKNOW ); 1722 aApplyCollBox.SetNoSelection(); 1723 } 1724 else 1725 { 1726 aApplyCollBtn.Enable(sal_False); 1727 aApplyCollBox.Enable(sal_False); 1728 aPagenumEdit.Enable(sal_False); 1729 aPagenumText.Enable(sal_False); 1730 } 1731 //!!! ApplyCollClickHdl_Impl( &aApplyCollBtn ); 1732 1733 if ( !bIsPageModel ) 1734 { 1735 _nWhich = GetWhich( SID_ATTR_PARA_PAGEBREAK ); 1736 eItemState = rSet.GetItemState( _nWhich ); 1737 1738 if ( eItemState >= SFX_ITEM_AVAILABLE ) 1739 { 1740 const SvxFmtBreakItem& rPageBreak = 1741 (const SvxFmtBreakItem&)rSet.Get( _nWhich ); 1742 1743 SvxBreak eBreak = (SvxBreak)rPageBreak.GetValue(); 1744 1745 // PageBreak nicht ueber CTRL-RETURN, 1746 // dann kann CheckBox frei gegeben werden 1747 aPageBreakBox.Enable(); 1748 aPageBreakBox.EnableTriState( sal_False ); 1749 aBreakTypeFT.Enable(); 1750 aBreakTypeLB.Enable(); 1751 aBreakPositionFT.Enable(); 1752 aBreakPositionLB.Enable(); 1753 1754 aPageBreakBox.SetState( STATE_CHECK ); 1755 1756 sal_Bool _bEnable = eBreak != SVX_BREAK_NONE && 1757 eBreak != SVX_BREAK_COLUMN_BEFORE && 1758 eBreak != SVX_BREAK_COLUMN_AFTER; 1759 aApplyCollBtn.Enable(_bEnable); 1760 if(!_bEnable) 1761 { 1762 aApplyCollBox.Enable(_bEnable); 1763 aPagenumEdit.Enable(_bEnable); 1764 } 1765 1766 if ( eBreak == SVX_BREAK_NONE ) 1767 aPageBreakBox.SetState( STATE_NOCHECK ); 1768 1769 sal_uInt16 nType = 0; // selection position in break type ListBox : Page 1770 sal_uInt16 nPosition = 0; // selection position in break position ListBox : Before 1771 switch ( eBreak ) 1772 { 1773 case SVX_BREAK_PAGE_BEFORE: 1774 break; 1775 case SVX_BREAK_PAGE_AFTER: 1776 nPosition = 1; 1777 break; 1778 case SVX_BREAK_COLUMN_BEFORE: 1779 nType = 1; 1780 break; 1781 case SVX_BREAK_COLUMN_AFTER: 1782 nType = 1; 1783 nPosition = 1; 1784 break; 1785 default: ;//prevent warning 1786 } 1787 aBreakTypeLB.SelectEntryPos(nType); 1788 aBreakPositionLB.SelectEntryPos(nPosition); 1789 } 1790 else if ( SFX_ITEM_DONTCARE == eItemState ) 1791 aPageBreakBox.SetState( STATE_DONTKNOW ); 1792 else 1793 { 1794 aPageBreakBox.Enable(sal_False); 1795 aBreakTypeFT.Enable(sal_False); 1796 aBreakTypeLB.Enable(sal_False); 1797 aBreakPositionFT.Enable(sal_False); 1798 aBreakPositionLB.Enable(sal_False); 1799 } 1800 } 1801 1802 PageBreakPosHdl_Impl( &aBreakPositionLB ); 1803 PageBreakHdl_Impl( &aPageBreakBox ); 1804 } 1805 1806 _nWhich = GetWhich( SID_ATTR_PARA_KEEP ); 1807 eItemState = rSet.GetItemState( _nWhich ); 1808 1809 if ( eItemState >= SFX_ITEM_AVAILABLE ) 1810 { 1811 aKeepParaBox.EnableTriState( sal_False ); 1812 const SvxFmtKeepItem& rKeep = 1813 (const SvxFmtKeepItem&)rSet.Get( _nWhich ); 1814 1815 if ( rKeep.GetValue() ) 1816 aKeepParaBox.SetState( STATE_CHECK ); 1817 else 1818 aKeepParaBox.SetState( STATE_NOCHECK ); 1819 } 1820 else if ( SFX_ITEM_DONTCARE == eItemState ) 1821 aKeepParaBox.SetState( STATE_DONTKNOW ); 1822 else 1823 aKeepParaBox.Enable(sal_False); 1824 1825 _nWhich = GetWhich( SID_ATTR_PARA_SPLIT ); 1826 eItemState = rSet.GetItemState( _nWhich ); 1827 1828 if ( eItemState >= SFX_ITEM_AVAILABLE ) 1829 { 1830 const SvxFmtSplitItem& rSplit = 1831 (const SvxFmtSplitItem&)rSet.Get( _nWhich ); 1832 aKeepTogetherBox.EnableTriState( sal_False ); 1833 1834 if ( !rSplit.GetValue() ) 1835 aKeepTogetherBox.SetState( STATE_CHECK ); 1836 else 1837 { 1838 aKeepTogetherBox.SetState( STATE_NOCHECK ); 1839 1840 // Witwen und Waisen 1841 aWidowBox.Enable(); 1842 _nWhich = GetWhich( SID_ATTR_PARA_WIDOWS ); 1843 SfxItemState eTmpState = rSet.GetItemState( _nWhich ); 1844 1845 if ( eTmpState >= SFX_ITEM_AVAILABLE ) 1846 { 1847 const SvxWidowsItem& rWidow = 1848 (const SvxWidowsItem&)rSet.Get( _nWhich ); 1849 aWidowBox.EnableTriState( sal_False ); 1850 const sal_uInt16 nLines = rWidow.GetValue(); 1851 1852 sal_Bool _bEnable = nLines > 0; 1853 aWidowRowNo.SetValue( aWidowRowNo.Normalize( nLines ) ); 1854 aWidowBox.SetState( _bEnable ? STATE_CHECK : STATE_NOCHECK); 1855 aWidowRowNo.Enable(_bEnable); 1856 aWidowRowLabel.Enable(_bEnable); 1857 1858 } 1859 else if ( SFX_ITEM_DONTCARE == eTmpState ) 1860 aWidowBox.SetState( STATE_DONTKNOW ); 1861 else 1862 aWidowBox.Enable(sal_False); 1863 1864 aOrphanBox.Enable(); 1865 _nWhich = GetWhich( SID_ATTR_PARA_ORPHANS ); 1866 eTmpState = rSet.GetItemState( _nWhich ); 1867 1868 if ( eTmpState >= SFX_ITEM_AVAILABLE ) 1869 { 1870 const SvxOrphansItem& rOrphan = 1871 (const SvxOrphansItem&)rSet.Get( _nWhich ); 1872 const sal_uInt16 nLines = rOrphan.GetValue(); 1873 aOrphanBox.EnableTriState( sal_False ); 1874 1875 sal_Bool _bEnable = nLines > 0; 1876 aOrphanBox.SetState( _bEnable ? STATE_CHECK : STATE_NOCHECK); 1877 aOrphanRowNo.SetValue( aOrphanRowNo.Normalize( nLines ) ); 1878 aOrphanRowNo.Enable(_bEnable); 1879 aOrphanRowLabel.Enable(_bEnable); 1880 1881 } 1882 else if ( SFX_ITEM_DONTCARE == eTmpState ) 1883 aOrphanBox.SetState( STATE_DONTKNOW ); 1884 else 1885 aOrphanBox.Enable(sal_False); 1886 } 1887 } 1888 else if ( SFX_ITEM_DONTCARE == eItemState ) 1889 aKeepTogetherBox.SetState( STATE_DONTKNOW ); 1890 else 1891 aKeepTogetherBox.Enable(sal_False); 1892 1893 // damit alles richt enabled wird 1894 KeepTogetherHdl_Impl( 0 ); 1895 WidowHdl_Impl( 0 ); 1896 OrphanHdl_Impl( 0 ); 1897 1898 aHyphenBox.SaveValue(); 1899 aExtHyphenBeforeBox.SaveValue(); 1900 aExtHyphenAfterBox.SaveValue(); 1901 aMaxHyphenEdit.SaveValue(); 1902 aPageBreakBox.SaveValue(); 1903 aBreakPositionLB.SaveValue(); 1904 aBreakTypeLB.SaveValue(); 1905 aApplyCollBtn.SaveValue(); 1906 aApplyCollBox.SaveValue(); 1907 aPagenumEdit.SaveValue(); 1908 aKeepTogetherBox.SaveValue(); 1909 aKeepParaBox.SaveValue(); 1910 aWidowBox.SaveValue(); 1911 aOrphanBox.SaveValue(); 1912 } 1913 1914 // ----------------------------------------------------------------------- 1915 1916 int SvxExtParagraphTabPage::DeactivatePage( SfxItemSet* _pSet ) 1917 { 1918 if ( _pSet ) 1919 FillItemSet( *_pSet ); 1920 return LEAVE_PAGE; 1921 } 1922 1923 // ----------------------------------------------------------------------- 1924 1925 void SvxExtParagraphTabPage::DisablePageBreak() 1926 { 1927 bPageBreak = sal_False; 1928 aPageBreakBox.Enable(sal_False); 1929 aBreakTypeLB.RemoveEntry(0); 1930 aBreakPositionFT.Enable(sal_False); 1931 aBreakPositionLB.Enable(sal_False); 1932 aApplyCollBtn.Enable(sal_False); 1933 aApplyCollBox.Enable(sal_False); 1934 aPagenumEdit.Enable(sal_False); 1935 } 1936 1937 // ----------------------------------------------------------------------- 1938 1939 SvxExtParagraphTabPage::SvxExtParagraphTabPage( Window* pParent, const SfxItemSet& rAttr ) : 1940 1941 SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_EXT_PARAGRAPH ), rAttr ), 1942 1943 aExtFL ( this, CUI_RES( FL_HYPHEN ) ), 1944 aHyphenBox ( this, CUI_RES( BTN_HYPHEN ) ), 1945 aBeforeText ( this, CUI_RES( FT_HYPHENBEFORE ) ), 1946 aExtHyphenBeforeBox ( this, CUI_RES( ED_HYPHENBEFORE ) ), 1947 aAfterText ( this, CUI_RES( FT_HYPHENAFTER ) ), 1948 aExtHyphenAfterBox ( this, CUI_RES( ED_HYPHENAFTER ) ), 1949 aMaxHyphenLabel ( this, CUI_RES( FT_MAXHYPH ) ), 1950 aMaxHyphenEdit ( this, CUI_RES( ED_MAXHYPH ) ), 1951 aBreaksFL ( this, CUI_RES( FL_BREAKS ) ), 1952 aPageBreakBox ( this, CUI_RES( BTN_PAGEBREAK ) ), 1953 aBreakTypeFT ( this, CUI_RES( FT_BREAKTYPE )), 1954 aBreakTypeLB ( this, CUI_RES( LB_BREAKTYPE )), 1955 aBreakPositionFT ( this, CUI_RES( FT_BREAKPOSITION )), 1956 aBreakPositionLB ( this, CUI_RES( LB_BREAKPOSITION )), 1957 // aPageBox ( this, CUI_RES( BTN_BREAKPAGE ) ), 1958 // aColumnBox ( this, CUI_RES( BTN_BREAKCOLUMN ) ), 1959 // aBeforeBox ( this, CUI_RES( BTN_PAGEBREAKBEFORE ) ), 1960 // aAfterBox ( this, CUI_RES( BTN_PAGEBREAKAFTER ) ), 1961 aApplyCollBtn ( this, CUI_RES( BTN_PAGECOLL ) ), 1962 aApplyCollBox ( this, CUI_RES( LB_PAGECOLL ) ), 1963 aPagenumText ( this, CUI_RES( FT_PAGENUM ) ), 1964 aPagenumEdit ( this, CUI_RES( ED_PAGENUM ) ), 1965 aExtendFL ( this, CUI_RES( FL_OPTIONS ) ), 1966 aKeepTogetherBox ( this, CUI_RES( BTN_KEEPTOGETHER ) ), 1967 aKeepParaBox ( this, CUI_RES( CB_KEEPTOGETHER ) ), 1968 aOrphanBox ( this, CUI_RES( BTN_ORPHANS ) ), 1969 aOrphanRowNo ( this, CUI_RES( ED_ORPHANS ) ), 1970 aOrphanRowLabel ( this, CUI_RES( FT_ORPHANS ) ), 1971 aWidowBox ( this, CUI_RES( BTN_WIDOWS ) ), 1972 aWidowRowNo ( this, CUI_RES( ED_WIDOWS ) ), 1973 aWidowRowLabel ( this, CUI_RES( FT_WIDOWS ) ), 1974 bPageBreak ( sal_True ), 1975 bHtmlMode ( sal_False ), 1976 nStdPos ( 0 ) 1977 { 1978 FreeResource(); 1979 1980 aApplyCollBox.SetAccessibleRelationLabeledBy(&aApplyCollBtn); 1981 aApplyCollBox.SetAccessibleName(String(CUI_RES(STR_PAGE_STYLE))); 1982 aOrphanRowNo.SetAccessibleRelationLabeledBy(&aOrphanBox); 1983 aWidowRowNo.SetAccessibleRelationLabeledBy(&aWidowBox); 1984 1985 // diese Page braucht ExchangeSupport 1986 SetExchangeSupport(); 1987 1988 aHyphenBox.SetClickHdl( LINK( this, SvxExtParagraphTabPage, HyphenClickHdl_Impl ) ); 1989 aPageBreakBox.SetClickHdl( LINK( this, SvxExtParagraphTabPage, PageBreakHdl_Impl ) ); 1990 aKeepTogetherBox.SetClickHdl( LINK( this, SvxExtParagraphTabPage, KeepTogetherHdl_Impl ) ); 1991 aWidowBox.SetClickHdl( LINK( this, SvxExtParagraphTabPage, WidowHdl_Impl ) ); 1992 aOrphanBox.SetClickHdl( LINK( this, SvxExtParagraphTabPage, OrphanHdl_Impl ) ); 1993 aApplyCollBtn.SetClickHdl( LINK( this, SvxExtParagraphTabPage, ApplyCollClickHdl_Impl ) ); 1994 aBreakTypeLB.SetSelectHdl( LINK( this, SvxExtParagraphTabPage, PageBreakTypeHdl_Impl ) ); 1995 aBreakPositionLB.SetSelectHdl( LINK( this, SvxExtParagraphTabPage, PageBreakPosHdl_Impl ) ); 1996 1997 SfxObjectShell* pSh = SfxObjectShell::Current(); 1998 if ( pSh ) 1999 { 2000 SfxStyleSheetBasePool* pPool = pSh->GetStyleSheetPool(); 2001 pPool->SetSearchMask( SFX_STYLE_FAMILY_PAGE ); 2002 SfxStyleSheetBase* pStyle = pPool->First(); 2003 String aStdName; 2004 2005 while( pStyle ) 2006 { 2007 if ( aStdName.Len() == 0 ) 2008 // first style == standard style 2009 aStdName = pStyle->GetName(); 2010 aApplyCollBox.InsertEntry( pStyle->GetName() ); 2011 pStyle = pPool->Next(); 2012 } 2013 nStdPos = aApplyCollBox.GetEntryPos( aStdName ); 2014 } 2015 2016 sal_uInt16 nHtmlMode = GetHtmlMode_Impl( rAttr ); 2017 if ( nHtmlMode & HTMLMODE_ON ) 2018 { 2019 bHtmlMode = sal_True; 2020 aHyphenBox .Enable(sal_False); 2021 aBeforeText .Enable(sal_False); 2022 aExtHyphenBeforeBox .Enable(sal_False); 2023 aAfterText .Enable(sal_False); 2024 aExtHyphenAfterBox .Enable(sal_False); 2025 aMaxHyphenLabel .Enable(sal_False); 2026 aMaxHyphenEdit .Enable(sal_False); 2027 aExtFL .Enable(sal_False); 2028 aPagenumText .Enable(sal_False); 2029 aPagenumEdit .Enable(sal_False); 2030 // no column break in HTML 2031 aBreakTypeLB.RemoveEntry(1); 2032 } 2033 } 2034 2035 // ----------------------------------------------------------------------- 2036 2037 __EXPORT SvxExtParagraphTabPage::~SvxExtParagraphTabPage() 2038 { 2039 } 2040 2041 // ----------------------------------------------------------------------- 2042 2043 sal_uInt16* SvxExtParagraphTabPage::GetRanges() 2044 { 2045 return pExtRanges; 2046 } 2047 2048 // ----------------------------------------------------------------------- 2049 2050 IMPL_LINK( SvxExtParagraphTabPage, PageBreakHdl_Impl, TriStateBox *, EMPTYARG ) 2051 { 2052 switch ( aPageBreakBox.GetState() ) 2053 { 2054 case STATE_CHECK: 2055 aBreakTypeFT.Enable(); 2056 aBreakTypeLB.Enable(); 2057 aBreakPositionFT.Enable(); 2058 aBreakPositionLB.Enable(); 2059 2060 if ( 0 == aBreakTypeLB.GetSelectEntryPos()&& 2061 0 == aBreakPositionLB.GetSelectEntryPos() ) 2062 { 2063 aApplyCollBtn.Enable(); 2064 2065 sal_Bool bEnable = STATE_CHECK == aApplyCollBtn.GetState() && 2066 aApplyCollBox.GetEntryCount(); 2067 aApplyCollBox.Enable(bEnable); 2068 if(!bHtmlMode) 2069 { 2070 aPagenumText.Enable(bEnable); 2071 aPagenumEdit.Enable(bEnable); 2072 } 2073 } 2074 break; 2075 2076 case STATE_NOCHECK: 2077 case STATE_DONTKNOW: 2078 aApplyCollBtn.SetState( STATE_NOCHECK ); 2079 aApplyCollBtn.Enable(sal_False); 2080 aApplyCollBox.Enable(sal_False); 2081 aPagenumText.Enable(sal_False); 2082 aPagenumEdit.Enable(sal_False); 2083 aBreakTypeFT.Enable(sal_False); 2084 aBreakTypeLB.Enable(sal_False); 2085 aBreakPositionFT.Enable(sal_False); 2086 aBreakPositionLB.Enable(sal_False); 2087 break; 2088 } 2089 return 0; 2090 } 2091 2092 // ----------------------------------------------------------------------- 2093 2094 IMPL_LINK( SvxExtParagraphTabPage, KeepTogetherHdl_Impl, TriStateBox *, EMPTYARG ) 2095 { 2096 sal_Bool bEnable = aKeepTogetherBox.GetState() == STATE_NOCHECK; 2097 aWidowBox.Enable(bEnable); 2098 aOrphanBox.Enable(bEnable); 2099 2100 return 0; 2101 } 2102 2103 // ----------------------------------------------------------------------- 2104 2105 IMPL_LINK( SvxExtParagraphTabPage, WidowHdl_Impl, TriStateBox *, EMPTYARG ) 2106 { 2107 switch ( aWidowBox.GetState() ) 2108 { 2109 case STATE_CHECK: 2110 aWidowRowNo.Enable(); 2111 aWidowRowLabel.Enable(); 2112 aKeepTogetherBox.Enable(sal_False); 2113 break; 2114 2115 case STATE_NOCHECK: 2116 if ( aOrphanBox.GetState() == STATE_NOCHECK ) 2117 aKeepTogetherBox.Enable(); 2118 2119 // kein break 2120 case STATE_DONTKNOW: 2121 aWidowRowNo.Enable(sal_False); 2122 aWidowRowLabel.Enable(sal_False); 2123 break; 2124 } 2125 return 0; 2126 } 2127 2128 // ----------------------------------------------------------------------- 2129 2130 IMPL_LINK( SvxExtParagraphTabPage, OrphanHdl_Impl, TriStateBox *, EMPTYARG ) 2131 { 2132 switch( aOrphanBox.GetState() ) 2133 { 2134 case STATE_CHECK: 2135 aOrphanRowNo.Enable(); 2136 aOrphanRowLabel.Enable(); 2137 aKeepTogetherBox.Enable(sal_False); 2138 break; 2139 2140 case STATE_NOCHECK: 2141 if ( aWidowBox.GetState() == STATE_NOCHECK ) 2142 aKeepTogetherBox.Enable(); 2143 2144 // kein break 2145 case STATE_DONTKNOW: 2146 aOrphanRowNo.Enable(sal_False); 2147 aOrphanRowLabel.Enable(sal_False); 2148 break; 2149 } 2150 return 0; 2151 } 2152 2153 // ----------------------------------------------------------------------- 2154 2155 IMPL_LINK( SvxExtParagraphTabPage, HyphenClickHdl_Impl, TriStateBox *, EMPTYARG ) 2156 { 2157 2158 sal_Bool bEnable = aHyphenBox.GetState() == STATE_CHECK; 2159 aBeforeText.Enable(bEnable); 2160 aExtHyphenBeforeBox.Enable(bEnable); 2161 aAfterText.Enable(bEnable); 2162 aExtHyphenAfterBox.Enable(bEnable); 2163 aMaxHyphenLabel.Enable(bEnable); 2164 aMaxHyphenEdit.Enable(bEnable); 2165 aHyphenBox.SetState( bEnable ? STATE_CHECK : STATE_NOCHECK); 2166 2167 return 0; 2168 } 2169 2170 // ----------------------------------------------------------------------- 2171 2172 IMPL_LINK( SvxExtParagraphTabPage, ApplyCollClickHdl_Impl, TriStateBox *, EMPTYARG ) 2173 { 2174 sal_Bool bEnable = sal_False; 2175 if ( aApplyCollBtn.GetState() == STATE_CHECK && 2176 aApplyCollBox.GetEntryCount() ) 2177 { 2178 bEnable = sal_True; 2179 aApplyCollBox.SelectEntryPos( nStdPos ); 2180 } 2181 else 2182 { 2183 aApplyCollBox.SetNoSelection(); 2184 } 2185 aApplyCollBox.Enable(bEnable); 2186 if(!bHtmlMode) 2187 { 2188 aPagenumText.Enable(bEnable); 2189 aPagenumEdit.Enable(bEnable); 2190 } 2191 return 0; 2192 } 2193 2194 // ----------------------------------------------------------------------- 2195 2196 IMPL_LINK( SvxExtParagraphTabPage, PageBreakPosHdl_Impl, ListBox *, pListBox ) 2197 { 2198 if ( 0 == pListBox->GetSelectEntryPos() ) 2199 { 2200 aApplyCollBtn.Enable(); 2201 2202 sal_Bool bEnable = aApplyCollBtn.GetState() == STATE_CHECK && 2203 aApplyCollBox.GetEntryCount(); 2204 2205 aApplyCollBox.Enable(bEnable); 2206 if(!bHtmlMode) 2207 { 2208 aPagenumText.Enable(bEnable); 2209 aPagenumEdit.Enable(bEnable); 2210 } 2211 } 2212 else if ( 1 == pListBox->GetSelectEntryPos() ) 2213 { 2214 aApplyCollBtn.SetState( STATE_NOCHECK ); 2215 aApplyCollBtn.Enable(sal_False); 2216 aApplyCollBox.Enable(sal_False); 2217 aPagenumText.Enable(sal_False); 2218 aPagenumEdit.Enable(sal_False); 2219 } 2220 return 0; 2221 } 2222 2223 // ----------------------------------------------------------------------- 2224 2225 IMPL_LINK( SvxExtParagraphTabPage, PageBreakTypeHdl_Impl, ListBox *, pListBox ) 2226 { 2227 //column break or break break after 2228 sal_uInt16 nBreakPos = aBreakPositionLB.GetSelectEntryPos(); 2229 if ( pListBox->GetSelectEntryPos() == 1 || 1 == nBreakPos) 2230 { 2231 aApplyCollBtn.SetState( STATE_NOCHECK ); 2232 aApplyCollBtn.Enable(sal_False); 2233 aApplyCollBox.Enable(sal_False); 2234 aPagenumText.Enable(sal_False); 2235 aPagenumEdit.Enable(sal_False); 2236 } 2237 else 2238 PageBreakPosHdl_Impl( &aBreakPositionLB ); 2239 return 0; 2240 } 2241 //Add CHINA001 begin 2242 void SvxExtParagraphTabPage::PageCreated(SfxAllItemSet aSet) 2243 { 2244 2245 2246 SFX_ITEMSET_ARG (&aSet,pDisablePageBreakItem,SfxBoolItem,SID_DISABLE_SVXEXTPARAGRAPHTABPAGE_PAGEBREAK,sal_False); 2247 2248 if (pDisablePageBreakItem) 2249 if ( pDisablePageBreakItem->GetValue()) 2250 DisablePageBreak(); 2251 2252 2253 } 2254 //end of Add CHINA001 2255 /*-- 29.11.00 11:36:24--------------------------------------------------- 2256 2257 -----------------------------------------------------------------------*/ 2258 SvxAsianTabPage::SvxAsianTabPage( Window* pParent, const SfxItemSet& rSet ) : 2259 SfxTabPage(pParent, CUI_RES( RID_SVXPAGE_PARA_ASIAN ), rSet), 2260 aOptionsFL( this, CUI_RES(FL_AS_OPTIONS )), 2261 aForbiddenRulesCB( this, CUI_RES(CB_AS_FORBIDDEN )), 2262 aHangingPunctCB( this, CUI_RES(CB_AS_HANG_PUNC )), 2263 aScriptSpaceCB( this, CUI_RES(CB_AS_SCRIPT_SPACE ))//, 2264 2265 { 2266 FreeResource(); 2267 2268 Link aLink = LINK( this, SvxAsianTabPage, ClickHdl_Impl ); 2269 aHangingPunctCB.SetClickHdl( aLink ); 2270 aScriptSpaceCB.SetClickHdl( aLink ); 2271 aForbiddenRulesCB.SetClickHdl( aLink ); 2272 2273 } 2274 /*-- 29.11.00 11:36:24--------------------------------------------------- 2275 2276 -----------------------------------------------------------------------*/ 2277 SvxAsianTabPage::~SvxAsianTabPage() 2278 { 2279 } 2280 /*-- 29.11.00 11:36:24--------------------------------------------------- 2281 2282 -----------------------------------------------------------------------*/ 2283 SfxTabPage* SvxAsianTabPage::Create( Window* pParent, const SfxItemSet& rSet ) 2284 { 2285 return new SvxAsianTabPage(pParent, rSet); 2286 } 2287 /*-- 29.11.00 11:36:24--------------------------------------------------- 2288 2289 -----------------------------------------------------------------------*/ 2290 sal_uInt16* SvxAsianTabPage::GetRanges() 2291 { 2292 static sal_uInt16 pRanges[] = 2293 { 2294 SID_ATTR_PARA_SCRIPTSPACE, SID_ATTR_PARA_FORBIDDEN_RULES, 2295 0 2296 }; 2297 return pRanges; 2298 } 2299 /*-- 29.11.00 11:36:24--------------------------------------------------- 2300 2301 -----------------------------------------------------------------------*/ 2302 sal_Bool SvxAsianTabPage::FillItemSet( SfxItemSet& rSet ) 2303 { 2304 sal_Bool bRet = sal_False; 2305 SfxItemPool* pPool = rSet.GetPool(); 2306 if(aScriptSpaceCB.IsChecked() != aScriptSpaceCB.GetSavedValue()) 2307 { 2308 SfxBoolItem* pNewItem = (SfxBoolItem*)rSet.Get( 2309 pPool->GetWhich(SID_ATTR_PARA_SCRIPTSPACE)).Clone(); 2310 pNewItem->SetValue(aScriptSpaceCB.IsChecked()); 2311 rSet.Put(*pNewItem); 2312 delete pNewItem; 2313 bRet = sal_True; 2314 } 2315 if(aHangingPunctCB.IsChecked() != aHangingPunctCB.GetSavedValue()) 2316 { 2317 SfxBoolItem* pNewItem = (SfxBoolItem*)rSet.Get( 2318 pPool->GetWhich(SID_ATTR_PARA_HANGPUNCTUATION)).Clone(); 2319 pNewItem->SetValue(aHangingPunctCB.IsChecked()); 2320 rSet.Put(*pNewItem); 2321 delete pNewItem; 2322 bRet = sal_True; 2323 } 2324 if(aForbiddenRulesCB.IsChecked() != aForbiddenRulesCB.GetSavedValue()) 2325 { 2326 SfxBoolItem* pNewItem = (SfxBoolItem*)rSet.Get( 2327 pPool->GetWhich(SID_ATTR_PARA_FORBIDDEN_RULES)).Clone(); 2328 pNewItem->SetValue(aForbiddenRulesCB.IsChecked()); 2329 rSet.Put(*pNewItem); 2330 delete pNewItem; 2331 bRet = sal_True; 2332 } 2333 return bRet; 2334 } 2335 /*-- 29.11.00 11:36:25--------------------------------------------------- 2336 2337 -----------------------------------------------------------------------*/ 2338 void lcl_SetBox(const SfxItemSet& rSet, sal_uInt16 nSlotId, TriStateBox& rBox) 2339 { 2340 sal_uInt16 _nWhich = rSet.GetPool()->GetWhich(nSlotId); 2341 SfxItemState eState = rSet.GetItemState(_nWhich, sal_True); 2342 if(!eState || eState == SFX_ITEM_DISABLED ) 2343 rBox.Enable(sal_False); 2344 else if(eState >= SFX_ITEM_AVAILABLE) 2345 { 2346 rBox.EnableTriState( sal_False ); 2347 rBox.Check(((const SfxBoolItem&)rSet.Get(_nWhich)).GetValue()); 2348 } 2349 else 2350 rBox.SetState( STATE_DONTKNOW ); 2351 rBox.SaveValue(); 2352 } 2353 2354 2355 void SvxAsianTabPage::Reset( const SfxItemSet& rSet ) 2356 { 2357 lcl_SetBox(rSet, SID_ATTR_PARA_FORBIDDEN_RULES, aForbiddenRulesCB ); 2358 // lcl_SetBox(rSet, , aAllowWordBreakCB ); 2359 lcl_SetBox(rSet, SID_ATTR_PARA_HANGPUNCTUATION, aHangingPunctCB ); 2360 2361 2362 //character distance not yet available 2363 // lcl_SetBox(rSet, , aPuntuationCB ); 2364 lcl_SetBox(rSet, SID_ATTR_PARA_SCRIPTSPACE, aScriptSpaceCB ); 2365 // lcl_SetBox(rSet, , aAdjustNumbersCB ); 2366 // aAllowWordBreakCB .Enable(sal_False); 2367 // aPuntuationCB .Enable(sal_False); 2368 // aAdjustNumbersCB .Enable(sal_False); 2369 } 2370 /* -----------------------------19.12.00 12:59-------------------------------- 2371 2372 ---------------------------------------------------------------------------*/ 2373 IMPL_LINK( SvxAsianTabPage, ClickHdl_Impl, TriStateBox*, pBox ) 2374 { 2375 pBox->EnableTriState( sal_False ); 2376 return 0; 2377 } 2378