LCOV - code coverage report
Current view: top level - sw/source/core/swg - SwXMLBlockImport.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 35 37 94.6 %
Date: 2012-08-25 Functions: 9 9 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 20 40 50.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <SwXMLBlockImport.hxx>
      30                 :            : #include <xmloff/nmspmap.hxx>
      31                 :            : #include <xmloff/xmlnmspe.hxx>
      32                 :            : #include <SwXMLBlockListContext.hxx>
      33                 :            : #include <SwXMLTextBlocks.hxx>
      34                 :            : using namespace ::com::sun::star::uno;
      35                 :            : using namespace ::com::sun::star;
      36                 :            : using namespace ::xmloff::token;
      37                 :            : using ::rtl::OUString;
      38                 :            : 
      39                 :            : sal_Char const sXML_np__block_list[] = "_block-list";
      40                 :            : sal_Char const sXML_np__office[] = "_ooffice";
      41                 :            : sal_Char const sXML_np__text[] = "_otext";
      42                 :            : 
      43                 :            : // #110680#
      44                 :        114 : SwXMLBlockListImport::SwXMLBlockListImport(
      45                 :            :     const uno::Reference< lang::XMultiServiceFactory > xServiceFactory,
      46                 :            :     SwXMLTextBlocks &rBlocks )
      47                 :            : :   SvXMLImport( xServiceFactory, 0 ),
      48                 :        114 :     rBlockList (rBlocks)
      49                 :            : {
      50                 :        114 :     GetNamespaceMap().Add( OUString ( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__block_list ) ),
      51         [ +  - ]:        114 :                            GetXMLToken ( XML_N_BLOCK_LIST ),
      52   [ +  -  +  - ]:        228 :                            XML_NAMESPACE_BLOCKLIST );
      53                 :        114 : }
      54                 :            : 
      55                 :        228 : SwXMLBlockListImport::~SwXMLBlockListImport ( void )
      56                 :        114 :     throw ()
      57                 :            : {
      58         [ -  + ]:        228 : }
      59                 :            : 
      60                 :        114 : SvXMLImportContext *SwXMLBlockListImport::CreateContext(
      61                 :            :         sal_uInt16 nPrefix,
      62                 :            :         const OUString& rLocalName,
      63                 :            :         const uno::Reference< xml::sax::XAttributeList > & xAttrList )
      64                 :            : {
      65                 :        114 :     SvXMLImportContext *pContext = 0;
      66   [ +  -  +  - ]:        228 :     if ( XML_NAMESPACE_BLOCKLIST == nPrefix &&
                 [ +  - ]
      67                 :        114 :          IsXMLToken ( rLocalName, XML_BLOCK_LIST ) )
      68                 :            :         pContext = new SwXMLBlockListContext( *this, nPrefix, rLocalName,
      69         [ +  - ]:        114 :                                               xAttrList );
      70                 :            :     else
      71                 :          0 :         pContext = SvXMLImport::CreateContext( nPrefix, rLocalName, xAttrList );
      72                 :        114 :     return pContext;
      73                 :            : }
      74                 :            : 
      75                 :            : // #110680#
      76                 :          8 : SwXMLTextBlockImport::SwXMLTextBlockImport(
      77                 :            :     const uno::Reference< lang::XMultiServiceFactory > xServiceFactory,
      78                 :            :     SwXMLTextBlocks &rBlocks,
      79                 :            :     String & rNewText,
      80                 :            :     sal_Bool bNewTextOnly )
      81                 :            : :   SvXMLImport(xServiceFactory, IMPORT_ALL ),
      82                 :            :     rBlockList ( rBlocks ),
      83                 :            :     bTextOnly ( bNewTextOnly ),
      84                 :          8 :     m_rText ( rNewText )
      85                 :            : {
      86                 :          8 :     GetNamespaceMap().Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__office ) ),
      87         [ +  - ]:          8 :                             GetXMLToken(XML_N_OFFICE_OOO),
      88   [ +  -  +  - ]:         16 :                             XML_NAMESPACE_OFFICE );
      89                 :          8 :     GetNamespaceMap().Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__text ) ),
      90         [ +  - ]:          8 :                             GetXMLToken(XML_N_TEXT_OOO),
      91   [ +  -  +  - ]:         16 :                             XML_NAMESPACE_TEXT );
      92                 :          8 : }
      93                 :            : 
      94                 :         16 : SwXMLTextBlockImport::~SwXMLTextBlockImport ( void )
      95                 :          8 :     throw()
      96                 :            : {
      97         [ -  + ]:         16 : }
      98                 :            : 
      99                 :          8 : SvXMLImportContext *SwXMLTextBlockImport::CreateContext(
     100                 :            :         sal_uInt16 nPrefix,
     101                 :            :         const OUString& rLocalName,
     102                 :            :         const uno::Reference< xml::sax::XAttributeList > & xAttrList )
     103                 :            : {
     104                 :          8 :     SvXMLImportContext *pContext = 0;
     105   [ +  -  +  - ]:         16 :     if( XML_NAMESPACE_OFFICE == nPrefix &&
                 [ +  - ]
     106         [ +  - ]:          8 :         IsXMLToken ( rLocalName, bTextOnly ? XML_DOCUMENT : XML_DOCUMENT_CONTENT ) )
     107         [ +  - ]:          8 :         pContext = new SwXMLTextBlockDocumentContext( *this, nPrefix, rLocalName, xAttrList );
     108                 :            :     else
     109                 :          0 :         pContext = SvXMLImport::CreateContext( nPrefix, rLocalName, xAttrList );
     110                 :          8 :     return pContext;
     111                 :            : }
     112                 :          8 : void SAL_CALL SwXMLTextBlockImport::endDocument(void)
     113                 :            :         throw( xml::sax::SAXException, uno::RuntimeException )
     114                 :            : {
     115                 :          8 : }
     116                 :            : 
     117                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10