Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / xmloff / source / transform / TransformerContext.cxx
blob71b2b44a11717a289ba369711718e48a72f8d550
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
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 <osl/diagnose.h>
26 #include "TransformerBase.hxx"
28 #include "TransformerContext.hxx"
31 using namespace ::com::sun::star::uno;
32 using namespace ::com::sun::star::xml::sax;
34 bool XMLTransformerContext::HasQName( sal_uInt16 nPrefix,
35 ::xmloff::token::XMLTokenEnum eToken ) const
37 OUString aLocalName;
38 return GetTransformer().GetNamespaceMap().GetKeyByAttrName( m_aQName,
39 &aLocalName ) == nPrefix &&
40 ::xmloff::token::IsXMLToken( aLocalName, eToken );
43 bool XMLTransformerContext::HasNamespace( sal_uInt16 nPrefix ) const
45 return GetTransformer().GetNamespaceMap().GetKeyByAttrName( m_aQName ) == nPrefix;
48 XMLTransformerContext::XMLTransformerContext( XMLTransformerBase& rImp,
49 const OUString& rQName )
50 : m_rTransformer(rImp)
51 , m_aQName(rQName)
55 XMLTransformerContext::~XMLTransformerContext()
59 rtl::Reference<XMLTransformerContext> XMLTransformerContext::CreateChildContext( sal_uInt16 nPrefix,
60 const OUString& rLocalName,
61 const OUString& rQName,
62 const Reference< XAttributeList >& )
64 return m_rTransformer.CreateContext( nPrefix, rLocalName, rQName );
67 void XMLTransformerContext::StartElement( const Reference< XAttributeList >& rAttrList )
69 m_rTransformer.GetDocHandler()->startElement( m_aQName, rAttrList );
72 void XMLTransformerContext::EndElement()
74 m_rTransformer.GetDocHandler()->endElement( m_aQName );
77 void XMLTransformerContext::Characters( const OUString& rChars )
79 m_rTransformer.GetDocHandler()->characters( rChars );
82 bool XMLTransformerContext::IsPersistent() const
84 return false;
87 void XMLTransformerContext::Export()
89 OSL_ENSURE( false, "context is not persistent" );
92 void XMLTransformerContext::ExportContent()
94 OSL_ENSURE( false, "context is not persistent" );
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */