merge the formfield patch from ooo-build
[ooovba.git] / chart2 / source / view / inc / Clipping.hxx
blobc834cf9afca03ecad7a76c5c032ce1101745d2ef
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: Clipping.hxx,v $
10 * $Revision: 1.5 $
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 _CHART2_CLIPPING_HXX
32 #define _CHART2_CLIPPING_HXX
34 #include <basegfx/range/b2drectangle.hxx>
35 #include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
37 //.............................................................................
38 namespace chart
40 //.............................................................................
42 //-----------------------------------------------------------------------------
43 /**
46 class Clipping
48 /** This class uses the Liang-Biarsky parametric line-clipping algorithm as described in:
49 Computer Graphics: principles and practice, 2nd ed.,
50 James D. Foley et al.,
51 Section 3.12.4 on page 117.
54 public:
55 /** @descr The intersection between an open polygon and a rectangle is
56 calculated and the resulting lines are placed into the poly-polygon aResult.
57 @param rPolygon The polygon is required to be open, ie. it's start and end point
58 have different coordinates and that it is continuous, ie. has no holes.
59 @param rRectangle The clipping area.
60 @param aResult The resulting lines that are the parts of the given polygon lying inside
61 the clipping area are stored into aResult whose prior content is deleted first.
63 static void clipPolygonAtRectangle(
64 const ::com::sun::star::drawing::PolyPolygonShape3D& rPolygon
65 , const ::basegfx::B2DRectangle& rRectangle
66 , ::com::sun::star::drawing::PolyPolygonShape3D& aResult
67 , bool bSplitPiecesToDifferentPolygons = true );
70 //.............................................................................
71 } //namespace chart
72 //.............................................................................
73 #endif