Update ooo320-m1
[ooovba.git] / sc / source / ui / optdlg / tpview.cxx
blob5f0e3d75c408049a213081c19eb1a196d201f5b7
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: tpview.cxx,v $
10 * $Revision: 1.20 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sc.hxx"
34 #undef SC_DLLIMPLEMENTATION
38 //------------------------------------------------------------------
40 #include "scitems.hxx"
41 #include "tpview.hxx"
42 #include "global.hxx"
43 #include "viewopti.hxx"
44 #include "tabvwsh.hxx"
45 #include "uiitems.hxx"
46 #include "scresid.hxx"
47 #include "docsh.hxx"
48 #include "sc.hrc" // -> Slot-IDs
49 #include "optdlg.hrc"
50 #include "globstr.hrc"
51 #include <appoptio.hxx>
52 #include <scmod.hxx>
53 #include <svx/dlgutil.hxx>
54 #include <svx/drawitem.hxx>
55 #include <svx/xtable.hxx>
58 // STATIC DATA -----------------------------------------------------------
62 /*-----------------11.01.97 10.52-------------------
63 Optionen Inhalte
64 --------------------------------------------------*/
66 ScTpContentOptions::ScTpContentOptions( Window* pParent,
67 const SfxItemSet& rArgSet ) :
68 SfxTabPage(pParent, ScResId( RID_SCPAGE_CONTENT ), rArgSet),
70 aLinesGB( this, ScResId(GB_LINES )),
71 aGridCB( this, ScResId(CB_GRID )),
72 aColorFT( this, ScResId(FT_COLOR )),
73 aColorLB( this, ScResId(LB_COLOR )),
74 aBreakCB( this, ScResId(CB_PAGEBREAKS )),
75 aGuideLineCB( this, ScResId(CB_GUIDELINE )),
76 aHandleCB( this, ScResId(CB_HANDLES )),
77 aBigHandleCB( this, ScResId(CB_BIGHANDLES )),
79 aSeparator1FL (this, ScResId(FL_SEPARATOR1 )),
80 aDisplayGB( this, ScResId(GB_DISPLAY)),
81 aFormulaCB( this, ScResId(CB_FORMULA)),
82 aNilCB( this, ScResId(CB_NIL )),
83 aAnnotCB( this, ScResId(CB_ANNOT )),
84 aValueCB( this, ScResId(CB_VALUE )),
85 aAnchorCB( this, ScResId(CB_ANCHOR )),
86 aClipMarkCB( this, ScResId(CB_CLIP )),
87 aRangeFindCB( this, ScResId( CB_RFIND )),
89 aObjectGB( this, ScResId(GB_OBJECT )),
90 aObjGrfFT( this, ScResId(FT_OBJGRF )),
91 aObjGrfLB( this, ScResId(LB_OBJGRF )),
92 aDiagramFT( this, ScResId(FT_DIAGRAM)),
93 aDiagramLB( this, ScResId(LB_DIAGRAM)),
94 aDrawFT( this, ScResId(FT_DRAW )),
95 aDrawLB( this, ScResId(LB_DRAW )),
97 aZoomGB( this, ScResId(GB_ZOOM) ),
98 aSyncZoomCB( this, ScResId(CB_SYNCZOOM) ),
100 aSeparator2FL (this, ScResId(FL_SEPARATOR2)),
101 aWindowGB( this, ScResId(GB_WINDOW )),
102 aRowColHeaderCB(this, ScResId(CB_ROWCOLHEADER )),
103 aHScrollCB( this, ScResId(CB_HSCROLL )),
104 aVScrollCB( this, ScResId(CB_VSCROLL )),
105 aTblRegCB( this, ScResId(CB_TBLREG )),
106 aOutlineCB( this, ScResId(CB_OUTLINE )),
107 pLocalOptions(0)
109 FreeResource();
110 aSeparator1FL.SetStyle( aSeparator1FL.GetStyle() | WB_VERT );
111 aSeparator2FL.SetStyle( aSeparator2FL.GetStyle() | WB_VERT );
112 SetExchangeSupport();
113 Link aSelObjHdl(LINK( this, ScTpContentOptions, SelLbObjHdl ) );
114 aObjGrfLB. SetSelectHdl(aSelObjHdl);
115 aDiagramLB. SetSelectHdl(aSelObjHdl);
116 aDrawLB. SetSelectHdl(aSelObjHdl);
118 Link aCBHdl(LINK( this, ScTpContentOptions, CBHdl ) );
119 aFormulaCB .SetClickHdl(aCBHdl);
120 aNilCB .SetClickHdl(aCBHdl);
121 aAnnotCB .SetClickHdl(aCBHdl);
122 aValueCB .SetClickHdl(aCBHdl);
123 aAnchorCB .SetClickHdl(aCBHdl);
124 aClipMarkCB .SetClickHdl(aCBHdl);
126 aVScrollCB .SetClickHdl(aCBHdl);
127 aHScrollCB .SetClickHdl(aCBHdl);
128 aTblRegCB .SetClickHdl(aCBHdl);
129 aOutlineCB .SetClickHdl(aCBHdl);
130 aBreakCB .SetClickHdl(aCBHdl);
131 aGuideLineCB.SetClickHdl(aCBHdl);
132 aHandleCB .SetClickHdl(aCBHdl);
133 aBigHandleCB.SetClickHdl(aCBHdl);
134 aRowColHeaderCB.SetClickHdl(aCBHdl);
136 aGridCB .SetClickHdl( LINK( this, ScTpContentOptions, GridHdl ) );
138 /*-----------------11.01.97 10.52-------------------
140 --------------------------------------------------*/
142 ScTpContentOptions::~ScTpContentOptions()
144 delete pLocalOptions;
146 /*-----------------11.01.97 10.52-------------------
148 --------------------------------------------------*/
150 SfxTabPage* ScTpContentOptions::Create( Window* pParent,
151 const SfxItemSet& rCoreSet )
153 return new ScTpContentOptions(pParent, rCoreSet);
155 /*-----------------11.01.97 10.52-------------------
157 --------------------------------------------------*/
158 BOOL ScTpContentOptions::FillItemSet( SfxItemSet& rCoreSet )
160 BOOL bRet = FALSE;
161 if( aFormulaCB .GetSavedValue() != aFormulaCB .IsChecked() ||
162 aNilCB .GetSavedValue() != aNilCB .IsChecked() ||
163 aAnnotCB .GetSavedValue() != aAnnotCB .IsChecked() ||
164 aValueCB .GetSavedValue() != aValueCB .IsChecked() ||
165 aAnchorCB .GetSavedValue() != aAnchorCB .IsChecked() ||
166 aClipMarkCB .GetSavedValue() != aClipMarkCB .IsChecked() ||
167 aObjGrfLB .GetSavedValue() != aObjGrfLB .GetSelectEntryPos() ||
168 aDiagramLB .GetSavedValue() != aDiagramLB .GetSelectEntryPos() ||
169 aDrawLB .GetSavedValue() != aDrawLB .GetSelectEntryPos() ||
170 aGridCB .GetSavedValue() != aGridCB.IsChecked() ||
171 aRowColHeaderCB .GetSavedValue() != aRowColHeaderCB.IsChecked() ||
172 aHScrollCB .GetSavedValue() != aHScrollCB .IsChecked() ||
173 aVScrollCB .GetSavedValue() != aVScrollCB .IsChecked() ||
174 aTblRegCB .GetSavedValue() != aTblRegCB .IsChecked() ||
175 aOutlineCB .GetSavedValue() != aOutlineCB .IsChecked() ||
176 aColorLB .GetSavedValue() != aColorLB .GetSelectEntryPos() ||
177 aBreakCB .GetSavedValue() != aBreakCB .IsChecked() ||
178 aGuideLineCB .GetSavedValue() != aGuideLineCB .IsChecked() ||
179 aHandleCB .GetSavedValue() != aHandleCB .IsChecked() ||
180 aBigHandleCB .GetSavedValue() != aBigHandleCB .IsChecked())
182 pLocalOptions->SetGridColor( aColorLB.GetSelectEntryColor(),
183 aColorLB.GetSelectEntry() );
184 rCoreSet.Put(ScTpViewItem(SID_SCVIEWOPTIONS, *pLocalOptions));
185 bRet = TRUE;
187 if(aRangeFindCB.GetSavedValue() != aRangeFindCB.IsChecked())
189 rCoreSet.Put(SfxBoolItem(SID_SC_INPUT_RANGEFINDER, aRangeFindCB.IsChecked()));
190 bRet = TRUE;
192 if(aSyncZoomCB.GetSavedValue() != aSyncZoomCB.IsChecked())
194 rCoreSet.Put(SfxBoolItem(SID_SC_OPT_SYNCZOOM, aSyncZoomCB.IsChecked()));
195 bRet = TRUE;
199 return bRet;
201 /*-----------------11.01.97 10.53-------------------
203 --------------------------------------------------*/
205 void ScTpContentOptions::Reset( const SfxItemSet& rCoreSet )
207 const SfxPoolItem* pItem;
208 if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SCVIEWOPTIONS, FALSE , &pItem))
209 pLocalOptions = new ScViewOptions(
210 ((const ScTpViewItem*)pItem)->GetViewOptions() );
211 else
212 pLocalOptions = new ScViewOptions;
213 aFormulaCB .Check(pLocalOptions->GetOption(VOPT_FORMULAS));
214 aNilCB .Check(pLocalOptions->GetOption(VOPT_NULLVALS));
215 aAnnotCB .Check(pLocalOptions->GetOption(VOPT_NOTES));
216 aValueCB .Check(pLocalOptions->GetOption(VOPT_SYNTAX));
217 aAnchorCB .Check(pLocalOptions->GetOption(VOPT_ANCHOR));
218 aClipMarkCB .Check(pLocalOptions->GetOption(VOPT_CLIPMARKS));
220 aObjGrfLB .SelectEntryPos( (USHORT)pLocalOptions->GetObjMode(VOBJ_TYPE_OLE) );
221 aDiagramLB .SelectEntryPos( (USHORT)pLocalOptions->GetObjMode(VOBJ_TYPE_CHART) );
222 aDrawLB .SelectEntryPos( (USHORT)pLocalOptions->GetObjMode(VOBJ_TYPE_DRAW) );
224 aRowColHeaderCB.Check( pLocalOptions->GetOption(VOPT_HEADER) );
225 aHScrollCB .Check( pLocalOptions->GetOption(VOPT_HSCROLL) );
226 aVScrollCB .Check( pLocalOptions->GetOption(VOPT_VSCROLL) );
227 aTblRegCB .Check( pLocalOptions->GetOption(VOPT_TABCONTROLS) );
228 aOutlineCB .Check( pLocalOptions->GetOption(VOPT_OUTLINER) );
230 InitGridOpt();
232 aBreakCB.Check( pLocalOptions->GetOption(VOPT_PAGEBREAKS) );
233 aGuideLineCB.Check( pLocalOptions->GetOption(VOPT_HELPLINES) );
234 aHandleCB.Check( !pLocalOptions->GetOption(VOPT_SOLIDHANDLES) ); // inverted
235 aBigHandleCB.Check( pLocalOptions->GetOption(VOPT_BIGHANDLES) );
237 if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SC_INPUT_RANGEFINDER, FALSE, &pItem))
238 aRangeFindCB.Check(((const SfxBoolItem*)pItem)->GetValue());
239 if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SC_OPT_SYNCZOOM, FALSE, &pItem))
240 aSyncZoomCB.Check(((const SfxBoolItem*)pItem)->GetValue());
242 aRangeFindCB.SaveValue();
243 aSyncZoomCB.SaveValue();
245 aFormulaCB .SaveValue();
246 aNilCB .SaveValue();
247 aAnnotCB .SaveValue();
248 aValueCB .SaveValue();
249 aAnchorCB .SaveValue();
250 aClipMarkCB .SaveValue();
251 aObjGrfLB .SaveValue();
252 aDiagramLB .SaveValue();
253 aDrawLB .SaveValue();
254 aRowColHeaderCB .SaveValue();
255 aHScrollCB .SaveValue();
256 aVScrollCB .SaveValue();
257 aTblRegCB .SaveValue();
258 aOutlineCB .SaveValue();
259 aGridCB .SaveValue();
260 aColorLB .SaveValue();
261 aBreakCB .SaveValue();
262 aGuideLineCB .SaveValue();
263 aHandleCB .SaveValue();
264 aBigHandleCB .SaveValue();
266 /*-----------------11.01.97 12.45-------------------
268 --------------------------------------------------*/
270 void ScTpContentOptions::ActivatePage( const SfxItemSet& rSet)
272 const SfxPoolItem* pItem;
273 if(SFX_ITEM_SET == rSet.GetItemState(SID_SCVIEWOPTIONS, FALSE , &pItem))
274 *pLocalOptions = ((const ScTpViewItem*)pItem)->GetViewOptions();
276 /*-----------------11.01.97 12.45-------------------
278 --------------------------------------------------*/
280 int ScTpContentOptions::DeactivatePage( SfxItemSet* pSetP )
282 if(pSetP)
283 FillItemSet(*pSetP);
284 return SfxTabPage::LEAVE_PAGE;
286 /*-----------------11.01.97 13.43-------------------
288 --------------------------------------------------*/
290 IMPL_LINK( ScTpContentOptions, SelLbObjHdl, ListBox*, pLb )
292 USHORT nSelPos = pLb->GetSelectEntryPos();
293 ScVObjMode eMode = ScVObjMode(nSelPos);
294 ScVObjType eType = VOBJ_TYPE_OLE;
296 if ( pLb == &aDiagramLB )
297 eType = VOBJ_TYPE_CHART;
298 else if ( pLb == &aDrawLB )
299 eType = VOBJ_TYPE_DRAW;
301 pLocalOptions->SetObjMode( eType, eMode );
303 return 0;
306 /*-----------------11.01.97 14.25-------------------
308 --------------------------------------------------*/
310 IMPL_LINK( ScTpContentOptions, CBHdl, CheckBox*, pBtn )
312 ScViewOption eOption = VOPT_FORMULAS;
313 BOOL bChecked = pBtn->IsChecked();
315 if ( &aFormulaCB == pBtn ) eOption = VOPT_FORMULAS;
316 else if ( &aNilCB == pBtn ) eOption = VOPT_NULLVALS;
317 else if ( &aAnnotCB == pBtn ) eOption = VOPT_NOTES;
318 else if ( &aValueCB == pBtn ) eOption = VOPT_SYNTAX;
319 else if ( &aAnchorCB == pBtn ) eOption = VOPT_ANCHOR;
320 else if ( &aClipMarkCB == pBtn ) eOption = VOPT_CLIPMARKS;
321 else if ( &aVScrollCB == pBtn ) eOption = VOPT_VSCROLL;
322 else if ( &aHScrollCB == pBtn ) eOption = VOPT_HSCROLL;
323 else if ( &aTblRegCB == pBtn ) eOption = VOPT_TABCONTROLS;
324 else if ( &aOutlineCB == pBtn ) eOption = VOPT_OUTLINER;
325 else if ( &aBreakCB == pBtn ) eOption = VOPT_PAGEBREAKS;
326 else if ( &aGuideLineCB == pBtn ) eOption = VOPT_HELPLINES;
327 else if ( &aHandleCB == pBtn ) eOption = VOPT_SOLIDHANDLES;
328 else if ( &aBigHandleCB == pBtn ) eOption = VOPT_BIGHANDLES;
329 else if ( &aRowColHeaderCB == pBtn ) eOption = VOPT_HEADER;
331 // VOPT_SOLIDHANDLES is inverted (CheckBox is "simple handles")
332 if ( eOption == VOPT_SOLIDHANDLES )
333 pLocalOptions->SetOption( eOption, !bChecked );
334 else
335 pLocalOptions->SetOption( eOption, bChecked );
338 return 0;
340 /*-----------------11.01.97 13.13-------------------
342 --------------------------------------------------*/
344 void ScTpContentOptions::InitGridOpt()
346 BOOL bGrid = pLocalOptions->GetOption( VOPT_GRID );
348 aGridCB.Check( bGrid );
350 if ( bGrid )
351 aColorFT.Enable(), aColorLB.Enable();
352 else
353 aColorFT.Disable(), aColorLB.Disable();
355 if ( aColorLB.GetEntryCount() == 0 )
357 SfxObjectShell* pDocSh = SfxObjectShell::Current();
358 // hier koennte auch eine andere DocShell kommen!
359 pDocSh = PTR_CAST(ScDocShell, pDocSh);
361 XColorTable* pColorTable = NULL;
363 if ( pDocSh )
365 const SfxPoolItem* pItem = pDocSh->GetItem( SID_COLOR_TABLE );
367 if ( pItem )
368 pColorTable = ((SvxColorTableItem*)pItem)->GetColorTable();
370 else
371 pColorTable = XColorTable::GetStdColorTable();
373 if ( !pColorTable )
374 return;
376 //------------------------------------------------------
378 aColorLB.SetUpdateMode( FALSE );
380 // Eintraege aus der Colortable
382 long nCount = pColorTable->Count();
383 for ( long n=0; n<nCount; n++ )
385 XColorEntry* pEntry = pColorTable->GetColor(n);
386 aColorLB.InsertEntry( pEntry->GetColor(), pEntry->GetName() );
389 // Standard-Gitterfarbe
391 Color aStdCol( SC_STD_GRIDCOLOR ); // wie Default in ScViewOptions
392 if ( LISTBOX_ENTRY_NOTFOUND ==
393 aColorLB.GetEntryPos( aStdCol ) )
394 aColorLB.InsertEntry( aStdCol, ScGlobal::GetRscString( STR_GRIDCOLOR ) );
396 aColorLB.SetUpdateMode( TRUE );
398 Invalidate();
401 // #79720# also select grid color entry on subsequent calls
403 String aName;
404 Color aCol = pLocalOptions->GetGridColor( &aName );
405 USHORT nSelPos = aColorLB.GetEntryPos( aCol );
407 if ( LISTBOX_ENTRY_NOTFOUND != nSelPos )
408 aColorLB.SelectEntryPos( nSelPos );
409 else
410 aColorLB.SelectEntryPos( aColorLB.InsertEntry( aCol, aName ) );
412 /*-----------------11.01.97 13.40-------------------
414 --------------------------------------------------*/
416 IMPL_LINK( ScTpContentOptions, GridHdl, CheckBox*, pBox )
418 BOOL bChecked = pBox->IsChecked();
419 aColorFT.Enable(bChecked);
420 aColorLB.Enable(bChecked);
421 pLocalOptions->SetOption( VOPT_GRID, bChecked );
422 return 0;
424 /*-----------------11.01.97 10.53-------------------
426 --------------------------------------------------*/
428 ScTpLayoutOptions::ScTpLayoutOptions( Window* pParent,
429 const SfxItemSet& rArgSet ) :
430 SfxTabPage(pParent, ScResId( RID_SCPAGE_LAYOUT ), rArgSet),
431 aUnitGB( this, ScResId(GB_UNIT )),
432 aUnitFT( this, ScResId(FT_UNIT )),
433 aUnitLB( this, ScResId(LB_UNIT )),
434 aTabFT( this, ScResId( FT_TAB )),
435 aTabMF( this, ScResId( MF_TAB )),
436 aSeparatorFL( this, ScResId( FL_SEPARATOR )),
437 aLinkGB (this, ScResId(GB_LINK )),
438 aLinkFT(this, ScResId(FT_UPDATE_LINKS )),
439 aAlwaysRB (this, ScResId(RB_ALWAYS )),
440 aRequestRB (this, ScResId(RB_REQUEST )),
441 aNeverRB (this, ScResId(RB_NEVER )),
443 aOptionsGB( this, ScResId( GB_OPTIONS )),
444 aAlignCB ( this, ScResId( CB_ALIGN )),
445 aAlignLB ( this, ScResId( LB_ALIGN )),
446 aEditModeCB( this, ScResId( CB_EDITMODE )),
447 aFormatCB( this, ScResId( CB_FORMAT )),
448 aExpRefCB( this, ScResId( CB_EXPREF )),
449 aMarkHdrCB( this, ScResId( CB_MARKHDR )),
450 aTextFmtCB( this, ScResId( CB_TEXTFMT )),
451 aReplWarnCB( this, ScResId( CB_REPLWARN )),
452 aUnitArr( ScResId(ST_UNIT )),
453 pDoc(NULL)
455 FreeResource();
456 aSeparatorFL.SetStyle( aSeparatorFL.GetStyle() | WB_VERT );
457 SetExchangeSupport();
459 aUnitLB. SetSelectHdl( LINK( this, ScTpLayoutOptions, MetricHdl ) );
461 aAlignCB.SetClickHdl(LINK(this, ScTpLayoutOptions, AlignHdl));
464 for ( USHORT i = 0; i < aUnitArr.Count(); ++i )
466 String sMetric = aUnitArr.GetStringByPos( i );
467 FieldUnit eFUnit = (FieldUnit)aUnitArr.GetValue( i );
469 switch ( eFUnit )
471 case FUNIT_MM:
472 case FUNIT_CM:
473 case FUNIT_POINT:
474 case FUNIT_PICA:
475 case FUNIT_INCH:
477 // nur diese Metriken benutzen
478 USHORT nPos = aUnitLB.InsertEntry( sMetric );
479 aUnitLB.SetEntryData( nPos, (void*)(long)eFUnit );
481 break;
482 default:
484 // added to avoid warnings
490 /*-----------------11.01.97 10.53-------------------
492 --------------------------------------------------*/
494 ScTpLayoutOptions::~ScTpLayoutOptions()
497 /*-----------------11.01.97 10.53-------------------
499 --------------------------------------------------*/
501 SfxTabPage* ScTpLayoutOptions::Create( Window* pParent,
502 const SfxItemSet& rCoreSet )
504 ScTpLayoutOptions* pNew = new ScTpLayoutOptions(pParent, rCoreSet);
505 ScDocShell* pDocSh = PTR_CAST(ScDocShell,SfxObjectShell::Current());
507 if(pDocSh!=NULL)
508 pNew->SetDocument(pDocSh->GetDocument());
509 return pNew;
511 /*-----------------11.01.97 10.53-------------------
513 --------------------------------------------------*/
515 BOOL ScTpLayoutOptions::FillItemSet( SfxItemSet& rCoreSet )
517 BOOL bRet = TRUE;
518 const USHORT nMPos = aUnitLB.GetSelectEntryPos();
519 if ( nMPos != aUnitLB.GetSavedValue() )
521 USHORT nFieldUnit = (USHORT)(long)aUnitLB.GetEntryData( nMPos );
522 rCoreSet.Put( SfxUInt16Item( SID_ATTR_METRIC,
523 (UINT16)nFieldUnit ) );
524 bRet = TRUE;
527 if(aTabMF.GetText() != aTabMF.GetSavedValue())
529 rCoreSet.Put(SfxUInt16Item(SID_ATTR_DEFTABSTOP,
530 sal::static_int_cast<UINT16>( aTabMF.Denormalize(aTabMF.GetValue(FUNIT_TWIP)) )));
531 bRet = TRUE;
534 ScLkUpdMode nSet=LM_ALWAYS;
536 if(aRequestRB.IsChecked())
538 nSet=LM_ON_DEMAND;
540 else if(aNeverRB.IsChecked())
542 nSet=LM_NEVER;
545 if(aRequestRB.IsChecked() != aRequestRB.GetSavedValue() ||
546 aNeverRB.IsChecked() != aNeverRB.GetSavedValue() )
548 if(pDoc)
549 pDoc->SetLinkMode(nSet);
550 ScAppOptions aAppOptions=SC_MOD()->GetAppOptions();
551 aAppOptions.SetLinkMode(nSet );
552 SC_MOD()->SetAppOptions(aAppOptions);
553 bRet = TRUE;
555 if(aAlignCB.GetSavedValue() != aAlignCB.IsChecked())
557 rCoreSet.Put(SfxBoolItem(SID_SC_INPUT_SELECTION, aAlignCB.IsChecked()));
558 bRet = TRUE;
561 if(aAlignLB.GetSavedValue() != aAlignLB.GetSelectEntryPos())
563 rCoreSet.Put(SfxUInt16Item(SID_SC_INPUT_SELECTIONPOS, aAlignLB.GetSelectEntryPos()));
564 bRet = TRUE;
567 if(aEditModeCB.GetSavedValue() != aEditModeCB.IsChecked())
569 rCoreSet.Put(SfxBoolItem(SID_SC_INPUT_EDITMODE, aEditModeCB.IsChecked()));
570 bRet = TRUE;
573 if(aFormatCB.GetSavedValue() != aFormatCB.IsChecked())
575 rCoreSet.Put(SfxBoolItem(SID_SC_INPUT_FMT_EXPAND, aFormatCB.IsChecked()));
576 bRet = TRUE;
580 if(aExpRefCB.GetSavedValue() != aExpRefCB.IsChecked())
582 rCoreSet.Put(SfxBoolItem(SID_SC_INPUT_REF_EXPAND, aExpRefCB.IsChecked()));
583 bRet = TRUE;
586 if(aMarkHdrCB.GetSavedValue() != aMarkHdrCB.IsChecked())
588 rCoreSet.Put(SfxBoolItem(SID_SC_INPUT_MARK_HEADER, aMarkHdrCB.IsChecked()));
589 bRet = TRUE;
592 if(aTextFmtCB.GetSavedValue() != aTextFmtCB.IsChecked())
594 rCoreSet.Put(SfxBoolItem(SID_SC_INPUT_TEXTWYSIWYG, aTextFmtCB.IsChecked()));
595 bRet = TRUE;
598 if( aReplWarnCB.GetSavedValue() != aReplWarnCB.IsChecked() )
600 rCoreSet.Put( SfxBoolItem( SID_SC_INPUT_REPLCELLSWARN, aReplWarnCB.IsChecked() ) );
601 bRet = TRUE;
604 return bRet;
606 /*-----------------11.01.97 10.53-------------------
608 --------------------------------------------------*/
610 void ScTpLayoutOptions::Reset( const SfxItemSet& rCoreSet )
612 aUnitLB.SetNoSelection();
613 if ( rCoreSet.GetItemState( SID_ATTR_METRIC ) >= SFX_ITEM_AVAILABLE )
615 const SfxUInt16Item& rItem = (SfxUInt16Item&)rCoreSet.Get( SID_ATTR_METRIC );
616 FieldUnit eFieldUnit = (FieldUnit)rItem.GetValue();
618 for ( USHORT i = 0; i < aUnitLB.GetEntryCount(); ++i )
620 if ( (FieldUnit)(long)aUnitLB.GetEntryData( i ) == eFieldUnit )
622 aUnitLB.SelectEntryPos( i );
623 break;
626 ::SetFieldUnit(aTabMF, eFieldUnit);
628 aUnitLB.SaveValue();
630 const SfxPoolItem* pItem;
631 if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_ATTR_DEFTABSTOP, FALSE, &pItem))
632 aTabMF.SetValue(aTabMF.Normalize(((SfxUInt16Item*)pItem)->GetValue()), FUNIT_TWIP);
633 aTabMF.SaveValue();
635 aUnitLB .SaveValue();
636 aTabMF .SaveValue();
638 ScLkUpdMode nSet=LM_UNKNOWN;
640 if(pDoc!=NULL)
642 nSet=pDoc->GetLinkMode();
645 if(nSet==LM_UNKNOWN)
647 ScAppOptions aAppOptions=SC_MOD()->GetAppOptions();
648 nSet=aAppOptions.GetLinkMode();
651 switch(nSet)
653 case LM_ALWAYS: aAlwaysRB. Check(); break;
654 case LM_NEVER: aNeverRB. Check(); break;
655 case LM_ON_DEMAND: aRequestRB. Check(); break;
656 default:
658 // added to avoid warnings
661 if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SC_INPUT_SELECTION, FALSE, &pItem))
662 aAlignCB.Check(((const SfxBoolItem*)pItem)->GetValue());
664 if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SC_INPUT_SELECTIONPOS, FALSE, &pItem))
665 aAlignLB.SelectEntryPos(((const SfxUInt16Item*)pItem)->GetValue());
667 if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SC_INPUT_EDITMODE, FALSE, &pItem))
668 aEditModeCB.Check(((const SfxBoolItem*)pItem)->GetValue());
670 if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SC_INPUT_FMT_EXPAND, FALSE, &pItem))
671 aFormatCB.Check(((const SfxBoolItem*)pItem)->GetValue());
674 if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SC_INPUT_REF_EXPAND, FALSE, &pItem))
675 aExpRefCB.Check(((const SfxBoolItem*)pItem)->GetValue());
677 if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SC_INPUT_MARK_HEADER, FALSE, &pItem))
678 aMarkHdrCB.Check(((const SfxBoolItem*)pItem)->GetValue());
680 if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SC_INPUT_TEXTWYSIWYG, FALSE, &pItem))
681 aTextFmtCB.Check(((const SfxBoolItem*)pItem)->GetValue());
683 if( SFX_ITEM_SET == rCoreSet.GetItemState( SID_SC_INPUT_REPLCELLSWARN, FALSE, &pItem ) )
684 aReplWarnCB.Check( ( (const SfxBoolItem*)pItem)->GetValue() );
686 aAlignCB .SaveValue();
687 aAlignLB .SaveValue();
688 aEditModeCB .SaveValue();
689 aFormatCB .SaveValue();
691 aExpRefCB .SaveValue();
692 aMarkHdrCB .SaveValue();
693 aTextFmtCB .SaveValue();
694 aReplWarnCB .SaveValue();
695 AlignHdl(&aAlignCB);
697 aAlwaysRB.SaveValue();
698 aNeverRB.SaveValue();
699 aRequestRB.SaveValue();
702 /*-----------------11.01.97 12.46-------------------
704 --------------------------------------------------*/
706 void ScTpLayoutOptions::ActivatePage( const SfxItemSet& /* rCoreSet */ )
709 /*-----------------11.01.97 12.46-------------------
711 --------------------------------------------------*/
713 int ScTpLayoutOptions::DeactivatePage( SfxItemSet* pSetP )
715 if(pSetP)
716 FillItemSet(*pSetP);
717 return SfxTabPage::LEAVE_PAGE;
721 /*-----------------13.01.97 14.44-------------------
722 Metric des Deftabstops umschalten
723 --------------------------------------------------*/
725 IMPL_LINK(ScTpLayoutOptions, MetricHdl, ListBox*, EMPTYARG)
727 const USHORT nMPos = aUnitLB.GetSelectEntryPos();
728 if(nMPos != USHRT_MAX)
730 FieldUnit eFieldUnit = (FieldUnit)(long)aUnitLB.GetEntryData( nMPos );
731 sal_Int64 nVal =
732 aTabMF.Denormalize( aTabMF.GetValue( FUNIT_TWIP ) );
733 ::SetFieldUnit( aTabMF, eFieldUnit );
734 aTabMF.SetValue( aTabMF.Normalize( nVal ), FUNIT_TWIP );
737 return 0;
739 /*-----------------11.01.97 15.30-------------------
741 --------------------------------------------------*/
742 IMPL_LINK( ScTpLayoutOptions, AlignHdl, CheckBox*, pBox )
744 aAlignLB.Enable(pBox->IsChecked());
745 return 0;