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_unotools_XMLACCELCFG_HXX
21 #define INCLUDED_unotools_XMLACCELCFG_HXX
23 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
24 #include <cppuhelper/weak.hxx>
26 struct SvtAcceleratorConfigItem
34 typedef ::std::list
< SvtAcceleratorConfigItem
> SvtAcceleratorItemList
;
37 class OReadAccelatorDocumentHandler
: public ::com::sun::star::xml::sax::XDocumentHandler
,
38 public ::cppu::OWeakObject
41 OReadAccelatorDocumentHandler( SvtAcceleratorItemList
& aNewAcceleratorItemList
) :
43 m_bAcceleratorMode( sal_False
),
44 m_bItemCloseExpected( sal_False
),
46 m_aReadAcceleratorList( aNewAcceleratorItemList
) {}
47 virtual ~OReadAccelatorDocumentHandler() {}
50 virtual void SAL_CALL
acquire() throw()
51 { OWeakObject::acquire(); }
52 virtual void SAL_CALL
release() throw()
53 { OWeakObject::release(); }
54 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface(
55 const ::com::sun::star::uno::Type
& rType
) throw( ::com::sun::star::uno::RuntimeException
);
58 virtual void SAL_CALL
startDocument(void)
59 throw ( ::com::sun::star::xml::sax::SAXException
, ::com::sun::star::uno::RuntimeException
);
60 virtual void SAL_CALL
endDocument(void)
61 throw ( ::com::sun::star::xml::sax::SAXException
, ::com::sun::star::uno::RuntimeException
);
62 virtual void SAL_CALL
startElement(
63 const OUString
& aName
,
64 const ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XAttributeList
> &xAttribs
)
65 throw( ::com::sun::star::xml::sax::SAXException
, ::com::sun::star::uno::RuntimeException
);
66 virtual void SAL_CALL
endElement(const OUString
& aName
) throw
67 ( ::com::sun::star::xml::sax::SAXException
, ::com::sun::star::uno::RuntimeException
);
68 virtual void SAL_CALL
characters(const OUString
& aChars
)
69 throw( ::com::sun::star::xml::sax::SAXException
, ::com::sun::star::uno::RuntimeException
);
70 virtual void SAL_CALL
ignorableWhitespace(const OUString
& aWhitespaces
)
71 throw( ::com::sun::star::xml::sax::SAXException
, ::com::sun::star::uno::RuntimeException
);
72 virtual void SAL_CALL
processingInstruction( const OUString
& aTarget
, const OUString
& aData
)
73 throw( ::com::sun::star::xml::sax::SAXException
, ::com::sun::star::uno::RuntimeException
);
74 virtual void SAL_CALL
setDocumentLocator(
75 const ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XLocator
> &xLocator
)
76 throw( ::com::sun::star::xml::sax::SAXException
, ::com::sun::star::uno::RuntimeException
);
79 OUString
getErrorLineString();
82 sal_Bool m_bAcceleratorMode
;
83 sal_Bool m_bItemCloseExpected
;
84 ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XLocator
> m_xLocator
;
85 SvtAcceleratorItemList
& m_aReadAcceleratorList
;
89 class OWriteAccelatorDocumentHandler
92 OWriteAccelatorDocumentHandler(
93 const SvtAcceleratorItemList
& aWriteAcceleratorList
,
94 ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XDocumentHandler
> );
95 virtual ~OWriteAccelatorDocumentHandler();
97 void WriteAcceleratorDocument() throw ( ::com::sun::star::xml::sax::SAXException
, ::com::sun::star::uno::RuntimeException
);
100 void WriteAcceleratorItem( const SvtAcceleratorConfigItem
& aAcceleratorItem
) throw( ::com::sun::star::xml::sax::SAXException
, ::com::sun::star::uno::RuntimeException
);
102 ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XDocumentHandler
> m_xWriteDocumentHandler
;
103 ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XAttributeList
> m_xEmptyList
;
104 OUString m_aAttributeType
;
105 const SvtAcceleratorItemList
& m_aWriteAcceleratorList
;
108 #endif // INCLUDED_unotools_XMLACCELCFG_HXX
110 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */