Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef _XEXPTRANSFORM_HXX
21 : #define _XEXPTRANSFORM_HXX
22 :
23 : #include <rtl/ustring.hxx>
24 : #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
25 : #include <com/sun/star/drawing/PointSequence.hpp>
26 : #include <com/sun/star/drawing/FlagSequence.hpp>
27 : #include <com/sun/star/awt/Size.hpp>
28 : #include <com/sun/star/drawing/HomogenMatrix.hpp>
29 : #include <tools/mapunit.hxx>
30 :
31 : #include <vector>
32 :
33 : //////////////////////////////////////////////////////////////////////////////
34 : // predeclarations
35 :
36 : struct ImpSdXMLExpTransObj2DBase;
37 : struct ImpSdXMLExpTransObj3DBase;
38 : class SvXMLUnitConverter;
39 : class SvXMLImport;
40 : class SvXMLExport;
41 :
42 : namespace basegfx
43 : {
44 : class B2DTuple;
45 : class B2DHomMatrix;
46 : class B3DHomMatrix;
47 : } // end of namespace basegfx
48 :
49 : //////////////////////////////////////////////////////////////////////////////
50 :
51 : typedef ::std::vector< ImpSdXMLExpTransObj2DBase* > ImpSdXMLExpTransObj2DBaseList;
52 : typedef ::std::vector< ImpSdXMLExpTransObj3DBase* > ImpSdXMLExpTransObj3DBaseList;
53 :
54 : //////////////////////////////////////////////////////////////////////////////
55 :
56 : class SdXMLImExTransform2D
57 : {
58 : ImpSdXMLExpTransObj2DBaseList maList;
59 : rtl::OUString msString;
60 :
61 : void EmptyList();
62 :
63 : public:
64 170 : SdXMLImExTransform2D() {}
65 170 : ~SdXMLImExTransform2D() { EmptyList(); }
66 :
67 : void AddRotate(double fNew);
68 : void AddTranslate(const ::basegfx::B2DTuple& rNew);
69 : void AddSkewX(double fNew);
70 :
71 129 : bool NeedsAction() const { return !maList.empty(); }
72 : void GetFullTransform(::basegfx::B2DHomMatrix& rFullTrans);
73 : const rtl::OUString& GetExportString(const SvXMLUnitConverter& rConv);
74 : void SetString(const rtl::OUString& rNew, const SvXMLUnitConverter& rConv);
75 : };
76 :
77 : //////////////////////////////////////////////////////////////////////////////
78 :
79 : class SdXMLImExTransform3D
80 : {
81 : ImpSdXMLExpTransObj3DBaseList maList;
82 : rtl::OUString msString;
83 :
84 : void EmptyList();
85 :
86 : public:
87 0 : SdXMLImExTransform3D() {}
88 : SdXMLImExTransform3D(const rtl::OUString& rNew, const SvXMLUnitConverter& rConv);
89 0 : ~SdXMLImExTransform3D() { EmptyList(); }
90 :
91 : void AddMatrix(const ::basegfx::B3DHomMatrix& rNew);
92 :
93 : void AddHomogenMatrix(const com::sun::star::drawing::HomogenMatrix& xHomMat);
94 0 : bool NeedsAction() const { return !maList.empty(); }
95 : void GetFullTransform(::basegfx::B3DHomMatrix& rFullTrans);
96 : bool GetFullHomogenTransform(com::sun::star::drawing::HomogenMatrix& xHomMat);
97 : const rtl::OUString& GetExportString(const SvXMLUnitConverter& rConv);
98 : void SetString(const rtl::OUString& rNew, const SvXMLUnitConverter& rConv);
99 : };
100 :
101 : //////////////////////////////////////////////////////////////////////////////
102 :
103 73 : class SdXMLImExViewBox
104 : {
105 : rtl::OUString msString;
106 : sal_Int32 mnX;
107 : sal_Int32 mnY;
108 : sal_Int32 mnW;
109 : sal_Int32 mnH;
110 :
111 : public:
112 : SdXMLImExViewBox(sal_Int32 nX = 0L, sal_Int32 nY = 0L, sal_Int32 nW = 1000L, sal_Int32 nH = 1000L);
113 : SdXMLImExViewBox(const rtl::OUString& rNew, const SvXMLUnitConverter& rConv);
114 :
115 82 : sal_Int32 GetX() const { return mnX; }
116 82 : sal_Int32 GetY() const { return mnY; }
117 85 : sal_Int32 GetWidth() const { return mnW; }
118 85 : sal_Int32 GetHeight() const { return mnH; }
119 : const rtl::OUString& GetExportString();
120 : };
121 :
122 : //////////////////////////////////////////////////////////////////////////////
123 :
124 5 : class SdXMLImExPointsElement
125 : {
126 : rtl::OUString msString;
127 : com::sun::star::drawing::PointSequenceSequence maPoly;
128 :
129 : public:
130 : SdXMLImExPointsElement(com::sun::star::drawing::PointSequence* pPoints,
131 : const SdXMLImExViewBox& rViewBox,
132 : const com::sun::star::awt::Point& rObjectPos,
133 : const com::sun::star::awt::Size& rObjectSize,
134 : // #96328#
135 : const bool bClosed = true);
136 : SdXMLImExPointsElement(const rtl::OUString& rNew,
137 : const SdXMLImExViewBox& rViewBox,
138 : const com::sun::star::awt::Point& rObjectPos,
139 : const com::sun::star::awt::Size& rObjectSize,
140 : const SvXMLUnitConverter& rConv);
141 :
142 0 : const rtl::OUString& GetExportString() const { return msString; }
143 5 : const com::sun::star::drawing::PointSequenceSequence& GetPointSequenceSequence() const { return maPoly; }
144 : };
145 :
146 : //////////////////////////////////////////////////////////////////////////////
147 :
148 7 : class SdXMLImExSvgDElement
149 : {
150 : rtl::OUString msString;
151 : const SdXMLImExViewBox& mrViewBox;
152 : bool mbIsClosed;
153 : bool mbIsCurve;
154 : bool mbRelative;
155 : sal_Int32 mnLastX;
156 : sal_Int32 mnLastY;
157 :
158 : com::sun::star::drawing::PolyPolygonBezierCoords maPoly;
159 :
160 : public:
161 : SdXMLImExSvgDElement(const SdXMLImExViewBox& rViewBox, const SvXMLExport& rExport);
162 : SdXMLImExSvgDElement(const rtl::OUString& rNew,
163 : const SdXMLImExViewBox& rViewBox,
164 : const com::sun::star::awt::Point& rObjectPos,
165 : const com::sun::star::awt::Size& rObjectSize,
166 : const SvXMLImport& rImport);
167 :
168 : void AddPolygon(
169 : com::sun::star::drawing::PointSequence* pPoints,
170 : com::sun::star::drawing::FlagSequence* pFlags,
171 : const com::sun::star::awt::Point& rObjectPos,
172 : const com::sun::star::awt::Size& rObjectSize,
173 : bool bClosed = false);
174 :
175 0 : const rtl::OUString& GetExportString() const { return msString; }
176 4 : bool IsClosed() const { return mbIsClosed; }
177 11 : bool IsCurve() const { return mbIsCurve; }
178 7 : const com::sun::star::drawing::PointSequenceSequence& GetPointSequenceSequence() const { return maPoly.Coordinates; }
179 4 : const com::sun::star::drawing::FlagSequenceSequence& GetFlagSequenceSequence() const { return maPoly.Flags; }
180 : };
181 :
182 :
183 : #endif // _XEXPTRANSFORM_HXX
184 :
185 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|