LibreOffice Module svx (master) 1
sdrpathprimitive2d.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
24#include <utility>
25
26
27using namespace com::sun::star;
28
29
31{
33 {
35
36 // add fill
37 if(!getSdrLFSTAttribute().getFill().isDefault()
38 && getUnitPolyPolygon().isClosed())
39 {
40 // #i108255# no need to use correctOrientations here; target is
41 // straight visualisation
43 aTransformed.transform(getTransform());
44
45 // OperationSmiley: Check if a UnitDefinitionPolyPolygon is set
48 {
49 // if yes, use the B2DRange of it's transformed form
51 aTransformedDefinition.transform(getTransform());
52
53 aRetval.push_back(
55 aTransformed,
56 aTransformedDefinition.getB2DRange(),
57 getSdrLFSTAttribute().getFill(),
58 getSdrLFSTAttribute().getFillFloatTransGradient()));
59 }
60 else
61 {
62 aRetval.push_back(
64 aTransformed,
65 getSdrLFSTAttribute().getFill(),
66 getSdrLFSTAttribute().getFillFloatTransGradient()));
67 }
68 }
69
70 // add line
71 if(getSdrLFSTAttribute().getLine().isDefault())
72 {
73 // if initially no line is defined, create one for HitTest and BoundRect
74 aRetval.push_back(
76 false,
78 getTransform()));
79 }
80 else
81 {
83
84 for(sal_uInt32 a(0); a < getUnitPolyPolygon().count(); a++)
85 {
86 basegfx::B2DPolygon aTransformed(getUnitPolyPolygon().getB2DPolygon(a));
87
88 aTransformed.transform(getTransform());
90 aTransformed,
91 getSdrLFSTAttribute().getLine(),
92 getSdrLFSTAttribute().getLineStartEnd());
93 }
94
95 aRetval.append(aTemp);
96 }
97
98 // add text
99 if(!getSdrLFSTAttribute().getText().isDefault())
100 {
101 aRetval.push_back(
104 getTransform(),
105 getSdrLFSTAttribute().getText(),
106 getSdrLFSTAttribute().getLine(),
107 false,
108 false));
109 }
110
111 // add shadow
112 if(!getSdrLFSTAttribute().getShadow().isDefault())
113 {
115 std::move(aRetval),
116 getSdrLFSTAttribute().getShadow());
117 }
118
119 rContainer.append(std::move(aRetval));
120 }
121
123 basegfx::B2DHomMatrix aTransform,
124 const attribute::SdrLineFillEffectsTextAttribute& rSdrLFSTAttribute,
125 basegfx::B2DPolyPolygon aUnitPolyPolygon,
126 basegfx::B2DPolyPolygon aUnitDefinitionPolyPolygon)
127 : maTransform(std::move(aTransform)),
128 maSdrLFSTAttribute(rSdrLFSTAttribute),
129 maUnitPolyPolygon(std::move(aUnitPolyPolygon)),
130 maUnitDefinitionPolyPolygon(std::move(aUnitDefinitionPolyPolygon))
131 {
132 }
133
135 {
136 if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
137 {
138 const SdrPathPrimitive2D& rCompare = static_cast<const SdrPathPrimitive2D&>(rPrimitive);
139
140 return (getUnitPolyPolygon() == rCompare.getUnitPolyPolygon()
142 && getTransform() == rCompare.getTransform()
143 && getSdrLFSTAttribute() == rCompare.getSdrLFSTAttribute());
144 }
145
146 return false;
147 }
148
149 // provide unique ID
151 {
153 }
154
155} // end of namespace
156
157/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void transform(const basegfx::B2DHomMatrix &rMatrix)
B2DRange getB2DRange() const
sal_uInt32 count() const
void transform(const basegfx::B2DHomMatrix &rMatrix)
void append(const Primitive2DReference &)
virtual sal_uInt32 getPrimitive2DID() const override
virtual bool operator==(const BasePrimitive2D &rPrimitive) const override
virtual void create2DDecomposition(Primitive2DContainer &rContainer, const geometry::ViewInformation2D &aViewInformation) const override
SdrPathPrimitive2D(basegfx::B2DHomMatrix aTransform, const attribute::SdrLineFillEffectsTextAttribute &rSdrLFSTAttribute, basegfx::B2DPolyPolygon aUnitPolyPolygon, basegfx::B2DPolyPolygon aUnitDefinitionPolyPolygon)
const basegfx::B2DHomMatrix & getTransform() const
const attribute::SdrLineFillEffectsTextAttribute & getSdrLFSTAttribute() const
const basegfx::B2DPolyPolygon & getUnitPolyPolygon() const
const basegfx::B2DPolyPolygon & getUnitDefinitionPolyPolygon() const
uno_Any a
Primitive2DReference createHiddenGeometryPrimitives2D(const basegfx::B2DHomMatrix &rMatrix)
Primitive2DContainer createEmbeddedShadowPrimitive(Primitive2DContainer &&rContent, const attribute::SdrShadowAttribute &rShadow, const basegfx::B2DHomMatrix &rObjectMatrix, const Primitive2DContainer *pContentForShadow)
Primitive2DReference createPolygonLinePrimitive(const basegfx::B2DPolygon &rPolygon, const attribute::SdrLineAttribute &rLine, const attribute::SdrLineStartEndAttribute &rStroke)
Primitive2DReference createTextPrimitive(const basegfx::B2DPolyPolygon &rUnitPolyPolygon, const basegfx::B2DHomMatrix &rObjectTransform, const attribute::SdrTextAttribute &rText, const attribute::SdrLineAttribute &rStroke, bool bCellText, bool bWordWrap)
Primitive2DReference createPolyPolygonFillPrimitive(const basegfx::B2DPolyPolygon &rPolyPolygon, const attribute::SdrFillAttribute &rFill, const attribute::FillGradientAttribute &rFillGradient)
#define PRIMITIVE2D_ID_SDRPATHPRIMITIVE2D
basegfx::B2DHomMatrix maTransform