Version 4.2.0.1, tag libreoffice-4.2.0.1
[LibreOffice.git] / embeddedobj / source / msole / ownview.hxx
blob4a17623f7bfd4ec7e8292d57abec561ead70e134
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef __OWNVIEW_HXX_
21 #define __OWNVIEW_HXX_
23 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
24 #include <com/sun/star/util/XCloseListener.hpp>
25 #include <com/sun/star/document/XEventListener.hpp>
26 #include <com/sun/star/frame/XModel.hpp>
27 #include <com/sun/star/io/XStream.hpp>
28 #include <com/sun/star/io/XInputStream.hpp>
29 #include <cppuhelper/implbase2.hxx>
31 #include <osl/mutex.hxx>
33 class OwnView_Impl : public ::cppu::WeakImplHelper2 < ::com::sun::star::util::XCloseListener,
34 ::com::sun::star::document::XEventListener >
36 ::osl::Mutex m_aMutex;
38 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
39 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xModel;
41 OUString m_aTempFileURL;
42 OUString m_aNativeTempURL;
44 OUString m_aFilterName;
46 sal_Bool m_bBusy;
48 sal_Bool m_bUseNative;
50 private:
51 sal_Bool CreateModelFromURL( const OUString& aFileURL );
53 sal_Bool CreateModel( sal_Bool bUseNative );
55 sal_Bool ReadContentsAndGenerateTempFile( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xStream, sal_Bool bParseHeader );
57 void CreateNative();
59 public:
60 static OUString GetFilterNameFromExtentionAndInStream(
61 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory,
62 const OUString& aNameWithExtention,
63 const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInputStream );
65 OwnView_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory,
66 const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xStream );
67 virtual ~OwnView_Impl();
69 sal_Bool Open();
71 void Close();
73 virtual void SAL_CALL notifyEvent( const ::com::sun::star::document::EventObject& Event ) throw (::com::sun::star::uno::RuntimeException);
75 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);
76 virtual void SAL_CALL notifyClosing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
78 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
81 #endif
83 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */