1*b3f79822SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*b3f79822SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*b3f79822SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*b3f79822SAndrew Rist * distributed with this work for additional information
6*b3f79822SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*b3f79822SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*b3f79822SAndrew Rist * "License"); you may not use this file except in compliance
9*b3f79822SAndrew Rist * with the License. You may obtain a copy of the License at
10*b3f79822SAndrew Rist *
11*b3f79822SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*b3f79822SAndrew Rist *
13*b3f79822SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*b3f79822SAndrew Rist * software distributed under the License is distributed on an
15*b3f79822SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b3f79822SAndrew Rist * KIND, either express or implied. See the License for the
17*b3f79822SAndrew Rist * specific language governing permissions and limitations
18*b3f79822SAndrew Rist * under the License.
19*b3f79822SAndrew Rist *
20*b3f79822SAndrew Rist *************************************************************/
21*b3f79822SAndrew Rist
22*b3f79822SAndrew 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
35cdf0e10cSrcweir #include "tptable.hxx"
36cdf0e10cSrcweir #include "global.hxx"
37cdf0e10cSrcweir #include "attrib.hxx"
38cdf0e10cSrcweir #include "scresid.hxx"
39cdf0e10cSrcweir #include "sc.hrc"
40cdf0e10cSrcweir #include "pagedlg.hrc"
41cdf0e10cSrcweir
42cdf0e10cSrcweir // =======================================================================
43cdf0e10cSrcweir
Modify()44cdf0e10cSrcweir void EmptyNumericField::Modify()
45cdf0e10cSrcweir {
46cdf0e10cSrcweir if( GetText().Len() )
47cdf0e10cSrcweir NumericField::Modify();
48cdf0e10cSrcweir else
49cdf0e10cSrcweir SetEmptyFieldValue();
50cdf0e10cSrcweir }
51cdf0e10cSrcweir
SetValue(sal_Int64 nValue)52cdf0e10cSrcweir void EmptyNumericField::SetValue( sal_Int64 nValue )
53cdf0e10cSrcweir {
54cdf0e10cSrcweir if( nValue == 0 )
55cdf0e10cSrcweir SetEmptyFieldValue();
56cdf0e10cSrcweir else
57cdf0e10cSrcweir NumericField::SetValue( nValue );
58cdf0e10cSrcweir }
59cdf0e10cSrcweir
GetValue() const60cdf0e10cSrcweir sal_Int64 EmptyNumericField::GetValue() const
61cdf0e10cSrcweir {
62cdf0e10cSrcweir return IsEmptyFieldValue() ? 0 : NumericField::GetValue();
63cdf0e10cSrcweir }
64cdf0e10cSrcweir
65cdf0e10cSrcweir // =======================================================================
66cdf0e10cSrcweir
67cdf0e10cSrcweir // STATIC DATA -----------------------------------------------------------
68cdf0e10cSrcweir
69cdf0e10cSrcweir static sal_uInt16 pPageTableRanges[] =
70cdf0e10cSrcweir {
71cdf0e10cSrcweir ATTR_PAGE_NOTES, ATTR_PAGE_FIRSTPAGENO,
72cdf0e10cSrcweir 0
73cdf0e10cSrcweir };
74cdf0e10cSrcweir
75cdf0e10cSrcweir sal_Bool lcl_PutVObjModeItem( sal_uInt16 nWhich,
76cdf0e10cSrcweir SfxItemSet& rCoreSet,
77cdf0e10cSrcweir const SfxItemSet& rOldSet,
78cdf0e10cSrcweir const CheckBox& rBtn );
79cdf0e10cSrcweir
80cdf0e10cSrcweir sal_Bool lcl_PutScaleItem( sal_uInt16 nWhich,
81cdf0e10cSrcweir SfxItemSet& rCoreSet,
82cdf0e10cSrcweir const SfxItemSet& rOldSet,
83cdf0e10cSrcweir const ListBox& rListBox,
84cdf0e10cSrcweir sal_uInt16 nLBEntry,
85cdf0e10cSrcweir const SpinField& rEd,
86cdf0e10cSrcweir sal_uInt16 nValue );
87cdf0e10cSrcweir
88cdf0e10cSrcweir sal_Bool lcl_PutScaleItem2( sal_uInt16 nWhich,
89cdf0e10cSrcweir SfxItemSet& rCoreSet,
90cdf0e10cSrcweir const SfxItemSet& rOldSet,
91cdf0e10cSrcweir const ListBox& rListBox,
92cdf0e10cSrcweir sal_uInt16 nLBEntry,
93cdf0e10cSrcweir const NumericField& rEd1,
94cdf0e10cSrcweir const NumericField& rEd2 );
95cdf0e10cSrcweir
96cdf0e10cSrcweir sal_Bool lcl_PutBoolItem( sal_uInt16 nWhich,
97cdf0e10cSrcweir SfxItemSet& rCoreSet,
98cdf0e10cSrcweir const SfxItemSet& rOldSet,
99cdf0e10cSrcweir sal_Bool bIsChecked,
100cdf0e10cSrcweir sal_Bool bSavedValue );
101cdf0e10cSrcweir
102cdf0e10cSrcweir //------------------------------------------------------------------------
103cdf0e10cSrcweir
104cdf0e10cSrcweir #define PAGENO_HDL LINK(this,ScTablePage,PageNoHdl)
105cdf0e10cSrcweir #define PAGEDIR_HDL LINK(this,ScTablePage,PageDirHdl)
106cdf0e10cSrcweir #define SCALE_HDL LINK(this,ScTablePage,ScaleHdl)
107cdf0e10cSrcweir
108cdf0e10cSrcweir #define WAS_DEFAULT(w,s) (SFX_ITEM_DEFAULT==(s).GetItemState((w),sal_True))
109cdf0e10cSrcweir #define GET_BOOL(sid,set) ((const SfxBoolItem&)((set).Get(GetWhich((sid))))).GetValue()
110cdf0e10cSrcweir #define GET_USHORT(sid,set) (sal_uInt16)((const SfxUInt16Item&)((set).Get(GetWhich((sid))))).GetValue()
111cdf0e10cSrcweir #define GET_SHOW(sid,set) ( ScVObjMode( ((const ScViewObjectModeItem&)((set).Get(GetWhich((sid))))).GetValue() ) \
112cdf0e10cSrcweir == VOBJ_MODE_SHOW )
113cdf0e10cSrcweir
114cdf0e10cSrcweir //========================================================================
115cdf0e10cSrcweir
ScTablePage(Window * pParent,const SfxItemSet & rCoreAttrs)116cdf0e10cSrcweir ScTablePage::ScTablePage( Window* pParent, const SfxItemSet& rCoreAttrs ) :
117cdf0e10cSrcweir
118cdf0e10cSrcweir SfxTabPage( pParent, ScResId( RID_SCPAGE_TABLE ), rCoreAttrs ),
119cdf0e10cSrcweir
120cdf0e10cSrcweir aFlPageDir ( this, ScResId( FL_PAGEDIR ) ),
121cdf0e10cSrcweir aBtnTopDown ( this, ScResId( BTN_TOPDOWN ) ),
122cdf0e10cSrcweir aBtnLeftRight ( this, ScResId( BTN_LEFTRIGHT ) ),
123cdf0e10cSrcweir aBmpPageDir ( this, ScResId( BMP_PAGEDIR ) ),
124cdf0e10cSrcweir aImgLeftRight ( ScResId( IMG_LEFTRIGHT ) ),
125cdf0e10cSrcweir aImgTopDown ( ScResId( IMG_TOPDOWN ) ),
126cdf0e10cSrcweir aImgLeftRightHC ( ScResId( IMG_LEFTRIGHT_H ) ),
127cdf0e10cSrcweir aImgTopDownHC ( ScResId( IMG_TOPDOWN_H ) ),
128cdf0e10cSrcweir aBtnPageNo ( this, ScResId( BTN_PAGENO ) ),
129cdf0e10cSrcweir aEdPageNo ( this, ScResId( ED_PAGENO ) ),
130cdf0e10cSrcweir aFlPrint ( this, ScResId( FL_PRINT ) ),
131cdf0e10cSrcweir aBtnHeaders ( this, ScResId( BTN_HEADER ) ),
132cdf0e10cSrcweir aBtnGrid ( this, ScResId( BTN_GRID ) ),
133cdf0e10cSrcweir aBtnNotes ( this, ScResId( BTN_NOTES ) ),
134cdf0e10cSrcweir aBtnObjects ( this, ScResId( BTN_OBJECTS ) ),
135cdf0e10cSrcweir aBtnCharts ( this, ScResId( BTN_CHARTS ) ),
136cdf0e10cSrcweir aBtnDrawings ( this, ScResId( BTN_DRAWINGS ) ),
137cdf0e10cSrcweir aBtnFormulas ( this, ScResId( BTN_FORMULAS ) ),
138cdf0e10cSrcweir aBtnNullVals ( this, ScResId( BTN_NULLVALS ) ),
139cdf0e10cSrcweir aFlScale ( this, ScResId( FL_SCALE ) ),
140cdf0e10cSrcweir aFtScaleMode ( this, ScResId( FT_SCALEMODE ) ),
141cdf0e10cSrcweir aLbScaleMode ( this, ScResId( LB_SCALEMODE ) ),
142cdf0e10cSrcweir aFtScaleAll ( this, ScResId( FT_SCALEFACTOR ) ),
143cdf0e10cSrcweir aEdScaleAll ( this, ScResId( ED_SCALEALL ) ),
144cdf0e10cSrcweir aFtScalePageWidth ( this, ScResId( FT_SCALEPAGEWIDTH ) ),
145cdf0e10cSrcweir aEdScalePageWidth ( this, ScResId( ED_SCALEPAGEWIDTH ) ),
146cdf0e10cSrcweir aFtScalePageHeight ( this, ScResId( FT_SCALEPAGEHEIGHT ) ),
147cdf0e10cSrcweir aEdScalePageHeight ( this, ScResId( ED_SCALEPAGEHEIGHT ) ),
148cdf0e10cSrcweir aFtScalePageNum ( this, ScResId( FT_SCALEPAGENUM ) ),
149cdf0e10cSrcweir aEdScalePageNum ( this, ScResId( ED_SCALEPAGENUM ) )
150cdf0e10cSrcweir {
151cdf0e10cSrcweir SetExchangeSupport();
152cdf0e10cSrcweir aBtnPageNo.SetClickHdl( PAGENO_HDL );
153cdf0e10cSrcweir aBtnTopDown.SetClickHdl( PAGEDIR_HDL );
154cdf0e10cSrcweir aBtnLeftRight.SetClickHdl( PAGEDIR_HDL );
155cdf0e10cSrcweir aLbScaleMode.SetSelectHdl( SCALE_HDL );
156cdf0e10cSrcweir
157cdf0e10cSrcweir Size aBmpSize = Image( ScResId( IMG_LEFTRIGHT ) ).GetSizePixel();
158cdf0e10cSrcweir aBmpPageDir.SetOutputSizePixel( aBmpSize );
159cdf0e10cSrcweir
160cdf0e10cSrcweir FreeResource();
161cdf0e10cSrcweir
162cdf0e10cSrcweir aEdPageNo.SetAccessibleName(aBtnPageNo.GetText());
163cdf0e10cSrcweir aEdPageNo.SetAccessibleRelationLabeledBy(&aBtnPageNo);
164cdf0e10cSrcweir }
165cdf0e10cSrcweir
166cdf0e10cSrcweir // -----------------------------------------------------------------------
167cdf0e10cSrcweir
ShowImage()168cdf0e10cSrcweir void ScTablePage::ShowImage()
169cdf0e10cSrcweir {
170cdf0e10cSrcweir bool bHC = GetSettings().GetStyleSettings().GetHighContrastMode();
171cdf0e10cSrcweir bool bLeftRight = aBtnLeftRight.IsChecked();
172cdf0e10cSrcweir aBmpPageDir.SetImage( bHC ?
173cdf0e10cSrcweir (bLeftRight ? aImgLeftRightHC : aImgTopDownHC) :
174cdf0e10cSrcweir (bLeftRight ? aImgLeftRight : aImgTopDown) );
175cdf0e10cSrcweir }
176cdf0e10cSrcweir
177cdf0e10cSrcweir // -----------------------------------------------------------------------
178cdf0e10cSrcweir
~ScTablePage()179cdf0e10cSrcweir ScTablePage::~ScTablePage()
180cdf0e10cSrcweir {
181cdf0e10cSrcweir }
182cdf0e10cSrcweir
183cdf0e10cSrcweir //------------------------------------------------------------------------
184cdf0e10cSrcweir
GetRanges()185cdf0e10cSrcweir sal_uInt16* ScTablePage::GetRanges()
186cdf0e10cSrcweir {
187cdf0e10cSrcweir return pPageTableRanges;
188cdf0e10cSrcweir }
189cdf0e10cSrcweir
190cdf0e10cSrcweir // -----------------------------------------------------------------------
191cdf0e10cSrcweir
Create(Window * pParent,const SfxItemSet & rCoreSet)192cdf0e10cSrcweir SfxTabPage* ScTablePage::Create( Window* pParent, const SfxItemSet& rCoreSet )
193cdf0e10cSrcweir {
194cdf0e10cSrcweir return ( new ScTablePage( pParent, rCoreSet ) );
195cdf0e10cSrcweir }
196cdf0e10cSrcweir
197cdf0e10cSrcweir // -----------------------------------------------------------------------
198cdf0e10cSrcweir
Reset(const SfxItemSet & rCoreSet)199cdf0e10cSrcweir void ScTablePage::Reset( const SfxItemSet& rCoreSet )
200cdf0e10cSrcweir {
201cdf0e10cSrcweir sal_Bool bTopDown = GET_BOOL( SID_SCATTR_PAGE_TOPDOWN, rCoreSet );
202cdf0e10cSrcweir sal_uInt16 nWhich = 0;
203cdf0e10cSrcweir
204cdf0e10cSrcweir //-----------
205cdf0e10cSrcweir // sal_Bool-Flags
206cdf0e10cSrcweir //-----------
207cdf0e10cSrcweir aBtnNotes .Check( GET_BOOL(SID_SCATTR_PAGE_NOTES,rCoreSet) );
208cdf0e10cSrcweir aBtnGrid .Check( GET_BOOL(SID_SCATTR_PAGE_GRID,rCoreSet) );
209cdf0e10cSrcweir aBtnHeaders .Check( GET_BOOL(SID_SCATTR_PAGE_HEADERS,rCoreSet) );
210cdf0e10cSrcweir aBtnFormulas .Check( GET_BOOL(SID_SCATTR_PAGE_FORMULAS,rCoreSet) );
211cdf0e10cSrcweir aBtnNullVals .Check( GET_BOOL(SID_SCATTR_PAGE_NULLVALS,rCoreSet) );
212cdf0e10cSrcweir aBtnTopDown .Check( bTopDown );
213cdf0e10cSrcweir aBtnLeftRight .Check( !bTopDown );
214cdf0e10cSrcweir
215cdf0e10cSrcweir //------------------
216cdf0e10cSrcweir // Erste Druckseite:
217cdf0e10cSrcweir //------------------
218cdf0e10cSrcweir sal_uInt16 nPage = GET_USHORT(SID_SCATTR_PAGE_FIRSTPAGENO,rCoreSet);
219cdf0e10cSrcweir aBtnPageNo.Check( nPage != 0 );
220cdf0e10cSrcweir aEdPageNo.SetValue( (nPage != 0) ? nPage : 1 );
221cdf0e10cSrcweir PageNoHdl( NULL );
222cdf0e10cSrcweir
223cdf0e10cSrcweir //-------------------
224cdf0e10cSrcweir // Objektdarstellung:
225cdf0e10cSrcweir //-------------------
226cdf0e10cSrcweir aBtnCharts .Check( GET_SHOW( SID_SCATTR_PAGE_CHARTS, rCoreSet ) );
227cdf0e10cSrcweir aBtnObjects .Check( GET_SHOW( SID_SCATTR_PAGE_OBJECTS, rCoreSet ) );
228cdf0e10cSrcweir aBtnDrawings .Check( GET_SHOW( SID_SCATTR_PAGE_DRAWINGS, rCoreSet ) );
229cdf0e10cSrcweir
230cdf0e10cSrcweir //------------
231cdf0e10cSrcweir // Skalierung:
232cdf0e10cSrcweir //------------
233cdf0e10cSrcweir
234cdf0e10cSrcweir nWhich = GetWhich(SID_SCATTR_PAGE_SCALE);
235cdf0e10cSrcweir if ( rCoreSet.GetItemState( nWhich, sal_True ) >= SFX_ITEM_AVAILABLE )
236cdf0e10cSrcweir {
237cdf0e10cSrcweir sal_uInt16 nScale = ((const SfxUInt16Item&)rCoreSet.Get(nWhich)).GetValue();
238cdf0e10cSrcweir if( nScale > 0 )
239cdf0e10cSrcweir aLbScaleMode.SelectEntryPos( SC_TPTABLE_SCALE_PERCENT );
240cdf0e10cSrcweir aEdScaleAll.SetValue( (nScale > 0) ? nScale : 100 );
241cdf0e10cSrcweir }
242cdf0e10cSrcweir
243cdf0e10cSrcweir nWhich = GetWhich(SID_SCATTR_PAGE_SCALETO);
244cdf0e10cSrcweir if ( rCoreSet.GetItemState( nWhich, sal_True ) >= SFX_ITEM_AVAILABLE )
245cdf0e10cSrcweir {
246cdf0e10cSrcweir const ScPageScaleToItem& rItem = static_cast< const ScPageScaleToItem& >( rCoreSet.Get( nWhich ) );
247cdf0e10cSrcweir sal_uInt16 nWidth = rItem.GetWidth();
248cdf0e10cSrcweir sal_uInt16 nHeight = rItem.GetHeight();
249cdf0e10cSrcweir
250cdf0e10cSrcweir /* width==0 and height==0 is invalid state, used as "not selected".
251cdf0e10cSrcweir Dialog shows width=height=1 then. */
252cdf0e10cSrcweir bool bValid = nWidth || nHeight;
253cdf0e10cSrcweir if( bValid )
254cdf0e10cSrcweir aLbScaleMode.SelectEntryPos( SC_TPTABLE_SCALE_TO );
255cdf0e10cSrcweir aEdScalePageWidth.SetValue( bValid ? nWidth : 1 );
256cdf0e10cSrcweir aEdScalePageHeight.SetValue( bValid ? nHeight : 1 );
257cdf0e10cSrcweir }
258cdf0e10cSrcweir
259cdf0e10cSrcweir nWhich = GetWhich(SID_SCATTR_PAGE_SCALETOPAGES);
260cdf0e10cSrcweir if ( rCoreSet.GetItemState( nWhich, sal_True ) >= SFX_ITEM_AVAILABLE )
261cdf0e10cSrcweir {
262cdf0e10cSrcweir sal_uInt16 nPages = ((const SfxUInt16Item&)rCoreSet.Get(nWhich)).GetValue();
263cdf0e10cSrcweir if( nPages > 0 )
264cdf0e10cSrcweir aLbScaleMode.SelectEntryPos( SC_TPTABLE_SCALE_TO_PAGES );
265cdf0e10cSrcweir aEdScalePageNum.SetValue( (nPages > 0) ? nPages : 1 );
266cdf0e10cSrcweir }
267cdf0e10cSrcweir
268cdf0e10cSrcweir if( aLbScaleMode.GetSelectEntryCount() == 0 )
269cdf0e10cSrcweir {
270cdf0e10cSrcweir // fall back to 100%
271cdf0e10cSrcweir DBG_ERRORFILE( "ScTablePage::Reset - missing scaling item" );
272cdf0e10cSrcweir aLbScaleMode.SelectEntryPos( SC_TPTABLE_SCALE_PERCENT );
273cdf0e10cSrcweir aEdScaleAll.SetValue( 100 );
274cdf0e10cSrcweir }
275cdf0e10cSrcweir
276cdf0e10cSrcweir PageDirHdl( NULL );
277cdf0e10cSrcweir ScaleHdl( NULL );
278cdf0e10cSrcweir
279cdf0e10cSrcweir // merken fuer FillItemSet
280cdf0e10cSrcweir aBtnFormulas .SaveValue();
281cdf0e10cSrcweir aBtnNullVals .SaveValue();
282cdf0e10cSrcweir aBtnNotes .SaveValue();
283cdf0e10cSrcweir aBtnGrid .SaveValue();
284cdf0e10cSrcweir aBtnHeaders .SaveValue();
285cdf0e10cSrcweir aBtnTopDown .SaveValue();
286cdf0e10cSrcweir aBtnLeftRight .SaveValue();
287cdf0e10cSrcweir aLbScaleMode .SaveValue();
288cdf0e10cSrcweir aBtnCharts .SaveValue();
289cdf0e10cSrcweir aBtnObjects .SaveValue();
290cdf0e10cSrcweir aBtnDrawings .SaveValue();
291cdf0e10cSrcweir aBtnPageNo .SaveValue();
292cdf0e10cSrcweir aEdPageNo .SaveValue();
293cdf0e10cSrcweir aEdScaleAll .SaveValue();
294cdf0e10cSrcweir aEdScalePageWidth.SaveValue();
295cdf0e10cSrcweir aEdScalePageHeight.SaveValue();
296cdf0e10cSrcweir aEdScalePageNum .SaveValue();
297cdf0e10cSrcweir }
298cdf0e10cSrcweir
299cdf0e10cSrcweir // -----------------------------------------------------------------------
300cdf0e10cSrcweir
FillItemSet(SfxItemSet & rCoreSet)301cdf0e10cSrcweir sal_Bool ScTablePage::FillItemSet( SfxItemSet& rCoreSet )
302cdf0e10cSrcweir {
303cdf0e10cSrcweir const SfxItemSet& rOldSet = GetItemSet();
304cdf0e10cSrcweir sal_uInt16 nWhichPageNo = GetWhich(SID_SCATTR_PAGE_FIRSTPAGENO);
305cdf0e10cSrcweir sal_Bool bDataChanged = sal_False;
306cdf0e10cSrcweir
307cdf0e10cSrcweir //-----------
308cdf0e10cSrcweir // sal_Bool-Flags
309cdf0e10cSrcweir //-----------
310cdf0e10cSrcweir
311cdf0e10cSrcweir bDataChanged |= lcl_PutBoolItem( GetWhich(SID_SCATTR_PAGE_NOTES),
312cdf0e10cSrcweir rCoreSet, rOldSet,
313cdf0e10cSrcweir aBtnNotes.IsChecked(),
314cdf0e10cSrcweir aBtnNotes.GetSavedValue() != STATE_NOCHECK );
315cdf0e10cSrcweir
316cdf0e10cSrcweir bDataChanged |= lcl_PutBoolItem( GetWhich(SID_SCATTR_PAGE_GRID),
317cdf0e10cSrcweir rCoreSet, rOldSet,
318cdf0e10cSrcweir aBtnGrid.IsChecked(),
319cdf0e10cSrcweir aBtnGrid.GetSavedValue() != STATE_NOCHECK );
320cdf0e10cSrcweir
321cdf0e10cSrcweir bDataChanged |= lcl_PutBoolItem( GetWhich(SID_SCATTR_PAGE_HEADERS),
322cdf0e10cSrcweir rCoreSet, rOldSet,
323cdf0e10cSrcweir aBtnHeaders.IsChecked(),
324cdf0e10cSrcweir aBtnHeaders.GetSavedValue() != STATE_NOCHECK );
325cdf0e10cSrcweir
326cdf0e10cSrcweir bDataChanged |= lcl_PutBoolItem( GetWhich(SID_SCATTR_PAGE_TOPDOWN),
327cdf0e10cSrcweir rCoreSet, rOldSet,
328cdf0e10cSrcweir aBtnTopDown.IsChecked(),
329cdf0e10cSrcweir aBtnTopDown.GetSavedValue() );
330cdf0e10cSrcweir
331cdf0e10cSrcweir bDataChanged |= lcl_PutBoolItem( GetWhich(SID_SCATTR_PAGE_FORMULAS),
332cdf0e10cSrcweir rCoreSet, rOldSet,
333cdf0e10cSrcweir aBtnFormulas.IsChecked(),
334cdf0e10cSrcweir aBtnFormulas.GetSavedValue() != STATE_NOCHECK );
335cdf0e10cSrcweir
336cdf0e10cSrcweir bDataChanged |= lcl_PutBoolItem( GetWhich(SID_SCATTR_PAGE_NULLVALS),
337cdf0e10cSrcweir rCoreSet, rOldSet,
338cdf0e10cSrcweir aBtnNullVals.IsChecked(),
339cdf0e10cSrcweir aBtnNullVals.GetSavedValue() != STATE_NOCHECK );
340cdf0e10cSrcweir
341cdf0e10cSrcweir //------------------
342cdf0e10cSrcweir // Erste Druckseite:
343cdf0e10cSrcweir //------------------
344cdf0e10cSrcweir sal_Bool bUseValue = aBtnPageNo.IsChecked();
345cdf0e10cSrcweir
346cdf0e10cSrcweir if ( WAS_DEFAULT(nWhichPageNo,rOldSet)
347cdf0e10cSrcweir && ( (!bUseValue && bUseValue == aBtnPageNo.GetSavedValue())
348cdf0e10cSrcweir || ( bUseValue && bUseValue == aBtnPageNo.GetSavedValue()
349cdf0e10cSrcweir && aEdPageNo.GetText() == aEdPageNo.GetSavedValue() ) ) )
350cdf0e10cSrcweir {
351cdf0e10cSrcweir rCoreSet.ClearItem( nWhichPageNo );
352cdf0e10cSrcweir }
353cdf0e10cSrcweir else
354cdf0e10cSrcweir {
355cdf0e10cSrcweir sal_uInt16 nPage = (sal_uInt16)( aBtnPageNo.IsChecked()
356cdf0e10cSrcweir ? aEdPageNo.GetValue()
357cdf0e10cSrcweir : 0 );
358cdf0e10cSrcweir
359cdf0e10cSrcweir rCoreSet.Put( SfxUInt16Item( nWhichPageNo, nPage ) );
360cdf0e10cSrcweir bDataChanged = sal_True;
361cdf0e10cSrcweir }
362cdf0e10cSrcweir
363cdf0e10cSrcweir //-------------------
364cdf0e10cSrcweir // Objektdarstellung:
365cdf0e10cSrcweir //-------------------
366cdf0e10cSrcweir
367cdf0e10cSrcweir bDataChanged |= lcl_PutVObjModeItem( GetWhich(SID_SCATTR_PAGE_CHARTS),
368cdf0e10cSrcweir rCoreSet, rOldSet, aBtnCharts );
369cdf0e10cSrcweir
370cdf0e10cSrcweir bDataChanged |= lcl_PutVObjModeItem( GetWhich(SID_SCATTR_PAGE_OBJECTS),
371cdf0e10cSrcweir rCoreSet, rOldSet, aBtnObjects );
372cdf0e10cSrcweir
373cdf0e10cSrcweir bDataChanged |= lcl_PutVObjModeItem( GetWhich(SID_SCATTR_PAGE_DRAWINGS),
374cdf0e10cSrcweir rCoreSet, rOldSet, aBtnDrawings );
375cdf0e10cSrcweir
376cdf0e10cSrcweir //------------
377cdf0e10cSrcweir // Skalierung:
378cdf0e10cSrcweir //------------
379cdf0e10cSrcweir
380cdf0e10cSrcweir if( !aEdScalePageWidth.GetValue() && !aEdScalePageHeight.GetValue() )
381cdf0e10cSrcweir {
382cdf0e10cSrcweir aLbScaleMode.SelectEntryPos( SC_TPTABLE_SCALE_PERCENT );
383cdf0e10cSrcweir aEdScaleAll.SetValue( 100 );
384cdf0e10cSrcweir }
385cdf0e10cSrcweir
386cdf0e10cSrcweir bDataChanged |= lcl_PutScaleItem( GetWhich(SID_SCATTR_PAGE_SCALE),
387cdf0e10cSrcweir rCoreSet, rOldSet,
388cdf0e10cSrcweir aLbScaleMode, SC_TPTABLE_SCALE_PERCENT,
389cdf0e10cSrcweir aEdScaleAll, (sal_uInt16)aEdScaleAll.GetValue() );
390cdf0e10cSrcweir
391cdf0e10cSrcweir bDataChanged |= lcl_PutScaleItem2( GetWhich(SID_SCATTR_PAGE_SCALETO),
392cdf0e10cSrcweir rCoreSet, rOldSet,
393cdf0e10cSrcweir aLbScaleMode, SC_TPTABLE_SCALE_TO,
394cdf0e10cSrcweir aEdScalePageWidth, aEdScalePageHeight );
395cdf0e10cSrcweir
396cdf0e10cSrcweir bDataChanged |= lcl_PutScaleItem( GetWhich(SID_SCATTR_PAGE_SCALETOPAGES),
397cdf0e10cSrcweir rCoreSet, rOldSet,
398cdf0e10cSrcweir aLbScaleMode, SC_TPTABLE_SCALE_TO_PAGES,
399cdf0e10cSrcweir aEdScalePageNum, (sal_uInt16)aEdScalePageNum.GetValue() );
400cdf0e10cSrcweir
401cdf0e10cSrcweir return bDataChanged;
402cdf0e10cSrcweir }
403cdf0e10cSrcweir
404cdf0e10cSrcweir //------------------------------------------------------------------------
405cdf0e10cSrcweir
DeactivatePage(SfxItemSet * pSetP)406cdf0e10cSrcweir int ScTablePage::DeactivatePage( SfxItemSet* pSetP )
407cdf0e10cSrcweir {
408cdf0e10cSrcweir if ( pSetP )
409cdf0e10cSrcweir FillItemSet( *pSetP );
410cdf0e10cSrcweir
411cdf0e10cSrcweir return LEAVE_PAGE;
412cdf0e10cSrcweir }
413cdf0e10cSrcweir
414cdf0e10cSrcweir //------------------------------------------------------------------------
415cdf0e10cSrcweir
DataChanged(const DataChangedEvent & rDCEvt)416cdf0e10cSrcweir void ScTablePage::DataChanged( const DataChangedEvent& rDCEvt )
417cdf0e10cSrcweir {
418cdf0e10cSrcweir if( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
419cdf0e10cSrcweir ShowImage();
420cdf0e10cSrcweir SfxTabPage::DataChanged( rDCEvt );
421cdf0e10cSrcweir }
422cdf0e10cSrcweir
423cdf0e10cSrcweir //------------------------------------------------------------------------
424cdf0e10cSrcweir // Handler:
425cdf0e10cSrcweir //------------------------------------------------------------------------
426cdf0e10cSrcweir
IMPL_LINK(ScTablePage,PageDirHdl,RadioButton *,EMPTYARG)427cdf0e10cSrcweir IMPL_LINK( ScTablePage, PageDirHdl, RadioButton*, EMPTYARG )
428cdf0e10cSrcweir {
429cdf0e10cSrcweir ShowImage();
430cdf0e10cSrcweir return 0;
431cdf0e10cSrcweir }
432cdf0e10cSrcweir
433cdf0e10cSrcweir //------------------------------------------------------------------------
434cdf0e10cSrcweir
IMPL_LINK(ScTablePage,PageNoHdl,CheckBox *,pBtn)435cdf0e10cSrcweir IMPL_LINK( ScTablePage, PageNoHdl, CheckBox*, pBtn )
436cdf0e10cSrcweir {
437cdf0e10cSrcweir if ( aBtnPageNo.IsChecked() )
438cdf0e10cSrcweir {
439cdf0e10cSrcweir aEdPageNo.Enable();
440cdf0e10cSrcweir if ( pBtn )
441cdf0e10cSrcweir aEdPageNo.GrabFocus();
442cdf0e10cSrcweir }
443cdf0e10cSrcweir else
444cdf0e10cSrcweir aEdPageNo.Disable();
445cdf0e10cSrcweir
446cdf0e10cSrcweir return 0;
447cdf0e10cSrcweir }
448cdf0e10cSrcweir
449cdf0e10cSrcweir //------------------------------------------------------------------------
450cdf0e10cSrcweir
IMPL_LINK(ScTablePage,ScaleHdl,ListBox *,EMPTYARG)451cdf0e10cSrcweir IMPL_LINK( ScTablePage, ScaleHdl, ListBox*, EMPTYARG )
452cdf0e10cSrcweir {
453cdf0e10cSrcweir // controls for "Reduce/enlarge"
454cdf0e10cSrcweir bool bPercent = (aLbScaleMode.GetSelectEntryPos() == SC_TPTABLE_SCALE_PERCENT);
455cdf0e10cSrcweir aFtScaleAll.Show( bPercent );
456cdf0e10cSrcweir aEdScaleAll.Show( bPercent );
457cdf0e10cSrcweir
458cdf0e10cSrcweir // controls for "Scale to width/height"
459cdf0e10cSrcweir bool bScaleTo = (aLbScaleMode.GetSelectEntryPos() == SC_TPTABLE_SCALE_TO);
460cdf0e10cSrcweir aFtScalePageWidth.Show( bScaleTo );
461cdf0e10cSrcweir aEdScalePageWidth.Show( bScaleTo );
462cdf0e10cSrcweir aFtScalePageHeight.Show( bScaleTo );
463cdf0e10cSrcweir aEdScalePageHeight.Show( bScaleTo );
464cdf0e10cSrcweir
465cdf0e10cSrcweir // controls for "Scale to pages"
466cdf0e10cSrcweir bool bScalePages = (aLbScaleMode.GetSelectEntryPos() == SC_TPTABLE_SCALE_TO_PAGES);
467cdf0e10cSrcweir aFtScalePageNum.Show( bScalePages );
468cdf0e10cSrcweir aEdScalePageNum.Show( bScalePages );
469cdf0e10cSrcweir
470cdf0e10cSrcweir return 0;
471cdf0e10cSrcweir }
472cdf0e10cSrcweir
473cdf0e10cSrcweir //========================================================================
474cdf0e10cSrcweir // Hilfsfunktionen fuer FillItemSet:
475cdf0e10cSrcweir //========================================================================
476cdf0e10cSrcweir
lcl_PutBoolItem(sal_uInt16 nWhich,SfxItemSet & rCoreSet,const SfxItemSet & rOldSet,sal_Bool bIsChecked,sal_Bool bSavedValue)477cdf0e10cSrcweir sal_Bool lcl_PutBoolItem( sal_uInt16 nWhich,
478cdf0e10cSrcweir SfxItemSet& rCoreSet,
479cdf0e10cSrcweir const SfxItemSet& rOldSet,
480cdf0e10cSrcweir sal_Bool bIsChecked,
481cdf0e10cSrcweir sal_Bool bSavedValue )
482cdf0e10cSrcweir {
483cdf0e10cSrcweir sal_Bool bDataChanged = ( bSavedValue == bIsChecked
484cdf0e10cSrcweir && WAS_DEFAULT(nWhich,rOldSet) );
485cdf0e10cSrcweir
486cdf0e10cSrcweir if ( bDataChanged )
487cdf0e10cSrcweir rCoreSet.ClearItem(nWhich);
488cdf0e10cSrcweir else
489cdf0e10cSrcweir rCoreSet.Put( SfxBoolItem( nWhich, bIsChecked ) );
490cdf0e10cSrcweir
491cdf0e10cSrcweir return bDataChanged;
492cdf0e10cSrcweir }
493cdf0e10cSrcweir
494cdf0e10cSrcweir //------------------------------------------------------------------------
495cdf0e10cSrcweir
lcl_PutVObjModeItem(sal_uInt16 nWhich,SfxItemSet & rCoreSet,const SfxItemSet & rOldSet,const CheckBox & rBtn)496cdf0e10cSrcweir sal_Bool lcl_PutVObjModeItem( sal_uInt16 nWhich,
497cdf0e10cSrcweir SfxItemSet& rCoreSet,
498cdf0e10cSrcweir const SfxItemSet& rOldSet,
499cdf0e10cSrcweir const CheckBox& rBtn )
500cdf0e10cSrcweir {
501cdf0e10cSrcweir sal_Bool bIsChecked = rBtn.IsChecked();
502cdf0e10cSrcweir sal_Bool bDataChanged = ( rBtn.GetSavedValue() == bIsChecked
503cdf0e10cSrcweir && WAS_DEFAULT(nWhich,rOldSet) );
504cdf0e10cSrcweir
505cdf0e10cSrcweir if ( bDataChanged )
506cdf0e10cSrcweir rCoreSet.ClearItem( nWhich );
507cdf0e10cSrcweir
508cdf0e10cSrcweir else
509cdf0e10cSrcweir rCoreSet.Put( ScViewObjectModeItem( nWhich, bIsChecked
510cdf0e10cSrcweir ? VOBJ_MODE_SHOW
511cdf0e10cSrcweir : VOBJ_MODE_HIDE ) );
512cdf0e10cSrcweir return bDataChanged;
513cdf0e10cSrcweir }
514cdf0e10cSrcweir
515cdf0e10cSrcweir //------------------------------------------------------------------------
516cdf0e10cSrcweir
lcl_PutScaleItem(sal_uInt16 nWhich,SfxItemSet & rCoreSet,const SfxItemSet & rOldSet,const ListBox & rListBox,sal_uInt16 nLBEntry,const SpinField & rEd,sal_uInt16 nValue)517cdf0e10cSrcweir sal_Bool lcl_PutScaleItem( sal_uInt16 nWhich,
518cdf0e10cSrcweir SfxItemSet& rCoreSet,
519cdf0e10cSrcweir const SfxItemSet& rOldSet,
520cdf0e10cSrcweir const ListBox& rListBox,
521cdf0e10cSrcweir sal_uInt16 nLBEntry,
522cdf0e10cSrcweir const SpinField& rEd,
523cdf0e10cSrcweir sal_uInt16 nValue )
524cdf0e10cSrcweir {
525cdf0e10cSrcweir sal_Bool bIsSel = (rListBox.GetSelectEntryPos() == nLBEntry);
526cdf0e10cSrcweir sal_Bool bDataChanged = (rListBox.GetSavedValue() != nLBEntry) ||
527cdf0e10cSrcweir (rEd.GetSavedValue() != rEd.GetText()) ||
528cdf0e10cSrcweir !WAS_DEFAULT( nWhich, rOldSet );
529cdf0e10cSrcweir
530cdf0e10cSrcweir if( bDataChanged )
531cdf0e10cSrcweir rCoreSet.Put( SfxUInt16Item( nWhich, bIsSel ? nValue : 0 ) );
532cdf0e10cSrcweir else
533cdf0e10cSrcweir rCoreSet.ClearItem( nWhich );
534cdf0e10cSrcweir
535cdf0e10cSrcweir return bDataChanged;
536cdf0e10cSrcweir }
537cdf0e10cSrcweir
538cdf0e10cSrcweir
lcl_PutScaleItem2(sal_uInt16 nWhich,SfxItemSet & rCoreSet,const SfxItemSet & rOldSet,const ListBox & rListBox,sal_uInt16 nLBEntry,const NumericField & rEd1,const NumericField & rEd2)539cdf0e10cSrcweir sal_Bool lcl_PutScaleItem2( sal_uInt16 nWhich,
540cdf0e10cSrcweir SfxItemSet& rCoreSet,
541cdf0e10cSrcweir const SfxItemSet& rOldSet,
542cdf0e10cSrcweir const ListBox& rListBox,
543cdf0e10cSrcweir sal_uInt16 nLBEntry,
544cdf0e10cSrcweir const NumericField& rEd1,
545cdf0e10cSrcweir const NumericField& rEd2 )
546cdf0e10cSrcweir {
547cdf0e10cSrcweir sal_uInt16 nValue1 = (sal_uInt16)rEd1.GetValue();
548cdf0e10cSrcweir sal_uInt16 nValue2 = (sal_uInt16)rEd2.GetValue();
549cdf0e10cSrcweir sal_Bool bIsSel = (rListBox.GetSelectEntryPos() == nLBEntry);
550cdf0e10cSrcweir sal_Bool bDataChanged = (rListBox.GetSavedValue() != nLBEntry) ||
551cdf0e10cSrcweir (rEd1.GetSavedValue() != rEd1.GetText()) ||
552cdf0e10cSrcweir (rEd2.GetSavedValue() != rEd2.GetText()) ||
553cdf0e10cSrcweir !WAS_DEFAULT( nWhich, rOldSet );
554cdf0e10cSrcweir
555cdf0e10cSrcweir if( bDataChanged )
556cdf0e10cSrcweir {
557cdf0e10cSrcweir ScPageScaleToItem aItem;
558cdf0e10cSrcweir if( bIsSel )
559cdf0e10cSrcweir aItem.Set( nValue1, nValue2 );
560cdf0e10cSrcweir rCoreSet.Put( aItem );
561cdf0e10cSrcweir }
562cdf0e10cSrcweir else
563cdf0e10cSrcweir rCoreSet.ClearItem( nWhich );
564cdf0e10cSrcweir
565cdf0e10cSrcweir return bDataChanged;
566cdf0e10cSrcweir }
567cdf0e10cSrcweir
568cdf0e10cSrcweir
569cdf0e10cSrcweir
570