1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: eventsdocumenthandler.hxx,v $
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 __FRAMEWORK_XML_EVENTSDOCUMENTHANDLER_HXX_
32 #define __FRAMEWORK_XML_EVENTSDOCUMENTHANDLER_HXX_
34 #ifndef __FRAMEWORK_XML_TOOLBOXCONFIGURATION_HXX_
35 #include <xml/eventsconfiguration.hxx>
38 //_________________________________________________________________________________________________________________
40 //_________________________________________________________________________________________________________________
42 #ifndef __COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HPP_
43 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
46 //_________________________________________________________________________________________________________________
48 //_________________________________________________________________________________________________________________
49 #include <threadhelp/threadhelpbase.hxx>
50 #include <rtl/ustring.hxx>
51 #include <cppuhelper/implbase1.hxx>
56 //_________________________________________________________________________________________________________________
58 //_________________________________________________________________________________________________________________
62 //*****************************************************************************************************************
63 // Hash code function for using in all hash maps of follow implementation.
65 class OReadEventsDocumentHandler
: private ThreadHelpBase
, // Struct for right initalization of lock member! Must be first of baseclasses.
66 public ::cppu::WeakImplHelper1
< ::com::sun::star::xml::sax::XDocumentHandler
>
77 EV_ATTRIBUTE_MACRONAME
,
82 enum Event_XML_Namespace
86 EV_XML_NAMESPACES_COUNT
89 OReadEventsDocumentHandler( EventsConfig
& aItems
);
93 virtual void SAL_CALL
startDocument(void)
94 throw ( ::com::sun::star::xml::sax::SAXException
,
95 ::com::sun::star::uno::RuntimeException
);
97 virtual void SAL_CALL
endDocument(void)
98 throw( ::com::sun::star::xml::sax::SAXException
,
99 ::com::sun::star::uno::RuntimeException
);
101 virtual void SAL_CALL
startElement(
102 const rtl::OUString
& aName
,
103 const ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XAttributeList
> &xAttribs
)
104 throw( ::com::sun::star::xml::sax::SAXException
,
105 ::com::sun::star::uno::RuntimeException
);
107 virtual void SAL_CALL
endElement(const rtl::OUString
& aName
)
108 throw( ::com::sun::star::xml::sax::SAXException
,
109 ::com::sun::star::uno::RuntimeException
);
111 virtual void SAL_CALL
characters(const rtl::OUString
& aChars
)
112 throw( ::com::sun::star::xml::sax::SAXException
,
113 ::com::sun::star::uno::RuntimeException
);
115 virtual void SAL_CALL
ignorableWhitespace(const rtl::OUString
& aWhitespaces
)
116 throw( ::com::sun::star::xml::sax::SAXException
,
117 ::com::sun::star::uno::RuntimeException
);
119 virtual void SAL_CALL
processingInstruction(const rtl::OUString
& aTarget
,
120 const rtl::OUString
& aData
)
121 throw( ::com::sun::star::xml::sax::SAXException
,
122 ::com::sun::star::uno::RuntimeException
);
124 virtual void SAL_CALL
setDocumentLocator(
125 const ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XLocator
> &xLocator
)
126 throw( ::com::sun::star::xml::sax::SAXException
,
127 ::com::sun::star::uno::RuntimeException
);
130 virtual ~OReadEventsDocumentHandler();
133 ::rtl::OUString
getErrorLineString();
135 class EventsHashMap
: public ::std::hash_map
< ::rtl::OUString
,
138 ::std::equal_to
< ::rtl::OUString
> >
143 EventsHashMap().swap( *this );
147 sal_Bool m_bEventsStartFound
;
148 sal_Bool m_bEventsEndFound
;
149 sal_Bool m_bEventStartFound
;
150 EventsHashMap m_aEventsMap
;
151 EventsConfig
& m_aEventItems
;
152 ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XLocator
> m_xLocator
;
155 class OWriteEventsDocumentHandler
: private ThreadHelpBase
// Struct for right initalization of lock member! Must be first of baseclasses.
158 OWriteEventsDocumentHandler(
159 const EventsConfig
& aItems
,
160 ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XDocumentHandler
> );
161 virtual ~OWriteEventsDocumentHandler();
163 void WriteEventsDocument() throw
164 ( ::com::sun::star::xml::sax::SAXException
,
165 ::com::sun::star::uno::RuntimeException
);
168 virtual void WriteEvent(
169 const ::rtl::OUString
& aEventName
,
170 const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>& aPropertyValue
) throw
171 ( ::com::sun::star::xml::sax::SAXException
,
172 ::com::sun::star::uno::RuntimeException
);
174 const EventsConfig
& m_aItems
;
175 ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XDocumentHandler
> m_xWriteDocumentHandler
;
176 ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XAttributeList
> m_xEmptyList
;
177 ::rtl::OUString m_aXMLEventNS
;
178 ::rtl::OUString m_aXMLXlinkNS
;
179 ::rtl::OUString m_aAttributeType
;
180 ::rtl::OUString m_aAttributeURL
;
181 ::rtl::OUString m_aAttributeLanguage
;
182 ::rtl::OUString m_aAttributeLinkType
;
183 ::rtl::OUString m_aAttributeMacroName
;
184 ::rtl::OUString m_aAttributeLibrary
;
185 ::rtl::OUString m_aAttributeName
;
188 } // namespace framework