LibreOffice Module xmloff (master)  1
XMLEventsImportContext.hxx
Go to the documentation of this file.
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_XMLEVENTSIMPORTCONTEXT_HXX
21 #define INCLUDED_XMLOFF_XMLEVENTSIMPORTCONTEXT_HXX
22 
23 #include <sal/config.h>
24 #include <xmloff/dllapi.h>
25 #include <com/sun/star/uno/Reference.hxx>
26 #include <xmloff/xmlictxt.hxx>
27 
28 #include <vector>
29 
30 namespace com::sun::star {
31  namespace xml::sax { class XAttributeList; }
32  namespace beans { struct PropertyValue; }
33  namespace container { class XNameReplace; }
34  namespace document { class XEventsSupplier; }
35 }
36 
37 namespace com::sun::star::uno { template <class E> class Sequence; }
38 
39 typedef ::std::pair<
40  OUString,
41  css::uno::Sequence<css::beans::PropertyValue> > EventNameValuesPair;
42 
52 {
53  // the event XNameReplace; may be empty
54  css::uno::Reference<css::container::XNameReplace> xEvents;
55 
56 protected:
57  // if no XNameReplace is given, use this vector to collect events
58  std::vector< EventNameValuesPair > aCollectEvents;
59 
60 public:
61 
62 
64  SvXMLImport& rImport,
65  sal_uInt16 nPrfx,
66  const OUString& rLocalName);
67 
69 
71  SvXMLImport& rImport,
72  sal_uInt16 nPrfx,
73  const OUString& rLocalName,
74  const css::uno::Reference<css::document::XEventsSupplier> & xEventsSupplier);
75 
77  SvXMLImport& rImport,
78  const css::uno::Reference<css::document::XEventsSupplier> & xEventsSupplier);
79 
81  SvXMLImport& rImport,
82  sal_uInt16 nPrfx,
83  const OUString& rLocalName,
84  const css::uno::Reference<css::container::XNameReplace> & xNameRepl);
85 
86  virtual ~XMLEventsImportContext() override;
87 
88  void AddEventValues(
89  const OUString& rEventName,
90  const css::uno::Sequence<css::beans::PropertyValue> & rValues);
91 
94  void SetEvents(
95  const css::uno::Reference<css::document::XEventsSupplier> & xEventsSupplier);
96 
99  void SetEvents(
100  const css::uno::Reference<css::container::XNameReplace> & xNameRepl);
101 
104  void GetEventSequence(
105  const OUString& rName,
106  css::uno::Sequence<css::beans::PropertyValue> & rSequence );
107 
108 protected:
109 
110  virtual void StartElement(
111  const css::uno::Reference<css::xml::sax::XAttributeList> & xAttrList) override;
112 
113  virtual void EndElement() override;
114 
116  sal_uInt16 nPrefix,
117  const OUString& rLocalName,
118  const css::uno::Reference<css::xml::sax::XAttributeList> & xAttrList ) override;
119 
120  virtual void SAL_CALL startFastElement( sal_Int32 nElement,
121  const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override;
122 
123  virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
124 
125  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
126  sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
127 };
128 
129 #endif
130 
131 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void EndElement()
EndElement is called before a context will be destructed, but after an elements context has been pars...
Definition: xmlictxt.cxx:62
css::uno::Reference< css::container::XNameReplace > xEvents
virtual void SAL_CALL startFastElement(sal_Int32 Element, const css::uno::Reference< css::xml::sax::XFastAttributeList > &Attribs) override
Definition: xmlictxt.cxx:71
virtual void StartElement(const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList)
StartElement is called after a context has been constructed and before an elements context is parsed...
Definition: xmlictxt.cxx:58
exports com.sun.star. container
This class deliberately does not support XWeak, to improve performance when loading large documents...
Definition: xmlictxt.hxx:44
exports com.sun.star. beans
virtual void SAL_CALL endFastElement(sal_Int32 Element) override
Definition: xmlictxt.cxx:114
exports com.sun.star. document
::std::pair< OUString, css::uno::Sequence< css::beans::PropertyValue > > EventNameValuesPair
virtual css::uno::Reference< XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 Element, const css::uno::Reference< css::xml::sax::XFastAttributeList > &Attribs) override
Definition: xmlictxt.cxx:128
virtual SvXMLImportContextRef CreateChildContext(sal_uInt16 nPrefix, const OUString &rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList)
Create a children element context.
Definition: xmlictxt.cxx:51
std::vector< EventNameValuesPair > aCollectEvents
#define XMLOFF_DLLPUBLIC
Definition: dllapi.h:29