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 : #ifndef INCLUDED_XMLOFF_SOURCE_TRANSFORM_PERSATTRLISTTCONTEXT_HXX
21 : #define INCLUDED_XMLOFF_SOURCE_TRANSFORM_PERSATTRLISTTCONTEXT_HXX
22 :
23 : #include <xmloff/xmltoken.hxx>
24 : #include "TransformerContext.hxx"
25 :
26 :
27 : class XMLPersAttrListTContext : public XMLTransformerContext
28 : {
29 :
30 : ::com::sun::star::uno::Reference<
31 : ::com::sun::star::xml::sax::XAttributeList > m_xAttrList;
32 : OUString m_aElemQName;
33 : sal_uInt16 m_nActionMap;
34 :
35 : protected:
36 :
37 4 : void SetExportQName( const OUString& r ) { m_aElemQName = r; }
38 :
39 : public:
40 : TYPEINFO_OVERRIDE();
41 :
42 : // A contexts constructor does anything that is required if an element
43 : // starts. Namespace processing has been done already.
44 : // Note that virtual methods cannot be used inside constructors. Use
45 : // StartElement instead if this is required.
46 : XMLPersAttrListTContext( XMLTransformerBase& rTransformer,
47 : const OUString& rQName );
48 :
49 : // attr list persistence + attribute processing
50 : XMLPersAttrListTContext( XMLTransformerBase& rTransformer,
51 : const OUString& rQName,
52 : sal_uInt16 nActionMap );
53 :
54 : // attr list persistence + renaming
55 : XMLPersAttrListTContext( XMLTransformerBase& rTransformer,
56 : const OUString& rQName,
57 : sal_uInt16 nPrefix,
58 : ::xmloff::token::XMLTokenEnum eToken );
59 :
60 : // attr list persistence + renaming + attribute processing
61 : XMLPersAttrListTContext( XMLTransformerBase& rTransformer,
62 : const OUString& rQName,
63 : sal_uInt16 nPrefix,
64 : ::xmloff::token::XMLTokenEnum eToken,
65 : sal_uInt16 nActionMap );
66 :
67 : // A contexts destructor does anything that is required if an element
68 : // ends. By default, nothing is done.
69 : // Note that virtual methods cannot be used inside destructors. Use
70 : // EndElement instead if this is required.
71 : virtual ~XMLPersAttrListTContext();
72 :
73 : // Create a children element context. By default, the import's
74 : // CreateContext method is called to create a new default context.
75 : virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix,
76 : const OUString& rLocalName,
77 : const OUString& rQName,
78 : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ) SAL_OVERRIDE;
79 :
80 : // StartElement is called after a context has been constructed and
81 : // before a elements context is parsed. It may be used for actions that
82 : // require virtual methods. The default is to do nothing.
83 : virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ) SAL_OVERRIDE;
84 :
85 : // EndElement is called before a context will be destructed, but
86 : // after a elements context has been parsed. It may be used for actions
87 : // that require virtual methods. The default is to do nothing.
88 : virtual void EndElement() SAL_OVERRIDE;
89 :
90 : // This method is called for all characters that are contained in the
91 : // current element.
92 : virtual void Characters( const OUString& rChars ) SAL_OVERRIDE;
93 :
94 : virtual bool IsPersistent() const SAL_OVERRIDE;
95 : virtual void Export() SAL_OVERRIDE;
96 : virtual void ExportContent() SAL_OVERRIDE;
97 :
98 2654 : const OUString& GetExportQName() const { return m_aElemQName; }
99 :
100 : void AddAttribute( sal_uInt16 nAPrefix,
101 : ::xmloff::token::XMLTokenEnum eAToken,
102 : ::xmloff::token::XMLTokenEnum eVToken );
103 :
104 : void AddAttribute( sal_uInt16 nAPrefix,
105 : ::xmloff::token::XMLTokenEnum eAToken,
106 : const OUString & rValue );
107 :
108 : ::com::sun::star::uno::Reference<
109 : ::com::sun::star::xml::sax::XAttributeList >
110 3 : GetAttrList() const { return m_xAttrList; }
111 :
112 : };
113 :
114 : #endif // INCLUDED_XMLOFF_SOURCE_TRANSFORM_PERSATTRLISTTCONTEXT_HXX
115 :
116 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|