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