LCOV - code coverage report
Current view: top level - sw/source/filter/xml - xmltext.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 21 23 91.3 %
Date: 2014-04-11 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        2224 :     SwXMLImport& GetSwImport() { return (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         150 : SwXMLBodyContentContext_Impl::SwXMLBodyContentContext_Impl( SwXMLImport& rImport,
      47             :                                               sal_uInt16 nPrfx,
      48             :                                                    const OUString& rLName ) :
      49         150 :     SvXMLImportContext( rImport, nPrfx, rLName )
      50             : {
      51         150 : }
      52             : 
      53         300 : SwXMLBodyContentContext_Impl::~SwXMLBodyContentContext_Impl()
      54             : {
      55         300 : }
      56             : 
      57        2224 : SvXMLImportContext *SwXMLBodyContentContext_Impl::CreateChildContext(
      58             :         sal_uInt16 nPrefix, const OUString& rLocalName,
      59             :         const Reference< xml::sax::XAttributeList > & xAttrList )
      60             : {
      61        2224 :     SvXMLImportContext *pContext = 0;
      62             : 
      63        2224 :     pContext = GetSwImport().GetTextImport()->CreateTextChildContext(
      64        2224 :             GetImport(), nPrefix, rLocalName, xAttrList,
      65        4448 :                XML_TEXT_TYPE_BODY );
      66        2224 :     if( !pContext )
      67           0 :         pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
      68             : 
      69        2224 :     return pContext;
      70             : }
      71             : 
      72         148 : void SwXMLBodyContentContext_Impl::EndElement()
      73             : {
      74             :     /* Code moved to SwXMLOmport::endDocument */
      75         148 :     GetImport().GetTextImport()->SetOutlineStyles( false );
      76         148 : }
      77             : 
      78         150 : SvXMLImportContext *SwXMLImport::CreateBodyContentContext(
      79             :                                        const OUString& rLocalName )
      80             : {
      81         150 :     SvXMLImportContext *pContext = 0;
      82             : 
      83         150 :     if( !IsStylesOnlyMode() )
      84             :          pContext = new SwXMLBodyContentContext_Impl( *this, XML_NAMESPACE_OFFICE,
      85         150 :                                               rLocalName );
      86             :     else
      87             :         pContext = new SvXMLImportContext( *this, XML_NAMESPACE_OFFICE,
      88           0 :                                            rLocalName );
      89             : 
      90         150 :     return pContext;
      91             : }
      92             : 
      93             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10