1*464702f4SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*464702f4SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*464702f4SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*464702f4SAndrew Rist  * distributed with this work for additional information
6*464702f4SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*464702f4SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*464702f4SAndrew Rist  * "License"); you may not use this file except in compliance
9*464702f4SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*464702f4SAndrew Rist  *
11*464702f4SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*464702f4SAndrew Rist  *
13*464702f4SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*464702f4SAndrew Rist  * software distributed under the License is distributed on an
15*464702f4SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*464702f4SAndrew Rist  * KIND, either express or implied.  See the License for the
17*464702f4SAndrew Rist  * specific language governing permissions and limitations
18*464702f4SAndrew Rist  * under the License.
19*464702f4SAndrew Rist  *
20*464702f4SAndrew Rist  *************************************************************/
21*464702f4SAndrew Rist 
22*464702f4SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_drawinglayer.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <drawinglayer/primitive2d/epsprimitive2d.hxx>
28cdf0e10cSrcweir #include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
29cdf0e10cSrcweir #include <drawinglayer/primitive2d/metafileprimitive2d.hxx>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
32cdf0e10cSrcweir 
33cdf0e10cSrcweir namespace drawinglayer
34cdf0e10cSrcweir {
35cdf0e10cSrcweir 	namespace primitive2d
36cdf0e10cSrcweir 	{
create2DDecomposition(const geometry::ViewInformation2D &) const37cdf0e10cSrcweir 		Primitive2DSequence EpsPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
38cdf0e10cSrcweir 		{
39cdf0e10cSrcweir 			Primitive2DSequence xRetval;
40cdf0e10cSrcweir 			const GDIMetaFile& rSubstituteContent = getMetaFile();
41cdf0e10cSrcweir 
42cdf0e10cSrcweir 			if(rSubstituteContent.GetActionCount())
43cdf0e10cSrcweir 			{
44cdf0e10cSrcweir 				// the default decomposition will use the Metafile replacement visualisation.
45cdf0e10cSrcweir 				// To really use the Eps data, a renderer has to know and interpret this primitive
46cdf0e10cSrcweir 				// directly.
47cdf0e10cSrcweir 				xRetval.realloc(1);
48cdf0e10cSrcweir 
49cdf0e10cSrcweir 				xRetval[0] = Primitive2DReference(
50cdf0e10cSrcweir 					new MetafilePrimitive2D(
51cdf0e10cSrcweir 						getEpsTransform(),
52cdf0e10cSrcweir 						rSubstituteContent));
53cdf0e10cSrcweir 			}
54cdf0e10cSrcweir 
55cdf0e10cSrcweir 			return xRetval;
56cdf0e10cSrcweir 		}
57cdf0e10cSrcweir 
EpsPrimitive2D(const basegfx::B2DHomMatrix & rEpsTransform,const GfxLink & rGfxLink,const GDIMetaFile & rMetaFile)58cdf0e10cSrcweir 		EpsPrimitive2D::EpsPrimitive2D(
59cdf0e10cSrcweir 			const basegfx::B2DHomMatrix& rEpsTransform,
60cdf0e10cSrcweir 			const GfxLink& rGfxLink,
61cdf0e10cSrcweir 			const GDIMetaFile& rMetaFile)
62cdf0e10cSrcweir 		:	BufferedDecompositionPrimitive2D(),
63cdf0e10cSrcweir 			maEpsTransform(rEpsTransform),
64cdf0e10cSrcweir 			maGfxLink(rGfxLink),
65cdf0e10cSrcweir 			maMetaFile(rMetaFile)
66cdf0e10cSrcweir 		{
67cdf0e10cSrcweir 		}
68cdf0e10cSrcweir 
operator ==(const BasePrimitive2D & rPrimitive) const69cdf0e10cSrcweir 		bool EpsPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
70cdf0e10cSrcweir 		{
71cdf0e10cSrcweir 			if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
72cdf0e10cSrcweir 			{
73cdf0e10cSrcweir 				const EpsPrimitive2D& rCompare = (EpsPrimitive2D&)rPrimitive;
74cdf0e10cSrcweir 
75cdf0e10cSrcweir 				return (getEpsTransform() == rCompare.getEpsTransform()
76cdf0e10cSrcweir 					&& getGfxLink().IsEqual(rCompare.getGfxLink())
77cdf0e10cSrcweir 					&& getMetaFile() == rCompare.getMetaFile());
78cdf0e10cSrcweir 			}
79cdf0e10cSrcweir 
80cdf0e10cSrcweir 			return false;
81cdf0e10cSrcweir 		}
82cdf0e10cSrcweir 
getB2DRange(const geometry::ViewInformation2D &) const83cdf0e10cSrcweir 		basegfx::B2DRange EpsPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
84cdf0e10cSrcweir 		{
85cdf0e10cSrcweir 			// use own implementation to quickly answer the getB2DRange question.
86cdf0e10cSrcweir 			basegfx::B2DRange aRetval(0.0, 0.0, 1.0, 1.0);
87cdf0e10cSrcweir 			aRetval.transform(getEpsTransform());
88cdf0e10cSrcweir 
89cdf0e10cSrcweir 			return aRetval;
90cdf0e10cSrcweir 		}
91cdf0e10cSrcweir 
92cdf0e10cSrcweir 		// provide unique ID
93cdf0e10cSrcweir 		ImplPrimitrive2DIDBlock(EpsPrimitive2D, PRIMITIVE2D_ID_EPSPRIMITIVE2D)
94cdf0e10cSrcweir 
95cdf0e10cSrcweir 	} // end of namespace primitive2d
96cdf0e10cSrcweir } // end of namespace drawinglayer
97cdf0e10cSrcweir 
98cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
99cdf0e10cSrcweir // eof
100