update credits
[LibreOffice.git] / svx / source / sdr / primitive2d / sdrconnectorprimitive2d.cxx
blob7bd7649a6851640057c2d8c7fdf3f316e1f31691
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/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>
28 //////////////////////////////////////////////////////////////////////////////
30 using namespace com::sun::star;
32 //////////////////////////////////////////////////////////////////////////////
34 namespace drawinglayer
36 namespace primitive2d
38 Primitive2DSequence SdrConnectorPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const
40 Primitive2DSequence aRetval;
42 // add line
43 if(getSdrLSTAttribute().getLine().isDefault())
45 // create invisible line for HitTest/BoundRect
46 appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
47 createHiddenGeometryPrimitives2D(
48 false,
49 basegfx::B2DPolyPolygon(getUnitPolygon())));
51 else
53 appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
54 createPolygonLinePrimitive(
55 getUnitPolygon(),
56 basegfx::B2DHomMatrix(),
57 getSdrLSTAttribute().getLine(),
58 getSdrLSTAttribute().getLineStartEnd()));
61 // add text
62 if(!getSdrLSTAttribute().getText().isDefault())
64 appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
65 createTextPrimitive(
66 basegfx::B2DPolyPolygon(getUnitPolygon()),
67 basegfx::B2DHomMatrix(),
68 getSdrLSTAttribute().getText(),
69 getSdrLSTAttribute().getLine(),
70 false,
71 false,
72 false));
75 // add shadow
76 if(!getSdrLSTAttribute().getShadow().isDefault())
78 aRetval = createEmbeddedShadowPrimitive(
79 aRetval,
80 getSdrLSTAttribute().getShadow());
83 return aRetval;
86 SdrConnectorPrimitive2D::SdrConnectorPrimitive2D(
87 const attribute::SdrLineShadowTextAttribute& rSdrLSTAttribute,
88 const ::basegfx::B2DPolygon& rUnitPolygon)
89 : BufferedDecompositionPrimitive2D(),
90 maSdrLSTAttribute(rSdrLSTAttribute),
91 maUnitPolygon(rUnitPolygon)
95 bool SdrConnectorPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
97 if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
99 const SdrConnectorPrimitive2D& rCompare = (SdrConnectorPrimitive2D&)rPrimitive;
101 return (getUnitPolygon() == rCompare.getUnitPolygon()
102 && getSdrLSTAttribute() == rCompare.getSdrLSTAttribute());
105 return false;
108 // provide unique ID
109 ImplPrimitive2DIDBlock(SdrConnectorPrimitive2D, PRIMITIVE2D_ID_SDRCONNECTORPRIMITIVE2D)
111 } // end of namespace primitive2d
112 } // end of namespace drawinglayer
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */