Coverage Report

Created: 2025-12-08 09:28

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.2k
        {
37
15.2k
            return SfxItemSet(
38
15.2k
                rPool,
39
15.2k
                svl::Items<
40
                    // Ranges from SdrAttrObj, SdrCircObj
41
15.2k
                    SDRATTR_START, SDRATTR_SHADOW_LAST,
42
15.2k
                    SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
43
15.2k
                    SDRATTR_CIRC_FIRST, SDRATTR_CIRC_LAST,
44
15.2k
                    SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
45
15.2k
                    SDRATTR_TEXTCOLUMNS_FIRST, SDRATTR_TEXTCOLUMNS_LAST,
46
                    // Range from SdrTextObj:
47
15.2k
                    EE_ITEMS_START, EE_ITEMS_END>);
48
15.2k
        }
49
50
        CircleProperties::CircleProperties(SdrObject& rObj)
51
15.0k
        :   RectangleProperties(rObj)
52
15.0k
        {
53
15.0k
        }
54
55
        CircleProperties::CircleProperties(const CircleProperties& rProps, SdrObject& rObj)
56
112
        :   RectangleProperties(rProps, rObj)
57
112
        {
58
112
        }
59
60
        CircleProperties::~CircleProperties()
61
15.1k
        {
62
15.1k
        }
63
64
        std::unique_ptr<BaseProperties> CircleProperties::Clone(SdrObject& rObj) const
65
112
        {
66
112
            return std::unique_ptr<BaseProperties>(new CircleProperties(*this, rObj));
67
112
        }
68
69
        void CircleProperties::ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich, bool bAdjustTextFrameWidthAndHeight)
70
152k
        {
71
152k
            SdrCircObj& rObj = static_cast<SdrCircObj&>(GetSdrObject());
72
73
            // call parent
74
152k
            RectangleProperties::ItemSetChanged(aChangedItems, nDeletedWhich, bAdjustTextFrameWidthAndHeight);
75
76
            // local changes
77
152k
            rObj.ImpSetAttrToCircInfo();
78
152k
        }
79
80
        void CircleProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr,
81
                bool bBroadcast, bool bAdjustTextFrameWidthAndHeight)
82
12.7k
        {
83
            // call parent (always first thing to do, may create the SfxItemSet)
84
12.7k
            RectangleProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr, bBroadcast, bAdjustTextFrameWidthAndHeight);
85
86
            // local changes
87
12.7k
            SdrCircObj& rObj = static_cast<SdrCircObj&>(GetSdrObject());
88
12.7k
            rObj.SetXPolyDirty();
89
90
            // local changes
91
12.7k
            rObj.ImpSetAttrToCircInfo();
92
12.7k
        }
93
94
        void CircleProperties::ForceDefaultAttributes()
95
15.0k
        {
96
15.0k
            SdrCircObj& rObj = static_cast<SdrCircObj&>(GetSdrObject());
97
15.0k
            SdrCircKind eKind = rObj.GetCircleKind();
98
99
15.0k
            if(eKind != SdrCircKind::Full)
100
13.1k
            {
101
13.1k
                moItemSet->Put(SdrCircKindItem(eKind));
102
103
13.1k
                if(rObj.GetStartAngle())
104
238
                {
105
238
                    moItemSet->Put(makeSdrCircStartAngleItem(rObj.GetStartAngle()));
106
238
                }
107
108
13.1k
                if(rObj.GetEndAngle() != 36000_deg100)
109
13.1k
                {
110
13.1k
                    moItemSet->Put(makeSdrCircEndAngleItem(rObj.GetEndAngle()));
111
13.1k
                }
112
13.1k
            }
113
114
            // call parent after SetObjectItem(SdrCircKindItem())
115
            // because ForceDefaultAttr() will call
116
            // ImpSetAttrToCircInfo() which needs a correct
117
            // SdrCircKindItem
118
15.0k
            RectangleProperties::ForceDefaultAttributes();
119
15.0k
        }
120
} // end of namespace
121
122
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */