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 INCLUDED_FRAMEWORK_INC_XML_ACCELERATORCONFIGURATIONREADER_HXX
21 #define INCLUDED_FRAMEWORK_INC_XML_ACCELERATORCONFIGURATIONREADER_HXX
23 #include <accelerators/acceleratorcache.hxx>
24 #include <accelerators/keymapping.hxx>
25 #include <macros/xinterface.hxx>
28 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
30 #include <com/sun/star/xml/sax/XLocator.hpp>
32 #include <salhelper/singletonref.hxx>
33 #include <cppuhelper/implbase1.hxx>
34 #include <rtl/ustring.hxx>
38 class AcceleratorConfigurationReader
: public ::cppu::WeakImplHelper1
< css::xml::sax::XDocumentHandler
>
45 /** @short classification of XML elements. */
48 E_ELEMENT_ACCELERATORLIST
,
52 /** @short classification of XML attributes. */
56 E_ATTRIBUTE_MOD_SHIFT
,
63 /** @short some namespace defines */
64 enum EAcceleratorXMLNamespace
74 /** @short needed to read the xml configuration. */
75 css::uno::Reference
< css::xml::sax::XDocumentHandler
> m_xReader
;
77 /** @short reference to the outside container, where this
78 reader/writer must work on. */
79 AcceleratorCache
& m_rContainer
;
81 /** @short used to detect if an accelerator list
82 occurs recursive inside xml. */
83 bool m_bInsideAcceleratorList
;
85 /** @short used to detect if an accelerator item
86 occurs recursive inside xml. */
87 bool m_bInsideAcceleratorItem
;
89 /** @short is used to map key codes to its
90 string representation.
92 @descr To perform this operation is
93 created only one time and kept
95 ::salhelper::SingletonRef
< KeyMapping
> m_rKeyMapping
;
97 /** @short provide information about the parsing state.
99 @descr We use it to find out the line and column, where
102 css::uno::Reference
< css::xml::sax::XLocator
> m_xLocator
;
108 /** @short connect this new reader/writer instance
109 to an outside container, which should be used
110 flushed to the underlying XML configuration or
114 a reference to the outside container.
116 AcceleratorConfigurationReader(AcceleratorCache
& rContainer
);
118 /** @short does nothing real ... */
119 virtual ~AcceleratorConfigurationReader();
122 virtual void SAL_CALL
startDocument()
123 throw(css::xml::sax::SAXException
,
124 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
126 virtual void SAL_CALL
endDocument()
127 throw(css::xml::sax::SAXException
,
128 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
130 virtual void SAL_CALL
startElement(const OUString
& sElement
,
131 const css::uno::Reference
< css::xml::sax::XAttributeList
>& xAttributeList
)
132 throw(css::xml::sax::SAXException
,
133 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
135 virtual void SAL_CALL
endElement(const OUString
& sElement
)
136 throw(css::xml::sax::SAXException
,
137 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
139 virtual void SAL_CALL
characters(const OUString
& sChars
)
140 throw(css::xml::sax::SAXException
,
141 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
143 virtual void SAL_CALL
ignorableWhitespace(const OUString
& sWhitespaces
)
144 throw(css::xml::sax::SAXException
,
145 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
147 virtual void SAL_CALL
processingInstruction(const OUString
& sTarget
,
148 const OUString
& sData
)
149 throw(css::xml::sax::SAXException
,
150 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
152 virtual void SAL_CALL
setDocumentLocator(const css::uno::Reference
< css::xml::sax::XLocator
>& xLocator
)
153 throw(css::xml::sax::SAXException
,
154 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
160 /** TODO document me */
161 static EXMLElement
implst_classifyElement(const OUString
& sElement
);
163 /** TODO document me */
164 static EXMLAttribute
implst_classifyAttribute(const OUString
& sAttribute
);
166 /** TODO document me */
167 OUString
implts_getErrorLineString();
170 } // namespace framework
172 #endif // INCLUDED_FRAMEWORK_INC_XML_ACCELERATORCONFIGURATIONREADER_HXX
174 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */