Coverage Report

Created: 2026-03-31 11:00

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/drawinglayer/inc/primitive2d/texteffectprimitive2d.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/primitive2d/BufferedDecompositionPrimitive2D.hxx>
23
#include <basegfx/matrix/b2dhommatrix.hxx>
24
25
namespace drawinglayer::primitive2d
26
{
27
/** TextEffectStyle2D definition */
28
enum class TextEffectStyle2D
29
{
30
    ReliefEmbossedDefault,
31
    ReliefEngravedDefault,
32
    ReliefEmbossed,
33
    Outline
34
};
35
36
/** TextEffectPrimitive2D class
37
38
    This primitive embeds text primitives (normally, as can be seen can
39
    also be used for any other primitives) which have some TextEffect applied
40
    and create the needed geometry and embedding on decomposition.
41
*/
42
class TextEffectPrimitive2D final : public BufferedDecompositionPrimitive2D
43
{
44
private:
45
    /// the text (or other) content
46
    Primitive2DContainer maTextContent;
47
48
    /// the style to apply, the direction and the rotation center
49
    const basegfx::B2DPoint maRotationCenter;
50
    double mfDirection;
51
    TextEffectStyle2D meTextEffectStyle2D;
52
53
    /** the last used object to view transformtion used from getDecomposition
54
        for decide buffering
55
     */
56
    basegfx::B2DHomMatrix maLastObjectToViewTransformation;
57
58
    /// create local decomposition
59
    virtual Primitive2DReference
60
    create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const override;
61
62
public:
63
    /// constructor
64
    TextEffectPrimitive2D(Primitive2DContainer&& rTextContent,
65
                          const basegfx::B2DPoint& rRotationCenter, double fDirection,
66
                          TextEffectStyle2D eTextEffectStyle2D);
67
68
    /// data read access
69
0
    const Primitive2DContainer& getTextContent() const { return maTextContent; }
70
0
    const basegfx::B2DPoint& getRotationCenter() const { return maRotationCenter; }
71
0
    double getDirection() const { return mfDirection; }
72
0
    TextEffectStyle2D getTextEffectStyle2D() const { return meTextEffectStyle2D; }
73
74
    /// compare operator
75
    virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
76
77
    /** own get range implementation to solve more effective. Content is by definition displaced
78
        by a fixed discrete unit, thus the contained geometry needs only once be asked for its
79
        own basegfx::B2DRange
80
     */
81
    virtual basegfx::B2DRange
82
    getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
83
84
    /// provide unique ID
85
    virtual sal_uInt32 getPrimitive2DID() const override;
86
87
    /// Override standard getDecomposition to be view-dependent here
88
    virtual void
89
    get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor,
90
                       const geometry::ViewInformation2D& rViewInformation) const override;
91
};
92
93
} // end of namespace primitive2d::drawinglayer
94
95
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */