30#include <osl/diagnose.h>
44 bool bRightActive)
const
53 if(rLineStartEnd.
isDefault() || (!bLeftActive && !bRightActive))
61 if(bLeftActive && bRightActive)
88 const double fDistance(aLine.
getLength());
89 const double fAngle(atan2(aLine.
getY(), aLine.
getX()));
90 bool bAutoUpsideDown(
false);
100 double fTestAngle(fAngle);
104 aTextMatrix.
rotate(-M_PI_2);
105 fTestAngle -= (M_PI_2);
109 fTestAngle += 2 * M_PI;
115 if(fTestAngle > (M_PI / 4.0) || fTestAngle < (-M_PI * (3.0 / 4.0)))
117 bAutoUpsideDown =
true;
133 aTextRange = xBlockText->getB2DRange(aViewInformation);
141 bool bArrowsOutside(
false);
142 bool bMainLineSplitted(
false);
144 double fStartArrowW(0.0);
145 double fStartArrowH(0.0);
146 double fEndArrowW(0.0);
147 double fEndArrowH(0.0);
176 const double fSpaceNeededByArrows(fStartArrowH + fEndArrowH + ((fStartArrowW + fEndArrowW) * 0.5));
177 const double fArrowsOutsideLen((fStartArrowH + fEndArrowH + fStartArrowW + fEndArrowW) * 0.5);
178 const double fHalfLineWidth(rLineAttribute.
getWidth() * 0.5);
180 if(fSpaceNeededByArrows > fDistance)
182 bArrowsOutside =
true;
195 bMainLineSplitted =
true;
200 if(aTextRange.
getWidth() > fDistance)
209 if(bMainLineSplitted)
211 if(aTextRange.
getWidth() + fSpaceNeededByArrows > fDistance)
213 bArrowsOutside =
true;
218 const double fSmallArrowNeed(fStartArrowH + fEndArrowH + ((fStartArrowW + fEndArrowW) * 0.125));
220 if(aTextRange.
getWidth() + fSmallArrowNeed > fDistance)
222 bArrowsOutside =
true;
229 bArrowsOutside =
true;
252 double fLenLeft(fArrowsOutsideLen);
253 double fLenRight(fArrowsOutsideLen);
255 if(!bMainLineSplitted)
259 fLenLeft = fStartArrowH + aTextRange.
getWidth();
263 fLenRight = fEndArrowH + aTextRange.
getWidth();
270 aRetval.push_back(
impCreatePart(rLineAttribute, aObjectMatrix, aMainLeftLeft, aMainLeft,
false,
true));
271 aRetval.push_back(
impCreatePart(rLineAttribute, aObjectMatrix, aMainRight, aMainRightRight,
true,
false));
275 aRetval.push_back(
impCreatePart(rLineAttribute, aObjectMatrix, aMainLeft, aMainRight,
false,
false));
280 if(bMainLineSplitted)
282 const double fHalfLength((fDistance - (aTextRange.
getWidth() + (fStartArrowH + fEndArrowH) * 0.25)) * 0.5);
286 aRetval.push_back(
impCreatePart(rLineAttribute, aObjectMatrix, aMainLeft, aMainInnerLeft,
true,
false));
287 aRetval.push_back(
impCreatePart(rLineAttribute, aObjectMatrix, aMainInnerRight, aMainRight,
false,
true));
291 aRetval.push_back(
impCreatePart(rLineAttribute, aObjectMatrix, aMainLeft, aMainRight,
true,
true));
304 aRetval.push_back(
impCreatePart(rLineAttribute, aObjectMatrix, aLeftDown, aLeftUp,
false,
false));
310 aRetval.push_back(
impCreatePart(rLineAttribute, aObjectMatrix, aRightDown, aRightUp,
false,
false));
316 const double fSmall(fArrowsOutsideLen * 0.18);
317 fTextX = aMainLeft.
getX() - (fStartArrowH + aTextRange.
getWidth() + fSmall + fHalfLineWidth);
319 if(bMainLineSplitted)
321 fTextX -= (fArrowsOutsideLen - fStartArrowH);
332 const double fSmall(fArrowsOutsideLen * 0.18);
333 fTextX = aMainRight.
getX() + (fEndArrowH + fSmall + fHalfLineWidth);
335 if(bMainLineSplitted)
337 fTextX += (fArrowsOutsideLen - fEndArrowH);
348 fTextX = aMainLeft.
getX() + ((fDistance - aTextRange.
getWidth()) * 0.5);
360 const double fSmall(fArrowsOutsideLen * 0.10);
361 fTextY = aMainLeft.
getY() - (aTextRange.
getHeight() + fSmall + fHalfLineWidth);
371 const double fSmall(fArrowsOutsideLen * 0.10);
372 fTextY = aMainLeft.
getY() + (fSmall + fHalfLineWidth);
414 aChange *= aObjectMatrix;
418 OSL_ENSURE(pNewBlockText,
"SdrMeasurePrimitive2D::create2DDecomposition: Could not create transformed clone of text primitive (!)");
422 aRetval.push_back(pNewBlockText);
433 rContainer.
append(std::move(aRetval));
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 rotate(double fRadiant)
void translate(double fX, double fY)
void transform(const basegfx::B2DHomMatrix &rMatrix)
void append(const basegfx::B2DPoint &rPoint, sal_uInt32 nCount)
const SdrTextAttribute & getText() const
const SdrLineAttribute & getLine() const
const SdrLineStartEndAttribute & getLineStartEnd() const
double getEndWidth() const
const basegfx::B2DPolyPolygon & getStartPolyPolygon() const
bool isEndCentered() const
bool isStartCentered() const
double getStartWidth() const
const basegfx::B2DPolyPolygon & getEndPolyPolygon() const
bool isStartActive() const
sal_Int32 getTextUpperDistance() const
sal_Int32 getTextLowerDistance() const
sal_Int32 getTextLeftDistance() const
const OutlinerParaObject & getOutlinerParaObject() const
sal_Int32 getTextRightDistance() const
const SdrText & getSdrText() const
void append(const Primitive2DReference &)
MeasureTextPosition getVertical() const
virtual void create2DDecomposition(Primitive2DContainer &rContainer, const geometry::ViewInformation2D &aViewInformation) const override
MeasureTextPosition getHorizontal() const
SdrMeasurePrimitive2D(const attribute::SdrLineEffectsTextAttribute &rSdrLSTAttribute, const basegfx::B2DPoint &rStart, const basegfx::B2DPoint &rEnd, MeasureTextPosition eHorizontal, MeasureTextPosition eVertical, double fDistance, double fUpper, double fLower, double fLeftDelta, double fRightDelta, bool bBelow, bool bTextRotation, bool bTextAutoAngle)
virtual sal_uInt32 getPrimitive2DID() const override
const basegfx::B2DPoint & getEnd() const
const basegfx::B2DPoint & getStart() const
virtual bool operator==(const BasePrimitive2D &rPrimitive) const override
double getLeftDelta() const
const attribute::SdrLineEffectsTextAttribute & getSdrLSTAttribute() const
Primitive2DReference impCreatePart(const attribute::SdrLineAttribute &rLineAttribute, const basegfx::B2DHomMatrix &rObjectMatrix, const basegfx::B2DPoint &rStart, const basegfx::B2DPoint &rEnd, bool bLeftActive, bool bRightActive) const
double getRightDelta() const
double getDistance() const
bool getTextRotation() const
bool getTextAutoAngle() const
B2DHomMatrix createShearXRotateTranslateB2DHomMatrix(double fShearX, double fRadiant, double fTranslateX, double fTranslateY)
B2DRange getRange(const B2DPolygon &rCandidate)
Primitive2DContainer createEmbeddedShadowPrimitive(Primitive2DContainer &&rContent, const attribute::SdrShadowAttribute &rShadow, const basegfx::B2DHomMatrix &rObjectMatrix, const Primitive2DContainer *pContentForShadow)
@ MEASURETEXTPOSITION_CENTERED
@ MEASURETEXTPOSITION_POSITIVE
@ MEASURETEXTPOSITION_NEGATIVE
@ MEASURETEXTPOSITION_AUTOMATIC
Primitive2DReference createPolygonLinePrimitive(const basegfx::B2DPolygon &rPolygon, const attribute::SdrLineAttribute &rLine, const attribute::SdrLineStartEndAttribute &rStroke)
@ SDRTEXTVERTADJUST_CENTER
@ SDRTEXTHORZADJUST_CENTER
#define PRIMITIVE2D_ID_SDRMEASUREPRIMITIVE2D