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