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_sc.hxx" 30 31 #undef SC_DLLIMPLEMENTATION 32 33 34 35 //------------------------------------------------------------------ 36 37 #include "scitems.hxx" 38 #include "tpview.hxx" 39 #include "global.hxx" 40 #include "viewopti.hxx" 41 #include "tabvwsh.hxx" 42 #include "uiitems.hxx" 43 #include "scresid.hxx" 44 #include "docsh.hxx" 45 #include "sc.hrc" // -> Slot-IDs 46 #include "optdlg.hrc" 47 #include "globstr.hrc" 48 #include <appoptio.hxx> 49 #include <scmod.hxx> 50 #include <svx/dlgutil.hxx> 51 #include <svx/drawitem.hxx> 52 #include <svx/xtable.hxx> 53 54 55 // STATIC DATA ----------------------------------------------------------- 56 57 58 59 /*-----------------11.01.97 10.52------------------- 60 Optionen Inhalte 61 --------------------------------------------------*/ 62 63 ScTpContentOptions::ScTpContentOptions( Window* pParent, 64 const SfxItemSet& rArgSet ) : 65 SfxTabPage(pParent, ScResId( RID_SCPAGE_CONTENT ), rArgSet), 66 67 aLinesGB( this, ScResId(GB_LINES )), 68 aGridCB( this, ScResId(CB_GRID )), 69 aColorFT( this, ScResId(FT_COLOR )), 70 aColorLB( this, ScResId(LB_COLOR )), 71 aBreakCB( this, ScResId(CB_PAGEBREAKS )), 72 aGuideLineCB( this, ScResId(CB_GUIDELINE )), 73 aHandleCB( this, ScResId(CB_HANDLES )), 74 aBigHandleCB( this, ScResId(CB_BIGHANDLES )), 75 76 aSeparator1FL (this, ScResId(FL_SEPARATOR1 )), 77 aDisplayGB( this, ScResId(GB_DISPLAY)), 78 aFormulaCB( this, ScResId(CB_FORMULA)), 79 aNilCB( this, ScResId(CB_NIL )), 80 aAnnotCB( this, ScResId(CB_ANNOT )), 81 aValueCB( this, ScResId(CB_VALUE )), 82 aAnchorCB( this, ScResId(CB_ANCHOR )), 83 aClipMarkCB( this, ScResId(CB_CLIP )), 84 aRangeFindCB( this, ScResId( CB_RFIND )), 85 86 aObjectGB( this, ScResId(GB_OBJECT )), 87 aObjGrfFT( this, ScResId(FT_OBJGRF )), 88 aObjGrfLB( this, ScResId(LB_OBJGRF )), 89 aDiagramFT( this, ScResId(FT_DIAGRAM)), 90 aDiagramLB( this, ScResId(LB_DIAGRAM)), 91 aDrawFT( this, ScResId(FT_DRAW )), 92 aDrawLB( this, ScResId(LB_DRAW )), 93 94 aZoomGB( this, ScResId(GB_ZOOM) ), 95 aSyncZoomCB( this, ScResId(CB_SYNCZOOM) ), 96 97 aSeparator2FL (this, ScResId(FL_SEPARATOR2)), 98 aWindowGB( this, ScResId(GB_WINDOW )), 99 aRowColHeaderCB(this, ScResId(CB_ROWCOLHEADER )), 100 aHScrollCB( this, ScResId(CB_HSCROLL )), 101 aVScrollCB( this, ScResId(CB_VSCROLL )), 102 aTblRegCB( this, ScResId(CB_TBLREG )), 103 aOutlineCB( this, ScResId(CB_OUTLINE )), 104 pLocalOptions(0) 105 { 106 FreeResource(); 107 aSeparator1FL.SetStyle( aSeparator1FL.GetStyle() | WB_VERT ); 108 aSeparator2FL.SetStyle( aSeparator2FL.GetStyle() | WB_VERT ); 109 SetExchangeSupport(); 110 Link aSelObjHdl(LINK( this, ScTpContentOptions, SelLbObjHdl ) ); 111 aObjGrfLB. SetSelectHdl(aSelObjHdl); 112 aDiagramLB. SetSelectHdl(aSelObjHdl); 113 aDrawLB. SetSelectHdl(aSelObjHdl); 114 115 Link aCBHdl(LINK( this, ScTpContentOptions, CBHdl ) ); 116 aFormulaCB .SetClickHdl(aCBHdl); 117 aNilCB .SetClickHdl(aCBHdl); 118 aAnnotCB .SetClickHdl(aCBHdl); 119 aValueCB .SetClickHdl(aCBHdl); 120 aAnchorCB .SetClickHdl(aCBHdl); 121 aClipMarkCB .SetClickHdl(aCBHdl); 122 123 aVScrollCB .SetClickHdl(aCBHdl); 124 aHScrollCB .SetClickHdl(aCBHdl); 125 aTblRegCB .SetClickHdl(aCBHdl); 126 aOutlineCB .SetClickHdl(aCBHdl); 127 aBreakCB .SetClickHdl(aCBHdl); 128 aGuideLineCB.SetClickHdl(aCBHdl); 129 aHandleCB .SetClickHdl(aCBHdl); 130 aBigHandleCB.SetClickHdl(aCBHdl); 131 aRowColHeaderCB.SetClickHdl(aCBHdl); 132 133 aGridCB .SetClickHdl( LINK( this, ScTpContentOptions, GridHdl ) ); 134 } 135 /*-----------------11.01.97 10.52------------------- 136 137 --------------------------------------------------*/ 138 139 ScTpContentOptions::~ScTpContentOptions() 140 { 141 delete pLocalOptions; 142 } 143 /*-----------------11.01.97 10.52------------------- 144 145 --------------------------------------------------*/ 146 147 SfxTabPage* ScTpContentOptions::Create( Window* pParent, 148 const SfxItemSet& rCoreSet ) 149 { 150 return new ScTpContentOptions(pParent, rCoreSet); 151 } 152 /*-----------------11.01.97 10.52------------------- 153 154 --------------------------------------------------*/ 155 sal_Bool ScTpContentOptions::FillItemSet( SfxItemSet& rCoreSet ) 156 { 157 sal_Bool bRet = sal_False; 158 if( aFormulaCB .GetSavedValue() != aFormulaCB .IsChecked() || 159 aNilCB .GetSavedValue() != aNilCB .IsChecked() || 160 aAnnotCB .GetSavedValue() != aAnnotCB .IsChecked() || 161 aValueCB .GetSavedValue() != aValueCB .IsChecked() || 162 aAnchorCB .GetSavedValue() != aAnchorCB .IsChecked() || 163 aClipMarkCB .GetSavedValue() != aClipMarkCB .IsChecked() || 164 aObjGrfLB .GetSavedValue() != aObjGrfLB .GetSelectEntryPos() || 165 aDiagramLB .GetSavedValue() != aDiagramLB .GetSelectEntryPos() || 166 aDrawLB .GetSavedValue() != aDrawLB .GetSelectEntryPos() || 167 aGridCB .GetSavedValue() != aGridCB.IsChecked() || 168 aRowColHeaderCB .GetSavedValue() != aRowColHeaderCB.IsChecked() || 169 aHScrollCB .GetSavedValue() != aHScrollCB .IsChecked() || 170 aVScrollCB .GetSavedValue() != aVScrollCB .IsChecked() || 171 aTblRegCB .GetSavedValue() != aTblRegCB .IsChecked() || 172 aOutlineCB .GetSavedValue() != aOutlineCB .IsChecked() || 173 aColorLB .GetSavedValue() != aColorLB .GetSelectEntryPos() || 174 aBreakCB .GetSavedValue() != aBreakCB .IsChecked() || 175 aGuideLineCB .GetSavedValue() != aGuideLineCB .IsChecked() || 176 aHandleCB .GetSavedValue() != aHandleCB .IsChecked() || 177 aBigHandleCB .GetSavedValue() != aBigHandleCB .IsChecked()) 178 { 179 pLocalOptions->SetGridColor( aColorLB.GetSelectEntryColor(), 180 aColorLB.GetSelectEntry() ); 181 rCoreSet.Put(ScTpViewItem(SID_SCVIEWOPTIONS, *pLocalOptions)); 182 bRet = sal_True; 183 } 184 if(aRangeFindCB.GetSavedValue() != aRangeFindCB.IsChecked()) 185 { 186 rCoreSet.Put(SfxBoolItem(SID_SC_INPUT_RANGEFINDER, aRangeFindCB.IsChecked())); 187 bRet = sal_True; 188 } 189 if(aSyncZoomCB.GetSavedValue() != aSyncZoomCB.IsChecked()) 190 { 191 rCoreSet.Put(SfxBoolItem(SID_SC_OPT_SYNCZOOM, aSyncZoomCB.IsChecked())); 192 bRet = sal_True; 193 } 194 195 196 return bRet; 197 } 198 /*-----------------11.01.97 10.53------------------- 199 200 --------------------------------------------------*/ 201 202 void ScTpContentOptions::Reset( const SfxItemSet& rCoreSet ) 203 { 204 const SfxPoolItem* pItem; 205 if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SCVIEWOPTIONS, sal_False , &pItem)) 206 pLocalOptions = new ScViewOptions( 207 ((const ScTpViewItem*)pItem)->GetViewOptions() ); 208 else 209 pLocalOptions = new ScViewOptions; 210 aFormulaCB .Check(pLocalOptions->GetOption(VOPT_FORMULAS)); 211 aNilCB .Check(pLocalOptions->GetOption(VOPT_NULLVALS)); 212 aAnnotCB .Check(pLocalOptions->GetOption(VOPT_NOTES)); 213 aValueCB .Check(pLocalOptions->GetOption(VOPT_SYNTAX)); 214 aAnchorCB .Check(pLocalOptions->GetOption(VOPT_ANCHOR)); 215 aClipMarkCB .Check(pLocalOptions->GetOption(VOPT_CLIPMARKS)); 216 217 aObjGrfLB .SelectEntryPos( (sal_uInt16)pLocalOptions->GetObjMode(VOBJ_TYPE_OLE) ); 218 aDiagramLB .SelectEntryPos( (sal_uInt16)pLocalOptions->GetObjMode(VOBJ_TYPE_CHART) ); 219 aDrawLB .SelectEntryPos( (sal_uInt16)pLocalOptions->GetObjMode(VOBJ_TYPE_DRAW) ); 220 221 aRowColHeaderCB.Check( pLocalOptions->GetOption(VOPT_HEADER) ); 222 aHScrollCB .Check( pLocalOptions->GetOption(VOPT_HSCROLL) ); 223 aVScrollCB .Check( pLocalOptions->GetOption(VOPT_VSCROLL) ); 224 aTblRegCB .Check( pLocalOptions->GetOption(VOPT_TABCONTROLS) ); 225 aOutlineCB .Check( pLocalOptions->GetOption(VOPT_OUTLINER) ); 226 227 InitGridOpt(); 228 229 aBreakCB.Check( pLocalOptions->GetOption(VOPT_PAGEBREAKS) ); 230 aGuideLineCB.Check( pLocalOptions->GetOption(VOPT_HELPLINES) ); 231 aHandleCB.Check( !pLocalOptions->GetOption(VOPT_SOLIDHANDLES) ); // inverted 232 aBigHandleCB.Check( pLocalOptions->GetOption(VOPT_BIGHANDLES) ); 233 234 if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SC_INPUT_RANGEFINDER, sal_False, &pItem)) 235 aRangeFindCB.Check(((const SfxBoolItem*)pItem)->GetValue()); 236 if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SC_OPT_SYNCZOOM, sal_False, &pItem)) 237 aSyncZoomCB.Check(((const SfxBoolItem*)pItem)->GetValue()); 238 239 aRangeFindCB.SaveValue(); 240 aSyncZoomCB.SaveValue(); 241 242 aFormulaCB .SaveValue(); 243 aNilCB .SaveValue(); 244 aAnnotCB .SaveValue(); 245 aValueCB .SaveValue(); 246 aAnchorCB .SaveValue(); 247 aClipMarkCB .SaveValue(); 248 aObjGrfLB .SaveValue(); 249 aDiagramLB .SaveValue(); 250 aDrawLB .SaveValue(); 251 aRowColHeaderCB .SaveValue(); 252 aHScrollCB .SaveValue(); 253 aVScrollCB .SaveValue(); 254 aTblRegCB .SaveValue(); 255 aOutlineCB .SaveValue(); 256 aGridCB .SaveValue(); 257 aColorLB .SaveValue(); 258 aBreakCB .SaveValue(); 259 aGuideLineCB .SaveValue(); 260 aHandleCB .SaveValue(); 261 aBigHandleCB .SaveValue(); 262 } 263 /*-----------------11.01.97 12.45------------------- 264 265 --------------------------------------------------*/ 266 267 void ScTpContentOptions::ActivatePage( const SfxItemSet& rSet) 268 { 269 const SfxPoolItem* pItem; 270 if(SFX_ITEM_SET == rSet.GetItemState(SID_SCVIEWOPTIONS, sal_False , &pItem)) 271 *pLocalOptions = ((const ScTpViewItem*)pItem)->GetViewOptions(); 272 } 273 /*-----------------11.01.97 12.45------------------- 274 275 --------------------------------------------------*/ 276 277 int ScTpContentOptions::DeactivatePage( SfxItemSet* pSetP ) 278 { 279 if(pSetP) 280 FillItemSet(*pSetP); 281 return SfxTabPage::LEAVE_PAGE; 282 } 283 /*-----------------11.01.97 13.43------------------- 284 285 --------------------------------------------------*/ 286 287 IMPL_LINK( ScTpContentOptions, SelLbObjHdl, ListBox*, pLb ) 288 { 289 sal_uInt16 nSelPos = pLb->GetSelectEntryPos(); 290 ScVObjMode eMode = ScVObjMode(nSelPos); 291 ScVObjType eType = VOBJ_TYPE_OLE; 292 293 if ( pLb == &aDiagramLB ) 294 eType = VOBJ_TYPE_CHART; 295 else if ( pLb == &aDrawLB ) 296 eType = VOBJ_TYPE_DRAW; 297 298 pLocalOptions->SetObjMode( eType, eMode ); 299 300 return 0; 301 } 302 303 /*-----------------11.01.97 14.25------------------- 304 305 --------------------------------------------------*/ 306 307 IMPL_LINK( ScTpContentOptions, CBHdl, CheckBox*, pBtn ) 308 { 309 ScViewOption eOption = VOPT_FORMULAS; 310 sal_Bool bChecked = pBtn->IsChecked(); 311 312 if ( &aFormulaCB == pBtn ) eOption = VOPT_FORMULAS; 313 else if ( &aNilCB == pBtn ) eOption = VOPT_NULLVALS; 314 else if ( &aAnnotCB == pBtn ) eOption = VOPT_NOTES; 315 else if ( &aValueCB == pBtn ) eOption = VOPT_SYNTAX; 316 else if ( &aAnchorCB == pBtn ) eOption = VOPT_ANCHOR; 317 else if ( &aClipMarkCB == pBtn ) eOption = VOPT_CLIPMARKS; 318 else if ( &aVScrollCB == pBtn ) eOption = VOPT_VSCROLL; 319 else if ( &aHScrollCB == pBtn ) eOption = VOPT_HSCROLL; 320 else if ( &aTblRegCB == pBtn ) eOption = VOPT_TABCONTROLS; 321 else if ( &aOutlineCB == pBtn ) eOption = VOPT_OUTLINER; 322 else if ( &aBreakCB == pBtn ) eOption = VOPT_PAGEBREAKS; 323 else if ( &aGuideLineCB == pBtn ) eOption = VOPT_HELPLINES; 324 else if ( &aHandleCB == pBtn ) eOption = VOPT_SOLIDHANDLES; 325 else if ( &aBigHandleCB == pBtn ) eOption = VOPT_BIGHANDLES; 326 else if ( &aRowColHeaderCB == pBtn ) eOption = VOPT_HEADER; 327 328 // VOPT_SOLIDHANDLES is inverted (CheckBox is "simple handles") 329 if ( eOption == VOPT_SOLIDHANDLES ) 330 pLocalOptions->SetOption( eOption, !bChecked ); 331 else 332 pLocalOptions->SetOption( eOption, bChecked ); 333 334 335 return 0; 336 } 337 /*-----------------11.01.97 13.13------------------- 338 339 --------------------------------------------------*/ 340 341 void ScTpContentOptions::InitGridOpt() 342 { 343 sal_Bool bGrid = pLocalOptions->GetOption( VOPT_GRID ); 344 345 aGridCB.Check( bGrid ); 346 347 if ( bGrid ) 348 aColorFT.Enable(), aColorLB.Enable(); 349 else 350 aColorFT.Disable(), aColorLB.Disable(); 351 352 if ( aColorLB.GetEntryCount() == 0 ) 353 { 354 SfxObjectShell* pDocSh = SfxObjectShell::Current(); 355 // hier koennte auch eine andere DocShell kommen! 356 pDocSh = PTR_CAST(ScDocShell, pDocSh); 357 358 XColorTable* pColorTable = NULL; 359 360 if ( pDocSh ) 361 { 362 const SfxPoolItem* pItem = pDocSh->GetItem( SID_COLOR_TABLE ); 363 364 if ( pItem ) 365 pColorTable = ((SvxColorTableItem*)pItem)->GetColorTable(); 366 } 367 else 368 pColorTable = XColorTable::GetStdColorTable(); 369 370 if ( !pColorTable ) 371 return; 372 373 //------------------------------------------------------ 374 375 aColorLB.SetUpdateMode( sal_False ); 376 377 // Eintraege aus der Colortable 378 379 long nCount = pColorTable->Count(); 380 for ( long n=0; n<nCount; n++ ) 381 { 382 XColorEntry* pEntry = pColorTable->GetColor(n); 383 aColorLB.InsertEntry( pEntry->GetColor(), pEntry->GetName() ); 384 } 385 386 // Standard-Gitterfarbe 387 388 Color aStdCol( SC_STD_GRIDCOLOR ); // wie Default in ScViewOptions 389 if ( LISTBOX_ENTRY_NOTFOUND == 390 aColorLB.GetEntryPos( aStdCol ) ) 391 aColorLB.InsertEntry( aStdCol, ScGlobal::GetRscString( STR_GRIDCOLOR ) ); 392 393 aColorLB.SetUpdateMode( sal_True ); 394 395 Invalidate(); 396 } 397 398 // #79720# also select grid color entry on subsequent calls 399 400 String aName; 401 Color aCol = pLocalOptions->GetGridColor( &aName ); 402 sal_uInt16 nSelPos = aColorLB.GetEntryPos( aCol ); 403 404 if ( LISTBOX_ENTRY_NOTFOUND != nSelPos ) 405 aColorLB.SelectEntryPos( nSelPos ); 406 else 407 aColorLB.SelectEntryPos( aColorLB.InsertEntry( aCol, aName ) ); 408 } 409 /*-----------------11.01.97 13.40------------------- 410 411 --------------------------------------------------*/ 412 413 IMPL_LINK( ScTpContentOptions, GridHdl, CheckBox*, pBox ) 414 { 415 sal_Bool bChecked = pBox->IsChecked(); 416 aColorFT.Enable(bChecked); 417 aColorLB.Enable(bChecked); 418 pLocalOptions->SetOption( VOPT_GRID, bChecked ); 419 return 0; 420 } 421 /*-----------------11.01.97 10.53------------------- 422 423 --------------------------------------------------*/ 424 425 ScTpLayoutOptions::ScTpLayoutOptions( Window* pParent, 426 const SfxItemSet& rArgSet ) : 427 SfxTabPage(pParent, ScResId( RID_SCPAGE_LAYOUT ), rArgSet), 428 aUnitGB( this, ScResId(GB_UNIT )), 429 aUnitFT( this, ScResId(FT_UNIT )), 430 aUnitLB( this, ScResId(LB_UNIT )), 431 aTabFT( this, ScResId( FT_TAB )), 432 aTabMF( this, ScResId( MF_TAB )), 433 aSeparatorFL( this, ScResId( FL_SEPARATOR )), 434 aLinkGB (this, ScResId(GB_LINK )), 435 aLinkFT(this, ScResId(FT_UPDATE_LINKS )), 436 aAlwaysRB (this, ScResId(RB_ALWAYS )), 437 aRequestRB (this, ScResId(RB_REQUEST )), 438 aNeverRB (this, ScResId(RB_NEVER )), 439 440 aOptionsGB( this, ScResId( GB_OPTIONS )), 441 aAlignCB ( this, ScResId( CB_ALIGN )), 442 aAlignLB ( this, ScResId( LB_ALIGN )), 443 aEditModeCB( this, ScResId( CB_EDITMODE )), 444 aFormatCB( this, ScResId( CB_FORMAT )), 445 aExpRefCB( this, ScResId( CB_EXPREF )), 446 aMarkHdrCB( this, ScResId( CB_MARKHDR )), 447 aTextFmtCB( this, ScResId( CB_TEXTFMT )), 448 aReplWarnCB( this, ScResId( CB_REPLWARN )), 449 aUnitArr( ScResId(ST_UNIT )), 450 pDoc(NULL) 451 { 452 FreeResource(); 453 aSeparatorFL.SetStyle( aSeparatorFL.GetStyle() | WB_VERT ); 454 SetExchangeSupport(); 455 456 aUnitLB. SetSelectHdl( LINK( this, ScTpLayoutOptions, MetricHdl ) ); 457 458 aAlignCB.SetClickHdl(LINK(this, ScTpLayoutOptions, AlignHdl)); 459 460 461 for ( sal_uInt16 i = 0; i < aUnitArr.Count(); ++i ) 462 { 463 String sMetric = aUnitArr.GetStringByPos( i ); 464 FieldUnit eFUnit = (FieldUnit)aUnitArr.GetValue( i ); 465 466 switch ( eFUnit ) 467 { 468 case FUNIT_MM: 469 case FUNIT_CM: 470 case FUNIT_POINT: 471 case FUNIT_PICA: 472 case FUNIT_INCH: 473 { 474 // nur diese Metriken benutzen 475 sal_uInt16 nPos = aUnitLB.InsertEntry( sMetric ); 476 aUnitLB.SetEntryData( nPos, (void*)(long)eFUnit ); 477 } 478 break; 479 default: 480 { 481 // added to avoid warnings 482 } 483 } 484 } 485 486 } 487 /*-----------------11.01.97 10.53------------------- 488 489 --------------------------------------------------*/ 490 491 ScTpLayoutOptions::~ScTpLayoutOptions() 492 { 493 } 494 /*-----------------11.01.97 10.53------------------- 495 496 --------------------------------------------------*/ 497 498 SfxTabPage* ScTpLayoutOptions::Create( Window* pParent, 499 const SfxItemSet& rCoreSet ) 500 { 501 ScTpLayoutOptions* pNew = new ScTpLayoutOptions(pParent, rCoreSet); 502 ScDocShell* pDocSh = PTR_CAST(ScDocShell,SfxObjectShell::Current()); 503 504 if(pDocSh!=NULL) 505 pNew->SetDocument(pDocSh->GetDocument()); 506 return pNew; 507 } 508 /*-----------------11.01.97 10.53------------------- 509 510 --------------------------------------------------*/ 511 512 sal_Bool ScTpLayoutOptions::FillItemSet( SfxItemSet& rCoreSet ) 513 { 514 sal_Bool bRet = sal_True; 515 const sal_uInt16 nMPos = aUnitLB.GetSelectEntryPos(); 516 if ( nMPos != aUnitLB.GetSavedValue() ) 517 { 518 sal_uInt16 nFieldUnit = (sal_uInt16)(long)aUnitLB.GetEntryData( nMPos ); 519 rCoreSet.Put( SfxUInt16Item( SID_ATTR_METRIC, 520 (sal_uInt16)nFieldUnit ) ); 521 bRet = sal_True; 522 } 523 524 if(aTabMF.GetText() != aTabMF.GetSavedValue()) 525 { 526 rCoreSet.Put(SfxUInt16Item(SID_ATTR_DEFTABSTOP, 527 sal::static_int_cast<sal_uInt16>( aTabMF.Denormalize(aTabMF.GetValue(FUNIT_TWIP)) ))); 528 bRet = sal_True; 529 } 530 531 ScLkUpdMode nSet=LM_ALWAYS; 532 533 if(aRequestRB.IsChecked()) 534 { 535 nSet=LM_ON_DEMAND; 536 } 537 else if(aNeverRB.IsChecked()) 538 { 539 nSet=LM_NEVER; 540 } 541 542 if(aRequestRB.IsChecked() != aRequestRB.GetSavedValue() || 543 aNeverRB.IsChecked() != aNeverRB.GetSavedValue() ) 544 { 545 if(pDoc) 546 pDoc->SetLinkMode(nSet); 547 ScAppOptions aAppOptions=SC_MOD()->GetAppOptions(); 548 aAppOptions.SetLinkMode(nSet ); 549 SC_MOD()->SetAppOptions(aAppOptions); 550 bRet = sal_True; 551 } 552 if(aAlignCB.GetSavedValue() != aAlignCB.IsChecked()) 553 { 554 rCoreSet.Put(SfxBoolItem(SID_SC_INPUT_SELECTION, aAlignCB.IsChecked())); 555 bRet = sal_True; 556 } 557 558 if(aAlignLB.GetSavedValue() != aAlignLB.GetSelectEntryPos()) 559 { 560 rCoreSet.Put(SfxUInt16Item(SID_SC_INPUT_SELECTIONPOS, aAlignLB.GetSelectEntryPos())); 561 bRet = sal_True; 562 } 563 564 if(aEditModeCB.GetSavedValue() != aEditModeCB.IsChecked()) 565 { 566 rCoreSet.Put(SfxBoolItem(SID_SC_INPUT_EDITMODE, aEditModeCB.IsChecked())); 567 bRet = sal_True; 568 } 569 570 if(aFormatCB.GetSavedValue() != aFormatCB.IsChecked()) 571 { 572 rCoreSet.Put(SfxBoolItem(SID_SC_INPUT_FMT_EXPAND, aFormatCB.IsChecked())); 573 bRet = sal_True; 574 } 575 576 577 if(aExpRefCB.GetSavedValue() != aExpRefCB.IsChecked()) 578 { 579 rCoreSet.Put(SfxBoolItem(SID_SC_INPUT_REF_EXPAND, aExpRefCB.IsChecked())); 580 bRet = sal_True; 581 } 582 583 if(aMarkHdrCB.GetSavedValue() != aMarkHdrCB.IsChecked()) 584 { 585 rCoreSet.Put(SfxBoolItem(SID_SC_INPUT_MARK_HEADER, aMarkHdrCB.IsChecked())); 586 bRet = sal_True; 587 } 588 589 if(aTextFmtCB.GetSavedValue() != aTextFmtCB.IsChecked()) 590 { 591 rCoreSet.Put(SfxBoolItem(SID_SC_INPUT_TEXTWYSIWYG, aTextFmtCB.IsChecked())); 592 bRet = sal_True; 593 } 594 595 if( aReplWarnCB.GetSavedValue() != aReplWarnCB.IsChecked() ) 596 { 597 rCoreSet.Put( SfxBoolItem( SID_SC_INPUT_REPLCELLSWARN, aReplWarnCB.IsChecked() ) ); 598 bRet = sal_True; 599 } 600 601 return bRet; 602 } 603 /*-----------------11.01.97 10.53------------------- 604 605 --------------------------------------------------*/ 606 607 void ScTpLayoutOptions::Reset( const SfxItemSet& rCoreSet ) 608 { 609 aUnitLB.SetNoSelection(); 610 if ( rCoreSet.GetItemState( SID_ATTR_METRIC ) >= SFX_ITEM_AVAILABLE ) 611 { 612 const SfxUInt16Item& rItem = (SfxUInt16Item&)rCoreSet.Get( SID_ATTR_METRIC ); 613 FieldUnit eFieldUnit = (FieldUnit)rItem.GetValue(); 614 615 for ( sal_uInt16 i = 0; i < aUnitLB.GetEntryCount(); ++i ) 616 { 617 if ( (FieldUnit)(long)aUnitLB.GetEntryData( i ) == eFieldUnit ) 618 { 619 aUnitLB.SelectEntryPos( i ); 620 break; 621 } 622 } 623 ::SetFieldUnit(aTabMF, eFieldUnit); 624 } 625 aUnitLB.SaveValue(); 626 627 const SfxPoolItem* pItem; 628 if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_ATTR_DEFTABSTOP, sal_False, &pItem)) 629 aTabMF.SetValue(aTabMF.Normalize(((SfxUInt16Item*)pItem)->GetValue()), FUNIT_TWIP); 630 aTabMF.SaveValue(); 631 632 aUnitLB .SaveValue(); 633 aTabMF .SaveValue(); 634 635 ScLkUpdMode nSet=LM_UNKNOWN; 636 637 if(pDoc!=NULL) 638 { 639 nSet=pDoc->GetLinkMode(); 640 } 641 642 if(nSet==LM_UNKNOWN) 643 { 644 ScAppOptions aAppOptions=SC_MOD()->GetAppOptions(); 645 nSet=aAppOptions.GetLinkMode(); 646 } 647 648 switch(nSet) 649 { 650 case LM_ALWAYS: aAlwaysRB. Check(); break; 651 case LM_NEVER: aNeverRB. Check(); break; 652 case LM_ON_DEMAND: aRequestRB. Check(); break; 653 default: 654 { 655 // added to avoid warnings 656 } 657 } 658 if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SC_INPUT_SELECTION, sal_False, &pItem)) 659 aAlignCB.Check(((const SfxBoolItem*)pItem)->GetValue()); 660 661 if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SC_INPUT_SELECTIONPOS, sal_False, &pItem)) 662 aAlignLB.SelectEntryPos(((const SfxUInt16Item*)pItem)->GetValue()); 663 664 if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SC_INPUT_EDITMODE, sal_False, &pItem)) 665 aEditModeCB.Check(((const SfxBoolItem*)pItem)->GetValue()); 666 667 if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SC_INPUT_FMT_EXPAND, sal_False, &pItem)) 668 aFormatCB.Check(((const SfxBoolItem*)pItem)->GetValue()); 669 670 671 if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SC_INPUT_REF_EXPAND, sal_False, &pItem)) 672 aExpRefCB.Check(((const SfxBoolItem*)pItem)->GetValue()); 673 674 if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SC_INPUT_MARK_HEADER, sal_False, &pItem)) 675 aMarkHdrCB.Check(((const SfxBoolItem*)pItem)->GetValue()); 676 677 if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SC_INPUT_TEXTWYSIWYG, sal_False, &pItem)) 678 aTextFmtCB.Check(((const SfxBoolItem*)pItem)->GetValue()); 679 680 if( SFX_ITEM_SET == rCoreSet.GetItemState( SID_SC_INPUT_REPLCELLSWARN, sal_False, &pItem ) ) 681 aReplWarnCB.Check( ( (const SfxBoolItem*)pItem)->GetValue() ); 682 683 aAlignCB .SaveValue(); 684 aAlignLB .SaveValue(); 685 aEditModeCB .SaveValue(); 686 aFormatCB .SaveValue(); 687 688 aExpRefCB .SaveValue(); 689 aMarkHdrCB .SaveValue(); 690 aTextFmtCB .SaveValue(); 691 aReplWarnCB .SaveValue(); 692 AlignHdl(&aAlignCB); 693 694 aAlwaysRB.SaveValue(); 695 aNeverRB.SaveValue(); 696 aRequestRB.SaveValue(); 697 } 698 699 /*-----------------11.01.97 12.46------------------- 700 701 --------------------------------------------------*/ 702 703 void ScTpLayoutOptions::ActivatePage( const SfxItemSet& /* rCoreSet */ ) 704 { 705 } 706 /*-----------------11.01.97 12.46------------------- 707 708 --------------------------------------------------*/ 709 710 int ScTpLayoutOptions::DeactivatePage( SfxItemSet* pSetP ) 711 { 712 if(pSetP) 713 FillItemSet(*pSetP); 714 return SfxTabPage::LEAVE_PAGE; 715 } 716 717 718 /*-----------------13.01.97 14.44------------------- 719 Metric des Deftabstops umschalten 720 --------------------------------------------------*/ 721 722 IMPL_LINK(ScTpLayoutOptions, MetricHdl, ListBox*, EMPTYARG) 723 { 724 const sal_uInt16 nMPos = aUnitLB.GetSelectEntryPos(); 725 if(nMPos != USHRT_MAX) 726 { 727 FieldUnit eFieldUnit = (FieldUnit)(long)aUnitLB.GetEntryData( nMPos ); 728 sal_Int64 nVal = 729 aTabMF.Denormalize( aTabMF.GetValue( FUNIT_TWIP ) ); 730 ::SetFieldUnit( aTabMF, eFieldUnit ); 731 aTabMF.SetValue( aTabMF.Normalize( nVal ), FUNIT_TWIP ); 732 } 733 734 return 0; 735 } 736 /*-----------------11.01.97 15.30------------------- 737 738 --------------------------------------------------*/ 739 IMPL_LINK( ScTpLayoutOptions, AlignHdl, CheckBox*, pBox ) 740 { 741 aAlignLB.Enable(pBox->IsChecked()); 742 return 0; 743 } 744 745 746