LCOV - code coverage report
Current view: top level - libreoffice/dbaccess/source/ui/dlg - dlgsize.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 31 0.0 %
Date: 2012-12-17 Functions: 0 7 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             : #include "dlgsize.hrc"
      21             : #include "dlgsize.hxx"
      22             : #include "dbu_dlg.hrc"
      23             : #include "moduledbu.hxx"
      24             : 
      25             : //.........................................................................
      26             : namespace dbaui
      27             : {
      28             : //.........................................................................
      29             : 
      30             : 
      31             : #define DEF_ROW_HEIGHT  45
      32             : #define DEF_COL_WIDTH   227
      33             : 
      34             : DBG_NAME(DlgSize)
      35             : //==================================================================
      36           0 : DlgSize::DlgSize( Window* pParent, sal_Int32 nVal, sal_Bool bRow, sal_Int32 _nAlternativeStandard )
      37             :         :ModalDialog( pParent, ModuleRes(bRow ? DLG_ROWHEIGHT : DLG_COLWIDTH))
      38             :         ,m_nPrevValue(nVal)
      39             :         ,m_nStandard(bRow ? DEF_ROW_HEIGHT : DEF_COL_WIDTH)
      40             :         ,aFT_VALUE(this,    ModuleRes( FT_VALUE))
      41             :         ,aMF_VALUE(this,    ModuleRes( MF_VALUE))
      42             :         ,aCB_STANDARD(this, ModuleRes(CB_STANDARD))
      43             :         ,aPB_OK(this,       ModuleRes(PB_OK))
      44             :         ,aPB_CANCEL(this,   ModuleRes(PB_CANCEL))
      45           0 :         ,aPB_HELP(this,     ModuleRes(PB_HELP))
      46             : {
      47             :     DBG_CTOR(DlgSize,NULL);
      48             : 
      49           0 :     if ( _nAlternativeStandard > 0 )
      50           0 :         m_nStandard = _nAlternativeStandard;
      51           0 :     aCB_STANDARD.SetClickHdl(LINK(this,DlgSize,CbClickHdl));
      52             : 
      53           0 :     aMF_VALUE.EnableEmptyFieldValue(sal_True);
      54           0 :     sal_Bool bDefault = -1 == nVal;
      55           0 :     aCB_STANDARD.Check(bDefault);
      56           0 :     if (bDefault)
      57             :     {
      58           0 :         SetValue(m_nStandard);
      59           0 :         m_nPrevValue = m_nStandard;
      60             :     }
      61           0 :     LINK(this,DlgSize,CbClickHdl).Call(&aCB_STANDARD);
      62             : 
      63           0 :     FreeResource();
      64           0 : }
      65             : 
      66             : //------------------------------------------------------------------------------
      67           0 : DlgSize::~DlgSize()
      68             : {
      69             : 
      70             :     DBG_DTOR(DlgSize,NULL);
      71           0 : }
      72             : 
      73             : //------------------------------------------------------------------------------
      74           0 : void DlgSize::SetValue( sal_Int32 nVal )
      75             : {
      76           0 :     aMF_VALUE.SetValue(nVal, FUNIT_CM );
      77           0 : }
      78             : 
      79             : //------------------------------------------------------------------------------
      80           0 : sal_Int32 DlgSize::GetValue()
      81             : {
      82           0 :     if (aCB_STANDARD.IsChecked())
      83           0 :         return -1;
      84           0 :     return (sal_Int32)aMF_VALUE.GetValue( FUNIT_CM );
      85             : }
      86             : 
      87             : //------------------------------------------------------------------------------
      88           0 : IMPL_LINK( DlgSize, CbClickHdl, Button *, pButton )
      89             : {
      90             : 
      91           0 :     if( pButton == &aCB_STANDARD )
      92             :     {
      93           0 :         aMF_VALUE.Enable(!aCB_STANDARD.IsChecked());
      94           0 :         if (aCB_STANDARD.IsChecked())
      95             :         {
      96           0 :             m_nPrevValue = static_cast<sal_Int32>(aMF_VALUE.GetValue(FUNIT_CM));
      97             :                 // don't use getValue as this will use aCB_STANDARD.to determine if we're standard
      98           0 :             aMF_VALUE.SetEmptyFieldValue();
      99             :         }
     100             :         else
     101             :         {
     102           0 :             SetValue( m_nPrevValue );
     103             :         }
     104             :     }
     105           0 :     return 0;
     106             : }
     107             : // -----------------------------------------------------------------------------
     108             : //.........................................................................
     109             : }   // namespace dbaui
     110             : //.........................................................................
     111             : 
     112             : 
     113             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10