LibreOffice Module embeddedobj (master) 1
ownview.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
22#include <sal/config.h>
23
24#include <string_view>
25
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>
32
33#include <osl/mutex.hxx>
34
35class OwnView_Impl : public ::cppu::WeakImplHelper < css::util::XCloseListener,
36 css::document::XEventListener >
37{
38 ::osl::Mutex m_aMutex;
39
40 css::uno::Reference< css::uno::XComponentContext > m_xContext;
41 css::uno::Reference< css::frame::XModel > m_xModel;
42
45
46 OUString m_aFilterName;
47
48 bool m_bBusy;
49
51
52private:
53 bool CreateModelFromURL( const OUString& aFileURL );
54
55 bool CreateModel( bool bUseNative );
56
57 bool ReadContentsAndGenerateTempFile( const css::uno::Reference< css::io::XInputStream >& xStream, bool bParseHeader );
58
59 void CreateNative();
60
61public:
63 const css::uno::Reference< css::uno::XComponentContext >& xContext,
64 std::u16string_view aNameWithExtention,
65 const css::uno::Reference< css::io::XInputStream >& xInputStream );
66
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;
70
71 bool Open();
72
73 void Close();
74
75 virtual void SAL_CALL notifyEvent( const css::document::EventObject& Event ) override;
76
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;
79
80 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
81};
82
83/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool m_bBusy
Definition: ownview.hxx:48
bool CreateModel(bool bUseNative)
Definition: ownview.cxx:160
OwnView_Impl(const css::uno::Reference< css::uno::XComponentContext > &xContext, const css::uno::Reference< css::io::XInputStream > &xStream)
Definition: ownview.cxx:70
bool Open()
Definition: ownview.cxx:456
virtual void SAL_CALL notifyEvent(const css::document::EventObject &Event) override
Definition: ownview.cxx:557
void Close()
Definition: ownview.cxx:521
bool m_bUseNative
Definition: ownview.hxx:50
bool CreateModelFromURL(const OUString &aFileURL)
Definition: ownview.cxx:96
void CreateNative()
Definition: ownview.cxx:383
static OUString GetFilterNameFromExtentionAndInStream(const css::uno::Reference< css::uno::XComponentContext > &xContext, std::u16string_view aNameWithExtention, const css::uno::Reference< css::io::XInputStream > &xInputStream)
Definition: ownview.cxx:175
::osl::Mutex m_aMutex
Definition: ownview.hxx:38
css::uno::Reference< css::uno::XComponentContext > m_xContext
Definition: ownview.hxx:40
OUString m_aTempFileURL
Definition: ownview.hxx:43
css::uno::Reference< css::frame::XModel > m_xModel
Definition: ownview.hxx:41
OUString m_aNativeTempURL
Definition: ownview.hxx:44
virtual void SAL_CALL notifyClosing(const css::lang::EventObject &Source) override
Definition: ownview.cxx:594
virtual ~OwnView_Impl() override
Definition: ownview.cxx:83
OUString m_aFilterName
Definition: ownview.hxx:46
virtual void SAL_CALL queryClosing(const css::lang::EventObject &Source, sal_Bool GetsOwnership) override
Definition: ownview.cxx:589
bool ReadContentsAndGenerateTempFile(const css::uno::Reference< css::io::XInputStream > &xStream, bool bParseHeader)
Definition: ownview.cxx:237
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
Definition: ownview.cxx:602
unsigned char sal_Bool