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 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_drawinglayer.hxx" 26 27 #include <drawinglayer/primitive2d/epsprimitive2d.hxx> 28 #include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx> 29 #include <drawinglayer/primitive2d/metafileprimitive2d.hxx> 30 31 ////////////////////////////////////////////////////////////////////////////// 32 33 namespace drawinglayer 34 { 35 namespace primitive2d 36 { create2DDecomposition(const geometry::ViewInformation2D &) const37 Primitive2DSequence EpsPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const 38 { 39 Primitive2DSequence xRetval; 40 const GDIMetaFile& rSubstituteContent = getMetaFile(); 41 42 if(rSubstituteContent.GetActionCount()) 43 { 44 // the default decomposition will use the Metafile replacement visualisation. 45 // To really use the Eps data, a renderer has to know and interpret this primitive 46 // directly. 47 xRetval.realloc(1); 48 49 xRetval[0] = Primitive2DReference( 50 new MetafilePrimitive2D( 51 getEpsTransform(), 52 rSubstituteContent)); 53 } 54 55 return xRetval; 56 } 57 EpsPrimitive2D(const basegfx::B2DHomMatrix & rEpsTransform,const GfxLink & rGfxLink,const GDIMetaFile & rMetaFile)58 EpsPrimitive2D::EpsPrimitive2D( 59 const basegfx::B2DHomMatrix& rEpsTransform, 60 const GfxLink& rGfxLink, 61 const GDIMetaFile& rMetaFile) 62 : BufferedDecompositionPrimitive2D(), 63 maEpsTransform(rEpsTransform), 64 maGfxLink(rGfxLink), 65 maMetaFile(rMetaFile) 66 { 67 } 68 operator ==(const BasePrimitive2D & rPrimitive) const69 bool EpsPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const 70 { 71 if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) 72 { 73 const EpsPrimitive2D& rCompare = (EpsPrimitive2D&)rPrimitive; 74 75 return (getEpsTransform() == rCompare.getEpsTransform() 76 && getGfxLink().IsEqual(rCompare.getGfxLink()) 77 && getMetaFile() == rCompare.getMetaFile()); 78 } 79 80 return false; 81 } 82 getB2DRange(const geometry::ViewInformation2D &) const83 basegfx::B2DRange EpsPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const 84 { 85 // use own implementation to quickly answer the getB2DRange question. 86 basegfx::B2DRange aRetval(0.0, 0.0, 1.0, 1.0); 87 aRetval.transform(getEpsTransform()); 88 89 return aRetval; 90 } 91 92 // provide unique ID 93 ImplPrimitrive2DIDBlock(EpsPrimitive2D, PRIMITIVE2D_ID_EPSPRIMITIVE2D) 94 95 } // end of namespace primitive2d 96 } // end of namespace drawinglayer 97 98 ////////////////////////////////////////////////////////////////////////////// 99 // eof 100