LibreOffice Module drawinglayer (master) 1
sdrlinestartendattribute.cxx
Go to the documentation of this file.
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
22#include <utility>
23
24
26{
28 {
29 public:
30 // line arrow definitions
33 double mfStartWidth; // 1/100th mm
34 double mfEndWidth; // 1/100th mm
35
36 bool mbStartActive : 1; // start of Line is active
37 bool mbEndActive : 1; // end of Line is active
38 bool mbStartCentered : 1; // Line is centered on line start point
39 bool mbEndCentered : 1; // Line is centered on line end point
40
42 basegfx::B2DPolyPolygon aStartPolyPolygon,
43 basegfx::B2DPolyPolygon aEndPolyPolygon,
44 double fStartWidth,
45 double fEndWidth,
46 bool bStartActive,
47 bool bEndActive,
48 bool bStartCentered,
49 bool bEndCentered)
50 : maStartPolyPolygon(std::move(aStartPolyPolygon)),
51 maEndPolyPolygon(std::move(aEndPolyPolygon)),
52 mfStartWidth(fStartWidth),
53 mfEndWidth(fEndWidth),
54 mbStartActive(bStartActive),
55 mbEndActive(bEndActive),
56 mbStartCentered(bStartCentered),
57 mbEndCentered(bEndCentered)
58 {
59 }
60
62 : mfStartWidth(0.0),
63 mfEndWidth(0.0),
64 mbStartActive(false),
65 mbEndActive(false),
66 mbStartCentered(false),
67 mbEndCentered(false)
68 {
69 }
70
71 // data read access
74 double getStartWidth() const { return mfStartWidth; }
75 double getEndWidth() const { return mfEndWidth; }
76 bool isStartActive() const { return mbStartActive; }
77 bool isEndActive() const { return mbEndActive; }
78 bool isStartCentered() const { return mbStartCentered; }
79 bool isEndCentered() const { return mbEndCentered; }
80
81 bool operator==(const ImpSdrLineStartEndAttribute& rCandidate) const
82 {
83 return (getStartPolyPolygon() == rCandidate.getStartPolyPolygon()
84 && getEndPolyPolygon() == rCandidate.getEndPolyPolygon()
85 && getStartWidth() == rCandidate.getStartWidth()
86 && getEndWidth() == rCandidate.getEndWidth()
87 && isStartActive() == rCandidate.isStartActive()
88 && isEndActive() == rCandidate.isEndActive()
89 && isStartCentered() == rCandidate.isStartCentered()
90 && isEndCentered() == rCandidate.isEndCentered());
91 }
92 };
93
94 namespace
95 {
96 SdrLineStartEndAttribute::ImplType& theGlobalDefault()
97 {
99 return SINGLETON;
100 }
101 }
102
104 const basegfx::B2DPolyPolygon& rStartPolyPolygon,
105 const basegfx::B2DPolyPolygon& rEndPolyPolygon,
106 double fStartWidth,
107 double fEndWidth,
108 bool bStartActive,
109 bool bEndActive,
110 bool bStartCentered,
111 bool bEndCentered)
112 : mpSdrLineStartEndAttribute(ImpSdrLineStartEndAttribute(
113 rStartPolyPolygon, rEndPolyPolygon, fStartWidth, fEndWidth, bStartActive, bEndActive, bStartCentered, bEndCentered))
114 {
115 }
116
118 : mpSdrLineStartEndAttribute(theGlobalDefault())
119 {
120 }
121
123
125
127
129 {
130 return mpSdrLineStartEndAttribute.same_object(theGlobalDefault());
131 }
132
134
136
138 {
139 // tdf#87509 default attr is always != non-default attr, even with same values
140 if(rCandidate.isDefault() != isDefault())
141 return false;
142
144 }
145
147 {
148 return mpSdrLineStartEndAttribute->getStartPolyPolygon();
149 }
150
152 {
153 return mpSdrLineStartEndAttribute->getEndPolyPolygon();
154 }
155
157 {
158 return mpSdrLineStartEndAttribute->getStartWidth();
159 }
160
162 {
163 return mpSdrLineStartEndAttribute->getEndWidth();
164 }
165
167 {
168 return mpSdrLineStartEndAttribute->isStartActive();
169 }
170
172 {
173 return mpSdrLineStartEndAttribute->isEndActive();
174 }
175
177 {
178 return mpSdrLineStartEndAttribute->isStartCentered();
179 }
180
182 {
183 return mpSdrLineStartEndAttribute->isEndCentered();
184 }
185
186} // end of namespace
187
188/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool operator==(const ImpSdrLineStartEndAttribute &rCandidate) const
const basegfx::B2DPolyPolygon & getEndPolyPolygon() const
ImpSdrLineStartEndAttribute(basegfx::B2DPolyPolygon aStartPolyPolygon, basegfx::B2DPolyPolygon aEndPolyPolygon, double fStartWidth, double fEndWidth, bool bStartActive, bool bEndActive, bool bStartCentered, bool bEndCentered)
const basegfx::B2DPolyPolygon & getStartPolyPolygon() const
o3tl::cow_wrapper< ImpSdrLineStartEndAttribute > ImplType
const basegfx::B2DPolyPolygon & getStartPolyPolygon() const
SdrLineStartEndAttribute & operator=(const SdrLineStartEndAttribute &)
const basegfx::B2DPolyPolygon & getEndPolyPolygon() const
bool operator==(const SdrLineStartEndAttribute &rCandidate) const
bool same_object(const cow_wrapper &rOther) const