Coverage Report

Created: 2026-10-14 09:33

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/svx/svdocirc.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/svdorect.hxx>
23
#include <svx/svxdllapi.h>
24
25
namespace sdr::properties {
26
    class CircleProperties;
27
}
28
29
// Helper class SdrCircObjGeoData
30
31
class SdrCircObjGeoData final : public SdrTextObjGeoData
32
{
33
public:
34
    Degree100     nStartAngle;
35
    Degree100     nEndAngle;
36
};
37
38
enum class SdrCircKind { Full, Section, Cut, Arc };
39
40
extern SVXCORE_DLLPUBLIC SdrCircKind ToSdrCircKind(SdrObjKind);
41
42
43
class SVXCORE_DLLPUBLIC SdrCircObj final : public SdrRectObj
44
{
45
    // to allow sdr::properties::CircleProperties access to ImpSetAttrToCircInfo()
46
    friend class sdr::properties::CircleProperties;
47
48
    SAL_DLLPRIVATE virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override;
49
    SAL_DLLPRIVATE virtual std::unique_ptr<sdr::properties::BaseProperties> CreateObjectSpecificProperties() override;
50
51
    SdrCircKind                 meCircleKind;
52
    Degree100                   m_nStartAngle;
53
    Degree100                   m_nEndAngle;
54
55
    SVX_DLLPRIVATE basegfx::B2DPolygon ImpCalcXPolyCirc(const SdrCircKind eKind, const tools::Rectangle& rRect1, Degree100 nStart, Degree100 nEnd) const;
56
    SVX_DLLPRIVATE static void ImpSetCreateParams(SdrDragStat& rStat);
57
    SVX_DLLPRIVATE void ImpSetAttrToCircInfo(); // copy values from pool
58
    SVX_DLLPRIVATE void ImpSetCircInfoToAttr(); // copy values into pool
59
60
    // returns sal_True if paint requires a XPolygon
61
    SVX_DLLPRIVATE bool PaintNeedsXPolyCirc() const; // PaintNeedsXPoly-> PaintNeedsXPolyCirc
62
    SVX_DLLPRIVATE virtual void RecalcXPoly() override;
63
64
    SAL_DLLPRIVATE virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override;
65
66
    // protected destructor - due to final, make private
67
    SAL_DLLPRIVATE virtual ~SdrCircObj() override;
68
69
    SAL_DLLPRIVATE virtual rtl::Reference<SdrObject> implCloneSdrObject(SdrModel& rTargetModel) const override;
70
71
public:
72
    SAL_DLLPRIVATE SdrCircObj(
73
        SdrModel& rSdrModel,
74
        SdrCircKind eNewKind);
75
    SdrCircObj(
76
        SdrModel& rSdrModel,
77
        SdrCircKind eNewKind,
78
        const tools::Rectangle& rRect);
79
    // Copy constructor
80
    SAL_DLLPRIVATE SdrCircObj(SdrModel& rSdrModel, SdrCircObj const & rSource);
81
82
    // 0=0.00Deg=3h 9000=90.00Deg=12h 18000=180.00Deg=9h 27000=270.00Deg=6h
83
    // The circle is built up from StartAngle to EndWink anti-clockwise.
84
    // If nNewStartAngle==nNewEndWink, then arc has an angle of 0 degrees.
85
    // If nNewStartAngle+36000==nNewEndWink, then the arc has angle of 360 degrees.
86
    SdrCircObj(
87
        SdrModel& rSdrModel,
88
        SdrCircKind eNewKind,
89
        const tools::Rectangle& rRect,
90
        Degree100 nNewStartAngle,
91
        Degree100 nNewEndAngle);
92
93
14.4k
    SdrCircKind GetCircleKind() const { return meCircleKind; }
94
95
    SAL_DLLPRIVATE virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
96
    SAL_DLLPRIVATE virtual SdrObjKind GetObjIdentifier() const override;
97
    SAL_DLLPRIVATE virtual void TakeUnrotatedSnapRect(tools::Rectangle& rRect) const override;
98
99
    SAL_DLLPRIVATE virtual OUString TakeObjNameSingul() const override;
100
    SAL_DLLPRIVATE virtual OUString TakeObjNamePlural() const override;
101
102
    SAL_DLLPRIVATE virtual void RecalcSnapRect() override;
103
    SAL_DLLPRIVATE virtual void NbcSetSnapRect(const tools::Rectangle& rRect) override;
104
    SAL_DLLPRIVATE virtual basegfx::B2DPolyPolygon TakeXorPoly() const override;
105
106
    SAL_DLLPRIVATE virtual sal_uInt32 GetSnapPointCount() const override;
107
    SAL_DLLPRIVATE virtual Point GetSnapPoint(sal_uInt32 i) const override;
108
109
    SAL_DLLPRIVATE virtual sal_uInt32 GetHdlCount() const override;
110
    SAL_DLLPRIVATE virtual void AddToHdlList(SdrHdlList& rHdlList) const override;
111
112
    // special drag methods
113
    SAL_DLLPRIVATE virtual bool hasSpecialDrag() const override;
114
    SAL_DLLPRIVATE virtual bool beginSpecialDrag(SdrDragStat& rDrag) const override;
115
    SAL_DLLPRIVATE virtual bool applySpecialDrag(SdrDragStat& rDrag) override;
116
    SAL_DLLPRIVATE virtual OUString getSpecialDragComment(const SdrDragStat& rDrag) const override;
117
118
    SAL_DLLPRIVATE virtual bool BegCreate(SdrDragStat& rStat) override;
119
    SAL_DLLPRIVATE virtual bool MovCreate(SdrDragStat& rStat) override;
120
    SAL_DLLPRIVATE virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) override;
121
    SAL_DLLPRIVATE virtual bool BckCreate(SdrDragStat& rStat) override;
122
    SAL_DLLPRIVATE virtual void BrkCreate(SdrDragStat& rStat) override;
123
    SAL_DLLPRIVATE virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const override;
124
    SAL_DLLPRIVATE virtual PointerStyle GetCreatePointer() const override;
125
    SAL_DLLPRIVATE virtual void NbcMove(const Size& aSiz) override;
126
    SAL_DLLPRIVATE virtual void NbcResize(const Point& rRef, double xFact, double yFact) override;
127
    SAL_DLLPRIVATE virtual void NbcMirror(const Point& rRef1, const Point& rRef2) override;
128
    SAL_DLLPRIVATE virtual void NbcShear (const Point& rRef, Degree100 nAngle, double tn, bool bVShear) override;
129
    SAL_DLLPRIVATE virtual rtl::Reference<SdrObject> DoConvertToPolyObj(bool bBezier, bool bAddText) const override;
130
131
private:
132
    SAL_DLLPRIVATE virtual std::unique_ptr<SdrObjGeoData> NewGeoData() const override;
133
    SAL_DLLPRIVATE virtual void SaveGeoData(SdrObjGeoData& rGeo) const override;
134
    SAL_DLLPRIVATE virtual void RestoreGeoData(const SdrObjGeoData& rGeo) override;
135
public:
136
14.2k
    Degree100 GetStartAngle() const { return m_nStartAngle; }
137
28.2k
    Degree100 GetEndAngle() const { return m_nEndAngle; }
138
139
};
140
141
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */