Coverage Report

Created: 2025-12-31 10:39

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/svx/svdhlpln.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
#ifndef INCLUDED_SVX_SVDHLPLN_HXX
21
#define INCLUDED_SVX_SVDHLPLN_HXX
22
23
#include <sal/types.h>
24
#include <tools/gen.hxx>
25
26
#include <svx/svxdllapi.h>
27
28
#include <vector>
29
#include <memory>
30
31
class OutputDevice;
32
enum class PointerStyle;
33
34
enum class SdrHelpLineKind { Point, Vertical, Horizontal };
35
36
0
#define SDRHELPLINE_POINT_PIXELSIZE 15 /* actual size = PIXELSIZE*2+1 */
37
38
class SdrHelpLine {
39
    Point            m_aPos; // X or Y may be unimportant, depending on the value of eKind
40
    SdrHelpLineKind  m_eKind;
41
42
public:
43
0
    explicit SdrHelpLine(SdrHelpLineKind eNewKind=SdrHelpLineKind::Point): m_eKind(eNewKind) {}
44
0
    SdrHelpLine(SdrHelpLineKind eNewKind, const Point& rNewPos): m_aPos(rNewPos), m_eKind(eNewKind) {}
45
0
    bool operator==(const SdrHelpLine& rCmp) const { return m_aPos==rCmp.m_aPos && m_eKind==rCmp.m_eKind; }
46
0
    bool operator!=(const SdrHelpLine& rCmp) const { return !operator==(rCmp); }
47
48
0
    void            SetKind(SdrHelpLineKind eNewKind) { m_eKind=eNewKind; }
49
0
    SdrHelpLineKind GetKind() const                   { return m_eKind; }
50
0
    void            SetPos(const Point& rPnt)         { m_aPos=rPnt; }
51
0
    const Point&    GetPos() const                    { return m_aPos; }
52
53
    PointerStyle    GetPointer() const;
54
    bool            IsHit(const Point& rPnt, sal_uInt16 nTolLog, const OutputDevice& rOut) const;
55
    // OutputDevice is required because capture points have a fixed pixel size
56
    tools::Rectangle       GetBoundRect(const OutputDevice& rOut) const;
57
};
58
59
0
#define SDRHELPLINE_NOTFOUND 0xFFFF
60
61
class SVXCORE_DLLPUBLIC SdrHelpLineList {
62
    std::vector<std::unique_ptr<SdrHelpLine>> m_aList;
63
64
public:
65
123k
    SdrHelpLineList() {}
66
0
    SdrHelpLineList(const SdrHelpLineList& rSrcList) { *this=rSrcList; }
67
    SdrHelpLineList&   operator=(const SdrHelpLineList& rSrcList);
68
    bool operator==(const SdrHelpLineList& rCmp) const;
69
0
    bool operator!=(const SdrHelpLineList& rCmp) const                 { return !operator==(rCmp); }
70
12
    sal_uInt16         GetCount() const                                    { return sal_uInt16(m_aList.size()); }
71
0
    void               Insert(const SdrHelpLine& rHL)                          { m_aList.emplace_back(new SdrHelpLine(rHL)); }
72
    void               Insert(const SdrHelpLine& rHL, sal_uInt16 nPos)
73
0
    {
74
0
        if(nPos==0xFFFF)
75
0
            m_aList.emplace_back(new SdrHelpLine(rHL));
76
0
        else
77
0
            m_aList.emplace(m_aList.begin() + nPos, new SdrHelpLine(rHL));
78
0
    }
79
    void               Delete(sal_uInt16 nPos)
80
0
    {
81
0
        m_aList.erase(m_aList.begin() + nPos);
82
0
    }
83
0
    SdrHelpLine&       operator[](sal_uInt16 nPos)                             { return *m_aList[nPos]; }
84
0
    const SdrHelpLine& operator[](sal_uInt16 nPos) const                       { return *m_aList[nPos]; }
85
    sal_uInt16             HitTest(const Point& rPnt, sal_uInt16 nTolLog, const OutputDevice& rOut) const;
86
};
87
88
89
#endif // INCLUDED_SVX_SVDHLPLN_HXX
90
91
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */