LCOV - code coverage report
Current view: top level - sc/source/core/tool - zforauto.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 17 34 50.0 %
Date: 2012-08-25 Functions: 4 7 57.1 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 6 22 27.3 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include <svl/zforlist.hxx>
      31                 :            : #include <svl/zformat.hxx>
      32                 :            : #include <vcl/svapp.hxx>
      33                 :            : 
      34                 :            : #include "zforauto.hxx"
      35                 :            : #include "global.hxx"
      36                 :            : 
      37                 :            : static const sal_Char pStandardName[] = "Standard";
      38                 :            : 
      39                 :            : //------------------------------------------------------------------------
      40                 :            : 
      41                 :        288 : ScNumFormatAbbrev::ScNumFormatAbbrev() :
      42                 :            :     sFormatstring   ( RTL_CONSTASCII_USTRINGPARAM( pStandardName ) ),
      43                 :            :     eLnge           (LANGUAGE_SYSTEM),
      44                 :        288 :     eSysLnge        (LANGUAGE_GERMAN)       // sonst passt "Standard" nicht
      45                 :            : {
      46                 :        288 : }
      47                 :            : 
      48                 :         32 : ScNumFormatAbbrev::ScNumFormatAbbrev(const ScNumFormatAbbrev& aFormat) :
      49                 :            :     sFormatstring   (aFormat.sFormatstring),
      50                 :            :     eLnge           (aFormat.eLnge),
      51                 :         32 :     eSysLnge        (aFormat.eSysLnge)
      52                 :            : {
      53                 :         32 : }
      54                 :            : 
      55                 :          0 : ScNumFormatAbbrev::ScNumFormatAbbrev(sal_uLong nFormat,
      56                 :          0 :                                      SvNumberFormatter& rFormatter)
      57                 :            : {
      58         [ #  # ]:          0 :     PutFormatIndex(nFormat, rFormatter);
      59                 :          0 : }
      60                 :            : 
      61                 :        256 : void ScNumFormatAbbrev::Load( SvStream& rStream, CharSet eByteStrSet )
      62                 :            : {
      63                 :            :     sal_uInt16 nSysLang, nLang;
      64 [ +  - ][ +  - ]:        256 :     sFormatstring = rStream.ReadUniOrByteString( eByteStrSet );
      65 [ +  - ][ +  - ]:        256 :     rStream >> nSysLang >> nLang;
      66                 :        256 :     eLnge = (LanguageType) nLang;
      67                 :        256 :     eSysLnge = (LanguageType) nSysLang;
      68         [ -  + ]:        256 :     if ( eSysLnge == LANGUAGE_SYSTEM )          // old versions did write it
      69 [ #  # ][ #  # ]:          0 :         eSysLnge = Application::GetSettings().GetLanguage();
      70                 :        256 : }
      71                 :            : 
      72                 :        528 : void ScNumFormatAbbrev::Save( SvStream& rStream, CharSet eByteStrSet ) const
      73                 :            : {
      74         [ +  - ]:        528 :     rStream.WriteUniOrByteString( sFormatstring, eByteStrSet );
      75                 :        528 :     rStream << (sal_uInt16) eSysLnge << (sal_uInt16) eLnge;
      76                 :        528 : }
      77                 :            : 
      78                 :          0 : void ScNumFormatAbbrev::PutFormatIndex(sal_uLong nFormat,
      79                 :            :                                        SvNumberFormatter& rFormatter)
      80                 :            : {
      81                 :          0 :     const SvNumberformat* pFormat = rFormatter.GetEntry(nFormat);
      82         [ #  # ]:          0 :     if (pFormat)
      83                 :            :     {
      84                 :          0 :         eSysLnge = Application::GetSettings().GetLanguage();
      85                 :          0 :         eLnge = pFormat->GetLanguage();
      86                 :          0 :         sFormatstring = ((SvNumberformat*)pFormat)->GetFormatstring();
      87                 :            :     }
      88                 :            :     else
      89                 :            :     {
      90                 :            :         OSL_FAIL("SCNumFormatAbbrev:: unbekanntes Zahlformat");
      91                 :          0 :         eLnge = LANGUAGE_SYSTEM;
      92                 :          0 :         eSysLnge = LANGUAGE_GERMAN;     // sonst passt "Standard" nicht
      93                 :          0 :         sFormatstring.AssignAscii( RTL_CONSTASCII_STRINGPARAM( pStandardName ) );
      94                 :            :     }
      95                 :          0 : }
      96                 :            : 
      97                 :          0 : sal_uLong ScNumFormatAbbrev::GetFormatIndex( SvNumberFormatter& rFormatter)
      98                 :            : {
      99                 :            :     short nType;
     100                 :            :     bool bNewInserted;
     101                 :            :     xub_StrLen nCheckPos;
     102                 :            :     return rFormatter.GetIndexPuttingAndConverting( sFormatstring, eLnge,
     103         [ #  # ]:          0 :             eSysLnge, nType, bNewInserted, nCheckPos);
     104                 :            : }
     105                 :            : 
     106                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10