LCOV - code coverage report
Current view: top level - libreoffice/sc/source/ui/optdlg - tpprint.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 39 0.0 %
Date: 2012-12-27 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             : // -----------------------------------------------------------------------
      33             : 
      34           0 : ScTpPrintOptions::ScTpPrintOptions( Window*           pParent,
      35             :                                     const SfxItemSet& rCoreAttrs )
      36             :     :   SfxTabPage      ( pParent,
      37             :                           ScResId( RID_SCPAGE_PRINT ),
      38             :                           rCoreAttrs ),
      39             :         aPagesFL         ( this, ScResId( FL_PAGES ) ),
      40             :         aSkipEmptyPagesCB( this, ScResId( BTN_SKIPEMPTYPAGES ) ),
      41             :         aSheetsFL        ( this, ScResId( FL_SHEETS ) ),
      42           0 :         aSelectedSheetsCB( this, ScResId( BTN_SELECTEDSHEETS ) )
      43             : {
      44           0 :     FreeResource();
      45           0 : }
      46             : 
      47           0 : ScTpPrintOptions::~ScTpPrintOptions()
      48             : {
      49           0 : }
      50             : 
      51           0 : SfxTabPage* ScTpPrintOptions::Create( Window* pParent, const SfxItemSet& rAttrSet )
      52             : {
      53           0 :     return new ScTpPrintOptions( pParent, rAttrSet );
      54             : }
      55             : 
      56           0 : int ScTpPrintOptions::DeactivatePage( SfxItemSet* pSetP )
      57             : {
      58           0 :     if ( pSetP )
      59           0 :         FillItemSet( *pSetP );
      60             : 
      61           0 :     return LEAVE_PAGE;
      62             : }
      63             : 
      64             : // -----------------------------------------------------------------------
      65             : 
      66           0 : void ScTpPrintOptions::Reset( const SfxItemSet& rCoreSet )
      67             : {
      68           0 :     ScPrintOptions aOptions;
      69             : 
      70             :     const SfxPoolItem* pItem;
      71           0 :     if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SCPRINTOPTIONS, false , &pItem))
      72           0 :         aOptions = ((const ScTpPrintItem*)pItem)->GetPrintOptions();
      73             :     else
      74             :     {
      75             :         // when called from print dialog and no options set, use configuration
      76           0 :         aOptions = SC_MOD()->GetPrintOptions();
      77             :     }
      78             : 
      79           0 :     if ( SFX_ITEM_SET == rCoreSet.GetItemState( SID_PRINT_SELECTEDSHEET, false , &pItem ) )
      80             :     {
      81           0 :         sal_Bool bChecked = ( (const SfxBoolItem*)pItem )->GetValue();
      82           0 :         aSelectedSheetsCB.Check( bChecked );
      83             :     }
      84             :     else
      85             :     {
      86           0 :         aSelectedSheetsCB.Check( !aOptions.GetAllSheets() );
      87             :     }
      88             : 
      89           0 :     aSkipEmptyPagesCB.Check( aOptions.GetSkipEmpty() );
      90           0 :     aSkipEmptyPagesCB.SaveValue();
      91           0 :     aSelectedSheetsCB.SaveValue();
      92           0 : }
      93             : 
      94             : // -----------------------------------------------------------------------
      95             : 
      96           0 : sal_Bool ScTpPrintOptions::FillItemSet( SfxItemSet& rCoreAttrs )
      97             : {
      98           0 :     rCoreAttrs.ClearItem( SID_PRINT_SELECTEDSHEET );
      99             : 
     100           0 :     bool bSkipEmptyChanged = ( aSkipEmptyPagesCB.GetSavedValue() != aSkipEmptyPagesCB.IsChecked() );
     101           0 :     bool bSelectedSheetsChanged = ( aSelectedSheetsCB.GetSavedValue() != aSelectedSheetsCB.IsChecked() );
     102             : 
     103           0 :     if ( bSkipEmptyChanged || bSelectedSheetsChanged )
     104             :     {
     105           0 :         ScPrintOptions aOpt;
     106           0 :         aOpt.SetSkipEmpty( aSkipEmptyPagesCB.IsChecked() );
     107           0 :         aOpt.SetAllSheets( !aSelectedSheetsCB.IsChecked() );
     108           0 :         rCoreAttrs.Put( ScTpPrintItem( SID_SCPRINTOPTIONS, aOpt ) );
     109           0 :         if ( bSelectedSheetsChanged )
     110             :         {
     111           0 :             rCoreAttrs.Put( SfxBoolItem( SID_PRINT_SELECTEDSHEET, aSelectedSheetsCB.IsChecked() ) );
     112             :         }
     113           0 :         return sal_True;
     114             :     }
     115             :     else
     116             :     {
     117           0 :         return false;
     118             :     }
     119           0 : }
     120             : 
     121             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10