Coverage Report

Created: 2026-11-06 11:29

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/drawinglayer/primitive2d/primitivetools2d.hxx
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
 * 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/drawinglayerdllapi.h>
23
24
#include <drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx>
25
#include <basegfx/matrix/b2dhommatrix.hxx>
26
27
28
namespace drawinglayer::primitive2d
29
{
30
        /** DiscreteMetricDependentPrimitive2D class
31
32
            tooling class for BufferedDecompositionPrimitive2D based classes which are view-dependent
33
            regarding the size of a discrete unit. The implementation of get2DDecomposition
34
            guards the buffered local decomposition and ensures that a create2DDecomposition
35
            implementation may use an up-to-date DiscreteUnit accessible using getDiscreteUnit()
36
         */
37
        class DRAWINGLAYER_DLLPUBLIC DiscreteMetricDependentPrimitive2D : public BufferedDecompositionPrimitive2D
38
        {
39
        private:
40
            /** the last used fDiscreteUnit definitions for decomposition. Since this
41
                is checked and updated from get2DDecomposition() it will be current and
42
                usable in create2DDecomposition()
43
             */
44
            double                                  mfDiscreteUnit;
45
46
        public:
47
            /// constructor
48
            DiscreteMetricDependentPrimitive2D()
49
3.14k
            :   mfDiscreteUnit(0.0)
50
3.14k
            {
51
3.14k
            }
52
53
            /// data read access
54
0
            double getDiscreteUnit() const { return mfDiscreteUnit; }
55
56
            /// Override standard getDecomposition to be view-dependent here
57
            virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const override;
58
        };
59
60
        /** ViewportDependentPrimitive2D class
61
62
            tooling class for BufferedDecompositionPrimitive2D based classes which are view-dependent
63
            regarding the viewport. The implementation of get2DDecomposition
64
            guards the buffered local decomposition and ensures that a create2DDecomposition
65
            implementation may use an up-to-date Viewport accessible using getViewport()
66
         */
67
        class DRAWINGLAYER_DLLPUBLIC ViewportDependentPrimitive2D : public BufferedDecompositionPrimitive2D
68
        {
69
        private:
70
            /** the last used Viewport definition for decomposition. Since this
71
                is checked and updated from get2DDecomposition() it will be current and
72
                usable in create2DDecomposition()
73
             */
74
            basegfx::B2DRange                       maViewport;
75
76
        public:
77
            /// constructor
78
            ViewportDependentPrimitive2D()
79
0
            {
80
0
            }
81
82
            /// data read access
83
0
            const basegfx::B2DRange& getViewport() const { return maViewport; }
84
85
            /// Override standard getDecomposition to be view-dependent here
86
            virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const override final;
87
        };
88
89
        /** ViewTransformationDependentPrimitive2D class
90
91
            tooling class for BufferedDecompositionPrimitive2D based classes which are view-dependent
92
            regarding the complete Viewtransformation. The implementation of get2DDecomposition
93
            guards the buffered local decomposition and ensures that a create2DDecomposition
94
            implementation may use an up-to-date ViewTransformation accessible using getViewTransformation()
95
         */
96
        class DRAWINGLAYER_DLLPUBLIC ViewTransformationDependentPrimitive2D : public BufferedDecompositionPrimitive2D
97
        {
98
        private:
99
            /** the last used ViewTransformation definition for decomposition. Since this
100
                is checked and updated from get2DDecomposition() it will be current and
101
                usable in create2DDecomposition()
102
             */
103
            basegfx::B2DHomMatrix                   maViewTransformation;
104
105
        public:
106
            /// constructor
107
            ViewTransformationDependentPrimitive2D()
108
751
            {
109
751
            }
110
111
            /// data read access
112
0
            const basegfx::B2DHomMatrix& getViewTransformation() const { return maViewTransformation; }
113
114
            /// Override standard getDecomposition to be view-dependent here
115
            virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const override final;
116
        };
117
118
        /** ObjectAndViewTransformationDependentPrimitive2D class
119
120
            tooling class for BufferedDecompositionPrimitive2D based classes which are view-dependent
121
            and Object-Transform dependent. The implementation of get2DDecomposition
122
            guards the buffered local decomposition and ensures that a create2DDecomposition
123
            implementation may use an up-to-date ViewTransformation accessible using getViewTransformation()
124
            and an object transformation via getObjectTransformation()
125
         */
126
        class DRAWINGLAYER_DLLPUBLIC ObjectAndViewTransformationDependentPrimitive2D : public BufferedDecompositionPrimitive2D
127
        {
128
        private:
129
            /** the last used ViewTransformation and the last ObjectTransformation
130
                definition for decomposition. Since this is checked and updated from
131
                get2DDecomposition() it will be current and usable in create2DDecomposition()
132
             */
133
            basegfx::B2DHomMatrix                   maViewTransformation;
134
            basegfx::B2DHomMatrix                   maObjectTransformation;
135
136
        public:
137
            /// constructor
138
            ObjectAndViewTransformationDependentPrimitive2D()
139
0
            {
140
0
            }
141
142
            /// data read access
143
0
            const basegfx::B2DHomMatrix& getViewTransformation() const { return maViewTransformation; }
144
0
            const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; }
145
146
            /// Override standard getDecomposition to be view-dependent here
147
            virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const override final;
148
        };
149
} // end of namespace drawinglayer::primitive2d
150
151
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */