1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_XMLEVENTSIMPORTCONTEXT_HXX
21 #define INCLUDED_XMLOFF_XMLEVENTSIMPORTCONTEXT_HXX
23 #include <sal/config.h>
24 #include <xmloff/dllapi.h>
25 #include <com/sun/star/uno/Reference.hxx>
26 #include <xmloff/xmlictxt.hxx>
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
; }
37 namespace com::sun::star::uno
{ template <class E
> class Sequence
; }
41 css::uno::Sequence
<css::beans::PropertyValue
> > EventNameValuesPair
;
44 * Import <script:events> element.
46 * The import context usually sets the events immediately at the event
47 * XNameReplace. If none was given on construction, it operates in
48 * delayed mode: All events are collected and may then be set
49 * with the setEvents() method.
51 class XMLOFF_DLLPUBLIC XMLEventsImportContext
: public SvXMLImportContext
53 // the event XNameReplace; may be empty
54 css::uno::Reference
<css::container::XNameReplace
> m_xEvents
;
57 // if no XNameReplace is given, use this vector to collect events
58 std::vector
< EventNameValuesPair
> m_aCollectEvents
;
62 XMLEventsImportContext(SvXMLImport
& rImport
);
64 XMLEventsImportContext(
66 const css::uno::Reference
<css::document::XEventsSupplier
> & xEventsSupplier
);
68 XMLEventsImportContext(
70 const css::uno::Reference
<css::container::XNameReplace
> & xNameRepl
);
72 virtual ~XMLEventsImportContext() override
;
75 const OUString
& rEventName
,
76 const css::uno::Sequence
<css::beans::PropertyValue
> & rValues
);
78 /// if the import operates in delayed mode, you can use this method
79 /// to set all events that have been read on the XEventsSupplier
81 const css::uno::Reference
<css::document::XEventsSupplier
> & xEventsSupplier
);
83 /// if the import operates in delayed mode, you can use this method
84 /// to set all events that have been read on the XNameReplace
86 const css::uno::Reference
<css::container::XNameReplace
> & xNameRepl
);
88 /// if the import operates in delayed mode, you can use this method
89 /// to obtain the value sequence for a specific event
90 void GetEventSequence(
91 const OUString
& rName
,
92 css::uno::Sequence
<css::beans::PropertyValue
> & rSequence
);
96 virtual css::uno::Reference
< css::xml::sax::XFastContextHandler
> SAL_CALL
createFastChildContext(
97 sal_Int32 nElement
, const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& AttrList
) override
;
102 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */