26 #include <rtl/ref.hxx>
43 bool bRightActive)
const
52 if(rLineStartEnd.
isDefault() || (!bLeftActive && !bRightActive))
60 if(bLeftActive && bRightActive)
87 const double fDistance(aLine.
getLength());
88 const double fAngle(atan2(aLine.
getY(), aLine.
getX()));
89 bool bAutoUpsideDown(
false);
99 double fTestAngle(fAngle);
101 if(getTextRotation())
104 fTestAngle -= (
F_PI2);
106 if(getTextAutoAngle() && fTestAngle < -
F_PI)
112 if(getTextAutoAngle())
114 if(fTestAngle > (
F_PI / 4.0) || fTestAngle < (-
F_PI * (3.0 / 4.0)))
116 bAutoUpsideDown =
true;
132 aTextRange = xBlockText->getB2DRange(aViewInformation);
140 bool bArrowsOutside(
false);
141 bool bMainLineSplitted(
false);
143 double fStartArrowW(0.0);
144 double fStartArrowH(0.0);
145 double fEndArrowW(0.0);
146 double fEndArrowH(0.0);
175 const double fSpaceNeededByArrows(fStartArrowH + fEndArrowH + ((fStartArrowW + fEndArrowW) * 0.5));
176 const double fArrowsOutsideLen((fStartArrowH + fEndArrowH + fStartArrowW + fEndArrowW) * 0.5);
177 const double fHalfLineWidth(rLineAttribute.
getWidth() * 0.5);
179 if(fSpaceNeededByArrows > fDistance)
181 bArrowsOutside =
true;
194 bMainLineSplitted =
true;
199 if(aTextRange.
getWidth() > fDistance)
208 if(bMainLineSplitted)
210 if(aTextRange.
getWidth() + fSpaceNeededByArrows > fDistance)
212 bArrowsOutside =
true;
217 const double fSmallArrowNeed(fStartArrowH + fEndArrowH + ((fStartArrowW + fEndArrowW) * 0.125));
219 if(aTextRange.
getWidth() + fSmallArrowNeed > fDistance)
221 bArrowsOutside =
true;
228 bArrowsOutside =
true;
232 if(getBelow() || (bAutoUpsideDown && !getTextRotation()))
244 const double fMainLineOffset(getBelow() ? getDistance() : -getDistance());
251 double fLenLeft(fArrowsOutsideLen);
252 double fLenRight(fArrowsOutsideLen);
254 if(!bMainLineSplitted)
258 fLenLeft = fStartArrowH + aTextRange.
getWidth();
262 fLenRight = fEndArrowH + aTextRange.
getWidth();
269 aRetval.push_back(impCreatePart(rLineAttribute, aObjectMatrix, aMainLeftLeft, aMainLeft,
false,
true));
270 aRetval.push_back(impCreatePart(rLineAttribute, aObjectMatrix, aMainRight, aMainRightRight,
true,
false));
274 aRetval.push_back(impCreatePart(rLineAttribute, aObjectMatrix, aMainLeft, aMainRight,
false,
false));
279 if(bMainLineSplitted)
281 const double fHalfLength((fDistance - (aTextRange.
getWidth() + (fStartArrowH + fEndArrowH) * 0.25)) * 0.5);
285 aRetval.push_back(impCreatePart(rLineAttribute, aObjectMatrix, aMainLeft, aMainInnerLeft,
true,
false));
286 aRetval.push_back(impCreatePart(rLineAttribute, aObjectMatrix, aMainInnerRight, aMainRight,
false,
true));
290 aRetval.push_back(impCreatePart(rLineAttribute, aObjectMatrix, aMainLeft, aMainRight,
true,
true));
295 const double fTopEdge(getBelow() ? getUpper() + getDistance() : -getUpper() - getDistance());
296 const double fBottomLeft(getBelow() ? getLower() - getLeftDelta() : getLeftDelta() - getLower());
297 const double fBottomRight(getBelow() ? getLower() - getRightDelta() : getRightDelta() - getLower());
303 aRetval.push_back(impCreatePart(rLineAttribute, aObjectMatrix, aLeftDown, aLeftUp,
false,
false));
309 aRetval.push_back(impCreatePart(rLineAttribute, aObjectMatrix, aRightDown, aRightUp,
false,
false));
315 const double fSmall(fArrowsOutsideLen * 0.18);
316 fTextX = aMainLeft.
getX() - (fStartArrowH + aTextRange.
getWidth() + fSmall + fHalfLineWidth);
318 if(bMainLineSplitted)
320 fTextX -= (fArrowsOutsideLen - fStartArrowH);
331 const double fSmall(fArrowsOutsideLen * 0.18);
332 fTextX = aMainRight.
getX() + (fEndArrowH + fSmall + fHalfLineWidth);
334 if(bMainLineSplitted)
336 fTextX += (fArrowsOutsideLen - fEndArrowH);
347 fTextX = aMainLeft.
getX() + ((fDistance - aTextRange.
getWidth()) * 0.5);
359 const double fSmall(fArrowsOutsideLen * 0.10);
360 fTextY = aMainLeft.
getY() - (aTextRange.
getHeight() + fSmall + fHalfLineWidth);
370 const double fSmall(fArrowsOutsideLen * 0.10);
371 fTextY = aMainLeft.
getY() + (fSmall + fHalfLineWidth);
390 if(getSdrLSTAttribute().getLine().isDefault())
413 aChange *= aObjectMatrix;
416 std::unique_ptr<SdrTextPrimitive2D> pNewBlockText = xBlockText->createTransformedClone(aChange);
417 OSL_ENSURE(pNewBlockText,
"SdrMeasurePrimitive2D::create2DDecomposition: Could not create transformed clone of text primitive (!)");
425 if(!getSdrLSTAttribute().getShadow().isDefault())
429 getSdrLSTAttribute().getShadow());
432 rContainer.insert(rContainer.end(), aRetval.begin(), aRetval.end());
435 SdrMeasurePrimitive2D::SdrMeasurePrimitive2D(
450 maSdrLSTAttribute(rSdrLSTAttribute),
453 meHorizontal(eHorizontal),
454 meVertical(eVertical),
455 mfDistance(fDistance),
458 mfLeftDelta(fLeftDelta),
459 mfRightDelta(fRightDelta),
461 mbTextRotation(bTextRotation),
462 mbTextAutoAngle(bTextAutoAngle)
468 if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
void append(const basegfx::B2DPoint &rPoint, sal_uInt32 nCount)
MeasureTextPosition getVertical() const
sal_Int32 getTextUpperDistance() const
double getRightDelta() const
sal_Int32 getTextRightDistance() const
const basegfx::B2DPoint & getStart() const
const basegfx::B2DPolyPolygon & getStartPolyPolygon() const
double getDistance() const
Primitive2DContainer createEmbeddedShadowPrimitive(const Primitive2DContainer &rContent, const attribute::SdrShadowAttribute &rShadow, const basegfx::B2DHomMatrix &rObjectMatrix, const Primitive2DContainer *pContentForShadow)
double getLeftDelta() const
double getStartWidth() const
const OutlinerParaObject & getOutlinerParaObject() const
const basegfx::B2DPolyPolygon & getEndPolyPolygon() const
void rotate(double fRadiant)
const attribute::SdrLineEffectsTextAttribute & getSdrLSTAttribute() const
MeasureTextPosition getHorizontal() const
ImplPrimitive2DIDBlock(BorderLinePrimitive2D, PRIMITIVE2D_ID_BORDERLINEPRIMITIVE2D) Primitive2DReference tryMergeBorderLinePrimitive2D(const BorderLinePrimitive2D *pCandidateA
B2DRange getRange(const B2DPolygon &rCandidate)
sal_Int32 getTextLowerDistance() const
void transform(const basegfx::B2DHomMatrix &rMatrix)
bool getTextRotation() const
css::uno::Reference< css::graphic::XPrimitive2D > Primitive2DReference
bool getTextAutoAngle() const
virtual bool operator==(const BasePrimitive2D &rPrimitive) const override
bool isStartCentered() const
sal_Int32 getTextLeftDistance() const
const SdrText & getSdrText() const
#define PRIMITIVE2D_ID_SDRMEASUREPRIMITIVE2D
bool isStartActive() const
void translate(double fX, double fY)
const basegfx::B2DPoint & getEnd() const
bool isEndCentered() const
B2DHomMatrix createShearXRotateTranslateB2DHomMatrix(double fShearX, double fRadiant, double fTranslateX, double fTranslateY)
Primitive2DReference createPolygonLinePrimitive(const basegfx::B2DPolygon &rPolygon, const attribute::SdrLineAttribute &rLine, const attribute::SdrLineStartEndAttribute &rStroke)
double getEndWidth() const