LCOV - code coverage report
Current view: top level - xmloff/source/text - XMLCalculationSettingsContext.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 28 0.0 %
Date: 2012-08-25 Functions: 0 4 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 44 0.0 %

           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 <XMLCalculationSettingsContext.hxx>
      31                 :            : 
      32                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      33                 :            : #include <com/sun/star/text/XTextDocument.hpp>
      34                 :            : 
      35                 :            : #include <sax/tools/converter.hxx>
      36                 :            : 
      37                 :            : #include <xmloff/xmlimp.hxx>
      38                 :            : #include <xmloff/nmspmap.hxx>
      39                 :            : #include "xmloff/xmlnmspe.hxx"
      40                 :            : #include <xmloff/xmltoken.hxx>
      41                 :            : 
      42                 :            : 
      43                 :            : using ::rtl::OUString;
      44                 :            : using ::rtl::OUStringBuffer;
      45                 :            : 
      46                 :            : using namespace ::com::sun::star::uno;
      47                 :            : using namespace ::com::sun::star::beans;
      48                 :            : using namespace ::com::sun::star::text;
      49                 :            : using namespace ::xmloff::token;
      50                 :            : 
      51                 :          0 : XMLCalculationSettingsContext::XMLCalculationSettingsContext( SvXMLImport& rImport,
      52                 :            :                                     sal_uInt16 p_nPrefix,
      53                 :            :                                     const ::rtl::OUString& rLocalName,
      54                 :            :                                      const ::com::sun::star::uno::Reference<
      55                 :            :                                          ::com::sun::star::xml::sax::XAttributeList >& xAttrList )
      56                 :            : : SvXMLImportContext ( rImport, p_nPrefix, rLocalName )
      57                 :          0 : , nYear( 1930 )
      58                 :            : {
      59 [ #  # ][ #  # ]:          0 :     sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
                 [ #  # ]
      60         [ #  # ]:          0 :     for( sal_Int16 i=0; i < nAttrCount; i++ )
      61                 :            :     {
      62 [ #  # ][ #  # ]:          0 :         rtl::OUString sAttrName = xAttrList->getNameByIndex( i );
      63                 :          0 :         rtl::OUString aLocalName;
      64                 :          0 :         sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName(
      65         [ #  # ]:          0 :                                             sAttrName, &aLocalName );
      66 [ #  # ][ #  # ]:          0 :         rtl::OUString sValue = xAttrList->getValueByIndex( i );
      67                 :            : 
      68         [ #  # ]:          0 :         if (nPrefix == XML_NAMESPACE_TABLE)
      69                 :            :         {
      70 [ #  # ][ #  # ]:          0 :             if ( IsXMLToken( aLocalName, XML_NULL_YEAR ) )
      71                 :            :             {
      72                 :            :                 sal_Int32 nTemp;
      73         [ #  # ]:          0 :                 ::sax::Converter::convertNumber(nTemp, sValue);
      74                 :          0 :                 nYear= static_cast <sal_Int16> (nTemp);
      75                 :            :             }
      76                 :            :         }
      77                 :          0 :     }
      78                 :          0 : }
      79                 :            : 
      80                 :          0 : XMLCalculationSettingsContext::~XMLCalculationSettingsContext()
      81                 :            : {
      82         [ #  # ]:          0 : }
      83                 :          0 : void XMLCalculationSettingsContext::EndElement()
      84                 :            : {
      85         [ #  # ]:          0 :     if (nYear != 1930 )
      86                 :            :     {
      87         [ #  # ]:          0 :         Reference < XTextDocument > xTextDoc ( GetImport().GetModel(), UNO_QUERY);
      88         [ #  # ]:          0 :         if (xTextDoc.is())
      89                 :            :         {
      90         [ #  # ]:          0 :             Reference < XPropertySet > xPropSet ( xTextDoc, UNO_QUERY );
      91         [ #  # ]:          0 :             OUString sTwoDigitYear ( RTL_CONSTASCII_USTRINGPARAM ( "TwoDigitYear" ) );
      92                 :          0 :             Any aAny;
      93         [ #  # ]:          0 :             aAny <<= nYear;
      94 [ #  # ][ #  # ]:          0 :             xPropSet->setPropertyValue ( sTwoDigitYear, aAny );
      95                 :          0 :         }
      96                 :            :     }
      97                 :          0 : }
      98                 :            : 
      99                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10