xref: /aoo41x/main/xmloff/inc/xexptran.hxx (revision ecfe53c5)
1*ecfe53c5SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*ecfe53c5SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*ecfe53c5SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*ecfe53c5SAndrew Rist  * distributed with this work for additional information
6*ecfe53c5SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*ecfe53c5SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*ecfe53c5SAndrew Rist  * "License"); you may not use this file except in compliance
9*ecfe53c5SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*ecfe53c5SAndrew Rist  *
11*ecfe53c5SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*ecfe53c5SAndrew Rist  *
13*ecfe53c5SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*ecfe53c5SAndrew Rist  * software distributed under the License is distributed on an
15*ecfe53c5SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*ecfe53c5SAndrew Rist  * KIND, either express or implied.  See the License for the
17*ecfe53c5SAndrew Rist  * specific language governing permissions and limitations
18*ecfe53c5SAndrew Rist  * under the License.
19*ecfe53c5SAndrew Rist  *
20*ecfe53c5SAndrew Rist  *************************************************************/
21*ecfe53c5SAndrew Rist 
22*ecfe53c5SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _XEXPTRANSFORM_HXX
25cdf0e10cSrcweir #define _XEXPTRANSFORM_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <rtl/ustring.hxx>
28cdf0e10cSrcweir #include <com/sun/star/drawing/PointSequenceSequence.hpp>
29cdf0e10cSrcweir #include <com/sun/star/drawing/PointSequence.hpp>
30cdf0e10cSrcweir #include <com/sun/star/awt/Size.hpp>
31cdf0e10cSrcweir #include <com/sun/star/drawing/FlagSequenceSequence.hpp>
32cdf0e10cSrcweir #include <com/sun/star/drawing/FlagSequence.hpp>
33cdf0e10cSrcweir #include <com/sun/star/drawing/HomogenMatrix.hpp>
34cdf0e10cSrcweir #include <tools/mapunit.hxx>
35cdf0e10cSrcweir 
36cdf0e10cSrcweir #include <vector>
37cdf0e10cSrcweir 
38cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
39cdf0e10cSrcweir // predeclarations
40cdf0e10cSrcweir 
41cdf0e10cSrcweir struct ImpSdXMLExpTransObj2DBase;
42cdf0e10cSrcweir struct ImpSdXMLExpTransObj3DBase;
43cdf0e10cSrcweir class SvXMLUnitConverter;
44cdf0e10cSrcweir 
45cdf0e10cSrcweir namespace basegfx
46cdf0e10cSrcweir {
47cdf0e10cSrcweir 	class B2DTuple;
48cdf0e10cSrcweir 	class B2DHomMatrix;
49cdf0e10cSrcweir 	class B3DTuple;
50cdf0e10cSrcweir 	class B3DHomMatrix;
51cdf0e10cSrcweir } // end of namespace basegfx
52cdf0e10cSrcweir 
53cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
54cdf0e10cSrcweir 
55cdf0e10cSrcweir typedef ::std::vector< ImpSdXMLExpTransObj2DBase* > ImpSdXMLExpTransObj2DBaseList;
56cdf0e10cSrcweir typedef ::std::vector< ImpSdXMLExpTransObj3DBase* > ImpSdXMLExpTransObj3DBaseList;
57cdf0e10cSrcweir 
58cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
59cdf0e10cSrcweir 
60cdf0e10cSrcweir class SdXMLImExTransform2D
61cdf0e10cSrcweir {
62cdf0e10cSrcweir 	ImpSdXMLExpTransObj2DBaseList	maList;
63cdf0e10cSrcweir 	rtl::OUString					msString;
64cdf0e10cSrcweir 
65cdf0e10cSrcweir 	void EmptyList();
66cdf0e10cSrcweir 
67cdf0e10cSrcweir public:
68cdf0e10cSrcweir 	SdXMLImExTransform2D() {}
69cdf0e10cSrcweir 	SdXMLImExTransform2D(const rtl::OUString& rNew, const SvXMLUnitConverter& rConv);
70cdf0e10cSrcweir 	~SdXMLImExTransform2D() { EmptyList(); }
71cdf0e10cSrcweir 
72cdf0e10cSrcweir 	void AddRotate(double fNew);
73cdf0e10cSrcweir 	void AddScale(const ::basegfx::B2DTuple& rNew);
74cdf0e10cSrcweir 	void AddTranslate(const ::basegfx::B2DTuple& rNew);
75cdf0e10cSrcweir 	void AddSkewX(double fNew);
76cdf0e10cSrcweir 	void AddSkewY(double fNew);
77cdf0e10cSrcweir 	void AddMatrix(const ::basegfx::B2DHomMatrix& rNew);
78cdf0e10cSrcweir 
79cdf0e10cSrcweir 	bool NeedsAction() const { return !maList.empty(); }
80cdf0e10cSrcweir 	void GetFullTransform(::basegfx::B2DHomMatrix& rFullTrans);
81cdf0e10cSrcweir 	const rtl::OUString& GetExportString(const SvXMLUnitConverter& rConv);
82cdf0e10cSrcweir 	void SetString(const rtl::OUString& rNew, const SvXMLUnitConverter& rConv);
83cdf0e10cSrcweir };
84cdf0e10cSrcweir 
85cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
86cdf0e10cSrcweir 
87cdf0e10cSrcweir class SdXMLImExTransform3D
88cdf0e10cSrcweir {
89cdf0e10cSrcweir 	ImpSdXMLExpTransObj3DBaseList	maList;
90cdf0e10cSrcweir 	rtl::OUString					msString;
91cdf0e10cSrcweir 
92cdf0e10cSrcweir 	void EmptyList();
93cdf0e10cSrcweir 
94cdf0e10cSrcweir public:
95cdf0e10cSrcweir 	SdXMLImExTransform3D() {}
96cdf0e10cSrcweir 	SdXMLImExTransform3D(const rtl::OUString& rNew, const SvXMLUnitConverter& rConv);
97cdf0e10cSrcweir 	~SdXMLImExTransform3D() { EmptyList(); }
98cdf0e10cSrcweir 
99cdf0e10cSrcweir 	void AddRotateX(double fNew);
100cdf0e10cSrcweir 	void AddRotateY(double fNew);
101cdf0e10cSrcweir 	void AddRotateZ(double fNew);
102cdf0e10cSrcweir 	void AddScale(const ::basegfx::B3DTuple& rNew);
103cdf0e10cSrcweir 	void AddTranslate(const ::basegfx::B3DTuple& rNew);
104cdf0e10cSrcweir 	void AddMatrix(const ::basegfx::B3DHomMatrix& rNew);
105cdf0e10cSrcweir 
106cdf0e10cSrcweir 	void AddHomogenMatrix(const com::sun::star::drawing::HomogenMatrix& xHomMat);
107cdf0e10cSrcweir 	bool NeedsAction() const { return !maList.empty(); }
108cdf0e10cSrcweir 	void GetFullTransform(::basegfx::B3DHomMatrix& rFullTrans);
109cdf0e10cSrcweir 	bool GetFullHomogenTransform(com::sun::star::drawing::HomogenMatrix& xHomMat);
110cdf0e10cSrcweir 	const rtl::OUString& GetExportString(const SvXMLUnitConverter& rConv);
111cdf0e10cSrcweir 	void SetString(const rtl::OUString& rNew, const SvXMLUnitConverter& rConv);
112cdf0e10cSrcweir };
113cdf0e10cSrcweir 
114cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
115cdf0e10cSrcweir 
116cdf0e10cSrcweir class SdXMLImExViewBox
117cdf0e10cSrcweir {
118cdf0e10cSrcweir 	rtl::OUString				msString;
119cdf0e10cSrcweir 	sal_Int32					mnX;
120cdf0e10cSrcweir 	sal_Int32					mnY;
121cdf0e10cSrcweir 	sal_Int32					mnW;
122cdf0e10cSrcweir 	sal_Int32					mnH;
123cdf0e10cSrcweir 
124cdf0e10cSrcweir public:
125cdf0e10cSrcweir 	SdXMLImExViewBox(sal_Int32 nX = 0L, sal_Int32 nY = 0L, sal_Int32 nW = 1000L, sal_Int32 nH = 1000L);
126cdf0e10cSrcweir 	SdXMLImExViewBox(const rtl::OUString& rNew, const SvXMLUnitConverter& rConv);
127cdf0e10cSrcweir 
128cdf0e10cSrcweir 	sal_Int32 GetX() const { return mnX; }
129cdf0e10cSrcweir 	sal_Int32 GetY() const { return mnY; }
130cdf0e10cSrcweir 	sal_Int32 GetWidth() const { return mnW; }
131cdf0e10cSrcweir 	sal_Int32 GetHeight() const { return mnH; }
132cdf0e10cSrcweir 	const rtl::OUString& GetExportString();
133cdf0e10cSrcweir };
134cdf0e10cSrcweir 
135cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
136cdf0e10cSrcweir 
137cdf0e10cSrcweir class SdXMLImExPointsElement
138cdf0e10cSrcweir {
139cdf0e10cSrcweir 	rtl::OUString				msString;
140cdf0e10cSrcweir 	com::sun::star::drawing::PointSequenceSequence	maPoly;
141cdf0e10cSrcweir 
142cdf0e10cSrcweir public:
143cdf0e10cSrcweir 	SdXMLImExPointsElement(com::sun::star::drawing::PointSequence* pPoints,
144cdf0e10cSrcweir 		const SdXMLImExViewBox& rViewBox,
145cdf0e10cSrcweir 		const com::sun::star::awt::Point& rObjectPos,
146cdf0e10cSrcweir 		const com::sun::star::awt::Size& rObjectSize,
147cdf0e10cSrcweir 		// #96328#
148cdf0e10cSrcweir 		const bool bClosed = true);
149cdf0e10cSrcweir 	SdXMLImExPointsElement(const rtl::OUString& rNew,
150cdf0e10cSrcweir 		const SdXMLImExViewBox& rViewBox,
151cdf0e10cSrcweir 		const com::sun::star::awt::Point& rObjectPos,
152cdf0e10cSrcweir 		const com::sun::star::awt::Size& rObjectSize,
153cdf0e10cSrcweir 		const SvXMLUnitConverter& rConv);
154cdf0e10cSrcweir 
155cdf0e10cSrcweir 	const rtl::OUString& GetExportString() const { return msString; }
156cdf0e10cSrcweir 	const com::sun::star::drawing::PointSequenceSequence& GetPointSequenceSequence() const { return maPoly; }
157cdf0e10cSrcweir };
158cdf0e10cSrcweir 
159cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
160cdf0e10cSrcweir 
161cdf0e10cSrcweir class SdXMLImExSvgDElement
162cdf0e10cSrcweir {
163cdf0e10cSrcweir 	rtl::OUString					msString;
164cdf0e10cSrcweir 	const SdXMLImExViewBox&			mrViewBox;
165cdf0e10cSrcweir 	bool							mbIsClosed;
166cdf0e10cSrcweir 	bool							mbIsCurve;
167cdf0e10cSrcweir 
168cdf0e10cSrcweir 	sal_Int32						mnLastX;
169cdf0e10cSrcweir 	sal_Int32						mnLastY;
170cdf0e10cSrcweir 
171cdf0e10cSrcweir 	com::sun::star::drawing::PointSequenceSequence		maPoly;
172cdf0e10cSrcweir 	com::sun::star::drawing::FlagSequenceSequence		maFlag;
173cdf0e10cSrcweir 
174cdf0e10cSrcweir public:
175cdf0e10cSrcweir 	SdXMLImExSvgDElement(const SdXMLImExViewBox& rViewBox);
176cdf0e10cSrcweir 	SdXMLImExSvgDElement(const rtl::OUString& rNew,
177cdf0e10cSrcweir 		const SdXMLImExViewBox& rViewBox,
178cdf0e10cSrcweir 		const com::sun::star::awt::Point& rObjectPos,
179cdf0e10cSrcweir 		const com::sun::star::awt::Size& rObjectSize,
180cdf0e10cSrcweir 		const SvXMLUnitConverter& rConv);
181cdf0e10cSrcweir 
182cdf0e10cSrcweir 	void AddPolygon(
183cdf0e10cSrcweir 		com::sun::star::drawing::PointSequence* pPoints,
184cdf0e10cSrcweir 		com::sun::star::drawing::FlagSequence* pFlags,
185cdf0e10cSrcweir 		const com::sun::star::awt::Point& rObjectPos,
186cdf0e10cSrcweir 		const com::sun::star::awt::Size& rObjectSize,
187cdf0e10cSrcweir 		bool bClosed = false, bool bRelative = true);
188cdf0e10cSrcweir 
189cdf0e10cSrcweir 	const rtl::OUString& GetExportString() const { return msString; }
190cdf0e10cSrcweir 	bool IsClosed() const { return mbIsClosed; }
191cdf0e10cSrcweir 	bool IsCurve() const { return mbIsCurve; }
192cdf0e10cSrcweir 	const com::sun::star::drawing::PointSequenceSequence& GetPointSequenceSequence() const { return maPoly; }
193cdf0e10cSrcweir 	const com::sun::star::drawing::FlagSequenceSequence& GetFlagSequenceSequence() const { return maFlag; }
194cdf0e10cSrcweir };
195cdf0e10cSrcweir 
196cdf0e10cSrcweir 
197cdf0e10cSrcweir #endif	//  _XEXPTRANSFORM_HXX
198