Line data Source code
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 :
20 : #include "CommonConverters.hxx"
21 : #include <com/sun/star/drawing/DoubleSequence.hpp>
22 : #include <com/sun/star/text/WritingMode2.hpp>
23 : #include <com/sun/star/chart2/data/XNumericalDataSequence.hpp>
24 : #include <com/sun/star/chart2/data/XTextualDataSequence.hpp>
25 : #include <rtl/math.hxx>
26 : #include <basegfx/matrix/b3dhommatrix.hxx>
27 :
28 : #include <cstdarg>
29 :
30 : namespace chart
31 : {
32 :
33 : using namespace ::com::sun::star;
34 :
35 : // diverse methods for class conversions; e.g. ::basegfx::B3DHomMatrix to HomogenMatrix
36 :
37 12953 : drawing::HomogenMatrix B3DHomMatrixToHomogenMatrix( const ::basegfx::B3DHomMatrix& rM )
38 : {
39 12953 : drawing::HomogenMatrix aHM;
40 12953 : aHM.Line1.Column1 = rM.get(0, 0);
41 12953 : aHM.Line1.Column2 = rM.get(0, 1);
42 12953 : aHM.Line1.Column3 = rM.get(0, 2);
43 12953 : aHM.Line1.Column4 = rM.get(0, 3);
44 12953 : aHM.Line2.Column1 = rM.get(1, 0);
45 12953 : aHM.Line2.Column2 = rM.get(1, 1);
46 12953 : aHM.Line2.Column3 = rM.get(1, 2);
47 12953 : aHM.Line2.Column4 = rM.get(1, 3);
48 12953 : aHM.Line3.Column1 = rM.get(2, 0);
49 12953 : aHM.Line3.Column2 = rM.get(2, 1);
50 12953 : aHM.Line3.Column3 = rM.get(2, 2);
51 12953 : aHM.Line3.Column4 = rM.get(2, 3);
52 12953 : aHM.Line4.Column1 = rM.get(3, 0);
53 12953 : aHM.Line4.Column2 = rM.get(3, 1);
54 12953 : aHM.Line4.Column3 = rM.get(3, 2);
55 12953 : aHM.Line4.Column4 = rM.get(3, 3);
56 12953 : return aHM;
57 : }
58 :
59 22423 : ::basegfx::B3DHomMatrix HomogenMatrixToB3DHomMatrix( const drawing::HomogenMatrix& rHM )
60 : {
61 22423 : ::basegfx::B3DHomMatrix aM;
62 22423 : aM.set(0, 0, rHM.Line1.Column1);
63 22423 : aM.set(0, 1, rHM.Line1.Column2);
64 22423 : aM.set(0, 2, rHM.Line1.Column3);
65 22423 : aM.set(0, 3, rHM.Line1.Column4);
66 22423 : aM.set(1, 0, rHM.Line2.Column1);
67 22423 : aM.set(1, 1, rHM.Line2.Column2);
68 22423 : aM.set(1, 2, rHM.Line2.Column3);
69 22423 : aM.set(1, 3, rHM.Line2.Column4);
70 22423 : aM.set(2, 0, rHM.Line3.Column1);
71 22423 : aM.set(2, 1, rHM.Line3.Column2);
72 22423 : aM.set(2, 2, rHM.Line3.Column3);
73 22423 : aM.set(2, 3, rHM.Line3.Column4);
74 22423 : aM.set(3, 0, rHM.Line4.Column1);
75 22423 : aM.set(3, 1, rHM.Line4.Column2);
76 22423 : aM.set(3, 2, rHM.Line4.Column3);
77 22423 : aM.set(3, 3, rHM.Line4.Column4);
78 22423 : return aM;
79 : }
80 :
81 152 : ::basegfx::B2DHomMatrix IgnoreZ( const ::basegfx::B3DHomMatrix& rM )
82 : {
83 152 : ::basegfx::B2DHomMatrix aM;
84 152 : aM.set(0, 0, rM.get(0, 0));
85 152 : aM.set(0, 1, rM.get(0, 1));
86 152 : aM.set(0, 2, rM.get(0, 3));
87 152 : aM.set(1, 0, rM.get(1, 0));
88 152 : aM.set(1, 1, rM.get(1, 1));
89 152 : aM.set(1, 2, rM.get(1, 3));
90 152 : aM.set(2, 0, rM.get(3, 0));
91 152 : aM.set(2, 1, rM.get(3, 1));
92 152 : aM.set(2, 2, rM.get(3, 3));
93 152 : return aM;
94 : }
95 :
96 19208 : drawing::HomogenMatrix3 B2DHomMatrixToHomogenMatrix3( const ::basegfx::B2DHomMatrix& rM )
97 : {
98 19208 : drawing::HomogenMatrix3 aHM;
99 19208 : aHM.Line1.Column1 = rM.get(0, 0);
100 19208 : aHM.Line1.Column2 = rM.get(0, 1);
101 19208 : aHM.Line1.Column3 = rM.get(0, 2);
102 19208 : aHM.Line2.Column1 = rM.get(1, 0);
103 19208 : aHM.Line2.Column2 = rM.get(1, 1);
104 19208 : aHM.Line2.Column3 = rM.get(1, 2);
105 19208 : aHM.Line3.Column1 = rM.get(2, 0);
106 19208 : aHM.Line3.Column2 = rM.get(2, 1);
107 19208 : aHM.Line3.Column3 = rM.get(2, 2);
108 19208 : return aHM;
109 : }
110 :
111 2892 : ::basegfx::B3DPoint Position3DToB3DPoint( const drawing::Position3D& rPosition )
112 : {
113 : return ::basegfx::B3DPoint(
114 : rPosition.PositionX ,
115 : rPosition.PositionY ,
116 2892 : rPosition.PositionZ );
117 : }
118 :
119 723 : drawing::Direction3D B3DVectorToDirection3D( const ::basegfx::B3DVector& rVector)
120 : {
121 : return drawing::Direction3D(
122 723 : rVector.getX()
123 723 : , rVector.getY()
124 723 : , rVector.getZ()
125 2169 : );
126 : }
127 :
128 360 : drawing::Position3D B3DPointToPosition3D( const ::basegfx::B3DPoint& rPoint)
129 : {
130 : return drawing::Position3D(
131 360 : rPoint.getX()
132 360 : , rPoint.getY()
133 360 : , rPoint.getZ()
134 1080 : );
135 : }
136 :
137 0 : ::basegfx::B3DVector Direction3DToB3DVector( const drawing::Direction3D& rDirection)
138 : {
139 : return ::basegfx::B3DVector(
140 : rDirection.DirectionX
141 : , rDirection.DirectionY
142 : , rDirection.DirectionZ
143 0 : );
144 : }
145 :
146 30222 : void AddPointToPoly( drawing::PolyPolygonShape3D& rPoly, const drawing::Position3D& rPos, sal_Int32 nPolygonIndex )
147 : {
148 30222 : if(nPolygonIndex<0)
149 : {
150 : OSL_FAIL( "The polygon index needs to be > 0");
151 0 : nPolygonIndex=0;
152 : }
153 :
154 : //make sure that we have enough polygons
155 30222 : if(nPolygonIndex >= rPoly.SequenceX.getLength() )
156 : {
157 1425 : rPoly.SequenceX.realloc(nPolygonIndex+1);
158 1425 : rPoly.SequenceY.realloc(nPolygonIndex+1);
159 1425 : rPoly.SequenceZ.realloc(nPolygonIndex+1);
160 : }
161 :
162 30222 : drawing::DoubleSequence* pOuterSequenceX = &rPoly.SequenceX.getArray()[nPolygonIndex];
163 30222 : drawing::DoubleSequence* pOuterSequenceY = &rPoly.SequenceY.getArray()[nPolygonIndex];
164 30222 : drawing::DoubleSequence* pOuterSequenceZ = &rPoly.SequenceZ.getArray()[nPolygonIndex];
165 :
166 30222 : sal_Int32 nOldPointCount = pOuterSequenceX->getLength();
167 :
168 30222 : pOuterSequenceX->realloc(nOldPointCount+1);
169 30222 : pOuterSequenceY->realloc(nOldPointCount+1);
170 30222 : pOuterSequenceZ->realloc(nOldPointCount+1);
171 :
172 30222 : double* pInnerSequenceX = pOuterSequenceX->getArray();
173 30222 : double* pInnerSequenceY = pOuterSequenceY->getArray();
174 30222 : double* pInnerSequenceZ = pOuterSequenceZ->getArray();
175 :
176 30222 : pInnerSequenceX[nOldPointCount] = rPos.PositionX;
177 30222 : pInnerSequenceY[nOldPointCount] = rPos.PositionY;
178 30222 : pInnerSequenceZ[nOldPointCount] = rPos.PositionZ;
179 30222 : }
180 :
181 0 : drawing::Position3D getPointFromPoly( const drawing::PolyPolygonShape3D& rPolygon, sal_Int32 nPointIndex, sal_Int32 nPolyIndex )
182 : {
183 0 : drawing::Position3D aRet(0.0,0.0,0.0);
184 :
185 0 : if( nPolyIndex>=0 && nPolyIndex<rPolygon.SequenceX.getLength())
186 : {
187 0 : if(nPointIndex<rPolygon.SequenceX[nPolyIndex].getLength())
188 : {
189 0 : aRet.PositionX = rPolygon.SequenceX[nPolyIndex][nPointIndex];
190 0 : aRet.PositionY = rPolygon.SequenceY[nPolyIndex][nPointIndex];
191 0 : aRet.PositionZ = rPolygon.SequenceZ[nPolyIndex][nPointIndex];
192 : }
193 : else
194 : {
195 : OSL_FAIL("polygon was accessed with a wrong index");
196 : }
197 : }
198 : else
199 : {
200 : OSL_FAIL("polygon was accessed with a wrong index");
201 : }
202 0 : return aRet;
203 : }
204 :
205 0 : void addPolygon( drawing::PolyPolygonShape3D& rRet, const drawing::PolyPolygonShape3D& rAdd )
206 : {
207 0 : sal_Int32 nAddOuterCount = rAdd.SequenceX.getLength();
208 0 : sal_Int32 nOuterCount = rRet.SequenceX.getLength() + nAddOuterCount;
209 0 : rRet.SequenceX.realloc( nOuterCount );
210 0 : rRet.SequenceY.realloc( nOuterCount );
211 0 : rRet.SequenceZ.realloc( nOuterCount );
212 :
213 0 : sal_Int32 nIndex = 0;
214 0 : sal_Int32 nOuter = nOuterCount - nAddOuterCount;
215 0 : for( ; nOuter < nOuterCount; nOuter++ )
216 : {
217 0 : if( nIndex >= nAddOuterCount )
218 0 : break;
219 :
220 0 : rRet.SequenceX[nOuter] = rAdd.SequenceX[nIndex];
221 0 : rRet.SequenceY[nOuter] = rAdd.SequenceY[nIndex];
222 0 : rRet.SequenceZ[nOuter] = rAdd.SequenceZ[nIndex];
223 :
224 0 : nIndex++;
225 : }
226 0 : }
227 :
228 0 : void appendPoly( drawing::PolyPolygonShape3D& rRet, const drawing::PolyPolygonShape3D& rAdd )
229 : {
230 0 : sal_Int32 nOuterCount = std::max( rRet.SequenceX.getLength(), rAdd.SequenceX.getLength() );
231 0 : rRet.SequenceX.realloc(nOuterCount);
232 0 : rRet.SequenceY.realloc(nOuterCount);
233 0 : rRet.SequenceZ.realloc(nOuterCount);
234 :
235 0 : for( sal_Int32 nOuter=0;nOuter<nOuterCount;nOuter++ )
236 : {
237 0 : sal_Int32 nOldPointCount = rRet.SequenceX[nOuter].getLength();
238 0 : sal_Int32 nAddPointCount = 0;
239 0 : if(nOuter<rAdd.SequenceX.getLength())
240 0 : nAddPointCount = rAdd.SequenceX[nOuter].getLength();
241 0 : if(!nAddPointCount)
242 0 : continue;
243 :
244 0 : sal_Int32 nNewPointCount = nOldPointCount + nAddPointCount;
245 :
246 0 : rRet.SequenceX[nOuter].realloc(nNewPointCount);
247 0 : rRet.SequenceY[nOuter].realloc(nNewPointCount);
248 0 : rRet.SequenceZ[nOuter].realloc(nNewPointCount);
249 :
250 0 : sal_Int32 nPointTarget=nOldPointCount;
251 0 : sal_Int32 nPointSource=nAddPointCount;
252 0 : for( ; nPointSource-- ; nPointTarget++ )
253 : {
254 0 : rRet.SequenceX[nOuter][nPointTarget] = rAdd.SequenceX[nOuter][nPointSource];
255 0 : rRet.SequenceY[nOuter][nPointTarget] = rAdd.SequenceY[nOuter][nPointSource];
256 0 : rRet.SequenceZ[nOuter][nPointTarget] = rAdd.SequenceZ[nOuter][nPointSource];
257 : }
258 : }
259 0 : }
260 :
261 16 : drawing::PolyPolygonShape3D BezierToPoly(
262 : const drawing::PolyPolygonBezierCoords& rBezier )
263 : {
264 16 : const drawing::PointSequenceSequence& rPointSequence = rBezier.Coordinates;
265 :
266 16 : drawing::PolyPolygonShape3D aRet;
267 16 : aRet.SequenceX.realloc( rPointSequence.getLength() );
268 16 : aRet.SequenceY.realloc( rPointSequence.getLength() );
269 16 : aRet.SequenceZ.realloc( rPointSequence.getLength() );
270 :
271 16 : sal_Int32 nRealOuter = 0;
272 32 : for(sal_Int32 nN = 0; nN < rPointSequence.getLength(); nN++)
273 : {
274 16 : sal_Int32 nInnerLength = rPointSequence[nN].getLength();
275 16 : aRet.SequenceX[nN].realloc( nInnerLength );
276 16 : aRet.SequenceY[nN].realloc( nInnerLength );
277 16 : aRet.SequenceZ[nN].realloc( nInnerLength );
278 :
279 16 : bool bHasOuterFlags = nN < rBezier.Flags.getLength();
280 :
281 16 : sal_Int32 nRealInner = 0;
282 1696 : for( sal_Int32 nM = 0; nM < nInnerLength; nM++)
283 : {
284 1680 : bool bHasInnerFlags = bHasOuterFlags && (nM < rBezier.Flags[nN].getLength());
285 :
286 1680 : if( !bHasInnerFlags || (rBezier.Flags[nN][nM] == drawing::PolygonFlags_NORMAL) )
287 : {
288 592 : aRet.SequenceX[nRealOuter][nRealInner] = rPointSequence[nN][nM].X;
289 592 : aRet.SequenceY[nRealOuter][nRealInner] = rPointSequence[nN][nM].Y;
290 592 : aRet.SequenceZ[nRealOuter][nRealInner] = 0.0;
291 592 : nRealInner++;
292 : }
293 : }
294 :
295 16 : aRet.SequenceX[nRealOuter].realloc( nRealInner );
296 16 : aRet.SequenceY[nRealOuter].realloc( nRealInner );
297 16 : aRet.SequenceZ[nRealOuter].realloc( nRealInner );
298 :
299 16 : if( nRealInner>0 )
300 16 : nRealOuter++;
301 : }
302 :
303 16 : aRet.SequenceX.realloc( nRealOuter );
304 16 : aRet.SequenceY.realloc( nRealOuter );
305 16 : aRet.SequenceZ.realloc( nRealOuter );
306 :
307 16 : return aRet;
308 : }
309 :
310 6191 : drawing::PointSequenceSequence PolyToPointSequence(
311 : const drawing::PolyPolygonShape3D& rPolyPolygon )
312 : {
313 6191 : drawing::PointSequenceSequence aRet;
314 6191 : aRet.realloc( rPolyPolygon.SequenceX.getLength() );
315 :
316 12958 : for(sal_Int32 nN = 0; nN < rPolyPolygon.SequenceX.getLength(); nN++)
317 : {
318 6767 : sal_Int32 nInnerLength = rPolyPolygon.SequenceX[nN].getLength();
319 6767 : aRet[nN].realloc( nInnerLength );
320 42858 : for( sal_Int32 nM = 0; nM < nInnerLength; nM++)
321 : {
322 36091 : aRet[nN][nM].X = static_cast<sal_Int32>(rPolyPolygon.SequenceX[nN][nM]);
323 36091 : aRet[nN][nM].Y = static_cast<sal_Int32>(rPolyPolygon.SequenceY[nN][nM]);
324 : }
325 : }
326 6191 : return aRet;
327 : }
328 :
329 0 : void appendPointSequence( drawing::PointSequenceSequence& rTarget
330 : , drawing::PointSequenceSequence& rAdd )
331 : {
332 0 : sal_Int32 nAddCount = rAdd.getLength();
333 0 : if(!nAddCount)
334 0 : return;
335 0 : sal_Int32 nOldCount = rTarget.getLength();
336 :
337 0 : rTarget.realloc(nOldCount+nAddCount);
338 0 : for(sal_Int32 nS=0; nS<nAddCount; nS++ )
339 0 : rTarget[nOldCount+nS]=rAdd[nS];
340 : }
341 :
342 333 : drawing::Position3D operator+( const drawing::Position3D& rPos
343 : , const drawing::Direction3D& rDirection)
344 : {
345 : return drawing::Position3D(
346 333 : rPos.PositionX + rDirection.DirectionX
347 333 : , rPos.PositionY + rDirection.DirectionY
348 333 : , rPos.PositionZ + rDirection.DirectionZ
349 999 : );
350 : }
351 :
352 370 : drawing::Direction3D operator-( const drawing::Position3D& rPos1
353 : , const drawing::Position3D& rPos2)
354 : {
355 : return drawing::Direction3D(
356 370 : rPos1.PositionX - rPos2.PositionX
357 370 : , rPos1.PositionY - rPos2.PositionY
358 370 : , rPos1.PositionZ - rPos2.PositionZ
359 1110 : );
360 : }
361 :
362 0 : bool operator==( const drawing::Position3D& rPos1
363 : , const drawing::Position3D& rPos2)
364 : {
365 0 : return rPos1.PositionX == rPos2.PositionX
366 0 : && rPos1.PositionY == rPos2.PositionY
367 0 : && rPos1.PositionZ == rPos2.PositionZ;
368 : }
369 :
370 10 : awt::Point Position3DToAWTPoint( const drawing::Position3D& rPos )
371 : {
372 10 : awt::Point aRet;
373 10 : aRet.X = static_cast<sal_Int32>(rPos.PositionX);
374 10 : aRet.Y = static_cast<sal_Int32>(rPos.PositionY);
375 10 : return aRet;
376 : }
377 :
378 1222 : awt::Point ToPoint( const awt::Rectangle& rRectangle )
379 : {
380 1222 : return awt::Point( rRectangle.X, rRectangle.Y );
381 : }
382 :
383 600 : awt::Size ToSize( const awt::Rectangle& rRectangle )
384 : {
385 600 : return awt::Size( rRectangle.Width, rRectangle.Height );
386 : }
387 :
388 10 : awt::Size Direction3DToAWTSize( const drawing::Direction3D& rDirection )
389 : {
390 10 : awt::Size aRet;
391 10 : aRet.Width = static_cast<sal_Int32>(rDirection.DirectionX);
392 10 : aRet.Height = static_cast<sal_Int32>(rDirection.DirectionY);
393 10 : return aRet;
394 : }
395 :
396 0 : uno::Sequence< double > B3DPointToSequence( const ::basegfx::B3DPoint& rPoint )
397 : {
398 0 : uno::Sequence< double > aRet(3);
399 0 : aRet[0] = rPoint.getX();
400 0 : aRet[1] = rPoint.getY();
401 0 : aRet[2] = rPoint.getZ();
402 0 : return aRet;
403 : }
404 :
405 66402 : drawing::Position3D SequenceToPosition3D( const uno::Sequence< double >& rSeq )
406 : {
407 : OSL_ENSURE(rSeq.getLength()==3,"The sequence needs to have length 3 for conversion into vector");
408 :
409 66402 : drawing::Position3D aRet;
410 66402 : aRet.PositionX = rSeq.getLength()>0?rSeq[0]:0.0;
411 66402 : aRet.PositionY = rSeq.getLength()>1?rSeq[1]:0.0;
412 66402 : aRet.PositionZ = rSeq.getLength()>2?rSeq[2]:0.0;
413 66402 : return aRet;
414 : }
415 :
416 59972 : uno::Sequence< double > Position3DToSequence( const drawing::Position3D& rPosition )
417 : {
418 59972 : uno::Sequence< double > aRet(3);
419 59972 : aRet[0] = rPosition.PositionX;
420 59972 : aRet[1] = rPosition.PositionY;
421 59972 : aRet[2] = rPosition.PositionZ;
422 59972 : return aRet;
423 : }
424 :
425 : using namespace ::com::sun::star::chart2;
426 :
427 1888 : uno::Sequence< double > DataSequenceToDoubleSequence(
428 : const uno::Reference< data::XDataSequence >& xDataSequence )
429 : {
430 1888 : uno::Sequence< double > aResult;
431 : OSL_ASSERT( xDataSequence.is());
432 1888 : if(!xDataSequence.is())
433 0 : return aResult;
434 :
435 3776 : uno::Reference< data::XNumericalDataSequence > xNumericalDataSequence( xDataSequence, uno::UNO_QUERY );
436 1888 : if( xNumericalDataSequence.is() )
437 : {
438 1888 : aResult = xNumericalDataSequence->getNumericalData();
439 : }
440 : else
441 : {
442 0 : uno::Sequence< uno::Any > aValues = xDataSequence->getData();
443 0 : aResult.realloc(aValues.getLength());
444 0 : for(sal_Int32 nN=aValues.getLength();nN--;)
445 : {
446 0 : if( !(aValues[nN] >>= aResult[nN]) )
447 0 : ::rtl::math::setNan( &aResult[nN] );
448 0 : }
449 : }
450 :
451 1888 : return aResult;
452 : }
453 :
454 26 : uno::Sequence< OUString > DataSequenceToStringSequence(
455 : const uno::Reference< data::XDataSequence >& xDataSequence )
456 : {
457 26 : uno::Sequence< OUString > aResult;
458 26 : if(!xDataSequence.is())
459 0 : return aResult;
460 :
461 52 : uno::Reference< data::XTextualDataSequence > xTextualDataSequence( xDataSequence, uno::UNO_QUERY );
462 26 : if( xTextualDataSequence.is() )
463 : {
464 26 : aResult = xTextualDataSequence->getTextualData();
465 : }
466 : else
467 : {
468 0 : uno::Sequence< uno::Any > aValues = xDataSequence->getData();
469 0 : aResult.realloc(aValues.getLength());
470 :
471 0 : for(sal_Int32 nN=aValues.getLength();nN--;)
472 0 : aValues[nN] >>= aResult[nN];
473 : }
474 :
475 26 : return aResult;
476 : }
477 :
478 2734 : bool hasDoubleValue( const uno::Any& rAny )
479 : {
480 2734 : bool bRet = false;
481 2734 : double fValue = 0.0;
482 2734 : if( rAny >>= fValue )
483 6 : bRet = true;
484 2734 : return bRet;
485 : }
486 :
487 0 : bool hasLongOrShortValue( const uno::Any& rAny )
488 : {
489 0 : bool bRet = false;
490 0 : sal_Int32 n32 = 0;
491 0 : if( rAny >>= n32 )
492 0 : bRet = true;
493 : else
494 : {
495 0 : sal_Int16 n16 = 0;
496 0 : if( rAny >>= n16 )
497 0 : bRet = true;
498 : }
499 0 : return bRet;
500 : }
501 0 : sal_Int16 getShortForLongAlso( const uno::Any& rAny )
502 : {
503 0 : sal_Int16 nRet = 0;
504 :
505 0 : if( !(rAny >>= nRet) )
506 : {
507 0 : sal_Int32 n32 = 0;
508 0 : if( rAny >>= n32 )
509 0 : nRet = static_cast<sal_Int16>(n32);
510 : }
511 0 : return nRet;
512 : }
513 :
514 46 : bool replaceParamterInString( OUString & rInOutResourceString,
515 : const OUString & rParamToReplace,
516 : const OUString & rReplaceWith )
517 : {
518 46 : sal_Int32 nPos = rInOutResourceString.indexOf( rParamToReplace );
519 46 : if( nPos == -1 )
520 42 : return false;
521 :
522 8 : rInOutResourceString = rInOutResourceString.replaceAt( nPos
523 4 : , rParamToReplace.getLength(), rReplaceWith );
524 4 : return true;
525 : }
526 :
527 : } //namespace chart
528 :
529 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|