Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / svx / source / sdr / primitive2d / sdrconnectorprimitive2d.cxx
blobccfc5c111d976b46f56b7ae9298b55c8fb81c559
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>
26 #include <utility>
29 using namespace com::sun::star;
32 namespace drawinglayer::primitive2d
34 void SdrConnectorPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*aViewInformation*/) const
36 Primitive2DContainer aRetval;
38 // add line
39 if(getSdrLSTAttribute().getLine().isDefault())
41 // create invisible line for HitTest/BoundRect
42 aRetval.push_back(
43 createHiddenGeometryPrimitives2D(
44 basegfx::B2DPolyPolygon(getUnitPolygon())));
46 else
48 aRetval.push_back(
49 createPolygonLinePrimitive(
50 getUnitPolygon(),
51 getSdrLSTAttribute().getLine(),
52 getSdrLSTAttribute().getLineStartEnd()));
55 // add text
56 if(!getSdrLSTAttribute().getText().isDefault())
58 aRetval.push_back(
59 createTextPrimitive(
60 basegfx::B2DPolyPolygon(getUnitPolygon()),
61 basegfx::B2DHomMatrix(),
62 getSdrLSTAttribute().getText(),
63 getSdrLSTAttribute().getLine(),
64 false,
65 false));
68 // add shadow
69 if(!getSdrLSTAttribute().getShadow().isDefault())
71 aRetval = createEmbeddedShadowPrimitive(
72 std::move(aRetval),
73 getSdrLSTAttribute().getShadow());
76 rContainer.append(std::move(aRetval));
79 SdrConnectorPrimitive2D::SdrConnectorPrimitive2D(
80 const attribute::SdrLineEffectsTextAttribute& rSdrLSTAttribute,
81 ::basegfx::B2DPolygon aUnitPolygon)
82 : maSdrLSTAttribute(rSdrLSTAttribute),
83 maUnitPolygon(std::move(aUnitPolygon))
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 sal_uInt32 SdrConnectorPrimitive2D::getPrimitive2DID() const
103 return PRIMITIVE2D_ID_SDRCONNECTORPRIMITIVE2D;
106 } // end of namespace
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */