54 virtual bool allowChange(sal_uInt32 nCount,
basegfx::B2DHomMatrix& rNewTransform, sal_uInt32 nIndex, sal_uInt32 nLength)
override;
56 void freeB2DCubicBezierHelper();
58 void advanceToPosition(
double fNewPosition);
61 pathTextBreakupHelper(
64 const double fBasegfxPathLength,
67 virtual ~pathTextBreakupHelper()
override;
70 double getPosition()
const {
return mfPosition; }
75 void pathTextBreakupHelper::freeB2DCubicBezierHelper()
90 void pathTextBreakupHelper::advanceToPosition(
double fNewPosition)
99 freeB2DCubicBezierHelper();
103 ? getB2DCubicBezierHelper()->getLength()
111 pathTextBreakupHelper::pathTextBreakupHelper(
114 const double fBasegfxPathLength,
117 :
drawinglayer::primitive2d::TextBreakupHelper(rSource),
130 advanceToPosition(fPosition);
133 pathTextBreakupHelper::~pathTextBreakupHelper()
135 freeB2DCubicBezierHelper();
138 bool pathTextBreakupHelper::allowChange(sal_uInt32 ,
basegfx::B2DHomMatrix& rNewTransform, sal_uInt32 nIndex, sal_uInt32 nLength)
144 const double fSnippetWidth(
145 getTextLayouter().getTextWidth(
146 getSource().getText(),
152 const OUString aText(getSource().getText());
153 const std::u16string_view aTrimmedChars(
o3tl::trim(aText.subView(nIndex, nLength)));
154 const double fEndPos(
mfPosition + fSnippetWidth);
156 if(!aTrimmedChars.empty() && (mfPosition < mfBasegfxPathLength || fEndPos > 0.0))
158 const double fHalfSnippetWidth(fSnippetWidth * 0.5);
160 advanceToPosition(
mfPosition + fHalfSnippetWidth);
188 if(getB2DCubicBezierHelper())
192 fBezierDistance = getB2DCubicBezierHelper()->distanceToRelative(fBezierDistance);
212 aPosition.setY(aPosition.getY() + aOffset.getY());
216 aPosition -= fHalfSnippetWidth * aTangent;
219 rNewTransform.
translate(-aBasePoint.getX(), -aBasePoint.getY());
222 rNewTransform.
rotate(atan2(aTangent.getY(), aTangent.getX()));
225 rNewTransform.
translate(aPosition.getX(), aPosition.getY());
229 advanceToPosition(fEndPos);
245 maSvgStyleAttributes(*this)
317 const std::optional<basegfx::B2DPolyPolygon>& pPolyPolyPath = pSvgPathNode->
getPath();
319 if(!pPolyPolyPath || !pPolyPolyPath->count())
326 if(!aPolygon.
count())
341 if(rPathContent.empty())
349 const std::optional<basegfx::B2DPolyPolygon>& pPolyPolyPath = pSvgPathNode->
getPath();
351 if(!(pPolyPolyPath && pPolyPolyPath->count()))
366 double fUserToBasegfx(1.0);
374 fUserToBasegfx = fUserLength / fBasegfxPathLength;
378 double fPosition(0.0);
396 const sal_Int32
nLength(rPathContent.size());
397 sal_Int32 nCurrent(0);
399 while(fPosition < fBasegfxPathLength && nCurrent <
nLength)
411 pathTextBreakupHelper aPathTextBreakupHelper(
419 aPathTextBreakupHelper.extractResult();
423 rTarget.append(std::move(aResult));
427 fPosition = aPathTextBreakupHelper.getPosition();
const B2DPoint & getStartPoint() const
double getLength(double fDeviation=0.01) const
B2DPoint interpolatePoint(double t) const
void testAndSolveTrivialBezier()
const B2DPoint & getEndPoint() const
B2DVector getTangent(double t) const
void rotate(double fRadiant)
void translate(double fX, double fY)
void transform(const basegfx::B2DHomMatrix &rMatrix)
void getBezierSegment(sal_uInt32 nIndex, B2DCubicBezier &rTarget) const
const SvgNode * findSvgNodeById(const OUString &rStr) const
find a node by its Id
virtual void parseAttribute(const OUString &rTokenName, SVGToken aSVGToken, const OUString &aContent)
void readLocalCssStyle(std::u16string_view aContent)
scan helper to read and interpret a local CssStyle to mpLocalCssStyle
const SvgDocument & getDocument() const
double solve(const InfoProvider &rInfoProvider, NumberType aNumberType=NumberType::length) const
const std::optional< basegfx::B2DPolyPolygon > & getPath() const
path content, set if found in current context
const SvgNumber & getPathLength() const
PathLength content.
const std::optional< basegfx::B2DHomMatrix > & getTransform() const
transform content, set if found in current context
void parseStyleAttribute(SVGToken aSVGToken, const OUString &rContent)
local attribute scanner
virtual ~SvgTextPathNode() override
SvgTextPathNode(SvgDocument &rDocument, SvgNode *pParent)
SvgStyleAttributes maSvgStyleAttributes
use styles
virtual const SvgStyleAttributes * getSvgStyleAttributes() const override
const SvgNumber & getStartOffset() const
StartOffset content.
SvgNumber maStartOffset
variable scan values, dependent of given XAttributeList
OUString maXLink
link to path content.
void decomposePathNode(const drawinglayer::primitive2d::Primitive2DContainer &rPathContent, drawinglayer::primitive2d::Primitive2DContainer &rTarget, const basegfx::B2DPoint &rTextStart) const
virtual void parseAttribute(const OUString &rTokenName, SVGToken aSVGToken, const OUString &aContent) override
double getLength(const B2DPolygon &rCandidate)
std::basic_string_view< charT, traits > trim(std::basic_string_view< charT, traits > str)
bool readLocalLink(std::u16string_view rCandidate, OUString &rURL)
bool readSingleNumber(std::u16string_view rCandidate, SvgNumber &aNum)
const sal_uInt32 mnMaxIndex
const double mfBasegfxPathLength
double mfSegmentStartPosition
basegfx::B2DCubicBezier maCurrentSegment
const basegfx::B2DPolygon & mrPolygon
std::unique_ptr< basegfx::B2DCubicBezierHelper > mpB2DCubicBezierHelper
double mfCurrentSegmentLength
const basegfx::B2DPoint & mrTextStart