android: Update app-specific/MIME type icons
[LibreOffice.git] / include / xmloff / xmlevent.hxx
blob163437f51af030c862340756a88296b48cadaeea
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 #ifndef INCLUDED_XMLOFF_XMLEVENT_HXX
21 #define INCLUDED_XMLOFF_XMLEVENT_HXX
23 #include <rtl/ustring.hxx>
24 #include <utility>
26 namespace com::sun::star::uno { template <class interface_type> class Reference; }
27 namespace com::sun::star::uno { template <typename > class Sequence; }
30 /**
31 * @#file
33 * Several definition used in im- and export of events
36 namespace com::sun::star {
37 namespace xml::sax { class XFastAttributeList; }
38 namespace beans { struct PropertyValue; }
41 class SvXMLExport;
42 class SvXMLImportContext;
43 class SvXMLImport;
44 class XMLEventsImportContext;
47 struct XMLEventName
49 sal_uInt16 m_nPrefix;
50 OUString m_aName;
52 XMLEventName() : m_nPrefix( 0 ) {}
53 XMLEventName( sal_uInt16 n, const char *p ) :
54 m_nPrefix( n ),
55 m_aName( OUString::createFromAscii(p) )
58 XMLEventName( sal_uInt16 n, OUString s ) :
59 m_nPrefix( n ),
60 m_aName(std::move( s ))
63 bool operator<( const XMLEventName& r ) const
65 return m_nPrefix < r.m_nPrefix ||
66 (m_nPrefix == r.m_nPrefix && m_aName < r.m_aName );
71 /**
72 * XMLEventNameTranslation: define tables that translate between event names
73 * as used in the XML file format and in the StarOffice API.
74 * The last entry in the table must be { NULL, 0, NULL }.
76 struct XMLEventNameTranslation
78 const char* sAPIName;
79 sal_uInt16 nPrefix; // namespace prefix
80 const char* sXMLName;
83 /// a translation table for the events defined in the XEventsSupplier service
84 /// (implemented in XMLEventExport.cxx)
85 extern const XMLEventNameTranslation aStandardEventTable[];
88 /**
89 * Handle export of an event for a certain event type (event type as
90 * defined by the PropertyValue "EventType" in API).
92 * The Handler has to generate the full <script:event> element.
94 class XMLEventExportHandler
96 public:
97 virtual ~XMLEventExportHandler() {};
99 virtual void Export(
100 SvXMLExport& rExport, /// the current XML export
101 const OUString& rEventQName, /// the XML name of the event
102 const css::uno::Sequence<css::beans::PropertyValue> & rValues, /// the values for the event
103 bool bUseWhitespace) = 0; /// create whitespace around elements?
108 * Handle import of an event for a certain event type (as defined by
109 * the PropertyValue "EventType" in the API).
111 * EventContextFactories must be registered with the EventImportHelper
112 * that is attached to the SvXMLImport.
114 * The factory has to create an import context for a <script:event>
115 * element. The context has to call the
116 * EventsImportContext::AddEventValues() method to save its event
117 * registered with the enclosing element. For events consisting only
118 * of attributes (and an empty element) an easy solution is to handle
119 * all attributes in the CreateContext()-method and return a default
120 * context.
122 * EventContextFactory objects have to be registered with the
123 * EventsImportHelper.
125 class XMLEventContextFactory
127 public:
128 virtual ~XMLEventContextFactory() {};
130 virtual SvXMLImportContext* CreateContext(
131 SvXMLImport& rImport, /// import context
132 const css::uno::Reference<css::xml::sax::XFastAttributeList> & xAttrList, /// attribute list
133 /// the context for the enclosing <script:events> element
134 XMLEventsImportContext* rEvents,
135 /// the event name (as understood by the API)
136 const OUString& rApiEventName) = 0;
140 #endif
142 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */