LCOV - code coverage report
Current view: top level - libreoffice/xmloff/source/text - XMLChangeImportContext.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 26 0.0 %
Date: 2012-12-27 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 "XMLChangeImportContext.hxx"
      21             : #include <com/sun/star/text/XTextRange.hpp>
      22             : #include <tools/debug.hxx>
      23             : #include <xmloff/xmlimp.hxx>
      24             : #include "xmloff/xmlnmspe.hxx"
      25             : #include <xmloff/nmspmap.hxx>
      26             : #include <xmloff/xmltoken.hxx>
      27             : 
      28             : using ::rtl::OUString;
      29             : using ::com::sun::star::uno::Reference;
      30             : using ::com::sun::star::text::XTextRange;
      31             : using ::com::sun::star::xml::sax::XAttributeList;
      32             : using ::xmloff::token::IsXMLToken;
      33             : using ::xmloff::token::XML_CHANGE_ID;
      34             : 
      35           0 : TYPEINIT1( XMLChangeImportContext, SvXMLImportContext );
      36             : 
      37           0 : XMLChangeImportContext::XMLChangeImportContext(
      38             :     SvXMLImport& rImport,
      39             :     sal_Int16 nPrefix,
      40             :     const OUString& rLocalName,
      41             :     sal_Bool bStart,
      42             :     sal_Bool bEnd,
      43             :     sal_Bool bOutsideOfParagraph) :
      44             :         SvXMLImportContext(rImport, nPrefix, rLocalName),
      45             :         bIsStart(bStart),
      46             :         bIsEnd(bEnd),
      47           0 :         bIsOutsideOfParagraph(bOutsideOfParagraph)
      48             : {
      49             :     DBG_ASSERT(bStart || bEnd, "Must be either start, end, or both!");
      50           0 : }
      51             : 
      52           0 : XMLChangeImportContext::~XMLChangeImportContext()
      53             : {
      54           0 : }
      55             : 
      56           0 : void XMLChangeImportContext::StartElement(
      57             :     const Reference<XAttributeList>& xAttrList)
      58             : {
      59           0 :     sal_Int16 nLength = xAttrList->getLength();
      60           0 :     for(sal_Int16 nAttr = 0; nAttr < nLength; nAttr++)
      61             :     {
      62           0 :         OUString sLocalName;
      63           0 :         sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
      64           0 :             GetKeyByAttrName( xAttrList->getNameByIndex(nAttr),
      65           0 :                               &sLocalName );
      66           0 :         if ( (XML_NAMESPACE_TEXT == nPrefix) &&
      67           0 :              IsXMLToken( sLocalName, XML_CHANGE_ID ) )
      68             :         {
      69             :             // Id found! Now call RedlineImportHelper
      70             : 
      71             :             // prepare parameters
      72             :             UniReference<XMLTextImportHelper> rHelper =
      73           0 :                 GetImport().GetTextImport();
      74           0 :             OUString sID = xAttrList->getValueByIndex(nAttr);
      75             : 
      76             :             // call for bStart and bEnd (may both be true)
      77           0 :             if (bIsStart)
      78           0 :                 rHelper->RedlineSetCursor(sID,sal_True,bIsOutsideOfParagraph);
      79           0 :             if (bIsEnd)
      80           0 :                 rHelper->RedlineSetCursor(sID,sal_False,bIsOutsideOfParagraph);
      81             : 
      82             :             // outside of paragraph and still open? set open redline ID
      83           0 :             if (bIsOutsideOfParagraph)
      84             :             {
      85           0 :                 rHelper->SetOpenRedlineId(sID);
      86           0 :             }
      87             :         }
      88             :         // else: ignore
      89           0 :     }
      90           0 : }
      91             : 
      92             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10