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
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 ************************************************************************/
34 #include <tools/gen.hxx>
36 #define MAX_64KPOINTS ((((USHORT)0xFFFF)-32)/sizeof(Point))
38 // -------------------
39 // - ImplPolygonData -
40 // -------------------
46 Point huge
* mpPointAry
;
48 GLOBALHANDLE mhPoints
;
62 class ImplPolygon
: public ImplPolygonData
65 ImplPolygon( USHORT nInitSize
, BOOL bFlags
= FALSE
);
66 ImplPolygon( USHORT nPoints
, const Point
* pPtAry
, const BYTE
* pInitFlags
= NULL
);
67 ImplPolygon( const ImplPolygon
& rImplPoly
);
70 void ImplSetSize( USHORT nSize
, BOOL bResize
= TRUE
);
71 void ImplCreateFlagArray();
72 void ImplSplit( USHORT nPos
, USHORT nSpace
, ImplPolygon
* pInitPoly
= NULL
);
73 void ImplRemove( USHORT nPos
, USHORT nCount
);
76 // -------------------
77 // - ImplPolyPolygon -
78 // -------------------
80 #define MAX_POLYGONS ((USHORT)0x3FF0)
83 typedef Polygon
* SVPPOLYGON
;
88 SVPPOLYGON
* mpPolyAry
;
94 ImplPolyPolygon( USHORT nInitSize
, USHORT nResize
)
95 { mpPolyAry
= NULL
; mnCount
= 0; mnRefCount
= 1;
96 mnSize
= nInitSize
; mnResize
= nResize
; }
97 ImplPolyPolygon( USHORT nInitSize
);
98 ImplPolyPolygon( const ImplPolyPolygon
& rImplPolyPoly
);
102 inline long MinMax( long nVal
, long nMin
, long nMax
)
104 return( nVal
>= nMin
? ( nVal
<= nMax
? nVal
: nMax
) : nMin
);
107 // ------------------------------------------------------------------
109 inline long FRound( double fVal
)
111 return( fVal
> 0.0 ? (long) ( fVal
+ 0.5 ) : -(long) ( -fVal
+ 0.5 ) );