LCOV - code coverage report
Current view: top level - libreoffice/chart2/source/controller/main - ConfigurationAccess.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 26 0.0 %
Date: 2012-12-27 Functions: 0 8 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             : #include "ConfigurationAccess.hxx"
      22             : #include "macros.hxx"
      23             : 
      24             : // header for class SvtSysLocale
      25             : #include <unotools/syslocale.hxx>
      26             : // header for class ConfigItem
      27             : #include <unotools/configitem.hxx>
      28             : // header for rtl::Static
      29             : #include <rtl/instance.hxx>
      30             : 
      31             : 
      32             : //.............................................................................
      33             : namespace chart
      34             : {
      35             : //.............................................................................
      36             : using namespace ::com::sun::star;
      37             : 
      38             : namespace
      39             : {
      40           0 : bool lcl_IsMetric()
      41             : {
      42           0 :     SvtSysLocale aSysLocale;
      43           0 :     const LocaleDataWrapper* pLocWrapper = aSysLocale.GetLocaleDataPtr();
      44           0 :     MeasurementSystem eSys = pLocWrapper->getMeasurementSystemEnum();
      45             : 
      46           0 :     return ( eSys == MEASURE_METRIC );
      47             : }
      48             : }//end anonymous namespace
      49             : 
      50             : // ----------------------------------------
      51             : 
      52             : class CalcConfigItem : public ::utl::ConfigItem
      53             : {
      54             : public:
      55             :     CalcConfigItem();
      56             :     virtual ~CalcConfigItem();
      57             : 
      58             :     FieldUnit getFieldUnit();
      59             :     virtual void                    Commit();
      60             :     virtual void                    Notify( const uno::Sequence<rtl::OUString>& aPropertyNames);
      61             : };
      62             : 
      63           0 : CalcConfigItem::CalcConfigItem()
      64           0 :     : ConfigItem( ::rtl::OUString( C2U( "Office.Calc/Layout" )))
      65             : {
      66           0 : }
      67             : 
      68           0 : CalcConfigItem::~CalcConfigItem()
      69             : {
      70           0 : }
      71             : 
      72           0 : void CalcConfigItem::Commit() {}
      73           0 : void CalcConfigItem::Notify( const uno::Sequence<rtl::OUString>& ) {}
      74             : 
      75           0 : FieldUnit CalcConfigItem::getFieldUnit()
      76             : {
      77           0 :     FieldUnit eResult( FUNIT_CM );
      78             : 
      79           0 :     uno::Sequence< ::rtl::OUString > aNames( 1 );
      80           0 :     if( lcl_IsMetric() )
      81           0 :         aNames[ 0 ] = ::rtl::OUString( C2U( "Other/MeasureUnit/Metric" ));
      82             :     else
      83           0 :         aNames[ 0 ] = ::rtl::OUString( C2U( "Other/MeasureUnit/NonMetric" ));
      84             : 
      85           0 :     uno::Sequence< uno::Any > aResult( GetProperties( aNames ));
      86           0 :     sal_Int32 nValue = 0;
      87           0 :     if( aResult[ 0 ] >>= nValue )
      88           0 :         eResult = static_cast< FieldUnit >( nValue );
      89             : 
      90           0 :     return eResult;
      91             : }
      92             : 
      93             : namespace
      94             : {
      95             :     //a CalcConfigItem Singleton
      96             :     struct theCalcConfigItem : public rtl::Static< CalcConfigItem, theCalcConfigItem > {};
      97             : }
      98             : 
      99             : namespace ConfigurationAccess
     100             : {
     101           0 :     FieldUnit getFieldUnit()
     102             :     {
     103           0 :         FieldUnit aUnit( theCalcConfigItem::get().getFieldUnit() );
     104           0 :         return aUnit;
     105             :     }
     106             : } //namespace ConfigurationAccess
     107             : 
     108             : //.............................................................................
     109             : } //namespace chart
     110             : //.............................................................................
     111             : 
     112             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10