Coverage Report

Created: 2025-07-07 10:01

/src/libreoffice/cppcanvas/source/wrapper/vclfactory.cxx
Line
Count
Source (jump to first uncovered line)
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
#include <osl/diagnose.h>
21
#include <vcl/window.hxx>
22
#include <vcl/canvastools.hxx>
23
24
#include <cppcanvas/vclfactory.hxx>
25
26
#include "implbitmapcanvas.hxx"
27
#include "implspritecanvas.hxx"
28
#include "implbitmap.hxx"
29
#include <implrenderer.hxx>
30
31
using namespace ::com::sun::star;
32
33
namespace cppcanvas
34
{
35
    CanvasSharedPtr VCLFactory::createCanvas( const uno::Reference< rendering::XCanvas >& xCanvas )
36
0
    {
37
0
        return std::make_shared<internal::ImplCanvas>( xCanvas );
38
0
    }
39
40
    BitmapCanvasSharedPtr VCLFactory::createBitmapCanvas( const uno::Reference< rendering::XBitmapCanvas >& xCanvas )
41
0
    {
42
0
        return std::make_shared<internal::ImplBitmapCanvas>( xCanvas );
43
0
    }
44
45
    SpriteCanvasSharedPtr VCLFactory::createSpriteCanvas( const vcl::Window& rVCLWindow )
46
0
    {
47
0
        return std::make_shared<internal::ImplSpriteCanvas>(
48
0
                    rVCLWindow.GetOutDev()->GetSpriteCanvas() );
49
0
    }
50
51
    SpriteCanvasSharedPtr VCLFactory::createSpriteCanvas( const uno::Reference< rendering::XSpriteCanvas >& xCanvas )
52
0
    {
53
0
        return std::make_shared<internal::ImplSpriteCanvas>( xCanvas );
54
0
    }
55
56
    BitmapSharedPtr VCLFactory::createBitmap( const CanvasSharedPtr&    rCanvas,
57
                                              const ::BitmapEx&         rBmpEx )
58
0
    {
59
0
        OSL_ENSURE( rCanvas && rCanvas->getUNOCanvas().is(),
60
0
                    "VCLFactory::createBitmap(): Invalid canvas" );
61
62
0
        if( !rCanvas )
63
0
            return BitmapSharedPtr();
64
65
0
        uno::Reference< rendering::XCanvas > xCanvas( rCanvas->getUNOCanvas() );
66
0
        if( !xCanvas.is() )
67
0
            return BitmapSharedPtr();
68
69
0
        return std::make_shared<internal::ImplBitmap>( rCanvas,
70
0
                                                          vcl::unotools::xBitmapFromBitmapEx(rBmpEx) );
71
0
    }
72
73
    RendererSharedPtr VCLFactory::createRenderer( const CanvasSharedPtr&        rCanvas,
74
                                                  const ::GDIMetaFile&          rMtf,
75
                                                  const Renderer::Parameters&   rParms )
76
0
    {
77
0
        return std::make_shared<internal::ImplRenderer>( rCanvas,
78
0
                                                              rMtf,
79
0
                                                              rParms );
80
0
    }
81
}
82
83
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */