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 :
26 : #include "TransformerBase.hxx"
27 :
28 : #include "TransformerContext.hxx"
29 :
30 :
31 : using namespace ::com::sun::star::uno;
32 : using namespace ::com::sun::star::xml::sax;
33 :
34 0 : TYPEINIT0( XMLTransformerContext );
35 :
36 24 : bool XMLTransformerContext::HasQName( sal_uInt16 nPrefix,
37 : ::xmloff::token::XMLTokenEnum eToken ) const
38 : {
39 24 : OUString aLocalName;
40 24 : return GetTransformer().GetNamespaceMap().GetKeyByAttrName( m_aQName,
41 72 : &aLocalName ) == nPrefix &&
42 48 : ::xmloff::token::IsXMLToken( aLocalName, eToken );
43 : }
44 :
45 0 : bool XMLTransformerContext::HasNamespace( sal_uInt16 nPrefix ) const
46 : {
47 0 : return GetTransformer().GetNamespaceMap().GetKeyByAttrName( m_aQName ) == nPrefix;
48 : }
49 :
50 5196 : XMLTransformerContext::XMLTransformerContext( XMLTransformerBase& rImp,
51 : const OUString& rQName ) :
52 : m_rTransformer( rImp ),
53 : m_aQName( rQName ),
54 5196 : m_pRewindMap( 0 )
55 : {
56 5196 : }
57 :
58 6690 : XMLTransformerContext::~XMLTransformerContext()
59 : {
60 6690 : }
61 :
62 3834 : XMLTransformerContext *XMLTransformerContext::CreateChildContext( sal_uInt16 nPrefix,
63 : const OUString& rLocalName,
64 : const OUString& rQName,
65 : const Reference< XAttributeList >& )
66 : {
67 3834 : return m_rTransformer.CreateContext( nPrefix, rLocalName, rQName );
68 : }
69 :
70 1702 : void XMLTransformerContext::StartElement( const Reference< XAttributeList >& rAttrList )
71 : {
72 1702 : m_rTransformer.GetDocHandler()->startElement( m_aQName, rAttrList );
73 1702 : }
74 :
75 1700 : void XMLTransformerContext::EndElement()
76 : {
77 1700 : m_rTransformer.GetDocHandler()->endElement( m_aQName );
78 1700 : }
79 :
80 1642 : void XMLTransformerContext::Characters( const OUString& rChars )
81 : {
82 1642 : m_rTransformer.GetDocHandler()->characters( rChars );
83 1642 : }
84 :
85 0 : bool XMLTransformerContext::IsPersistent() const
86 : {
87 0 : return false;
88 : }
89 :
90 0 : void XMLTransformerContext::Export()
91 : {
92 : OSL_ENSURE( false, "context is not persistent" );
93 0 : }
94 :
95 0 : void XMLTransformerContext::ExportContent()
96 : {
97 : OSL_ENSURE( false, "context is not persistent" );
98 0 : }
99 :
100 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|