LibreOffice Module xmloff (master) 1
PersAttrListTContext.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/util/XCloneable.hpp>
21#include "IgnoreTContext.hxx"
22#include "TransformerBase.hxx"
23#include "MutableAttrList.hxx"
26
27
28using namespace ::com::sun::star::uno;
29using namespace ::com::sun::star::util;
30using namespace ::com::sun::star::xml::sax;
31
33 sal_uInt16 nAPrefix,
36{
37 const OUString& aAttrValue( ::xmloff::token::GetXMLToken( eVToken ) );
38 AddAttribute( nAPrefix, eAToken, aAttrValue );
39}
40
42 sal_uInt16 nAPrefix,
44 const OUString & rValue )
45{
46 OUString aAttrQName( GetTransformer().GetNamespaceMap().GetQNameByKey(
47 nAPrefix, ::xmloff::token::GetXMLToken( eAToken ) ) );
48 const OUString& aAttrValue( rValue );
49
51 if( m_xAttrList.is() )
52 {
53 pMutableAttrList =
54 static_cast< XMLMutableAttributeList * >( m_xAttrList.get() );
55 }
56 else
57 {
58 pMutableAttrList = new XMLMutableAttributeList ;
59 m_xAttrList = pMutableAttrList;
60 }
61
62 pMutableAttrList->AddAttribute( aAttrQName, aAttrValue );
63}
64
67 const OUString& rQName ) :
68 XMLTransformerContext( rImp, rQName ),
69 m_aElemQName( rQName ),
70 m_nActionMap( INVALID_ACTIONS )
71{
72}
73
76 const OUString& rQName,
77 sal_uInt16 nActionMap ) :
78 XMLTransformerContext( rImp, rQName ),
79 m_aElemQName( rQName ),
80 m_nActionMap( nActionMap )
81{
82}
83
86 const OUString& rQName,
87 sal_uInt16 nPrefix,
89 XMLTransformerContext( rImp, rQName ),
90 m_aElemQName( rImp.GetNamespaceMap().GetQNameByKey( nPrefix,
91 ::xmloff::token::GetXMLToken( eToken ) ) ),
92 m_nActionMap( INVALID_ACTIONS )
93{
94}
95
98 const OUString& rQName,
99 sal_uInt16 nPrefix,
101 sal_uInt16 nActionMap ) :
102 XMLTransformerContext( rImp, rQName ),
103 m_aElemQName( rImp.GetNamespaceMap().GetQNameByKey( nPrefix,
104 ::xmloff::token::GetXMLToken( eToken ) ) ),
105 m_nActionMap( nActionMap )
106{
107}
108
110 sal_uInt16 /*nPrefix*/,
111 const OUString& /*rLocalName*/,
112 const OUString& rQName,
113 const Reference< XAttributeList >& )
114{
115 // ignore all child elements
117 rQName, true, true );
118}
119
121 const Reference< XAttributeList >& rAttrList )
122{
123 XMLMutableAttributeList *pMutableAttrList = nullptr;
124
125 Reference< XAttributeList > xAttrList( rAttrList );
127 {
128 pMutableAttrList =
130 true );
131 }
132
133 if( m_xAttrList.is() )
134 {
135 static_cast< XMLMutableAttributeList * >( m_xAttrList.get() )
136 ->AppendAttributeList( xAttrList );
137 }
138 else if( pMutableAttrList )
139 {
140 m_xAttrList = xAttrList;
141 }
142 else
143 {
144 m_xAttrList = new XMLMutableAttributeList( rAttrList, true );
145 }
146}
147
149{
150 // ignore for now
151}
152
154{
155}
156
158{
159 return true;
160}
161
163{
166 GetTransformer().GetDocHandler()->endElement( m_aElemQName );
167}
168
170{
171 // nothing to export
172}
173
174/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const sal_uInt16 INVALID_ACTIONS
css::uno::Reference< css::xml::sax::XAttributeList > m_xAttrList
virtual void ExportContent() override
virtual bool IsPersistent() const override
virtual rtl::Reference< XMLTransformerContext > CreateChildContext(sal_uInt16 nPrefix, const OUString &rLocalName, const OUString &rQName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList) override
virtual void Characters(const OUString &rChars) override
virtual void StartElement(const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList) override
XMLPersAttrListTContext(XMLTransformerBase &rTransformer, const OUString &rQName)
virtual void Export() override
void AddAttribute(sal_uInt16 nAPrefix, ::xmloff::token::XMLTokenEnum eAToken, ::xmloff::token::XMLTokenEnum eVToken)
virtual void EndElement() override
const css::uno::Reference< css::xml::sax::XDocumentHandler > & GetDocHandler() const
XMLMutableAttributeList * ProcessAttrList(css::uno::Reference< css::xml::sax::XAttributeList > &rAttrList, sal_uInt16 nActionMap, bool bClone)
XMLTransformerBase & GetTransformer()
XMLTokenEnum
The enumeration of all XML tokens.
Definition: xmltoken.hxx:50
const OUString & GetXMLToken(enum XMLTokenEnum eToken)
return the OUString representation for eToken
Definition: xmltoken.cxx:3541
XMLTokenEnum eToken
Definition: xmltoken.cxx:40