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