xref: /trunk/main/xmloff/inc/xexptran.hxx (revision 1f882ec4)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _XEXPTRANSFORM_HXX
25 #define _XEXPTRANSFORM_HXX
26 
27 #include <rtl/ustring.hxx>
28 #include <com/sun/star/drawing/PointSequenceSequence.hpp>
29 #include <com/sun/star/drawing/PointSequence.hpp>
30 #include <com/sun/star/awt/Size.hpp>
31 #include <com/sun/star/drawing/FlagSequenceSequence.hpp>
32 #include <com/sun/star/drawing/FlagSequence.hpp>
33 #include <com/sun/star/drawing/HomogenMatrix.hpp>
34 #include <tools/mapunit.hxx>
35 
36 #include <vector>
37 
38 //////////////////////////////////////////////////////////////////////////////
39 // predeclarations
40 
41 struct ImpSdXMLExpTransObj2DBase;
42 struct ImpSdXMLExpTransObj3DBase;
43 class SvXMLUnitConverter;
44 
45 namespace basegfx
46 {
47 	class B2DTuple;
48 	class B2DHomMatrix;
49 	class B3DTuple;
50 	class B3DHomMatrix;
51 } // end of namespace basegfx
52 
53 //////////////////////////////////////////////////////////////////////////////
54 
55 typedef ::std::vector< ImpSdXMLExpTransObj2DBase* > ImpSdXMLExpTransObj2DBaseList;
56 typedef ::std::vector< ImpSdXMLExpTransObj3DBase* > ImpSdXMLExpTransObj3DBaseList;
57 
58 //////////////////////////////////////////////////////////////////////////////
59 
60 class SdXMLImExTransform2D
61 {
62 	ImpSdXMLExpTransObj2DBaseList	maList;
63 	rtl::OUString					msString;
64 
65 	void EmptyList();
66 
67 public:
SdXMLImExTransform2D()68 	SdXMLImExTransform2D() {}
69 	SdXMLImExTransform2D(const rtl::OUString& rNew, const SvXMLUnitConverter& rConv);
~SdXMLImExTransform2D()70 	~SdXMLImExTransform2D() { EmptyList(); }
71 
72 	void AddRotate(double fNew);
73 	void AddScale(const ::basegfx::B2DTuple& rNew);
74 	void AddTranslate(const ::basegfx::B2DTuple& rNew);
75 	void AddSkewX(double fNew);
76 	void AddSkewY(double fNew);
77 	void AddMatrix(const ::basegfx::B2DHomMatrix& rNew);
78 
NeedsAction() const79 	bool NeedsAction() const { return !maList.empty(); }
80 	void GetFullTransform(::basegfx::B2DHomMatrix& rFullTrans);
81 	const rtl::OUString& GetExportString(const SvXMLUnitConverter& rConv);
82 	void SetString(const rtl::OUString& rNew, const SvXMLUnitConverter& rConv);
83 };
84 
85 //////////////////////////////////////////////////////////////////////////////
86 
87 class SdXMLImExTransform3D
88 {
89 	ImpSdXMLExpTransObj3DBaseList	maList;
90 	rtl::OUString					msString;
91 
92 	void EmptyList();
93 
94 public:
SdXMLImExTransform3D()95 	SdXMLImExTransform3D() {}
96 	SdXMLImExTransform3D(const rtl::OUString& rNew, const SvXMLUnitConverter& rConv);
~SdXMLImExTransform3D()97 	~SdXMLImExTransform3D() { EmptyList(); }
98 
99 	void AddRotateX(double fNew);
100 	void AddRotateY(double fNew);
101 	void AddRotateZ(double fNew);
102 	void AddScale(const ::basegfx::B3DTuple& rNew);
103 	void AddTranslate(const ::basegfx::B3DTuple& rNew);
104 	void AddMatrix(const ::basegfx::B3DHomMatrix& rNew);
105 
106 	void AddHomogenMatrix(const com::sun::star::drawing::HomogenMatrix& xHomMat);
NeedsAction() const107 	bool NeedsAction() const { return !maList.empty(); }
108 	void GetFullTransform(::basegfx::B3DHomMatrix& rFullTrans);
109 	bool GetFullHomogenTransform(com::sun::star::drawing::HomogenMatrix& xHomMat);
110 	const rtl::OUString& GetExportString(const SvXMLUnitConverter& rConv);
111 	void SetString(const rtl::OUString& rNew, const SvXMLUnitConverter& rConv);
112 };
113 
114 //////////////////////////////////////////////////////////////////////////////
115 
116 class SdXMLImExViewBox
117 {
118     rtl::OUString				msString;
119     double                      mfX;
120     double                      mfY;
121     double                      mfW;
122     double                      mfH;
123 
124 public:
125     SdXMLImExViewBox(double fX = 0.0, double fY = 0.0, double fW = 1000.0, double fH = 1000.0);
126     SdXMLImExViewBox(const rtl::OUString& rNew, const SvXMLUnitConverter& rConv);
127 
GetX() const128     double GetX() const { return mfX; }
GetY() const129     double GetY() const { return mfY; }
GetWidth() const130     double GetWidth() const { return mfW; }
GetHeight() const131     double GetHeight() const { return mfH; }
132     const rtl::OUString& GetExportString();
133 };
134 
135 #endif	//  _XEXPTRANSFORM_HXX
136 // eof
137