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

Generated by: LCOV version 1.10