LCOV - code coverage report
Current view: top level - xmloff/source/text - XMLAutoMarkFileContext.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 22 0.0 %
Date: 2015-06-13 12:38:46 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 "XMLAutoMarkFileContext.hxx"
      21             : #include <xmloff/xmlimp.hxx>
      22             : #include <rtl/ustring.hxx>
      23             : #include <xmloff/nmspmap.hxx>
      24             : #include <xmloff/xmlnmspe.hxx>
      25             : #include <xmloff/xmltoken.hxx>
      26             : #include <com/sun/star/uno/Reference.hxx>
      27             : #include <com/sun/star/xml/sax/XAttributeList.hpp>
      28             : #include <com/sun/star/beans/XPropertySet.hpp>
      29             : 
      30             : 
      31             : using ::com::sun::star::uno::Any;
      32             : using ::com::sun::star::uno::Reference;
      33             : using ::com::sun::star::uno::UNO_QUERY;
      34             : using ::com::sun::star::xml::sax::XAttributeList;
      35             : using ::com::sun::star::beans::XPropertySet;
      36             : 
      37             : using ::xmloff::token::IsXMLToken;
      38             : using ::xmloff::token::XML_HREF;
      39             : 
      40             : 
      41           0 : TYPEINIT1( XMLAutoMarkFileContext, SvXMLImportContext );
      42             : 
      43           0 : XMLAutoMarkFileContext::XMLAutoMarkFileContext(
      44             :     SvXMLImport& rImport,
      45             :     sal_uInt16 nPrefix,
      46             :     const OUString& rLocalName) :
      47             :         SvXMLImportContext(rImport, nPrefix, rLocalName),
      48           0 :         sIndexAutoMarkFileURL("IndexAutoMarkFileURL")
      49             : {
      50           0 : }
      51             : 
      52           0 : XMLAutoMarkFileContext::~XMLAutoMarkFileContext()
      53             : {
      54           0 : }
      55             : 
      56             : 
      57           0 : void XMLAutoMarkFileContext::StartElement(
      58             :     const Reference<XAttributeList> & xAttrList)
      59             : {
      60             :     // scan for text:alphabetical-index-auto-mark-file attribute, and if
      61             :     // found set value with the document
      62             : 
      63           0 :     sal_Int16 nLength = xAttrList->getLength();
      64           0 :     for( sal_Int16 i = 0; i < nLength; i++ )
      65             :     {
      66           0 :         OUString sLocalName;
      67           0 :         sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
      68           0 :             GetKeyByAttrName( xAttrList->getNameByIndex(i), &sLocalName );
      69             : 
      70           0 :         if ( ( XML_NAMESPACE_XLINK == nPrefix ) &&
      71           0 :              IsXMLToken(sLocalName, XML_HREF) )
      72             :         {
      73           0 :             Any aAny;
      74           0 :             aAny <<= GetImport().GetAbsoluteReference( xAttrList->getValueByIndex(i) );
      75             :             Reference<XPropertySet> xPropertySet(
      76           0 :                 GetImport().GetModel(), UNO_QUERY );
      77           0 :             if (xPropertySet.is())
      78             :             {
      79           0 :                 xPropertySet->setPropertyValue( sIndexAutoMarkFileURL, aAny );
      80           0 :             }
      81             :         }
      82           0 :     }
      83           0 : }
      84             : 
      85             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11