1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
26 using namespace ::com::sun::star
;
28 double CGM::ImplGetOrientation( FloatPoint
& rCenter
, FloatPoint
& rPoint
)
32 double nX
= rPoint
.X
- rCenter
.X
;
33 double nY
= rPoint
.Y
- rCenter
.Y
;
35 fOrientation
= acos( nX
/ sqrt( nX
* nX
+ nY
* nY
) ) * 57.29577951308;
37 fOrientation
= 360 - fOrientation
;
42 // ---------------------------------------------------------------
44 void CGM::ImplSwitchStartEndAngle( double& rStartAngle
, double& rEndAngle
)
48 rStartAngle
= rEndAngle
;
52 // ---------------------------------------------------------------
54 void CGM::ImplGetVector( double* pVector
)
56 if ( pElement
->eVDCType
== VDC_REAL
)
58 for ( sal_uInt32 i
= 0; i
< 4; i
++ )
60 pVector
[ i
] = (double)ImplGetFloat( pElement
->eVDCRealPrecision
, pElement
->nVDCRealSize
);
65 for ( sal_uInt32 i
= 0; i
< 4; i
++ )
67 pVector
[ i
] = (double)ImplGetI( pElement
->nVDCIntegerPrecision
);
70 pVector
[ 0 ] *= mnVDCXmul
;
71 pVector
[ 2 ] *= mnVDCXmul
;
72 pVector
[ 1 ] *= mnVDCYmul
;
73 pVector
[ 3 ] *= mnVDCYmul
;
76 // ---------------------------------------------------------------
77 sal_Bool
CGM::ImplGetEllipse( FloatPoint
& rCenter
, FloatPoint
& rRadius
, double& rAngle
)
79 FloatPoint aPoint1
, aPoint2
;
81 ImplGetPoint( rCenter
, sal_True
);
82 ImplGetPoint( aPoint1
, sal_True
);
83 ImplGetPoint( aPoint2
, sal_True
);
84 fRot1
= ImplGetOrientation( rCenter
, aPoint1
);
85 fRot2
= ImplGetOrientation( rCenter
, aPoint2
);
86 rAngle
= ImplGetOrientation( rCenter
, aPoint1
);
87 aPoint1
.X
-= rCenter
.X
;
88 aPoint1
.Y
-= rCenter
.Y
;
89 rRadius
.X
= sqrt( aPoint1
.X
* aPoint1
.X
+ aPoint1
.Y
* aPoint1
.Y
);
90 aPoint2
.X
-= rCenter
.X
;
91 aPoint2
.Y
-= rCenter
.Y
;
92 rRadius
.Y
= sqrt( aPoint2
.X
* aPoint2
.X
+ aPoint2
.Y
* aPoint2
.Y
);
96 if ( ( fRot1
- fRot2
) < 180 )
101 if ( ( fRot2
- fRot1
) > 180 )
107 void CGM::ImplDoClass4()
110 mpOutAct
->FirstOutPut();
112 if ( mpBitmapInUse
&& ( mnElementID
!= 9 ) ) // process existend graphic
113 { // because there are now no pending bitmap actions
114 CGMBitmapDescriptor
* pBmpDesc
= mpBitmapInUse
->GetBitmap();
115 // do anything with the bitmap
116 mpOutAct
->DrawBitmap( pBmpDesc
);
117 delete mpBitmapInUse
;
118 mpBitmapInUse
= NULL
;
121 if ( ( mpChart
== NULL
) || mpChart
->IsAnnotation() )
123 switch ( mnElementID
)
125 case 0x01 : /*PolyLine*/
127 sal_uInt32 nPoints
= mnElementSize
/ ImplGetPointSize();
128 Polygon
aPolygon( (sal_uInt16
)nPoints
);
129 for ( sal_uInt16 i
= 0; i
< nPoints
; i
++)
131 FloatPoint aFloatPoint
;
132 ImplGetPoint( aFloatPoint
, sal_True
);
133 aPolygon
.SetPoint( Point( (long)aFloatPoint
.X
, (long)aFloatPoint
.Y
), i
);
136 mpOutAct
->RegPolyLine( aPolygon
);
138 mpOutAct
->DrawPolyLine( aPolygon
);
142 case 0x02 : /*Disjoint PolyLine*/
144 sal_uInt16 nPoints
= sal::static_int_cast
< sal_uInt16
>(
145 mnElementSize
/ ImplGetPointSize());
146 if ( ! ( nPoints
& 1 ) )
149 FloatPoint aFloatPoint
;
152 Polygon
aPolygon( nPoints
);
153 for ( sal_uInt16 i
= 0; i
< nPoints
; i
++ )
155 ImplGetPoint( aFloatPoint
, sal_True
);
156 aPolygon
.SetPoint( Point( (long)aFloatPoint
.X
, (long)aFloatPoint
.Y
), 0 );
158 mpOutAct
->RegPolyLine( aPolygon
);
162 mpOutAct
->BeginGroup();
163 Polygon
aPolygon( (sal_uInt16
)2 );
164 for ( sal_uInt16 i
= 0; i
< nPoints
; i
++ )
166 ImplGetPoint( aFloatPoint
, sal_True
);
167 aPolygon
.SetPoint( Point( (long)aFloatPoint
.X
, (long)aFloatPoint
.Y
), 0 );
168 ImplGetPoint( aFloatPoint
, sal_True
);
169 aPolygon
.SetPoint( Point( (long)aFloatPoint
.X
, (long)aFloatPoint
.Y
), 1);
170 mpOutAct
->DrawPolyLine( aPolygon
);
172 mpOutAct
->EndGroup();
178 case 0x03 : /*PolyMarker*/ break;
181 FloatPoint aFloatPoint
;
182 sal_uInt32 nType
, nSize
;
185 mpOutAct
->CloseRegion();
187 ImplGetPoint ( aFloatPoint
, sal_True
);
188 nType
= ImplGetUI16( 4 );
189 nSize
= ImplGetUI( 1 );
190 mpSource
[ mnParaSize
+ nSize
] = 0;
193 awt::Point
aPoint( (long)aFloatPoint
.X
, (long)aFloatPoint
.Y
);
194 mpOutAct
->DrawText( aPoint
, aSize
,
195 (char*)mpSource
+ mnParaSize
, nSize
, (FinalFlag
)nType
);
196 mnParaSize
= mnElementSize
;
200 case 0x05 : /*Restricted Text*/
203 FloatPoint aFloatPoint
;
204 sal_uInt32 nType
, nSize
;
207 mpOutAct
->CloseRegion();
209 if ( pElement
->eVDCType
== VDC_REAL
)
211 dx
= ImplGetFloat( pElement
->eVDCRealPrecision
, pElement
->nVDCRealSize
);
212 dy
= ImplGetFloat( pElement
->eVDCRealPrecision
, pElement
->nVDCRealSize
);
216 dx
= (double)ImplGetI( pElement
->nVDCIntegerPrecision
);
217 dy
= (double)ImplGetI( pElement
->nVDCIntegerPrecision
);
222 ImplGetPoint ( aFloatPoint
, sal_True
);
223 nType
= ImplGetUI16( 4 );
224 nSize
= ImplGetUI( 1 );
226 mpSource
[ mnParaSize
+ nSize
] = 0;
228 awt::Point
aPoint( (long)aFloatPoint
.X
, (long)aFloatPoint
.Y
);
229 awt::Size
aSize((long)dx
, (long)dy
);
230 mpOutAct
->DrawText( aPoint
, aSize
,
231 (char*)mpSource
+ mnParaSize
, nSize
, (FinalFlag
)nType
);
232 mnParaSize
= mnElementSize
;
236 case 0x06 : /*Append Text*/
239 sal_uInt32 nType
= ImplGetUI16( 4 );
241 nSize
= ImplGetUI( 1 );
242 mpSource
[ mnParaSize
+ nSize
] = 0;
244 mpOutAct
->AppendText( (char*)mpSource
+ mnParaSize
, nSize
, (FinalFlag
)nType
);
245 mnParaSize
= mnElementSize
;
249 case 0x07 : /*Polygon*/
252 mpOutAct
->CloseRegion();
254 sal_uInt16 nPoints
= sal::static_int_cast
< sal_uInt16
>(
255 mnElementSize
/ ImplGetPointSize());
256 Polygon
aPolygon( nPoints
);
257 for ( sal_uInt16 i
= 0; i
< nPoints
; i
++)
259 FloatPoint aFloatPoint
;
260 ImplGetPoint( aFloatPoint
, sal_True
);
261 aPolygon
.SetPoint( Point ( (long)( aFloatPoint
.X
), (long)( aFloatPoint
.Y
) ), i
);
263 mpOutAct
->DrawPolygon( aPolygon
);
267 case 0x08 : /*Polygon Set*/
270 mpOutAct
->CloseRegion();
272 sal_uInt16 nPoints
= 0;
273 Point
* pPoints
= new Point
[ 0x4000 ];
275 PolyPolygon aPolyPolygon
;
276 FloatPoint aFloatPoint
;
277 sal_uInt32 nEdgeFlag
;
278 while ( mnParaSize
< mnElementSize
)
280 ImplGetPoint( aFloatPoint
, sal_True
);
281 nEdgeFlag
= ImplGetUI16();
282 pPoints
[ nPoints
++ ] = Point( (long)aFloatPoint
.X
, (long)aFloatPoint
.Y
);
283 if ( ( nEdgeFlag
& 2 ) || ( mnParaSize
== mnElementSize
) )
285 Polygon
aPolygon( nPoints
);
286 for ( sal_uInt16 i
= 0; i
< nPoints
; i
++ )
288 aPolygon
.SetPoint( pPoints
[ i
], i
);
290 aPolyPolygon
.Insert( aPolygon
, POLYPOLY_APPEND
);
295 mpOutAct
->DrawPolyPolygon( aPolyPolygon
);
299 case 0x09 : /*Cell Array*/
302 mpOutAct
->CloseRegion();
306 CGMBitmap
* pBmpDesc
= mpBitmapInUse
->GetNext();
307 if ( pBmpDesc
) // we possibly get a bitmap back which does not fit to
308 { // to the previous -> we need to delete this one too
309 mpOutAct
->DrawBitmap( pBmpDesc
->GetBitmap() );
315 mpBitmapInUse
= new CGMBitmap( *this );
320 case 0x0a : /*Generalized Drawing Primitive*/
322 ImplGetI( pElement
->nIntegerPrecision
); //-Wall is this needed
323 ImplGetUI( pElement
->nIntegerPrecision
); //-Wall is this needed
324 mnParaSize
= mnElementSize
;
328 case 0x0b : /*Rectangle*/
331 mpOutAct
->CloseRegion();
333 FloatRect aFloatRect
;
334 ImplGetRectangle( aFloatRect
, sal_True
);
335 mpOutAct
->DrawRectangle( aFloatRect
);
339 case 0x0c : /*Circle*/
342 mpOutAct
->CloseRegion();
344 double fRotation
= 0;
345 FloatPoint aCenter
, aRadius
;
346 ImplGetPoint( aCenter
, sal_True
);
347 if ( pElement
->eVDCType
== VDC_REAL
)
348 aRadius
.X
= ImplGetFloat( pElement
->eVDCRealPrecision
, pElement
->nVDCRealSize
);
350 aRadius
.X
= (double)ImplGetI( pElement
->nVDCIntegerPrecision
);
351 ImplMapDouble( aRadius
.X
);
352 aRadius
.Y
= aRadius
.X
;
353 mpOutAct
->DrawEllipse( aCenter
, aRadius
, fRotation
);
357 case 0x0d : /*Circular Arc 3 Point*/
359 FloatPoint aStartingPoint
, aIntermediatePoint
, aEndingPoint
, aCenterPoint
;
360 ImplGetPoint( aStartingPoint
, sal_True
);
361 ImplGetPoint( aIntermediatePoint
, sal_True
);
362 ImplGetPoint( aEndingPoint
, sal_True
);
364 double fA
= aIntermediatePoint
.X
- aStartingPoint
.X
;
365 double fB
= aIntermediatePoint
.Y
- aStartingPoint
.Y
;
366 double fC
= aEndingPoint
.X
- aStartingPoint
.X
;
367 double fD
= aEndingPoint
.Y
- aStartingPoint
.Y
;
369 double fE
= fA
* ( aStartingPoint
.X
+ aIntermediatePoint
.X
) + fB
* ( aStartingPoint
.Y
+ aIntermediatePoint
.Y
);
370 double fF
= fC
* ( aStartingPoint
.X
+ aEndingPoint
.X
) + fD
* ( aStartingPoint
.Y
+ aEndingPoint
.Y
);
372 double fG
= 2.0 * ( fA
* ( aEndingPoint
.Y
- aIntermediatePoint
.Y
) - fB
* ( aEndingPoint
.X
- aIntermediatePoint
.X
) );
374 aCenterPoint
.X
= ( fD
* fE
- fB
* fF
) / fG
;
375 aCenterPoint
.Y
= ( fA
* fF
- fC
* fE
) / fG
;
379 double fStartAngle
= ImplGetOrientation( aCenterPoint
, aStartingPoint
);
380 double fInterAngle
= ImplGetOrientation( aCenterPoint
, aIntermediatePoint
);
381 double fEndAngle
= ImplGetOrientation( aCenterPoint
, aEndingPoint
);
385 if ( fStartAngle
> fEndAngle
)
388 aIntermediatePoint
= aEndingPoint
;
389 aEndingPoint
= aStartingPoint
;
390 aStartingPoint
= aIntermediatePoint
;
392 fStartAngle
= fEndAngle
;
395 if ( ! ( fInterAngle
> fStartAngle
) && ( fInterAngle
< fEndAngle
) )
398 aIntermediatePoint
= aEndingPoint
;
399 aEndingPoint
= aStartingPoint
;
400 aStartingPoint
= aIntermediatePoint
;
402 fStartAngle
= fEndAngle
;
405 double fRadius
= sqrt( pow( ( aStartingPoint
.X
- aCenterPoint
.X
), 2 ) + pow( ( aStartingPoint
.Y
- aCenterPoint
.Y
), 2 ) ) ;
409 Rectangle
aBoundingBox( Point( (long)( aCenterPoint
.X
- fRadius
), long( aCenterPoint
.Y
- fRadius
) ),
410 Size( ( static_cast< long >( 2 * fRadius
) ), (long)( 2 * fRadius
) ) );
411 Polygon
aPolygon( aBoundingBox
, Point( (long)aStartingPoint
.X
, (long)aStartingPoint
.Y
) ,Point( (long)aEndingPoint
.X
, (long)aEndingPoint
.Y
), POLY_ARC
);
413 mpOutAct
->RegPolyLine( aPolygon
, sal_True
);
415 mpOutAct
->RegPolyLine( aPolygon
);
421 aRadius
.X
= aRadius
.Y
= fRadius
;
422 mpOutAct
->DrawEllipticalArc( aCenterPoint
, aRadius
, fG
, 2, fStartAngle
, fEndAngle
);
428 case 0x0e : /*Circular Arc 3 Point Close*/
431 mpOutAct
->CloseRegion();
433 FloatPoint aStartingPoint
, aIntermediatePoint
, aEndingPoint
, aCenterPoint
;
434 ImplGetPoint( aStartingPoint
);
435 ImplGetPoint( aIntermediatePoint
);
436 ImplGetPoint( aEndingPoint
);
438 double fA
= aIntermediatePoint
.X
- aStartingPoint
.X
;
439 double fB
= aIntermediatePoint
.Y
- aStartingPoint
.Y
;
440 double fC
= aEndingPoint
.X
- aStartingPoint
.X
;
441 double fD
= aEndingPoint
.Y
- aStartingPoint
.Y
;
443 double fE
= fA
* ( aStartingPoint
.X
+ aIntermediatePoint
.X
) + fB
* ( aStartingPoint
.Y
+ aIntermediatePoint
.Y
);
444 double fF
= fC
* ( aStartingPoint
.X
+ aEndingPoint
.X
) + fD
* ( aStartingPoint
.Y
+ aEndingPoint
.Y
);
446 double fG
= 2.0 * ( fA
* ( aEndingPoint
.Y
- aIntermediatePoint
.Y
) - fB
* ( aEndingPoint
.X
- aIntermediatePoint
.X
) );
448 aCenterPoint
.X
= ( fD
* fE
- fB
* fF
) / fG
;
449 aCenterPoint
.Y
= ( fA
* fF
- fC
* fE
) / fG
;
453 double fStartAngle
= ImplGetOrientation( aCenterPoint
, aStartingPoint
);
454 double fInterAngle
= ImplGetOrientation( aCenterPoint
, aIntermediatePoint
);
455 double fEndAngle
= ImplGetOrientation( aCenterPoint
, aEndingPoint
);
457 if ( fStartAngle
> fEndAngle
)
459 aIntermediatePoint
= aEndingPoint
;
460 aEndingPoint
= aStartingPoint
;
461 aStartingPoint
= aIntermediatePoint
;
463 fStartAngle
= fEndAngle
;
466 if ( ! ( fInterAngle
> fStartAngle
) && ( fInterAngle
< fEndAngle
) )
468 aIntermediatePoint
= aEndingPoint
;
469 aEndingPoint
= aStartingPoint
;
470 aStartingPoint
= aIntermediatePoint
;
472 fStartAngle
= fEndAngle
;
476 fRadius
.Y
= fRadius
.X
= sqrt( pow( ( aStartingPoint
.X
- aCenterPoint
.X
), 2 ) + pow( ( aStartingPoint
.Y
- aCenterPoint
.Y
), 2 ) ) ;
478 sal_uInt32 nType
= ImplGetUI16();
482 nType
= 1; // is CHORD
484 double fOrientation
= 0;
485 mpOutAct
->DrawEllipticalArc( aCenterPoint
, fRadius
, fOrientation
, nType
, fStartAngle
, fEndAngle
);
490 case 0x0f : /*Circular Arc Centre*/
492 double fStartAngle
, fEndAngle
, vector
[ 4 ];
493 FloatPoint aCenter
, aRadius
;
496 mpOutAct
->CloseRegion();
498 ImplGetPoint( aCenter
, sal_True
);
499 ImplGetVector( &vector
[ 0 ] );
501 if ( pElement
->eVDCType
== VDC_REAL
)
503 aRadius
.X
= (double)ImplGetFloat( pElement
->eVDCRealPrecision
, pElement
->nVDCRealSize
);
507 aRadius
.X
= (double)ImplGetI( pElement
->nVDCIntegerPrecision
);
510 ImplMapDouble( aRadius
.X
);
511 aRadius
.Y
= aRadius
.X
;
513 fStartAngle
= acos( vector
[ 0 ] / sqrt( vector
[ 0 ] * vector
[ 0 ] + vector
[ 1 ] * vector
[ 1 ] ) ) * 57.29577951308;
514 fEndAngle
= acos( vector
[ 2 ] / sqrt( vector
[ 2 ] * vector
[ 2 ] + vector
[ 3 ] * vector
[ 3 ] ) ) * 57.29577951308;
516 if ( vector
[ 1 ] > 0 )
517 fStartAngle
= 360 - fStartAngle
;
518 if ( vector
[ 3 ] > 0 )
519 fEndAngle
= 360 - fEndAngle
;
522 ImplSwitchStartEndAngle( fStartAngle
, fEndAngle
);
526 Rectangle
aBoundingBox(
527 Point( (long)( aCenter
.X
- aRadius
.X
), long( aCenter
.Y
- aRadius
.X
) ),
528 Size( static_cast< long >( 2 * aRadius
.X
), (long)( 2 * aRadius
.X
) ) );
529 Polygon
aPolygon( aBoundingBox
,
530 Point( (long)vector
[ 0 ], (long)vector
[ 1 ] ),
531 Point( (long)vector
[ 2 ], (long)vector
[ 3 ] ), POLY_ARC
);
532 mpOutAct
->RegPolyLine( aPolygon
);
536 double fOrientation
= 0;
537 mpOutAct
->DrawEllipticalArc( aCenter
, aRadius
, fOrientation
, 2, fStartAngle
, fEndAngle
);
539 mnParaSize
= mnElementSize
;
544 case 0x10 : /*Circular Arc Centre Close*/
546 double fOrientation
, fStartAngle
, fEndAngle
, vector
[ 4 ];
547 FloatPoint aCenter
, aRadius
;
550 mpOutAct
->CloseRegion();
552 ImplGetPoint( aCenter
, sal_True
);
553 ImplGetVector( &vector
[ 0 ] );
554 if ( pElement
->eVDCType
== VDC_REAL
)
556 aRadius
.X
= (double)ImplGetFloat( pElement
->eVDCRealPrecision
, pElement
->nVDCRealSize
);
560 aRadius
.X
= (double)ImplGetI( pElement
->nVDCIntegerPrecision
);
562 ImplMapDouble( aRadius
.X
);
563 aRadius
.Y
= aRadius
.X
;
564 fStartAngle
= acos( vector
[ 0 ] / sqrt( vector
[ 0 ] * vector
[ 0 ] + vector
[ 1 ] * vector
[ 1 ] ) ) * 57.29577951308;
565 fEndAngle
= acos( vector
[ 2 ] / sqrt( vector
[ 2 ] * vector
[ 2 ] + vector
[ 3 ] * vector
[ 3 ] ) ) * 57.29577951308;
567 if ( vector
[ 1 ] > 0 )
568 fStartAngle
= 360 - fStartAngle
;
569 if ( vector
[ 3 ] > 0 )
570 fEndAngle
= 360 - fEndAngle
;
573 ImplSwitchStartEndAngle( fStartAngle
, fEndAngle
);
576 sal_uInt32 nType
= ImplGetUI16();
580 nType
= 1; // is CHORD
583 mpOutAct
->DrawEllipticalArc( aCenter
, aRadius
, fOrientation
,
584 nType
, fStartAngle
, fEndAngle
);
585 mnParaSize
= mnElementSize
;
589 case 0x11 : /*Ellipse*/
592 FloatPoint aCenter
, aRadius
;
595 mpOutAct
->CloseRegion();
597 ImplGetEllipse( aCenter
, aRadius
, fOrientation
) ;
598 mpOutAct
->DrawEllipse( aCenter
, aRadius
, fOrientation
) ;
602 case 0x12 : /*Elliptical Arc*/
605 mpOutAct
->CloseRegion();
607 double fOrientation
, fStartAngle
, fEndAngle
, vector
[ 4 ];
608 FloatPoint aCenter
, aRadius
;
611 mpOutAct
->CloseRegion();
613 sal_Bool bDirection
= ImplGetEllipse( aCenter
, aRadius
, fOrientation
);
614 ImplGetVector( &vector
[ 0 ] );
616 fStartAngle
= acos( vector
[ 0 ] / sqrt( vector
[ 0 ] * vector
[ 0 ] + vector
[ 1 ] * vector
[ 1 ] ) ) * 57.29577951308;
617 fEndAngle
= acos( vector
[ 2 ] / sqrt( vector
[ 2 ] * vector
[ 2 ] + vector
[ 3 ] * vector
[ 3 ] ) ) * 57.29577951308;
619 if ( vector
[ 1 ] > 0 )
620 fStartAngle
= 360 - fStartAngle
;
621 if ( vector
[ 3 ] > 0 )
622 fEndAngle
= 360 - fEndAngle
;
625 mpOutAct
->DrawEllipticalArc( aCenter
, aRadius
, fOrientation
,
626 2, fStartAngle
, fEndAngle
);
628 mpOutAct
->DrawEllipticalArc( aCenter
, aRadius
, fOrientation
,
629 2, fEndAngle
, fStartAngle
);
633 case 0x13 : /*Elliptical Arc Close*/
635 double fOrientation
, fStartAngle
, fEndAngle
, vector
[ 4 ];
636 FloatPoint aCenter
, aRadius
;
639 mpOutAct
->CloseRegion();
641 sal_Bool bDirection
= ImplGetEllipse( aCenter
, aRadius
, fOrientation
);
642 ImplGetVector( &vector
[ 0 ] );
644 fStartAngle
= acos( vector
[ 0 ] / sqrt( vector
[ 0 ] * vector
[ 0 ] + vector
[ 1 ] * vector
[ 1 ] ) ) * 57.29577951308;
645 fEndAngle
= acos( vector
[ 2 ] / sqrt( vector
[ 2 ] * vector
[ 2 ] + vector
[ 3 ] * vector
[ 3 ] ) ) * 57.29577951308;
647 if ( vector
[ 1 ] > 0 )
648 fStartAngle
= 360 - fStartAngle
;
649 if ( vector
[ 3 ] > 0 )
650 fEndAngle
= 360 - fEndAngle
;
652 sal_uInt32 nType
= ImplGetUI16();
656 nType
= 1; // is CHORD
659 mpOutAct
->DrawEllipticalArc( aCenter
, aRadius
, fOrientation
,
660 nType
, fStartAngle
, fEndAngle
);
662 mpOutAct
->DrawEllipticalArc( aCenter
, aRadius
, fOrientation
,
663 nType
, fEndAngle
, fStartAngle
);
666 case 0x14 : /*Circular Arc Centre Reversed*/
669 mpOutAct
->CloseRegion();
672 case 0x15 : /*Connection Edge */ // NS
675 // mpOutAct->CloseRegion();
678 case 0x16 : /*Hyperbolic Arc */ // NS
681 mpOutAct
->CloseRegion();
684 case 0x17 : /*Parabolic Arc */ // NS
687 mpOutAct
->CloseRegion();
690 case 0x18 : /*Non Uniform B-Spline */ // NS
693 mpOutAct
->CloseRegion();
696 case 0x19 : /*Non Uniform Rational B-Spline */ // NS
699 mpOutAct
->CloseRegion();
702 case 0x1a : /*Polybezier*/
704 sal_uInt32 nOrder
= ImplGetI( pElement
->nIntegerPrecision
);
706 sal_uInt16 nNumberOfPoints
= sal::static_int_cast
< sal_uInt16
>(( mnElementSize
- pElement
->nIntegerPrecision
) / ImplGetPointSize());
708 Polygon
aPolygon( nNumberOfPoints
);
710 for ( sal_uInt16 i
= 0; i
< nNumberOfPoints
; i
++)
712 FloatPoint aFloatPoint
;
713 ImplGetPoint( aFloatPoint
, sal_True
);
714 aPolygon
.SetPoint( Point ( (long)( aFloatPoint
.X
), (long)( aFloatPoint
.Y
) ), i
);
718 for ( sal_uInt16 i
= 0; i
< nNumberOfPoints
; i
++ )
720 if ( ( i
% 3 ) == 0 )
721 aPolygon
.SetFlags( i
, POLY_NORMAL
);
723 aPolygon
.SetFlags( i
, POLY_CONTROL
);
728 for ( sal_uInt16 i
= 0; i
< nNumberOfPoints
; i
++ )
733 case 3 : aPolygon
.SetFlags( i
, POLY_NORMAL
); break;
734 default : aPolygon
.SetFlags( i
, POLY_CONTROL
); break;
739 mpOutAct
->RegPolyLine( aPolygon
);
741 mpOutAct
->DrawPolybezier( aPolygon
);
742 mnParaSize
= mnElementSize
;
746 case 0x1b : /*Polysymbol */ // NS
749 mpOutAct
->CloseRegion();
752 case 0x1c : /*Bitonal Tile */ // NS
755 mpOutAct
->CloseRegion();
758 case 0x1d : /*Tile */ // NS
761 mpOutAct
->CloseRegion();
764 case 0x1e : /*Insert Object*/
767 mpOutAct
->CloseRegion();
770 case 0xff : /*Polybezier*/
773 mpOutAct
->CloseRegion();
776 case 0xfe : /*Sharp Polybezier*/
779 mpOutAct
->CloseRegion();
782 case 0xfd : /*Polyspline*/
785 mpOutAct
->CloseRegion();
788 case 0xfc : /*Reounded Rectangle*/
791 mpOutAct
->CloseRegion();
794 case 0xfb : /*Begin Cell Array*/
797 mpOutAct
->CloseRegion();
800 case 0xfa : /*End Cell Array*/
803 mpOutAct
->CloseRegion();
806 case 0xf9 : /*Insert File*/
809 mpOutAct
->CloseRegion();
812 case 0xf8 : /*Block Text*/
815 mpOutAct
->CloseRegion();
818 case 0xf7 : /*Variable Width Polyline*/
821 mpOutAct
->CloseRegion();
824 case 0xf6 : /*Elliptical Arc 3 Point*/
827 mpOutAct
->CloseRegion();
830 case 0xf1 : /*Hyperlink Definition */break;
835 mnParaSize
= mnElementSize
;
839 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */