1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 _FRAMEWORK_XML_ACCELERATORCONFIGURATIONREADER_HXX_
21 #define _FRAMEWORK_XML_ACCELERATORCONFIGURATIONREADER_HXX_
23 #include <accelerators/acceleratorcache.hxx>
24 #include <accelerators/keymapping.hxx>
25 #include <macros/xinterface.hxx>
26 #include <threadhelp/threadhelpbase.hxx>
29 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
31 #include <com/sun/star/xml/sax/XLocator.hpp>
33 #include <salhelper/singletonref.hxx>
34 #include <cppuhelper/weak.hxx>
35 #include <rtl/ustring.hxx>
39 class AcceleratorConfigurationReader
: public css::xml::sax::XDocumentHandler
40 , private ThreadHelpBase
41 , public ::cppu::OWeakObject
43 //-------------------------------------------
48 //---------------------------------------
49 /** @short classification of XML elements. */
52 E_ELEMENT_ACCELERATORLIST
,
56 //---------------------------------------
57 /** @short classification of XML attributes. */
61 E_ATTRIBUTE_MOD_SHIFT
,
68 //---------------------------------------
69 /** @short some namespace defines */
70 enum EAcceleratorXMLNamespace
76 //-------------------------------------------
81 //---------------------------------------
82 /** @short needed to read the xml configuration. */
83 css::uno::Reference
< css::xml::sax::XDocumentHandler
> m_xReader
;
85 //---------------------------------------
86 /** @short reference to the outside container, where this
87 reader/writer must work on. */
88 AcceleratorCache
& m_rContainer
;
90 //---------------------------------------
91 /** @short used to detect if an accelerator list
92 occures recursive inside xml. */
93 sal_Bool m_bInsideAcceleratorList
;
95 //---------------------------------------
96 /** @short used to detect if an accelerator item
97 occures recursive inside xml. */
98 sal_Bool m_bInsideAcceleratorItem
;
100 //---------------------------------------
101 /** @short is used to map key codes to its
102 string representation.
104 @descr To perform this operatio is
105 created only one times and holded
107 ::salhelper::SingletonRef
< KeyMapping
> m_rKeyMapping
;
109 //---------------------------------------
110 /** @short provide information about the parsing state.
112 @descr We use it to find out the line and column, where
115 css::uno::Reference
< css::xml::sax::XLocator
> m_xLocator
;
117 //-------------------------------------------
122 //---------------------------------------
123 /** @short connect this new reader/writer instance
124 to an outside container, which should be used
125 flushed to the underlying XML configuration or
129 a reference to the outside container.
131 AcceleratorConfigurationReader(AcceleratorCache
& rContainer
);
133 //---------------------------------------
134 /** @short does nothing real ... */
135 virtual ~AcceleratorConfigurationReader();
137 //---------------------------------------
139 FWK_DECLARE_XINTERFACE
141 //---------------------------------------
143 virtual void SAL_CALL
startDocument()
144 throw(css::xml::sax::SAXException
,
145 css::uno::RuntimeException
);
147 virtual void SAL_CALL
endDocument()
148 throw(css::xml::sax::SAXException
,
149 css::uno::RuntimeException
);
151 virtual void SAL_CALL
startElement(const OUString
& sElement
,
152 const css::uno::Reference
< css::xml::sax::XAttributeList
>& xAttributeList
)
153 throw(css::xml::sax::SAXException
,
154 css::uno::RuntimeException
);
156 virtual void SAL_CALL
endElement(const OUString
& sElement
)
157 throw(css::xml::sax::SAXException
,
158 css::uno::RuntimeException
);
160 virtual void SAL_CALL
characters(const OUString
& sChars
)
161 throw(css::xml::sax::SAXException
,
162 css::uno::RuntimeException
);
164 virtual void SAL_CALL
ignorableWhitespace(const OUString
& sWhitespaces
)
165 throw(css::xml::sax::SAXException
,
166 css::uno::RuntimeException
);
168 virtual void SAL_CALL
processingInstruction(const OUString
& sTarget
,
169 const OUString
& sData
)
170 throw(css::xml::sax::SAXException
,
171 css::uno::RuntimeException
);
173 virtual void SAL_CALL
setDocumentLocator(const css::uno::Reference
< css::xml::sax::XLocator
>& xLocator
)
174 throw(css::xml::sax::SAXException
,
175 css::uno::RuntimeException
);
177 //-------------------------------------------
182 //---------------------------------------
183 /** TODO document me */
184 static EXMLElement
implst_classifyElement(const OUString
& sElement
);
186 //---------------------------------------
187 /** TODO document me */
188 static EXMLAttribute
implst_classifyAttribute(const OUString
& sAttribute
);
190 //---------------------------------------
191 /** TODO document me */
192 OUString
implts_getErrorLineString();
195 } // namespace framework
197 #endif // _FRAMEWORK_XML_ACCELERATORCONFIGURATIONREADER_HXX_
199 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */