LCOV - code coverage report
Current view: top level - sc/source/ui/miscdlgs - delcodlg.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 95 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 11 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 "delcodlg.hxx"
      23             : #include "scresid.hxx"
      24             : #include "miscdlgs.hrc"
      25             : 
      26             : bool       ScDeleteContentsDlg::bPreviousAllCheck = false;
      27           0 : InsertDeleteFlags ScDeleteContentsDlg::nPreviousChecks   = (IDF_DATETIME | IDF_STRING  |
      28           0 :                                                  IDF_NOTE     | IDF_FORMULA |
      29             :                                                  IDF_VALUE);
      30             : 
      31           0 : ScDeleteContentsDlg::ScDeleteContentsDlg( vcl::Window* pParent,
      32             :                                           InsertDeleteFlags nCheckDefaults ) :
      33             :     ModalDialog     ( pParent, "DeleteContentsDialog", "modules/scalc/ui/deletecontents.ui" ),
      34             : 
      35           0 :     bObjectsDisabled( false )
      36             : {
      37           0 :     get( aBtnDelAll, "deleteall" );
      38           0 :     get( aBtnDelStrings, "text" );
      39           0 :     get( aBtnDelNumbers, "numbers" );
      40           0 :     get( aBtnDelDateTime, "datetime" );
      41           0 :     get( aBtnDelFormulas, "formulas" );
      42           0 :     get( aBtnDelNotes, "comments" );
      43           0 :     get( aBtnDelAttrs, "formats" );
      44           0 :     get( aBtnDelObjects, "objects" );
      45           0 :     get( aBtnOk, "ok" );
      46             : 
      47           0 :     if ( nCheckDefaults != IDF_NONE )
      48             :     {
      49           0 :         ScDeleteContentsDlg::nPreviousChecks = nCheckDefaults;
      50           0 :         ScDeleteContentsDlg::bPreviousAllCheck = false;
      51             :     }
      52             : 
      53           0 :     aBtnDelAll->Check     ( ScDeleteContentsDlg::bPreviousAllCheck );
      54           0 :     aBtnDelStrings->Check ( IS_SET( IDF_STRING,
      55           0 :                                    ScDeleteContentsDlg::nPreviousChecks ) );
      56           0 :     aBtnDelNumbers->Check ( IS_SET( IDF_VALUE,
      57           0 :                                    ScDeleteContentsDlg::nPreviousChecks ) );
      58           0 :     aBtnDelDateTime->Check( IS_SET( IDF_DATETIME,
      59           0 :                                    ScDeleteContentsDlg::nPreviousChecks ) );
      60           0 :     aBtnDelFormulas->Check( IS_SET( IDF_FORMULA,
      61           0 :                                    ScDeleteContentsDlg::nPreviousChecks ) );
      62           0 :     aBtnDelNotes->Check   ( IS_SET( IDF_NOTE,
      63           0 :                                    ScDeleteContentsDlg::nPreviousChecks ) );
      64           0 :     aBtnDelAttrs->Check   ( IS_SET( IDF_ATTRIB,
      65           0 :                                    ScDeleteContentsDlg::nPreviousChecks ) );
      66           0 :     aBtnDelObjects->Check ( IS_SET( IDF_OBJECTS,
      67           0 :                                    ScDeleteContentsDlg::nPreviousChecks ) );
      68             : 
      69           0 :     DisableChecks( aBtnDelAll->IsChecked() );
      70             : 
      71           0 :     aBtnDelAll->SetClickHdl( LINK( this, ScDeleteContentsDlg, DelAllHdl ) );
      72           0 : }
      73             : 
      74           0 : ScDeleteContentsDlg::~ScDeleteContentsDlg()
      75             : {
      76           0 :     disposeOnce();
      77           0 : }
      78             : 
      79           0 : void ScDeleteContentsDlg::dispose()
      80             : {
      81           0 :     aBtnDelAll.clear();
      82           0 :     aBtnDelStrings.clear();
      83           0 :     aBtnDelNumbers.clear();
      84           0 :     aBtnDelDateTime.clear();
      85           0 :     aBtnDelFormulas.clear();
      86           0 :     aBtnDelNotes.clear();
      87           0 :     aBtnDelAttrs.clear();
      88           0 :     aBtnDelObjects.clear();
      89           0 :     aBtnOk.clear();
      90           0 :     ModalDialog::dispose();
      91           0 : }
      92             : 
      93           0 : InsertDeleteFlags ScDeleteContentsDlg::GetDelContentsCmdBits() const
      94             : {
      95           0 :     ScDeleteContentsDlg::nPreviousChecks = IDF_NONE;
      96             : 
      97           0 :     if ( aBtnDelStrings->IsChecked() )
      98           0 :         ScDeleteContentsDlg::nPreviousChecks  = IDF_STRING;
      99           0 :     if ( aBtnDelNumbers->IsChecked() )
     100           0 :         ScDeleteContentsDlg::nPreviousChecks |= IDF_VALUE;
     101           0 :     if ( aBtnDelDateTime->IsChecked())
     102           0 :         ScDeleteContentsDlg::nPreviousChecks |= IDF_DATETIME;
     103           0 :     if ( aBtnDelFormulas->IsChecked())
     104           0 :         ScDeleteContentsDlg::nPreviousChecks |= IDF_FORMULA;
     105           0 :     if ( aBtnDelNotes->IsChecked()   )
     106           0 :         ScDeleteContentsDlg::nPreviousChecks |= IDF_NOTE;
     107           0 :     if ( aBtnDelAttrs->IsChecked()   )
     108           0 :         ScDeleteContentsDlg::nPreviousChecks |= IDF_ATTRIB;
     109           0 :     if ( aBtnDelObjects->IsChecked() )
     110           0 :         ScDeleteContentsDlg::nPreviousChecks |= IDF_OBJECTS;
     111             : 
     112           0 :     ScDeleteContentsDlg::bPreviousAllCheck = aBtnDelAll->IsChecked();
     113             : 
     114             :     return ( (ScDeleteContentsDlg::bPreviousAllCheck)
     115             :                 ? IDF_ALL
     116           0 :                 : ScDeleteContentsDlg::nPreviousChecks );
     117             : }
     118             : 
     119           0 : void ScDeleteContentsDlg::DisableChecks( bool bDelAllChecked )
     120             : {
     121           0 :     if ( bDelAllChecked )
     122             :     {
     123           0 :         aBtnDelStrings->Disable();
     124           0 :         aBtnDelNumbers->Disable();
     125           0 :         aBtnDelDateTime->Disable();
     126           0 :         aBtnDelFormulas->Disable();
     127           0 :         aBtnDelNotes->Disable();
     128           0 :         aBtnDelAttrs->Disable();
     129           0 :         aBtnDelObjects->Disable();
     130             :     }
     131             :     else
     132             :     {
     133           0 :         aBtnDelStrings->Enable();
     134           0 :         aBtnDelNumbers->Enable();
     135           0 :         aBtnDelDateTime->Enable();
     136           0 :         aBtnDelFormulas->Enable();
     137           0 :         aBtnDelNotes->Enable();
     138           0 :         aBtnDelAttrs->Enable();
     139           0 :         if (bObjectsDisabled)
     140           0 :             aBtnDelObjects->Disable();
     141             :         else
     142           0 :             aBtnDelObjects->Enable();
     143             :     }
     144           0 : }
     145             : 
     146           0 : void ScDeleteContentsDlg::DisableObjects()
     147             : {
     148           0 :     bObjectsDisabled = true;
     149           0 :     aBtnDelObjects->Check(false);
     150           0 :     aBtnDelObjects->Disable();
     151           0 : }
     152             : 
     153           0 : IMPL_LINK_NOARG(ScDeleteContentsDlg, DelAllHdl)
     154             : {
     155           0 :     DisableChecks( aBtnDelAll->IsChecked() );
     156             : 
     157           0 :     return 0;
     158           0 : }
     159             : 
     160             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11