Files
libreoffice/sw/source/core/docnode/retrieveinputstream.cxx
Oliver Bolte 336037c403 INTEGRATION: CWS swqbf91 (1.1.2); FILE ADDED
2007/06/20 12:18:29 od 1.1.2.10: #i73788# further step to final implementation
2007/06/07 19:48:29 od 1.1.2.9: #i73788## further steps to the final implementation
2007/05/03 15:33:00 od 1.1.2.8: #i73788# further refactoring of non-blocking load of linked graphics
2007/04/13 10:15:47 od 1.1.2.7: #i73788# - further refactoring
2007/04/13 08:53:44 od 1.1.2.6: #i73788# - adjusting documentation
2007/03/30 11:29:28 od 1.1.2.5: #i73788# - redesign of non-blocking load of linked graphics
2007/03/15 11:40:43 od 1.1.2.4: #i73788# further adjustments to the implementation
2007/03/14 13:22:15 od 1.1.2.3: #i73788# further adjustments to the implementation
2007/03/09 08:52:53 od 1.1.2.2: #i73788# - fix potential deadlock
2007/01/30 15:04:03 od 1.1.2.1: #i73788# - implementation of new class <SwAsyncRetrieveInputStreamThread>
2007-07-18 12:31:42 +00:00

100 lines
3.5 KiB
C++

/*************************************************************************
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: retrieveinputstream.cxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: obo $ $Date: 2007-07-18 13:31:42 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
*
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2005 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
************************************************************************/
#include "precompiled_sw.hxx"
#ifndef _RETRIEVEINPUTSTREAM_HXX
#include <retrieveinputstream.hxx>
#endif
#ifndef _COMPHELPER_MEDIADESCRIPTOR_HXX_
#include <comphelper/mediadescriptor.hxx>
#endif
#ifndef _COM_SUN_STAR_IO_XSTREAM_HXX_
#include <com/sun/star/io/XStream.hpp>
#endif
/** class for a thread to retrieve an input stream given by an URL
OD 2007-01-29 #i73788#
@author OD
*/
::rtl::Reference< ObservableThread > SwAsyncRetrieveInputStreamThread::createThread(
const SwRetrievedInputStreamDataManager::tDataKey nDataKey,
const String& rLinkedURL )
{
SwAsyncRetrieveInputStreamThread* pNewThread =
new SwAsyncRetrieveInputStreamThread( nDataKey, rLinkedURL );
return pNewThread;
}
SwAsyncRetrieveInputStreamThread::SwAsyncRetrieveInputStreamThread(
const SwRetrievedInputStreamDataManager::tDataKey nDataKey,
const String& rLinkedURL )
: ObservableThread(),
mnDataKey( nDataKey ),
mrLinkedURL( rLinkedURL )
{
}
SwAsyncRetrieveInputStreamThread::~SwAsyncRetrieveInputStreamThread()
{
}
void SwAsyncRetrieveInputStreamThread::threadFunction()
{
com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > xProps( 1 );
xProps[0].Name = ::rtl::OUString::createFromAscii( "URL" );
xProps[0].Value <<= ::rtl::OUString( mrLinkedURL );
comphelper::MediaDescriptor aMedium( xProps );
aMedium.addInputStream();
com::sun::star::uno::Reference<com::sun::star::io::XInputStream> xInputStream;
aMedium[comphelper::MediaDescriptor::PROP_INPUTSTREAM()] >>= xInputStream;
if ( !xInputStream.is() )
{
com::sun::star::uno::Reference<com::sun::star::io::XStream> xStream;
aMedium[comphelper::MediaDescriptor::PROP_STREAM()] >>= xStream;
if ( xStream.is() )
{
xInputStream = xStream->getInputStream();
}
}
SwRetrievedInputStreamDataManager::GetManager().PushData( mnDataKey,
xInputStream,
aMedium.isStreamReadOnly() );
}