LCOV - code coverage report
Current view: top level - sc/source/ui/optdlg - tpprint.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 38 0.0 %
Date: 2012-08-25 Functions: 0 7 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #undef SC_DLLIMPLEMENTATION
      31                 :            : 
      32                 :            : #include <svl/eitem.hxx>
      33                 :            : 
      34                 :            : #include "tpprint.hxx"
      35                 :            : #include "printopt.hxx"
      36                 :            : #include "scmod.hxx"
      37                 :            : #include "scresid.hxx"
      38                 :            : #include "sc.hrc"
      39                 :            : #include "optdlg.hrc"
      40                 :            : 
      41                 :            : // -----------------------------------------------------------------------
      42                 :            : 
      43                 :          0 : ScTpPrintOptions::ScTpPrintOptions( Window*           pParent,
      44                 :            :                                     const SfxItemSet& rCoreAttrs )
      45                 :            :     :   SfxTabPage      ( pParent,
      46                 :            :                           ScResId( RID_SCPAGE_PRINT ),
      47                 :            :                           rCoreAttrs ),
      48                 :            :         aPagesFL         ( this, ScResId( FL_PAGES ) ),
      49                 :            :         aSkipEmptyPagesCB( this, ScResId( BTN_SKIPEMPTYPAGES ) ),
      50                 :            :         aSheetsFL        ( this, ScResId( FL_SHEETS ) ),
      51                 :          0 :         aSelectedSheetsCB( this, ScResId( BTN_SELECTEDSHEETS ) )
      52                 :            : {
      53                 :          0 :     FreeResource();
      54                 :          0 : }
      55                 :            : 
      56                 :          0 : ScTpPrintOptions::~ScTpPrintOptions()
      57                 :            : {
      58                 :          0 : }
      59                 :            : 
      60                 :          0 : SfxTabPage* ScTpPrintOptions::Create( Window* pParent, const SfxItemSet& rAttrSet )
      61                 :            : {
      62                 :          0 :     return new ScTpPrintOptions( pParent, rAttrSet );
      63                 :            : }
      64                 :            : 
      65                 :          0 : int ScTpPrintOptions::DeactivatePage( SfxItemSet* pSetP )
      66                 :            : {
      67                 :          0 :     if ( pSetP )
      68                 :          0 :         FillItemSet( *pSetP );
      69                 :            : 
      70                 :          0 :     return LEAVE_PAGE;
      71                 :            : }
      72                 :            : 
      73                 :            : // -----------------------------------------------------------------------
      74                 :            : 
      75                 :          0 : void ScTpPrintOptions::Reset( const SfxItemSet& rCoreSet )
      76                 :            : {
      77                 :          0 :     ScPrintOptions aOptions;
      78                 :            : 
      79                 :            :     const SfxPoolItem* pItem;
      80                 :          0 :     if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SCPRINTOPTIONS, false , &pItem))
      81                 :          0 :         aOptions = ((const ScTpPrintItem*)pItem)->GetPrintOptions();
      82                 :            :     else
      83                 :            :     {
      84                 :            :         // when called from print dialog and no options set, use configuration
      85                 :          0 :         aOptions = SC_MOD()->GetPrintOptions();
      86                 :            :     }
      87                 :            : 
      88                 :          0 :     if ( SFX_ITEM_SET == rCoreSet.GetItemState( SID_PRINT_SELECTEDSHEET, false , &pItem ) )
      89                 :            :     {
      90                 :          0 :         sal_Bool bChecked = ( (const SfxBoolItem*)pItem )->GetValue();
      91                 :          0 :         aSelectedSheetsCB.Check( bChecked );
      92                 :            :     }
      93                 :            :     else
      94                 :            :     {
      95                 :          0 :         aSelectedSheetsCB.Check( !aOptions.GetAllSheets() );
      96                 :            :     }
      97                 :            : 
      98                 :          0 :     aSkipEmptyPagesCB.Check( aOptions.GetSkipEmpty() );
      99                 :          0 :     aSkipEmptyPagesCB.SaveValue();
     100                 :          0 :     aSelectedSheetsCB.SaveValue();
     101                 :          0 : }
     102                 :            : 
     103                 :            : // -----------------------------------------------------------------------
     104                 :            : 
     105                 :          0 : sal_Bool ScTpPrintOptions::FillItemSet( SfxItemSet& rCoreAttrs )
     106                 :            : {
     107                 :          0 :     rCoreAttrs.ClearItem( SID_PRINT_SELECTEDSHEET );
     108                 :            : 
     109                 :          0 :     bool bSkipEmptyChanged = ( aSkipEmptyPagesCB.GetSavedValue() != aSkipEmptyPagesCB.IsChecked() );
     110                 :          0 :     bool bSelectedSheetsChanged = ( aSelectedSheetsCB.GetSavedValue() != aSelectedSheetsCB.IsChecked() );
     111                 :            : 
     112                 :          0 :     if ( bSkipEmptyChanged || bSelectedSheetsChanged )
     113                 :            :     {
     114                 :          0 :         ScPrintOptions aOpt;
     115                 :          0 :         aOpt.SetSkipEmpty( aSkipEmptyPagesCB.IsChecked() );
     116                 :          0 :         aOpt.SetAllSheets( !aSelectedSheetsCB.IsChecked() );
     117                 :          0 :         rCoreAttrs.Put( ScTpPrintItem( SID_SCPRINTOPTIONS, aOpt ) );
     118                 :          0 :         if ( bSelectedSheetsChanged )
     119                 :            :         {
     120                 :          0 :             rCoreAttrs.Put( SfxBoolItem( SID_PRINT_SELECTEDSHEET, aSelectedSheetsCB.IsChecked() ) );
     121                 :            :         }
     122                 :          0 :         return sal_True;
     123                 :            :     }
     124                 :            :     else
     125                 :            :     {
     126                 :          0 :         return false;
     127                 :            :     }
     128                 :            : }
     129                 :            : 
     130                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10