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 INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVE2DTOOLS_HXX 29 #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVE2DTOOLS_HXX 30 31 #include <drawinglayer/primitive2d/baseprimitive2d.hxx> 32 #include <basegfx/matrix/b2dhommatrix.hxx> 33 34 ////////////////////////////////////////////////////////////////////////////// 35 36 namespace drawinglayer 37 { 38 namespace primitive2d 39 { 40 /** DiscreteMetricDependentPrimitive2D class 41 42 tooling class for BufferedDecompositionPrimitive2D baseed classes which are view-dependent 43 regarding the size of a discrete unit. The implementation of get2DDecomposition 44 guards the buffered local decomposition and ensures that a create2DDecomposition 45 implementation may use an up-to-date DiscreteUnit accessible using getDiscreteUnit() 46 */ 47 class DiscreteMetricDependentPrimitive2D : public BufferedDecompositionPrimitive2D 48 { 49 private: 50 /** the last used fDiscreteUnit definitions for decomposition. Since this 51 is checked and updated from get2DDecomposition() it will be current and 52 usable in create2DDecomposition() 53 */ 54 double mfDiscreteUnit; 55 56 public: 57 /// constructor 58 DiscreteMetricDependentPrimitive2D() 59 : BufferedDecompositionPrimitive2D(), 60 mfDiscreteUnit(0.0) 61 { 62 } 63 64 /// data read access 65 double getDiscreteUnit() const { return mfDiscreteUnit; } 66 67 /// get local decomposition. Overloaded since this decomposition is view-dependent 68 virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; 69 }; 70 } // end of namespace primitive2d 71 } // end of namespace drawinglayer 72 73 ////////////////////////////////////////////////////////////////////////////// 74 75 namespace drawinglayer 76 { 77 namespace primitive2d 78 { 79 /** ViewportDependentPrimitive2D class 80 81 tooling class for BufferedDecompositionPrimitive2D baseed classes which are view-dependent 82 regarding the viewport. The implementation of get2DDecomposition 83 guards the buffered local decomposition and ensures that a create2DDecomposition 84 implementation may use an up-to-date Viewport accessible using getViewport() 85 */ 86 class ViewportDependentPrimitive2D : public BufferedDecompositionPrimitive2D 87 { 88 private: 89 /** the last used Viewport definition for decomposition. Since this 90 is checked and updated from get2DDecomposition() it will be current and 91 usable in create2DDecomposition() 92 */ 93 basegfx::B2DRange maViewport; 94 95 public: 96 /// constructor 97 ViewportDependentPrimitive2D() 98 : BufferedDecompositionPrimitive2D(), 99 maViewport() 100 { 101 } 102 103 /// data read access 104 const basegfx::B2DRange& getViewport() const { return maViewport; } 105 106 /// get local decomposition. Overloaded since this decomposition is view-dependent 107 virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; 108 }; 109 } // end of namespace primitive2d 110 } // end of namespace drawinglayer 111 112 ////////////////////////////////////////////////////////////////////////////// 113 114 namespace drawinglayer 115 { 116 namespace primitive2d 117 { 118 /** ViewTransformationDependentPrimitive2D class 119 120 tooling class for BufferedDecompositionPrimitive2D based classes which are view-dependent 121 regarding the complete Viewtransformation. The implementation of get2DDecomposition 122 guards the buffered local decomposition and ensures that a create2DDecomposition 123 implementation may use an up-to-date ViewTransformation accessible using getViewTransformation() 124 */ 125 class ViewTransformationDependentPrimitive2D : public BufferedDecompositionPrimitive2D 126 { 127 private: 128 /** the last used ViewTransformation definition for decomposition. Since this 129 is checked and updated from get2DDecomposition() it will be current and 130 usable in create2DDecomposition() 131 */ 132 basegfx::B2DHomMatrix maViewTransformation; 133 134 public: 135 /// constructor 136 ViewTransformationDependentPrimitive2D() 137 : BufferedDecompositionPrimitive2D(), 138 maViewTransformation() 139 { 140 } 141 142 /// data read access 143 const basegfx::B2DHomMatrix& getViewTransformation() const { return maViewTransformation; } 144 145 /// get local decomposition. Overloaded since this decomposition is view-dependent 146 virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; 147 }; 148 } // end of namespace primitive2d 149 } // end of namespace drawinglayer 150 151 ////////////////////////////////////////////////////////////////////////////// 152 153 namespace drawinglayer 154 { 155 namespace primitive2d 156 { 157 /** ObjectAndViewTransformationDependentPrimitive2D class 158 159 tooling class for BufferedDecompositionPrimitive2D based classes which are view-dependent 160 and Object-Transform dependent. The implementation of get2DDecomposition 161 guards the buffered local decomposition and ensures that a create2DDecomposition 162 implementation may use an up-to-date ViewTransformation accessible using getViewTransformation() 163 and an object transformation via getObjectTransformation() 164 */ 165 class ObjectAndViewTransformationDependentPrimitive2D : public BufferedDecompositionPrimitive2D 166 { 167 private: 168 /** the last used ViewTransformation and the last ObjectTransformation 169 definition for decomposition. Since this is checked and updated from 170 get2DDecomposition() it will be current and usable in create2DDecomposition() 171 */ 172 basegfx::B2DHomMatrix maViewTransformation; 173 basegfx::B2DHomMatrix maObjectTransformation; 174 175 public: 176 /// constructor 177 ObjectAndViewTransformationDependentPrimitive2D() 178 : BufferedDecompositionPrimitive2D(), 179 maViewTransformation(), 180 maObjectTransformation() 181 { 182 } 183 184 /// data read access 185 const basegfx::B2DHomMatrix& getViewTransformation() const { return maViewTransformation; } 186 const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; } 187 188 /// get local decomposition. Overloaded since this decomposition is view-dependent 189 virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; 190 }; 191 } // end of namespace primitive2d 192 } // end of namespace drawinglayer 193 194 ////////////////////////////////////////////////////////////////////////////// 195 196 #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVE2DTOOLS_HXX 197 198 ////////////////////////////////////////////////////////////////////////////// 199 // eof 200