LCOV - code coverage report
Current view: top level - sc/source/ui/pagedlg - tptable.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 240 0.0 %
Date: 2015-06-13 12:38:46 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             : const sal_uInt16 ScTablePage::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 :     disposeOnce();
     129           0 : }
     130             : 
     131           0 : void ScTablePage::dispose()
     132             : {
     133           0 :     m_pBtnTopDown.clear();
     134           0 :     m_pBtnLeftRight.clear();
     135           0 :     m_pBmpPageDir.clear();
     136           0 :     m_pBtnPageNo.clear();
     137           0 :     m_pEdPageNo.clear();
     138           0 :     m_pBtnHeaders.clear();
     139           0 :     m_pBtnGrid.clear();
     140           0 :     m_pBtnNotes.clear();
     141           0 :     m_pBtnObjects.clear();
     142           0 :     m_pBtnCharts.clear();
     143           0 :     m_pBtnDrawings.clear();
     144           0 :     m_pBtnFormulas.clear();
     145           0 :     m_pBtnNullVals.clear();
     146           0 :     m_pLbScaleMode.clear();
     147           0 :     m_pBxScaleAll.clear();
     148           0 :     m_pEdScaleAll.clear();
     149           0 :     m_pGrHeightWidth.clear();
     150           0 :     m_pEdScalePageWidth.clear();
     151           0 :     m_pEdScalePageHeight.clear();
     152           0 :     m_pBxScalePageNum.clear();
     153           0 :     m_pEdScalePageNum.clear();
     154           0 :     SfxTabPage::dispose();
     155           0 : }
     156             : 
     157           0 : VclPtr<SfxTabPage> ScTablePage::Create( vcl::Window* pParent, const SfxItemSet* rCoreSet )
     158             : {
     159           0 :     return VclPtr<ScTablePage>::Create( pParent, *rCoreSet );
     160             : }
     161             : 
     162           0 : void ScTablePage::Reset( const SfxItemSet* rCoreSet )
     163             : {
     164           0 :     bool    bTopDown = GET_BOOL( SID_SCATTR_PAGE_TOPDOWN, *rCoreSet );
     165           0 :     sal_uInt16  nWhich   = 0;
     166             : 
     167             :     // sal_Bool flags
     168           0 :     m_pBtnNotes->Check( GET_BOOL(SID_SCATTR_PAGE_NOTES,*rCoreSet) );
     169           0 :     m_pBtnGrid->Check( GET_BOOL(SID_SCATTR_PAGE_GRID,*rCoreSet) );
     170           0 :     m_pBtnHeaders->Check( GET_BOOL(SID_SCATTR_PAGE_HEADERS,*rCoreSet) );
     171           0 :     m_pBtnFormulas->Check( GET_BOOL(SID_SCATTR_PAGE_FORMULAS,*rCoreSet) );
     172           0 :     m_pBtnNullVals->Check( GET_BOOL(SID_SCATTR_PAGE_NULLVALS,*rCoreSet) );
     173           0 :     m_pBtnTopDown->Check( bTopDown );
     174           0 :     m_pBtnLeftRight->Check( !bTopDown );
     175             : 
     176             :     // first printed page:
     177           0 :     sal_uInt16 nPage = GET_USHORT(SID_SCATTR_PAGE_FIRSTPAGENO,*rCoreSet);
     178           0 :     m_pBtnPageNo->Check( nPage != 0 );
     179           0 :     m_pEdPageNo->SetValue( (nPage != 0) ? nPage : 1 );
     180           0 :     PageNoHdl( NULL );
     181             : 
     182             :     // object representation:
     183           0 :     m_pBtnCharts->Check( GET_SHOW( SID_SCATTR_PAGE_CHARTS, *rCoreSet ) );
     184           0 :     m_pBtnObjects->Check( GET_SHOW( SID_SCATTR_PAGE_OBJECTS, *rCoreSet ) );
     185           0 :     m_pBtnDrawings->Check( GET_SHOW( SID_SCATTR_PAGE_DRAWINGS, *rCoreSet ) );
     186             : 
     187             :     // scaling:
     188           0 :     nWhich = GetWhich(SID_SCATTR_PAGE_SCALE);
     189           0 :     if ( rCoreSet->GetItemState( nWhich, true ) >= SfxItemState::DEFAULT )
     190             :     {
     191           0 :         sal_uInt16 nScale = static_cast<const SfxUInt16Item&>(rCoreSet->Get(nWhich)).GetValue();
     192           0 :         if( nScale > 0 )
     193           0 :             m_pLbScaleMode->SelectEntryPos( SC_TPTABLE_SCALE_PERCENT );
     194           0 :         m_pEdScaleAll->SetValue( (nScale > 0) ? nScale : 100 );
     195             :     }
     196             : 
     197           0 :     nWhich = GetWhich(SID_SCATTR_PAGE_SCALETO);
     198           0 :     if ( rCoreSet->GetItemState( nWhich, true ) >= SfxItemState::DEFAULT )
     199             :     {
     200           0 :         const ScPageScaleToItem& rItem = static_cast< const ScPageScaleToItem& >( rCoreSet->Get( nWhich ) );
     201           0 :         sal_uInt16 nWidth = rItem.GetWidth();
     202           0 :         sal_uInt16 nHeight = rItem.GetHeight();
     203             : 
     204             :         /*  width==0 and height==0 is invalid state, used as "not selected".
     205             :             Dialog shows width=height=1 then. */
     206           0 :         bool bValid = nWidth || nHeight;
     207           0 :         if( bValid )
     208           0 :             m_pLbScaleMode->SelectEntryPos( SC_TPTABLE_SCALE_TO );
     209           0 :         m_pEdScalePageWidth->SetValue( bValid ? nWidth : 1 );
     210           0 :         m_pEdScalePageHeight->SetValue( bValid ? nHeight : 1 );
     211             :     }
     212             : 
     213           0 :     nWhich = GetWhich(SID_SCATTR_PAGE_SCALETOPAGES);
     214           0 :     if ( rCoreSet->GetItemState( nWhich, true ) >= SfxItemState::DEFAULT )
     215             :     {
     216           0 :         sal_uInt16 nPages = static_cast<const SfxUInt16Item&>(rCoreSet->Get(nWhich)).GetValue();
     217           0 :         if( nPages > 0 )
     218           0 :             m_pLbScaleMode->SelectEntryPos( SC_TPTABLE_SCALE_TO_PAGES );
     219           0 :         m_pEdScalePageNum->SetValue( (nPages > 0) ? nPages : 1 );
     220             :     }
     221             : 
     222           0 :     if( m_pLbScaleMode->GetSelectEntryCount() == 0 )
     223             :     {
     224             :         // fall back to 100%
     225             :         OSL_FAIL( "ScTablePage::Reset - missing scaling item" );
     226           0 :         m_pLbScaleMode->SelectEntryPos( SC_TPTABLE_SCALE_PERCENT );
     227           0 :         m_pEdScaleAll->SetValue( 100 );
     228             :     }
     229             : 
     230           0 :     PageDirHdl( NULL );
     231           0 :     ScaleHdl( NULL );
     232             : 
     233             :     // remember for FillItemSet
     234           0 :     m_pBtnFormulas->SaveValue();
     235           0 :     m_pBtnNullVals->SaveValue();
     236           0 :     m_pBtnNotes->SaveValue();
     237           0 :     m_pBtnGrid->SaveValue();
     238           0 :     m_pBtnHeaders->SaveValue();
     239           0 :     m_pBtnTopDown->SaveValue();
     240           0 :     m_pBtnLeftRight->SaveValue();
     241           0 :     m_pLbScaleMode->SaveValue();
     242           0 :     m_pBtnCharts->SaveValue();
     243           0 :     m_pBtnObjects->SaveValue();
     244           0 :     m_pBtnDrawings->SaveValue();
     245           0 :     m_pBtnPageNo->SaveValue();
     246           0 :     m_pEdPageNo->SaveValue();
     247           0 :     m_pEdScaleAll->SaveValue();
     248           0 :     m_pEdScalePageWidth->SaveValue();
     249           0 :     m_pEdScalePageHeight->SaveValue();
     250           0 :     m_pEdScalePageNum->SaveValue();
     251           0 : }
     252             : 
     253           0 : bool ScTablePage::FillItemSet( SfxItemSet* rCoreSet )
     254             : {
     255           0 :     const SfxItemSet&   rOldSet      = GetItemSet();
     256           0 :     sal_uInt16              nWhichPageNo = GetWhich(SID_SCATTR_PAGE_FIRSTPAGENO);
     257           0 :     bool                bDataChanged = false;
     258             : 
     259             :     // sal_Bool flags
     260           0 :     bDataChanged |= lcl_PutBoolItem( GetWhich(SID_SCATTR_PAGE_NOTES),
     261             :                                      *rCoreSet, rOldSet,
     262           0 :                                      m_pBtnNotes->IsChecked(),
     263           0 :                                      m_pBtnNotes->GetSavedValue() != TRISTATE_FALSE );
     264             : 
     265           0 :     bDataChanged |= lcl_PutBoolItem( GetWhich(SID_SCATTR_PAGE_GRID),
     266             :                                      *rCoreSet, rOldSet,
     267           0 :                                      m_pBtnGrid->IsChecked(),
     268           0 :                                      m_pBtnGrid->GetSavedValue() != TRISTATE_FALSE );
     269             : 
     270           0 :     bDataChanged |= lcl_PutBoolItem( GetWhich(SID_SCATTR_PAGE_HEADERS),
     271             :                                      *rCoreSet, rOldSet,
     272           0 :                                      m_pBtnHeaders->IsChecked(),
     273           0 :                                      m_pBtnHeaders->GetSavedValue() != TRISTATE_FALSE );
     274             : 
     275           0 :     bDataChanged |= lcl_PutBoolItem( GetWhich(SID_SCATTR_PAGE_TOPDOWN),
     276             :                                      *rCoreSet, rOldSet,
     277           0 :                                      m_pBtnTopDown->IsChecked(),
     278           0 :                                      m_pBtnTopDown->GetSavedValue() );
     279             : 
     280           0 :     bDataChanged |= lcl_PutBoolItem( GetWhich(SID_SCATTR_PAGE_FORMULAS),
     281             :                                      *rCoreSet, rOldSet,
     282           0 :                                      m_pBtnFormulas->IsChecked(),
     283           0 :                                      m_pBtnFormulas->GetSavedValue() != TRISTATE_FALSE );
     284             : 
     285           0 :     bDataChanged |= lcl_PutBoolItem( GetWhich(SID_SCATTR_PAGE_NULLVALS),
     286             :                                      *rCoreSet, rOldSet,
     287           0 :                                      m_pBtnNullVals->IsChecked(),
     288           0 :                                      m_pBtnNullVals->GetSavedValue() != TRISTATE_FALSE );
     289             : 
     290             :     // first printed page:
     291           0 :     bool bUseValue = m_pBtnPageNo->IsChecked();
     292             : 
     293           0 :     if (   WAS_DEFAULT(nWhichPageNo,rOldSet)
     294           0 :         && (    (!bUseValue && 0 == m_pBtnPageNo->GetSavedValue())
     295           0 :             || (   bUseValue && 1 == m_pBtnPageNo->GetSavedValue()
     296           0 :                    && ! m_pEdPageNo->IsValueChangedFromSaved() ) ) )
     297             :     {
     298           0 :             rCoreSet->ClearItem( nWhichPageNo );
     299             :     }
     300             :     else
     301             :     {
     302           0 :         sal_uInt16 nPage = (sal_uInt16)( m_pBtnPageNo->IsChecked()
     303           0 :                                     ? m_pEdPageNo->GetValue()
     304           0 :                                     : 0 );
     305             : 
     306           0 :         rCoreSet->Put( SfxUInt16Item( nWhichPageNo, nPage ) );
     307           0 :         bDataChanged = true;
     308             :     }
     309             : 
     310             :     // object representation:
     311           0 :     bDataChanged |= lcl_PutVObjModeItem( GetWhich(SID_SCATTR_PAGE_CHARTS),
     312           0 :                                          *rCoreSet, rOldSet, *m_pBtnCharts );
     313             : 
     314           0 :     bDataChanged |= lcl_PutVObjModeItem( GetWhich(SID_SCATTR_PAGE_OBJECTS),
     315           0 :                                          *rCoreSet, rOldSet, *m_pBtnObjects );
     316             : 
     317           0 :     bDataChanged |= lcl_PutVObjModeItem( GetWhich(SID_SCATTR_PAGE_DRAWINGS),
     318           0 :                                          *rCoreSet, rOldSet, *m_pBtnDrawings );
     319             : 
     320             :     // scaling:
     321           0 :     if( !m_pEdScalePageWidth->GetValue() && !m_pEdScalePageHeight->GetValue() )
     322             :     {
     323           0 :         m_pLbScaleMode->SelectEntryPos( SC_TPTABLE_SCALE_PERCENT );
     324           0 :         m_pEdScaleAll->SetValue( 100 );
     325             :     }
     326             : 
     327           0 :     bDataChanged |= lcl_PutScaleItem( GetWhich(SID_SCATTR_PAGE_SCALE),
     328             :                                       *rCoreSet, rOldSet,
     329           0 :                                       *m_pLbScaleMode, SC_TPTABLE_SCALE_PERCENT,
     330           0 :                                       *m_pEdScaleAll, (sal_uInt16)m_pEdScaleAll->GetValue() );
     331             : 
     332           0 :     bDataChanged |= lcl_PutScaleItem2( GetWhich(SID_SCATTR_PAGE_SCALETO),
     333             :                                       *rCoreSet, rOldSet,
     334           0 :                                       *m_pLbScaleMode, SC_TPTABLE_SCALE_TO,
     335           0 :                                       *m_pEdScalePageWidth, *m_pEdScalePageHeight );
     336             : 
     337           0 :     bDataChanged |= lcl_PutScaleItem( GetWhich(SID_SCATTR_PAGE_SCALETOPAGES),
     338             :                                       *rCoreSet, rOldSet,
     339           0 :                                       *m_pLbScaleMode, SC_TPTABLE_SCALE_TO_PAGES,
     340           0 :                                       *m_pEdScalePageNum, (sal_uInt16)m_pEdScalePageNum->GetValue() );
     341             : 
     342           0 :     return bDataChanged;
     343             : }
     344             : 
     345           0 : SfxTabPage::sfxpg ScTablePage::DeactivatePage( SfxItemSet* pSetP )
     346             : {
     347           0 :     if ( pSetP )
     348           0 :         FillItemSet( pSetP );
     349             : 
     350           0 :     return LEAVE_PAGE;
     351             : }
     352             : 
     353           0 : void ScTablePage::DataChanged( const DataChangedEvent& rDCEvt )
     354             : {
     355           0 :     if( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
     356           0 :         ShowImage();
     357           0 :     SfxTabPage::DataChanged( rDCEvt );
     358           0 : }
     359             : 
     360             : // Handler:
     361             : 
     362           0 : IMPL_LINK_NOARG(ScTablePage, PageDirHdl)
     363             : {
     364           0 :     ShowImage();
     365           0 :     return 0;
     366             : }
     367             : 
     368           0 : IMPL_LINK( ScTablePage, PageNoHdl, CheckBox*, pBtn )
     369             : {
     370           0 :     if ( m_pBtnPageNo->IsChecked() )
     371             :     {
     372           0 :         m_pEdPageNo->Enable();
     373           0 :         if ( pBtn )
     374           0 :             m_pEdPageNo->GrabFocus();
     375             :     }
     376             :     else
     377           0 :         m_pEdPageNo->Disable();
     378             : 
     379           0 :     return 0;
     380             : }
     381             : 
     382           0 : IMPL_LINK_NOARG(ScTablePage, ScaleHdl)
     383             : {
     384             :     // controls for Box "Reduce/enlarge"
     385           0 :     m_pBxScaleAll->Show(m_pLbScaleMode->GetSelectEntryPos() == SC_TPTABLE_SCALE_PERCENT);
     386             : 
     387             :     // controls for Grid "Scale to width/height"
     388           0 :     m_pGrHeightWidth->Show(m_pLbScaleMode->GetSelectEntryPos() == SC_TPTABLE_SCALE_TO);
     389             : 
     390             :     // controls for Box "Scale to pages"
     391           0 :     m_pBxScalePageNum->Show(m_pLbScaleMode->GetSelectEntryPos() == SC_TPTABLE_SCALE_TO_PAGES);
     392             : 
     393           0 :     return 0;
     394             : }
     395             : 
     396             : // Helper functions for FillItemSet:
     397             : 
     398           0 : static bool lcl_PutBoolItem( sal_uInt16            nWhich,
     399             :                      SfxItemSet&        rCoreSet,
     400             :                      const SfxItemSet&  rOldSet,
     401             :                      bool               bIsChecked,
     402             :                      bool               bSavedValue )
     403             : {
     404             :     bool bDataChanged = (   bSavedValue == bIsChecked
     405           0 :                          && WAS_DEFAULT(nWhich,rOldSet) );
     406             : 
     407           0 :     if ( bDataChanged )
     408           0 :         rCoreSet.ClearItem(nWhich);
     409             :     else
     410           0 :         rCoreSet.Put( SfxBoolItem( nWhich, bIsChecked ) );
     411             : 
     412           0 :     return bDataChanged;
     413             : }
     414             : 
     415           0 : static bool lcl_PutVObjModeItem( sal_uInt16            nWhich,
     416             :                          SfxItemSet&        rCoreSet,
     417             :                          const SfxItemSet&  rOldSet,
     418             :                          const CheckBox&    rBtn )
     419             : {
     420           0 :     bool bIsChecked   = rBtn.IsChecked();
     421           0 :     bool bDataChanged =     rBtn.GetSavedValue() == (bIsChecked ? 1 : 0)
     422           0 :                          && WAS_DEFAULT(nWhich,rOldSet);
     423             : 
     424           0 :     if ( bDataChanged )
     425           0 :         rCoreSet.ClearItem( nWhich );
     426             : 
     427             :     else
     428             :         rCoreSet.Put( ScViewObjectModeItem( nWhich, bIsChecked
     429             :                                                     ? VOBJ_MODE_SHOW
     430           0 :                                                     : VOBJ_MODE_HIDE ) );
     431           0 :     return bDataChanged;
     432             : }
     433             : 
     434           0 : static bool lcl_PutScaleItem( sal_uInt16               nWhich,
     435             :                       SfxItemSet&           rCoreSet,
     436             :                       const SfxItemSet&     rOldSet,
     437             :                       const ListBox&        rListBox,
     438             :                       sal_uInt16                nLBEntry,
     439             :                       const SpinField&      rEd,
     440             :                       sal_uInt16                nValue )
     441             : {
     442           0 :     bool bIsSel = (rListBox.GetSelectEntryPos() == nLBEntry);
     443           0 :     bool bDataChanged = (rListBox.GetSavedValue() != nLBEntry) ||
     444           0 :                         rEd.IsValueChangedFromSaved() ||
     445           0 :                         !WAS_DEFAULT( nWhich, rOldSet );
     446             : 
     447           0 :     if( bDataChanged )
     448           0 :         rCoreSet.Put( SfxUInt16Item( nWhich, bIsSel ? nValue : 0 ) );
     449             :     else
     450           0 :         rCoreSet.ClearItem( nWhich );
     451             : 
     452           0 :     return bDataChanged;
     453             : }
     454             : 
     455           0 : static bool lcl_PutScaleItem2( sal_uInt16               nWhich,
     456             :                       SfxItemSet&           rCoreSet,
     457             :                       const SfxItemSet&     rOldSet,
     458             :                       const ListBox&        rListBox,
     459             :                       sal_uInt16                nLBEntry,
     460             :                       const NumericField&   rEd1,
     461             :                       const NumericField&   rEd2 )
     462             : {
     463           0 :     sal_uInt16 nValue1 = (sal_uInt16)rEd1.GetValue();
     464           0 :     sal_uInt16 nValue2 = (sal_uInt16)rEd2.GetValue();
     465           0 :     bool bIsSel = (rListBox.GetSelectEntryPos() == nLBEntry);
     466           0 :     bool bDataChanged = (rListBox.GetSavedValue() != nLBEntry) ||
     467           0 :                         rEd1.IsValueChangedFromSaved() ||
     468           0 :                         rEd2.IsValueChangedFromSaved() ||
     469           0 :                         !WAS_DEFAULT( nWhich, rOldSet );
     470             : 
     471           0 :     if( bDataChanged )
     472             :     {
     473           0 :         ScPageScaleToItem aItem;
     474           0 :         if( bIsSel )
     475           0 :             aItem.Set( nValue1, nValue2 );
     476           0 :         rCoreSet.Put( aItem );
     477             :     }
     478             :     else
     479           0 :         rCoreSet.ClearItem( nWhich );
     480             : 
     481           0 :     return bDataChanged;
     482           0 : }
     483             : 
     484             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11