LCOV - code coverage report
Current view: top level - sc/source/filter/xml - XMLCellRangeSourceContext.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 40 2.5 %
Date: 2014-11-03 Functions: 2 8 25.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 "XMLCellRangeSourceContext.hxx"
      21             : 
      22             : #include <sax/tools/converter.hxx>
      23             : 
      24             : #include <xmloff/nmspmap.hxx>
      25             : #include "xmlimprt.hxx"
      26             : 
      27             : using namespace ::com::sun::star;
      28             : 
      29           0 : ScMyImpCellRangeSource::ScMyImpCellRangeSource() :
      30             :     nColumns( 0 ),
      31             :     nRows( 0 ),
      32           0 :     nRefresh( 0 )
      33             : {
      34           0 : }
      35             : 
      36           0 : ScXMLCellRangeSourceContext::ScXMLCellRangeSourceContext(
      37             :         ScXMLImport& rImport,
      38             :         sal_uInt16 nPrfx,
      39             :         const OUString& rLName,
      40             :         const uno::Reference< xml::sax::XAttributeList >& xAttrList,
      41             :         ScMyImpCellRangeSource* pCellRangeSource ) :
      42           0 :     SvXMLImportContext( rImport, nPrfx, rLName )
      43             : {
      44           0 :     if( !xAttrList.is() ) return;
      45             : 
      46           0 :     sal_Int16               nAttrCount      = xAttrList->getLength();
      47           0 :     const SvXMLTokenMap&    rAttrTokenMap   = GetScImport().GetTableCellRangeSourceAttrTokenMap();
      48             : 
      49           0 :     for( sal_Int16 nIndex = 0; nIndex < nAttrCount; ++nIndex )
      50             :     {
      51           0 :         const OUString& sAttrName(xAttrList->getNameByIndex( nIndex ));
      52           0 :         const OUString& sValue(xAttrList->getValueByIndex( nIndex ));
      53           0 :         OUString aLocalName;
      54           0 :         sal_uInt16 nPrefix      = GetScImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
      55             : 
      56           0 :         switch( rAttrTokenMap.Get( nPrefix, aLocalName ) )
      57             :         {
      58             :             case XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_NAME:
      59           0 :                 pCellRangeSource->sSourceStr = sValue;
      60           0 :             break;
      61             :             case XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_FILTER_NAME:
      62           0 :                 pCellRangeSource->sFilterName = sValue;
      63           0 :             break;
      64             :             case XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_FILTER_OPTIONS:
      65           0 :                 pCellRangeSource->sFilterOptions = sValue;
      66           0 :             break;
      67             :             case XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_HREF:
      68           0 :                 pCellRangeSource->sURL = GetScImport().GetAbsoluteReference(sValue);
      69           0 :             break;
      70             :             case XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_LAST_COLUMN:
      71             :             {
      72             :                 sal_Int32 nValue;
      73           0 :                 if (::sax::Converter::convertNumber( nValue, sValue, 1 ))
      74           0 :                     pCellRangeSource->nColumns = nValue;
      75             :                 else
      76           0 :                     pCellRangeSource->nColumns = 1;
      77             :             }
      78           0 :             break;
      79             :             case XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_LAST_ROW:
      80             :             {
      81             :                 sal_Int32 nValue;
      82           0 :                 if (::sax::Converter::convertNumber( nValue, sValue, 1 ))
      83           0 :                     pCellRangeSource->nRows = nValue;
      84             :                 else
      85           0 :                     pCellRangeSource->nRows = 1;
      86             :             }
      87           0 :             break;
      88             :             case XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_REFRESH_DELAY:
      89             :             {
      90             :                 double fTime;
      91           0 :                 if (::sax::Converter::convertDuration( fTime, sValue ))
      92           0 :                     pCellRangeSource->nRefresh = std::max( (sal_Int32)(fTime * 86400.0), (sal_Int32)0 );
      93             :             }
      94           0 :             break;
      95             :         }
      96           0 :     }
      97             : }
      98             : 
      99           0 : ScXMLCellRangeSourceContext::~ScXMLCellRangeSourceContext()
     100             : {
     101           0 : }
     102             : 
     103           0 : SvXMLImportContext *ScXMLCellRangeSourceContext::CreateChildContext(
     104             :         sal_uInt16 nPrefix,
     105             :         const OUString& rLName,
     106             :         const uno::Reference< xml::sax::XAttributeList>& /* xAttrList */ )
     107             : {
     108           0 :     return new SvXMLImportContext( GetImport(), nPrefix, rLName );
     109             : }
     110             : 
     111           0 : void ScXMLCellRangeSourceContext::EndElement()
     112             : {
     113         228 : }
     114             : 
     115             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10