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

Generated by: LCOV version 1.10