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