tdf#130857 qt weld: Implement QtInstanceWidget::get_text_height
[LibreOffice.git] / drawinglayer / source / primitive2d / epsprimitive2d.cxx
blob760d5d764c41696e608500c6bf60a6c8e3848077
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>
23 #include <utility>
25 namespace drawinglayer::primitive2d
27 Primitive2DReference EpsPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
29 const GDIMetaFile& rSubstituteContent = getMetaFile();
31 if( rSubstituteContent.GetActionSize() )
33 // the default decomposition will use the Metafile replacement visualisation.
34 // To really use the Eps data, a renderer has to know and interpret this primitive
35 // directly.
37 return
38 new MetafilePrimitive2D(
39 getEpsTransform(),
40 rSubstituteContent);
42 return nullptr;
45 EpsPrimitive2D::EpsPrimitive2D(
46 basegfx::B2DHomMatrix aEpsTransform,
47 GfxLink aGfxLink,
48 const GDIMetaFile& rMetaFile)
49 : maEpsTransform(std::move(aEpsTransform)),
50 maGfxLink(std::move(aGfxLink)),
51 maMetaFile(rMetaFile)
55 bool EpsPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
57 if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
59 const EpsPrimitive2D& rCompare = static_cast<const EpsPrimitive2D&>(rPrimitive);
61 return (getEpsTransform() == rCompare.getEpsTransform()
62 && getGfxLink() == rCompare.getGfxLink()
63 && getMetaFile() == rCompare.getMetaFile());
66 return false;
69 basegfx::B2DRange EpsPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
71 // use own implementation to quickly answer the getB2DRange question.
72 basegfx::B2DRange aRetval(0.0, 0.0, 1.0, 1.0);
73 aRetval.transform(getEpsTransform());
75 return aRetval;
78 // provide unique ID
79 sal_uInt32 EpsPrimitive2D::getPrimitive2DID() const
81 return PRIMITIVE2D_ID_EPSPRIMITIVE2D;
84 } // end of namespace
86 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */