tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / svx / source / sdr / primitive2d / sdrconnectorprimitive2d.cxx
blobece9bc81296080dfa272caeadd0b097c3ec12c14
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 <drawinglayer/primitive2d/groupprimitive2d.hxx>
26 #include <basegfx/polygon/b2dpolypolygon.hxx>
27 #include <utility>
30 using namespace com::sun::star;
33 namespace drawinglayer::primitive2d
35 Primitive2DReference SdrConnectorPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const
37 Primitive2DContainer aRetval;
39 // add line
40 if(getSdrLSTAttribute().getLine().isDefault())
42 // create invisible line for HitTest/BoundRect
43 aRetval.push_back(
44 createHiddenGeometryPrimitives2D(
45 basegfx::B2DPolyPolygon(getUnitPolygon())));
47 else
49 aRetval.push_back(
50 createPolygonLinePrimitive(
51 getUnitPolygon(),
52 getSdrLSTAttribute().getLine(),
53 getSdrLSTAttribute().getLineStartEnd()));
56 // add text
57 if(!getSdrLSTAttribute().getText().isDefault())
59 aRetval.push_back(
60 createTextPrimitive(
61 basegfx::B2DPolyPolygon(getUnitPolygon()),
62 basegfx::B2DHomMatrix(),
63 getSdrLSTAttribute().getText(),
64 getSdrLSTAttribute().getLine(),
65 false,
66 false));
69 // add shadow
70 if(!getSdrLSTAttribute().getShadow().isDefault())
72 aRetval = createEmbeddedShadowPrimitive(
73 std::move(aRetval),
74 getSdrLSTAttribute().getShadow());
77 return new GroupPrimitive2D(std::move(aRetval));
80 SdrConnectorPrimitive2D::SdrConnectorPrimitive2D(
81 const attribute::SdrLineEffectsTextAttribute& rSdrLSTAttribute,
82 ::basegfx::B2DPolygon aUnitPolygon)
83 : maSdrLSTAttribute(rSdrLSTAttribute),
84 maUnitPolygon(std::move(aUnitPolygon))
88 bool SdrConnectorPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
90 if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
92 const SdrConnectorPrimitive2D& rCompare = static_cast<const SdrConnectorPrimitive2D&>(rPrimitive);
94 return (getUnitPolygon() == rCompare.getUnitPolygon()
95 && getSdrLSTAttribute() == rCompare.getSdrLSTAttribute());
98 return false;
101 // provide unique ID
102 sal_uInt32 SdrConnectorPrimitive2D::getPrimitive2DID() const
104 return PRIMITIVE2D_ID_SDRCONNECTORPRIMITIVE2D;
107 } // end of namespace
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */