1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #ifndef __OWNVIEW_HXX_
30 #define __OWNVIEW_HXX_
32 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
33 #include <com/sun/star/util/XCloseListener.hpp>
34 #include <com/sun/star/document/XEventListener.hpp>
35 #include <com/sun/star/frame/XModel.hpp>
36 #include <com/sun/star/io/XStream.hpp>
37 #include <com/sun/star/io/XInputStream.hpp>
38 #include <cppuhelper/implbase2.hxx>
40 #include <osl/mutex.hxx>
42 class OwnView_Impl
: public ::cppu::WeakImplHelper2
< ::com::sun::star::util::XCloseListener
,
43 ::com::sun::star::document::XEventListener
>
45 ::osl::Mutex m_aMutex
;
47 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
> m_xFactory
;
48 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XModel
> m_xModel
;
50 ::rtl::OUString m_aTempFileURL
;
51 ::rtl::OUString m_aNativeTempURL
;
53 ::rtl::OUString m_aFilterName
;
57 sal_Bool m_bUseNative
;
60 sal_Bool
CreateModelFromURL( const ::rtl::OUString
& aFileURL
);
62 sal_Bool
CreateModel( sal_Bool bUseNative
);
64 sal_Bool
ReadContentsAndGenerateTempFile( const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
>& xStream
, sal_Bool bParseHeader
);
69 static ::rtl::OUString
GetFilterNameFromExtentionAndInStream(
70 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& xFactory
,
71 const ::rtl::OUString
& aNameWithExtention
,
72 const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
>& xInputStream
);
74 OwnView_Impl( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& xFactory
,
75 const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
>& xStream
);
76 virtual ~OwnView_Impl();
82 virtual void SAL_CALL
notifyEvent( const ::com::sun::star::document::EventObject
& Event
) throw (::com::sun::star::uno::RuntimeException
);
84 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
);
85 virtual void SAL_CALL
notifyClosing( const ::com::sun::star::lang::EventObject
& Source
) throw (::com::sun::star::uno::RuntimeException
);
87 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& Source
) throw (::com::sun::star::uno::RuntimeException
);
92 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */