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

Generated by: LCOV version 1.10