Coverage Report

Created: 2025-07-07 10:01

/src/libreoffice/drawinglayer/inc/primitive2d/wallpaperprimitive2d.hxx
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
#pragma once
21
22
#include <drawinglayer/primitive2d/primitivetools2d.hxx>
23
#include <vcl/bitmapex.hxx>
24
#include <vcl/wall.hxx>
25
26
27
namespace drawinglayer::primitive2d
28
    {
29
        /** WallpaperBitmapPrimitive2D class
30
31
            This is a specialized primitive for the Wallpaper definitions included in
32
            VCL and Metafiles. The extraordinary about the bitmap definition part of
33
            the Wallpaper is that it uses PIXEL size of the given Bitmap and not
34
            the logic and/or discrete size derived by PrefMapMode/PrefSize methods.
35
            To emulate this, a ViewTransformation dependent primitive is needed which
36
            takes over the correct scaling(s).
37
38
            Since a specialized primitive is needed anyways, i opted to also add the
39
            layouting which is dependent from WallpaperStyle; thus it does not need
40
            to be handled anywhere else in the future.
41
         */
42
        class WallpaperBitmapPrimitive2D final : public ViewTransformationDependentPrimitive2D
43
        {
44
        private:
45
            basegfx::B2DRange                   maObjectRange;
46
            BitmapEx                            maBitmapEx;
47
            WallpaperStyle                      meWallpaperStyle;
48
49
            /// create local decomposition
50
            virtual Primitive2DReference create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const override;
51
52
        public:
53
            /// constructor
54
            WallpaperBitmapPrimitive2D(
55
                const basegfx::B2DRange& rObjectRange,
56
                const BitmapEx& rBitmapEx,
57
                WallpaperStyle eWallpaperStyle);
58
59
            /// data read access
60
0
            const basegfx::B2DRange& getLocalObjectRange() const { return maObjectRange; }
61
0
            const BitmapEx& getBitmapEx() const { return maBitmapEx ; }
62
0
            WallpaperStyle getWallpaperStyle() const { return meWallpaperStyle; }
63
64
            /// compare operator
65
            virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
66
67
            /// get B2Drange
68
            virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
69
70
            /// provide unique ID
71
            virtual sal_uInt32 getPrimitive2DID() const override;
72
        };
73
74
} // end of namespace drawinglayer::primitive2d
75
76
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */