LibreOffice Module drawinglayer (master) 1
epsprimitive2d.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
23#include <utility>
24
26{
28 {
29 const GDIMetaFile& rSubstituteContent = getMetaFile();
30
31 if( rSubstituteContent.GetActionSize() )
32 {
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.
36
37 rContainer.push_back(
40 rSubstituteContent));
41 }
42 }
43
45 basegfx::B2DHomMatrix aEpsTransform,
46 GfxLink aGfxLink,
47 const GDIMetaFile& rMetaFile)
48 : maEpsTransform(std::move(aEpsTransform)),
49 maGfxLink(std::move(aGfxLink)),
50 maMetaFile(rMetaFile)
51 {
52 }
53
54 bool EpsPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
55 {
56 if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
57 {
58 const EpsPrimitive2D& rCompare = static_cast<const EpsPrimitive2D&>(rPrimitive);
59
60 return (getEpsTransform() == rCompare.getEpsTransform()
61 && getGfxLink() == rCompare.getGfxLink()
62 && getMetaFile() == rCompare.getMetaFile());
63 }
64
65 return false;
66 }
67
69 {
70 // use own implementation to quickly answer the getB2DRange question.
71 basegfx::B2DRange aRetval(0.0, 0.0, 1.0, 1.0);
72 aRetval.transform(getEpsTransform());
73
74 return aRetval;
75 }
76
77 // provide unique ID
79 {
81 }
82
83} // end of namespace
84
85/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
size_t GetActionSize() const
BASEGFX_DLLPUBLIC void transform(const B2DHomMatrix &rMatrix)
const GDIMetaFile & getMetaFile() const
virtual void create2DDecomposition(Primitive2DContainer &rContainer, const geometry::ViewInformation2D &rViewInformation) const override
create local decomposition
virtual sal_uInt32 getPrimitive2DID() const override
provide unique ID
virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D &rViewInformation) const override
get B2Drange
EpsPrimitive2D(basegfx::B2DHomMatrix aEpsTransform, GfxLink aGfxLink, const GDIMetaFile &rMetaFile)
constructor
virtual bool operator==(const BasePrimitive2D &rPrimitive) const override
compare operator
const basegfx::B2DHomMatrix & getEpsTransform() const
data read access
#define PRIMITIVE2D_ID_EPSPRIMITIVE2D