LCOV - code coverage report
Current view: top level - libreoffice/xmloff/source/transform - MetaTContext.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 35 0.0 %
Date: 2012-12-27 Functions: 0 11 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 <com/sun/star/xml/sax/SAXParseException.hpp>
      21             : #include <com/sun/star/xml/sax/SAXException.hpp>
      22             : #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
      23             : #include <com/sun/star/xml/sax/XAttributeList.hpp>
      24             : #include <xmloff/nmspmap.hxx>
      25             : #include <xmloff/xmltoken.hxx>
      26             : #include "xmloff/xmlnmspe.hxx"
      27             : 
      28             : #include "TransformerBase.hxx"
      29             : #include "MutableAttrList.hxx"
      30             : #include "MetaTContext.hxx"
      31             : 
      32             : using ::rtl::OUString;
      33             : using namespace ::xmloff::token;
      34             : using namespace ::com::sun::star::uno;
      35             : using namespace ::com::sun::star::xml::sax;
      36             : 
      37             : XMLTokenEnum aMetaTokens[] =
      38             : {
      39             :     XML_GENERATOR,
      40             :     XML_TITLE,
      41             :     XML_DESCRIPTION,
      42             :     XML_SUBJECT,
      43             :     XML_INITIAL_CREATOR,
      44             :     XML_CREATION_DATE,
      45             :     XML_CREATOR,
      46             :     XML_DATE,
      47             :     XML_PRINTED_BY,
      48             :     XML_PRINT_DATE,
      49             :     XML_KEYWORD,
      50             :     XML_LANGUAGE,
      51             :     XML_EDITING_CYCLES,
      52             :     XML_EDITING_DURATION,
      53             :     XML_HYPERLINK_BEHAVIOUR,
      54             :     XML_AUTO_RELOAD,
      55             :     XML_TEMPLATE,
      56             :     XML_USER_DEFINED,
      57             :     XML_DOCUMENT_STATISTIC,
      58             :     XML_TOKEN_END
      59             : };
      60             : 
      61           0 : TYPEINIT1( XMLMetaTransformerContext, XMLTransformerContext );
      62             : 
      63           0 : XMLMetaTransformerContext::XMLMetaTransformerContext( XMLTransformerBase& rImp,
      64             :                                                 const OUString& rQName ) :
      65           0 :     XMLTransformerContext( rImp, rQName )
      66             : {
      67           0 : }
      68             : 
      69           0 : XMLMetaTransformerContext::~XMLMetaTransformerContext()
      70             : {
      71           0 : }
      72             : 
      73           0 : XMLTransformerContext *XMLMetaTransformerContext::CreateChildContext(
      74             :             sal_uInt16 /*nPrefix*/,
      75             :             const OUString& rLocalName,
      76             :             const OUString& rQName,
      77             :             const Reference< XAttributeList >& )
      78             : {
      79             :     XMLPersTextContentTContext *pContext =
      80           0 :         new XMLPersTextContentTContext( GetTransformer(), rQName );
      81           0 :     XMLMetaContexts_Impl::value_type aVal( rLocalName, pContext );
      82           0 :     m_aContexts.insert( aVal );
      83             : 
      84           0 :     return pContext;
      85             : }
      86             : 
      87           0 : void XMLMetaTransformerContext::EndElement()
      88             : {
      89             :     // export everything in the correct order
      90           0 :     OUString aKeywordsQName;
      91           0 :     XMLTokenEnum *pToken = aMetaTokens;
      92           0 :     while( *pToken != XML_TOKEN_END )
      93             :     {
      94           0 :         const OUString& rToken = GetXMLToken( *pToken );
      95             :         XMLMetaContexts_Impl::const_iterator aIter =
      96           0 :             m_aContexts.find( rToken );
      97           0 :         if( aIter != m_aContexts.end() )
      98             :         {
      99           0 :             if( XML_KEYWORD == *pToken )
     100             :             {
     101             :                 aKeywordsQName =
     102           0 :                     GetTransformer().GetNamespaceMap().GetQNameByKey(
     103           0 :                             XML_NAMESPACE_META, GetXMLToken(XML_KEYWORDS ) );
     104             : 
     105             :                 Reference< XAttributeList > xAttrList =
     106           0 :                     new XMLMutableAttributeList;
     107           0 :                 GetTransformer().GetDocHandler()->startElement( aKeywordsQName,
     108           0 :                                                             xAttrList );
     109             :             }
     110             : 
     111             :             // All elements may occur multiple times
     112             :             XMLMetaContexts_Impl::const_iterator aEndIter =
     113           0 :                 m_aContexts.upper_bound( rToken );
     114           0 :             while( aIter != aEndIter )
     115             :             {
     116           0 :                 (*aIter).second->Export();
     117           0 :                 ++aIter;
     118             :             }
     119             : 
     120           0 :             if( XML_KEYWORD == *pToken )
     121           0 :                 GetTransformer().GetDocHandler()->endElement( aKeywordsQName );
     122             :         }
     123           0 :         pToken++;
     124             :     }
     125             : 
     126           0 :     GetTransformer().GetDocHandler()->endElement( GetQName() );
     127           0 : }
     128             : 
     129           0 : void XMLMetaTransformerContext::Characters( const OUString& )
     130             : {
     131             :     // ignore them
     132           0 : }
     133             : 
     134             : 
     135             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10