LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sw/source/core/swg - SwXMLBlockImport.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 35 37 94.6 %
Date: 2013-07-09 Functions: 11 11 100.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 <SwXMLBlockImport.hxx>
      21             : #include <xmloff/nmspmap.hxx>
      22             : #include <xmloff/xmlnmspe.hxx>
      23             : #include <SwXMLBlockListContext.hxx>
      24             : #include <SwXMLTextBlocks.hxx>
      25             : using namespace ::com::sun::star::uno;
      26             : using namespace ::com::sun::star;
      27             : using namespace ::xmloff::token;
      28             : 
      29             : sal_Char const sXML_np__block_list[] = "_block-list";
      30             : sal_Char const sXML_np__office[] = "_ooffice";
      31             : sal_Char const sXML_np__text[] = "_otext";
      32             : 
      33          57 : SwXMLBlockListImport::SwXMLBlockListImport(
      34             :     const uno::Reference< uno::XComponentContext > xContext,
      35             :     SwXMLTextBlocks &rBlocks )
      36             : :   SvXMLImport( xContext, 0 ),
      37          57 :     rBlockList (rBlocks)
      38             : {
      39          57 :     GetNamespaceMap().Add( OUString ( sXML_np__block_list ),
      40          57 :                            GetXMLToken ( XML_N_BLOCK_LIST ),
      41         114 :                            XML_NAMESPACE_BLOCKLIST );
      42          57 : }
      43             : 
      44         114 : SwXMLBlockListImport::~SwXMLBlockListImport ( void )
      45          57 :     throw ()
      46             : {
      47         114 : }
      48             : 
      49          57 : SvXMLImportContext *SwXMLBlockListImport::CreateContext(
      50             :         sal_uInt16 nPrefix,
      51             :         const OUString& rLocalName,
      52             :         const uno::Reference< xml::sax::XAttributeList > & xAttrList )
      53             : {
      54          57 :     SvXMLImportContext *pContext = 0;
      55         114 :     if ( XML_NAMESPACE_BLOCKLIST == nPrefix &&
      56          57 :          IsXMLToken ( rLocalName, XML_BLOCK_LIST ) )
      57             :         pContext = new SwXMLBlockListContext( *this, nPrefix, rLocalName,
      58          57 :                                               xAttrList );
      59             :     else
      60           0 :         pContext = SvXMLImport::CreateContext( nPrefix, rLocalName, xAttrList );
      61          57 :     return pContext;
      62             : }
      63             : 
      64           4 : SwXMLTextBlockImport::SwXMLTextBlockImport(
      65             :     const uno::Reference< uno::XComponentContext > xContext,
      66             :     SwXMLTextBlocks &rBlocks,
      67             :     String & rNewText,
      68             :     sal_Bool bNewTextOnly )
      69             : :   SvXMLImport(xContext, IMPORT_ALL ),
      70             :     rBlockList ( rBlocks ),
      71             :     bTextOnly ( bNewTextOnly ),
      72           4 :     m_rText ( rNewText )
      73             : {
      74           4 :     GetNamespaceMap().Add( OUString( sXML_np__office ),
      75           4 :                             GetXMLToken(XML_N_OFFICE_OOO),
      76           8 :                             XML_NAMESPACE_OFFICE );
      77           4 :     GetNamespaceMap().Add( OUString( sXML_np__text ),
      78           4 :                             GetXMLToken(XML_N_TEXT_OOO),
      79           8 :                             XML_NAMESPACE_TEXT );
      80           4 : }
      81             : 
      82           8 : SwXMLTextBlockImport::~SwXMLTextBlockImport ( void )
      83           4 :     throw()
      84             : {
      85           8 : }
      86             : 
      87           4 : SvXMLImportContext *SwXMLTextBlockImport::CreateContext(
      88             :         sal_uInt16 nPrefix,
      89             :         const OUString& rLocalName,
      90             :         const uno::Reference< xml::sax::XAttributeList > & xAttrList )
      91             : {
      92           4 :     SvXMLImportContext *pContext = 0;
      93           8 :     if( XML_NAMESPACE_OFFICE == nPrefix &&
      94           4 :         IsXMLToken ( rLocalName, bTextOnly ? XML_DOCUMENT : XML_DOCUMENT_CONTENT ) )
      95           4 :         pContext = new SwXMLTextBlockDocumentContext( *this, nPrefix, rLocalName, xAttrList );
      96             :     else
      97           0 :         pContext = SvXMLImport::CreateContext( nPrefix, rLocalName, xAttrList );
      98           4 :     return pContext;
      99             : }
     100           4 : void SAL_CALL SwXMLTextBlockImport::endDocument(void)
     101             :         throw( xml::sax::SAXException, uno::RuntimeException )
     102             : {
     103         103 : }
     104             : 
     105             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10