LCOV - code coverage report
Current view: top level - sc/source/ui/optdlg - tpprint.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 52 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 10 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 :     disposeOnce();
      45           0 : }
      46             : 
      47           0 : void ScTpPrintOptions::dispose()
      48             : {
      49           0 :     m_pSkipEmptyPagesCB.clear();
      50           0 :     m_pSelectedSheetsCB.clear();
      51           0 :     m_pForceBreaksCB.clear();
      52           0 :     SfxTabPage::dispose();
      53           0 : }
      54             : 
      55           0 : VclPtr<SfxTabPage> ScTpPrintOptions::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
      56             : {
      57           0 :     return VclPtr<ScTpPrintOptions>::Create( pParent, *rAttrSet );
      58             : }
      59             : 
      60           0 : SfxTabPage::sfxpg ScTpPrintOptions::DeactivatePage( SfxItemSet* pSetP )
      61             : {
      62           0 :     if ( pSetP )
      63           0 :         FillItemSet( pSetP );
      64             : 
      65           0 :     return LEAVE_PAGE;
      66             : }
      67             : 
      68           0 : void ScTpPrintOptions::Reset( const SfxItemSet* rCoreSet )
      69             : {
      70           0 :     ScPrintOptions aOptions;
      71             : 
      72             :     const SfxPoolItem* pItem;
      73           0 :     if(SfxItemState::SET == rCoreSet->GetItemState(SID_SCPRINTOPTIONS, false , &pItem))
      74           0 :         aOptions = static_cast<const ScTpPrintItem*>(pItem)->GetPrintOptions();
      75             :     else
      76             :     {
      77             :         // when called from print dialog and no options set, use configuration
      78           0 :         aOptions = SC_MOD()->GetPrintOptions();
      79             :     }
      80             : 
      81           0 :     if ( SfxItemState::SET == rCoreSet->GetItemState( SID_PRINT_SELECTEDSHEET, false , &pItem ) )
      82             :     {
      83           0 :         bool bChecked = static_cast<const SfxBoolItem*>(pItem)->GetValue();
      84           0 :         m_pSelectedSheetsCB->Check( bChecked );
      85             :     }
      86             :     else
      87             :     {
      88           0 :         m_pSelectedSheetsCB->Check( !aOptions.GetAllSheets() );
      89             :     }
      90             : 
      91           0 :     m_pSkipEmptyPagesCB->Check( aOptions.GetSkipEmpty() );
      92           0 :     m_pSkipEmptyPagesCB->SaveValue();
      93           0 :     m_pSelectedSheetsCB->SaveValue();
      94           0 :     m_pForceBreaksCB->Check( aOptions.GetForceBreaks() );
      95           0 :     m_pForceBreaksCB->SaveValue();
      96           0 : }
      97             : 
      98           0 : bool ScTpPrintOptions::FillItemSet( SfxItemSet* rCoreAttrs )
      99             : {
     100           0 :     rCoreAttrs->ClearItem( SID_PRINT_SELECTEDSHEET );
     101             : 
     102           0 :     bool bSkipEmptyChanged = m_pSkipEmptyPagesCB->IsValueChangedFromSaved();
     103           0 :     bool bSelectedSheetsChanged = m_pSelectedSheetsCB->IsValueChangedFromSaved();
     104           0 :     bool bForceBreaksChanged = m_pForceBreaksCB->IsValueChangedFromSaved();
     105             : 
     106           0 :     if ( bSkipEmptyChanged || bSelectedSheetsChanged || bForceBreaksChanged )
     107             :     {
     108           0 :         ScPrintOptions aOpt;
     109           0 :         aOpt.SetSkipEmpty( m_pSkipEmptyPagesCB->IsChecked() );
     110           0 :         aOpt.SetAllSheets( !m_pSelectedSheetsCB->IsChecked() );
     111           0 :         aOpt.SetForceBreaks( m_pForceBreaksCB->IsChecked() );
     112           0 :         rCoreAttrs->Put( ScTpPrintItem( SID_SCPRINTOPTIONS, aOpt ) );
     113           0 :         if ( bSelectedSheetsChanged )
     114             :         {
     115           0 :             rCoreAttrs->Put( SfxBoolItem( SID_PRINT_SELECTEDSHEET, m_pSelectedSheetsCB->IsChecked() ) );
     116             :         }
     117           0 :         return true;
     118             :     }
     119             :     else
     120             :     {
     121           0 :         return false;
     122             :     }
     123           0 : }
     124             : 
     125             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11