lineinfo.cxx (9f62ea84) lineinfo.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

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

42 mnRefCount ( 1 ),
43 meStyle ( LINE_SOLID ),
44 mnWidth ( 0 ),
45 mnDashCount ( 0 ),
46 mnDashLen ( 0 ),
47 mnDotCount ( 0 ),
48 mnDotLen ( 0 ),
49 mnDistance ( 0 ),
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

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

42 mnRefCount ( 1 ),
43 meStyle ( LINE_SOLID ),
44 mnWidth ( 0 ),
45 mnDashCount ( 0 ),
46 mnDashLen ( 0 ),
47 mnDotCount ( 0 ),
48 mnDotLen ( 0 ),
49 mnDistance ( 0 ),
50 meLineJoin ( basegfx::B2DLINEJOIN_ROUND )
50 meLineJoin ( basegfx::B2DLINEJOIN_ROUND ),
51 meLineCap ( com::sun::star::drawing::LineCap_BUTT )
51{
52}
53
54// -----------------------------------------------------------------------
55
56ImplLineInfo::ImplLineInfo( const ImplLineInfo& rImplLineInfo ) :
57 mnRefCount ( 1 ),
58 meStyle ( rImplLineInfo.meStyle ),
59 mnWidth ( rImplLineInfo.mnWidth ),
60 mnDashCount ( rImplLineInfo.mnDashCount ),
61 mnDashLen ( rImplLineInfo.mnDashLen ),
62 mnDotCount ( rImplLineInfo.mnDotCount ),
63 mnDotLen ( rImplLineInfo.mnDotLen ),
64 mnDistance ( rImplLineInfo.mnDistance ),
52{
53}
54
55// -----------------------------------------------------------------------
56
57ImplLineInfo::ImplLineInfo( const ImplLineInfo& rImplLineInfo ) :
58 mnRefCount ( 1 ),
59 meStyle ( rImplLineInfo.meStyle ),
60 mnWidth ( rImplLineInfo.mnWidth ),
61 mnDashCount ( rImplLineInfo.mnDashCount ),
62 mnDashLen ( rImplLineInfo.mnDashLen ),
63 mnDotCount ( rImplLineInfo.mnDotCount ),
64 mnDotLen ( rImplLineInfo.mnDotLen ),
65 mnDistance ( rImplLineInfo.mnDistance ),
65 meLineJoin ( rImplLineInfo.meLineJoin )
66 meLineJoin ( rImplLineInfo.meLineJoin ),
67 meLineCap ( rImplLineInfo.meLineCap )
66{
67}
68
69// -----------------------------------------------------------------------
70
71inline bool ImplLineInfo::operator==( const ImplLineInfo& rB ) const
72{
73 return(meStyle == rB.meStyle
74 && mnWidth == rB.mnWidth
75 && mnDashCount == rB.mnDashCount
76 && mnDashLen == rB.mnDashLen
77 && mnDotCount == rB.mnDotCount
78 && mnDotLen == rB.mnDotLen
79 && mnDistance == rB.mnDistance
68{
69}
70
71// -----------------------------------------------------------------------
72
73inline bool ImplLineInfo::operator==( const ImplLineInfo& rB ) const
74{
75 return(meStyle == rB.meStyle
76 && mnWidth == rB.mnWidth
77 && mnDashCount == rB.mnDashCount
78 && mnDashLen == rB.mnDashLen
79 && mnDotCount == rB.mnDotCount
80 && mnDotLen == rB.mnDotLen
81 && mnDistance == rB.mnDistance
80 && meLineJoin == rB.meLineJoin);
82 && meLineJoin == rB.meLineJoin
83 && meLineCap == rB.meLineCap);
81}
82
83// ------------
84// - LineInfo -
85// ------------
86
87LineInfo::LineInfo( LineStyle eStyle, long nWidth )
88{

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

224 {
225 ImplMakeUnique();
226 mpImplLineInfo->meLineJoin = eLineJoin;
227 }
228}
229
230// -----------------------------------------------------------------------
231
84}
85
86// ------------
87// - LineInfo -
88// ------------
89
90LineInfo::LineInfo( LineStyle eStyle, long nWidth )
91{

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

227 {
228 ImplMakeUnique();
229 mpImplLineInfo->meLineJoin = eLineJoin;
230 }
231}
232
233// -----------------------------------------------------------------------
234
235void LineInfo::SetLineCap(com::sun::star::drawing::LineCap eLineCap)
236{
237 DBG_CHKTHIS( LineInfo, NULL );
238
239 if(eLineCap != mpImplLineInfo->meLineCap)
240 {
241 ImplMakeUnique();
242 mpImplLineInfo->meLineCap = eLineCap;
243 }
244}
245
246// -----------------------------------------------------------------------
247
248sal_Bool LineInfo::IsDefault() const
249{
250 return( !mpImplLineInfo->mnWidth
251 && ( LINE_SOLID == mpImplLineInfo->meStyle )
252 && ( com::sun::star::drawing::LineCap_BUTT == mpImplLineInfo->meLineCap));
253}
254
255// -----------------------------------------------------------------------
256
232SvStream& operator>>( SvStream& rIStm, ImplLineInfo& rImplLineInfo )
233{
234 VersionCompat aCompat( rIStm, STREAM_READ );
235 sal_uInt16 nTmp16;
236
237 rIStm >> nTmp16; rImplLineInfo.meStyle = (LineStyle) nTmp16;
238 rIStm >> rImplLineInfo.mnWidth;
239

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

246 }
247
248 if( aCompat.GetVersion() >= 3 )
249 {
250 // version 3
251 rIStm >> nTmp16; rImplLineInfo.meLineJoin = (basegfx::B2DLineJoin) nTmp16;
252 }
253
257SvStream& operator>>( SvStream& rIStm, ImplLineInfo& rImplLineInfo )
258{
259 VersionCompat aCompat( rIStm, STREAM_READ );
260 sal_uInt16 nTmp16;
261
262 rIStm >> nTmp16; rImplLineInfo.meStyle = (LineStyle) nTmp16;
263 rIStm >> rImplLineInfo.mnWidth;
264

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

271 }
272
273 if( aCompat.GetVersion() >= 3 )
274 {
275 // version 3
276 rIStm >> nTmp16; rImplLineInfo.meLineJoin = (basegfx::B2DLineJoin) nTmp16;
277 }
278
279 if( aCompat.GetVersion() >= 4 )
280 {
281 // version 4
282 rIStm >> nTmp16; rImplLineInfo.meLineCap = (com::sun::star::drawing::LineCap) nTmp16;
283 }
284
254 return rIStm;
255}
256
257// -----------------------------------------------------------------------
258
259SvStream& operator<<( SvStream& rOStm, const ImplLineInfo& rImplLineInfo )
260{
285 return rIStm;
286}
287
288// -----------------------------------------------------------------------
289
290SvStream& operator<<( SvStream& rOStm, const ImplLineInfo& rImplLineInfo )
291{
261 VersionCompat aCompat( rOStm, STREAM_WRITE, 3 );
292 VersionCompat aCompat( rOStm, STREAM_WRITE, 4 );
262
263 // version 1
264 rOStm << (sal_uInt16) rImplLineInfo.meStyle << rImplLineInfo.mnWidth;
265
266 // since version2
267 rOStm << rImplLineInfo.mnDashCount << rImplLineInfo.mnDashLen;
268 rOStm << rImplLineInfo.mnDotCount << rImplLineInfo.mnDotLen;
269 rOStm << rImplLineInfo.mnDistance;
270
271 // since version3
272 rOStm << (sal_uInt16) rImplLineInfo.meLineJoin;
273
293
294 // version 1
295 rOStm << (sal_uInt16) rImplLineInfo.meStyle << rImplLineInfo.mnWidth;
296
297 // since version2
298 rOStm << rImplLineInfo.mnDashCount << rImplLineInfo.mnDashLen;
299 rOStm << rImplLineInfo.mnDotCount << rImplLineInfo.mnDotLen;
300 rOStm << rImplLineInfo.mnDistance;
301
302 // since version3
303 rOStm << (sal_uInt16) rImplLineInfo.meLineJoin;
304
305 // since version4
306 rOStm << (sal_uInt16) rImplLineInfo.meLineCap;
307
274 return rOStm;
275}
276
277// -----------------------------------------------------------------------
278
279SvStream& operator>>( SvStream& rIStm, LineInfo& rLineInfo )
280{
281 rLineInfo.ImplMakeUnique();

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

349 {
350 const double fHalfLineWidth((GetWidth() * 0.5) + 0.5);
351
352 for(sal_uInt32 a(0); a < io_rLinePolyPolygon.count(); a++)
353 {
354 o_rFillPolyPolygon.append(basegfx::tools::createAreaGeometry(
355 io_rLinePolyPolygon.getB2DPolygon(a),
356 fHalfLineWidth,
308 return rOStm;
309}
310
311// -----------------------------------------------------------------------
312
313SvStream& operator>>( SvStream& rIStm, LineInfo& rLineInfo )
314{
315 rLineInfo.ImplMakeUnique();

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

383 {
384 const double fHalfLineWidth((GetWidth() * 0.5) + 0.5);
385
386 for(sal_uInt32 a(0); a < io_rLinePolyPolygon.count(); a++)
387 {
388 o_rFillPolyPolygon.append(basegfx::tools::createAreaGeometry(
389 io_rLinePolyPolygon.getB2DPolygon(a),
390 fHalfLineWidth,
357 GetLineJoin()));
391 GetLineJoin(),
392 GetLineCap()));
358 }
359
360 io_rLinePolyPolygon.clear();
361 }
362 }
363}
364
365// -----------------------------------------------------------------------
393 }
394
395 io_rLinePolyPolygon.clear();
396 }
397 }
398}
399
400// -----------------------------------------------------------------------