LibreOffice Module drawinglayer (master) 1
fillhatchattribute.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
23
25{
27 {
28 public:
29 // data definitions
31 double mfDistance;
32 double mfAngle;
35
37
39 HatchStyle eStyle,
40 double fDistance,
41 double fAngle,
42 const basegfx::BColor& rColor,
43 sal_uInt32 nMinimalDiscreteDistance,
44 bool bFillBackground)
45 : meStyle(eStyle),
46 mfDistance(fDistance),
47 mfAngle(fAngle),
48 maColor(rColor),
49 mnMinimalDiscreteDistance(nMinimalDiscreteDistance),
50 mbFillBackground(bFillBackground)
51 {
52 }
53
56 mfDistance(0.0),
57 mfAngle(0.0),
58 mnMinimalDiscreteDistance(3), // same as VCL
59 mbFillBackground(false)
60 {
61 }
62
63 // data read access
64 HatchStyle getStyle() const { return meStyle; }
65 double getDistance() const { return mfDistance; }
66 double getAngle() const { return mfAngle; }
67 const basegfx::BColor& getColor() const { return maColor; }
69 bool isFillBackground() const { return mbFillBackground; }
70
71 bool operator==(const ImpFillHatchAttribute& rCandidate) const
72 {
73 return (getStyle() == rCandidate.getStyle()
74 && getDistance() == rCandidate.getDistance()
75 && getAngle() == rCandidate.getAngle()
76 && getColor() == rCandidate.getColor()
78 && isFillBackground() == rCandidate.isFillBackground());
79 }
80 };
81
82 namespace
83 {
84 FillHatchAttribute::ImplType& theGlobalDefault()
85 {
86 static FillHatchAttribute::ImplType SINGLETON;
87 return SINGLETON;
88 }
89 }
90
92 HatchStyle eStyle,
93 double fDistance,
94 double fAngle,
95 const basegfx::BColor& rColor,
96 sal_uInt32 nMinimalDiscreteDistance,
97 bool bFillBackground)
98 : mpFillHatchAttribute(ImpFillHatchAttribute(
99 eStyle, fDistance, fAngle, rColor,
100 nMinimalDiscreteDistance, bFillBackground))
101 {
102 }
103
105 : mpFillHatchAttribute(theGlobalDefault())
106 {
107 }
108
110
112
114
116 {
117 return mpFillHatchAttribute.same_object(theGlobalDefault());
118 }
119
121
123
125 {
126 // tdf#87509 default attr is always != non-default attr, even with same values
127 if(rCandidate.isDefault() != isDefault())
128 return false;
129
130 return rCandidate.mpFillHatchAttribute == mpFillHatchAttribute;
131 }
132
133 // data read access
135 {
136 return mpFillHatchAttribute->getStyle();
137 }
138
140 {
141 return mpFillHatchAttribute->getDistance();
142 }
143
145 {
146 return mpFillHatchAttribute->getAngle();
147 }
148
150 {
151 return mpFillHatchAttribute->getColor();
152 }
153
155 {
156 return mpFillHatchAttribute->getMinimalDiscreteDistance();
157 }
158
160 {
161 return mpFillHatchAttribute->isFillBackground();
162 }
163
164} // end of namespace
165
166/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
o3tl::cow_wrapper< ImpFillHatchAttribute > ImplType
bool operator==(const FillHatchAttribute &rCandidate) const
FillHatchAttribute & operator=(const FillHatchAttribute &)
bool operator==(const ImpFillHatchAttribute &rCandidate) const
ImpFillHatchAttribute(HatchStyle eStyle, double fDistance, double fAngle, const basegfx::BColor &rColor, sal_uInt32 nMinimalDiscreteDistance, bool bFillBackground)
bool same_object(const cow_wrapper &rOther) const