Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_UNOTOOLS_XMLACCELCFG_HXX
21 : #define INCLUDED_UNOTOOLS_XMLACCELCFG_HXX
22 :
23 : #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
24 : #include <cppuhelper/weak.hxx>
25 :
26 0 : struct SvtAcceleratorConfigItem
27 : {
28 : sal_uInt16 nCode;
29 : sal_uInt16 nModifier;
30 : OUString aCommand;
31 : };
32 :
33 : #include <list>
34 : typedef ::std::list < SvtAcceleratorConfigItem > SvtAcceleratorItemList;
35 :
36 : class OReadAccelatorDocumentHandler : public ::com::sun::star::xml::sax::XDocumentHandler,
37 : public ::cppu::OWeakObject
38 : {
39 : public:
40 : OReadAccelatorDocumentHandler( SvtAcceleratorItemList& aNewAcceleratorItemList ) :
41 : m_nElementDepth( 0 ),
42 : m_bAcceleratorMode( false ),
43 : m_bItemCloseExpected( false ),
44 : m_xLocator( 0 ),
45 : m_aReadAcceleratorList( aNewAcceleratorItemList ) {}
46 0 : virtual ~OReadAccelatorDocumentHandler() {}
47 :
48 : // XInterface
49 0 : virtual void SAL_CALL acquire() throw() SAL_OVERRIDE
50 0 : { OWeakObject::acquire(); }
51 0 : virtual void SAL_CALL release() throw() SAL_OVERRIDE
52 0 : { OWeakObject::release(); }
53 : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
54 : const ::com::sun::star::uno::Type & rType ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
55 :
56 : // XDocumentHandler
57 : virtual void SAL_CALL startDocument()
58 : throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
59 : virtual void SAL_CALL endDocument()
60 : throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
61 : virtual void SAL_CALL startElement(
62 : const OUString& aName,
63 : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > &xAttribs )
64 : throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
65 : virtual void SAL_CALL endElement(const OUString& aName) throw
66 : ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
67 : virtual void SAL_CALL characters(const OUString& aChars)
68 : throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
69 : virtual void SAL_CALL ignorableWhitespace(const OUString& aWhitespaces)
70 : throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
71 : virtual void SAL_CALL processingInstruction( const OUString& aTarget, const OUString& aData )
72 : throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
73 : virtual void SAL_CALL setDocumentLocator(
74 : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > &xLocator)
75 : throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
76 :
77 : private:
78 : OUString getErrorLineString();
79 :
80 : int m_nElementDepth;
81 : bool m_bAcceleratorMode;
82 : bool m_bItemCloseExpected;
83 : ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > m_xLocator;
84 : SvtAcceleratorItemList& m_aReadAcceleratorList;
85 : };
86 :
87 : #endif // INCLUDED_UNOTOOLS_XMLACCELCFG_HXX
88 :
89 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|