LCOV - code coverage report
Current view: top level - sc/source/ui/pagedlg - tptable.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 214 0.0 %
Date: 2014-04-14 Functions: 0 22 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #undef SC_DLLIMPLEMENTATION
      21             : 
      22             : #include "scitems.hxx"
      23             : 
      24             : #include <vcl/settings.hxx>
      25             : 
      26             : #include "tptable.hxx"
      27             : #include "global.hxx"
      28             : #include "attrib.hxx"
      29             : #include "scresid.hxx"
      30             : #include "sc.hrc"
      31             : #include "pagedlg.hrc"
      32             : 
      33             : 
      34             : // Static Data
      35             : 
      36             : static sal_uInt16 pPageTableRanges[] =
      37             : {
      38             :     ATTR_PAGE_NOTES, ATTR_PAGE_FIRSTPAGENO,
      39             :     0
      40             : };
      41             : 
      42             : static sal_Bool lcl_PutVObjModeItem( sal_uInt16            nWhich,
      43             :                           SfxItemSet&       rCoreSet,
      44             :                           const SfxItemSet& rOldSet,
      45             :                           const CheckBox&   rBtn );
      46             : 
      47             : static sal_Bool lcl_PutScaleItem( sal_uInt16               nWhich,
      48             :                        SfxItemSet&          rCoreSet,
      49             :                        const SfxItemSet&    rOldSet,
      50             :                        const ListBox&       rListBox,
      51             :                        sal_uInt16               nLBEntry,
      52             :                        const SpinField&     rEd,
      53             :                        sal_uInt16               nValue );
      54             : 
      55             : static sal_Bool lcl_PutScaleItem2( sal_uInt16               nWhich,
      56             :                        SfxItemSet&          rCoreSet,
      57             :                        const SfxItemSet&    rOldSet,
      58             :                        const ListBox&       rListBox,
      59             :                        sal_uInt16               nLBEntry,
      60             :                        const NumericField&  rEd1,
      61             :                        const NumericField&  rEd2 );
      62             : 
      63             : static sal_Bool lcl_PutBoolItem( sal_uInt16            nWhich,
      64             :                       SfxItemSet&       rCoreSet,
      65             :                       const SfxItemSet& rOldSet,
      66             :                       sal_Bool              bIsChecked,
      67             :                       sal_Bool              bSavedValue );
      68             : 
      69             : 
      70             : #define PAGENO_HDL          LINK(this,ScTablePage,PageNoHdl)
      71             : #define PAGEDIR_HDL         LINK(this,ScTablePage,PageDirHdl)
      72             : #define SCALE_HDL           LINK(this,ScTablePage,ScaleHdl)
      73             : 
      74             : #define WAS_DEFAULT(w,s)    (SFX_ITEM_DEFAULT==(s).GetItemState((w),true))
      75             : #define GET_BOOL(sid,set)   ((const SfxBoolItem&)((set).Get(GetWhich((sid))))).GetValue()
      76             : #define GET_USHORT(sid,set) (sal_uInt16)((const SfxUInt16Item&)((set).Get(GetWhich((sid))))).GetValue()
      77             : #define GET_SHOW(sid,set)   ( ScVObjMode( ((const ScViewObjectModeItem&)((set).Get(GetWhich((sid))))).GetValue() ) \
      78             :                               == VOBJ_MODE_SHOW )
      79             : // List box entries "Scaling mode"
      80             : #define SC_TPTABLE_SCALE_PERCENT    0
      81             : #define SC_TPTABLE_SCALE_TO         1
      82             : #define SC_TPTABLE_SCALE_TO_PAGES   2
      83             : 
      84             : 
      85           0 : ScTablePage::ScTablePage( Window* pParent, const SfxItemSet& rCoreAttrs ) :
      86             : 
      87           0 :         SfxTabPage( pParent, "SheetPrintPage","modules/scalc/ui/sheetprintpage.ui", rCoreAttrs )
      88             : {
      89           0 :     get(m_pBtnTopDown,"radioBTN_TOPDOWN");
      90           0 :     get(m_pBtnLeftRight,"radioBTN_LEFTRIGHT");
      91           0 :     get(m_pBmpPageDir,"imageBMP_PAGEDIR");
      92           0 :     get(m_pBtnPageNo,"checkBTN_PAGENO");
      93           0 :     get(m_pEdPageNo,"spinED_PAGENO");
      94             : 
      95           0 :     get(m_pBtnHeaders,"checkBTN_HEADER");
      96           0 :     get(m_pBtnGrid,"checkBTN_GRID");
      97           0 :     get(m_pBtnNotes,"checkBTN_NOTES");
      98           0 :     get(m_pBtnObjects,"checkBTN_OBJECTS");
      99           0 :     get(m_pBtnCharts,"checkBTN_CHARTS");
     100           0 :     get(m_pBtnDrawings,"checkBTN_DRAWINGS");
     101           0 :     get(m_pBtnFormulas,"checkBTN_FORMULAS");
     102           0 :     get(m_pBtnNullVals,"checkBTN_NULLVALS");
     103             : 
     104           0 :     get(m_pLbScaleMode,"comboLB_SCALEMODE");
     105           0 :     get(m_pBxScaleAll,"boxSCALEALL");
     106           0 :     get(m_pEdScaleAll,"spinED_SCALEALL");
     107           0 :     get(m_pGrHeightWidth,"gridWH");
     108           0 :     get(m_pEdScalePageWidth,"spinED_SCALEPAGEWIDTH");
     109           0 :     get(m_pEdScalePageHeight,"spinED_SCALEPAGEHEIGHT");
     110           0 :     get(m_pBxScalePageNum,"boxNP");
     111           0 :     get(m_pEdScalePageNum,"spinED_SCALEPAGENUM");
     112             : 
     113           0 :     SetExchangeSupport();
     114             : 
     115           0 :     m_pBtnPageNo->SetClickHdl( PAGENO_HDL );
     116           0 :     m_pBtnTopDown->SetClickHdl( PAGEDIR_HDL );
     117           0 :     m_pBtnLeftRight->SetClickHdl( PAGEDIR_HDL );
     118           0 :     m_pLbScaleMode->SetSelectHdl( SCALE_HDL );
     119             : 
     120           0 : }
     121             : 
     122           0 : void ScTablePage::ShowImage()
     123             : {
     124           0 :     Image aImg = Image( ScResId( (m_pBtnLeftRight->IsChecked()) ? IMG_LEFTRIGHT : IMG_TOPDOWN ) );
     125           0 :     m_pBmpPageDir->SetImage( aImg );
     126           0 :     m_pBmpPageDir->SetOutputSizePixel( aImg.GetSizePixel() );
     127           0 : }
     128             : 
     129           0 : ScTablePage::~ScTablePage()
     130             : {
     131           0 : }
     132             : 
     133           0 : sal_uInt16* ScTablePage::GetRanges()
     134             : {
     135           0 :     return pPageTableRanges;
     136             : }
     137             : 
     138           0 : SfxTabPage* ScTablePage::Create( Window* pParent, const SfxItemSet& rCoreSet )
     139             : {
     140           0 :     return ( new ScTablePage( pParent, rCoreSet ) );
     141             : }
     142             : 
     143           0 : void ScTablePage::Reset( const SfxItemSet& rCoreSet )
     144             : {
     145           0 :     sal_Bool    bTopDown = GET_BOOL( SID_SCATTR_PAGE_TOPDOWN, rCoreSet );
     146           0 :     sal_uInt16  nWhich   = 0;
     147             : 
     148             :     // sal_Bool flags
     149           0 :     m_pBtnNotes->Check( GET_BOOL(SID_SCATTR_PAGE_NOTES,rCoreSet) );
     150           0 :     m_pBtnGrid->Check( GET_BOOL(SID_SCATTR_PAGE_GRID,rCoreSet) );
     151           0 :     m_pBtnHeaders->Check( GET_BOOL(SID_SCATTR_PAGE_HEADERS,rCoreSet) );
     152           0 :     m_pBtnFormulas->Check( GET_BOOL(SID_SCATTR_PAGE_FORMULAS,rCoreSet) );
     153           0 :     m_pBtnNullVals->Check( GET_BOOL(SID_SCATTR_PAGE_NULLVALS,rCoreSet) );
     154           0 :     m_pBtnTopDown->Check( bTopDown );
     155           0 :     m_pBtnLeftRight->Check( !bTopDown );
     156             : 
     157             :     // first printed page:
     158           0 :     sal_uInt16 nPage = GET_USHORT(SID_SCATTR_PAGE_FIRSTPAGENO,rCoreSet);
     159           0 :     m_pBtnPageNo->Check( nPage != 0 );
     160           0 :     m_pEdPageNo->SetValue( (nPage != 0) ? nPage : 1 );
     161           0 :     PageNoHdl( NULL );
     162             : 
     163             :     // object representation:
     164           0 :     m_pBtnCharts->Check( GET_SHOW( SID_SCATTR_PAGE_CHARTS, rCoreSet ) );
     165           0 :     m_pBtnObjects->Check( GET_SHOW( SID_SCATTR_PAGE_OBJECTS, rCoreSet ) );
     166           0 :     m_pBtnDrawings->Check( GET_SHOW( SID_SCATTR_PAGE_DRAWINGS, rCoreSet ) );
     167             : 
     168             :     // scaling:
     169           0 :     nWhich = GetWhich(SID_SCATTR_PAGE_SCALE);
     170           0 :     if ( rCoreSet.GetItemState( nWhich, true ) >= SFX_ITEM_AVAILABLE )
     171             :     {
     172           0 :         sal_uInt16 nScale = ((const SfxUInt16Item&)rCoreSet.Get(nWhich)).GetValue();
     173           0 :         if( nScale > 0 )
     174           0 :             m_pLbScaleMode->SelectEntryPos( SC_TPTABLE_SCALE_PERCENT );
     175           0 :         m_pEdScaleAll->SetValue( (nScale > 0) ? nScale : 100 );
     176             :     }
     177             : 
     178           0 :     nWhich = GetWhich(SID_SCATTR_PAGE_SCALETO);
     179           0 :     if ( rCoreSet.GetItemState( nWhich, true ) >= SFX_ITEM_AVAILABLE )
     180             :     {
     181           0 :         const ScPageScaleToItem& rItem = static_cast< const ScPageScaleToItem& >( rCoreSet.Get( nWhich ) );
     182           0 :         sal_uInt16 nWidth = rItem.GetWidth();
     183           0 :         sal_uInt16 nHeight = rItem.GetHeight();
     184             : 
     185             :         /*  width==0 and height==0 is invalid state, used as "not selected".
     186             :             Dialog shows width=height=1 then. */
     187           0 :         bool bValid = nWidth || nHeight;
     188           0 :         if( bValid )
     189           0 :             m_pLbScaleMode->SelectEntryPos( SC_TPTABLE_SCALE_TO );
     190           0 :         m_pEdScalePageWidth->SetValue( bValid ? nWidth : 1 );
     191           0 :         m_pEdScalePageHeight->SetValue( bValid ? nHeight : 1 );
     192             :     }
     193             : 
     194           0 :     nWhich = GetWhich(SID_SCATTR_PAGE_SCALETOPAGES);
     195           0 :     if ( rCoreSet.GetItemState( nWhich, true ) >= SFX_ITEM_AVAILABLE )
     196             :     {
     197           0 :         sal_uInt16 nPages = ((const SfxUInt16Item&)rCoreSet.Get(nWhich)).GetValue();
     198           0 :         if( nPages > 0 )
     199           0 :             m_pLbScaleMode->SelectEntryPos( SC_TPTABLE_SCALE_TO_PAGES );
     200           0 :         m_pEdScalePageNum->SetValue( (nPages > 0) ? nPages : 1 );
     201             :     }
     202             : 
     203           0 :     if( m_pLbScaleMode->GetSelectEntryCount() == 0 )
     204             :     {
     205             :         // fall back to 100%
     206             :         OSL_FAIL( "ScTablePage::Reset - missing scaling item" );
     207           0 :         m_pLbScaleMode->SelectEntryPos( SC_TPTABLE_SCALE_PERCENT );
     208           0 :         m_pEdScaleAll->SetValue( 100 );
     209             :     }
     210             : 
     211           0 :     PageDirHdl( NULL );
     212           0 :     ScaleHdl( NULL );
     213             : 
     214             :     // remember for FillItemSet
     215           0 :     m_pBtnFormulas->SaveValue();
     216           0 :     m_pBtnNullVals->SaveValue();
     217           0 :     m_pBtnNotes->SaveValue();
     218           0 :     m_pBtnGrid->SaveValue();
     219           0 :     m_pBtnHeaders->SaveValue();
     220           0 :     m_pBtnTopDown->SaveValue();
     221           0 :     m_pBtnLeftRight->SaveValue();
     222           0 :     m_pLbScaleMode->SaveValue();
     223           0 :     m_pBtnCharts->SaveValue();
     224           0 :     m_pBtnObjects->SaveValue();
     225           0 :     m_pBtnDrawings->SaveValue();
     226           0 :     m_pBtnPageNo->SaveValue();
     227           0 :     m_pEdPageNo->SaveValue();
     228           0 :     m_pEdScaleAll->SaveValue();
     229           0 :     m_pEdScalePageWidth->SaveValue();
     230           0 :     m_pEdScalePageHeight->SaveValue();
     231           0 :     m_pEdScalePageNum->SaveValue();
     232           0 : }
     233             : 
     234           0 : bool ScTablePage::FillItemSet( SfxItemSet& rCoreSet )
     235             : {
     236           0 :     const SfxItemSet&   rOldSet      = GetItemSet();
     237           0 :     sal_uInt16              nWhichPageNo = GetWhich(SID_SCATTR_PAGE_FIRSTPAGENO);
     238           0 :     sal_Bool                bDataChanged = false;
     239             : 
     240             :     // sal_Bool flags
     241           0 :     bDataChanged |= lcl_PutBoolItem( GetWhich(SID_SCATTR_PAGE_NOTES),
     242             :                                      rCoreSet, rOldSet,
     243           0 :                                      m_pBtnNotes->IsChecked(),
     244           0 :                                      m_pBtnNotes->GetSavedValue() != TRISTATE_FALSE );
     245             : 
     246           0 :     bDataChanged |= lcl_PutBoolItem( GetWhich(SID_SCATTR_PAGE_GRID),
     247             :                                      rCoreSet, rOldSet,
     248           0 :                                      m_pBtnGrid->IsChecked(),
     249           0 :                                      m_pBtnGrid->GetSavedValue() != TRISTATE_FALSE );
     250             : 
     251           0 :     bDataChanged |= lcl_PutBoolItem( GetWhich(SID_SCATTR_PAGE_HEADERS),
     252             :                                      rCoreSet, rOldSet,
     253           0 :                                      m_pBtnHeaders->IsChecked(),
     254           0 :                                      m_pBtnHeaders->GetSavedValue() != TRISTATE_FALSE );
     255             : 
     256           0 :     bDataChanged |= lcl_PutBoolItem( GetWhich(SID_SCATTR_PAGE_TOPDOWN),
     257             :                                      rCoreSet, rOldSet,
     258           0 :                                      m_pBtnTopDown->IsChecked(),
     259           0 :                                      m_pBtnTopDown->GetSavedValue() );
     260             : 
     261           0 :     bDataChanged |= lcl_PutBoolItem( GetWhich(SID_SCATTR_PAGE_FORMULAS),
     262             :                                      rCoreSet, rOldSet,
     263           0 :                                      m_pBtnFormulas->IsChecked(),
     264           0 :                                      m_pBtnFormulas->GetSavedValue() != TRISTATE_FALSE );
     265             : 
     266           0 :     bDataChanged |= lcl_PutBoolItem( GetWhich(SID_SCATTR_PAGE_NULLVALS),
     267             :                                      rCoreSet, rOldSet,
     268           0 :                                      m_pBtnNullVals->IsChecked(),
     269           0 :                                      m_pBtnNullVals->GetSavedValue() != TRISTATE_FALSE );
     270             : 
     271             :     // first printed page:
     272           0 :     sal_Bool bUseValue = m_pBtnPageNo->IsChecked();
     273             : 
     274           0 :     if (   WAS_DEFAULT(nWhichPageNo,rOldSet)
     275           0 :         && (    (!bUseValue && bUseValue == m_pBtnPageNo->GetSavedValue())
     276           0 :             || (   bUseValue && bUseValue == m_pBtnPageNo->GetSavedValue()
     277           0 :                    && m_pEdPageNo->GetText() == m_pEdPageNo->GetSavedValue() ) ) )
     278             :     {
     279           0 :             rCoreSet.ClearItem( nWhichPageNo );
     280             :     }
     281             :     else
     282             :     {
     283           0 :         sal_uInt16 nPage = (sal_uInt16)( m_pBtnPageNo->IsChecked()
     284           0 :                                     ? m_pEdPageNo->GetValue()
     285           0 :                                     : 0 );
     286             : 
     287           0 :         rCoreSet.Put( SfxUInt16Item( nWhichPageNo, nPage ) );
     288           0 :         bDataChanged = sal_True;
     289             :     }
     290             : 
     291             :     // object representation:
     292           0 :     bDataChanged |= lcl_PutVObjModeItem( GetWhich(SID_SCATTR_PAGE_CHARTS),
     293           0 :                                          rCoreSet, rOldSet, *m_pBtnCharts );
     294             : 
     295           0 :     bDataChanged |= lcl_PutVObjModeItem( GetWhich(SID_SCATTR_PAGE_OBJECTS),
     296           0 :                                          rCoreSet, rOldSet, *m_pBtnObjects );
     297             : 
     298           0 :     bDataChanged |= lcl_PutVObjModeItem( GetWhich(SID_SCATTR_PAGE_DRAWINGS),
     299           0 :                                          rCoreSet, rOldSet, *m_pBtnDrawings );
     300             : 
     301             :     // scaling:
     302           0 :     if( !m_pEdScalePageWidth->GetValue() && !m_pEdScalePageHeight->GetValue() )
     303             :     {
     304           0 :         m_pLbScaleMode->SelectEntryPos( SC_TPTABLE_SCALE_PERCENT );
     305           0 :         m_pEdScaleAll->SetValue( 100 );
     306             :     }
     307             : 
     308           0 :     bDataChanged |= lcl_PutScaleItem( GetWhich(SID_SCATTR_PAGE_SCALE),
     309             :                                       rCoreSet, rOldSet,
     310             :                                       *m_pLbScaleMode, SC_TPTABLE_SCALE_PERCENT,
     311           0 :                                       *m_pEdScaleAll, (sal_uInt16)m_pEdScaleAll->GetValue() );
     312             : 
     313           0 :     bDataChanged |= lcl_PutScaleItem2( GetWhich(SID_SCATTR_PAGE_SCALETO),
     314             :                                       rCoreSet, rOldSet,
     315             :                                       *m_pLbScaleMode, SC_TPTABLE_SCALE_TO,
     316           0 :                                       *m_pEdScalePageWidth, *m_pEdScalePageHeight );
     317             : 
     318           0 :     bDataChanged |= lcl_PutScaleItem( GetWhich(SID_SCATTR_PAGE_SCALETOPAGES),
     319             :                                       rCoreSet, rOldSet,
     320             :                                       *m_pLbScaleMode, SC_TPTABLE_SCALE_TO_PAGES,
     321           0 :                                       *m_pEdScalePageNum, (sal_uInt16)m_pEdScalePageNum->GetValue() );
     322             : 
     323           0 :     return bDataChanged;
     324             : }
     325             : 
     326           0 : int ScTablePage::DeactivatePage( SfxItemSet* pSetP )
     327             : {
     328           0 :     if ( pSetP )
     329           0 :         FillItemSet( *pSetP );
     330             : 
     331           0 :     return LEAVE_PAGE;
     332             : }
     333             : 
     334           0 : void ScTablePage::DataChanged( const DataChangedEvent& rDCEvt )
     335             : {
     336           0 :     if( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
     337           0 :         ShowImage();
     338           0 :     SfxTabPage::DataChanged( rDCEvt );
     339           0 : }
     340             : 
     341             : // Handler:
     342             : 
     343           0 : IMPL_LINK_NOARG(ScTablePage, PageDirHdl)
     344             : {
     345           0 :     ShowImage();
     346           0 :     return 0;
     347             : }
     348             : 
     349           0 : IMPL_LINK( ScTablePage, PageNoHdl, CheckBox*, pBtn )
     350             : {
     351           0 :     if ( m_pBtnPageNo->IsChecked() )
     352             :     {
     353           0 :         m_pEdPageNo->Enable();
     354           0 :         if ( pBtn )
     355           0 :             m_pEdPageNo->GrabFocus();
     356             :     }
     357             :     else
     358           0 :         m_pEdPageNo->Disable();
     359             : 
     360           0 :     return 0;
     361             : }
     362             : 
     363           0 : IMPL_LINK_NOARG(ScTablePage, ScaleHdl)
     364             : {
     365             :     // controls for Box "Reduce/enlarge"
     366           0 :     m_pBxScaleAll->Show(m_pLbScaleMode->GetSelectEntryPos() == SC_TPTABLE_SCALE_PERCENT);
     367             : 
     368             :     // controls for Grid "Scale to width/height"
     369           0 :     m_pGrHeightWidth->Show(m_pLbScaleMode->GetSelectEntryPos() == SC_TPTABLE_SCALE_TO);
     370             : 
     371             :     // controls for Box "Scale to pages"
     372           0 :     m_pBxScalePageNum->Show(m_pLbScaleMode->GetSelectEntryPos() == SC_TPTABLE_SCALE_TO_PAGES);
     373             : 
     374           0 :     return 0;
     375             : }
     376             : 
     377             : // Helper functions for FillItemSet:
     378             : 
     379           0 : static sal_Bool lcl_PutBoolItem( sal_uInt16            nWhich,
     380             :                      SfxItemSet&        rCoreSet,
     381             :                      const SfxItemSet&  rOldSet,
     382             :                      sal_Bool               bIsChecked,
     383             :                      sal_Bool               bSavedValue )
     384             : {
     385             :     sal_Bool bDataChanged = (   bSavedValue == bIsChecked
     386           0 :                          && WAS_DEFAULT(nWhich,rOldSet) );
     387             : 
     388           0 :     if ( bDataChanged )
     389           0 :         rCoreSet.ClearItem(nWhich);
     390             :     else
     391           0 :         rCoreSet.Put( SfxBoolItem( nWhich, bIsChecked ) );
     392             : 
     393           0 :     return bDataChanged;
     394             : }
     395             : 
     396           0 : static sal_Bool lcl_PutVObjModeItem( sal_uInt16            nWhich,
     397             :                          SfxItemSet&        rCoreSet,
     398             :                          const SfxItemSet&  rOldSet,
     399             :                          const CheckBox&    rBtn )
     400             : {
     401           0 :     sal_Bool bIsChecked   = rBtn.IsChecked();
     402           0 :     sal_Bool bDataChanged = (   rBtn.GetSavedValue() == bIsChecked
     403           0 :                          && WAS_DEFAULT(nWhich,rOldSet) );
     404             : 
     405           0 :     if ( bDataChanged )
     406           0 :         rCoreSet.ClearItem( nWhich );
     407             : 
     408             :     else
     409             :         rCoreSet.Put( ScViewObjectModeItem( nWhich, bIsChecked
     410             :                                                     ? VOBJ_MODE_SHOW
     411           0 :                                                     : VOBJ_MODE_HIDE ) );
     412           0 :     return bDataChanged;
     413             : }
     414             : 
     415           0 : static sal_Bool lcl_PutScaleItem( sal_uInt16               nWhich,
     416             :                       SfxItemSet&           rCoreSet,
     417             :                       const SfxItemSet&     rOldSet,
     418             :                       const ListBox&        rListBox,
     419             :                       sal_uInt16                nLBEntry,
     420             :                       const SpinField&      rEd,
     421             :                       sal_uInt16                nValue )
     422             : {
     423           0 :     sal_Bool bIsSel = (rListBox.GetSelectEntryPos() == nLBEntry);
     424           0 :     sal_Bool bDataChanged = (rListBox.GetSavedValue() != nLBEntry) ||
     425           0 :         (rEd.GetSavedValue() != rEd.GetText()) ||
     426           0 :                         !WAS_DEFAULT( nWhich, rOldSet );
     427             : 
     428           0 :     if( bDataChanged )
     429           0 :         rCoreSet.Put( SfxUInt16Item( nWhich, bIsSel ? nValue : 0 ) );
     430             :     else
     431           0 :         rCoreSet.ClearItem( nWhich );
     432             : 
     433           0 :     return bDataChanged;
     434             : }
     435             : 
     436             : 
     437           0 : static sal_Bool lcl_PutScaleItem2( sal_uInt16               nWhich,
     438             :                       SfxItemSet&           rCoreSet,
     439             :                       const SfxItemSet&     rOldSet,
     440             :                       const ListBox&        rListBox,
     441             :                       sal_uInt16                nLBEntry,
     442             :                       const NumericField&   rEd1,
     443             :                       const NumericField&   rEd2 )
     444             : {
     445           0 :     sal_uInt16 nValue1 = (sal_uInt16)rEd1.GetValue();
     446           0 :     sal_uInt16 nValue2 = (sal_uInt16)rEd2.GetValue();
     447           0 :     sal_Bool bIsSel = (rListBox.GetSelectEntryPos() == nLBEntry);
     448           0 :     sal_Bool bDataChanged = (rListBox.GetSavedValue() != nLBEntry) ||
     449           0 :         (rEd1.GetSavedValue() != rEd1.GetText()) ||
     450           0 :         (rEd2.GetSavedValue() != rEd2.GetText()) ||
     451           0 :                         !WAS_DEFAULT( nWhich, rOldSet );
     452             : 
     453           0 :     if( bDataChanged )
     454             :     {
     455           0 :         ScPageScaleToItem aItem;
     456           0 :         if( bIsSel )
     457           0 :             aItem.Set( nValue1, nValue2 );
     458           0 :         rCoreSet.Put( aItem );
     459             :     }
     460             :     else
     461           0 :         rCoreSet.ClearItem( nWhich );
     462             : 
     463           0 :     return bDataChanged;
     464           0 : }
     465             : 
     466             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10