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 <com/sun/star/uno/Sequence.hxx>
27 #include <xmloff/xmlictxt.hxx>
28 #include <xmloff/xmlevent.hxx>
33 namespace com
{ namespace sun
{ namespace star
{
34 namespace xml
{ namespace sax
{ class XAttributeList
; } }
35 namespace beans
{ struct PropertyValue
; }
36 namespace container
{ class XNameReplace
; }
37 namespace document
{ class XEventsSupplier
; }
42 ::com::sun::star::uno::Sequence
<
43 ::com::sun::star::beans::PropertyValue
> > EventNameValuesPair
;
45 typedef ::std::vector
< EventNameValuesPair
> EventsVector
;
48 * Import <script:events> element.
50 * The import context usually sets the events immediately at the event
51 * XNameReplace. If none was given on construction, it operates in
52 * delayed mode: All events are collected and may then be set
53 * with the setEvents() method.
55 class XMLOFF_DLLPUBLIC XMLEventsImportContext
: public SvXMLImportContext
58 // the event XNameReplace; may be empty
59 ::com::sun::star::uno::Reference
<
60 ::com::sun::star::container::XNameReplace
> xEvents
;
62 // if no XNameReplace is given, use this vector to collect events
63 EventsVector aCollectEvents
;
69 XMLEventsImportContext(
72 const OUString
& rLocalName
);
74 XMLEventsImportContext(
77 const OUString
& rLocalName
,
78 const ::com::sun::star::uno::Reference
<
79 ::com::sun::star::document::XEventsSupplier
> & xEventsSupplier
);
81 XMLEventsImportContext(
84 const OUString
& rLocalName
,
85 const ::com::sun::star::uno::Reference
<
86 ::com::sun::star::container::XNameReplace
> & xNameRepl
);
88 virtual ~XMLEventsImportContext();
91 const OUString
& rEventName
,
92 const ::com::sun::star::uno::Sequence
<
93 ::com::sun::star::beans::PropertyValue
> & rValues
);
95 /// if the import operates in delayed mode, you can use this method
96 /// to set all events that have been read on the XEventsSupplier
98 const ::com::sun::star::uno::Reference
<
99 ::com::sun::star::document::XEventsSupplier
> & xEventsSupplier
);
101 /// if the import operates in delayed mode, you can use this method
102 /// to set all events that have been read on the XNameReplace
104 const ::com::sun::star::uno::Reference
<
105 ::com::sun::star::container::XNameReplace
> & xNameRepl
);
107 /// if the import operates indelayed mode, you can use this method
108 /// to obtain the value sequence for a specific event
109 bool GetEventSequence(
110 const OUString
& rName
,
111 ::com::sun::star::uno::Sequence
<
112 ::com::sun::star::beans::PropertyValue
> & rSequence
);
116 virtual void StartElement(
117 const ::com::sun::star::uno::Reference
<
118 ::com::sun::star::xml::sax::XAttributeList
> & xAttrList
) SAL_OVERRIDE
;
120 virtual void EndElement() SAL_OVERRIDE
;
122 virtual SvXMLImportContext
*CreateChildContext(
124 const OUString
& rLocalName
,
125 const ::com::sun::star::uno::Reference
<
126 ::com::sun::star::xml::sax::XAttributeList
> & xAttrList
) SAL_OVERRIDE
;
131 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */