sdrlineattribute.cxx (cdf0e10c) sdrlineattribute.cxx (5aaf853b)
1/*************************************************************************
2 *
3 * OpenOffice.org - a multi-platform office productivity suite
4 *
5 * $RCSfile: sdrattribute.cxx,v $
6 *
7 * $Revision: 1.5 $
8 *

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

51 // refcounter
52 sal_uInt32 mnRefCount;
53
54 // line definitions
55 basegfx::B2DLineJoin meJoin; // B2DLINEJOIN_* defines
56 double mfWidth; // 1/100th mm, 0.0==hair
57 double mfTransparence; // [0.0 .. 1.0], 0.0==no transp.
58 basegfx::BColor maColor; // color of line
1/*************************************************************************
2 *
3 * OpenOffice.org - a multi-platform office productivity suite
4 *
5 * $RCSfile: sdrattribute.cxx,v $
6 *
7 * $Revision: 1.5 $
8 *

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

51 // refcounter
52 sal_uInt32 mnRefCount;
53
54 // line definitions
55 basegfx::B2DLineJoin meJoin; // B2DLINEJOIN_* defines
56 double mfWidth; // 1/100th mm, 0.0==hair
57 double mfTransparence; // [0.0 .. 1.0], 0.0==no transp.
58 basegfx::BColor maColor; // color of line
59 com::sun::star::drawing::LineCap meCap; // BUTT, ROUND, or SQUARE
59 ::std::vector< double > maDotDashArray; // array of double which defines the dot-dash pattern
60 double mfFullDotDashLen; // sum of maDotDashArray (for convenience)
61
62 ImpSdrLineAttribute(
63 basegfx::B2DLineJoin eJoin,
64 double fWidth,
65 double fTransparence,
66 const basegfx::BColor& rColor,
60 ::std::vector< double > maDotDashArray; // array of double which defines the dot-dash pattern
61 double mfFullDotDashLen; // sum of maDotDashArray (for convenience)
62
63 ImpSdrLineAttribute(
64 basegfx::B2DLineJoin eJoin,
65 double fWidth,
66 double fTransparence,
67 const basegfx::BColor& rColor,
68 com::sun::star::drawing::LineCap eCap,
67 const ::std::vector< double >& rDotDashArray,
68 double fFullDotDashLen)
69 : mnRefCount(0),
70 meJoin(eJoin),
71 mfWidth(fWidth),
72 mfTransparence(fTransparence),
73 maColor(rColor),
69 const ::std::vector< double >& rDotDashArray,
70 double fFullDotDashLen)
71 : mnRefCount(0),
72 meJoin(eJoin),
73 mfWidth(fWidth),
74 mfTransparence(fTransparence),
75 maColor(rColor),
76 meCap(eCap),
74 maDotDashArray(rDotDashArray),
75 mfFullDotDashLen(fFullDotDashLen)
76 {
77 }
78
79 ImpSdrLineAttribute(const basegfx::BColor& rColor)
80 : mnRefCount(0),
81 meJoin(basegfx::B2DLINEJOIN_NONE),
82 mfWidth(0.0),
83 mfTransparence(0.0),
84 maColor(rColor),
77 maDotDashArray(rDotDashArray),
78 mfFullDotDashLen(fFullDotDashLen)
79 {
80 }
81
82 ImpSdrLineAttribute(const basegfx::BColor& rColor)
83 : mnRefCount(0),
84 meJoin(basegfx::B2DLINEJOIN_NONE),
85 mfWidth(0.0),
86 mfTransparence(0.0),
87 maColor(rColor),
88 meCap(com::sun::star::drawing::LineCap_BUTT),
85 maDotDashArray(),
86 mfFullDotDashLen(0.0)
87 {
88 }
89
90 // data read access
91 basegfx::B2DLineJoin getJoin() const { return meJoin; }
92 double getWidth() const { return mfWidth; }
93 double getTransparence() const { return mfTransparence; }
94 const basegfx::BColor& getColor() const { return maColor; }
89 maDotDashArray(),
90 mfFullDotDashLen(0.0)
91 {
92 }
93
94 // data read access
95 basegfx::B2DLineJoin getJoin() const { return meJoin; }
96 double getWidth() const { return mfWidth; }
97 double getTransparence() const { return mfTransparence; }
98 const basegfx::BColor& getColor() const { return maColor; }
99 com::sun::star::drawing::LineCap getCap() const { return meCap; }
95 const ::std::vector< double >& getDotDashArray() const { return maDotDashArray; }
96 double getFullDotDashLen() const { return mfFullDotDashLen; }
97
98 bool operator==(const ImpSdrLineAttribute& rCandidate) const
99 {
100 return (getJoin() == rCandidate.getJoin()
101 && getWidth() == rCandidate.getWidth()
102 && getTransparence() == rCandidate.getTransparence()
103 && getColor() == rCandidate.getColor()
100 const ::std::vector< double >& getDotDashArray() const { return maDotDashArray; }
101 double getFullDotDashLen() const { return mfFullDotDashLen; }
102
103 bool operator==(const ImpSdrLineAttribute& rCandidate) const
104 {
105 return (getJoin() == rCandidate.getJoin()
106 && getWidth() == rCandidate.getWidth()
107 && getTransparence() == rCandidate.getTransparence()
108 && getColor() == rCandidate.getColor()
109 && getCap() == rCandidate.getCap()
104 && getDotDashArray() == rCandidate.getDotDashArray());
105 }
106
107 static ImpSdrLineAttribute* get_global_default()
108 {
109 static ImpSdrLineAttribute* pDefault = 0;
110
111 if(!pDefault)
112 {
113 pDefault = new ImpSdrLineAttribute(
114 basegfx::B2DLINEJOIN_ROUND,
115 0.0,
116 0.0,
117 basegfx::BColor(),
110 && getDotDashArray() == rCandidate.getDotDashArray());
111 }
112
113 static ImpSdrLineAttribute* get_global_default()
114 {
115 static ImpSdrLineAttribute* pDefault = 0;
116
117 if(!pDefault)
118 {
119 pDefault = new ImpSdrLineAttribute(
120 basegfx::B2DLINEJOIN_ROUND,
121 0.0,
122 0.0,
123 basegfx::BColor(),
124 com::sun::star::drawing::LineCap_BUTT,
118 std::vector< double >(),
119 0.0);
120
121 // never delete; start with RefCount 1, not 0
122 pDefault->mnRefCount++;
123 }
124
125 return pDefault;
126 }
127 };
128
129 SdrLineAttribute::SdrLineAttribute(
130 basegfx::B2DLineJoin eJoin,
131 double fWidth,
132 double fTransparence,
133 const basegfx::BColor& rColor,
125 std::vector< double >(),
126 0.0);
127
128 // never delete; start with RefCount 1, not 0
129 pDefault->mnRefCount++;
130 }
131
132 return pDefault;
133 }
134 };
135
136 SdrLineAttribute::SdrLineAttribute(
137 basegfx::B2DLineJoin eJoin,
138 double fWidth,
139 double fTransparence,
140 const basegfx::BColor& rColor,
141 com::sun::star::drawing::LineCap eCap,
134 const ::std::vector< double >& rDotDashArray,
135 double fFullDotDashLen)
142 const ::std::vector< double >& rDotDashArray,
143 double fFullDotDashLen)
136 : mpSdrLineAttribute(new ImpSdrLineAttribute(
137 eJoin, fWidth, fTransparence, rColor, rDotDashArray, fFullDotDashLen))
144 : mpSdrLineAttribute(
145 new ImpSdrLineAttribute(
146 eJoin,
147 fWidth,
148 fTransparence,
149 rColor,
150 eCap,
151 rDotDashArray,
152 fFullDotDashLen))
138 {
139 }
140
141 SdrLineAttribute::SdrLineAttribute(
142 const basegfx::BColor& rColor)
153 {
154 }
155
156 SdrLineAttribute::SdrLineAttribute(
157 const basegfx::BColor& rColor)
143 : mpSdrLineAttribute(new ImpSdrLineAttribute(rColor))
158 : mpSdrLineAttribute(
159 new ImpSdrLineAttribute(
160 rColor))
144 {
145 }
146
147 SdrLineAttribute::SdrLineAttribute()
148 : mpSdrLineAttribute(ImpSdrLineAttribute::get_global_default())
149 {
150 mpSdrLineAttribute->mnRefCount++;
151 }

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

238 return mpSdrLineAttribute->getFullDotDashLen();
239 }
240
241 bool SdrLineAttribute::isDashed() const
242 {
243 return (0L != getDotDashArray().size());
244 }
245
161 {
162 }
163
164 SdrLineAttribute::SdrLineAttribute()
165 : mpSdrLineAttribute(ImpSdrLineAttribute::get_global_default())
166 {
167 mpSdrLineAttribute->mnRefCount++;
168 }

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

255 return mpSdrLineAttribute->getFullDotDashLen();
256 }
257
258 bool SdrLineAttribute::isDashed() const
259 {
260 return (0L != getDotDashArray().size());
261 }
262
263 com::sun::star::drawing::LineCap SdrLineAttribute::getCap() const
264 {
265 return mpSdrLineAttribute->getCap();
266 }
267
246 } // end of namespace attribute
247} // end of namespace drawinglayer
248
249//////////////////////////////////////////////////////////////////////////////
250// eof
268 } // end of namespace attribute
269} // end of namespace drawinglayer
270
271//////////////////////////////////////////////////////////////////////////////
272// eof