LCOV - code coverage report
Current view: top level - sc/source/filter/xml - xmlconti.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 11 32 34.4 %
Date: 2014-04-11 Functions: 5 6 83.3 %
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 "xmlconti.hxx"
      21             : #include "xmlimprt.hxx"
      22             : #include "global.hxx"
      23             : #include "document.hxx"
      24             : 
      25             : #include <xmloff/xmltkmap.hxx>
      26             : #include <xmloff/nmspmap.hxx>
      27             : #include <xmloff/xmlnmspe.hxx>
      28             : #include <xmloff/xmltoken.hxx>
      29             : 
      30             : using namespace xmloff::token;
      31             : 
      32          21 : ScXMLContentContext::ScXMLContentContext( ScXMLImport& rImport,
      33             :                                       sal_uInt16 nPrfx,
      34             :                                       const OUString& rLName,
      35             :                                       const ::com::sun::star::uno::Reference<
      36             :                                       ::com::sun::star::xml::sax::XAttributeList>& /* xAttrList */,
      37             :                                       OUStringBuffer& sTempValue) :
      38             :     SvXMLImportContext( rImport, nPrfx, rLName ),
      39             :     sOUText(),
      40          21 :     sValue(sTempValue)
      41             : {
      42          21 : }
      43             : 
      44          42 : ScXMLContentContext::~ScXMLContentContext()
      45             : {
      46          42 : }
      47             : 
      48           0 : SvXMLImportContext *ScXMLContentContext::CreateChildContext( sal_uInt16 nPrefix,
      49             :                                             const OUString& rLName,
      50             :                                             const ::com::sun::star::uno::Reference<
      51             :                                           ::com::sun::star::xml::sax::XAttributeList>& xAttrList )
      52             : {
      53           0 :     SvXMLImportContext *pContext = 0;
      54             : 
      55           0 :     if ((nPrefix == XML_NAMESPACE_TEXT) && IsXMLToken(rLName, XML_S))
      56             :     {
      57           0 :         sal_Int32 nRepeat(0);
      58           0 :         sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
      59           0 :         for( sal_Int16 i=0; i < nAttrCount; ++i )
      60             :         {
      61           0 :             const OUString& sAttrName(xAttrList->getNameByIndex( i ));
      62           0 :             const OUString& sAttrValue(xAttrList->getValueByIndex( i ));
      63           0 :             OUString aLocalName;
      64           0 :             sal_uInt16 nPrfx = GetScImport().GetNamespaceMap().GetKeyByAttrName(
      65           0 :                                                 sAttrName, &aLocalName );
      66           0 :             if ((nPrfx == XML_NAMESPACE_TEXT) && IsXMLToken(aLocalName, XML_C))
      67           0 :                 nRepeat = sAttrValue.toInt32();
      68           0 :         }
      69           0 :         if (nRepeat)
      70           0 :             for (sal_Int32 j = 0; j < nRepeat; ++j)
      71           0 :                 sOUText.append(' ');
      72             :         else
      73           0 :             sOUText.append(' ');
      74             :     }
      75             : 
      76           0 :     if( !pContext )
      77           0 :         pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
      78             : 
      79           0 :     return pContext;
      80             : }
      81             : 
      82          21 : void ScXMLContentContext::Characters( const OUString& rChars )
      83             : {
      84          21 :     sOUText.append(rChars);
      85          21 : }
      86             : 
      87          21 : void ScXMLContentContext::EndElement()
      88             : {
      89          21 :     sValue.append(sOUText.toString());
      90          21 : }
      91             : 
      92             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10