LCOV - code coverage report
Current view: top level - xmloff/source/text - XMLChangeElementImportContext.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 25 0.0 %
Date: 2014-04-14 Functions: 0 9 0.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 "XMLChangeElementImportContext.hxx"
      21             : #include "XMLChangedRegionImportContext.hxx"
      22             : #include "XMLChangeInfoContext.hxx"
      23             : #include <com/sun/star/uno/Reference.h>
      24             : #include <xmloff/xmlimp.hxx>
      25             : #include <xmloff/xmlnmspe.hxx>
      26             : #include <xmloff/xmltoken.hxx>
      27             : 
      28             : 
      29             : 
      30             : using ::com::sun::star::uno::Reference;
      31             : using ::com::sun::star::xml::sax::XAttributeList;
      32             : using ::xmloff::token::IsXMLToken;
      33             : using ::xmloff::token::XML_P;
      34             : using ::xmloff::token::XML_CHANGE_INFO;
      35             : 
      36           0 : TYPEINIT1( XMLChangeElementImportContext, SvXMLImportContext );
      37             : 
      38           0 : XMLChangeElementImportContext::XMLChangeElementImportContext(
      39             :     SvXMLImport& rImport,
      40             :     sal_uInt16 nPrefix,
      41             :     const OUString& rLocalName,
      42             :     sal_Bool bAccContent,
      43             :     XMLChangedRegionImportContext& rParent) :
      44             :         SvXMLImportContext(rImport, nPrefix, rLocalName),
      45             :         bAcceptContent(bAccContent),
      46           0 :         rChangedRegion(rParent)
      47             : {
      48           0 : }
      49             : 
      50           0 : SvXMLImportContext* XMLChangeElementImportContext::CreateChildContext(
      51             :     sal_uInt16 nPrefix,
      52             :     const OUString& rLocalName,
      53             :     const Reference<XAttributeList> & xAttrList)
      54             : {
      55           0 :     SvXMLImportContext* pContext = NULL;
      56             : 
      57           0 :     if ( (XML_NAMESPACE_OFFICE == nPrefix) &&
      58           0 :          IsXMLToken( rLocalName, XML_CHANGE_INFO) )
      59             :     {
      60           0 :         pContext = new XMLChangeInfoContext(GetImport(), nPrefix, rLocalName,
      61           0 :                                             rChangedRegion, GetLocalName());
      62             :     }
      63             :     else
      64             :     {
      65             :         // import into redline -> create XText
      66           0 :         rChangedRegion.UseRedlineText();
      67             : 
      68           0 :         pContext = GetImport().GetTextImport()->CreateTextChildContext(
      69           0 :             GetImport(), nPrefix, rLocalName, xAttrList,
      70           0 :             XML_TEXT_TYPE_CHANGED_REGION);
      71             : 
      72           0 :         if (NULL == pContext)
      73             :         {
      74             :             // no text element
      75             :             // illegal element content! TODO: discard this redline!
      76             :             // for the moment -> use default
      77             :             pContext = SvXMLImportContext::CreateChildContext(
      78           0 :                 nPrefix, rLocalName, xAttrList);
      79             :         }
      80             :     }
      81             : 
      82           0 :     return pContext;
      83             : }
      84             : 
      85             : // #107848#
      86           0 : void XMLChangeElementImportContext::StartElement( const Reference< XAttributeList >& )
      87             : {
      88           0 :     if(bAcceptContent)
      89             :     {
      90           0 :         GetImport().GetTextImport()->SetInsideDeleteContext(true);
      91             :     }
      92           0 : }
      93             : 
      94             : // #107848#
      95           0 : void XMLChangeElementImportContext::EndElement()
      96             : {
      97           0 :     if(bAcceptContent)
      98             :     {
      99           0 :         GetImport().GetTextImport()->SetInsideDeleteContext(false);
     100             :     }
     101           0 : }
     102             : 
     103             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10