LCOV - code coverage report
Current view: top level - svx/source/dialog - dlgutil.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 3 26 11.5 %
Date: 2015-06-13 12:38:46 Functions: 3 5 60.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 "svx/dlgutil.hxx"
      21             : #include <svl/itemset.hxx>
      22             : #include <sfx2/sfxsids.hrc>
      23             : #include <sfx2/module.hxx>
      24             : #include <svl/intitem.hxx>
      25             : #include <svl/eitem.hxx>
      26             : #include <sfx2/viewfrm.hxx>
      27             : #include <sfx2/objsh.hxx>
      28             : 
      29             : 
      30             : 
      31           0 : FieldUnit GetModuleFieldUnit( const SfxItemSet& rSet )
      32             : {
      33           0 :     FieldUnit eUnit = FUNIT_INCH;
      34           0 :     const SfxPoolItem* pItem = NULL;
      35           0 :     if ( SfxItemState::SET == rSet.GetItemState( SID_ATTR_METRIC, false, &pItem ) )
      36           0 :         eUnit = (FieldUnit) static_cast<const SfxUInt16Item*>(pItem)->GetValue();
      37             :     else
      38             :     {
      39           0 :         return SfxModule::GetCurrentFieldUnit();
      40             :     }
      41             : 
      42           0 :     return eUnit;
      43             : }
      44             : 
      45           0 : bool GetApplyCharUnit( const SfxItemSet& rSet )
      46             : {
      47           0 :     bool  bUseCharUnit = false;
      48           0 :     const SfxPoolItem* pItem = NULL;
      49           0 :     if ( SfxItemState::SET == rSet.GetItemState( SID_ATTR_APPLYCHARUNIT, false, &pItem ) )
      50           0 :         bUseCharUnit =  static_cast<const SfxBoolItem*>(pItem)->GetValue();
      51             :     else
      52             :     {
      53             :         // FIXME - this might be wrong, cf. the DEV300 changes in GetModuleFieldUnit()
      54           0 :         SfxViewFrame* pFrame = SfxViewFrame::Current();
      55           0 :         SfxObjectShell* pSh = NULL;
      56           0 :         if ( pFrame )
      57           0 :             pSh = pFrame->GetObjectShell();
      58           0 :         if ( pSh )  // the object shell is not always available during reload
      59             :         {
      60           0 :             SfxModule* pModule = pSh->GetModule();
      61           0 :             if ( pModule )
      62             :             {
      63           0 :                 pItem = pModule->GetItem( SID_ATTR_APPLYCHARUNIT );
      64           0 :                 if ( pItem )
      65           0 :                     bUseCharUnit = static_cast<const SfxBoolItem*>(pItem)->GetValue();
      66             :             }
      67             :             else
      68             :             {
      69             :                 SAL_WARN( "svx.dialog", "GetApplyCharUnit(): no module found" );
      70             :             }
      71             :         }
      72             :     }
      73           0 :     return bUseCharUnit;
      74             : }
      75             : 
      76         337 : FieldUnit GetModuleFieldUnit()
      77             : {
      78         337 :     return SfxModule::GetCurrentFieldUnit();
      79         435 : }
      80             : 
      81             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11