Coverage Report

Created: 2025-11-16 09:57

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/sw/source/uibase/docvw/AnchorOverlayObject.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 <svx/sdr/overlay/overlayobject.hxx>
23
#include <tools/long.hxx>
24
#include <basegfx/polygon/b2dpolygon.hxx>
25
26
class SwView;
27
class SwRect;
28
class Point;
29
30
namespace sw::sidebarwindows {
31
32
enum class AnchorState
33
{
34
    All,
35
    End,
36
    Tri
37
};
38
39
class AnchorOverlayObject final : public sdr::overlay::OverlayObjectWithBasePosition
40
{
41
    public:
42
        static std::unique_ptr<AnchorOverlayObject> CreateAnchorOverlayObject( SwView const & rDocView,
43
                                                               const SwRect& aAnchorRect,
44
                                                               tools::Long aPageBorder,
45
                                                               const Point& aLineStart,
46
                                                               const Point& aLineEnd,
47
                                                               const Color& aColorAnchor );
48
49
0
        const basegfx::B2DPoint& GetSecondPosition() const { return maSecondPosition; }
50
0
        const basegfx::B2DPoint& GetThirdPosition() const { return maThirdPosition; }
51
0
        const basegfx::B2DPoint& GetFourthPosition() const { return maFourthPosition; }
52
0
        const basegfx::B2DPoint& GetFifthPosition() const { return maFifthPosition; }
53
0
        const basegfx::B2DPoint& GetSixthPosition() const { return maSixthPosition; }
54
0
        const basegfx::B2DPoint& GetSeventhPosition() const { return maSeventhPosition; }
55
56
        void SetAllPosition( const basegfx::B2DPoint& rPoint1,
57
                             const basegfx::B2DPoint& rPoint2,
58
                             const basegfx::B2DPoint& rPoint3,
59
                             const basegfx::B2DPoint& rPoint4,
60
                             const basegfx::B2DPoint& rPoint5,
61
                             const basegfx::B2DPoint& rPoint6,
62
                             const basegfx::B2DPoint& rPoint7 );
63
        void SetTriPosition( const basegfx::B2DPoint& rPoint1,
64
                             const basegfx::B2DPoint& rPoint2,
65
                             const basegfx::B2DPoint& rPoint3,
66
                             const basegfx::B2DPoint& rPoint4,
67
                             const basegfx::B2DPoint& rPoint5 );
68
        void SetSixthPosition( const basegfx::B2DPoint& rNew );
69
        void SetSeventhPosition( const basegfx::B2DPoint& rNew );
70
71
        void setLineSolid( const bool bNew );
72
0
        bool getLineSolid() const { return mbLineSolid; }
73
74
        void SetAnchorState( const AnchorState aState );
75
0
        AnchorState GetAnchorState() const { return mAnchorState; }
76
77
    private:
78
        /*                        6------------7
79
             1                   /
80
            /4\ ---------------5
81
           2 - 3
82
        */
83
84
        basegfx::B2DPoint maSecondPosition;
85
        basegfx::B2DPoint maThirdPosition;
86
        basegfx::B2DPoint maFourthPosition;
87
        basegfx::B2DPoint maFifthPosition;
88
        basegfx::B2DPoint maSixthPosition;
89
        basegfx::B2DPoint maSeventhPosition;
90
91
        // helpers to fill and reset geometry
92
        void implEnsureGeometry();
93
        void implResetGeometry();
94
95
        // geometry creation for OverlayObject
96
        virtual drawinglayer::primitive2d::Primitive2DContainer createOverlayObjectPrimitive2DSequence() override;
97
98
        // object's geometry
99
        basegfx::B2DPolygon maTriangle;
100
        basegfx::B2DPolygon maLine;
101
        basegfx::B2DPolygon maLineTop;
102
        AnchorState mAnchorState;
103
104
        bool mbLineSolid : 1;
105
106
        AnchorOverlayObject( const basegfx::B2DPoint& rBasePos,
107
                             const basegfx::B2DPoint& rSecondPos,
108
                             const basegfx::B2DPoint& rThirdPos,
109
                             const basegfx::B2DPoint& rFourthPos,
110
                             const basegfx::B2DPoint& rFifthPos,
111
                             const basegfx::B2DPoint& rSixthPos,
112
                             const basegfx::B2DPoint& rSeventhPos,
113
                             const Color& rBaseColor );
114
    public:
115
        virtual ~AnchorOverlayObject() override;
116
};
117
118
} // end of namespace sw::annotation
119
120
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */