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