1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: PersAttrListTContext.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _XMLOFF_PERSATTRLISTTCONTEXT_HXX
32 #define _XMLOFF_PERSATTRLISTTCONTEXT_HXX
34 #include <xmloff/xmltoken.hxx>
35 #include "TransformerContext.hxx"
38 class XMLPersAttrListTContext
: public XMLTransformerContext
41 ::com::sun::star::uno::Reference
<
42 ::com::sun::star::xml::sax::XAttributeList
> m_xAttrList
;
43 ::rtl::OUString m_aElemQName
;
44 sal_uInt16 m_nActionMap
;
48 void SetExportQName( const ::rtl::OUString
& r
) { m_aElemQName
= r
; }
53 // A contexts constructor does anything that is required if an element
54 // starts. Namespace processing has been done already.
55 // Note that virtual methods cannot be used inside constructors. Use
56 // StartElement instead if this is required.
57 XMLPersAttrListTContext( XMLTransformerBase
& rTransformer
,
58 const ::rtl::OUString
& rQName
);
60 // attr list persistence + attribute processing
61 XMLPersAttrListTContext( XMLTransformerBase
& rTransformer
,
62 const ::rtl::OUString
& rQName
,
63 sal_uInt16 nActionMap
);
65 // attr list persistence + renaming
66 XMLPersAttrListTContext( XMLTransformerBase
& rTransformer
,
67 const ::rtl::OUString
& rQName
,
69 ::xmloff::token::XMLTokenEnum eToken
);
71 // attr list persistence + renaming + attribute processing
72 XMLPersAttrListTContext( XMLTransformerBase
& rTransformer
,
73 const ::rtl::OUString
& rQName
,
75 ::xmloff::token::XMLTokenEnum eToken
,
76 sal_uInt16 nActionMap
);
78 // A contexts destructor does anything that is required if an element
79 // ends. By default, nothing is done.
80 // Note that virtual methods cannot be used inside destructors. Use
81 // EndElement instead if this is required.
82 virtual ~XMLPersAttrListTContext();
84 // Create a childs element context. By default, the import's
85 // CreateContext method is called to create a new default context.
86 virtual XMLTransformerContext
*CreateChildContext( sal_uInt16 nPrefix
,
87 const ::rtl::OUString
& rLocalName
,
88 const ::rtl::OUString
& rQName
,
89 const ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
);
91 // StartElement is called after a context has been constructed and
92 // before a elements context is parsed. It may be used for actions that
93 // require virtual methods. The default is to do nothing.
94 virtual void StartElement( const ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
);
96 // EndElement is called before a context will be destructed, but
97 // after a elements context has been parsed. It may be used for actions
98 // that require virtual methods. The default is to do nothing.
99 virtual void EndElement();
101 // This method is called for all characters that are contained in the
103 virtual void Characters( const ::rtl::OUString
& rChars
);
105 virtual sal_Bool
IsPersistent() const;
106 virtual void Export();
107 virtual void ExportContent();
109 const ::rtl::OUString
& GetExportQName() const { return m_aElemQName
; }
111 void AddAttribute( sal_uInt16 nAPrefix
,
112 ::xmloff::token::XMLTokenEnum eAToken
,
113 ::xmloff::token::XMLTokenEnum eVToken
);
115 void AddAttribute( sal_uInt16 nAPrefix
,
116 ::xmloff::token::XMLTokenEnum eAToken
,
117 const ::rtl::OUString
& rValue
);
119 ::com::sun::star::uno::Reference
<
120 ::com::sun::star::xml::sax::XAttributeList
>
124 #endif // _XMLOFF_PERSATTRLISTTCONTEXT_HXX