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_GRAPHICPRIMITIVE2D_HXX
29 #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_GRAPHICPRIMITIVE2D_HXX
30 
31 #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
32 #include <basegfx/matrix/b2dhommatrix.hxx>
33 #include <svtools/grfmgr.hxx>
34 
35 //////////////////////////////////////////////////////////////////////////////
36 
37 namespace drawinglayer
38 {
39 	namespace primitive2d
40 	{
41         /** GraphicPrimitive2D class
42 
43             Primitive to hold graphics defined by GraphicObject and GraphicAttr
44             combination. This includes MetaFiles and diverse pixel-oriented graphic
45             formats. It even includes animated GIFs, Croppings and other changes
46             defined in GraphicAttr.
47 
48             This makes the decomposition contain a wide variety of possibilites,
49             too. From a simple BitmapPrimitive over AnimatedSwitchPrimitive2D,
50             MetafilePrimitive2D (with and without embedding in a masking when e.g.
51             the Metafile is bigger than the geometry) and embeddings in
52             TransformPrimitive2D and MaskPrimitive2D for croppings.
53 
54             The primitive geometry area is defined by Transform.
55          */
56 		class GraphicPrimitive2D : public BufferedDecompositionPrimitive2D
57 		{
58 		private:
59             /// the geometric definition
60 			basegfx::B2DHomMatrix						maTransform;
61 
62             /// the GraphicObject with all it's content possibilities
63 			GraphicObject								maGraphicObject;
64 
65             /// The GraphicAttr with all it's modification possibilities
66 			GraphicAttr									maGraphicAttr;
67 
68 		protected:
69 			/// local decomposition
70 			virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
71 
72 		public:
73             /// constructor(s)
74 			GraphicPrimitive2D(
75 				const basegfx::B2DHomMatrix& rTransform,
76 				const GraphicObject& rGraphicObject,
77 				const GraphicAttr& rGraphicAttr);
78 			GraphicPrimitive2D(
79 				const basegfx::B2DHomMatrix& rTransform,
80 				const GraphicObject& rGraphicObject);
81 
82 			/// data read access
83 			const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
84 			const GraphicObject& getGraphicObject() const { return maGraphicObject; }
85 			const GraphicAttr& getGraphicAttr() const { return maGraphicAttr; }
86 			bool isTransparent() const;
87 
88 			/// compare operator
89 			virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
90 
91 			/// get range
92 			virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
93 
94 			/// provide unique ID
95 			DeclPrimitrive2DIDBlock()
96 		};
97 	} // end of namespace primitive2d
98 } // end of namespace drawinglayer
99 
100 //////////////////////////////////////////////////////////////////////////////
101 
102 #endif // INCLUDED_DRAWINGLAYER_PRIMITIVE2D_GRAPHICPRIMITIVE2D_HXX
103 
104 //////////////////////////////////////////////////////////////////////////////
105 // eof
106