LibreOffice Module sw (master) 1
retrieveinputstream.cxx
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
21
24#include <com/sun/star/io/XStream.hpp>
25#include <com/sun/star/beans/PropertyValue.hpp>
26#include <utility>
27
28/* class for a thread to retrieve an input stream given by a URL
29
30 #i73788#
31*/
34 const OUString& rLinkedURL, const OUString& rReferer )
35{
37 new SwAsyncRetrieveInputStreamThread( nDataKey, rLinkedURL, rReferer );
38 return pNewThread;
39}
40
43 OUString aLinkedURL,
44 OUString aReferer )
45 : mnDataKey( nDataKey ),
46 mrLinkedURL(std::move( aLinkedURL )),
47 mrReferer(std::move( aReferer ))
48{
49}
50
52{
53}
54
56{
57 osl_setThreadName("SwAsyncRetrieveInputStreamThread");
58
59 css::uno::Sequence < css::beans::PropertyValue > xProps{
62 };
63 utl::MediaDescriptor aMedium( xProps );
64
65 aMedium.addInputStream();
66
67 css::uno::Reference<css::io::XInputStream> xInputStream;
68 aMedium[utl::MediaDescriptor::PROP_INPUTSTREAM] >>= xInputStream;
69 if ( !xInputStream.is() )
70 {
71 css::uno::Reference<css::io::XStream> xStream;
73 if ( xStream.is() )
74 {
75 xInputStream = xStream->getInputStream();
76 }
77 }
78
80 xInputStream,
81 aMedium.isStreamReadOnly() );
82}
83
84/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Reference< XInputStream > xStream
class for a thread to retrieve an input stream given by a URL
virtual void threadFunction() override
static ::rtl::Reference< ObservableThread > createThread(const SwRetrievedInputStreamDataManager::tDataKey nDataKey, const OUString &rLinkedURL, const OUString &rReferer)
SwAsyncRetrieveInputStreamThread(const SwRetrievedInputStreamDataManager::tDataKey nDataKey, OUString aLinkedURL, OUString aReferer)
const SwRetrievedInputStreamDataManager::tDataKey mnDataKey
virtual ~SwAsyncRetrieveInputStreamThread() override
static SwRetrievedInputStreamDataManager & GetManager()
void PushData(const tDataKey nDataKey, css::uno::Reference< css::io::XInputStream > const &xInputStream, const bool bIsStreamReadOnly)
static constexpr OUStringLiteral PROP_INPUTSTREAM
static constexpr OUStringLiteral PROP_STREAM
bool isStreamReadOnly() const
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)