bump product version to 4.1.6.2
[LibreOffice.git] / svx / source / sdr / primitive2d / sdrpathprimitive2d.cxx
blob7f213fa2a72424893e96a412cde4ec9255adceff
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 <svx/sdr/primitive2d/sdrpathprimitive2d.hxx>
21 #include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
22 #include <basegfx/polygon/b2dpolypolygontools.hxx>
23 #include <drawinglayer/primitive2d/groupprimitive2d.hxx>
24 #include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
25 #include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
27 //////////////////////////////////////////////////////////////////////////////
29 using namespace com::sun::star;
31 //////////////////////////////////////////////////////////////////////////////
33 namespace drawinglayer
35 namespace primitive2d
37 Primitive2DSequence SdrPathPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const
39 Primitive2DSequence aRetval;
41 // add fill
42 if(!getSdrLFSTAttribute().getFill().isDefault()
43 && getUnitPolyPolygon().isClosed())
45 // #i108255# no need to use correctOrientations here; target is
46 // straight visualisation
47 appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
48 createPolyPolygonFillPrimitive(
49 getUnitPolyPolygon(),
50 getTransform(),
51 getSdrLFSTAttribute().getFill(),
52 getSdrLFSTAttribute().getFillFloatTransGradient()));
55 // add line
56 if(getSdrLFSTAttribute().getLine().isDefault())
58 // if initially no line is defined, create one for HitTest and BoundRect
59 appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
60 createHiddenGeometryPrimitives2D(
61 false,
62 getUnitPolyPolygon(),
63 getTransform()));
65 else
67 Primitive2DSequence aTemp(getUnitPolyPolygon().count());
69 for(sal_uInt32 a(0); a < getUnitPolyPolygon().count(); a++)
71 aTemp[a] = createPolygonLinePrimitive(
72 getUnitPolyPolygon().getB2DPolygon(a),
73 getTransform(),
74 getSdrLFSTAttribute().getLine(),
75 getSdrLFSTAttribute().getLineStartEnd());
78 appendPrimitive2DSequenceToPrimitive2DSequence(aRetval, aTemp);
81 // add text
82 if(!getSdrLFSTAttribute().getText().isDefault())
84 appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
85 createTextPrimitive(
86 getUnitPolyPolygon(),
87 getTransform(),
88 getSdrLFSTAttribute().getText(),
89 getSdrLFSTAttribute().getLine(),
90 false,
91 false,
92 false));
95 // add shadow
96 if(!getSdrLFSTAttribute().getShadow().isDefault())
98 aRetval = createEmbeddedShadowPrimitive(
99 aRetval,
100 getSdrLFSTAttribute().getShadow());
103 return aRetval;
106 SdrPathPrimitive2D::SdrPathPrimitive2D(
107 const basegfx::B2DHomMatrix& rTransform,
108 const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute,
109 const basegfx::B2DPolyPolygon& rUnitPolyPolygon)
110 : BufferedDecompositionPrimitive2D(),
111 maTransform(rTransform),
112 maSdrLFSTAttribute(rSdrLFSTAttribute),
113 maUnitPolyPolygon(rUnitPolyPolygon)
117 bool SdrPathPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
119 if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
121 const SdrPathPrimitive2D& rCompare = (SdrPathPrimitive2D&)rPrimitive;
123 return (getUnitPolyPolygon() == rCompare.getUnitPolyPolygon()
124 && getTransform() == rCompare.getTransform()
125 && getSdrLFSTAttribute() == rCompare.getSdrLFSTAttribute());
128 return false;
131 // provide unique ID
132 ImplPrimitive2DIDBlock(SdrPathPrimitive2D, PRIMITIVE2D_ID_SDRPATHPRIMITIVE2D)
134 } // end of namespace primitive2d
135 } // end of namespace drawinglayer
137 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */