update dev300-m58
[ooovba.git] / configmgr / source / xml / writersvc.hxx
blobf42fe0f21b73801c1d3665edacbbf77e4170eabd
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: writersvc.hxx,v $
10 * $Revision: 1.7 $
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_WRITERSVC_HXX
32 #define CONFIGMGR_XML_WRITERSVC_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/XActiveDataSource.hpp>
40 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
42 // -----------------------------------------------------------------------------
44 namespace com { namespace sun { namespace star { namespace configuration { namespace backend {
45 class XLayerHandler;
46 } } } } }
48 // -----------------------------------------------------------------------------
50 namespace configmgr
52 // -----------------------------------------------------------------------------
53 namespace xml
55 // -----------------------------------------------------------------------------
56 namespace uno = ::com::sun::star::uno;
57 namespace lang = ::com::sun::star::lang;
58 namespace io = ::com::sun::star::io;
59 namespace sax = ::com::sun::star::xml::sax;
60 // -----------------------------------------------------------------------------
62 template <class BackendInterface>
63 class WriterService : public ::cppu::WeakImplHelper4<
64 lang::XInitialization,
65 lang::XServiceInfo,
66 io::XActiveDataSource,
67 BackendInterface
70 public:
71 explicit
72 WriterService(uno::Reference< uno::XComponentContext > const & _xContext);
74 // XInitialization
75 virtual void SAL_CALL
76 initialize( const uno::Sequence< uno::Any >& aArguments )
77 throw (uno::Exception, uno::RuntimeException);
79 // XServiceInfo
80 virtual ::rtl::OUString SAL_CALL
81 getImplementationName( )
82 throw (uno::RuntimeException);
84 virtual sal_Bool SAL_CALL
85 supportsService( const ::rtl::OUString& ServiceName )
86 throw (uno::RuntimeException);
88 virtual uno::Sequence< ::rtl::OUString > SAL_CALL
89 getSupportedServiceNames( )
90 throw (uno::RuntimeException);
92 // XActiveDataSink
93 virtual void SAL_CALL
94 setOutputStream( const uno::Reference< io::XOutputStream >& aStream )
95 throw (uno::RuntimeException);
97 virtual uno::Reference< io::XOutputStream > SAL_CALL
98 getOutputStream( )
99 throw (uno::RuntimeException);
101 protected:
102 uno::Reference< lang::XMultiServiceFactory > getServiceFactory() const
103 { return m_xServiceFactory; }
105 uno::Reference< sax::XDocumentHandler > getWriteHandler() throw (uno::RuntimeException);
106 private:
107 uno::Reference< lang::XMultiServiceFactory > m_xServiceFactory;
108 uno::Reference< sax::XDocumentHandler > m_xWriter;
110 uno::Reference< sax::XDocumentHandler > createHandler() const throw (uno::RuntimeException);
112 static ServiceInfoHelper getServiceInfo();
115 // -----------------------------------------------------------------------------
116 } // namespace xml
117 // -----------------------------------------------------------------------------
119 } // namespace configmgr
120 #endif