Coverage Report

Created: 2026-11-06 11:29

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/svx/source/sdr/properties/circleproperties.cxx
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
#include <sal/config.h>
21
22
#include <sdr/properties/circleproperties.hxx>
23
#include <svl/itemset.hxx>
24
#include <svl/style.hxx>
25
#include <svx/svddef.hxx>
26
#include <editeng/eeitem.hxx>
27
#include <svx/svdocirc.hxx>
28
#include <sxcikitm.hxx>
29
#include <svx/sxciaitm.hxx>
30
31
32
namespace sdr::properties
33
{
34
        // create a new itemset
35
        SfxItemSet CircleProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
36
15.4k
        {
37
15.4k
            return SfxItemSet(
38
15.4k
                rPool,
39
15.4k
                svl::Items<
40
                    // Ranges from SdrAttrObj, SdrCircObj
41
15.4k
                    SDRATTR_START, SDRATTR_SHADOW_LAST,
42
15.4k
                    SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
43
15.4k
                    SDRATTR_CIRC_FIRST, SDRATTR_CIRC_LAST,
44
15.4k
                    SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
45
15.4k
                    SDRATTR_GLOW_FIRST, SDRATTR_GLOW_TEXT_LAST,
46
15.4k
                    SDRATTR_TEXTCOLUMNS_FIRST, SDRATTR_TEXTCOLUMNS_LAST,
47
15.4k
                    SDRATTR_REFLECTION_FIRST, SDRATTR_REFLECTION_LAST,
48
                    // Range from SdrTextObj:
49
15.4k
                    EE_ITEMS_START, EE_ITEMS_END>);
50
15.4k
        }
51
52
        CircleProperties::CircleProperties(SdrObject& rObj)
53
15.2k
        :   RectangleProperties(rObj)
54
15.2k
        {
55
15.2k
        }
56
57
        CircleProperties::CircleProperties(const CircleProperties& rProps, SdrObject& rObj)
58
154
        :   RectangleProperties(rProps, rObj)
59
154
        {
60
154
        }
61
62
        CircleProperties::~CircleProperties()
63
15.4k
        {
64
15.4k
        }
65
66
        std::unique_ptr<BaseProperties> CircleProperties::implCloneProperties(SdrObject& rObj) const
67
154
        {
68
154
            return std::unique_ptr<BaseProperties>(new CircleProperties(*this, rObj));
69
154
        }
70
71
        void CircleProperties::ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich, bool bAdjustTextFrameWidthAndHeight)
72
145k
        {
73
145k
            SdrCircObj& rObj = static_cast<SdrCircObj&>(GetSdrObject());
74
75
            // call parent
76
145k
            RectangleProperties::ItemSetChanged(aChangedItems, nDeletedWhich, bAdjustTextFrameWidthAndHeight);
77
78
            // local changes
79
145k
            rObj.ImpSetAttrToCircInfo();
80
145k
        }
81
82
        void CircleProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr,
83
                bool bBroadcast, bool bAdjustTextFrameWidthAndHeight)
84
12.3k
        {
85
            // call parent (always first thing to do, may create the SfxItemSet)
86
12.3k
            RectangleProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr, bBroadcast, bAdjustTextFrameWidthAndHeight);
87
88
            // local changes
89
12.3k
            SdrCircObj& rObj = static_cast<SdrCircObj&>(GetSdrObject());
90
12.3k
            rObj.SetXPolyDirty();
91
92
            // local changes
93
12.3k
            rObj.ImpSetAttrToCircInfo();
94
12.3k
        }
95
96
        void CircleProperties::ForceDefaultAttributes()
97
15.2k
        {
98
15.2k
            SdrCircObj& rObj = static_cast<SdrCircObj&>(GetSdrObject());
99
15.2k
            SdrCircKind eKind = rObj.GetCircleKind();
100
101
15.2k
            if(eKind != SdrCircKind::Full)
102
12.8k
            {
103
12.8k
                moItemSet->Put(SdrCircKindItem(eKind));
104
105
12.8k
                if(rObj.GetStartAngle())
106
210
                {
107
210
                    moItemSet->Put(makeSdrCircStartAngleItem(rObj.GetStartAngle()));
108
210
                }
109
110
12.8k
                if(rObj.GetEndAngle() != 36000_deg100)
111
12.8k
                {
112
12.8k
                    moItemSet->Put(makeSdrCircEndAngleItem(rObj.GetEndAngle()));
113
12.8k
                }
114
12.8k
            }
115
116
            // call parent after SetObjectItem(SdrCircKindItem())
117
            // because ForceDefaultAttr() will call
118
            // ImpSetAttrToCircInfo() which needs a correct
119
            // SdrCircKindItem
120
15.2k
            RectangleProperties::ForceDefaultAttributes();
121
15.2k
        }
122
} // end of namespace
123
124
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */