Update ooo320-m1
[ooovba.git] / binfilter / inc / bf_xmloff / xmlevent.hxx
blob55b00800a810d062d215f2dd1d21a6d1e979685a
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xmlevent.hxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _XMLOFF_XMLEVENT_HXX
32 #define _XMLOFF_XMLEVENT_HXX
34 #ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
35 #include <com/sun/star/uno/Sequence.hxx>
36 #endif
39 /**
40 * @#file
42 * Several definition used in im- and export of events
45 namespace com { namespace sun { namespace star {
46 namespace xml { namespace sax { class XAttributeList; } }
47 namespace beans { struct PropertyValue; }
48 } } }
49 namespace rtl { class OUString; }
50 namespace binfilter {
52 class SvXMLExport;
53 class SvXMLImportContext;
54 class SvXMLImport;
55 class XMLEventsImportContext;
57 /**
58 * XMLEventNameTranslation: define tables that translate between event names
59 * as used in the XML file format and in the StarOffice API.
60 * The last entry in the table must be { NULL, NULL }.
62 struct XMLEventNameTranslation
64 const sal_Char* sAPIName;
65 const sal_Char* sXMLName;
68 /// a translation table for the events defined in the XEventsSupplier service
69 /// (implemented in XMLEventExport.cxx)
70 extern const XMLEventNameTranslation aStandardEventTable[];
72 /**
73 * Handle export of an event for a certain event type (event type as
74 * defined by the PropertyValue "EventType" in API).
76 * The Handler has to generate the full <script:event> element.
78 class XMLEventExportHandler
80 public:
81 virtual ~XMLEventExportHandler() {};
83 virtual void Export(
84 SvXMLExport& rExport, /// the current XML export
85 const ::rtl::OUString& rEventName, /// the XML name of the event
86 ::com::sun::star::uno::Sequence< /// the values for the event
87 ::com::sun::star::beans::PropertyValue> & rValues,
88 sal_Bool bUseWhitespace) = 0; /// create whitespace around elements?
91 /**
92 * Handle import of an event for a certain event type (as defined by
93 * the PropertyValue "EventType" in the API).
95 * EventContextFactories must be registered with the EventImportHelper
96 * that is attached to the SvXMLImport.
98 * The factory has to create an import context for a <script:event>
99 * element. The context has to call the
100 * EventsImportContext::AddEventValues() method to fave its event
101 * registered with the enclosing element. For events consisting only
102 * of attributes (and an empty element) an easy solution is to handle
103 * all attributes in the CreateContext()-method and return a default
104 * context.
106 * EventContextFactory objects have to be registered with the
107 * EventsImportHelper.
109 class XMLEventContextFactory
111 public:
112 virtual ~XMLEventContextFactory() {};
114 virtual SvXMLImportContext* CreateContext(
115 SvXMLImport& rImport, /// import context
116 sal_uInt16 nPrefix, /// element: namespace prefix
117 const ::rtl::OUString& rLocalName, /// element: local name
118 const ::com::sun::star::uno::Reference< /// attribute list
119 ::com::sun::star::xml::sax::XAttributeList> & xAttrList,
120 /// the context for the enclosing <script:events> element
121 XMLEventsImportContext* rEvents,
122 /// the event name (as understood by the API)
123 const ::rtl::OUString& rApiEventName,
124 /// the event type name (as registered)
125 const ::rtl::OUString& rLanguage) = 0;
128 }//end of namespace binfilter
129 #endif