LCOV - code coverage report
Current view: top level - sc/source/ui/optdlg - tpprint.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 45 0.0 %
Date: 2014-04-14 Functions: 0 9 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             : 
      21             : #undef SC_DLLIMPLEMENTATION
      22             : 
      23             : #include <svl/eitem.hxx>
      24             : 
      25             : #include "tpprint.hxx"
      26             : #include "printopt.hxx"
      27             : #include "scmod.hxx"
      28             : #include "scresid.hxx"
      29             : #include "sc.hrc"
      30             : #include "optdlg.hrc"
      31             : 
      32           0 : ScTpPrintOptions::ScTpPrintOptions( Window*           pParent,
      33             :                                     const SfxItemSet& rCoreAttrs )
      34             :     :   SfxTabPage      ( pParent,
      35             :                           "optCalcPrintPage",
      36             :                           "modules/scalc/ui/optdlg.ui",
      37           0 :                           rCoreAttrs )
      38             : {
      39           0 :     get( m_pSkipEmptyPagesCB , "suppressCB" );
      40           0 :     get( m_pSelectedSheetsCB , "printCB" );
      41           0 :     get( m_pForceBreaksCB, "forceBreaksCB" );
      42           0 : }
      43             : 
      44           0 : ScTpPrintOptions::~ScTpPrintOptions()
      45             : {
      46           0 : }
      47             : 
      48           0 : SfxTabPage* ScTpPrintOptions::Create( Window* pParent, const SfxItemSet& rAttrSet )
      49             : {
      50           0 :     return new ScTpPrintOptions( pParent, rAttrSet );
      51             : }
      52             : 
      53           0 : int ScTpPrintOptions::DeactivatePage( SfxItemSet* pSetP )
      54             : {
      55           0 :     if ( pSetP )
      56           0 :         FillItemSet( *pSetP );
      57             : 
      58           0 :     return LEAVE_PAGE;
      59             : }
      60             : 
      61           0 : void ScTpPrintOptions::Reset( const SfxItemSet& rCoreSet )
      62             : {
      63           0 :     ScPrintOptions aOptions;
      64             : 
      65             :     const SfxPoolItem* pItem;
      66           0 :     if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SCPRINTOPTIONS, false , &pItem))
      67           0 :         aOptions = ((const ScTpPrintItem*)pItem)->GetPrintOptions();
      68             :     else
      69             :     {
      70             :         // when called from print dialog and no options set, use configuration
      71           0 :         aOptions = SC_MOD()->GetPrintOptions();
      72             :     }
      73             : 
      74           0 :     if ( SFX_ITEM_SET == rCoreSet.GetItemState( SID_PRINT_SELECTEDSHEET, false , &pItem ) )
      75             :     {
      76           0 :         sal_Bool bChecked = ( (const SfxBoolItem*)pItem )->GetValue();
      77           0 :         m_pSelectedSheetsCB->Check( bChecked );
      78             :     }
      79             :     else
      80             :     {
      81           0 :         m_pSelectedSheetsCB->Check( !aOptions.GetAllSheets() );
      82             :     }
      83             : 
      84           0 :     m_pSkipEmptyPagesCB->Check( aOptions.GetSkipEmpty() );
      85           0 :     m_pSkipEmptyPagesCB->SaveValue();
      86           0 :     m_pSelectedSheetsCB->SaveValue();
      87           0 :     m_pForceBreaksCB->Check( aOptions.GetForceBreaks() );
      88           0 :     m_pForceBreaksCB->SaveValue();
      89           0 : }
      90             : 
      91           0 : bool ScTpPrintOptions::FillItemSet( SfxItemSet& rCoreAttrs )
      92             : {
      93           0 :     rCoreAttrs.ClearItem( SID_PRINT_SELECTEDSHEET );
      94             : 
      95           0 :     bool bSkipEmptyChanged = ( m_pSkipEmptyPagesCB->GetSavedValue() != TriState(m_pSkipEmptyPagesCB->IsChecked()) );
      96           0 :     bool bSelectedSheetsChanged = ( m_pSelectedSheetsCB->GetSavedValue() != TriState(m_pSelectedSheetsCB->IsChecked()) );
      97           0 :     bool bForceBreaksChanged = ( m_pForceBreaksCB->GetSavedValue() != TriState(m_pForceBreaksCB->IsChecked()) );
      98             : 
      99           0 :     if ( bSkipEmptyChanged || bSelectedSheetsChanged || bForceBreaksChanged )
     100             :     {
     101           0 :         ScPrintOptions aOpt;
     102           0 :         aOpt.SetSkipEmpty( m_pSkipEmptyPagesCB->IsChecked() );
     103           0 :         aOpt.SetAllSheets( !m_pSelectedSheetsCB->IsChecked() );
     104           0 :         aOpt.SetForceBreaks( m_pForceBreaksCB->IsChecked() );
     105           0 :         rCoreAttrs.Put( ScTpPrintItem( SID_SCPRINTOPTIONS, aOpt ) );
     106           0 :         if ( bSelectedSheetsChanged )
     107             :         {
     108           0 :             rCoreAttrs.Put( SfxBoolItem( SID_PRINT_SELECTEDSHEET, m_pSelectedSheetsCB->IsChecked() ) );
     109             :         }
     110           0 :         return true;
     111             :     }
     112             :     else
     113             :     {
     114           0 :         return false;
     115             :     }
     116           0 : }
     117             : 
     118             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10