1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef _BGFX_POLYGON_B3DPOLYPOLYGON_HXX 29 #define _BGFX_POLYGON_B3DPOLYPOLYGON_HXX 30 31 #include <sal/types.h> 32 #include <o3tl/cow_wrapper.hxx> 33 34 // predeclarations 35 class ImplB3DPolyPolygon; 36 37 namespace basegfx 38 { 39 class B3DPolygon; 40 class B3DHomMatrix; 41 class B2DHomMatrix; 42 } // end of namespace basegfx 43 44 ////////////////////////////////////////////////////////////////////////////// 45 46 namespace basegfx 47 { 48 class B3DPolyPolygon 49 { 50 public: 51 typedef o3tl::cow_wrapper< ImplB3DPolyPolygon > ImplType; 52 53 private: 54 ImplType mpPolyPolygon; 55 56 public: 57 B3DPolyPolygon(); 58 B3DPolyPolygon(const B3DPolyPolygon& rPolyPolygon); 59 explicit B3DPolyPolygon(const B3DPolygon& rPolygon); 60 ~B3DPolyPolygon(); 61 62 // assignment operator 63 B3DPolyPolygon& operator=(const B3DPolyPolygon& rPolyPolygon); 64 65 /// unshare this poly-polygon (and all included polygons) with all internally shared instances 66 void makeUnique(); 67 68 // compare operators 69 bool operator==(const B3DPolyPolygon& rPolyPolygon) const; 70 bool operator!=(const B3DPolyPolygon& rPolyPolygon) const; 71 72 // polygon interface 73 sal_uInt32 count() const; 74 75 // B3DPolygon interface 76 B3DPolygon getB3DPolygon(sal_uInt32 nIndex) const; 77 void setB3DPolygon(sal_uInt32 nIndex, const B3DPolygon& rPolygon); 78 79 // BColor interface 80 bool areBColorsUsed() const; 81 void clearBColors(); 82 83 // Normals interface 84 void transformNormals(const B3DHomMatrix& rMatrix); 85 bool areNormalsUsed() const; 86 void clearNormals(); 87 88 // TextureCoordinate interface 89 void transformTextureCoordiantes(const B2DHomMatrix& rMatrix); 90 bool areTextureCoordinatesUsed() const; 91 void clearTextureCoordinates(); 92 93 // insert/append single polygon 94 void insert(sal_uInt32 nIndex, const B3DPolygon& rPolygon, sal_uInt32 nCount = 1); 95 void append(const B3DPolygon& rPolygon, sal_uInt32 nCount = 1); 96 97 // insert/append multiple polygons 98 void insert(sal_uInt32 nIndex, const B3DPolyPolygon& rPolyPolygon); 99 void append(const B3DPolyPolygon& rPolyPolygon); 100 101 // remove 102 void remove(sal_uInt32 nIndex, sal_uInt32 nCount = 1); 103 104 // reset to empty state 105 void clear(); 106 107 // closed state 108 bool isClosed() const; 109 void setClosed(bool bNew); 110 111 // flip polygon direction 112 void flip(); 113 114 // test if PolyPolygon has double points 115 bool hasDoublePoints() const; 116 117 // remove double points, at the begin/end and follow-ups, too 118 void removeDoublePoints(); 119 120 // apply transformation given in matrix form to the polygon 121 void transform(const basegfx::B3DHomMatrix& rMatrix); 122 }; 123 } // end of namespace basegfx 124 125 #endif /* _BGFX_POLYGON_B3DPOLYPOLYGON_HXX */ 126