LCOV - code coverage report
Current view: top level - xmloff/source/text - XMLLineNumberingSeparatorImportContext.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 25 0.0 %
Date: 2014-11-03 Functions: 0 11 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             : #include "XMLLineNumberingSeparatorImportContext.hxx"
      22             : 
      23             : #include <sax/tools/converter.hxx>
      24             : #include "XMLLineNumberingImportContext.hxx"
      25             : #include <xmloff/xmlimp.hxx>
      26             : #include <xmloff/nmspmap.hxx>
      27             : #include <xmloff/xmlnmspe.hxx>
      28             : #include <xmloff/xmltoken.hxx>
      29             : 
      30             : 
      31             : using namespace ::com::sun::star::uno;
      32             : 
      33             : using ::com::sun::star::xml::sax::XAttributeList;
      34             : using ::xmloff::token::IsXMLToken;
      35             : using ::xmloff::token::XML_INCREMENT;
      36             : 
      37           0 : TYPEINIT1( XMLLineNumberingSeparatorImportContext, SvXMLImportContext );
      38             : 
      39           0 : XMLLineNumberingSeparatorImportContext::XMLLineNumberingSeparatorImportContext(
      40             :     SvXMLImport& rImport,
      41             :     sal_uInt16 nPrfx,
      42             :     const OUString& rLocalName,
      43             :     XMLLineNumberingImportContext& rLineNumbering) :
      44             :         SvXMLImportContext(rImport, nPrfx, rLocalName),
      45           0 :         rLineNumberingContext(rLineNumbering)
      46             : {
      47           0 : }
      48             : 
      49           0 : XMLLineNumberingSeparatorImportContext::~XMLLineNumberingSeparatorImportContext()
      50             : {
      51           0 : }
      52             : 
      53           0 : void XMLLineNumberingSeparatorImportContext::StartElement(
      54             :     const Reference<XAttributeList> & xAttrList)
      55             : {
      56           0 :     sal_Int16 nLength = xAttrList->getLength();
      57           0 :     for(sal_Int16 i=0; i<nLength; i++)
      58             :     {
      59           0 :         OUString sLocalName;
      60           0 :         sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
      61           0 :             GetKeyByAttrName( xAttrList->getNameByIndex(i), &sLocalName );
      62             : 
      63           0 :         if ( (nPrefix == XML_NAMESPACE_TEXT) &&
      64           0 :              IsXMLToken(sLocalName, XML_INCREMENT) )
      65             :         {
      66             :             sal_Int32 nTmp;
      67           0 :             if (::sax::Converter::convertNumber(
      68           0 :                 nTmp, xAttrList->getValueByIndex(i), 0))
      69             :             {
      70           0 :                 rLineNumberingContext.SetSeparatorIncrement((sal_Int16)nTmp);
      71             :             }
      72             :             // else: invalid number -> ignore
      73             :         }
      74             :         // else: unknown attribute -> ignore
      75           0 :     }
      76           0 : }
      77             : 
      78           0 : void XMLLineNumberingSeparatorImportContext::Characters(
      79             :     const OUString& rChars )
      80             : {
      81           0 :     sSeparatorBuf.append(rChars);
      82           0 : }
      83             : 
      84           0 : void XMLLineNumberingSeparatorImportContext::EndElement()
      85             : {
      86           0 :     rLineNumberingContext.SetSeparatorText(sSeparatorBuf.makeStringAndClear());
      87           0 : }
      88             : 
      89             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10