1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 #include <sdr/attribute/sdrformtextoutlineattribute.hxx>
22 #include <drawinglayer/attribute/lineattribute.hxx>
23 #include <drawinglayer/attribute/strokeattribute.hxx>
27 namespace drawinglayer::attribute
29 class ImpSdrFormTextOutlineAttribute
32 // one set of attributes for FormText (FontWork) outline visualisation
33 LineAttribute maLineAttribute
;
34 StrokeAttribute maStrokeAttribute
;
35 sal_uInt8 mnTransparence
;
37 ImpSdrFormTextOutlineAttribute(
38 const LineAttribute
& rLineAttribute
,
39 StrokeAttribute aStrokeAttribute
,
40 sal_uInt8 nTransparence
)
41 : maLineAttribute(rLineAttribute
),
42 maStrokeAttribute(std::move(aStrokeAttribute
)),
43 mnTransparence(nTransparence
)
47 ImpSdrFormTextOutlineAttribute()
53 const LineAttribute
& getLineAttribute() const { return maLineAttribute
; }
54 const StrokeAttribute
& getStrokeAttribute() const { return maStrokeAttribute
; }
55 sal_uInt8
getTransparence() const { return mnTransparence
; }
58 bool operator==(const ImpSdrFormTextOutlineAttribute
& rCandidate
) const
60 return (getLineAttribute() == rCandidate
.getLineAttribute()
61 && getStrokeAttribute() == rCandidate
.getStrokeAttribute()
62 && getTransparence() == rCandidate
.getTransparence());
68 SdrFormTextOutlineAttribute::ImplType
& theGlobalDefault()
70 static SdrFormTextOutlineAttribute::ImplType SINGLETON
;
75 SdrFormTextOutlineAttribute::SdrFormTextOutlineAttribute(
76 const LineAttribute
& rLineAttribute
,
77 const StrokeAttribute
& rStrokeAttribute
,
78 sal_uInt8 nTransparence
)
79 : mpSdrFormTextOutlineAttribute(
80 ImpSdrFormTextOutlineAttribute(
81 rLineAttribute
, rStrokeAttribute
, nTransparence
))
85 SdrFormTextOutlineAttribute::SdrFormTextOutlineAttribute()
86 : mpSdrFormTextOutlineAttribute(theGlobalDefault())
90 SdrFormTextOutlineAttribute::SdrFormTextOutlineAttribute(const SdrFormTextOutlineAttribute
& rCandidate
)
91 : mpSdrFormTextOutlineAttribute(rCandidate
.mpSdrFormTextOutlineAttribute
)
95 SdrFormTextOutlineAttribute::~SdrFormTextOutlineAttribute()
99 bool SdrFormTextOutlineAttribute::isDefault() const
101 return mpSdrFormTextOutlineAttribute
.same_object(theGlobalDefault());
104 SdrFormTextOutlineAttribute
& SdrFormTextOutlineAttribute::operator=(const SdrFormTextOutlineAttribute
& rCandidate
)
106 mpSdrFormTextOutlineAttribute
= rCandidate
.mpSdrFormTextOutlineAttribute
;
110 SdrFormTextOutlineAttribute
& SdrFormTextOutlineAttribute::operator=(SdrFormTextOutlineAttribute
&& rCandidate
) noexcept
112 mpSdrFormTextOutlineAttribute
= std::move(rCandidate
.mpSdrFormTextOutlineAttribute
);
116 bool SdrFormTextOutlineAttribute::operator==(const SdrFormTextOutlineAttribute
& rCandidate
) const
118 // tdf#87509 default attr is always != non-default attr, even with same values
119 if(rCandidate
.isDefault() != isDefault())
122 return rCandidate
.mpSdrFormTextOutlineAttribute
== mpSdrFormTextOutlineAttribute
;
125 const LineAttribute
& SdrFormTextOutlineAttribute::getLineAttribute() const
127 return mpSdrFormTextOutlineAttribute
->getLineAttribute();
130 const StrokeAttribute
& SdrFormTextOutlineAttribute::getStrokeAttribute() const
132 return mpSdrFormTextOutlineAttribute
->getStrokeAttribute();
135 sal_uInt8
SdrFormTextOutlineAttribute::getTransparence() const
137 return mpSdrFormTextOutlineAttribute
->getTransparence();
140 } // end of namespace
142 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */