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