1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
22 #include <sal/config.h>
24 #include <string_view>
26 #include <com/sun/star/util/XCloseListener.hpp>
27 #include <com/sun/star/document/XEventListener.hpp>
28 #include <com/sun/star/frame/XModel.hpp>
29 #include <com/sun/star/io/XInputStream.hpp>
30 #include <com/sun/star/uno/XComponentContext.hpp>
31 #include <cppuhelper/implbase.hxx>
33 #include <osl/mutex.hxx>
35 class OwnView_Impl
: public ::cppu::WeakImplHelper
< css::util::XCloseListener
,
36 css::document::XEventListener
>
38 ::osl::Mutex m_aMutex
;
40 css::uno::Reference
< css::uno::XComponentContext
> m_xContext
;
41 css::uno::Reference
< css::frame::XModel
> m_xModel
;
43 OUString m_aTempFileURL
;
44 OUString m_aNativeTempURL
;
46 OUString m_aFilterName
;
53 bool CreateModelFromURL( const OUString
& aFileURL
);
55 bool CreateModel( bool bUseNative
);
57 bool ReadContentsAndGenerateTempFile( const css::uno::Reference
< css::io::XInputStream
>& xStream
, bool bParseHeader
);
62 static OUString
GetFilterNameFromExtentionAndInStream(
63 const css::uno::Reference
< css::uno::XComponentContext
>& xContext
,
64 std::u16string_view aNameWithExtention
,
65 const css::uno::Reference
< css::io::XInputStream
>& xInputStream
);
67 OwnView_Impl( const css::uno::Reference
< css::uno::XComponentContext
>& xContext
,
68 const css::uno::Reference
< css::io::XInputStream
>& xStream
);
69 virtual ~OwnView_Impl() override
;
75 virtual void SAL_CALL
notifyEvent( const css::document::EventObject
& Event
) override
;
77 virtual void SAL_CALL
queryClosing( const css::lang::EventObject
& Source
, sal_Bool GetsOwnership
) override
;
78 virtual void SAL_CALL
notifyClosing( const css::lang::EventObject
& Source
) override
;
80 virtual void SAL_CALL
disposing( const css::lang::EventObject
& Source
) override
;
83 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */