xref: /AOO41X/main/xmloff/inc/xexptran.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef _XEXPTRANSFORM_HXX
29*cdf0e10cSrcweir #define _XEXPTRANSFORM_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <rtl/ustring.hxx>
32*cdf0e10cSrcweir #include <com/sun/star/drawing/PointSequenceSequence.hpp>
33*cdf0e10cSrcweir #include <com/sun/star/drawing/PointSequence.hpp>
34*cdf0e10cSrcweir #include <com/sun/star/awt/Size.hpp>
35*cdf0e10cSrcweir #include <com/sun/star/drawing/FlagSequenceSequence.hpp>
36*cdf0e10cSrcweir #include <com/sun/star/drawing/FlagSequence.hpp>
37*cdf0e10cSrcweir #include <com/sun/star/drawing/HomogenMatrix.hpp>
38*cdf0e10cSrcweir #include <tools/mapunit.hxx>
39*cdf0e10cSrcweir 
40*cdf0e10cSrcweir #include <vector>
41*cdf0e10cSrcweir 
42*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
43*cdf0e10cSrcweir // predeclarations
44*cdf0e10cSrcweir 
45*cdf0e10cSrcweir struct ImpSdXMLExpTransObj2DBase;
46*cdf0e10cSrcweir struct ImpSdXMLExpTransObj3DBase;
47*cdf0e10cSrcweir class SvXMLUnitConverter;
48*cdf0e10cSrcweir 
49*cdf0e10cSrcweir namespace basegfx
50*cdf0e10cSrcweir {
51*cdf0e10cSrcweir 	class B2DTuple;
52*cdf0e10cSrcweir 	class B2DHomMatrix;
53*cdf0e10cSrcweir 	class B3DTuple;
54*cdf0e10cSrcweir 	class B3DHomMatrix;
55*cdf0e10cSrcweir } // end of namespace basegfx
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir typedef ::std::vector< ImpSdXMLExpTransObj2DBase* > ImpSdXMLExpTransObj2DBaseList;
60*cdf0e10cSrcweir typedef ::std::vector< ImpSdXMLExpTransObj3DBase* > ImpSdXMLExpTransObj3DBaseList;
61*cdf0e10cSrcweir 
62*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
63*cdf0e10cSrcweir 
64*cdf0e10cSrcweir class SdXMLImExTransform2D
65*cdf0e10cSrcweir {
66*cdf0e10cSrcweir 	ImpSdXMLExpTransObj2DBaseList	maList;
67*cdf0e10cSrcweir 	rtl::OUString					msString;
68*cdf0e10cSrcweir 
69*cdf0e10cSrcweir 	void EmptyList();
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir public:
72*cdf0e10cSrcweir 	SdXMLImExTransform2D() {}
73*cdf0e10cSrcweir 	SdXMLImExTransform2D(const rtl::OUString& rNew, const SvXMLUnitConverter& rConv);
74*cdf0e10cSrcweir 	~SdXMLImExTransform2D() { EmptyList(); }
75*cdf0e10cSrcweir 
76*cdf0e10cSrcweir 	void AddRotate(double fNew);
77*cdf0e10cSrcweir 	void AddScale(const ::basegfx::B2DTuple& rNew);
78*cdf0e10cSrcweir 	void AddTranslate(const ::basegfx::B2DTuple& rNew);
79*cdf0e10cSrcweir 	void AddSkewX(double fNew);
80*cdf0e10cSrcweir 	void AddSkewY(double fNew);
81*cdf0e10cSrcweir 	void AddMatrix(const ::basegfx::B2DHomMatrix& rNew);
82*cdf0e10cSrcweir 
83*cdf0e10cSrcweir 	bool NeedsAction() const { return !maList.empty(); }
84*cdf0e10cSrcweir 	void GetFullTransform(::basegfx::B2DHomMatrix& rFullTrans);
85*cdf0e10cSrcweir 	const rtl::OUString& GetExportString(const SvXMLUnitConverter& rConv);
86*cdf0e10cSrcweir 	void SetString(const rtl::OUString& rNew, const SvXMLUnitConverter& rConv);
87*cdf0e10cSrcweir };
88*cdf0e10cSrcweir 
89*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
90*cdf0e10cSrcweir 
91*cdf0e10cSrcweir class SdXMLImExTransform3D
92*cdf0e10cSrcweir {
93*cdf0e10cSrcweir 	ImpSdXMLExpTransObj3DBaseList	maList;
94*cdf0e10cSrcweir 	rtl::OUString					msString;
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir 	void EmptyList();
97*cdf0e10cSrcweir 
98*cdf0e10cSrcweir public:
99*cdf0e10cSrcweir 	SdXMLImExTransform3D() {}
100*cdf0e10cSrcweir 	SdXMLImExTransform3D(const rtl::OUString& rNew, const SvXMLUnitConverter& rConv);
101*cdf0e10cSrcweir 	~SdXMLImExTransform3D() { EmptyList(); }
102*cdf0e10cSrcweir 
103*cdf0e10cSrcweir 	void AddRotateX(double fNew);
104*cdf0e10cSrcweir 	void AddRotateY(double fNew);
105*cdf0e10cSrcweir 	void AddRotateZ(double fNew);
106*cdf0e10cSrcweir 	void AddScale(const ::basegfx::B3DTuple& rNew);
107*cdf0e10cSrcweir 	void AddTranslate(const ::basegfx::B3DTuple& rNew);
108*cdf0e10cSrcweir 	void AddMatrix(const ::basegfx::B3DHomMatrix& rNew);
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir 	void AddHomogenMatrix(const com::sun::star::drawing::HomogenMatrix& xHomMat);
111*cdf0e10cSrcweir 	bool NeedsAction() const { return !maList.empty(); }
112*cdf0e10cSrcweir 	void GetFullTransform(::basegfx::B3DHomMatrix& rFullTrans);
113*cdf0e10cSrcweir 	bool GetFullHomogenTransform(com::sun::star::drawing::HomogenMatrix& xHomMat);
114*cdf0e10cSrcweir 	const rtl::OUString& GetExportString(const SvXMLUnitConverter& rConv);
115*cdf0e10cSrcweir 	void SetString(const rtl::OUString& rNew, const SvXMLUnitConverter& rConv);
116*cdf0e10cSrcweir };
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
119*cdf0e10cSrcweir 
120*cdf0e10cSrcweir class SdXMLImExViewBox
121*cdf0e10cSrcweir {
122*cdf0e10cSrcweir 	rtl::OUString				msString;
123*cdf0e10cSrcweir 	sal_Int32					mnX;
124*cdf0e10cSrcweir 	sal_Int32					mnY;
125*cdf0e10cSrcweir 	sal_Int32					mnW;
126*cdf0e10cSrcweir 	sal_Int32					mnH;
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir public:
129*cdf0e10cSrcweir 	SdXMLImExViewBox(sal_Int32 nX = 0L, sal_Int32 nY = 0L, sal_Int32 nW = 1000L, sal_Int32 nH = 1000L);
130*cdf0e10cSrcweir 	SdXMLImExViewBox(const rtl::OUString& rNew, const SvXMLUnitConverter& rConv);
131*cdf0e10cSrcweir 
132*cdf0e10cSrcweir 	sal_Int32 GetX() const { return mnX; }
133*cdf0e10cSrcweir 	sal_Int32 GetY() const { return mnY; }
134*cdf0e10cSrcweir 	sal_Int32 GetWidth() const { return mnW; }
135*cdf0e10cSrcweir 	sal_Int32 GetHeight() const { return mnH; }
136*cdf0e10cSrcweir 	const rtl::OUString& GetExportString();
137*cdf0e10cSrcweir };
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir class SdXMLImExPointsElement
142*cdf0e10cSrcweir {
143*cdf0e10cSrcweir 	rtl::OUString				msString;
144*cdf0e10cSrcweir 	com::sun::star::drawing::PointSequenceSequence	maPoly;
145*cdf0e10cSrcweir 
146*cdf0e10cSrcweir public:
147*cdf0e10cSrcweir 	SdXMLImExPointsElement(com::sun::star::drawing::PointSequence* pPoints,
148*cdf0e10cSrcweir 		const SdXMLImExViewBox& rViewBox,
149*cdf0e10cSrcweir 		const com::sun::star::awt::Point& rObjectPos,
150*cdf0e10cSrcweir 		const com::sun::star::awt::Size& rObjectSize,
151*cdf0e10cSrcweir 		// #96328#
152*cdf0e10cSrcweir 		const bool bClosed = true);
153*cdf0e10cSrcweir 	SdXMLImExPointsElement(const rtl::OUString& rNew,
154*cdf0e10cSrcweir 		const SdXMLImExViewBox& rViewBox,
155*cdf0e10cSrcweir 		const com::sun::star::awt::Point& rObjectPos,
156*cdf0e10cSrcweir 		const com::sun::star::awt::Size& rObjectSize,
157*cdf0e10cSrcweir 		const SvXMLUnitConverter& rConv);
158*cdf0e10cSrcweir 
159*cdf0e10cSrcweir 	const rtl::OUString& GetExportString() const { return msString; }
160*cdf0e10cSrcweir 	const com::sun::star::drawing::PointSequenceSequence& GetPointSequenceSequence() const { return maPoly; }
161*cdf0e10cSrcweir };
162*cdf0e10cSrcweir 
163*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
164*cdf0e10cSrcweir 
165*cdf0e10cSrcweir class SdXMLImExSvgDElement
166*cdf0e10cSrcweir {
167*cdf0e10cSrcweir 	rtl::OUString					msString;
168*cdf0e10cSrcweir 	const SdXMLImExViewBox&			mrViewBox;
169*cdf0e10cSrcweir 	bool							mbIsClosed;
170*cdf0e10cSrcweir 	bool							mbIsCurve;
171*cdf0e10cSrcweir 
172*cdf0e10cSrcweir 	sal_Int32						mnLastX;
173*cdf0e10cSrcweir 	sal_Int32						mnLastY;
174*cdf0e10cSrcweir 
175*cdf0e10cSrcweir 	com::sun::star::drawing::PointSequenceSequence		maPoly;
176*cdf0e10cSrcweir 	com::sun::star::drawing::FlagSequenceSequence		maFlag;
177*cdf0e10cSrcweir 
178*cdf0e10cSrcweir public:
179*cdf0e10cSrcweir 	SdXMLImExSvgDElement(const SdXMLImExViewBox& rViewBox);
180*cdf0e10cSrcweir 	SdXMLImExSvgDElement(const rtl::OUString& rNew,
181*cdf0e10cSrcweir 		const SdXMLImExViewBox& rViewBox,
182*cdf0e10cSrcweir 		const com::sun::star::awt::Point& rObjectPos,
183*cdf0e10cSrcweir 		const com::sun::star::awt::Size& rObjectSize,
184*cdf0e10cSrcweir 		const SvXMLUnitConverter& rConv);
185*cdf0e10cSrcweir 
186*cdf0e10cSrcweir 	void AddPolygon(
187*cdf0e10cSrcweir 		com::sun::star::drawing::PointSequence* pPoints,
188*cdf0e10cSrcweir 		com::sun::star::drawing::FlagSequence* pFlags,
189*cdf0e10cSrcweir 		const com::sun::star::awt::Point& rObjectPos,
190*cdf0e10cSrcweir 		const com::sun::star::awt::Size& rObjectSize,
191*cdf0e10cSrcweir 		bool bClosed = false, bool bRelative = true);
192*cdf0e10cSrcweir 
193*cdf0e10cSrcweir 	const rtl::OUString& GetExportString() const { return msString; }
194*cdf0e10cSrcweir 	bool IsClosed() const { return mbIsClosed; }
195*cdf0e10cSrcweir 	bool IsCurve() const { return mbIsCurve; }
196*cdf0e10cSrcweir 	const com::sun::star::drawing::PointSequenceSequence& GetPointSequenceSequence() const { return maPoly; }
197*cdf0e10cSrcweir 	const com::sun::star::drawing::FlagSequenceSequence& GetFlagSequenceSequence() const { return maFlag; }
198*cdf0e10cSrcweir };
199*cdf0e10cSrcweir 
200*cdf0e10cSrcweir 
201*cdf0e10cSrcweir #endif	//  _XEXPTRANSFORM_HXX
202