Line data Source code
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 :
20 : #include <drawinglayer/primitive2d/epsprimitive2d.hxx>
21 : #include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
22 : #include <drawinglayer/primitive2d/metafileprimitive2d.hxx>
23 :
24 : namespace drawinglayer
25 : {
26 : namespace primitive2d
27 : {
28 0 : Primitive2DSequence EpsPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
29 : {
30 0 : Primitive2DSequence xRetval;
31 0 : const GDIMetaFile& rSubstituteContent = getMetaFile();
32 :
33 0 : if( rSubstituteContent.GetActionSize() )
34 : {
35 : // the default decomposition will use the Metafile replacement visualisation.
36 : // To really use the Eps data, a renderer has to know and interpret this primitive
37 : // directly.
38 0 : xRetval.realloc(1);
39 :
40 0 : xRetval[0] = Primitive2DReference(
41 : new MetafilePrimitive2D(
42 : getEpsTransform(),
43 0 : rSubstituteContent));
44 : }
45 :
46 0 : return xRetval;
47 : }
48 :
49 0 : EpsPrimitive2D::EpsPrimitive2D(
50 : const basegfx::B2DHomMatrix& rEpsTransform,
51 : const GfxLink& rGfxLink,
52 : const GDIMetaFile& rMetaFile)
53 : : BufferedDecompositionPrimitive2D(),
54 : maEpsTransform(rEpsTransform),
55 : maGfxLink(rGfxLink),
56 0 : maMetaFile(rMetaFile)
57 : {
58 0 : }
59 :
60 0 : bool EpsPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
61 : {
62 0 : if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
63 : {
64 0 : const EpsPrimitive2D& rCompare = (EpsPrimitive2D&)rPrimitive;
65 :
66 0 : return (getEpsTransform() == rCompare.getEpsTransform()
67 0 : && getGfxLink().IsEqual(rCompare.getGfxLink())
68 0 : && getMetaFile() == rCompare.getMetaFile());
69 : }
70 :
71 0 : return false;
72 : }
73 :
74 0 : basegfx::B2DRange EpsPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
75 : {
76 : // use own implementation to quickly answer the getB2DRange question.
77 0 : basegfx::B2DRange aRetval(0.0, 0.0, 1.0, 1.0);
78 0 : aRetval.transform(getEpsTransform());
79 :
80 0 : return aRetval;
81 : }
82 :
83 : // provide unique ID
84 0 : ImplPrimitive2DIDBlock(EpsPrimitive2D, PRIMITIVE2D_ID_EPSPRIMITIVE2D)
85 :
86 : } // end of namespace primitive2d
87 : } // end of namespace drawinglayer
88 :
89 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|