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

Generated by: LCOV version 1.10