LibreOffice Module xmloff (master) 1
TransformerContext.cxx
Go to the documentation of this file.
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/SAXException.hpp>
21#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
22#include <com/sun/star/xml/sax/XAttributeList.hpp>
23#include <utility>
24#include <osl/diagnose.h>
25
26#include "TransformerBase.hxx"
27
29
30
31using namespace ::com::sun::star::uno;
32using namespace ::com::sun::star::xml::sax;
33
34bool XMLTransformerContext::HasQName( sal_uInt16 nPrefix,
36{
37 OUString aLocalName;
39 &aLocalName ) == nPrefix &&
41}
42
43bool XMLTransformerContext::HasNamespace( sal_uInt16 nPrefix ) const
44{
46}
47
49 OUString aQName )
50 : m_rTransformer(rImp)
51 , m_aQName(std::move(aQName))
52{
53}
54
56 const OUString& rLocalName,
57 const OUString& rQName,
58 const Reference< XAttributeList >& )
59{
60 return m_rTransformer.CreateContext( nPrefix, rLocalName, rQName );
61}
62
63void XMLTransformerContext::StartElement( const Reference< XAttributeList >& rAttrList )
64{
65 m_rTransformer.GetDocHandler()->startElement( m_aQName, rAttrList );
66}
67
69{
70 GetTransformer().GetDocHandler()->endElement( m_aQName );
71}
72
73void XMLTransformerContext::Characters( const OUString& rChars )
74{
75 m_rTransformer.GetDocHandler()->characters( rChars );
76}
77
79{
80 return false;
81}
82
84{
85 OSL_ENSURE( false, "context is not persistent" );
86}
87
89{
90 OSL_ENSURE( false, "context is not persistent" );
91}
92
93/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_uInt16 GetKeyByAttrName(const OUString &rAttrName, OUString *pPrefix, OUString *pLocalName, OUString *pNamespace) const
SvXMLNamespaceMap & GetNamespaceMap()
const css::uno::Reference< css::xml::sax::XDocumentHandler > & GetDocHandler() const
XMLTransformerContext * CreateContext(sal_uInt16 nPrefix, const OUString &rLocalName, const OUString &rQName)
bool HasNamespace(sal_uInt16 nPrefix) const
virtual rtl::Reference< XMLTransformerContext > CreateChildContext(sal_uInt16 nPrefix, const OUString &rLocalName, const OUString &rQName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList)
XMLTransformerContext(XMLTransformerBase &rTransformer, OUString aQName)
virtual void Characters(const OUString &rChars)
bool HasQName(sal_uInt16 nPrefix, ::xmloff::token::XMLTokenEnum eToken) const
XMLTransformerBase & GetTransformer()
virtual void StartElement(const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList)
XMLTransformerBase & m_rTransformer
virtual bool IsPersistent() const
XMLTokenEnum
The enumeration of all XML tokens.
Definition: xmltoken.hxx:50
bool IsXMLToken(std::u16string_view rString, enum XMLTokenEnum eToken)
compare eToken to the string
Definition: xmltoken.cxx:3575
XMLTokenEnum eToken
Definition: xmltoken.cxx:40