LCOV - code coverage report
Current view: top level - xmloff/source/text - XMLTrackedChangesImportContext.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 31 0.0 %
Date: 2012-08-25 Functions: 0 10 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 42 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include "XMLTrackedChangesImportContext.hxx"
      30                 :            : #include "XMLChangedRegionImportContext.hxx"
      31                 :            : #include <com/sun/star/uno/Reference.h>
      32                 :            : #include <com/sun/star/uno/Sequence.h>
      33                 :            : #include <sax/tools/converter.hxx>
      34                 :            : #include <xmloff/xmlimp.hxx>
      35                 :            : #include "xmloff/xmlnmspe.hxx"
      36                 :            : #include <xmloff/nmspmap.hxx>
      37                 :            : #include <xmloff/xmltoken.hxx>
      38                 :            : 
      39                 :            : 
      40                 :            : using ::rtl::OUString;
      41                 :            : using ::com::sun::star::uno::Reference;
      42                 :            : using ::com::sun::star::uno::Sequence;
      43                 :            : using ::com::sun::star::xml::sax::XAttributeList;
      44                 :            : using namespace ::xmloff::token;
      45                 :            : 
      46                 :            : 
      47                 :            : 
      48 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLTrackedChangesImportContext, SvXMLImportContext );
      49                 :            : 
      50                 :          0 : XMLTrackedChangesImportContext::XMLTrackedChangesImportContext(
      51                 :            :     SvXMLImport& rImport,
      52                 :            :     sal_uInt16 nPrefix,
      53                 :            :     const OUString& rLocalName) :
      54                 :          0 :         SvXMLImportContext(rImport, nPrefix, rLocalName)
      55                 :            : {
      56                 :          0 : }
      57                 :            : 
      58                 :          0 : XMLTrackedChangesImportContext::~XMLTrackedChangesImportContext()
      59                 :            : {
      60         [ #  # ]:          0 : }
      61                 :            : 
      62                 :          0 : void XMLTrackedChangesImportContext::StartElement(
      63                 :            :     const Reference<XAttributeList> & xAttrList )
      64                 :            : {
      65                 :          0 :     sal_Bool bTrackChanges = sal_True;
      66                 :            : 
      67                 :            :     // scan for text:track-changes and text:protection-key attributes
      68                 :          0 :     sal_Int16 nLength = xAttrList->getLength();
      69         [ #  # ]:          0 :     for( sal_Int16 i = 0; i < nLength; i++ )
      70                 :            :     {
      71                 :          0 :         OUString sLocalName;
      72                 :          0 :         sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
      73   [ #  #  #  # ]:          0 :             GetKeyByAttrName( xAttrList->getNameByIndex(i), &sLocalName );
                 [ #  # ]
      74                 :            : 
      75         [ #  # ]:          0 :         if ( XML_NAMESPACE_TEXT == nPrefix )
      76                 :            :         {
      77 [ #  # ][ #  # ]:          0 :             if ( IsXMLToken( sLocalName, XML_TRACK_CHANGES ) )
      78                 :            :             {
      79                 :          0 :                 bool bTmp(false);
      80   [ #  #  #  # ]:          0 :                 if (::sax::Converter::convertBool(
      81 [ #  # ][ #  # ]:          0 :                     bTmp, xAttrList->getValueByIndex(i)) )
      82                 :            :                 {
      83                 :          0 :                     bTrackChanges = bTmp;
      84                 :            :                 }
      85                 :            :             }
      86                 :            :         }
      87                 :          0 :     }
      88                 :            : 
      89                 :            :     // set tracked changes
      90 [ #  # ][ #  # ]:          0 :     GetImport().GetTextImport()->SetRecordChanges( bTrackChanges );
      91                 :          0 : }
      92                 :            : 
      93                 :            : 
      94                 :          0 : SvXMLImportContext* XMLTrackedChangesImportContext::CreateChildContext(
      95                 :            :     sal_uInt16 nPrefix,
      96                 :            :     const OUString& rLocalName,
      97                 :            :     const Reference<XAttributeList> & xAttrList)
      98                 :            : {
      99                 :          0 :     SvXMLImportContext* pContext = NULL;
     100                 :            : 
     101   [ #  #  #  # ]:          0 :     if ( (XML_NAMESPACE_TEXT == nPrefix) &&
                 [ #  # ]
     102                 :          0 :          IsXMLToken( rLocalName, XML_CHANGED_REGION ) )
     103                 :            :     {
     104                 :          0 :         pContext = new XMLChangedRegionImportContext(GetImport(),
     105         [ #  # ]:          0 :                                                      nPrefix, rLocalName);
     106                 :            :     }
     107                 :            : 
     108         [ #  # ]:          0 :     if (NULL == pContext)
     109                 :            :     {
     110                 :            :         pContext = SvXMLImportContext::CreateChildContext(nPrefix, rLocalName,
     111                 :          0 :                                                           xAttrList);
     112                 :            :     }
     113                 :            : 
     114                 :          0 :     return pContext;
     115                 :            : }
     116                 :            : 
     117                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10