2003-10-06 03:58:36 -05:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 15:01:52 -05:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2003-10-06 03:58:36 -05:00
|
|
|
*
|
2010-02-12 08:01:35 -06:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2003-10-06 03:58:36 -05:00
|
|
|
*
|
2008-04-10 15:01:52 -05:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2003-10-06 03:58:36 -05:00
|
|
|
*
|
2008-04-10 15:01:52 -05:00
|
|
|
* This file is part of OpenOffice.org.
|
2003-10-06 03:58:36 -05:00
|
|
|
*
|
2008-04-10 15:01:52 -05:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2003-10-06 03:58:36 -05:00
|
|
|
*
|
2008-04-10 15:01:52 -05:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2003-10-06 03:58:36 -05:00
|
|
|
*
|
2008-04-10 15:01:52 -05:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2003-10-06 03:58:36 -05:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
#ifndef __CHART_COMMON_CONVERTERS_HXX
|
|
|
|
#define __CHART_COMMON_CONVERTERS_HXX
|
|
|
|
|
|
|
|
#include <tools/poly.hxx>
|
2007-05-22 12:13:46 -05:00
|
|
|
#include <com/sun/star/awt/Point.hpp>
|
|
|
|
#include <com/sun/star/awt/Rectangle.hpp>
|
|
|
|
#include <com/sun/star/awt/Size.hpp>
|
2003-10-06 03:58:36 -05:00
|
|
|
#include <com/sun/star/drawing/Direction3D.hpp>
|
|
|
|
#include <com/sun/star/drawing/HomogenMatrix.hpp>
|
|
|
|
#include <com/sun/star/drawing/HomogenMatrix3.hpp>
|
2007-05-22 12:13:46 -05:00
|
|
|
#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
|
2003-10-06 03:58:36 -05:00
|
|
|
#include <com/sun/star/drawing/PointSequenceSequence.hpp>
|
|
|
|
#include <com/sun/star/drawing/Position3D.hpp>
|
|
|
|
#include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
|
|
|
|
#include <com/sun/star/text/WritingMode.hpp>
|
2007-05-22 12:13:46 -05:00
|
|
|
#include <com/sun/star/chart2/data/XDataSequence.hpp>
|
2006-11-14 08:32:16 -06:00
|
|
|
#include <basegfx/matrix/b2dhommatrix.hxx>
|
|
|
|
#include <basegfx/point/b3dpoint.hxx>
|
|
|
|
#include <basegfx/vector/b3dvector.hxx>
|
2008-12-30 07:32:01 -06:00
|
|
|
#include "charttoolsdllapi.hxx"
|
2006-11-14 08:32:16 -06:00
|
|
|
|
2007-05-22 12:13:46 -05:00
|
|
|
#include <vector>
|
|
|
|
#include <algorithm>
|
|
|
|
|
2003-10-06 03:58:36 -05:00
|
|
|
//.............................................................................
|
|
|
|
namespace chart
|
|
|
|
{
|
|
|
|
//.............................................................................
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
/**
|
2006-11-14 08:32:16 -06:00
|
|
|
diverse methods for class conversions; e.g. ::basegfx::B3DHomMatrix to HomogenMatrix
|
2003-10-06 03:58:36 -05:00
|
|
|
and operations e.g drawing::Position3D + drawing::Direction3D
|
|
|
|
*/
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
2006-11-14 08:32:16 -06:00
|
|
|
/** ::basegfx::B3DHomMatrix -> HomogenMatrix
|
2003-10-06 03:58:36 -05:00
|
|
|
*/
|
2008-12-30 07:32:01 -06:00
|
|
|
OOO_DLLPUBLIC_CHARTTOOLS com::sun::star::drawing::HomogenMatrix
|
2007-05-22 12:13:46 -05:00
|
|
|
B3DHomMatrixToHomogenMatrix( const ::basegfx::B3DHomMatrix& rM );
|
2003-10-06 03:58:36 -05:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
2006-11-14 08:32:16 -06:00
|
|
|
/** HomogenMatrix -> ::basegfx::B3DHomMatrix
|
2003-10-06 03:58:36 -05:00
|
|
|
*/
|
2008-12-30 07:32:01 -06:00
|
|
|
OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B3DHomMatrix HomogenMatrixToB3DHomMatrix( const com::sun::star::drawing::HomogenMatrix& rHM );
|
2003-10-06 03:58:36 -05:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
2006-11-14 08:32:16 -06:00
|
|
|
/** ::basegfx::B3DHomMatrix -> B2DHomMatrix
|
2003-10-06 03:58:36 -05:00
|
|
|
*/
|
2008-12-30 07:32:01 -06:00
|
|
|
OOO_DLLPUBLIC_CHARTTOOLS
|
2007-05-22 12:13:46 -05:00
|
|
|
::basegfx::B2DHomMatrix IgnoreZ( const ::basegfx::B3DHomMatrix& rM );
|
2003-10-06 03:58:36 -05:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
2006-11-14 08:32:16 -06:00
|
|
|
/** B2DHomMatrix <-> HomogenMatrix3
|
2003-10-06 03:58:36 -05:00
|
|
|
*/
|
2008-12-30 07:32:01 -06:00
|
|
|
OOO_DLLPUBLIC_CHARTTOOLS com::sun::star::drawing::HomogenMatrix3
|
2007-05-22 12:13:46 -05:00
|
|
|
B2DHomMatrixToHomogenMatrix3( const ::basegfx::B2DHomMatrix& rM );
|
2003-10-06 03:58:36 -05:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
2006-11-14 08:32:16 -06:00
|
|
|
/** Position3D -> B3DPoint
|
2003-10-06 03:58:36 -05:00
|
|
|
*/
|
2008-12-30 07:32:01 -06:00
|
|
|
OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B3DPoint Position3DToB3DPoint( const com::sun::star::drawing::Position3D& rPosition );
|
2003-10-06 03:58:36 -05:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
2006-11-14 08:32:16 -06:00
|
|
|
/** B3DVector -> Direction3D
|
2003-10-06 03:58:36 -05:00
|
|
|
*/
|
2008-12-30 07:32:01 -06:00
|
|
|
OOO_DLLPUBLIC_CHARTTOOLS com::sun::star::drawing::Direction3D B3DVectorToDirection3D( const ::basegfx::B3DVector& rVector);
|
2003-10-06 03:58:36 -05:00
|
|
|
|
2007-05-22 12:13:46 -05:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
/** B3DPoint -> Position3D
|
|
|
|
*/
|
2008-12-30 07:32:01 -06:00
|
|
|
OOO_DLLPUBLIC_CHARTTOOLS com::sun::star::drawing::Position3D B3DPointToPosition3D( const ::basegfx::B3DPoint& rPoint);
|
2007-05-22 12:13:46 -05:00
|
|
|
|
2008-10-17 03:40:10 -05:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
/** Direction3D -> B3DVector
|
|
|
|
*/
|
2008-12-30 07:32:01 -06:00
|
|
|
OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B3DVector Direction3DToB3DVector( const com::sun::star::drawing::Direction3D& rDirection);
|
2008-10-17 03:40:10 -05:00
|
|
|
|
2003-10-06 03:58:36 -05:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
/** PolyPolygonShape3D + drawing::Position3D -> PolyPolygonShape3D
|
|
|
|
*/
|
2008-12-30 07:32:01 -06:00
|
|
|
OOO_DLLPUBLIC_CHARTTOOLS
|
2003-11-04 06:14:20 -06:00
|
|
|
void AddPointToPoly( ::com::sun::star::drawing::PolyPolygonShape3D& rPoly
|
2003-10-06 03:58:36 -05:00
|
|
|
, const com::sun::star::drawing::Position3D& rPos
|
|
|
|
, sal_Int32 nSequenceIndex=0 );
|
|
|
|
|
2003-11-04 06:14:20 -06:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
/** get a single Point from a Polygon
|
|
|
|
*/
|
2008-12-30 07:32:01 -06:00
|
|
|
OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::drawing::Position3D getPointFromPoly(
|
2003-11-04 06:14:20 -06:00
|
|
|
const ::com::sun::star::drawing::PolyPolygonShape3D& rPolygon
|
|
|
|
, sal_Int32 nPointIndex, sal_Int32 nPolyIndex=0 );
|
|
|
|
|
2003-10-06 03:58:36 -05:00
|
|
|
//-----------------------------------------------------------------------------
|
2009-08-26 04:55:20 -05:00
|
|
|
OOO_DLLPUBLIC_CHARTTOOLS
|
|
|
|
void addPolygon( com::sun::star::drawing::PolyPolygonShape3D& rRet
|
|
|
|
, const com::sun::star::drawing::PolyPolygonShape3D& rAdd );
|
|
|
|
//-----------------------------------------------------------------------------
|
2003-10-06 03:58:36 -05:00
|
|
|
/** PolyPolygonShape3D + PolyPolygonShape3D -> PolyPolygonShape3D
|
|
|
|
*/
|
2008-12-30 07:32:01 -06:00
|
|
|
OOO_DLLPUBLIC_CHARTTOOLS
|
2003-10-06 03:58:36 -05:00
|
|
|
void appendPoly( com::sun::star::drawing::PolyPolygonShape3D& rRet
|
|
|
|
, const com::sun::star::drawing::PolyPolygonShape3D& rAdd );
|
|
|
|
|
2007-05-22 12:13:46 -05:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
/** PolyPolygonBezierCoords -> PolyPolygonShape3D
|
|
|
|
*/
|
2008-12-30 07:32:01 -06:00
|
|
|
OOO_DLLPUBLIC_CHARTTOOLS
|
2007-05-22 12:13:46 -05:00
|
|
|
com::sun::star::drawing::PolyPolygonShape3D BezierToPoly(
|
|
|
|
const com::sun::star::drawing::PolyPolygonBezierCoords& rBezier );
|
|
|
|
|
2003-10-06 03:58:36 -05:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
/** PolyPolygonShape3D -> drawing::PointSequenceSequence (2D)
|
|
|
|
*/
|
2008-12-30 07:32:01 -06:00
|
|
|
OOO_DLLPUBLIC_CHARTTOOLS
|
2003-10-06 03:58:36 -05:00
|
|
|
com::sun::star::drawing::PointSequenceSequence PolyToPointSequence(
|
|
|
|
const com::sun::star::drawing::PolyPolygonShape3D& rPolyPolygon );
|
|
|
|
|
2004-01-17 06:10:08 -06:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
/** drawing::PointSequenceSequence + drawing::PointSequenceSequence
|
|
|
|
*/
|
2008-12-30 07:32:01 -06:00
|
|
|
OOO_DLLPUBLIC_CHARTTOOLS
|
2004-01-17 06:10:08 -06:00
|
|
|
void appendPointSequence( com::sun::star::drawing::PointSequenceSequence& rTarget
|
|
|
|
, com::sun::star::drawing::PointSequenceSequence& rAdd );
|
|
|
|
|
2003-10-06 03:58:36 -05:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
/** Position3D + Direction3D == Position3D
|
|
|
|
*/
|
2008-12-30 07:32:01 -06:00
|
|
|
OOO_DLLPUBLIC_CHARTTOOLS com::sun::star::drawing::Position3D
|
2003-10-06 03:58:36 -05:00
|
|
|
operator+( const com::sun::star::drawing::Position3D& rPos
|
|
|
|
, const com::sun::star::drawing::Direction3D& rDirection);
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
/** Position3D - Position3D == Direction3D
|
|
|
|
*/
|
2008-12-30 07:32:01 -06:00
|
|
|
OOO_DLLPUBLIC_CHARTTOOLS com::sun::star::drawing::Direction3D
|
2003-10-06 03:58:36 -05:00
|
|
|
operator-( const com::sun::star::drawing::Position3D& rPos1
|
|
|
|
, const com::sun::star::drawing::Position3D& rPos2);
|
|
|
|
|
2003-11-04 03:23:04 -06:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
/** Position3D == Position3D ?
|
|
|
|
*/
|
2008-12-30 07:32:01 -06:00
|
|
|
OOO_DLLPUBLIC_CHARTTOOLS
|
2003-11-04 03:23:04 -06:00
|
|
|
bool operator==( const com::sun::star::drawing::Position3D& rPos1
|
|
|
|
, const com::sun::star::drawing::Position3D& rPos2);
|
|
|
|
|
2007-05-22 12:13:46 -05:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
/** awt::Rect --> awt::Point (2D)
|
|
|
|
*/
|
2008-12-30 07:32:01 -06:00
|
|
|
OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::awt::Point ToPoint( const com::sun::star::awt::Rectangle& rRectangle );
|
2007-05-22 12:13:46 -05:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
/** awt::Rect --> awt::Size (2D)
|
|
|
|
*/
|
2008-12-30 07:32:01 -06:00
|
|
|
OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::awt::Size ToSize( const com::sun::star::awt::Rectangle& rRectangle );
|
2007-05-22 12:13:46 -05:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
/** Position3D --> awt::Point (2D)
|
|
|
|
*/
|
2008-12-30 07:32:01 -06:00
|
|
|
OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::awt::Point Position3DToAWTPoint( const com::sun::star::drawing::Position3D& rPos );
|
2007-05-22 12:13:46 -05:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
/** Direction3D --> awt::Size (2D)
|
|
|
|
*/
|
2008-12-30 07:32:01 -06:00
|
|
|
OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::awt::Size Direction3DToAWTSize( const com::sun::star::drawing::Direction3D& rDirection );
|
2007-05-22 12:13:46 -05:00
|
|
|
|
2003-10-06 03:58:36 -05:00
|
|
|
//-----------------------------------------------------------------------------
|
2006-11-14 08:32:16 -06:00
|
|
|
/** B3DPoint -> Sequence<double>
|
2003-10-06 03:58:36 -05:00
|
|
|
*/
|
2008-12-30 07:32:01 -06:00
|
|
|
OOO_DLLPUBLIC_CHARTTOOLS com::sun::star::uno::Sequence< double > B3DPointToSequence( const ::basegfx::B3DPoint& rPoint );
|
2003-10-06 03:58:36 -05:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
/** Sequence<double> -> drawing::Position3D
|
|
|
|
*/
|
2008-12-30 07:32:01 -06:00
|
|
|
OOO_DLLPUBLIC_CHARTTOOLS com::sun::star::drawing::Position3D
|
2003-10-06 03:58:36 -05:00
|
|
|
SequenceToPosition3D( const com::sun::star::uno::Sequence< double >& rSeq );
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
/** drawing::Position3D -> Sequence<double>
|
|
|
|
*/
|
|
|
|
|
2008-12-30 07:32:01 -06:00
|
|
|
OOO_DLLPUBLIC_CHARTTOOLS com::sun::star::uno::Sequence< double >
|
2003-10-06 03:58:36 -05:00
|
|
|
Position3DToSequence( const com::sun::star::drawing::Position3D& rPosition );
|
|
|
|
|
2003-12-17 07:30:48 -06:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
/** chart2::XDataSequence -> uno::Sequence< double >
|
|
|
|
*/
|
|
|
|
|
2008-12-30 07:32:01 -06:00
|
|
|
OOO_DLLPUBLIC_CHARTTOOLS
|
2003-12-17 07:30:48 -06:00
|
|
|
::com::sun::star::uno::Sequence< double > DataSequenceToDoubleSequence(
|
|
|
|
const ::com::sun::star::uno::Reference<
|
2007-05-22 12:13:46 -05:00
|
|
|
::com::sun::star::chart2::data::XDataSequence > & xDataSequence );
|
|
|
|
|
2008-12-30 07:32:01 -06:00
|
|
|
OOO_DLLPUBLIC_CHARTTOOLS
|
2007-05-22 12:13:46 -05:00
|
|
|
::com::sun::star::uno::Sequence< rtl::OUString > DataSequenceToStringSequence(
|
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::chart2::data::XDataSequence > & xDataSequence );
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
/** uno::Sequence< uno::Sequence< T > > -> uno::Sequence< T >
|
|
|
|
*/
|
|
|
|
template< typename T >
|
|
|
|
::com::sun::star::uno::Sequence< T >
|
|
|
|
FlattenSequence( const ::com::sun::star::uno::Sequence<
|
|
|
|
::com::sun::star::uno::Sequence< T > > & aSeqSeq )
|
|
|
|
{
|
|
|
|
sal_Int32 nOuter, nInner, nCount = 0,
|
|
|
|
nResultSize = 0;
|
|
|
|
const sal_Int32 nOuterSize = aSeqSeq.getLength();
|
|
|
|
for( nOuter=0; nOuter<nOuterSize; ++nOuter )
|
|
|
|
nResultSize += aSeqSeq[nOuter].getLength();
|
|
|
|
::com::sun::star::uno::Sequence< T > aResult( nResultSize );
|
|
|
|
|
|
|
|
for( nOuter=0; nOuter<nOuterSize; ++nOuter )
|
|
|
|
{
|
|
|
|
const sal_Int32 nInnerSize = aSeqSeq[nOuter].getLength();
|
|
|
|
for( nInner=0; nInner<nInnerSize; ++nInner, ++nCount )
|
|
|
|
aResult[nCount] = aSeqSeq[nOuter][nInner];
|
|
|
|
}
|
|
|
|
return aResult;
|
|
|
|
}
|
|
|
|
|
|
|
|
template< typename T >
|
|
|
|
::std::vector< T >
|
|
|
|
FlattenVector( const ::std::vector< ::std::vector< T > > & rVecVec )
|
|
|
|
{
|
|
|
|
typedef ::std::vector< T > tFlatVec;
|
|
|
|
typedef ::std::vector< tFlatVec > tVecVec;
|
|
|
|
|
|
|
|
tFlatVec aResult;
|
|
|
|
typename tVecVec::const_iterator aOuterEnd( rVecVec.end());
|
|
|
|
for( typename tVecVec::const_iterator aOuterIt( rVecVec.begin()); aOuterIt != aOuterEnd; ++aOuterIt )
|
|
|
|
::std::copy( aOuterIt->begin(), aOuterIt->end(), back_inserter( aResult ));
|
|
|
|
return aResult;
|
|
|
|
}
|
|
|
|
|
2008-12-30 07:32:01 -06:00
|
|
|
OOO_DLLPUBLIC_CHARTTOOLS
|
2007-05-22 12:13:46 -05:00
|
|
|
sal_Bool hasDoubleValue( const ::com::sun::star::uno::Any& rAny );
|
|
|
|
|
2008-12-30 07:32:01 -06:00
|
|
|
OOO_DLLPUBLIC_CHARTTOOLS
|
2007-05-22 12:13:46 -05:00
|
|
|
sal_Bool hasLongOrShortValue( const ::com::sun::star::uno::Any& rAny );
|
2008-12-30 07:32:01 -06:00
|
|
|
OOO_DLLPUBLIC_CHARTTOOLS
|
2007-05-22 12:13:46 -05:00
|
|
|
sal_Int16 getShortForLongAlso( const ::com::sun::star::uno::Any& rAny );
|
|
|
|
|
2008-12-30 07:32:01 -06:00
|
|
|
OOO_DLLPUBLIC_CHARTTOOLS
|
2007-05-22 12:13:46 -05:00
|
|
|
bool replaceParamterInString( rtl::OUString & rInOutResourceString,
|
|
|
|
const rtl::OUString & rParamToReplace,
|
|
|
|
const rtl::OUString & rReplaceWith );
|
2003-12-17 07:30:48 -06:00
|
|
|
|
2003-10-06 03:58:36 -05:00
|
|
|
//.............................................................................
|
|
|
|
} //namespace chart
|
|
|
|
//.............................................................................
|
|
|
|
#endif
|