Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / drawinglayer / source / primitive2d / epsprimitive2d.cxx
blob533cdb30ce52175983f95f8269991b43278ed111
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <drawinglayer/primitive2d/epsprimitive2d.hxx>
21 #include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
22 #include <drawinglayer/primitive2d/metafileprimitive2d.hxx>
24 namespace drawinglayer
26 namespace primitive2d
28 void EpsPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
30 const GDIMetaFile& rSubstituteContent = getMetaFile();
32 if( rSubstituteContent.GetActionSize() )
34 // the default decomposition will use the Metafile replacement visualisation.
35 // To really use the Eps data, a renderer has to know and interpret this primitive
36 // directly.
38 rContainer.push_back(
39 new MetafilePrimitive2D(
40 getEpsTransform(),
41 rSubstituteContent));
45 EpsPrimitive2D::EpsPrimitive2D(
46 const basegfx::B2DHomMatrix& rEpsTransform,
47 const GfxLink& rGfxLink,
48 const GDIMetaFile& rMetaFile)
49 : BufferedDecompositionPrimitive2D(),
50 maEpsTransform(rEpsTransform),
51 maGfxLink(rGfxLink),
52 maMetaFile(rMetaFile)
56 bool EpsPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
58 if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
60 const EpsPrimitive2D& rCompare = static_cast<const EpsPrimitive2D&>(rPrimitive);
62 return (getEpsTransform() == rCompare.getEpsTransform()
63 && getGfxLink() == rCompare.getGfxLink()
64 && getMetaFile() == rCompare.getMetaFile());
67 return false;
70 basegfx::B2DRange EpsPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
72 // use own implementation to quickly answer the getB2DRange question.
73 basegfx::B2DRange aRetval(0.0, 0.0, 1.0, 1.0);
74 aRetval.transform(getEpsTransform());
76 return aRetval;
79 // provide unique ID
80 ImplPrimitive2DIDBlock(EpsPrimitive2D, PRIMITIVE2D_ID_EPSPRIMITIVE2D)
82 } // end of namespace primitive2d
83 } // end of namespace drawinglayer
85 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */