Coverage Report

Created: 2026-05-16 09:25

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/svx/source/sdr/attribute/sdrformtextoutlineattribute.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
21
#include <sdr/attribute/sdrformtextoutlineattribute.hxx>
22
#include <drawinglayer/attribute/lineattribute.hxx>
23
#include <drawinglayer/attribute/strokeattribute.hxx>
24
#include <utility>
25
26
27
namespace drawinglayer::attribute
28
{
29
        class ImpSdrFormTextOutlineAttribute
30
        {
31
        public:
32
            // one set of attributes for FormText (FontWork) outline visualisation
33
            LineAttribute                       maLineAttribute;
34
            StrokeAttribute                     maStrokeAttribute;
35
            sal_uInt8                           mnTransparence;
36
37
            ImpSdrFormTextOutlineAttribute(
38
                const LineAttribute& rLineAttribute,
39
                StrokeAttribute aStrokeAttribute,
40
                sal_uInt8 nTransparence)
41
0
            :   maLineAttribute(rLineAttribute),
42
0
                maStrokeAttribute(std::move(aStrokeAttribute)),
43
0
                mnTransparence(nTransparence)
44
0
            {
45
0
            }
46
47
            ImpSdrFormTextOutlineAttribute()
48
5
            : mnTransparence(0)
49
5
            {
50
5
            }
51
52
            // data read access
53
0
            const LineAttribute& getLineAttribute() const { return maLineAttribute; }
54
0
            const StrokeAttribute& getStrokeAttribute() const { return maStrokeAttribute; }
55
0
            sal_uInt8 getTransparence() const { return mnTransparence; }
56
57
            // compare operator
58
            bool operator==(const ImpSdrFormTextOutlineAttribute& rCandidate) const
59
0
            {
60
0
                return (getLineAttribute() == rCandidate.getLineAttribute()
61
0
                    && getStrokeAttribute() == rCandidate.getStrokeAttribute()
62
0
                    && getTransparence() == rCandidate.getTransparence());
63
0
            }
64
        };
65
66
        namespace
67
        {
68
            SdrFormTextOutlineAttribute::ImplType& theGlobalDefault()
69
10
            {
70
10
                static SdrFormTextOutlineAttribute::ImplType SINGLETON;
71
10
                return SINGLETON;
72
10
            }
73
        }
74
75
        SdrFormTextOutlineAttribute::SdrFormTextOutlineAttribute(
76
            const LineAttribute& rLineAttribute,
77
            const StrokeAttribute& rStrokeAttribute,
78
            sal_uInt8 nTransparence)
79
0
        :   mpSdrFormTextOutlineAttribute(
80
0
                ImpSdrFormTextOutlineAttribute(
81
0
                    rLineAttribute, rStrokeAttribute, nTransparence))
82
0
        {
83
0
        }
84
85
        SdrFormTextOutlineAttribute::SdrFormTextOutlineAttribute()
86
10
        :   mpSdrFormTextOutlineAttribute(theGlobalDefault())
87
10
        {
88
10
        }
89
90
        SdrFormTextOutlineAttribute::SdrFormTextOutlineAttribute(const SdrFormTextOutlineAttribute& rCandidate)
91
0
        :   mpSdrFormTextOutlineAttribute(rCandidate.mpSdrFormTextOutlineAttribute)
92
0
        {
93
0
        }
94
95
        SdrFormTextOutlineAttribute::~SdrFormTextOutlineAttribute()
96
10
        {
97
10
        }
98
99
        bool SdrFormTextOutlineAttribute::isDefault() const
100
0
        {
101
0
            return mpSdrFormTextOutlineAttribute.same_object(theGlobalDefault());
102
0
        }
103
104
        SdrFormTextOutlineAttribute& SdrFormTextOutlineAttribute::operator=(const SdrFormTextOutlineAttribute& rCandidate)
105
0
        {
106
0
            mpSdrFormTextOutlineAttribute = rCandidate.mpSdrFormTextOutlineAttribute;
107
0
            return *this;
108
0
        }
109
110
        SdrFormTextOutlineAttribute& SdrFormTextOutlineAttribute::operator=(SdrFormTextOutlineAttribute&& rCandidate) noexcept
111
0
        {
112
0
            mpSdrFormTextOutlineAttribute = std::move(rCandidate.mpSdrFormTextOutlineAttribute);
113
0
            return *this;
114
0
        }
115
116
        bool SdrFormTextOutlineAttribute::operator==(const SdrFormTextOutlineAttribute& rCandidate) const
117
0
        {
118
            // tdf#87509 default attr is always != non-default attr, even with same values
119
0
            if(rCandidate.isDefault() != isDefault())
120
0
                return false;
121
122
0
            return rCandidate.mpSdrFormTextOutlineAttribute == mpSdrFormTextOutlineAttribute;
123
0
        }
124
125
        const LineAttribute& SdrFormTextOutlineAttribute::getLineAttribute() const
126
0
        {
127
0
            return mpSdrFormTextOutlineAttribute->getLineAttribute();
128
0
        }
129
130
        const StrokeAttribute& SdrFormTextOutlineAttribute::getStrokeAttribute() const
131
0
        {
132
0
            return mpSdrFormTextOutlineAttribute->getStrokeAttribute();
133
0
        }
134
135
        sal_uInt8 SdrFormTextOutlineAttribute::getTransparence() const
136
0
        {
137
0
            return mpSdrFormTextOutlineAttribute->getTransparence();
138
0
        }
139
140
} // end of namespace
141
142
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */