LCOV - code coverage report
Current view: top level - dbaccess/source/ui/dlg - dlgsize.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 1 39 2.6 %
Date: 2015-06-13 12:38:46 Functions: 2 10 20.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.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 ? OUString("RowHeightDialog") : OUString("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 : DlgSize::~DlgSize()
      55             : {
      56           0 :     disposeOnce();
      57           0 : }
      58             : 
      59           0 : void DlgSize::dispose()
      60             : {
      61           0 :     m_pMF_VALUE.clear();
      62           0 :     m_pCB_STANDARD.clear();
      63           0 :     ModalDialog::dispose();
      64           0 : }
      65             : 
      66             : 
      67           0 : void DlgSize::SetValue( sal_Int32 nVal )
      68             : {
      69           0 :     m_pMF_VALUE->SetValue(nVal, FUNIT_CM );
      70           0 : }
      71             : 
      72           0 : sal_Int32 DlgSize::GetValue()
      73             : {
      74           0 :     if (m_pCB_STANDARD->IsChecked())
      75           0 :         return -1;
      76           0 :     return (sal_Int32)m_pMF_VALUE->GetValue( FUNIT_CM );
      77             : }
      78             : 
      79           0 : IMPL_LINK( DlgSize, CbClickHdl, Button *, pButton )
      80             : {
      81             : 
      82           0 :     if( pButton == m_pCB_STANDARD )
      83             :     {
      84           0 :         m_pMF_VALUE->Enable(!m_pCB_STANDARD->IsChecked());
      85           0 :         if (m_pCB_STANDARD->IsChecked())
      86             :         {
      87           0 :             m_nPrevValue = static_cast<sal_Int32>(m_pMF_VALUE->GetValue(FUNIT_CM));
      88             :                 // don't use getValue as this will use m_pCB_STANDARD->to determine if we're standard
      89           0 :             m_pMF_VALUE->SetEmptyFieldValue();
      90             :         }
      91             :         else
      92             :         {
      93           0 :             SetValue( m_nPrevValue );
      94             :         }
      95             :     }
      96           0 :     return 0;
      97             : }
      98             : 
      99          36 : }   // namespace dbaui
     100             : 
     101             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11