update emoji autocorrect entries from po-files
[LibreOffice.git] / drawinglayer / source / attribute / fillhatchattribute.cxx
blobf54db0861655b83d9434e65bc028821c56c9324a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 #include <drawinglayer/attribute/fillhatchattribute.hxx>
21 #include <basegfx/color/bcolor.hxx>
22 #include <rtl/instance.hxx>
26 namespace drawinglayer
28 namespace attribute
30 class ImpFillHatchAttribute
32 public:
33 // data definitions
34 HatchStyle meStyle;
35 double mfDistance;
36 double mfAngle;
37 basegfx::BColor maColor;
38 sal_uInt32 mnMinimalDiscreteDistance;
40 // bitfield
41 bool mbFillBackground : 1;
43 ImpFillHatchAttribute(
44 HatchStyle eStyle,
45 double fDistance,
46 double fAngle,
47 const basegfx::BColor& rColor,
48 sal_uInt32 nMinimalDiscreteDistance,
49 bool bFillBackground)
50 : meStyle(eStyle),
51 mfDistance(fDistance),
52 mfAngle(fAngle),
53 maColor(rColor),
54 mnMinimalDiscreteDistance(nMinimalDiscreteDistance),
55 mbFillBackground(bFillBackground)
59 ImpFillHatchAttribute()
60 : meStyle(HATCHSTYLE_SINGLE),
61 mfDistance(0.0),
62 mfAngle(0.0),
63 maColor(basegfx::BColor()),
64 mnMinimalDiscreteDistance(3), // same as VCL
65 mbFillBackground(false)
69 // data read access
70 HatchStyle getStyle() const { return meStyle; }
71 double getDistance() const { return mfDistance; }
72 double getAngle() const { return mfAngle; }
73 const basegfx::BColor& getColor() const { return maColor; }
74 sal_uInt32 getMinimalDiscreteDistance() const { return mnMinimalDiscreteDistance; }
75 bool isFillBackground() const { return mbFillBackground; }
77 bool operator==(const ImpFillHatchAttribute& rCandidate) const
79 return (getStyle() == rCandidate.getStyle()
80 && getDistance() == rCandidate.getDistance()
81 && getAngle() == rCandidate.getAngle()
82 && getColor() == rCandidate.getColor()
83 && getMinimalDiscreteDistance() == rCandidate.getMinimalDiscreteDistance()
84 && isFillBackground() == rCandidate.isFillBackground());
88 namespace
90 struct theGlobalDefault :
91 public rtl::Static< FillHatchAttribute::ImplType, theGlobalDefault > {};
94 FillHatchAttribute::FillHatchAttribute(
95 HatchStyle eStyle,
96 double fDistance,
97 double fAngle,
98 const basegfx::BColor& rColor,
99 sal_uInt32 nMinimalDiscreteDistance,
100 bool bFillBackground)
101 : mpFillHatchAttribute(ImpFillHatchAttribute(
102 eStyle, fDistance, fAngle, rColor,
103 nMinimalDiscreteDistance, bFillBackground))
107 FillHatchAttribute::FillHatchAttribute()
108 : mpFillHatchAttribute(theGlobalDefault::get())
112 FillHatchAttribute::FillHatchAttribute(const FillHatchAttribute& rCandidate)
113 : mpFillHatchAttribute(rCandidate.mpFillHatchAttribute)
117 FillHatchAttribute::~FillHatchAttribute()
121 bool FillHatchAttribute::isDefault() const
123 return mpFillHatchAttribute.same_object(theGlobalDefault::get());
126 FillHatchAttribute& FillHatchAttribute::operator=(const FillHatchAttribute& rCandidate)
128 mpFillHatchAttribute = rCandidate.mpFillHatchAttribute;
129 return *this;
132 bool FillHatchAttribute::operator==(const FillHatchAttribute& rCandidate) const
134 // tdf#87509 default attr is always != non-default attr, even with same values
135 if(rCandidate.isDefault() != isDefault())
136 return false;
138 return rCandidate.mpFillHatchAttribute == mpFillHatchAttribute;
141 // data read access
142 HatchStyle FillHatchAttribute::getStyle() const
144 return mpFillHatchAttribute->getStyle();
147 double FillHatchAttribute::getDistance() const
149 return mpFillHatchAttribute->getDistance();
152 double FillHatchAttribute::getAngle() const
154 return mpFillHatchAttribute->getAngle();
157 const basegfx::BColor& FillHatchAttribute::getColor() const
159 return mpFillHatchAttribute->getColor();
162 sal_uInt32 FillHatchAttribute::getMinimalDiscreteDistance() const
164 return mpFillHatchAttribute->getMinimalDiscreteDistance();
167 bool FillHatchAttribute::isFillBackground() const
169 return mpFillHatchAttribute->isFillBackground();
172 } // end of namespace attribute
173 } // end of namespace drawinglayer
175 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */