LCOV - code coverage report
Current view: top level - dbaccess/source/ui/dlg - dlgsize.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 31 3.2 %
Date: 2014-11-03 Functions: 2 7 28.6 %
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.hxx"
      21             : #include "dbu_dlg.hrc"
      22             : #include "moduledbu.hxx"
      23             : 
      24             : namespace dbaui
      25             : {
      26             : 
      27             : #define DEF_ROW_HEIGHT  45
      28             : #define DEF_COL_WIDTH   227
      29             : 
      30           0 : DlgSize::DlgSize( vcl::Window* pParent, sal_Int32 nVal, bool bRow, sal_Int32 _nAlternativeStandard )
      31             :     : ModalDialog(pParent, bRow ? OString("RowHeightDialog") : OString("ColWidthDialog"),
      32             :         bRow ? OUString("dbaccess/ui/rowheightdialog.ui") : OUString("dbaccess/ui/colwidthdialog.ui"))
      33             :     , m_nPrevValue(nVal)
      34           0 :     , m_nStandard(bRow ? DEF_ROW_HEIGHT : DEF_COL_WIDTH)
      35             : {
      36           0 :     get(m_pMF_VALUE, "value");
      37           0 :     get(m_pCB_STANDARD, "automatic");
      38             : 
      39           0 :     if ( _nAlternativeStandard > 0 )
      40           0 :         m_nStandard = _nAlternativeStandard;
      41           0 :     m_pCB_STANDARD->SetClickHdl(LINK(this,DlgSize,CbClickHdl));
      42             : 
      43           0 :     m_pMF_VALUE->EnableEmptyFieldValue(true);
      44           0 :     bool bDefault = -1 == nVal;
      45           0 :     m_pCB_STANDARD->Check(bDefault);
      46           0 :     if (bDefault)
      47             :     {
      48           0 :         SetValue(m_nStandard);
      49           0 :         m_nPrevValue = m_nStandard;
      50             :     }
      51           0 :     LINK(this,DlgSize,CbClickHdl).Call(m_pCB_STANDARD);
      52           0 : }
      53             : 
      54           0 : void DlgSize::SetValue( sal_Int32 nVal )
      55             : {
      56           0 :     m_pMF_VALUE->SetValue(nVal, FUNIT_CM );
      57           0 : }
      58             : 
      59           0 : sal_Int32 DlgSize::GetValue()
      60             : {
      61           0 :     if (m_pCB_STANDARD->IsChecked())
      62           0 :         return -1;
      63           0 :     return (sal_Int32)m_pMF_VALUE->GetValue( FUNIT_CM );
      64             : }
      65             : 
      66           0 : IMPL_LINK( DlgSize, CbClickHdl, Button *, pButton )
      67             : {
      68             : 
      69           0 :     if( pButton == m_pCB_STANDARD )
      70             :     {
      71           0 :         m_pMF_VALUE->Enable(!m_pCB_STANDARD->IsChecked());
      72           0 :         if (m_pCB_STANDARD->IsChecked())
      73             :         {
      74           0 :             m_nPrevValue = static_cast<sal_Int32>(m_pMF_VALUE->GetValue(FUNIT_CM));
      75             :                 // don't use getValue as this will use m_pCB_STANDARD->to determine if we're standard
      76           0 :             m_pMF_VALUE->SetEmptyFieldValue();
      77             :         }
      78             :         else
      79             :         {
      80           0 :             SetValue( m_nPrevValue );
      81             :         }
      82             :     }
      83           0 :     return 0;
      84             : }
      85             : 
      86          72 : }   // namespace dbaui
      87             : 
      88             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10