LCOV - code coverage report
Current view: top level - sw/source/ui/table - colwd.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 31 0.0 %
Date: 2014-11-03 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             : #include <sfx2/dispatch.hxx>
      21             : #include <svx/dlgutil.hxx>
      22             : #include <colwd.hxx>
      23             : #include <tablemgr.hxx>
      24             : #include <wrtsh.hxx>
      25             : #include <wdocsh.hxx>
      26             : #include <view.hxx>
      27             : #include <swmodule.hxx>
      28             : #include <modcfg.hxx>
      29             : #include <usrpref.hxx>
      30             : 
      31             : #include <cmdid.h>
      32             : #include <table.hrc>
      33             : 
      34           0 : IMPL_LINK_NOARG_INLINE_START(SwTableWidthDlg, LoseFocusHdl)
      35             : {
      36           0 :     sal_uInt16 nId = (sal_uInt16)m_pColNF->GetValue()-1;
      37           0 :     const SwTwips lWidth = rFnc.GetColWidth(nId);
      38           0 :     m_pWidthMF->SetMax(m_pWidthMF->Normalize(rFnc.GetMaxColWidth(nId)), FUNIT_TWIP);
      39           0 :     m_pWidthMF->SetValue(m_pWidthMF->Normalize(lWidth), FUNIT_TWIP);
      40           0 :     return 0;
      41             : }
      42           0 : IMPL_LINK_NOARG_INLINE_END(SwTableWidthDlg, LoseFocusHdl)
      43             : 
      44           0 : SwTableWidthDlg::SwTableWidthDlg(vcl::Window *pParent, SwTableFUNC &rTableFnc )
      45             :     : SvxStandardDialog( pParent, "ColumnWidthDialog", "modules/swriter/ui/columnwidth.ui" )
      46           0 :     , rFnc(rTableFnc)
      47             : {
      48           0 :     get(m_pColNF, "column");
      49           0 :     get(m_pWidthMF, "width");
      50             : 
      51           0 :     bool bIsWeb = rTableFnc.GetShell()
      52           0 :                   && (0 != PTR_CAST( SwWebDocShell,
      53           0 :                                      rTableFnc.GetShell()->GetView().GetDocShell()) );
      54           0 :     FieldUnit eFieldUnit = SW_MOD()->GetUsrPref( bIsWeb )->GetMetric();
      55           0 :     ::SetFieldUnit(*m_pWidthMF, eFieldUnit);
      56             : 
      57           0 :     m_pColNF->SetValue( rFnc.GetCurColNum() +1 );
      58           0 :     m_pWidthMF->SetMin(m_pWidthMF->Normalize(MINLAY), FUNIT_TWIP);
      59           0 :     if(!m_pWidthMF->GetMin())
      60           0 :         m_pWidthMF->SetMin(1);
      61             : 
      62           0 :     if(rFnc.GetColCount() == 0)
      63           0 :         m_pWidthMF->SetMin(m_pWidthMF->Normalize(rFnc.GetColWidth(0)), FUNIT_TWIP);
      64           0 :     m_pColNF->SetMax(rFnc.GetColCount() +1 );
      65           0 :     m_pColNF->SetModifyHdl(LINK(this,SwTableWidthDlg, LoseFocusHdl));
      66           0 :     LoseFocusHdl();
      67           0 : }
      68             : 
      69           0 : void SwTableWidthDlg::Apply()
      70             : {
      71           0 :     rFnc.InitTabCols();
      72             :     rFnc.SetColWidth(
      73           0 :             static_cast< sal_uInt16 >(m_pColNF->GetValue() - 1),
      74           0 :             static_cast< sal_uInt16 >(m_pWidthMF->Denormalize(m_pWidthMF->GetValue(FUNIT_TWIP))));
      75           0 : }
      76             : 
      77             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10