LCOV - code coverage report
Current view: top level - chart2/source/tools - CommonConverters.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 190 293 64.8 %
Date: 2014-04-11 Functions: 21 31 67.7 %
Legend: Lines: hit not hit

          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       10588 : drawing::HomogenMatrix B3DHomMatrixToHomogenMatrix( const ::basegfx::B3DHomMatrix& rM )
      38             : {
      39       10588 :     drawing::HomogenMatrix aHM;
      40       10588 :     aHM.Line1.Column1 = rM.get(0, 0);
      41       10588 :     aHM.Line1.Column2 = rM.get(0, 1);
      42       10588 :     aHM.Line1.Column3 = rM.get(0, 2);
      43       10588 :     aHM.Line1.Column4 = rM.get(0, 3);
      44       10588 :     aHM.Line2.Column1 = rM.get(1, 0);
      45       10588 :     aHM.Line2.Column2 = rM.get(1, 1);
      46       10588 :     aHM.Line2.Column3 = rM.get(1, 2);
      47       10588 :     aHM.Line2.Column4 = rM.get(1, 3);
      48       10588 :     aHM.Line3.Column1 = rM.get(2, 0);
      49       10588 :     aHM.Line3.Column2 = rM.get(2, 1);
      50       10588 :     aHM.Line3.Column3 = rM.get(2, 2);
      51       10588 :     aHM.Line3.Column4 = rM.get(2, 3);
      52       10588 :     aHM.Line4.Column1 = rM.get(3, 0);
      53       10588 :     aHM.Line4.Column2 = rM.get(3, 1);
      54       10588 :     aHM.Line4.Column3 = rM.get(3, 2);
      55       10588 :     aHM.Line4.Column4 = rM.get(3, 3);
      56       10588 :     return aHM;
      57             : }
      58             : 
      59       26823 : ::basegfx::B3DHomMatrix HomogenMatrixToB3DHomMatrix( const drawing::HomogenMatrix& rHM )
      60             : {
      61       26823 :     ::basegfx::B3DHomMatrix aM;
      62       26823 :     aM.set(0, 0, rHM.Line1.Column1);
      63       26823 :     aM.set(0, 1, rHM.Line1.Column2);
      64       26823 :     aM.set(0, 2, rHM.Line1.Column3);
      65       26823 :     aM.set(0, 3, rHM.Line1.Column4);
      66       26823 :     aM.set(1, 0, rHM.Line2.Column1);
      67       26823 :     aM.set(1, 1, rHM.Line2.Column2);
      68       26823 :     aM.set(1, 2, rHM.Line2.Column3);
      69       26823 :     aM.set(1, 3, rHM.Line2.Column4);
      70       26823 :     aM.set(2, 0, rHM.Line3.Column1);
      71       26823 :     aM.set(2, 1, rHM.Line3.Column2);
      72       26823 :     aM.set(2, 2, rHM.Line3.Column3);
      73       26823 :     aM.set(2, 3, rHM.Line3.Column4);
      74       26823 :     aM.set(3, 0, rHM.Line4.Column1);
      75       26823 :     aM.set(3, 1, rHM.Line4.Column2);
      76       26823 :     aM.set(3, 2, rHM.Line4.Column3);
      77       26823 :     aM.set(3, 3, rHM.Line4.Column4);
      78       26823 :     return aM;
      79             : }
      80             : 
      81         118 : ::basegfx::B2DHomMatrix IgnoreZ( const ::basegfx::B3DHomMatrix& rM )
      82             : {
      83         118 :     ::basegfx::B2DHomMatrix aM;
      84         118 :     aM.set(0, 0, rM.get(0, 0));
      85         118 :     aM.set(0, 1, rM.get(0, 1));
      86         118 :     aM.set(0, 2, rM.get(0, 3));
      87         118 :     aM.set(1, 0, rM.get(1, 0));
      88         118 :     aM.set(1, 1, rM.get(1, 1));
      89         118 :     aM.set(1, 2, rM.get(1, 3));
      90         118 :     aM.set(2, 0, rM.get(3, 0));
      91         118 :     aM.set(2, 1, rM.get(3, 1));
      92         118 :     aM.set(2, 2, rM.get(3, 3));
      93         118 :     return aM;
      94             : }
      95             : 
      96       18354 : drawing::HomogenMatrix3 B2DHomMatrixToHomogenMatrix3( const ::basegfx::B2DHomMatrix& rM )
      97             : {
      98       18354 :     drawing::HomogenMatrix3 aHM;
      99       18354 :     aHM.Line1.Column1 = rM.get(0, 0);
     100       18354 :     aHM.Line1.Column2 = rM.get(0, 1);
     101       18354 :     aHM.Line1.Column3 = rM.get(0, 2);
     102       18354 :     aHM.Line2.Column1 = rM.get(1, 0);
     103       18354 :     aHM.Line2.Column2 = rM.get(1, 1);
     104       18354 :     aHM.Line2.Column3 = rM.get(1, 2);
     105       18354 :     aHM.Line3.Column1 = rM.get(2, 0);
     106       18354 :     aHM.Line3.Column2 = rM.get(2, 1);
     107       18354 :     aHM.Line3.Column3 = rM.get(2, 2);
     108       18354 :     return aHM;
     109             : }
     110             : 
     111         576 : ::basegfx::B3DPoint Position3DToB3DPoint( const drawing::Position3D& rPosition )
     112             : {
     113             :     return ::basegfx::B3DPoint(
     114             :         rPosition.PositionX ,
     115             :         rPosition.PositionY ,
     116         576 :         rPosition.PositionZ );
     117             : }
     118             : 
     119         144 : drawing::Direction3D B3DVectorToDirection3D( const ::basegfx::B3DVector& rVector)
     120             : {
     121             :     return drawing::Direction3D(
     122         144 :           rVector.getX()
     123         144 :         , rVector.getY()
     124         144 :         , rVector.getZ()
     125         432 :         );
     126             : }
     127             : 
     128         236 : drawing::Position3D B3DPointToPosition3D( const ::basegfx::B3DPoint& rPoint)
     129             : {
     130             :         return drawing::Position3D(
     131         236 :           rPoint.getX()
     132         236 :         , rPoint.getY()
     133         236 :         , rPoint.getZ()
     134         708 :         );
     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       36855 : void AddPointToPoly( drawing::PolyPolygonShape3D& rPoly, const drawing::Position3D& rPos, sal_Int32 nPolygonIndex )
     147             : {
     148       36855 :     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       36855 :     if(nPolygonIndex >= rPoly.SequenceX.getLength() )
     156             :     {
     157         895 :         rPoly.SequenceX.realloc(nPolygonIndex+1);
     158         895 :         rPoly.SequenceY.realloc(nPolygonIndex+1);
     159         895 :         rPoly.SequenceZ.realloc(nPolygonIndex+1);
     160             :     }
     161             : 
     162       36855 :     drawing::DoubleSequence* pOuterSequenceX = &rPoly.SequenceX.getArray()[nPolygonIndex];
     163       36855 :     drawing::DoubleSequence* pOuterSequenceY = &rPoly.SequenceY.getArray()[nPolygonIndex];
     164       36855 :     drawing::DoubleSequence* pOuterSequenceZ = &rPoly.SequenceZ.getArray()[nPolygonIndex];
     165             : 
     166       36855 :     sal_Int32 nOldPointCount = pOuterSequenceX->getLength();
     167             : 
     168       36855 :     pOuterSequenceX->realloc(nOldPointCount+1);
     169       36855 :     pOuterSequenceY->realloc(nOldPointCount+1);
     170       36855 :     pOuterSequenceZ->realloc(nOldPointCount+1);
     171             : 
     172       36855 :     double* pInnerSequenceX = pOuterSequenceX->getArray();
     173       36855 :     double* pInnerSequenceY = pOuterSequenceY->getArray();
     174       36855 :     double* pInnerSequenceZ = pOuterSequenceZ->getArray();
     175             : 
     176       36855 :     pInnerSequenceX[nOldPointCount] = rPos.PositionX;
     177       36855 :     pInnerSequenceY[nOldPointCount] = rPos.PositionY;
     178       36855 :     pInnerSequenceZ[nOldPointCount] = rPos.PositionZ;
     179       36855 : }
     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           8 : drawing::PolyPolygonShape3D BezierToPoly(
     262             :     const drawing::PolyPolygonBezierCoords& rBezier )
     263             : {
     264           8 :     const drawing::PointSequenceSequence& rPointSequence = rBezier.Coordinates;
     265             : 
     266           8 :     drawing::PolyPolygonShape3D aRet;
     267           8 :     aRet.SequenceX.realloc( rPointSequence.getLength() );
     268           8 :     aRet.SequenceY.realloc( rPointSequence.getLength() );
     269           8 :     aRet.SequenceZ.realloc( rPointSequence.getLength() );
     270             : 
     271           8 :     sal_Int32 nRealOuter = 0;
     272          16 :     for(sal_Int32 nN = 0; nN < rPointSequence.getLength(); nN++)
     273             :     {
     274           8 :         sal_Int32 nInnerLength = rPointSequence[nN].getLength();
     275           8 :         aRet.SequenceX[nN].realloc( nInnerLength );
     276           8 :         aRet.SequenceY[nN].realloc( nInnerLength );
     277           8 :         aRet.SequenceZ[nN].realloc( nInnerLength );
     278             : 
     279           8 :         bool bHasOuterFlags = nN < rBezier.Flags.getLength();
     280             : 
     281           8 :         sal_Int32 nRealInner = 0;
     282         848 :         for( sal_Int32 nM = 0; nM < nInnerLength; nM++)
     283             :         {
     284         840 :             bool bHasInnerFlags = bHasOuterFlags && (nM < rBezier.Flags[nN].getLength());
     285             : 
     286         840 :             if( !bHasInnerFlags || (rBezier.Flags[nN][nM] == drawing::PolygonFlags_NORMAL) )
     287             :             {
     288         296 :                 aRet.SequenceX[nRealOuter][nRealInner] = rPointSequence[nN][nM].X;
     289         296 :                 aRet.SequenceY[nRealOuter][nRealInner] = rPointSequence[nN][nM].Y;
     290         296 :                 aRet.SequenceZ[nRealOuter][nRealInner] = 0.0;
     291         296 :                 nRealInner++;
     292             :             }
     293             :         }
     294             : 
     295           8 :         aRet.SequenceX[nRealOuter].realloc( nRealInner );
     296           8 :         aRet.SequenceY[nRealOuter].realloc( nRealInner );
     297           8 :         aRet.SequenceZ[nRealOuter].realloc( nRealInner );
     298             : 
     299           8 :         if( nRealInner>0 )
     300           8 :             nRealOuter++;
     301             :     }
     302             : 
     303           8 :     aRet.SequenceX.realloc( nRealOuter );
     304           8 :     aRet.SequenceY.realloc( nRealOuter );
     305           8 :     aRet.SequenceZ.realloc( nRealOuter );
     306             : 
     307           8 :     return aRet;
     308             : }
     309             : 
     310        7388 : drawing::PointSequenceSequence PolyToPointSequence(
     311             :                 const drawing::PolyPolygonShape3D& rPolyPolygon )
     312             : {
     313        7388 :     drawing::PointSequenceSequence aRet;
     314        7388 :     aRet.realloc( rPolyPolygon.SequenceX.getLength() );
     315             : 
     316       15210 :     for(sal_Int32 nN = 0; nN < rPolyPolygon.SequenceX.getLength(); nN++)
     317             :     {
     318        7822 :         sal_Int32 nInnerLength = rPolyPolygon.SequenceX[nN].getLength();
     319        7822 :         aRet[nN].realloc( nInnerLength );
     320       46300 :         for( sal_Int32 nM = 0; nM < nInnerLength; nM++)
     321             :         {
     322       38478 :             aRet[nN][nM].X = static_cast<sal_Int32>(rPolyPolygon.SequenceX[nN][nM]);
     323       38478 :             aRet[nN][nM].Y = static_cast<sal_Int32>(rPolyPolygon.SequenceY[nN][nM]);
     324             :         }
     325             :     }
     326        7388 :     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         108 : drawing::Position3D  operator+( const drawing::Position3D& rPos
     343             :                            , const drawing::Direction3D& rDirection)
     344             : {
     345             :     return drawing::Position3D(
     346         108 :           rPos.PositionX + rDirection.DirectionX
     347         108 :         , rPos.PositionY + rDirection.DirectionY
     348         108 :         , rPos.PositionZ + rDirection.DirectionZ
     349         324 :         );
     350             : }
     351             : 
     352         167 : drawing::Direction3D  operator-( const drawing::Position3D& rPos1
     353             :                            , const drawing::Position3D& rPos2)
     354             : {
     355             :     return drawing::Direction3D(
     356         167 :           rPos1.PositionX - rPos2.PositionX
     357         167 :         , rPos1.PositionY - rPos2.PositionY
     358         167 :         , rPos1.PositionZ - rPos2.PositionZ
     359         501 :         );
     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           5 : awt::Point Position3DToAWTPoint( const drawing::Position3D& rPos )
     371             : {
     372           5 :     awt::Point aRet;
     373           5 :     aRet.X = static_cast<sal_Int32>(rPos.PositionX);
     374           5 :     aRet.Y = static_cast<sal_Int32>(rPos.PositionY);
     375           5 :     return aRet;
     376             : }
     377             : 
     378         479 : awt::Point ToPoint( const awt::Rectangle& rRectangle )
     379             : {
     380         479 :     return awt::Point( rRectangle.X, rRectangle.Y );
     381             : }
     382             : 
     383         193 : awt::Size ToSize( const awt::Rectangle& rRectangle )
     384             : {
     385         193 :     return awt::Size( rRectangle.Width, rRectangle.Height );
     386             : }
     387             : 
     388           5 : awt::Size Direction3DToAWTSize( const drawing::Direction3D& rDirection )
     389             : {
     390           5 :     awt::Size aRet;
     391           5 :     aRet.Width = static_cast<sal_Int32>(rDirection.DirectionX);
     392           5 :     aRet.Height = static_cast<sal_Int32>(rDirection.DirectionY);
     393           5 :     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       73207 : 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       73207 :     drawing::Position3D aRet;
     410       73207 :     aRet.PositionX = rSeq.getLength()>0?rSeq[0]:0.0;
     411       73207 :     aRet.PositionY = rSeq.getLength()>1?rSeq[1]:0.0;
     412       73207 :     aRet.PositionZ = rSeq.getLength()>2?rSeq[2]:0.0;
     413       73207 :     return aRet;
     414             : }
     415             : 
     416       67231 : uno::Sequence< double > Position3DToSequence( const drawing::Position3D& rPosition )
     417             : {
     418       67231 :     uno::Sequence< double > aRet(3);
     419       67231 :     aRet[0] = rPosition.PositionX;
     420       67231 :     aRet[1] = rPosition.PositionY;
     421       67231 :     aRet[2] = rPosition.PositionZ;
     422       67231 :     return aRet;
     423             : }
     424             : 
     425             : using namespace ::com::sun::star::chart2;
     426             : 
     427        2017 : uno::Sequence< double > DataSequenceToDoubleSequence(
     428             :     const uno::Reference< data::XDataSequence >& xDataSequence )
     429             : {
     430        2017 :     uno::Sequence< double > aResult;
     431             :     OSL_ASSERT( xDataSequence.is());
     432        2017 :     if(!xDataSequence.is())
     433           0 :         return aResult;
     434             : 
     435        4034 :     uno::Reference< data::XNumericalDataSequence > xNumericalDataSequence( xDataSequence, uno::UNO_QUERY );
     436        2017 :     if( xNumericalDataSequence.is() )
     437             :     {
     438        2017 :         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        2017 :     return aResult;
     452             : }
     453             : 
     454           0 : uno::Sequence< OUString > DataSequenceToStringSequence(
     455             :     const uno::Reference< data::XDataSequence >& xDataSequence )
     456             : {
     457           0 :     uno::Sequence< OUString > aResult;
     458           0 :     if(!xDataSequence.is())
     459           0 :         return aResult;
     460             : 
     461           0 :     uno::Reference< data::XTextualDataSequence > xTextualDataSequence( xDataSequence, uno::UNO_QUERY );
     462           0 :     if( xTextualDataSequence.is() )
     463             :     {
     464           0 :         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           0 :     return aResult;
     476             : }
     477             : 
     478         913 : sal_Bool hasDoubleValue( const uno::Any& rAny )
     479             : {
     480         913 :     sal_Bool bRet = sal_False;
     481         913 :     double fValue = 0.0;
     482         913 :     if( rAny >>= fValue )
     483           3 :         bRet = sal_True;
     484         913 :     return bRet;
     485             : }
     486             : 
     487           0 : sal_Bool hasLongOrShortValue( const uno::Any& rAny )
     488             : {
     489           0 :     sal_Bool bRet = sal_False;
     490           0 :     sal_Int32 n32 = 0;
     491           0 :     if( rAny >>= n32 )
     492           0 :         bRet = sal_True;
     493             :     else
     494             :     {
     495           0 :         sal_Int16 n16 = 0;
     496           0 :         if( rAny >>= n16 )
     497           0 :             bRet = sal_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          53 : bool replaceParamterInString( OUString & rInOutResourceString,
     515             :                             const OUString & rParamToReplace,
     516             :                             const OUString & rReplaceWith )
     517             : {
     518          53 :     sal_Int32 nPos = rInOutResourceString.indexOf( rParamToReplace );
     519          53 :     if( nPos == -1 )
     520          21 :         return false;
     521             : 
     522          64 :     rInOutResourceString = rInOutResourceString.replaceAt( nPos
     523          32 :                         , rParamToReplace.getLength(), rReplaceWith );
     524          32 :     return true;
     525             : }
     526             : 
     527             : } //namespace chart
     528             : 
     529             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10