LibreOffice Module svx (master)  1
sdrconnectorprimitive2d.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
26 
27 
28 using namespace com::sun::star;
29 
30 
32 {
33  void SdrConnectorPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*aViewInformation*/) const
34  {
35  Primitive2DContainer aRetval;
36 
37  // add line
38  if(getSdrLSTAttribute().getLine().isDefault())
39  {
40  // create invisible line for HitTest/BoundRect
41  aRetval.push_back(
43  basegfx::B2DPolyPolygon(getUnitPolygon())));
44  }
45  else
46  {
47  aRetval.push_back(
49  getUnitPolygon(),
50  getSdrLSTAttribute().getLine(),
51  getSdrLSTAttribute().getLineStartEnd()));
52  }
53 
54  // add text
55  if(!getSdrLSTAttribute().getText().isDefault())
56  {
57  aRetval.push_back(
59  basegfx::B2DPolyPolygon(getUnitPolygon()),
61  getSdrLSTAttribute().getText(),
62  getSdrLSTAttribute().getLine(),
63  false,
64  false));
65  }
66 
67  // add shadow
68  if(!getSdrLSTAttribute().getShadow().isDefault())
69  {
71  aRetval,
72  getSdrLSTAttribute().getShadow());
73  }
74 
75  rContainer.insert(rContainer.end(), aRetval.begin(), aRetval.end());
76  }
77 
78  SdrConnectorPrimitive2D::SdrConnectorPrimitive2D(
79  const attribute::SdrLineEffectsTextAttribute& rSdrLSTAttribute,
80  const ::basegfx::B2DPolygon& rUnitPolygon)
81  : maSdrLSTAttribute(rSdrLSTAttribute),
82  maUnitPolygon(rUnitPolygon)
83  {
84  }
85 
87  {
88  if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
89  {
90  const SdrConnectorPrimitive2D& rCompare = static_cast<const SdrConnectorPrimitive2D&>(rPrimitive);
91 
92  return (getUnitPolygon() == rCompare.getUnitPolygon()
93  && getSdrLSTAttribute() == rCompare.getSdrLSTAttribute());
94  }
95 
96  return false;
97  }
98 
99  // provide unique ID
101  {
103  }
104 
105 } // end of namespace
106 
107 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual bool operator==(const BasePrimitive2D &rPrimitive) const override
Primitive2DContainer createEmbeddedShadowPrimitive(const Primitive2DContainer &rContent, const attribute::SdrShadowAttribute &rShadow, const basegfx::B2DHomMatrix &rObjectMatrix, const Primitive2DContainer *pContentForShadow)
const attribute::SdrLineEffectsTextAttribute & getSdrLSTAttribute() const
#define PRIMITIVE2D_ID_SDRCONNECTORPRIMITIVE2D
Primitive2DReference createTextPrimitive(const basegfx::B2DPolyPolygon &rUnitPolyPolygon, const basegfx::B2DHomMatrix &rObjectTransform, const attribute::SdrTextAttribute &rText, const attribute::SdrLineAttribute &rStroke, bool bCellText, bool bWordWrap)
const ::basegfx::B2DPolygon & getUnitPolygon() const
Primitive2DReference createHiddenGeometryPrimitives2D(const basegfx::B2DHomMatrix &rMatrix)
Primitive2DReference createPolygonLinePrimitive(const basegfx::B2DPolygon &rPolygon, const attribute::SdrLineAttribute &rLine, const attribute::SdrLineStartEndAttribute &rStroke)