LCOV - code coverage report
Current view: top level - sc/source/ui/miscdlgs - mtrindlg.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 32 0.0 %
Date: 2014-04-14 Functions: 0 6 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             : 
      24             : 
      25             : #include "mtrindlg.hxx"
      26             : #include "scresid.hxx"
      27             : #include "miscdlgs.hrc"
      28             : 
      29             : 
      30           0 : ScMetricInputDlg::ScMetricInputDlg( Window*         pParent,
      31             :                                     const OString&  sDialogName,
      32             :                                     long            nCurrent,
      33             :                                     long            nDefault,
      34             :                                     FieldUnit       eFUnit,
      35             :                                     sal_uInt16      nDecimals,
      36             :                                     long            nMaximum,
      37             :                                     long            nMinimum,
      38             :                                     long            nFirst,
      39             :                                     long            nLast )
      40             : 
      41             :     :   ModalDialog(pParent, sDialogName,
      42           0 :             OStringToOUString("modules/scalc/ui/" +
      43           0 :                 sDialogName.toAsciiLowerCase() + ".ui", RTL_TEXTENCODING_UTF8))
      44             : {
      45           0 :     get(m_pEdValue, "value");
      46           0 :     get(m_pBtnDefVal, "default");
      47             : 
      48           0 :     m_pBtnDefVal->SetClickHdl ( LINK( this, ScMetricInputDlg, SetDefValHdl ) );
      49           0 :     m_pEdValue->SetModifyHdl( LINK( this, ScMetricInputDlg, ModifyHdl    ) );
      50             : 
      51           0 :     m_pEdValue->SetUnit            ( eFUnit );
      52           0 :     m_pEdValue->SetDecimalDigits   ( nDecimals );
      53           0 :     m_pEdValue->SetMax             ( m_pEdValue->Normalize( nMaximum ), FUNIT_TWIP );
      54           0 :     m_pEdValue->SetMin             ( m_pEdValue->Normalize( nMinimum ), FUNIT_TWIP );
      55           0 :     m_pEdValue->SetLast            ( m_pEdValue->Normalize( nLast ),    FUNIT_TWIP );
      56           0 :     m_pEdValue->SetFirst           ( m_pEdValue->Normalize( nFirst ),   FUNIT_TWIP );
      57           0 :     m_pEdValue->SetSpinSize        ( m_pEdValue->Normalize( 1 ) / 10 );
      58           0 :     m_pEdValue->SetValue           ( m_pEdValue->Normalize( nDefault ), FUNIT_TWIP );
      59           0 :     nDefaultValue = sal::static_int_cast<long>( m_pEdValue->GetValue() );
      60           0 :     m_pEdValue->SetValue           ( m_pEdValue->Normalize( nCurrent ), FUNIT_TWIP );
      61           0 :     nCurrentValue = sal::static_int_cast<long>( m_pEdValue->GetValue() );
      62           0 :     m_pBtnDefVal->Check( nCurrentValue == nDefaultValue );
      63           0 : }
      64             : 
      65           0 : long ScMetricInputDlg::GetInputValue( FieldUnit eUnit ) const
      66             : {
      67             : /*
      68             :     mit Nachkommastellen:
      69             : 
      70             :     double  nVal    = m_pEdValue->GetValue( eUnit );
      71             :     sal_uInt16  nDecs   = m_pEdValue->GetDecimalDigits();
      72             :     double  nFactor = 0.0;
      73             : 
      74             :     // static long ImpPower10( sal_uInt16 nDecs )
      75             :     {
      76             :         nFactor = 1.0;
      77             : 
      78             :         for ( sal_uInt16 i=0; i < nDecs; i++ )
      79             :             nFactor *= 10.0;
      80             :     }
      81             : 
      82             :     return nVal / nFactor;
      83             : */
      84             :     // erstmal Nachkommastellen abschneiden - nich so doll...
      85             : 
      86           0 :     return sal::static_int_cast<long>( m_pEdValue->Denormalize( m_pEdValue->GetValue( eUnit ) ) );
      87             : }
      88             : 
      89             : 
      90             : // Handler:
      91             : 
      92           0 : IMPL_LINK_NOARG(ScMetricInputDlg, SetDefValHdl)
      93             : {
      94           0 :     if ( m_pBtnDefVal->IsChecked() )
      95             :     {
      96           0 :         nCurrentValue = sal::static_int_cast<long>( m_pEdValue->GetValue() );
      97           0 :         m_pEdValue->SetValue( nDefaultValue );
      98             :     }
      99             :     else
     100           0 :         m_pEdValue->SetValue( nCurrentValue );
     101           0 :     return 0;
     102             : }
     103             : 
     104           0 : IMPL_LINK_NOARG_INLINE_START(ScMetricInputDlg, ModifyHdl)
     105             : {
     106           0 :     m_pBtnDefVal->Check( nDefaultValue == m_pEdValue->GetValue() );
     107           0 :     return 0;
     108             : }
     109           0 : IMPL_LINK_NOARG_INLINE_END(ScMetricInputDlg, ModifyHdl)
     110             : 
     111             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10