LCOV - code coverage report
Current view: top level - sc/source/core/tool - zforauto.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 18 35 51.4 %
Date: 2015-06-13 12:38:46 Functions: 6 9 66.7 %
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 <svl/zforlist.hxx>
      21             : #include <svl/zformat.hxx>
      22             : #include <vcl/svapp.hxx>
      23             : #include <vcl/settings.hxx>
      24             : 
      25             : #include "zforauto.hxx"
      26             : #include "global.hxx"
      27             : 
      28         560 : ScNumFormatAbbrev::ScNumFormatAbbrev() :
      29             :     sFormatstring   ( "Standard" ),
      30             :     eLnge           (LANGUAGE_SYSTEM),
      31         560 :     eSysLnge        (LANGUAGE_GERMAN)       // sonst passt "Standard" nicht
      32             : {
      33         560 : }
      34             : 
      35          32 : ScNumFormatAbbrev::ScNumFormatAbbrev(const ScNumFormatAbbrev& aFormat) :
      36             :     sFormatstring   (aFormat.sFormatstring),
      37             :     eLnge           (aFormat.eLnge),
      38          32 :     eSysLnge        (aFormat.eSysLnge)
      39             : {
      40          32 : }
      41             : 
      42           0 : ScNumFormatAbbrev::ScNumFormatAbbrev(sal_uLong nFormat,
      43           0 :                                      SvNumberFormatter& rFormatter)
      44             : {
      45           0 :     PutFormatIndex(nFormat, rFormatter);
      46           0 : }
      47             : 
      48         512 : void ScNumFormatAbbrev::Load( SvStream& rStream, rtl_TextEncoding eByteStrSet )
      49             : {
      50             :     sal_uInt16 nSysLang, nLang;
      51         512 :     sFormatstring = rStream.ReadUniOrByteString( eByteStrSet );
      52         512 :     rStream.ReadUInt16( nSysLang ).ReadUInt16( nLang );
      53         512 :     eLnge = (LanguageType) nLang;
      54         512 :     eSysLnge = (LanguageType) nSysLang;
      55         512 :     if ( eSysLnge == LANGUAGE_SYSTEM )          // old versions did write it
      56           0 :         eSysLnge = Application::GetSettings().GetLanguageTag().getLanguageType();
      57         512 : }
      58             : 
      59         528 : void ScNumFormatAbbrev::Save( SvStream& rStream, rtl_TextEncoding eByteStrSet ) const
      60             : {
      61         528 :     rStream.WriteUniOrByteString( sFormatstring, eByteStrSet );
      62         528 :     rStream.WriteUInt16( eSysLnge ).WriteUInt16( eLnge );
      63         528 : }
      64             : 
      65           0 : void ScNumFormatAbbrev::PutFormatIndex(sal_uLong nFormat,
      66             :                                        SvNumberFormatter& rFormatter)
      67             : {
      68           0 :     const SvNumberformat* pFormat = rFormatter.GetEntry(nFormat);
      69           0 :     if (pFormat)
      70             :     {
      71           0 :         eSysLnge = Application::GetSettings().GetLanguageTag().getLanguageType();
      72           0 :         eLnge = pFormat->GetLanguage();
      73           0 :         sFormatstring = pFormat->GetFormatstring();
      74             :     }
      75             :     else
      76             :     {
      77             :         OSL_FAIL("SCNumFormatAbbrev:: unknown number format");
      78           0 :         eLnge = LANGUAGE_SYSTEM;
      79           0 :         eSysLnge = LANGUAGE_GERMAN;     // sonst passt "Standard" nicht
      80           0 :         sFormatstring = "Standard";
      81             :     }
      82           0 : }
      83             : 
      84           0 : sal_uLong ScNumFormatAbbrev::GetFormatIndex( SvNumberFormatter& rFormatter)
      85             : {
      86             :     short nType;
      87             :     bool bNewInserted;
      88             :     sal_Int32 nCheckPos;
      89             :     return rFormatter.GetIndexPuttingAndConverting( sFormatstring, eLnge,
      90           0 :                                                     eSysLnge, nType, bNewInserted, nCheckPos);
      91         156 : }
      92             : 
      93             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11