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/.
11 #include <vcl/GraphicLoader.hxx>
13 #include <com/sun/star/awt/XWindow.hpp>
14 #include <unotools/ucbstreamhelper.hxx>
15 #include <vcl/graphicfilter.hxx>
16 #include <vcl/weld.hxx>
20 namespace vcl::graphic
22 Graphic
loadFromURL(OUString
const& rURL
, weld::Window
* pParentWin
)
26 std::unique_ptr
<SvStream
> pInputStream
= utl::UcbStreamHelper::CreateStream(
27 rURL
, StreamMode::READ
, pParentWin
? pParentWin
->GetXWindow() : nullptr);
31 GraphicFilter
& rFilter
= GraphicFilter::GetGraphicFilter();
34 = rFilter
.ImportGraphic(aGraphic
, rURL
, *pInputStream
, GRFILTER_FORMAT_DONTKNOW
,
35 nullptr, GraphicFilterImportFlags::NONE
);
36 if (nError
!= ERRCODE_NONE
|| aGraphic
.GetType() == GraphicType::NONE
)
44 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */