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

Generated by: LCOV version 1.11