lineattribute.cxx (464702f4) lineattribute.cxx (5aaf853b)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 29 unchanged lines hidden (view full) ---

38 public:
39 // refcounter
40 sal_uInt32 mnRefCount;
41
42 // data definitions
43 basegfx::BColor maColor; // color
44 double mfWidth; // absolute line width
45 basegfx::B2DLineJoin meLineJoin; // type of LineJoin
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 29 unchanged lines hidden (view full) ---

38 public:
39 // refcounter
40 sal_uInt32 mnRefCount;
41
42 // data definitions
43 basegfx::BColor maColor; // color
44 double mfWidth; // absolute line width
45 basegfx::B2DLineJoin meLineJoin; // type of LineJoin
46 com::sun::star::drawing::LineCap meLineCap; // BUTT, ROUND, or SQUARE
46
47 ImpLineAttribute(
48 const basegfx::BColor& rColor,
49 double fWidth,
47
48 ImpLineAttribute(
49 const basegfx::BColor& rColor,
50 double fWidth,
50 basegfx::B2DLineJoin aB2DLineJoin)
51 basegfx::B2DLineJoin aB2DLineJoin,
52 com::sun::star::drawing::LineCap aLineCap)
51 : mnRefCount(0),
52 maColor(rColor),
53 mfWidth(fWidth),
53 : mnRefCount(0),
54 maColor(rColor),
55 mfWidth(fWidth),
54 meLineJoin(aB2DLineJoin)
56 meLineJoin(aB2DLineJoin),
57 meLineCap(aLineCap)
55 {
56 }
57
58 // data read access
59 const basegfx::BColor& getColor() const { return maColor; }
60 double getWidth() const { return mfWidth; }
61 basegfx::B2DLineJoin getLineJoin() const { return meLineJoin; }
58 {
59 }
60
61 // data read access
62 const basegfx::BColor& getColor() const { return maColor; }
63 double getWidth() const { return mfWidth; }
64 basegfx::B2DLineJoin getLineJoin() const { return meLineJoin; }
65 com::sun::star::drawing::LineCap getLineCap() const { return meLineCap; }
62
63 bool operator==(const ImpLineAttribute& rCandidate) const
64 {
65 return (getColor() == rCandidate.getColor()
66 && getWidth() == rCandidate.getWidth()
66
67 bool operator==(const ImpLineAttribute& rCandidate) const
68 {
69 return (getColor() == rCandidate.getColor()
70 && getWidth() == rCandidate.getWidth()
67 && getLineJoin() == rCandidate.getLineJoin());
71 && getLineJoin() == rCandidate.getLineJoin()
72 && getLineCap() == rCandidate.getLineCap());
68 }
69
70 static ImpLineAttribute* get_global_default()
71 {
72 static ImpLineAttribute* pDefault = 0;
73
74 if(!pDefault)
75 {
76 pDefault = new ImpLineAttribute(
77 basegfx::BColor(),
78 0.0,
73 }
74
75 static ImpLineAttribute* get_global_default()
76 {
77 static ImpLineAttribute* pDefault = 0;
78
79 if(!pDefault)
80 {
81 pDefault = new ImpLineAttribute(
82 basegfx::BColor(),
83 0.0,
79 basegfx::B2DLINEJOIN_ROUND);
84 basegfx::B2DLINEJOIN_ROUND,
85 com::sun::star::drawing::LineCap_BUTT);
80
81 // never delete; start with RefCount 1, not 0
82 pDefault->mnRefCount++;
83 }
84
85 return pDefault;
86 }
87 };
88
89 LineAttribute::LineAttribute(
90 const basegfx::BColor& rColor,
91 double fWidth,
86
87 // never delete; start with RefCount 1, not 0
88 pDefault->mnRefCount++;
89 }
90
91 return pDefault;
92 }
93 };
94
95 LineAttribute::LineAttribute(
96 const basegfx::BColor& rColor,
97 double fWidth,
92 basegfx::B2DLineJoin aB2DLineJoin)
93 : mpLineAttribute(new ImpLineAttribute(
94 rColor, fWidth, aB2DLineJoin))
98 basegfx::B2DLineJoin aB2DLineJoin,
99 com::sun::star::drawing::LineCap aLineCap)
100 : mpLineAttribute(
101 new ImpLineAttribute(
102 rColor,
103 fWidth,
104 aB2DLineJoin,
105 aLineCap))
95 {
96 }
97
98 LineAttribute::LineAttribute()
99 : mpLineAttribute(ImpLineAttribute::get_global_default())
100 {
101 mpLineAttribute->mnRefCount++;
102 }

--- 66 unchanged lines hidden (view full) ---

169 return mpLineAttribute->getWidth();
170 }
171
172 basegfx::B2DLineJoin LineAttribute::getLineJoin() const
173 {
174 return mpLineAttribute->getLineJoin();
175 }
176
106 {
107 }
108
109 LineAttribute::LineAttribute()
110 : mpLineAttribute(ImpLineAttribute::get_global_default())
111 {
112 mpLineAttribute->mnRefCount++;
113 }

--- 66 unchanged lines hidden (view full) ---

180 return mpLineAttribute->getWidth();
181 }
182
183 basegfx::B2DLineJoin LineAttribute::getLineJoin() const
184 {
185 return mpLineAttribute->getLineJoin();
186 }
187
188 com::sun::star::drawing::LineCap LineAttribute::getLineCap() const
189 {
190 return mpLineAttribute->getLineCap();
191 }
192
177 } // end of namespace attribute
178} // end of namespace drawinglayer
179
180//////////////////////////////////////////////////////////////////////////////
181// eof
193 } // end of namespace attribute
194} // end of namespace drawinglayer
195
196//////////////////////////////////////////////////////////////////////////////
197// eof