Version 7.1.7.1, tag libreoffice-7.1.7.1
[LibreOffice.git] / svx / source / sdr / primitive2d / sdrconnectorprimitive2d.cxx
blob8b5c8413ccdf45777924e9933b40a564a64f4a1e
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 <sdr/primitive2d/sdrconnectorprimitive2d.hxx>
21 #include <sdr/primitive2d/sdrdecompositiontools.hxx>
22 #include <basegfx/matrix/b2dhommatrix.hxx>
23 #include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
24 #include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
25 #include <basegfx/polygon/b2dpolypolygon.hxx>
28 using namespace com::sun::star;
31 namespace drawinglayer::primitive2d
33 void SdrConnectorPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*aViewInformation*/) const
35 Primitive2DContainer aRetval;
37 // add line
38 if(getSdrLSTAttribute().getLine().isDefault())
40 // create invisible line for HitTest/BoundRect
41 aRetval.push_back(
42 createHiddenGeometryPrimitives2D(
43 basegfx::B2DPolyPolygon(getUnitPolygon())));
45 else
47 aRetval.push_back(
48 createPolygonLinePrimitive(
49 getUnitPolygon(),
50 getSdrLSTAttribute().getLine(),
51 getSdrLSTAttribute().getLineStartEnd()));
54 // add text
55 if(!getSdrLSTAttribute().getText().isDefault())
57 aRetval.push_back(
58 createTextPrimitive(
59 basegfx::B2DPolyPolygon(getUnitPolygon()),
60 basegfx::B2DHomMatrix(),
61 getSdrLSTAttribute().getText(),
62 getSdrLSTAttribute().getLine(),
63 false,
64 false));
67 // add shadow
68 if(!getSdrLSTAttribute().getShadow().isDefault())
70 aRetval = createEmbeddedShadowPrimitive(
71 aRetval,
72 getSdrLSTAttribute().getShadow());
75 rContainer.insert(rContainer.end(), aRetval.begin(), aRetval.end());
78 SdrConnectorPrimitive2D::SdrConnectorPrimitive2D(
79 const attribute::SdrLineEffectsTextAttribute& rSdrLSTAttribute,
80 const ::basegfx::B2DPolygon& rUnitPolygon)
81 : BufferedDecompositionPrimitive2D(),
82 maSdrLSTAttribute(rSdrLSTAttribute),
83 maUnitPolygon(rUnitPolygon)
87 bool SdrConnectorPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
89 if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
91 const SdrConnectorPrimitive2D& rCompare = static_cast<const SdrConnectorPrimitive2D&>(rPrimitive);
93 return (getUnitPolygon() == rCompare.getUnitPolygon()
94 && getSdrLSTAttribute() == rCompare.getSdrLSTAttribute());
97 return false;
100 // provide unique ID
101 ImplPrimitive2DIDBlock(SdrConnectorPrimitive2D, PRIMITIVE2D_ID_SDRCONNECTORPRIMITIVE2D)
103 } // end of namespace
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */