1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _XIMP3DOBJECT_HXX
29 #define _XIMP3DOBJECT_HXX
30 
31 #include <xmloff/xmlictxt.hxx>
32 #include "sdxmlimp_impl.hxx"
33 #include <xmloff/nmspmap.hxx>
34 #include <com/sun/star/drawing/XShapes.hpp>
35 #include <tools/rtti.hxx>
36 #include <com/sun/star/drawing/HomogenMatrix.hpp>
37 #include <com/sun/star/drawing/Direction3D.hpp>
38 #include <com/sun/star/drawing/Position3D.hpp>
39 #include "ximpshap.hxx"
40 
41 //////////////////////////////////////////////////////////////////////////////
42 // common shape context
43 
44 class SdXML3DObjectContext : public SdXMLShapeContext
45 {
46 protected:
47 	// the shape group this object should be created inside
48 
49 	com::sun::star::drawing::HomogenMatrix mxHomMat;
50 	sal_Bool						mbSetTransform;
51 
52 /*
53 	void SetStyle();
54 	void AddShape(com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape);
55 */
56 public:
57 	TYPEINFO();
58 
59 	SdXML3DObjectContext( SvXMLImport& rImport,
60 		sal_uInt16 nPrfx,
61 		const rtl::OUString& rLocalName,
62 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
63 		com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
64         sal_Bool bTemporaryShape);
65 	virtual ~SdXML3DObjectContext();
66 
67 	virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
68 	virtual void EndElement();
69 };
70 
71 //////////////////////////////////////////////////////////////////////////////
72 // dr3d:3dcube context
73 
74 class SdXML3DCubeObjectShapeContext : public SdXML3DObjectContext
75 {
76 	::basegfx::B3DVector	maMinEdge;
77 	::basegfx::B3DVector	maMaxEdge;
78 	sal_Bool					mbMinEdgeUsed;
79 	sal_Bool					mbMaxEdgeUsed;
80 
81 public:
82 	TYPEINFO();
83 
84 	SdXML3DCubeObjectShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
85 		const rtl::OUString& rLocalName,
86 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
87 		com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
88         sal_Bool bTemporaryShape);
89 	virtual ~SdXML3DCubeObjectShapeContext();
90 
91 	virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
92 	virtual void EndElement();
93 };
94 
95 //////////////////////////////////////////////////////////////////////////////
96 // dr3d:3dsphere context
97 
98 class SdXML3DSphereObjectShapeContext : public SdXML3DObjectContext
99 {
100 	::basegfx::B3DVector	maCenter;
101 	::basegfx::B3DVector	maSize;
102 	sal_Bool					mbCenterUsed;
103 	sal_Bool					mbSizeUsed;
104 
105 public:
106 	TYPEINFO();
107 
108 	SdXML3DSphereObjectShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
109 		const rtl::OUString& rLocalName,
110 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
111 		com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
112         sal_Bool bTemporaryShape);
113 	virtual ~SdXML3DSphereObjectShapeContext();
114 
115 	virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
116 	virtual void EndElement();
117 };
118 
119 //////////////////////////////////////////////////////////////////////////////
120 // polygonbased context
121 
122 class SdXML3DPolygonBasedShapeContext : public SdXML3DObjectContext
123 {
124 	rtl::OUString				maPoints;
125 	rtl::OUString				maViewBox;
126 
127 public:
128 	TYPEINFO();
129 
130 	SdXML3DPolygonBasedShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
131 		const rtl::OUString& rLocalName,
132 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
133 		com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
134         sal_Bool bTemporaryShape);
135 	virtual ~SdXML3DPolygonBasedShapeContext();
136 
137 	virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
138 	virtual void EndElement();
139 };
140 
141 //////////////////////////////////////////////////////////////////////////////
142 // dr3d:3dlathe context
143 
144 class SdXML3DLatheObjectShapeContext : public SdXML3DPolygonBasedShapeContext
145 {
146 public:
147 	TYPEINFO();
148 
149 	SdXML3DLatheObjectShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
150 		const rtl::OUString& rLocalName,
151 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
152 		com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
153         sal_Bool bTemporaryShape);
154 	virtual ~SdXML3DLatheObjectShapeContext();
155 
156 	virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
157 	virtual void EndElement();
158 };
159 
160 //////////////////////////////////////////////////////////////////////////////
161 // dr3d:3dextrude context
162 
163 class SdXML3DExtrudeObjectShapeContext : public SdXML3DPolygonBasedShapeContext
164 {
165 public:
166 	TYPEINFO();
167 
168 	SdXML3DExtrudeObjectShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
169 		const rtl::OUString& rLocalName,
170 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
171 		com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
172         sal_Bool bTemporaryShape);
173 	virtual ~SdXML3DExtrudeObjectShapeContext();
174 
175 	virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
176 	virtual void EndElement();
177 };
178 
179 #endif	//  _XIMP3DOBJECT_HXX
180