LCOV - code coverage report
Current view: top level - sw/source/filter/xml - xmltext.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 21 23 91.3 %
Date: 2015-06-13 12:38:46 Functions: 7 7 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 <xmloff/xmlnmspe.hxx>
      21             : #include "xmlimp.hxx"
      22             : 
      23             : using namespace ::com::sun::star;
      24             : using namespace ::com::sun::star::uno;
      25             : using namespace ::com::sun::star::text;
      26             : 
      27             : class SwXMLBodyContentContext_Impl : public SvXMLImportContext
      28             : {
      29        3345 :     SwXMLImport& GetSwImport() { return static_cast<SwXMLImport&>(GetImport()); }
      30             : 
      31             : public:
      32             : 
      33             :     SwXMLBodyContentContext_Impl( SwXMLImport& rImport, sal_uInt16 nPrfx,
      34             :                              const OUString& rLName );
      35             :     virtual ~SwXMLBodyContentContext_Impl();
      36             : 
      37             :     virtual SvXMLImportContext *CreateChildContext(
      38             :             sal_uInt16 nPrefix, const OUString& rLocalName,
      39             :             const Reference< xml::sax::XAttributeList > & xAttrList ) SAL_OVERRIDE;
      40             : 
      41             :     // The body element's text:global attribute can be ignored, because
      42             :     // we must have the correct object shell already.
      43             :     virtual void EndElement() SAL_OVERRIDE;
      44             : };
      45             : 
      46         353 : SwXMLBodyContentContext_Impl::SwXMLBodyContentContext_Impl( SwXMLImport& rImport,
      47             :                                               sal_uInt16 nPrfx,
      48             :                                                    const OUString& rLName ) :
      49         353 :     SvXMLImportContext( rImport, nPrfx, rLName )
      50             : {
      51         353 : }
      52             : 
      53         706 : SwXMLBodyContentContext_Impl::~SwXMLBodyContentContext_Impl()
      54             : {
      55         706 : }
      56             : 
      57        3345 : SvXMLImportContext *SwXMLBodyContentContext_Impl::CreateChildContext(
      58             :         sal_uInt16 nPrefix, const OUString& rLocalName,
      59             :         const Reference< xml::sax::XAttributeList > & xAttrList )
      60             : {
      61        3345 :     SvXMLImportContext *pContext = 0;
      62             : 
      63        3345 :     pContext = GetSwImport().GetTextImport()->CreateTextChildContext(
      64        3345 :             GetImport(), nPrefix, rLocalName, xAttrList,
      65        6690 :                XML_TEXT_TYPE_BODY );
      66        3345 :     if( !pContext )
      67           0 :         pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
      68             : 
      69        3345 :     return pContext;
      70             : }
      71             : 
      72         353 : void SwXMLBodyContentContext_Impl::EndElement()
      73             : {
      74             :     /* Code moved to SwXMLOmport::endDocument */
      75         353 :     GetImport().GetTextImport()->SetOutlineStyles( false );
      76         353 : }
      77             : 
      78         353 : SvXMLImportContext *SwXMLImport::CreateBodyContentContext(
      79             :                                        const OUString& rLocalName )
      80             : {
      81         353 :     SvXMLImportContext *pContext = 0;
      82             : 
      83         353 :     if( !IsStylesOnlyMode() )
      84             :          pContext = new SwXMLBodyContentContext_Impl( *this, XML_NAMESPACE_OFFICE,
      85         353 :                                               rLocalName );
      86             :     else
      87             :         pContext = new SvXMLImportContext( *this, XML_NAMESPACE_OFFICE,
      88           0 :                                            rLocalName );
      89             : 
      90         353 :     return pContext;
      91             : }
      92             : 
      93             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11