svgtextpathnode.cxx (e2bf1e9d) svgtextpathnode.cxx (693be7f6)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 53 unchanged lines hidden (view full) ---

62 virtual bool allowChange(sal_uInt32 nCount, basegfx::B2DHomMatrix& rNewTransform, sal_uInt32 nIndex, sal_uInt32 nLength);
63
64 void freeB2DCubicBezierHelper();
65 basegfx::B2DCubicBezierHelper* getB2DCubicBezierHelper();
66 void advanceToPosition(double fNewPosition);
67
68 public:
69 pathTextBreakupHelper(
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 53 unchanged lines hidden (view full) ---

62 virtual bool allowChange(sal_uInt32 nCount, basegfx::B2DHomMatrix& rNewTransform, sal_uInt32 nIndex, sal_uInt32 nLength);
63
64 void freeB2DCubicBezierHelper();
65 basegfx::B2DCubicBezierHelper* getB2DCubicBezierHelper();
66 void advanceToPosition(double fNewPosition);
67
68 public:
69 pathTextBreakupHelper(
70 const drawinglayer::primitive2d::Primitive2DReference& rxSource,
70 const drawinglayer::primitive2d::TextSimplePortionPrimitive2D& rSource,
71 const basegfx::B2DPolygon& rPolygon,
72 const double fBasegfxPathLength,
73 const double fUserToBasegfx,
74 double fPosition,
75 const basegfx::B2DPoint& rTextStart);
76 virtual ~pathTextBreakupHelper();
77
78 // read access to evtl. advanced position

--- 51 unchanged lines hidden (view full) ---

130 : maCurrentSegment.getLength();
131 }
132 }
133
134 mfPosition = fNewPosition;
135 }
136
137 pathTextBreakupHelper::pathTextBreakupHelper(
71 const basegfx::B2DPolygon& rPolygon,
72 const double fBasegfxPathLength,
73 const double fUserToBasegfx,
74 double fPosition,
75 const basegfx::B2DPoint& rTextStart);
76 virtual ~pathTextBreakupHelper();
77
78 // read access to evtl. advanced position

--- 51 unchanged lines hidden (view full) ---

130 : maCurrentSegment.getLength();
131 }
132 }
133
134 mfPosition = fNewPosition;
135 }
136
137 pathTextBreakupHelper::pathTextBreakupHelper(
138 const drawinglayer::primitive2d::Primitive2DReference& rxSource,
138 const drawinglayer::primitive2d::TextSimplePortionPrimitive2D& rSource,
139 const basegfx::B2DPolygon& rPolygon,
140 const double fBasegfxPathLength,
141 const double fUserToBasegfx,
142 double fPosition,
143 const basegfx::B2DPoint& rTextStart)
139 const basegfx::B2DPolygon& rPolygon,
140 const double fBasegfxPathLength,
141 const double fUserToBasegfx,
142 double fPosition,
143 const basegfx::B2DPoint& rTextStart)
144 : drawinglayer::primitive2d::TextBreakupHelper(rxSource),
144 : drawinglayer::primitive2d::TextBreakupHelper(rSource),
145 mrPolygon(rPolygon),
146 mfBasegfxPathLength(fBasegfxPathLength),
147 mfUserToBasegfx(fUserToBasegfx),
148 mfPosition(0.0),
149 mrTextStart(rTextStart),
150 mnMaxIndex(rPolygon.isClosed() ? rPolygon.count() : rPolygon.count() - 1),
151 mnIndex(0),
152 maCurrentSegment(),

--- 11 unchanged lines hidden (view full) ---

