LibreOffice Module svx (master) 1
sdrcaptionprimitive2d.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#include <utility>
27
28
29using namespace com::sun::star;
30
31
33{
35 {
37
38 // create unit outline polygon
40 basegfx::B2DRange(0.0, 0.0, 1.0, 1.0),
43
44 // add fill
45 if(getSdrLFSTAttribute().getFill().isDefault())
46 {
47 // create invisible fill for HitTest
48 aRetval.push_back(
50 true,
51 basegfx::B2DPolyPolygon(aUnitOutline),
52 getTransform()));
53 }
54 else
55 {
56 basegfx::B2DPolyPolygon aTransformed(aUnitOutline);
57
58 aTransformed.transform(getTransform());
59 aRetval.push_back(
61 aTransformed,
62 getSdrLFSTAttribute().getFill(),
63 getSdrLFSTAttribute().getFillFloatTransGradient()));
64 }
65
66 // add line
67 if(getSdrLFSTAttribute().getLine().isDefault())
68 {
69 // create invisible line for HitTest/BoundRect
70 aRetval.push_back(
72 false,
73 basegfx::B2DPolyPolygon(aUnitOutline),
74 getTransform()));
75
76 aRetval.push_back(
78 false,
80 {}));
81 }
82 else
83 {
84 basegfx::B2DPolygon aTransformed(aUnitOutline);
85
86 aTransformed.transform(getTransform());
87 aRetval.push_back(
89 aTransformed,
90 getSdrLFSTAttribute().getLine(),
92
93 aRetval.push_back(
95 getTail(),
96 getSdrLFSTAttribute().getLine(),
97 getSdrLFSTAttribute().getLineStartEnd()));
98 }
99
100 // add text
101 if(!getSdrLFSTAttribute().getText().isDefault())
102 {
103 aRetval.push_back(
105 basegfx::B2DPolyPolygon(aUnitOutline),
106 getTransform(),
107 getSdrLFSTAttribute().getText(),
108 getSdrLFSTAttribute().getLine(),
109 false,
110 false));
111 }
112
113 // add shadow
114 if(!getSdrLFSTAttribute().getShadow().isDefault())
115 {
116 aRetval = createEmbeddedShadowPrimitive(std::move(aRetval), getSdrLFSTAttribute().getShadow());
117 }
118
119 rContainer.append(std::move(aRetval));
120 }
121
123 basegfx::B2DHomMatrix aTransform,
124 const attribute::SdrLineFillEffectsTextAttribute& rSdrLFSTAttribute,
126 double fCornerRadiusX,
127 double fCornerRadiusY)
128 : maTransform(std::move(aTransform)),
129 maSdrLFSTAttribute(rSdrLFSTAttribute),
130 maTail(std::move(aTail)),
131 mfCornerRadiusX(fCornerRadiusX),
132 mfCornerRadiusY(fCornerRadiusY)
133 {
134 }
135
137 {
138 if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
139 {
140 const SdrCaptionPrimitive2D& rCompare = static_cast<const SdrCaptionPrimitive2D&>(rPrimitive);
141
142 return (getCornerRadiusX() == rCompare.getCornerRadiusX()
143 && getCornerRadiusY() == rCompare.getCornerRadiusY()
144 && getTail() == rCompare.getTail()
145 && getTransform() == rCompare.getTransform()
146 && getSdrLFSTAttribute() == rCompare.getSdrLFSTAttribute());
147 }
148
149 return false;
150 }
151
152 // provide unique ID
154 {
156 }
157
158} // end of namespace
159
160/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void transform(const basegfx::B2DHomMatrix &rMatrix)
void transform(const basegfx::B2DHomMatrix &rMatrix)
void append(const Primitive2DReference &)
virtual sal_uInt32 getPrimitive2DID() const override
const attribute::SdrLineFillEffectsTextAttribute & getSdrLFSTAttribute() const
virtual bool operator==(const BasePrimitive2D &rPrimitive) const override
const ::basegfx::B2DPolygon & getTail() const
virtual void create2DDecomposition(Primitive2DContainer &rContainer, const geometry::ViewInformation2D &aViewInformation) const override
SdrCaptionPrimitive2D(::basegfx::B2DHomMatrix aTransform, const attribute::SdrLineFillEffectsTextAttribute &rSdrLFSTAttribute, ::basegfx::B2DPolygon aTail, double fCornerRadiusX, double fCornerRadiusY)
const ::basegfx::B2DHomMatrix & getTransform() const
B2DPolygon createPolygonFromRect(const B2DRectangle &rRect, double fRadiusX, double fRadiusY)
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_SDRCAPTIONPRIMITIVE2D
basegfx::B2DHomMatrix maTransform