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

Generated by: LCOV version 1.10