1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  **************************************************************/
21 
22  // MARKER(update_precomp.py): autogen include statement, do not remove
23 //This file is about the conversion of the UOF v2.0 and ODF document format
24 #ifndef _UOF2_SPLITER_HXX_
25 #define _UOF2_SPLITER_HXX_
26 
27 #include <com/sun/star/uno/Reference.hxx>
28 
29 #include "uof2splithandler.hxx"
30 #include <com/sun/star/io/XActiveDataControl.hpp>
31 #include <com/sun/star/io/XActiveDataSink.hpp>
32 #include <com/sun/star/io/XActiveDataStreamer.hpp>
33 #include <com/sun/star/lang/XInitialization.hpp>
34 #include <cppuhelper/implbase3.hxx>
35 #include <osl/mutex.hxx>
36 #include <osl/thread.h>
37 
38 #include <set>
39 
40 namespace com{
41 	namespace sun{
42 		namespace star{
43 			namespace io{
44 				class XInputStream;
45 				class XStream;
46 				class XStreamListener;
47 				class XActiveDataStreamer;
48 			}
49 			namespace lang{
50 				//class XInitialization;
51 				class XMultiServiceFactory;
52 			}
53 		}
54 	}
55 }
56 
57 
58 namespace XSLT{
59 
60 class UOF2Splitter : public ::cppu::WeakImplHelper3<
61 	::com::sun::star::io::XActiveDataControl ,
62 	::com::sun::star::io::XActiveDataStreamer ,
63 	::com::sun::star::io::XActiveDataSink >//,
64 	//::com::sun::star::lang::XInitialization >
65 {
66 	::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_rMultiFactory;
67 	::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XExtendedDocumentHandler >  m_xWriter;
68 	::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > m_xStream;
69 	::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > m_xInputStream;
70 	std::set< ::com::sun::star::uno::Reference< ::com::sun::star::io::XStreamListener > > m_StreamListeners;
71 	::rtl::OUString aURL;
72 	::osl::Mutex	m_aMutex;
73 	oslThread    m_aThread;
74 
75 public :
76 	UOF2Splitter( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rFactory , const ::rtl::OUString & rURL );
77 	~UOF2Splitter();
78 
79 	// XActiveDataControl
80 	virtual void SAL_CALL   addListener ( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStreamListener> & rxListener ) throw( ::com::sun::star::uno::RuntimeException);
81 	virtual void SAL_CALL   removeListener ( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStreamListener> & rxListener ) throw( ::com::sun::star::uno::RuntimeException);
82 	virtual void SAL_CALL   start (void) throw( ::com::sun::star::uno::RuntimeException);
83     virtual void SAL_CALL   terminate (void) throw( ::com::sun::star::uno::RuntimeException);
84 
85 	// XActiveDataSink
86 	virtual void SAL_CALL   setInputStream ( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream> &rxInputStream) throw( ::com::sun::star::uno::RuntimeException);
87 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream> SAL_CALL getInputStream (void) throw( ::com::sun::star::uno::RuntimeException);
88 
89 	// XActiveDataStreamer
90 	virtual void SAL_CALL   setStream ( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream> &rxStream) throw( ::com::sun::star::uno::RuntimeException);
91 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream> SAL_CALL getStream (void) throw( ::com::sun::star::uno::RuntimeException);
92 
93 };
94 
95 }
96 #endif
97