merge the formfield patch from ooo-build
[ooovba.git] / tools / inc / poly.h
blobe0433d10ec567c9475db3cae734e2fcba12fbe3e
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: poly.h,v $
10 * $Revision: 1.6 $
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 #ifndef _POLY_H
32 #define _POLY_H
34 #include <tools/gen.hxx>
36 #define MAX_64KPOINTS ((((USHORT)0xFFFF)-32)/sizeof(Point))
38 // -------------------
39 // - ImplPolygonData -
40 // -------------------
42 class ImplPolygonData
44 public:
45 #ifdef WIN
46 Point huge* mpPointAry;
47 BYTE* mpFlagAry;
48 GLOBALHANDLE mhPoints;
49 #else
50 Point* mpPointAry;
51 BYTE* mpFlagAry;
52 #endif
54 USHORT mnPoints;
55 ULONG mnRefCount;
58 // ---------------
59 // - ImplPolygon -
60 // ---------------
62 class ImplPolygon : public ImplPolygonData
64 public:
65 ImplPolygon( USHORT nInitSize, BOOL bFlags = FALSE );
66 ImplPolygon( USHORT nPoints, const Point* pPtAry, const BYTE* pInitFlags = NULL );
67 ImplPolygon( const ImplPolygon& rImplPoly );
68 ~ImplPolygon();
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)
82 class Polygon;
83 typedef Polygon* SVPPOLYGON;
85 class ImplPolyPolygon
87 public:
88 SVPPOLYGON* mpPolyAry;
89 ULONG mnRefCount;
90 USHORT mnCount;
91 USHORT mnSize;
92 USHORT mnResize;
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 );
99 ~ImplPolyPolygon();
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 ) );
115 #endif // _SV_POLY_H