1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: class4.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_goodies.hxx"
39 using namespace ::com::sun::star
;
41 double CGM::ImplGetOrientation( FloatPoint
& rCenter
, FloatPoint
& rPoint
)
45 double nX
= rPoint
.X
- rCenter
.X
;
46 double nY
= rPoint
.Y
- rCenter
.Y
;
48 fOrientation
= acos( nX
/ sqrt( nX
* nX
+ nY
* nY
) ) * 57.29577951308;
50 fOrientation
= 360 - fOrientation
;
55 // ---------------------------------------------------------------
57 void CGM::ImplSwitchStartEndAngle( double& rStartAngle
, double& rEndAngle
)
61 rStartAngle
= rEndAngle
;
65 // ---------------------------------------------------------------
67 void CGM::ImplGetVector( double* pVector
)
69 if ( pElement
->eVDCType
== VDC_REAL
)
71 for ( sal_uInt32 i
= 0; i
< 4; i
++ )
73 pVector
[ i
] = (double)ImplGetFloat( pElement
->eVDCRealPrecision
, pElement
->nVDCRealSize
);
78 for ( sal_uInt32 i
= 0; i
< 4; i
++ )
80 pVector
[ i
] = (double)ImplGetI( pElement
->nVDCIntegerPrecision
);
83 pVector
[ 0 ] *= mnVDCXmul
;
84 pVector
[ 2 ] *= mnVDCXmul
;
85 pVector
[ 1 ] *= mnVDCYmul
;
86 pVector
[ 3 ] *= mnVDCYmul
;
89 // ---------------------------------------------------------------
90 sal_Bool
CGM::ImplGetEllipse( FloatPoint
& rCenter
, FloatPoint
& rRadius
, double& rAngle
)
92 FloatPoint aPoint1
, aPoint2
;
94 ImplGetPoint( rCenter
, sal_True
);
95 ImplGetPoint( aPoint1
, sal_True
);
96 ImplGetPoint( aPoint2
, sal_True
);
97 fRot1
= ImplGetOrientation( rCenter
, aPoint1
);
98 fRot2
= ImplGetOrientation( rCenter
, aPoint2
);
99 rAngle
= ImplGetOrientation( rCenter
, aPoint1
);
100 aPoint1
.X
-= rCenter
.X
;
101 aPoint1
.Y
-= rCenter
.Y
;
102 rRadius
.X
= sqrt( aPoint1
.X
* aPoint1
.X
+ aPoint1
.Y
* aPoint1
.Y
);
103 aPoint2
.X
-= rCenter
.X
;
104 aPoint2
.Y
-= rCenter
.Y
;
105 rRadius
.Y
= sqrt( aPoint2
.X
* aPoint2
.X
+ aPoint2
.Y
* aPoint2
.Y
);
109 if ( ( fRot1
- fRot2
) < 180 )
114 if ( ( fRot2
- fRot1
) > 180 )
120 void CGM::ImplDoClass4()
123 mpOutAct
->FirstOutPut();
125 if ( mpBitmapInUse
&& ( mnElementID
!= 9 ) ) // vorhandene grafik verarbeiten,
126 { // da jetzt nicht bitmap actions anstehen
127 CGMBitmapDescriptor
* pBmpDesc
= mpBitmapInUse
->GetBitmap();
128 // irgendetwas mit der Bitmap anfangen
129 mpOutAct
->DrawBitmap( pBmpDesc
);
130 delete mpBitmapInUse
;
131 mpBitmapInUse
= NULL
;
134 if ( ( mpChart
== NULL
) || mpChart
->IsAnnotation() )
136 switch ( mnElementID
)
138 case 0x01 : ComOut( CGM_LEVEL1
, "PolyLine" )
140 sal_uInt32 nPoints
= mnElementSize
/ ImplGetPointSize();
141 Polygon
aPolygon( (sal_uInt16
)nPoints
);
142 for ( sal_uInt16 i
= 0; i
< nPoints
; i
++)
144 FloatPoint aFloatPoint
;
145 ImplGetPoint( aFloatPoint
, sal_True
);
146 aPolygon
.SetPoint( Point( (long)aFloatPoint
.X
, (long)aFloatPoint
.Y
), i
);
149 mpOutAct
->RegPolyLine( aPolygon
);
151 mpOutAct
->DrawPolyLine( aPolygon
);
155 case 0x02 : ComOut( CGM_LEVEL1
| CGM_EXTENDED_PRIMITIVES_SET
, "Disjoint PolyLine" )
157 USHORT nPoints
= sal::static_int_cast
< USHORT
>(
158 mnElementSize
/ ImplGetPointSize());
159 if ( ! ( nPoints
& 1 ) )
162 FloatPoint aFloatPoint
;
165 Polygon
aPolygon( nPoints
);
166 for ( sal_uInt16 i
= 0; i
< nPoints
; i
++ )
168 ImplGetPoint( aFloatPoint
, sal_True
);
169 aPolygon
.SetPoint( Point( (long)aFloatPoint
.X
, (long)aFloatPoint
.Y
), 0 );
171 mpOutAct
->RegPolyLine( aPolygon
);
175 mpOutAct
->BeginGroup();
176 Polygon
aPolygon( (sal_uInt16
)2 );
177 for ( sal_uInt16 i
= 0; i
< nPoints
; i
++ )
179 ImplGetPoint( aFloatPoint
, sal_True
);
180 aPolygon
.SetPoint( Point( (long)aFloatPoint
.X
, (long)aFloatPoint
.Y
), 0 );
181 ImplGetPoint( aFloatPoint
, sal_True
);
182 aPolygon
.SetPoint( Point( (long)aFloatPoint
.X
, (long)aFloatPoint
.Y
), 1);
183 mpOutAct
->DrawPolyLine( aPolygon
);
185 mpOutAct
->EndGroup();
191 case 0x03 : ComOut( CGM_LEVEL1
, "PolyMarker" ) break;
192 case 0x04 : ComOut( CGM_LEVEL1
, "Text" )
194 FloatPoint aFloatPoint
;
195 sal_uInt32 nType
, nSize
;
198 mpOutAct
->CloseRegion();
200 ImplGetPoint ( aFloatPoint
, sal_True
);
201 nType
= ImplGetUI16( 4 );
202 nSize
= ImplGetUI( 1 );
203 mpSource
[ mnParaSize
+ nSize
] = 0;
205 ComOut( CGM_DESCRIPTION
, (char*)mpSource
+ mnParaSize
);
208 awt::Point
aPoint( (long)aFloatPoint
.X
, (long)aFloatPoint
.Y
);
209 mpOutAct
->DrawText( aPoint
, aSize
,
210 (char*)mpSource
+ mnParaSize
, nSize
, (FinalFlag
)nType
);
211 // mnParaSize += nSize;
212 mnParaSize
= mnElementSize
;
216 case 0x05 : ComOut( CGM_LEVEL1
| CGM_EXTENDED_PRIMITIVES_SET
, "Restricted Text" )
219 FloatPoint aFloatPoint
;
220 sal_uInt32 nType
, nSize
;
223 mpOutAct
->CloseRegion();
225 if ( pElement
->eVDCType
== VDC_REAL
)
227 dx
= ImplGetFloat( pElement
->eVDCRealPrecision
, pElement
->nVDCRealSize
);
228 dy
= ImplGetFloat( pElement
->eVDCRealPrecision
, pElement
->nVDCRealSize
);
232 dx
= (double)ImplGetI( pElement
->nVDCIntegerPrecision
);
233 dy
= (double)ImplGetI( pElement
->nVDCIntegerPrecision
);
238 ImplGetPoint ( aFloatPoint
, sal_True
);
239 nType
= ImplGetUI16( 4 );
240 nSize
= ImplGetUI( 1 );
242 mpSource
[ mnParaSize
+ nSize
] = 0;
244 ComOut( CGM_DESCRIPTION
, (char*)mpSource
+ mnParaSize
);
246 awt::Point
aPoint( (long)aFloatPoint
.X
, (long)aFloatPoint
.Y
);
247 awt::Size
aSize((long)dx
, (long)dy
);
248 mpOutAct
->DrawText( aPoint
, aSize
,
249 (char*)mpSource
+ mnParaSize
, nSize
, (FinalFlag
)nType
);
250 // mnParaSize += nSize;
251 mnParaSize
= mnElementSize
;
255 case 0x06 : ComOut( CGM_LEVEL1
| CGM_EXTENDED_PRIMITIVES_SET
, "Append Text" )
258 sal_uInt32 nType
= ImplGetUI16( 4 );
260 nSize
= ImplGetUI( 1 );
261 mpSource
[ mnParaSize
+ nSize
] = 0;
263 ComOut( CGM_DESCRIPTION
, (char*)mpSource
+ mnParaSize
);
265 mpOutAct
->AppendText( (char*)mpSource
+ mnParaSize
, nSize
, (FinalFlag
)nType
);
266 // mnParaSize += nSize;
267 mnParaSize
= mnElementSize
;
271 case 0x07 : ComOut( CGM_LEVEL1
, "Polygon" )
274 mpOutAct
->CloseRegion();
276 USHORT nPoints
= sal::static_int_cast
< USHORT
>(
277 mnElementSize
/ ImplGetPointSize());
278 Polygon
aPolygon( nPoints
);
279 for ( USHORT i
= 0; i
< nPoints
; i
++)
281 FloatPoint aFloatPoint
;
282 ImplGetPoint( aFloatPoint
, sal_True
);
283 aPolygon
.SetPoint( Point ( (long)( aFloatPoint
.X
), (long)( aFloatPoint
.Y
) ), i
);
285 mpOutAct
->DrawPolygon( aPolygon
);
289 case 0x08 : ComOut( CGM_LEVEL1
| CGM_EXTENDED_PRIMITIVES_SET
, "Polygon Set" )
292 mpOutAct
->CloseRegion();
295 Point
* pPoints
= new Point
[ 0x4000 ];
297 PolyPolygon aPolyPolygon
;
298 FloatPoint aFloatPoint
;
299 sal_uInt32 nEdgeFlag
;
300 while ( mnParaSize
< mnElementSize
)
302 ImplGetPoint( aFloatPoint
, sal_True
);
303 nEdgeFlag
= ImplGetUI16();
304 pPoints
[ nPoints
++ ] = Point( (long)aFloatPoint
.X
, (long)aFloatPoint
.Y
);
305 if ( ( nEdgeFlag
& 2 ) || ( mnParaSize
== mnElementSize
) )
307 Polygon
aPolygon( nPoints
);
308 for ( USHORT i
= 0; i
< nPoints
; i
++ )
310 aPolygon
.SetPoint( pPoints
[ i
], i
);
312 aPolyPolygon
.Insert( aPolygon
, POLYPOLY_APPEND
);
317 mpOutAct
->DrawPolyPolygon( aPolyPolygon
);
321 case 0x09 : ComOut( CGM_LEVEL1
, "Cell Array" )
324 mpOutAct
->CloseRegion();
328 CGMBitmap
* pBmpDesc
= mpBitmapInUse
->GetNext();
329 if ( pBmpDesc
) // eventuell bekommen wir eine bitmap zurück, die nicht
330 { // zur vorherigen paßt -> diese müssen wir dann auch löschen
331 mpOutAct
->DrawBitmap( pBmpDesc
->GetBitmap() );
337 mpBitmapInUse
= new CGMBitmap( *this );
342 case 0x0a : ComOut( CGM_LEVEL1
, "Generalized Drawing Primitive" )
344 ImplGetI( pElement
->nIntegerPrecision
); //-Wall is this needed
345 ImplGetUI( pElement
->nIntegerPrecision
); //-Wall is this needed
346 mnParaSize
= mnElementSize
;
350 case 0x0b : ComOut( CGM_LEVEL1
| CGM_EXTENDED_PRIMITIVES_SET
, "Rectangle" )
353 mpOutAct
->CloseRegion();
355 FloatRect aFloatRect
;
356 ImplGetRectangle( aFloatRect
, sal_True
);
357 mpOutAct
->DrawRectangle( aFloatRect
);
361 case 0x0c : ComOut( CGM_LEVEL1
| CGM_EXTENDED_PRIMITIVES_SET
, "Circle" )
364 mpOutAct
->CloseRegion();
366 double fRotation
= 0;
367 FloatPoint aCenter
, aRadius
;
368 ImplGetPoint( aCenter
, sal_True
);
369 if ( pElement
->eVDCType
== VDC_REAL
)
370 aRadius
.X
= ImplGetFloat( pElement
->eVDCRealPrecision
, pElement
->nVDCRealSize
);
372 aRadius
.X
= (double)ImplGetI( pElement
->nVDCIntegerPrecision
);
373 ImplMapDouble( aRadius
.X
);
374 aRadius
.Y
= aRadius
.X
;
375 mpOutAct
->DrawEllipse( aCenter
, aRadius
, fRotation
);
379 case 0x0d : ComOut( CGM_LEVEL1
| CGM_EXTENDED_PRIMITIVES_SET
, "Circular Arc 3 Point" )
383 FloatPoint aStartingPoint
, aIntermediatePoint
, aEndingPoint
, aCenterPoint
;
384 ImplGetPoint( aStartingPoint
, sal_True
);
385 ImplGetPoint( aIntermediatePoint
, sal_True
);
386 ImplGetPoint( aEndingPoint
, sal_True
);
388 double fA
= aIntermediatePoint
.X
- aStartingPoint
.X
;
389 double fB
= aIntermediatePoint
.Y
- aStartingPoint
.Y
;
390 double fC
= aEndingPoint
.X
- aStartingPoint
.X
;
391 double fD
= aEndingPoint
.Y
- aStartingPoint
.Y
;
393 double fE
= fA
* ( aStartingPoint
.X
+ aIntermediatePoint
.X
) + fB
* ( aStartingPoint
.Y
+ aIntermediatePoint
.Y
);
394 double fF
= fC
* ( aStartingPoint
.X
+ aEndingPoint
.X
) + fD
* ( aStartingPoint
.Y
+ aEndingPoint
.Y
);
396 double fG
= 2.0 * ( fA
* ( aEndingPoint
.Y
- aIntermediatePoint
.Y
) - fB
* ( aEndingPoint
.X
- aIntermediatePoint
.X
) );
398 aCenterPoint
.X
= ( fD
* fE
- fB
* fF
) / fG
;
399 aCenterPoint
.Y
= ( fA
* fF
- fC
* fE
) / fG
;
403 double fStartAngle
= ImplGetOrientation( aCenterPoint
, aStartingPoint
);
404 double fInterAngle
= ImplGetOrientation( aCenterPoint
, aIntermediatePoint
);
405 double fEndAngle
= ImplGetOrientation( aCenterPoint
, aEndingPoint
);
407 if ( fStartAngle
> fEndAngle
)
410 aIntermediatePoint
= aEndingPoint
;
411 aEndingPoint
= aStartingPoint
;
412 aStartingPoint
= aIntermediatePoint
;
414 fStartAngle
= fEndAngle
;
417 if ( ! ( fInterAngle
> fStartAngle
) && ( fInterAngle
< fEndAngle
) )
420 aIntermediatePoint
= aEndingPoint
;
421 aEndingPoint
= aStartingPoint
;
422 aStartingPoint
= aIntermediatePoint
;
424 fStartAngle
= fEndAngle
;
427 double fRadius
= sqrt( pow( ( aStartingPoint
.X
- aCenterPoint
.X
), 2 ) + pow( ( aStartingPoint
.Y
- aCenterPoint
.Y
), 2 ) ) ;
431 Rectangle
aBoundingBox( Point( (long)( aCenterPoint
.X
- fRadius
), long( aCenterPoint
.Y
- fRadius
) ),
432 Size( ( static_cast< long >( 2 * fRadius
) ), (long)( 2 * fRadius
) ) );
433 Polygon
aPolygon( aBoundingBox
, Point( (long)aStartingPoint
.X
, (long)aStartingPoint
.Y
) ,Point( (long)aEndingPoint
.X
, (long)aEndingPoint
.Y
), POLY_ARC
);
435 mpOutAct
->RegPolyLine( aPolygon
, sal_True
);
437 mpOutAct
->RegPolyLine( aPolygon
);
443 aRadius
.X
= aRadius
.Y
= fRadius
;
444 mpOutAct
->DrawEllipticalArc( aCenterPoint
, aRadius
, fG
, 2, fStartAngle
, fEndAngle
);
450 case 0x0e : ComOut( CGM_LEVEL1
| CGM_EXTENDED_PRIMITIVES_SET
, "Circular Arc 3 Point Close" )
455 mpOutAct
->CloseRegion();
457 FloatPoint aStartingPoint
, aIntermediatePoint
, aEndingPoint
, aCenterPoint
;
458 ImplGetPoint( aStartingPoint
);
459 ImplGetPoint( aIntermediatePoint
);
460 ImplGetPoint( aEndingPoint
);
462 double fA
= aIntermediatePoint
.X
- aStartingPoint
.X
;
463 double fB
= aIntermediatePoint
.Y
- aStartingPoint
.Y
;
464 double fC
= aEndingPoint
.X
- aStartingPoint
.X
;
465 double fD
= aEndingPoint
.Y
- aStartingPoint
.Y
;
467 double fE
= fA
* ( aStartingPoint
.X
+ aIntermediatePoint
.X
) + fB
* ( aStartingPoint
.Y
+ aIntermediatePoint
.Y
);
468 double fF
= fC
* ( aStartingPoint
.X
+ aEndingPoint
.X
) + fD
* ( aStartingPoint
.Y
+ aEndingPoint
.Y
);
470 double fG
= 2.0 * ( fA
* ( aEndingPoint
.Y
- aIntermediatePoint
.Y
) - fB
* ( aEndingPoint
.X
- aIntermediatePoint
.X
) );
472 aCenterPoint
.X
= ( fD
* fE
- fB
* fF
) / fG
;
473 aCenterPoint
.Y
= ( fA
* fF
- fC
* fE
) / fG
;
477 double fStartAngle
= ImplGetOrientation( aCenterPoint
, aStartingPoint
);
478 double fInterAngle
= ImplGetOrientation( aCenterPoint
, aIntermediatePoint
);
479 double fEndAngle
= ImplGetOrientation( aCenterPoint
, aEndingPoint
);
481 if ( fStartAngle
> fEndAngle
)
484 aIntermediatePoint
= aEndingPoint
;
485 aEndingPoint
= aStartingPoint
;
486 aStartingPoint
= aIntermediatePoint
;
488 fStartAngle
= fEndAngle
;
491 if ( ! ( fInterAngle
> fStartAngle
) && ( fInterAngle
< fEndAngle
) )
494 aIntermediatePoint
= aEndingPoint
;
495 aEndingPoint
= aStartingPoint
;
496 aStartingPoint
= aIntermediatePoint
;
498 fStartAngle
= fEndAngle
;
502 fRadius
.Y
= fRadius
.X
= sqrt( pow( ( aStartingPoint
.X
- aCenterPoint
.X
), 2 ) + pow( ( aStartingPoint
.Y
- aCenterPoint
.Y
), 2 ) ) ;
504 sal_uInt32 nType
= ImplGetUI16();
508 nType
= 1; // is CHORD
510 double fOrientation
= 0;
511 mpOutAct
->DrawEllipticalArc( aCenterPoint
, fRadius
, fOrientation
, nType
, fStartAngle
, fEndAngle
);
516 case 0x0f : ComOut( CGM_LEVEL1
| CGM_EXTENDED_PRIMITIVES_SET
, "Circular Arc Centre" )
518 double fOrientation
, fStartAngle
, fEndAngle
, vector
[ 4 ];
519 FloatPoint aCenter
, aRadius
;
522 mpOutAct
->CloseRegion();
524 ImplGetPoint( aCenter
, sal_True
);
525 ImplGetVector( &vector
[ 0 ] );
527 if ( pElement
->eVDCType
== VDC_REAL
)
529 aRadius
.X
= (double)ImplGetFloat( pElement
->eVDCRealPrecision
, pElement
->nVDCRealSize
);
533 aRadius
.X
= (double)ImplGetI( pElement
->nVDCIntegerPrecision
);
536 ImplMapDouble( aRadius
.X
);
537 aRadius
.Y
= aRadius
.X
;
539 fStartAngle
= acos( vector
[ 0 ] / sqrt( vector
[ 0 ] * vector
[ 0 ] + vector
[ 1 ] * vector
[ 1 ] ) ) * 57.29577951308;
540 fEndAngle
= acos( vector
[ 2 ] / sqrt( vector
[ 2 ] * vector
[ 2 ] + vector
[ 3 ] * vector
[ 3 ] ) ) * 57.29577951308;
542 if ( vector
[ 1 ] > 0 )
543 fStartAngle
= 360 - fStartAngle
;
544 if ( vector
[ 3 ] > 0 )
545 fEndAngle
= 360 - fEndAngle
;
548 ImplSwitchStartEndAngle( fStartAngle
, fEndAngle
);
552 Rectangle
aBoundingBox(
553 Point( (long)( aCenter
.X
- aRadius
.X
), long( aCenter
.Y
- aRadius
.X
) ),
554 Size( static_cast< long >( 2 * aRadius
.X
), (long)( 2 * aRadius
.X
) ) );
555 Polygon
aPolygon( aBoundingBox
,
556 Point( (long)vector
[ 0 ], (long)vector
[ 1 ] ),
557 Point( (long)vector
[ 2 ], (long)vector
[ 3 ] ), POLY_ARC
);
558 mpOutAct
->RegPolyLine( aPolygon
);
563 mpOutAct
->DrawEllipticalArc( aCenter
, aRadius
, fOrientation
, 2, fStartAngle
, fEndAngle
);
565 mnParaSize
= mnElementSize
;
570 case 0x10 : ComOut( CGM_LEVEL1
| CGM_EXTENDED_PRIMITIVES_SET
, "Circular Arc Centre Close" )
572 double fOrientation
, fStartAngle
, fEndAngle
, vector
[ 4 ];
573 FloatPoint aCenter
, aRadius
;
576 mpOutAct
->CloseRegion();
578 ImplGetPoint( aCenter
, sal_True
);
579 ImplGetVector( &vector
[ 0 ] );
580 if ( pElement
->eVDCType
== VDC_REAL
)
582 aRadius
.X
= (double)ImplGetFloat( pElement
->eVDCRealPrecision
, pElement
->nVDCRealSize
);
586 aRadius
.X
= (double)ImplGetI( pElement
->nVDCIntegerPrecision
);
588 ImplMapDouble( aRadius
.X
);
589 aRadius
.Y
= aRadius
.X
;
590 fStartAngle
= acos( vector
[ 0 ] / sqrt( vector
[ 0 ] * vector
[ 0 ] + vector
[ 1 ] * vector
[ 1 ] ) ) * 57.29577951308;
591 fEndAngle
= acos( vector
[ 2 ] / sqrt( vector
[ 2 ] * vector
[ 2 ] + vector
[ 3 ] * vector
[ 3 ] ) ) * 57.29577951308;
593 if ( vector
[ 1 ] > 0 )
594 fStartAngle
= 360 - fStartAngle
;
595 if ( vector
[ 3 ] > 0 )
596 fEndAngle
= 360 - fEndAngle
;
599 ImplSwitchStartEndAngle( fStartAngle
, fEndAngle
);
602 sal_uInt32 nType
= ImplGetUI16();
606 nType
= 1; // is CHORD
609 mpOutAct
->DrawEllipticalArc( aCenter
, aRadius
, fOrientation
,
610 nType
, fStartAngle
, fEndAngle
);
611 mnParaSize
= mnElementSize
;
615 case 0x11 : ComOut( CGM_LEVEL1
| CGM_EXTENDED_PRIMITIVES_SET
, "Ellipse" )
618 FloatPoint aCenter
, aRadius
;
621 mpOutAct
->CloseRegion();
623 ImplGetEllipse( aCenter
, aRadius
, fOrientation
) ;
624 mpOutAct
->DrawEllipse( aCenter
, aRadius
, fOrientation
) ;
628 case 0x12 : ComOut( CGM_LEVEL1
| CGM_EXTENDED_PRIMITIVES_SET
, "Elliptical Arc" )
631 mpOutAct
->CloseRegion();
633 double fOrientation
, fStartAngle
, fEndAngle
, vector
[ 4 ];
634 FloatPoint aCenter
, aRadius
;
637 mpOutAct
->CloseRegion();
639 sal_Bool bDirection
= ImplGetEllipse( aCenter
, aRadius
, fOrientation
);
640 ImplGetVector( &vector
[ 0 ] );
642 fStartAngle
= acos( vector
[ 0 ] / sqrt( vector
[ 0 ] * vector
[ 0 ] + vector
[ 1 ] * vector
[ 1 ] ) ) * 57.29577951308;
643 fEndAngle
= acos( vector
[ 2 ] / sqrt( vector
[ 2 ] * vector
[ 2 ] + vector
[ 3 ] * vector
[ 3 ] ) ) * 57.29577951308;
645 if ( vector
[ 1 ] > 0 )
646 fStartAngle
= 360 - fStartAngle
;
647 if ( vector
[ 3 ] > 0 )
648 fEndAngle
= 360 - fEndAngle
;
651 mpOutAct
->DrawEllipticalArc( aCenter
, aRadius
, fOrientation
,
652 2, fStartAngle
, fEndAngle
);
654 mpOutAct
->DrawEllipticalArc( aCenter
, aRadius
, fOrientation
,
655 2, fEndAngle
, fStartAngle
);
659 case 0x13 : ComOut( CGM_LEVEL1
| CGM_EXTENDED_PRIMITIVES_SET
, "Elliptical Arc Close" )
661 double fOrientation
, fStartAngle
, fEndAngle
, vector
[ 4 ];
662 FloatPoint aCenter
, aRadius
;
665 mpOutAct
->CloseRegion();
667 sal_Bool bDirection
= ImplGetEllipse( aCenter
, aRadius
, fOrientation
);
668 ImplGetVector( &vector
[ 0 ] );
670 fStartAngle
= acos( vector
[ 0 ] / sqrt( vector
[ 0 ] * vector
[ 0 ] + vector
[ 1 ] * vector
[ 1 ] ) ) * 57.29577951308;
671 fEndAngle
= acos( vector
[ 2 ] / sqrt( vector
[ 2 ] * vector
[ 2 ] + vector
[ 3 ] * vector
[ 3 ] ) ) * 57.29577951308;
673 if ( vector
[ 1 ] > 0 )
674 fStartAngle
= 360 - fStartAngle
;
675 if ( vector
[ 3 ] > 0 )
676 fEndAngle
= 360 - fEndAngle
;
678 sal_uInt32 nType
= ImplGetUI16();
682 nType
= 1; // is CHORD
685 mpOutAct
->DrawEllipticalArc( aCenter
, aRadius
, fOrientation
,
686 nType
, fStartAngle
, fEndAngle
);
688 mpOutAct
->DrawEllipticalArc( aCenter
, aRadius
, fOrientation
,
689 nType
, fEndAngle
, fStartAngle
);
692 case 0x14 : ComOut( CGM_LEVEL2
, "Circular Arc Centre Reversed" )
695 mpOutAct
->CloseRegion();
698 case 0x15 : ComOut( CGM_LEVEL2
, "Connection Edge" ) // NS
701 // mpOutAct->CloseRegion();
704 case 0x16 : ComOut( CGM_LEVEL3
, "Hyperbolic Arc" ) // NS
707 mpOutAct
->CloseRegion();
710 case 0x17 : ComOut( CGM_LEVEL3
, "Parabolic Arc" ) // NS
713 mpOutAct
->CloseRegion();
716 case 0x18 : ComOut( CGM_LEVEL3
, "Non Uniform B-Spline" ) // NS
719 mpOutAct
->CloseRegion();
722 case 0x19 : ComOut( CGM_LEVEL3
, "Non Uniform Rational B-Spline" ) // NS
725 mpOutAct
->CloseRegion();
728 case 0x1a : ComOut( CGM_LEVEL3
, "Polybezier" )
730 sal_uInt32 nOrder
= ImplGetI( pElement
->nIntegerPrecision
);
732 USHORT nNumberOfPoints
= sal::static_int_cast
< USHORT
>(( mnElementSize
- pElement
->nIntegerPrecision
) / ImplGetPointSize());
734 Polygon
aPolygon( nNumberOfPoints
);
736 for ( USHORT i
= 0; i
< nNumberOfPoints
; i
++)
738 FloatPoint aFloatPoint
;
739 ImplGetPoint( aFloatPoint
, sal_True
);
740 aPolygon
.SetPoint( Point ( (long)( aFloatPoint
.X
), (long)( aFloatPoint
.Y
) ), i
);
744 for ( USHORT i
= 0; i
< nNumberOfPoints
; i
++ )
746 if ( ( i
% 3 ) == 0 )
747 aPolygon
.SetFlags( i
, POLY_NORMAL
);
749 aPolygon
.SetFlags( i
, POLY_CONTROL
);
754 for ( USHORT i
= 0; i
< nNumberOfPoints
; i
++ )
759 case 3 : aPolygon
.SetFlags( i
, POLY_NORMAL
); break;
760 default : aPolygon
.SetFlags( i
, POLY_CONTROL
); break;
765 mpOutAct
->RegPolyLine( aPolygon
);
767 mpOutAct
->DrawPolybezier( aPolygon
);
768 mnParaSize
= mnElementSize
;
772 case 0x1b : ComOut( CGM_LEVEL3
, "Polysymbol" ) // NS
775 mpOutAct
->CloseRegion();
778 case 0x1c : ComOut( CGM_LEVEL3
, "Bitonal Tile" ) // NS
781 mpOutAct
->CloseRegion();
784 case 0x1d : ComOut( CGM_LEVEL3
, "Tile" ) // NS
787 mpOutAct
->CloseRegion();
790 case 0x1e : ComOut( CGM_UNKNOWN_LEVEL
, "Insert Object" )
793 mpOutAct
->CloseRegion();
796 case 0xff : ComOut( CGM_GDSF_ONLY
, "Polybezier" )
799 mpOutAct
->CloseRegion();
802 case 0xfe : ComOut( CGM_GDSF_ONLY
, "Sharp Polybezier" )
805 mpOutAct
->CloseRegion();
808 case 0xfd : ComOut( CGM_GDSF_ONLY
, "Polyspline" )
811 mpOutAct
->CloseRegion();
814 case 0xfc : ComOut( CGM_GDSF_ONLY
, "Reounded Rectangle" )
817 mpOutAct
->CloseRegion();
820 case 0xfb : ComOut( CGM_GDSF_ONLY
, "Begin Cell Array" )
823 mpOutAct
->CloseRegion();
826 case 0xfa : ComOut( CGM_GDSF_ONLY
, "End Cell Array" )
829 mpOutAct
->CloseRegion();
832 case 0xf9 : ComOut( CGM_GDSF_ONLY
, "Insert File" )
835 mpOutAct
->CloseRegion();
838 case 0xf8 : ComOut( CGM_GDSF_ONLY
, "Block Text" )
841 mpOutAct
->CloseRegion();
844 case 0xf7 : ComOut( CGM_GDSF_ONLY
, "Variable Width Polyline" )
847 mpOutAct
->CloseRegion();
850 case 0xf6 : ComOut( CGM_GDSF_ONLY
, "Elliptical Arc 3 Point" )
853 mpOutAct
->CloseRegion();
856 case 0xf1 : ComOut( CGM_GDSF_ONLY
, "Hyperlink Definition" ) break;
857 default: ComOut( CGM_UNKNOWN_COMMAND
, "" ) break;
861 mnParaSize
= mnElementSize
;