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: BezierPolyPolygon.java,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 ************************************************************************/
32 import com
.sun
.star
.rendering
.*;
33 import com
.sun
.star
.geometry
.*;
35 public class BezierPolyPolygon
36 extends com
.sun
.star
.lib
.uno
.helper
.ComponentBase
37 implements com
.sun
.star
.lang
.XServiceInfo
,
38 com
.sun
.star
.rendering
.XBezierPolyPolygon2D
40 private java
.awt
.geom
.GeneralPath path
;
42 //----------------------------------------------------------------------------------
44 public BezierPolyPolygon( RealBezierSegment2D
[][] points
)
46 setBezierSegments( points
, 0 );
49 public java
.awt
.geom
.GeneralPath
getJavaPath()
54 //----------------------------------------------------------------------------------
57 // XPolyPolygon implementation
58 // ===========================
60 public void addPolyPolygon( RealPoint2D position
, XPolyPolygon2D polyPolygon
)
64 public int getNumberOfPolygons( )
69 public int getNumberOfPolygonPoints( int polygon
)
74 public FillRule
getFillRule( )
76 if( path
.getWindingRule() == java
.awt
.geom
.GeneralPath
.WIND_EVEN_ODD
)
77 return FillRule
.EVEN_ODD
;
79 return FillRule
.NON_ZERO
;
82 public void setFillRule( FillRule fillRule
)
84 if( fillRule
== FillRule
.EVEN_ODD
)
85 path
.setWindingRule( java
.awt
.geom
.GeneralPath
.WIND_EVEN_ODD
);
87 path
.setWindingRule( java
.awt
.geom
.GeneralPath
.WIND_NON_ZERO
);
90 public boolean isClosed( int index
)
96 public void setClosed( int index
, boolean closedState
)
101 //----------------------------------------------------------------------------------
104 // XBezierPolyPolygon implementation
105 // =================================
107 public RealBezierSegment2D
[][] getBezierSegments( int nPolygonIndex
, int nNumberOfPolygons
, int nPointIndex
, int nNumberOfPoints
)
112 public void setBezierSegments( RealBezierSegment2D
[][] points
, int nPolygonIndex
)
114 if( nPolygonIndex
!= 0 )
115 CanvasUtils
.printLog( "LinePolyPolygon.setPoints: subset not yet implemented!" );
117 path
= CanvasUtils
.makeGenPathFromBezierPoints( points
);
120 public RealBezierSegment2D
getBezierSegment( int nPolygonIndex
, int nPointIndex
)
125 public void setBezierSegment( RealBezierSegment2D point
, int nPolygonIndex
, int nPointIndex
)
127 CanvasUtils
.printLog( "LinePolyPolygon.setPoint: not yet implemented!" );
130 //----------------------------------------------------------------------------------
137 private static final String s_implName
= "XBezierPolyPolygon2D.java.impl";
138 private static final String s_serviceName
= "com.sun.star.rendering.BezierPolyPolygon2D";
140 public String
getImplementationName()
145 public String
[] getSupportedServiceNames()
147 return new String
[] { s_serviceName
};
150 public boolean supportsService( String serviceName
)
152 return serviceName
.equals( s_serviceName
);