LibreOffice Module chart2 (master) 1
CommonConverters.hxx
Go to the documentation of this file.
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#pragma once
20
21#include <com/sun/star/awt/Point.hpp>
22#include <com/sun/star/awt/Size.hpp>
23#include <com/sun/star/drawing/Direction3D.hpp>
24#include <com/sun/star/drawing/HomogenMatrix.hpp>
25#include <com/sun/star/drawing/HomogenMatrix3.hpp>
26#include <com/sun/star/drawing/PointSequenceSequence.hpp>
27#include <com/sun/star/drawing/Position3D.hpp>
28#include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
33#include "charttoolsdllapi.hxx"
34
35namespace com::sun::star::awt { struct Rectangle; }
36namespace com::sun::star::chart2::data { class XDataSequence; }
37namespace com::sun::star::drawing { struct PolyPolygonBezierCoords; }
38
39namespace chart
40{
41
49OOO_DLLPUBLIC_CHARTTOOLS css::drawing::HomogenMatrix
50 B3DHomMatrixToHomogenMatrix( const ::basegfx::B3DHomMatrix& rM );
51
54OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B3DHomMatrix HomogenMatrixToB3DHomMatrix( const css::drawing::HomogenMatrix& rHM );
55
58OOO_DLLPUBLIC_CHARTTOOLS
59::basegfx::B2DHomMatrix IgnoreZ( const ::basegfx::B3DHomMatrix& rM );
60
63OOO_DLLPUBLIC_CHARTTOOLS css::drawing::HomogenMatrix3
64 B2DHomMatrixToHomogenMatrix3( const ::basegfx::B2DHomMatrix& rM );
65
68OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B3DPoint Position3DToB3DPoint( const css::drawing::Position3D& rPosition );
69
72OOO_DLLPUBLIC_CHARTTOOLS css::drawing::Direction3D B3DVectorToDirection3D( const ::basegfx::B3DVector& rVector);
73
76OOO_DLLPUBLIC_CHARTTOOLS css::drawing::Position3D B3DPointToPosition3D( const ::basegfx::B3DPoint& rPoint);
77
80OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B3DVector Direction3DToB3DVector( const css::drawing::Direction3D& rDirection);
81
85void AddPointToPoly( css::drawing::PolyPolygonShape3D& rPoly
86 , const css::drawing::Position3D& rPos
87 , sal_Int32 nSequenceIndex=0 );
89void AddPointToPoly( std::vector<std::vector<css::drawing::Position3D>>& rPoly
90 , const css::drawing::Position3D& rPos
91 , sal_Int32 nSequenceIndex=0 );
92
95OOO_DLLPUBLIC_CHARTTOOLS css::drawing::Position3D getPointFromPoly(
96 const std::vector<std::vector<css::drawing::Position3D>>& rPolygon
97 , sal_Int32 nPointIndex, sal_Int32 nPolyIndex );
99 const css::drawing::PolyPolygonShape3D& rPolygon
100 , sal_Int32 nPointIndex, sal_Int32 nPolyIndex );
101
103void addPolygon( std::vector<std::vector<css::drawing::Position3D>>& rRet
104 , const std::vector<std::vector<css::drawing::Position3D>>& rAdd );
108void appendPoly( std::vector<std::vector<css::drawing::Position3D>>& rRet
109 , const std::vector<std::vector<css::drawing::Position3D>>& rAdd );
110
114css::drawing::PolyPolygonShape3D BezierToPoly(
115 const css::drawing::PolyPolygonBezierCoords& rBezier );
116
120css::drawing::PointSequenceSequence PolyToPointSequence(
121 const css::drawing::PolyPolygonShape3D& rPolyPolygon );
123css::drawing::PointSequenceSequence PolyToPointSequence(
124 const std::vector<std::vector<css::drawing::Position3D>>& rPolyPolygon );
125
130 const std::vector<std::vector<css::drawing::Position3D>>& rPolyPolygon );
131
135void appendPointSequence( css::drawing::PointSequenceSequence& rTarget
136 , const css::drawing::PointSequenceSequence& rAdd );
137
140OOO_DLLPUBLIC_CHARTTOOLS css::drawing::Position3D
141 operator+( const css::drawing::Position3D& rPos
142 , const css::drawing::Direction3D& rDirection);
143
146OOO_DLLPUBLIC_CHARTTOOLS css::drawing::Direction3D
147 operator-( const css::drawing::Position3D& rPos1
148 , const css::drawing::Position3D& rPos2);
149
152OOO_DLLPUBLIC_CHARTTOOLS css::awt::Point ToPoint( const css::awt::Rectangle& rRectangle );
153
156OOO_DLLPUBLIC_CHARTTOOLS css::awt::Size ToSize( const css::awt::Rectangle& rRectangle );
157
160OOO_DLLPUBLIC_CHARTTOOLS css::awt::Point Position3DToAWTPoint( const css::drawing::Position3D& rPos );
161
164OOO_DLLPUBLIC_CHARTTOOLS css::awt::Size Direction3DToAWTSize( const css::drawing::Direction3D& rDirection );
165
168OOO_DLLPUBLIC_CHARTTOOLS css::drawing::Position3D
169 SequenceToPosition3D( const css::uno::Sequence< double >& rSeq );
170
175css::uno::Sequence< double > DataSequenceToDoubleSequence(
176 const css::uno::Reference< css::chart2::data::XDataSequence > & xDataSequence );
177
179css::uno::Sequence< OUString > DataSequenceToStringSequence(
180 const css::uno::Reference< css::chart2::data::XDataSequence > & xDataSequence );
181
184template< typename T >
185std::vector< T >
186 FlattenSequence( const std::vector< std::vector< T > > & aSeqSeq )
187{
188 sal_Int32 nOuter, nInner, nCount = 0,
189 nResultSize = 0;
190 const sal_Int32 nOuterSize = aSeqSeq.size();
191 for( nOuter=0; nOuter<nOuterSize; ++nOuter )
192 nResultSize += aSeqSeq[nOuter].size();
193 std::vector< T > aResult( nResultSize );
194
195 for( nOuter=0; nOuter<nOuterSize; ++nOuter )
196 {
197 const sal_Int32 nInnerSize = aSeqSeq[nOuter].size();
198 for( nInner=0; nInner<nInnerSize; ++nInner, ++nCount )
199 aResult[nCount] = aSeqSeq[nOuter][nInner];
200 }
201 return aResult;
202}
203
205bool hasDoubleValue( const css::uno::Any& rAny );
206
208bool hasLongOrShortValue( const css::uno::Any& rAny );
210sal_Int16 getShortForLongAlso( const css::uno::Any& rAny );
211
213bool replaceParamterInString( OUString & rInOutResourceString,
214 std::u16string_view rParamToReplace,
215 std::u16string_view rReplaceWith );
216
217} //namespace chart
218
219/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define OOO_DLLPUBLIC_CHARTTOOLS
int nCount
size
OOO_DLLPUBLIC_CHARTTOOLS::basegfx::B3DVector Direction3DToB3DVector(const css::drawing::Direction3D &rDirection)
Direction3D -> B3DVector.
OOO_DLLPUBLIC_CHARTTOOLS css::drawing::Position3D getPointFromPoly(const std::vector< std::vector< css::drawing::Position3D > > &rPolygon, sal_Int32 nPointIndex, sal_Int32 nPolyIndex)
get a single Point from a Polygon
OOO_DLLPUBLIC_CHARTTOOLS css::drawing::Position3D B3DPointToPosition3D(const ::basegfx::B3DPoint &rPoint)
B3DPoint -> Position3D.
OOO_DLLPUBLIC_CHARTTOOLS css::awt::Point Position3DToAWTPoint(const css::drawing::Position3D &rPos)
Position3D --> awt::Point (2D)
OOO_DLLPUBLIC_CHARTTOOLS bool hasLongOrShortValue(const css::uno::Any &rAny)
OOO_DLLPUBLIC_CHARTTOOLS css::drawing::HomogenMatrix3 B2DHomMatrixToHomogenMatrix3(const ::basegfx::B2DHomMatrix &rM)
B2DHomMatrix <-> HomogenMatrix3.
OOO_DLLPUBLIC_CHARTTOOLS css::drawing::Direction3D operator-(const css::drawing::Position3D &rPos1, const css::drawing::Position3D &rPos2)
Position3D - Position3D == Direction3D.
OOO_DLLPUBLIC_CHARTTOOLS bool replaceParamterInString(OUString &rInOutResourceString, std::u16string_view rParamToReplace, std::u16string_view rReplaceWith)
OOO_DLLPUBLIC_CHARTTOOLS void AddPointToPoly(css::drawing::PolyPolygonShape3D &rPoly, const css::drawing::Position3D &rPos, sal_Int32 nSequenceIndex=0)
PolyPolygonShape3D + drawing::Position3D -> PolyPolygonShape3D.
OOO_DLLPUBLIC_CHARTTOOLS css::awt::Size ToSize(const css::awt::Rectangle &rRectangle)
awt::Rect --> awt::Size (2D)
OOO_DLLPUBLIC_CHARTTOOLS basegfx::B2DPolyPolygon PolyToB2DPolyPolygon(const std::vector< std::vector< css::drawing::Position3D > > &rPolyPolygon)
PolyPolygonShape3D -> basegfx::B2DPolyPolygon (2D)
OOO_DLLPUBLIC_CHARTTOOLS void addPolygon(std::vector< std::vector< css::drawing::Position3D > > &rRet, const std::vector< std::vector< css::drawing::Position3D > > &rAdd)
OOO_DLLPUBLIC_CHARTTOOLS css::drawing::PolyPolygonShape3D BezierToPoly(const css::drawing::PolyPolygonBezierCoords &rBezier)
PolyPolygonBezierCoords -> PolyPolygonShape3D.
OOO_DLLPUBLIC_CHARTTOOLS void appendPointSequence(css::drawing::PointSequenceSequence &rTarget, const css::drawing::PointSequenceSequence &rAdd)
drawing::PointSequenceSequence + drawing::PointSequenceSequence
OOO_DLLPUBLIC_CHARTTOOLS void appendPoly(std::vector< std::vector< css::drawing::Position3D > > &rRet, const std::vector< std::vector< css::drawing::Position3D > > &rAdd)
PolyPolygonShape3D + PolyPolygonShape3D -> PolyPolygonShape3D.
OOO_DLLPUBLIC_CHARTTOOLS::basegfx::B3DPoint Position3DToB3DPoint(const css::drawing::Position3D &rPosition)
Position3D -> B3DPoint.
OOO_DLLPUBLIC_CHARTTOOLS sal_Int16 getShortForLongAlso(const css::uno::Any &rAny)
OOO_DLLPUBLIC_CHARTTOOLS css::drawing::Direction3D B3DVectorToDirection3D(const ::basegfx::B3DVector &rVector)
B3DVector -> Direction3D.
OOO_DLLPUBLIC_CHARTTOOLS css::awt::Point ToPoint(const css::awt::Rectangle &rRectangle)
awt::Rect --> awt::Point (2D)
OOO_DLLPUBLIC_CHARTTOOLS css::drawing::HomogenMatrix B3DHomMatrixToHomogenMatrix(const ::basegfx::B3DHomMatrix &rM)
diverse methods for class conversions; e.g.
OOO_DLLPUBLIC_CHARTTOOLS css::uno::Sequence< double > DataSequenceToDoubleSequence(const css::uno::Reference< css::chart2::data::XDataSequence > &xDataSequence)
chart2::XDataSequence -> uno::Sequence< double >
std::vector< T > FlattenSequence(const std::vector< std::vector< T > > &aSeqSeq)
std::vector< std::vector< T > > -> std::vector< T >
OOO_DLLPUBLIC_CHARTTOOLS css::awt::Size Direction3DToAWTSize(const css::drawing::Direction3D &rDirection)
Direction3D --> awt::Size (2D)
OOO_DLLPUBLIC_CHARTTOOLS::basegfx::B2DHomMatrix IgnoreZ(const ::basegfx::B3DHomMatrix &rM)
basegfx::B3DHomMatrix -> B2DHomMatrix
OOO_DLLPUBLIC_CHARTTOOLS css::drawing::PointSequenceSequence PolyToPointSequence(const css::drawing::PolyPolygonShape3D &rPolyPolygon)
PolyPolygonShape3D -> drawing::PointSequenceSequence (2D)
OOO_DLLPUBLIC_CHARTTOOLS css::uno::Sequence< OUString > DataSequenceToStringSequence(const css::uno::Reference< css::chart2::data::XDataSequence > &xDataSequence)
OOO_DLLPUBLIC_CHARTTOOLS css::drawing::Position3D operator+(const css::drawing::Position3D &rPos, const css::drawing::Direction3D &rDirection)
Position3D + Direction3D == Position3D.
OOO_DLLPUBLIC_CHARTTOOLS css::drawing::Position3D SequenceToPosition3D(const css::uno::Sequence< double > &rSeq)
Sequence<double> -> drawing::Position3D.
OOO_DLLPUBLIC_CHARTTOOLS::basegfx::B3DHomMatrix HomogenMatrixToB3DHomMatrix(const css::drawing::HomogenMatrix &rHM)
HomogenMatrix -> basegfx::B3DHomMatrix.
OOO_DLLPUBLIC_CHARTTOOLS bool hasDoubleValue(const css::uno::Any &rAny)