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

Generated by: LCOV version 1.10