bump product version to 5.0.4.1
[LibreOffice.git] / xmloff / source / transform / TransformerContext.hxx
blob4bd1499a8af597dae0d1b377b5911007eebf75d2
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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_TRANSFORMERCONTEXT_HXX
21 #define INCLUDED_XMLOFF_SOURCE_TRANSFORM_TRANSFORMERCONTEXT_HXX
23 #include <com/sun/star/xml/sax/XAttributeList.hpp>
24 #include <salhelper/simplereferenceobject.hxx>
25 #include <rtl/ustring.hxx>
26 #include <tools/rtti.hxx>
27 #include <xmloff/xmltoken.hxx>
29 class SvXMLNamespaceMap;
30 class XMLTransformerBase;
32 class XMLTransformerContext : public ::salhelper::SimpleReferenceObject
34 friend class XMLTransformerBase;
36 XMLTransformerBase& m_rTransformer;
38 OUString m_aQName;
40 SvXMLNamespaceMap *m_pRewindMap;
42 SvXMLNamespaceMap *GetRewindMap() const { return m_pRewindMap; }
43 void SetRewindMap( SvXMLNamespaceMap *p ) { m_pRewindMap = p; }
45 protected:
47 XMLTransformerBase& GetTransformer() { return m_rTransformer; }
48 const XMLTransformerBase& GetTransformer() const { return m_rTransformer; }
50 void SetQName( const OUString& rQName ) { m_aQName = rQName; }
52 public:
53 TYPEINFO();
55 const OUString& GetQName() const { return m_aQName; }
56 bool HasQName( sal_uInt16 nPrefix,
57 ::xmloff::token::XMLTokenEnum eToken ) const;
58 bool HasNamespace( sal_uInt16 nPrefix ) const;
60 // A contexts constructor does anything that is required if an element
61 // starts. Namespace processing has been done already.
62 // Note that virtual methods cannot be used inside constructors. Use
63 // StartElement instead if this is required.
64 XMLTransformerContext( XMLTransformerBase& rTransformer,
65 const OUString& rQName );
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 ~XMLTransformerContext();
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 );
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 );
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();
90 // This method is called for all characters that are contained in the
91 // current element. The default is to ignore them.
92 virtual void Characters( const OUString& rChars );
94 // Is the current context a persistent one (i.e. one that saves is content
95 // rather than exporting it directly?
96 virtual bool IsPersistent() const;
98 // Export the whole element. By default, nothing is done here
99 virtual void Export();
101 // Export the element content. By default, nothing is done here
102 virtual void ExportContent();
106 #endif // INCLUDED_XMLOFF_SOURCE_TRANSFORM_TRANSFORMERCONTEXT_HXX
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */