1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #ifndef INCLUDED_XMLOFF_SOURCE_TRANSFORM_PERSATTRLISTTCONTEXT_HXX
21 #define INCLUDED_XMLOFF_SOURCE_TRANSFORM_PERSATTRLISTTCONTEXT_HXX
23 #include <xmloff/xmltoken.hxx>
24 #include "TransformerContext.hxx"
27 class XMLPersAttrListTContext
: public XMLTransformerContext
30 css::uno::Reference
< css::xml::sax::XAttributeList
> m_xAttrList
;
31 OUString m_aElemQName
;
32 sal_uInt16 m_nActionMap
;
36 void SetExportQName( const OUString
& r
) { m_aElemQName
= r
; }
39 // A contexts constructor does anything that is required if an element
40 // starts. Namespace processing has been done already.
41 // Note that virtual methods cannot be used inside constructors. Use
42 // StartElement instead if this is required.
43 XMLPersAttrListTContext( XMLTransformerBase
& rTransformer
,
44 const OUString
& rQName
);
46 // attr list persistence + attribute processing
47 XMLPersAttrListTContext( XMLTransformerBase
& rTransformer
,
48 const OUString
& rQName
,
49 sal_uInt16 nActionMap
);
51 // attr list persistence + renaming
52 XMLPersAttrListTContext( XMLTransformerBase
& rTransformer
,
53 const OUString
& rQName
,
55 ::xmloff::token::XMLTokenEnum eToken
);
57 // attr list persistence + renaming + attribute processing
58 XMLPersAttrListTContext( XMLTransformerBase
& rTransformer
,
59 const OUString
& rQName
,
61 ::xmloff::token::XMLTokenEnum eToken
,
62 sal_uInt16 nActionMap
);
64 // A contexts destructor does anything that is required if an element
65 // ends. By default, nothing is done.
66 // Note that virtual methods cannot be used inside destructors. Use
67 // EndElement instead if this is required.
68 virtual ~XMLPersAttrListTContext();
70 // Create a children element context. By default, the import's
71 // CreateContext method is called to create a new default context.
72 virtual rtl::Reference
<XMLTransformerContext
> CreateChildContext( sal_uInt16 nPrefix
,
73 const OUString
& rLocalName
,
74 const OUString
& rQName
,
75 const css::uno::Reference
< css::xml::sax::XAttributeList
>& xAttrList
) override
;
77 // StartElement is called after a context has been constructed and
78 // before a elements context is parsed. It may be used for actions that
79 // require virtual methods. The default is to do nothing.
80 virtual void StartElement( const css::uno::Reference
< css::xml::sax::XAttributeList
>& xAttrList
) override
;
82 // EndElement is called before a context will be destructed, but
83 // after a elements context has been parsed. It may be used for actions
84 // that require virtual methods. The default is to do nothing.
85 virtual void EndElement() override
;
87 // This method is called for all characters that are contained in the
89 virtual void Characters( const OUString
& rChars
) override
;
91 virtual bool IsPersistent() const override
;
92 virtual void Export() override
;
93 virtual void ExportContent() override
;
95 const OUString
& GetExportQName() const { return m_aElemQName
; }
97 void AddAttribute( sal_uInt16 nAPrefix
,
98 ::xmloff::token::XMLTokenEnum eAToken
,
99 ::xmloff::token::XMLTokenEnum eVToken
);
101 void AddAttribute( sal_uInt16 nAPrefix
,
102 ::xmloff::token::XMLTokenEnum eAToken
,
103 const OUString
& rValue
);
105 const css::uno::Reference
< css::xml::sax::XAttributeList
>&
106 GetAttrList() const { return m_xAttrList
; }
110 #endif // INCLUDED_XMLOFF_SOURCE_TRANSFORM_PERSATTRLISTTCONTEXT_HXX
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */