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