xref: /AOO41X/main/embeddedobj/source/msole/ownview.hxx (revision 08421ca6693c7ac7e4bba1e7a4157ea1594eb73d)
1*08421ca6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*08421ca6SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*08421ca6SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*08421ca6SAndrew Rist  * distributed with this work for additional information
6*08421ca6SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*08421ca6SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*08421ca6SAndrew Rist  * "License"); you may not use this file except in compliance
9*08421ca6SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*08421ca6SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*08421ca6SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*08421ca6SAndrew Rist  * software distributed under the License is distributed on an
15*08421ca6SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*08421ca6SAndrew Rist  * KIND, either express or implied.  See the License for the
17*08421ca6SAndrew Rist  * specific language governing permissions and limitations
18*08421ca6SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*08421ca6SAndrew Rist  *************************************************************/
21*08421ca6SAndrew Rist 
22*08421ca6SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef __OWNVIEW_HXX_
25cdf0e10cSrcweir #define __OWNVIEW_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
28cdf0e10cSrcweir #include <com/sun/star/util/XCloseListener.hpp>
29cdf0e10cSrcweir #include <com/sun/star/document/XEventListener.hpp>
30cdf0e10cSrcweir #include <com/sun/star/frame/XModel.hpp>
31cdf0e10cSrcweir #include <com/sun/star/io/XStream.hpp>
32cdf0e10cSrcweir #include <com/sun/star/io/XInputStream.hpp>
33cdf0e10cSrcweir #include <cppuhelper/implbase2.hxx>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir #include <osl/mutex.hxx>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir class OwnView_Impl : public ::cppu::WeakImplHelper2 < ::com::sun::star::util::XCloseListener,
38cdf0e10cSrcweir 													  ::com::sun::star::document::XEventListener >
39cdf0e10cSrcweir {
40cdf0e10cSrcweir 	::osl::Mutex m_aMutex;
41cdf0e10cSrcweir 
42cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
43cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xModel;
44cdf0e10cSrcweir 
45cdf0e10cSrcweir 	::rtl::OUString m_aTempFileURL;
46cdf0e10cSrcweir 	::rtl::OUString m_aNativeTempURL;
47cdf0e10cSrcweir 
48cdf0e10cSrcweir 	::rtl::OUString m_aFilterName;
49cdf0e10cSrcweir 
50cdf0e10cSrcweir 	sal_Bool m_bBusy;
51cdf0e10cSrcweir 
52cdf0e10cSrcweir 	sal_Bool m_bUseNative;
53cdf0e10cSrcweir 
54cdf0e10cSrcweir private:
55cdf0e10cSrcweir 	sal_Bool CreateModelFromURL( const ::rtl::OUString& aFileURL );
56cdf0e10cSrcweir 
57cdf0e10cSrcweir 	sal_Bool CreateModel( sal_Bool bUseNative );
58cdf0e10cSrcweir 
59cdf0e10cSrcweir 	sal_Bool ReadContentsAndGenerateTempFile( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xStream, sal_Bool bParseHeader );
60cdf0e10cSrcweir 
61cdf0e10cSrcweir 	void CreateNative();
62cdf0e10cSrcweir 
63cdf0e10cSrcweir public:
64cdf0e10cSrcweir     static ::rtl::OUString GetFilterNameFromExtentionAndInStream(
65cdf0e10cSrcweir                                 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory,
66cdf0e10cSrcweir                                 const ::rtl::OUString& aNameWithExtention,
67cdf0e10cSrcweir                                 const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInputStream );
68cdf0e10cSrcweir 
69cdf0e10cSrcweir 	OwnView_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory,
70cdf0e10cSrcweir 				  const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xStream );
71cdf0e10cSrcweir 	virtual ~OwnView_Impl();
72cdf0e10cSrcweir 
73cdf0e10cSrcweir 	sal_Bool Open();
74cdf0e10cSrcweir 
75cdf0e10cSrcweir 	void Close();
76cdf0e10cSrcweir 
77cdf0e10cSrcweir     virtual void SAL_CALL notifyEvent( const ::com::sun::star::document::EventObject& Event ) throw (::com::sun::star::uno::RuntimeException);
78cdf0e10cSrcweir 
79cdf0e10cSrcweir     virtual void SAL_CALL queryClosing( const ::com::sun::star::lang::EventObject& Source, sal_Bool GetsOwnership ) throw (::com::sun::star::util::CloseVetoException, ::com::sun::star::uno::RuntimeException);
80cdf0e10cSrcweir     virtual void SAL_CALL notifyClosing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
81cdf0e10cSrcweir 
82cdf0e10cSrcweir     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
83cdf0e10cSrcweir };
84cdf0e10cSrcweir 
85cdf0e10cSrcweir #endif
86cdf0e10cSrcweir 
87