1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_METAFILEPRIMITIVE2D_HXX
25 #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_METAFILEPRIMITIVE2D_HXX
26 
27 #include <drawinglayer/drawinglayerdllapi.h>
28 #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
29 #include <basegfx/matrix/b2dhommatrix.hxx>
30 #include <vcl/gdimtf.hxx>
31 
32 //////////////////////////////////////////////////////////////////////////////
33 // MetafilePrimitive2D class
34 
35 namespace drawinglayer
36 {
37 	namespace primitive2d
38 	{
39         /** MetafilePrimitive2D class
40 
41             This is the MetaFile representing primitive. It's geometry is defined
42             by MetaFileTransform. The content (defined by MetaFile) will be scaled
43             to the geometric definiton by using PrefMapMode and PrefSize of the
44             Metafile.
45 
46             It has shown that this not always guarantees that all Metafile content
47             is inside the geometric definition, but this primitive defines that this
48             is the case to allow a getB2DRange implementation. If it cannot be
49             guaranteed that the Metafile is inside the geometric definition, it should
50             be embedded to a MaskPrimitive2D.
51 
52             This primitive has no decomposition yet, so when not supported by a renderer,
53             it will not be visualized.
54 
55             In the future, a decomposition implementation would be appreciated and would
56             have many advantages; Metafile would no longer have to be rendered by
57             sub-systems and a standard way for converting Metafiles would exist.
58          */
59 		class DRAWINGLAYER_DLLPUBLIC MetafilePrimitive2D : public BufferedDecompositionPrimitive2D
60 		{
61 		private:
62             /// the geometry definition
63 			basegfx::B2DHomMatrix						maMetaFileTransform;
64 
65             /// the content definition
66 			GDIMetaFile									maMetaFile;
67 
68         protected:
69 			/// local decomposition.
70 			virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
71 		public:
72             /// constructor
73 			MetafilePrimitive2D(
74 				const basegfx::B2DHomMatrix& rMetaFileTransform,
75 				const GDIMetaFile& rMetaFile);
76 
77 			/// data read access
getTransform() const78 			const basegfx::B2DHomMatrix& getTransform() const { return maMetaFileTransform; }
getMetaFile() const79 			const GDIMetaFile& getMetaFile() const { return maMetaFile; }
80 
81 			/// compare operator
82 			virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
83 
84 			/// get range
85 			virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
86 
87 			/// provide unique ID
88 			DeclPrimitrive2DIDBlock()
89 		};
90 	} // end of namespace primitive2d
91 } // end of namespace drawinglayer
92 
93 //////////////////////////////////////////////////////////////////////////////
94 
95 #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_METAFILEPRIMITIVE2D_HXX
96 
97 //////////////////////////////////////////////////////////////////////////////
98 // eof
99