Version 24.2.2.2, tag libreoffice-24.2.2.2
[LibreOffice.git] / xmloff / source / transform / PersAttrListTContext.hxx
blob41ac5a113f43f5a1208949b399a240040abf6ae5
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 #pragma once
22 #include <xmloff/xmltoken.hxx>
23 #include "TransformerContext.hxx"
26 class XMLPersAttrListTContext : public XMLTransformerContext
29 css::uno::Reference< css::xml::sax::XAttributeList > m_xAttrList;
30 OUString m_aElemQName;
31 sal_uInt16 const m_nActionMap;
33 protected:
35 void SetExportQName( const OUString& r ) { m_aElemQName = r; }
37 public:
38 // A contexts constructor does anything that is required if an element
39 // starts. Namespace processing has been done already.
40 // Note that virtual methods cannot be used inside constructors. Use
41 // StartElement instead if this is required.
42 XMLPersAttrListTContext( XMLTransformerBase& rTransformer,
43 const OUString& rQName );
45 // attr list persistence + attribute processing
46 XMLPersAttrListTContext( XMLTransformerBase& rTransformer,
47 const OUString& rQName,
48 sal_uInt16 nActionMap );
50 // attr list persistence + renaming
51 XMLPersAttrListTContext( XMLTransformerBase& rTransformer,
52 const OUString& rQName,
53 sal_uInt16 nPrefix,
54 ::xmloff::token::XMLTokenEnum eToken );
56 // attr list persistence + renaming + attribute processing
57 XMLPersAttrListTContext( XMLTransformerBase& rTransformer,
58 const OUString& rQName,
59 sal_uInt16 nPrefix,
60 ::xmloff::token::XMLTokenEnum eToken,
61 sal_uInt16 nActionMap );
63 // Create a children element context. By default, the import's
64 // CreateContext method is called to create a new default context.
65 virtual rtl::Reference<XMLTransformerContext> CreateChildContext( sal_uInt16 nPrefix,
66 const OUString& rLocalName,
67 const OUString& rQName,
68 const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override;
70 // StartElement is called after a context has been constructed and
71 // before an elements context is parsed. It may be used for actions that
72 // require virtual methods. The default is to do nothing.
73 virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override;
75 // EndElement is called before a context will be destructed, but
76 // after an elements context has been parsed. It may be used for actions
77 // that require virtual methods. The default is to do nothing.
78 virtual void EndElement() override;
80 // This method is called for all characters that are contained in the
81 // current element.
82 virtual void Characters( const OUString& rChars ) override;
84 virtual bool IsPersistent() const override;
85 virtual void Export() override;
86 virtual void ExportContent() override;
88 const OUString& GetExportQName() const { return m_aElemQName; }
90 void AddAttribute( sal_uInt16 nAPrefix,
91 ::xmloff::token::XMLTokenEnum eAToken,
92 ::xmloff::token::XMLTokenEnum eVToken );
94 void AddAttribute( sal_uInt16 nAPrefix,
95 ::xmloff::token::XMLTokenEnum eAToken,
96 const OUString & rValue );
98 const css::uno::Reference< css::xml::sax::XAttributeList >&
99 GetAttrList() const { return m_xAttrList; }
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */