merge the formfield patch from ooo-build
[ooovba.git] / framework / inc / xml / acceleratorconfigurationreader.hxx
blobe633b010bac3e76602d229b8698f4c853e9911ab
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: acceleratorconfigurationreader.hxx,v $
10 * $Revision: 1.5 $
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_ACCELERATORCONFIGURATIONREADER_HXX_
32 #define _FRAMEWORK_XML_ACCELERATORCONFIGURATIONREADER_HXX_
34 //_______________________________________________
35 // own includes
37 #include <accelerators/acceleratorcache.hxx>
38 #include <accelerators/keymapping.hxx>
39 #include <macros/xinterface.hxx>
40 #include <threadhelp/threadhelpbase.hxx>
41 #include <general.h>
43 //_______________________________________________
44 // interface includes
46 #ifndef __COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HPP_
47 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
48 #endif
50 #ifndef __COM_SUN_STAR_XML_SAX_XLOCATOR_HPP_
51 #include <com/sun/star/xml/sax/XLocator.hpp>
52 #endif
54 //_______________________________________________
55 // other includes
56 #include <salhelper/singletonref.hxx>
57 #include <cppuhelper/weak.hxx>
58 #include <rtl/ustring.hxx>
60 namespace framework{
62 class AcceleratorConfigurationReader : public css::xml::sax::XDocumentHandler
63 , private ThreadHelpBase
64 , public ::cppu::OWeakObject
66 //-------------------------------------------
67 // const, types
69 private:
71 //---------------------------------------
72 /** @short classification of XML elements. */
73 enum EXMLElement
75 E_ELEMENT_ACCELERATORLIST,
76 E_ELEMENT_ITEM
79 //---------------------------------------
80 /** @short classification of XML attributes. */
81 enum EXMLAttribute
83 E_ATTRIBUTE_KEYCODE,
84 E_ATTRIBUTE_MOD_SHIFT,
85 E_ATTRIBUTE_MOD_MOD1,
86 E_ATTRIBUTE_MOD_MOD2,
87 E_ATTRIBUTE_MOD_MOD3,
88 E_ATTRIBUTE_URL
91 //---------------------------------------
92 /** @short some namespace defines */
93 enum EAcceleratorXMLNamespace
95 E_NAMESPACE_ACCEL,
96 E_NAMESPACE_XLINK
99 //-------------------------------------------
100 // member
102 private:
104 //---------------------------------------
105 /** @short needed to read the xml configuration. */
106 css::uno::Reference< css::xml::sax::XDocumentHandler > m_xReader;
108 //---------------------------------------
109 /** @short reference to the outside container, where this
110 reader/writer must work on. */
111 AcceleratorCache& m_rContainer;
113 //---------------------------------------
114 /** @short used to detect if an accelerator list
115 occures recursive inside xml. */
116 sal_Bool m_bInsideAcceleratorList;
118 //---------------------------------------
119 /** @short used to detect if an accelerator item
120 occures recursive inside xml. */
121 sal_Bool m_bInsideAcceleratorItem;
123 //---------------------------------------
124 /** @short is used to map key codes to its
125 string representation.
127 @descr To perform this operatio is
128 created only one times and holded
129 alive forever ...*/
130 ::salhelper::SingletonRef< KeyMapping > m_rKeyMapping;
132 //---------------------------------------
133 /** @short provide informations abou the parsing state.
135 @descr We use it to find out the line and column, where
136 an error occure.
138 css::uno::Reference< css::xml::sax::XLocator > m_xLocator;
140 /* SfxAcceleratorItemList& m_aReadAcceleratorList;
143 //-------------------------------------------
144 // interface
146 public:
148 //---------------------------------------
149 /** @short connect this new reader/writer instance
150 to an outside container, which should be used
151 flushed to the underlying XML configuration or
152 filled from there.
154 @param rContainer
155 a reference to the outside container.
157 AcceleratorConfigurationReader(AcceleratorCache& rContainer);
159 //---------------------------------------
160 /** @short does nothing real ... */
161 virtual ~AcceleratorConfigurationReader();
163 //---------------------------------------
164 // XInterface
165 FWK_DECLARE_XINTERFACE
167 //---------------------------------------
168 // XDocumentHandler
169 virtual void SAL_CALL startDocument()
170 throw(css::xml::sax::SAXException,
171 css::uno::RuntimeException );
173 virtual void SAL_CALL endDocument()
174 throw(css::xml::sax::SAXException,
175 css::uno::RuntimeException );
177 virtual void SAL_CALL startElement(const ::rtl::OUString& sElement ,
178 const css::uno::Reference< css::xml::sax::XAttributeList >& xAttributeList)
179 throw(css::xml::sax::SAXException,
180 css::uno::RuntimeException );
182 virtual void SAL_CALL endElement(const ::rtl::OUString& sElement)
183 throw(css::xml::sax::SAXException,
184 css::uno::RuntimeException );
186 virtual void SAL_CALL characters(const ::rtl::OUString& sChars)
187 throw(css::xml::sax::SAXException,
188 css::uno::RuntimeException );
190 virtual void SAL_CALL ignorableWhitespace(const ::rtl::OUString& sWhitespaces)
191 throw(css::xml::sax::SAXException,
192 css::uno::RuntimeException );
194 virtual void SAL_CALL processingInstruction(const ::rtl::OUString& sTarget,
195 const ::rtl::OUString& sData )
196 throw(css::xml::sax::SAXException,
197 css::uno::RuntimeException );
199 virtual void SAL_CALL setDocumentLocator(const css::uno::Reference< css::xml::sax::XLocator >& xLocator)
200 throw(css::xml::sax::SAXException,
201 css::uno::RuntimeException );
203 //-------------------------------------------
204 // helper
206 private:
208 //---------------------------------------
209 /** TODO document me */
210 static EXMLElement implst_classifyElement(const ::rtl::OUString& sElement);
212 //---------------------------------------
213 /** TODO document me */
214 static EXMLAttribute implst_classifyAttribute(const ::rtl::OUString& sAttribute);
216 //---------------------------------------
217 /** TODO document me */
218 ::rtl::OUString implts_getErrorLineString();
221 } // namespace framework
223 #endif // _FRAMEWORK_XML_ACCELERATORCONFIGURATIONREADER_HXX_