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_XMLICTXT_HXX
21 : #define INCLUDED_XMLOFF_XMLICTXT_HXX
22 :
23 : #include <sal/config.h>
24 : #include <xmloff/dllapi.h>
25 : #include <sal/types.h>
26 : #include <com/sun/star/xml/sax/XAttributeList.hpp>
27 : #include <tools/ref.hxx>
28 : #include <rtl/ustring.hxx>
29 : #include <tools/rtti.hxx>
30 :
31 : class SvXMLNamespaceMap;
32 : class SvXMLImport;
33 :
34 0 : class XMLOFF_DLLPUBLIC SvXMLImportContext : public SvRefBase
35 : {
36 : friend class SvXMLImport;
37 :
38 : SvXMLImport& mrImport;
39 :
40 : sal_uInt16 mnPrefix;
41 : OUString maLocalName;
42 :
43 : SvXMLNamespaceMap *mpRewindMap;
44 :
45 0 : SAL_DLLPRIVATE SvXMLNamespaceMap *GetRewindMap() const
46 0 : { return mpRewindMap; }
47 0 : SAL_DLLPRIVATE void SetRewindMap( SvXMLNamespaceMap *p ) { mpRewindMap = p; }
48 :
49 : protected:
50 :
51 0 : SvXMLImport& GetImport() { return mrImport; }
52 0 : const SvXMLImport& GetImport() const { return mrImport; }
53 :
54 : public:
55 : TYPEINFO();
56 :
57 0 : sal_uInt16 GetPrefix() const { return mnPrefix; }
58 0 : const OUString& GetLocalName() const { return maLocalName; }
59 :
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 : SvXMLImportContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
65 : const OUString& rLName );
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 ~SvXMLImportContext();
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 SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
76 : const OUString& rLocalName,
77 : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
78 :
79 : /** StartElement is called after a context has been constructed and
80 : * before a elements context is parsed. It may be used for actions that
81 : * require virtual methods. The default is to do nothing. */
82 : virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
83 :
84 : /** EndElement is called before a context will be destructed, but
85 : * after a elements context has been parsed. It may be used for actions
86 : * that require virtual methods. The default is to do nothing. */
87 : virtual void EndElement();
88 :
89 : /** This method is called for all characters that are contained in the
90 : * current element. The default is to ignore them. */
91 : virtual void Characters( const OUString& rChars );
92 :
93 : // #i124143# allow to copy evtl. useful data from another temporary import context, e.g. used to
94 : // support multiple images and to rescue evtl. GluePoints imported with one of the
95 : // to be deprecated contents
96 : virtual void onDemandRescueUsefulDataFromTemporary( const SvXMLImportContext& rCandidate );
97 : };
98 :
99 : typedef tools::SvRef<SvXMLImportContext> SvXMLImportContextRef;
100 :
101 : #endif // INCLUDED_XMLOFF_XMLICTXT_HXX
102 :
103 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|