LCOV - code coverage report
Current view: top level - sw/source/core/swg - SwXMLBlockImport.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 35 37 94.6 %
Date: 2014-11-03 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         114 : SwXMLBlockListImport::SwXMLBlockListImport(
      34             :     const uno::Reference< uno::XComponentContext > xContext,
      35             :     SwXMLTextBlocks &rBlocks )
      36             : :   SvXMLImport( xContext, "", 0 ),
      37         114 :     rBlockList (rBlocks)
      38             : {
      39         114 :     GetNamespaceMap().Add( OUString ( sXML_np__block_list ),
      40         114 :                            GetXMLToken ( XML_N_BLOCK_LIST ),
      41         228 :                            XML_NAMESPACE_BLOCKLIST );
      42         114 : }
      43             : 
      44         228 : SwXMLBlockListImport::~SwXMLBlockListImport ( void )
      45         114 :     throw ()
      46             : {
      47         228 : }
      48             : 
      49         114 : SvXMLImportContext *SwXMLBlockListImport::CreateContext(
      50             :         sal_uInt16 nPrefix,
      51             :         const OUString& rLocalName,
      52             :         const uno::Reference< xml::sax::XAttributeList > & xAttrList )
      53             : {
      54         114 :     SvXMLImportContext *pContext = 0;
      55         228 :     if ( XML_NAMESPACE_BLOCKLIST == nPrefix &&
      56         114 :          IsXMLToken ( rLocalName, XML_BLOCK_LIST ) )
      57             :         pContext = new SwXMLBlockListContext( *this, nPrefix, rLocalName,
      58         114 :                                               xAttrList );
      59             :     else
      60           0 :         pContext = SvXMLImport::CreateContext( nPrefix, rLocalName, xAttrList );
      61         114 :     return pContext;
      62             : }
      63             : 
      64           8 : SwXMLTextBlockImport::SwXMLTextBlockImport(
      65             :     const uno::Reference< uno::XComponentContext > xContext,
      66             :     SwXMLTextBlocks &rBlocks,
      67             :     OUString & rNewText,
      68             :     bool bNewTextOnly )
      69             : :   SvXMLImport(xContext, "", IMPORT_ALL ),
      70             :     rBlockList ( rBlocks ),
      71             :     bTextOnly ( bNewTextOnly ),
      72           8 :     m_rText ( rNewText )
      73             : {
      74           8 :     GetNamespaceMap().Add( OUString( sXML_np__office ),
      75           8 :                             GetXMLToken(XML_N_OFFICE_OOO),
      76          16 :                             XML_NAMESPACE_OFFICE );
      77           8 :     GetNamespaceMap().Add( OUString( sXML_np__text ),
      78           8 :                             GetXMLToken(XML_N_TEXT_OOO),
      79          16 :                             XML_NAMESPACE_TEXT );
      80           8 : }
      81             : 
      82          16 : SwXMLTextBlockImport::~SwXMLTextBlockImport ( void )
      83           8 :     throw()
      84             : {
      85          16 : }
      86             : 
      87           8 : SvXMLImportContext *SwXMLTextBlockImport::CreateContext(
      88             :         sal_uInt16 nPrefix,
      89             :         const OUString& rLocalName,
      90             :         const uno::Reference< xml::sax::XAttributeList > & xAttrList )
      91             : {
      92           8 :     SvXMLImportContext *pContext = 0;
      93          16 :     if( XML_NAMESPACE_OFFICE == nPrefix &&
      94           8 :         IsXMLToken ( rLocalName, bTextOnly ? XML_DOCUMENT : XML_DOCUMENT_CONTENT ) )
      95           8 :         pContext = new SwXMLTextBlockDocumentContext( *this, nPrefix, rLocalName, xAttrList );
      96             :     else
      97           0 :         pContext = SvXMLImport::CreateContext( nPrefix, rLocalName, xAttrList );
      98           8 :     return pContext;
      99             : }
     100           8 : void SAL_CALL SwXMLTextBlockImport::endDocument(void)
     101             :         throw( xml::sax::SAXException, uno::RuntimeException, std::exception )
     102             : {
     103         278 : }
     104             : 
     105             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10