/src/libreoffice/xmloff/source/transform/TransformerContext.cxx
Line | Count | Source |
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/XDocumentHandler.hpp> |
21 | | #include <utility> |
22 | | #include <osl/diagnose.h> |
23 | | |
24 | | #include "TransformerBase.hxx" |
25 | | |
26 | | #include "TransformerContext.hxx" |
27 | | |
28 | | |
29 | | using namespace ::com::sun::star::uno; |
30 | | using namespace ::com::sun::star::xml::sax; |
31 | | |
32 | | bool XMLTransformerContext::HasQName( sal_uInt16 nPrefix, |
33 | | ::xmloff::token::XMLTokenEnum eToken ) const |
34 | 0 | { |
35 | 0 | OUString aLocalName; |
36 | 0 | return GetTransformer().GetNamespaceMap().GetKeyByAttrName( m_aQName, |
37 | 0 | &aLocalName ) == nPrefix && |
38 | 0 | ::xmloff::token::IsXMLToken( aLocalName, eToken ); |
39 | 0 | } |
40 | | |
41 | | bool XMLTransformerContext::HasNamespace( sal_uInt16 nPrefix ) const |
42 | 0 | { |
43 | 0 | return GetTransformer().GetNamespaceMap().GetKeyByAttrName( m_aQName ) == nPrefix; |
44 | 0 | } |
45 | | |
46 | | XMLTransformerContext::XMLTransformerContext( XMLTransformerBase& rImp, |
47 | | OUString aQName ) |
48 | 0 | : m_rTransformer(rImp) |
49 | 0 | , m_aQName(std::move(aQName)) |
50 | 0 | { |
51 | 0 | } |
52 | | |
53 | | rtl::Reference<XMLTransformerContext> XMLTransformerContext::CreateChildContext( sal_uInt16 nPrefix, |
54 | | const OUString& rLocalName, |
55 | | const OUString& rQName, |
56 | | const Reference< XAttributeList >& ) |
57 | 0 | { |
58 | 0 | return m_rTransformer.CreateContext( nPrefix, rLocalName, rQName ); |
59 | 0 | } |
60 | | |
61 | | void XMLTransformerContext::StartElement( const Reference< XAttributeList >& rAttrList ) |
62 | 0 | { |
63 | 0 | m_rTransformer.GetDocHandler()->startElement( m_aQName, rAttrList ); |
64 | 0 | } |
65 | | |
66 | | void XMLTransformerContext::EndElement() |
67 | 0 | { |
68 | 0 | GetTransformer().GetDocHandler()->endElement( m_aQName ); |
69 | 0 | } |
70 | | |
71 | | void XMLTransformerContext::Characters( const OUString& rChars ) |
72 | 0 | { |
73 | 0 | m_rTransformer.GetDocHandler()->characters( rChars ); |
74 | 0 | } |
75 | | |
76 | | bool XMLTransformerContext::IsPersistent() const |
77 | 0 | { |
78 | 0 | return false; |
79 | 0 | } |
80 | | |
81 | | void XMLTransformerContext::Export() |
82 | 0 | { |
83 | 0 | OSL_ENSURE( false, "context is not persistent" ); |
84 | 0 | } |
85 | | |
86 | | void XMLTransformerContext::ExportContent() |
87 | 0 | { |
88 | 0 | OSL_ENSURE( false, "context is not persistent" ); |
89 | 0 | } |
90 | | |
91 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |