merge the formfield patch from ooo-build
[ooovba.git] / svtools / inc / xmlaccelcfg.hxx
blob0dc59524d1523cf802f550be774f3a883be6c0ba
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xmlaccelcfg.hxx,v $
10 * $Revision: 1.6 $
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 INCLUDED_SVTOOLS_XMLACCELCFG_HXX
32 #define INCLUDED_SVTOOLS_XMLACCELCFG_HXX
34 #ifndef __COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HPP_
35 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
36 #endif
37 #include <cppuhelper/weak.hxx>
39 #include <svtools/accelcfg.hxx>
41 class OReadAccelatorDocumentHandler : public ::com::sun::star::xml::sax::XDocumentHandler,
42 public ::cppu::OWeakObject
44 public:
45 OReadAccelatorDocumentHandler( SvtAcceleratorItemList& aNewAcceleratorItemList ) :
46 m_nElementDepth( 0 ),
47 m_bAcceleratorMode( sal_False ),
48 m_bItemCloseExpected( sal_False ),
49 m_xLocator( 0 ),
50 m_aReadAcceleratorList( aNewAcceleratorItemList ) {}
51 virtual ~OReadAccelatorDocumentHandler() {}
53 // XInterface
54 virtual void SAL_CALL acquire() throw()
55 { OWeakObject::acquire(); }
56 virtual void SAL_CALL release() throw()
57 { OWeakObject::release(); }
58 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
59 const ::com::sun::star::uno::Type & rType ) throw( ::com::sun::star::uno::RuntimeException );
61 // XDocumentHandler
62 virtual void SAL_CALL startDocument(void)
63 throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
64 virtual void SAL_CALL endDocument(void)
65 throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
66 virtual void SAL_CALL startElement(
67 const ::rtl::OUString& aName,
68 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > &xAttribs )
69 throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
70 virtual void SAL_CALL endElement(const ::rtl::OUString& aName) throw
71 ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
72 virtual void SAL_CALL characters(const ::rtl::OUString& aChars)
73 throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
74 virtual void SAL_CALL ignorableWhitespace(const ::rtl::OUString& aWhitespaces)
75 throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
76 virtual void SAL_CALL processingInstruction( const ::rtl::OUString& aTarget, const ::rtl::OUString& aData )
77 throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
78 virtual void SAL_CALL setDocumentLocator(
79 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > &xLocator)
80 throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
82 private:
83 ::rtl::OUString getErrorLineString();
85 int m_nElementDepth;
86 sal_Bool m_bAcceleratorMode;
87 sal_Bool m_bItemCloseExpected;
88 ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > m_xLocator;
89 SvtAcceleratorItemList& m_aReadAcceleratorList;
93 class OWriteAccelatorDocumentHandler
95 public:
96 OWriteAccelatorDocumentHandler(
97 const SvtAcceleratorItemList& aWriteAcceleratorList,
98 ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > );
99 virtual ~OWriteAccelatorDocumentHandler();
101 void WriteAcceleratorDocument() throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
103 private:
104 void WriteAcceleratorItem( const SvtAcceleratorConfigItem& aAcceleratorItem ) throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
106 ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > m_xWriteDocumentHandler;
107 ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > m_xEmptyList;
108 ::rtl::OUString m_aAttributeType;
109 const SvtAcceleratorItemList& m_aWriteAcceleratorList;
112 #endif // INCLUDED_SVTOOLS_XMLACCELCFG_HXX