Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <drawinglayer/primitive2d/epsprimitive2d.hxx>
30 : : #include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
31 : : #include <drawinglayer/primitive2d/metafileprimitive2d.hxx>
32 : :
33 : : //////////////////////////////////////////////////////////////////////////////
34 : :
35 : : namespace drawinglayer
36 : : {
37 : : namespace primitive2d
38 : : {
39 : 0 : Primitive2DSequence EpsPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
40 : : {
41 : 0 : Primitive2DSequence xRetval;
42 : 0 : const GDIMetaFile& rSubstituteContent = getMetaFile();
43 : :
44 [ # # ][ # # ]: 0 : if( rSubstituteContent.GetActionSize() )
45 : : {
46 : : // the default decomposition will use the Metafile replacement visualisation.
47 : : // To really use the Eps data, a renderer has to know and interpret this primitive
48 : : // directly.
49 [ # # ]: 0 : xRetval.realloc(1);
50 : :
51 [ # # ]: 0 : xRetval[0] = Primitive2DReference(
52 : : new MetafilePrimitive2D(
53 : : getEpsTransform(),
54 [ # # ][ # # ]: 0 : rSubstituteContent));
[ # # ][ # # ]
55 : : }
56 : :
57 : 0 : return xRetval;
58 : : }
59 : :
60 : 0 : EpsPrimitive2D::EpsPrimitive2D(
61 : : const basegfx::B2DHomMatrix& rEpsTransform,
62 : : const GfxLink& rGfxLink,
63 : : const GDIMetaFile& rMetaFile)
64 : : : BufferedDecompositionPrimitive2D(),
65 : : maEpsTransform(rEpsTransform),
66 : : maGfxLink(rGfxLink),
67 [ # # ][ # # ]: 0 : maMetaFile(rMetaFile)
[ # # ]
68 : : {
69 : 0 : }
70 : :
71 : 0 : bool EpsPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
72 : : {
73 [ # # ]: 0 : if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
74 : : {
75 : 0 : const EpsPrimitive2D& rCompare = (EpsPrimitive2D&)rPrimitive;
76 : :
77 : 0 : return (getEpsTransform() == rCompare.getEpsTransform()
78 : 0 : && getGfxLink().IsEqual(rCompare.getGfxLink())
79 [ # # ]: 0 : && getMetaFile() == rCompare.getMetaFile());
[ # # # # ]
80 : : }
81 : :
82 : 0 : return false;
83 : : }
84 : :
85 : 0 : basegfx::B2DRange EpsPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
86 : : {
87 : : // use own implementation to quickly answer the getB2DRange question.
88 : 0 : basegfx::B2DRange aRetval(0.0, 0.0, 1.0, 1.0);
89 : 0 : aRetval.transform(getEpsTransform());
90 : :
91 : 0 : return aRetval;
92 : : }
93 : :
94 : : // provide unique ID
95 : 0 : ImplPrimitrive2DIDBlock(EpsPrimitive2D, PRIMITIVE2D_ID_EPSPRIMITIVE2D)
96 : :
97 : : } // end of namespace primitive2d
98 : : } // end of namespace drawinglayer
99 : :
100 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|