Coverage Report

Created: 2026-07-10 11:04

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/vcl/source/graphic/GraphicLoader.cxx
Line
Count
Source
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
 */
10
11
#include <vcl/GraphicLoader.hxx>
12
13
#include <com/sun/star/awt/XWindow.hpp>
14
#include <tools/stream.hxx>
15
#include <unotools/ucbstreamhelper.hxx>
16
#include <vcl/graph.hxx>
17
#include <vcl/graphicfilter.hxx>
18
#include <vcl/weld/Window.hxx>
19
20
using namespace css;
21
22
namespace vcl::graphic
23
{
24
Graphic loadFromURL(OUString const& rURL, weld::Window* pParentWin)
25
18.7k
{
26
18.7k
    Graphic aGraphic;
27
28
18.7k
    std::unique_ptr<SvStream> pInputStream = utl::UcbStreamHelper::CreateStream(
29
18.7k
        rURL, StreamMode::READ, pParentWin ? pParentWin->GetXWindow() : nullptr);
30
31
18.7k
    if (pInputStream)
32
0
    {
33
0
        GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter();
34
35
0
        ErrCode nError
36
0
            = rFilter.ImportGraphic(aGraphic, rURL, *pInputStream, GRFILTER_FORMAT_DONTKNOW,
37
0
                                    nullptr, GraphicFilterImportFlags::NONE);
38
0
        if (nError != ERRCODE_NONE || aGraphic.GetType() == GraphicType::NONE)
39
0
            return Graphic();
40
0
    }
41
42
18.7k
    return aGraphic;
43
18.7k
}
44
} // end vcl::graphic
45
46
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */