update dev300-m58
[ooovba.git] / configmgr / source / xml / parsersvc.hxx
blob99afeae76f85ad5b27ef6139b010e99069a4ac4e
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: parsersvc.hxx,v $
10 * $Revision: 1.8 $
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 CONFIGMGR_XML_PARSERSVC_HXX
32 #define CONFIGMGR_XML_PARSERSVC_HXX
34 #include "serviceinfohelper.hxx"
35 #include <cppuhelper/implbase4.hxx>
36 #include <com/sun/star/uno/XComponentContext.hpp>
37 #include <com/sun/star/lang/XServiceInfo.hpp>
38 #include <com/sun/star/lang/XInitialization.hpp>
39 #include <com/sun/star/io/XActiveDataSink.hpp>
40 #include <com/sun/star/xml/sax/InputSource.hpp>
41 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
43 namespace configmgr
45 // -----------------------------------------------------------------------------
46 namespace xml
48 // -----------------------------------------------------------------------------
49 namespace uno = ::com::sun::star::uno;
50 namespace lang = ::com::sun::star::lang;
51 namespace io = ::com::sun::star::io;
52 namespace sax = ::com::sun::star::xml::sax;
53 // -----------------------------------------------------------------------------
55 template <class BackendInterface>
56 class ParserService : public ::cppu::WeakImplHelper4<
57 lang::XInitialization,
58 lang::XServiceInfo,
59 io::XActiveDataSink,
60 BackendInterface
63 public:
64 explicit
65 ParserService(uno::Reference< uno::XComponentContext > const & _xContext);
67 // XInitialization
68 virtual void SAL_CALL
69 initialize( const uno::Sequence< uno::Any >& aArguments )
70 throw (uno::Exception, uno::RuntimeException);
72 // XServiceInfo
73 virtual ::rtl::OUString SAL_CALL
74 getImplementationName( )
75 throw (uno::RuntimeException);
77 virtual sal_Bool SAL_CALL
78 supportsService( const ::rtl::OUString& ServiceName )
79 throw (uno::RuntimeException);
81 virtual uno::Sequence< ::rtl::OUString > SAL_CALL
82 getSupportedServiceNames( )
83 throw (uno::RuntimeException);
85 // XActiveDataSink
86 virtual void SAL_CALL
87 setInputStream( const uno::Reference< io::XInputStream >& aStream )
88 throw (uno::RuntimeException);
90 virtual uno::Reference< io::XInputStream > SAL_CALL
91 getInputStream( )
92 throw (uno::RuntimeException);
94 protected:
95 uno::Reference< uno::XComponentContext > getContext() const
96 { return m_xContext; }
98 void parse(uno::Reference< sax::XDocumentHandler > const & _xHandler);
99 // throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
101 private:
102 uno::Reference< uno::XComponentContext > m_xContext;
103 sax::InputSource m_aInputSource;
105 static ServiceInfoHelper getServiceInfo();
108 // -----------------------------------------------------------------------------
109 } // namespace xml
110 // -----------------------------------------------------------------------------
112 } // namespace configmgr
113 #endif