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: acceleratorconfigurationreader.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_ACCELERATORCONFIGURATIONREADER_HXX_
32 #define _FRAMEWORK_XML_ACCELERATORCONFIGURATIONREADER_HXX_
34 //_______________________________________________
37 #include <accelerators/acceleratorcache.hxx>
38 #include <accelerators/keymapping.hxx>
39 #include <macros/xinterface.hxx>
40 #include <threadhelp/threadhelpbase.hxx>
43 //_______________________________________________
46 #ifndef __COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HPP_
47 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
50 #ifndef __COM_SUN_STAR_XML_SAX_XLOCATOR_HPP_
51 #include <com/sun/star/xml/sax/XLocator.hpp>
54 //_______________________________________________
56 #include <salhelper/singletonref.hxx>
57 #include <cppuhelper/weak.hxx>
58 #include <rtl/ustring.hxx>
62 class AcceleratorConfigurationReader
: public css::xml::sax::XDocumentHandler
63 , private ThreadHelpBase
64 , public ::cppu::OWeakObject
66 //-------------------------------------------
71 //---------------------------------------
72 /** @short classification of XML elements. */
75 E_ELEMENT_ACCELERATORLIST
,
79 //---------------------------------------
80 /** @short classification of XML attributes. */
84 E_ATTRIBUTE_MOD_SHIFT
,
91 //---------------------------------------
92 /** @short some namespace defines */
93 enum EAcceleratorXMLNamespace
99 //-------------------------------------------
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
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
138 css::uno::Reference
< css::xml::sax::XLocator
> m_xLocator
;
140 /* SfxAcceleratorItemList& m_aReadAcceleratorList;
143 //-------------------------------------------
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
155 a reference to the outside container.
157 AcceleratorConfigurationReader(AcceleratorCache
& rContainer
);
159 //---------------------------------------
160 /** @short does nothing real ... */
161 virtual ~AcceleratorConfigurationReader();
163 //---------------------------------------
165 FWK_DECLARE_XINTERFACE
167 //---------------------------------------
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 //-------------------------------------------
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_