LCOV - code coverage report
Current view: top level - libreoffice/xmloff/source/chart - SchXMLParagraphContext.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 35 0.0 %
Date: 2012-12-27 Functions: 0 7 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 "SchXMLImport.hxx"
      22             : #include "SchXMLParagraphContext.hxx"
      23             : 
      24             : #include "xmloff/xmlnmspe.hxx"
      25             : #include <xmloff/xmltoken.hxx>
      26             : #include <xmloff/nmspmap.hxx>
      27             : 
      28             : using ::rtl::OUString;
      29             : using namespace com::sun::star;
      30             : using namespace ::xmloff::token;
      31             : 
      32           0 : SchXMLParagraphContext::SchXMLParagraphContext( SvXMLImport& rImport,
      33             :                                                 const OUString& rLocalName,
      34             :                                                 OUString& rText,
      35             :                                                 OUString * pOutId /* = 0 */ ) :
      36             :         SvXMLImportContext( rImport, XML_NAMESPACE_TEXT, rLocalName ),
      37             :         mrText( rText ),
      38           0 :         mpId( pOutId )
      39             : {
      40           0 : }
      41             : 
      42           0 : SchXMLParagraphContext::~SchXMLParagraphContext()
      43           0 : {}
      44             : 
      45           0 : void SchXMLParagraphContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
      46             : {
      47             :     // remember the id. It is used for storing the original cell range string in
      48             :     // a local table (cached data)
      49           0 :     if( mpId )
      50             :     {
      51           0 :         sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
      52           0 :         bool bHaveXmlId( false );
      53             : 
      54           0 :         for( sal_Int16 i = 0; i < nAttrCount; i++ )
      55             :         {
      56           0 :             rtl::OUString sAttrName = xAttrList->getNameByIndex( i );
      57           0 :             rtl::OUString aLocalName;
      58           0 :             sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
      59             : 
      60           0 :             if (IsXMLToken(aLocalName, XML_ID))
      61             :             {
      62           0 :                 if (nPrefix == XML_NAMESPACE_XML)
      63             :                 {
      64           0 :                     (*mpId) = xAttrList->getValueByIndex( i );
      65           0 :                     bHaveXmlId = true;
      66             :                 }
      67           0 :                 if (nPrefix == XML_NAMESPACE_TEXT)
      68             :                 {   // text:id shall be ignored if xml:id exists
      69           0 :                     if (!bHaveXmlId)
      70             :                     {
      71           0 :                         (*mpId) = xAttrList->getValueByIndex( i );
      72             :                     }
      73             :                 }
      74             :             }
      75           0 :         }
      76             :     }
      77           0 : }
      78             : 
      79           0 : void SchXMLParagraphContext::EndElement()
      80             : {
      81           0 :     mrText = maBuffer.makeStringAndClear();
      82           0 : }
      83             : 
      84           0 : SvXMLImportContext* SchXMLParagraphContext::CreateChildContext(
      85             :     sal_uInt16 nPrefix,
      86             :     const OUString& rLocalName,
      87             :     const uno::Reference< xml::sax::XAttributeList >& )
      88             : {
      89           0 :     if( nPrefix == XML_NAMESPACE_TEXT )
      90             :     {
      91           0 :         if( rLocalName.equals( ::xmloff::token::GetXMLToken( ::xmloff::token::XML_TAB_STOP )))
      92             :         {
      93           0 :             maBuffer.append( sal_Unicode( 0x0009 ));  // tabulator
      94             :         }
      95           0 :         else if( rLocalName.equals( ::xmloff::token::GetXMLToken( ::xmloff::token::XML_LINE_BREAK )))
      96             :         {
      97           0 :             maBuffer.append( sal_Unicode( 0x000A ));  // linefeed
      98             :         }
      99             :     }
     100             : 
     101           0 :     return new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
     102             : }
     103             : 
     104           0 : void SchXMLParagraphContext::Characters( const OUString& rChars )
     105             : {
     106           0 :     maBuffer.append( rChars );
     107           0 : }
     108             : 
     109             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10