1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 <sdr/primitive2d/sdrconnectorprimitive2d.hxx>
21 #include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
22 #include <basegfx/matrix/b2dhommatrix.hxx>
23 #include <drawinglayer/primitive2d/groupprimitive2d.hxx>
24 #include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
25 #include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
26 #include <basegfx/polygon/b2dpolypolygon.hxx>
30 using namespace com::sun::star
;
34 namespace drawinglayer
38 Primitive2DSequence
SdrConnectorPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D
& /*aViewInformation*/) const
40 Primitive2DSequence aRetval
;
43 if(getSdrLSTAttribute().getLine().isDefault())
45 // create invisible line for HitTest/BoundRect
46 appendPrimitive2DReferenceToPrimitive2DSequence(aRetval
,
47 createHiddenGeometryPrimitives2D(
49 basegfx::B2DPolyPolygon(getUnitPolygon())));
53 appendPrimitive2DReferenceToPrimitive2DSequence(aRetval
,
54 createPolygonLinePrimitive(
56 getSdrLSTAttribute().getLine(),
57 getSdrLSTAttribute().getLineStartEnd()));
61 if(!getSdrLSTAttribute().getText().isDefault())
63 appendPrimitive2DReferenceToPrimitive2DSequence(aRetval
,
65 basegfx::B2DPolyPolygon(getUnitPolygon()),
66 basegfx::B2DHomMatrix(),
67 getSdrLSTAttribute().getText(),
68 getSdrLSTAttribute().getLine(),
75 if(!getSdrLSTAttribute().getShadow().isDefault())
77 aRetval
= createEmbeddedShadowPrimitive(
79 getSdrLSTAttribute().getShadow());
85 SdrConnectorPrimitive2D::SdrConnectorPrimitive2D(
86 const attribute::SdrLineShadowTextAttribute
& rSdrLSTAttribute
,
87 const ::basegfx::B2DPolygon
& rUnitPolygon
)
88 : BufferedDecompositionPrimitive2D(),
89 maSdrLSTAttribute(rSdrLSTAttribute
),
90 maUnitPolygon(rUnitPolygon
)
94 bool SdrConnectorPrimitive2D::operator==(const BasePrimitive2D
& rPrimitive
) const
96 if(BufferedDecompositionPrimitive2D::operator==(rPrimitive
))
98 const SdrConnectorPrimitive2D
& rCompare
= static_cast<const SdrConnectorPrimitive2D
&>(rPrimitive
);
100 return (getUnitPolygon() == rCompare
.getUnitPolygon()
101 && getSdrLSTAttribute() == rCompare
.getSdrLSTAttribute());
108 ImplPrimitive2DIDBlock(SdrConnectorPrimitive2D
, PRIMITIVE2D_ID_SDRCONNECTORPRIMITIVE2D
)
110 } // end of namespace primitive2d
111 } // end of namespace drawinglayer
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */