1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xexptran.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _XEXPTRANSFORM_HXX
32 #define _XEXPTRANSFORM_HXX
34 #include <rtl/ustring.hxx>
35 #include <com/sun/star/drawing/PointSequenceSequence.hpp>
36 #include <com/sun/star/drawing/PointSequence.hpp>
37 #include <com/sun/star/awt/Size.hpp>
38 #include <com/sun/star/drawing/FlagSequenceSequence.hpp>
39 #include <com/sun/star/drawing/FlagSequence.hpp>
40 #include <com/sun/star/drawing/HomogenMatrix.hpp>
41 #include <vcl/mapunit.hxx>
45 //////////////////////////////////////////////////////////////////////////////
48 struct ImpSdXMLExpTransObj2DBase
;
49 struct ImpSdXMLExpTransObj3DBase
;
50 class SvXMLUnitConverter
;
58 } // end of namespace basegfx
60 //////////////////////////////////////////////////////////////////////////////
62 typedef ::std::vector
< ImpSdXMLExpTransObj2DBase
* > ImpSdXMLExpTransObj2DBaseList
;
63 typedef ::std::vector
< ImpSdXMLExpTransObj3DBase
* > ImpSdXMLExpTransObj3DBaseList
;
65 //////////////////////////////////////////////////////////////////////////////
67 class SdXMLImExTransform2D
69 ImpSdXMLExpTransObj2DBaseList maList
;
70 rtl::OUString msString
;
75 SdXMLImExTransform2D() {}
76 SdXMLImExTransform2D(const rtl::OUString
& rNew
, const SvXMLUnitConverter
& rConv
);
77 ~SdXMLImExTransform2D() { EmptyList(); }
79 void AddRotate(double fNew
);
80 void AddScale(const ::basegfx::B2DTuple
& rNew
);
81 void AddTranslate(const ::basegfx::B2DTuple
& rNew
);
82 void AddSkewX(double fNew
);
83 void AddSkewY(double fNew
);
84 void AddMatrix(const ::basegfx::B2DHomMatrix
& rNew
);
86 bool NeedsAction() const { return !maList
.empty(); }
87 void GetFullTransform(::basegfx::B2DHomMatrix
& rFullTrans
);
88 const rtl::OUString
& GetExportString(const SvXMLUnitConverter
& rConv
);
89 void SetString(const rtl::OUString
& rNew
, const SvXMLUnitConverter
& rConv
);
92 //////////////////////////////////////////////////////////////////////////////
94 class SdXMLImExTransform3D
96 ImpSdXMLExpTransObj3DBaseList maList
;
97 rtl::OUString msString
;
102 SdXMLImExTransform3D() {}
103 SdXMLImExTransform3D(const rtl::OUString
& rNew
, const SvXMLUnitConverter
& rConv
);
104 ~SdXMLImExTransform3D() { EmptyList(); }
106 void AddRotateX(double fNew
);
107 void AddRotateY(double fNew
);
108 void AddRotateZ(double fNew
);
109 void AddScale(const ::basegfx::B3DTuple
& rNew
);
110 void AddTranslate(const ::basegfx::B3DTuple
& rNew
);
111 void AddMatrix(const ::basegfx::B3DHomMatrix
& rNew
);
113 void AddHomogenMatrix(const com::sun::star::drawing::HomogenMatrix
& xHomMat
);
114 bool NeedsAction() const { return !maList
.empty(); }
115 void GetFullTransform(::basegfx::B3DHomMatrix
& rFullTrans
);
116 bool GetFullHomogenTransform(com::sun::star::drawing::HomogenMatrix
& xHomMat
);
117 const rtl::OUString
& GetExportString(const SvXMLUnitConverter
& rConv
);
118 void SetString(const rtl::OUString
& rNew
, const SvXMLUnitConverter
& rConv
);
121 //////////////////////////////////////////////////////////////////////////////
123 class SdXMLImExViewBox
125 rtl::OUString msString
;
132 SdXMLImExViewBox(sal_Int32 nX
= 0L, sal_Int32 nY
= 0L, sal_Int32 nW
= 1000L, sal_Int32 nH
= 1000L);
133 SdXMLImExViewBox(const rtl::OUString
& rNew
, const SvXMLUnitConverter
& rConv
);
135 sal_Int32
GetX() const { return mnX
; }
136 sal_Int32
GetY() const { return mnY
; }
137 sal_Int32
GetWidth() const { return mnW
; }
138 sal_Int32
GetHeight() const { return mnH
; }
139 const rtl::OUString
& GetExportString();
142 //////////////////////////////////////////////////////////////////////////////
144 class SdXMLImExPointsElement
146 rtl::OUString msString
;
147 com::sun::star::drawing::PointSequenceSequence maPoly
;
150 SdXMLImExPointsElement(com::sun::star::drawing::PointSequence
* pPoints
,
151 const SdXMLImExViewBox
& rViewBox
,
152 const com::sun::star::awt::Point
& rObjectPos
,
153 const com::sun::star::awt::Size
& rObjectSize
,
155 const bool bClosed
= true);
156 SdXMLImExPointsElement(const rtl::OUString
& rNew
,
157 const SdXMLImExViewBox
& rViewBox
,
158 const com::sun::star::awt::Point
& rObjectPos
,
159 const com::sun::star::awt::Size
& rObjectSize
,
160 const SvXMLUnitConverter
& rConv
);
162 const rtl::OUString
& GetExportString() const { return msString
; }
163 const com::sun::star::drawing::PointSequenceSequence
& GetPointSequenceSequence() const { return maPoly
; }
166 //////////////////////////////////////////////////////////////////////////////
168 class SdXMLImExSvgDElement
170 rtl::OUString msString
;
171 const SdXMLImExViewBox
& mrViewBox
;
178 com::sun::star::drawing::PointSequenceSequence maPoly
;
179 com::sun::star::drawing::FlagSequenceSequence maFlag
;
182 SdXMLImExSvgDElement(const SdXMLImExViewBox
& rViewBox
);
183 SdXMLImExSvgDElement(const rtl::OUString
& rNew
,
184 const SdXMLImExViewBox
& rViewBox
,
185 const com::sun::star::awt::Point
& rObjectPos
,
186 const com::sun::star::awt::Size
& rObjectSize
,
187 const SvXMLUnitConverter
& rConv
);
190 com::sun::star::drawing::PointSequence
* pPoints
,
191 com::sun::star::drawing::FlagSequence
* pFlags
,
192 const com::sun::star::awt::Point
& rObjectPos
,
193 const com::sun::star::awt::Size
& rObjectSize
,
194 bool bClosed
= false, bool bRelative
= true);
196 const rtl::OUString
& GetExportString() const { return msString
; }
197 bool IsClosed() const { return mbIsClosed
; }
198 bool IsCurve() const { return mbIsCurve
; }
199 const com::sun::star::drawing::PointSequenceSequence
& GetPointSequenceSequence() const { return maPoly
; }
200 const com::sun::star::drawing::FlagSequenceSequence
& GetFlagSequenceSequence() const { return maFlag
; }
204 #endif // _XEXPTRANSFORM_HXX