164 {
165 freeB2DCubicBezierHelper();
166 }
167
168 bool pathTextBreakupHelper::allowChange(sal_uInt32 /*nCount*/, basegfx::B2DHomMatrix& rNewTransform, sal_uInt32 nIndex, sal_uInt32 nLength)
169 {
170 bool bRetval(false);
171
145 mrPolygon(rPolygon),
146 mfBasegfxPathLength(fBasegfxPathLength),
147 mfUserToBasegfx(fUserToBasegfx),
148 mfPosition(0.0),
149 mrTextStart(rTextStart),
150 mnMaxIndex(rPolygon.isClosed() ? rPolygon.count() : rPolygon.count() - 1),
151 mnIndex(0),
152 maCurrentSegment(),

--- 11 unchanged lines hidden (view full) ---

164 {
165 freeB2DCubicBezierHelper();
166 }
167
168 bool pathTextBreakupHelper::allowChange(sal_uInt32 /*nCount*/, basegfx::B2DHomMatrix& rNewTransform, sal_uInt32 nIndex, sal_uInt32 nLength)
169 {
170 bool bRetval(false);
171
172 if(mfPosition < mfBasegfxPathLength && nLength && getCastedSource() && mnIndex < mnMaxIndex)
172 if(mfPosition < mfBasegfxPathLength && nLength && mnIndex < mnMaxIndex)
173 {
174 const double fSnippetWidth(
175 getTextLayouter().getTextWidth(
173 {
174 const double fSnippetWidth(
175 getTextLayouter().getTextWidth(
176 getCastedSource()->getText(),
176 getSource().getText(),
177 nIndex,
178 nLength));
179
180 if(basegfx::fTools::more(fSnippetWidth, 0.0))
181 {
177 nIndex,
178 nLength));
179
180 if(basegfx::fTools::more(fSnippetWidth, 0.0))
181 {
182 const ::rtl::OUString aText(getCastedSource()->getText());
182 const ::rtl::OUString aText(getSource().getText());
183 const ::rtl::OUString aTrimmedChars(aText.copy(nIndex, nLength).trim());
184 const double fEndPos(mfPosition + fSnippetWidth);
185
186 if(aTrimmedChars.getLength() && (mfPosition < mfBasegfxPathLength || fEndPos > 0.0))
187 {
188 const double fHalfSnippetWidth(fSnippetWidth * 0.5);
189
190 advanceToPosition(mfPosition + fHalfSnippetWidth);

--- 282 unchanged lines hidden (view full) ---

473
474 if(xReference.is())
475 {
476 pCandidate = dynamic_cast< const drawinglayer::primitive2d::TextSimplePortionPrimitive2D* >(xReference.get());
477 }
478
479 if(pCandidate)
480 {
183 const ::rtl::OUString aTrimmedChars(aText.copy(nIndex, nLength).trim());
184 const double fEndPos(mfPosition + fSnippetWidth);
185
186 if(aTrimmedChars.getLength() && (mfPosition < mfBasegfxPathLength || fEndPos > 0.0))
187 {
188 const double fHalfSnippetWidth(fSnippetWidth * 0.5);
189
190 advanceToPosition(mfPosition + fHalfSnippetWidth);

--- 282 unchanged lines hidden (view full) ---

473
474 if(xReference.is())
475 {
476 pCandidate = dynamic_cast< const drawinglayer::primitive2d::TextSimplePortionPrimitive2D* >(xReference.get());
477 }
478
479 if(pCandidate)
480 {
481 pathTextBreakupHelper aPathTextBreakupHelper(
482 xReference,
481 const pathTextBreakupHelper aPathTextBreakupHelper(
482 *pCandidate,
483 aPolygon,
484 fBasegfxPathLength,
485 fUserToBasegfx,
486 fPosition,
487 rTextStart);
488
489 const drawinglayer::primitive2d::Primitive2DSequence aResult(
490 aPathTextBreakupHelper.getResult(drawinglayer::primitive2d::BreakupUnit_character));

--- 24 unchanged lines hidden ---
483 aPolygon,
484 fBasegfxPathLength,
485 fUserToBasegfx,
486 fPosition,
487 rTextStart);
488
489 const drawinglayer::primitive2d::Primitive2DSequence aResult(
490 aPathTextBreakupHelper.getResult(drawinglayer::primitive2d::BreakupUnit_character));

--- 24 unchanged lines hidden ---