xref: /aoo41x/main/xmloff/source/draw/ximpshap.hxx (revision 598d8f9f)
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 _XIMPSHAPE_HXX
25 #define _XIMPSHAPE_HXX
26 
27 #include <com/sun/star/io/XOutputStream.hpp>
28 #include <com/sun/star/document/XActionLockable.hpp>
29 #include <com/sun/star/container/XIdentifierContainer.hpp>
30 #include <xmloff/xmlictxt.hxx>
31 #include "sdxmlimp_impl.hxx"
32 #include <xmloff/nmspmap.hxx>
33 #include <com/sun/star/drawing/XShapes.hpp>
34 #include <com/sun/star/text/XTextCursor.hpp>
35 #include <com/sun/star/awt/Point.hpp>
36 #include <tools/rtti.hxx>
37 #include "xexptran.hxx"
38 
39 #include <vector>
40 #include <xmloff/shapeimport.hxx>
41 #include <xmloff/xmlmultiimagehelper.hxx>
42 
43 //////////////////////////////////////////////////////////////////////////////
44 // common shape context
45 
46 class SdXMLShapeContext : public SvXMLShapeContext
47 {
48 protected:
49 	// the shape group this object should be created inside
50 	com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >	mxShapes;
51 	com::sun::star::uno::Reference< com::sun::star::text::XTextCursor >	mxCursor;
52 	com::sun::star::uno::Reference< com::sun::star::text::XTextCursor >	mxOldCursor;
53 	com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList> mxAttrList;
54 	com::sun::star::uno::Reference< com::sun::star::container::XIdentifierContainer > mxGluePoints;
55 	com::sun::star::uno::Reference< com::sun::star::document::XActionLockable > mxLockable;
56 
57 	rtl::OUString				maDrawStyleName;
58 	rtl::OUString				maTextStyleName;
59 	rtl::OUString				maPresentationClass;
60 	rtl::OUString				maShapeName;
61 	rtl::OUString				maThumbnailURL;
62 
63     /// whether to restore list context (#91964#)
64     bool                        mbListContextPushed;
65 
66 	sal_uInt16					mnStyleFamily;
67 	sal_uInt16					mnClass;
68 	sal_Bool					mbIsPlaceholder;
69 	bool						mbClearDefaultAttributes;
70 	sal_Bool					mbIsUserTransformed;
71 	sal_Int32					mnZOrder;
72 	rtl::OUString				maShapeId;
73 	rtl::OUString				maLayerName;
74 
75 	// #i68101#
76 	rtl::OUString				maShapeTitle;
77 	rtl::OUString				maShapeDescription;
78 
79 	SdXMLImExTransform2D		mnTransform;
80 	com::sun::star::awt::Size	maSize;
81 	com::sun::star::awt::Point	maPosition;
82 
83 	bool						mbVisible;
84 	bool						mbPrintable;
85 
86 	/** if bSupportsStyle is false, auto styles will be set but not	a style */
87 	void SetStyle( bool bSupportsStyle = true );
88 	void SetLayer();
89 	void SetThumbnail();
90 
91 	void AddShape(com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape);
92 	void AddShape(const char* pServiceName );
93 	void SetTransformation();
94 
95 	SvXMLImport& GetImport() { return SvXMLImportContext::GetImport(); }
96 	const SvXMLImport& GetImport() const { return SvXMLImportContext::GetImport(); }
97 
98 	void addGluePoint( const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
99 
100 	sal_Bool isPresentationShape() const;
101 
102 public:
103 	TYPEINFO();
104 
105 	SdXMLShapeContext( SvXMLImport& rImport,
106 		sal_uInt16 nPrfx,
107 		const rtl::OUString& rLocalName,
108 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
109 		com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
110         sal_Bool bTemporaryShape);
111 	virtual ~SdXMLShapeContext();
112 
113 	virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
114 	virtual void EndElement();
115 
116 	virtual SvXMLImportContext * CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
117 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
118 
119 	// this is called from the parent group for each unparsed attribute in the attribute list
120 	virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
121 
122     /// access to ShapeId for evtl. late adding
123     const rtl::OUString& getShapeId() const { return maShapeId; }
124 };
125 
126 //////////////////////////////////////////////////////////////////////////////
127 // draw:rect context
128 
129 class SdXMLRectShapeContext : public SdXMLShapeContext
130 {
131 	sal_Int32					mnRadius;
132 
133 public:
134 	TYPEINFO();
135 
136 	SdXMLRectShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
137 		const rtl::OUString& rLocalName,
138 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
139 		com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
140         sal_Bool bTemporaryShape);
141 	virtual ~SdXMLRectShapeContext();
142 	virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
143 
144 	// this is called from the parent group for each unparsed attribute in the attribute list
145 	virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
146 };
147 
148 //////////////////////////////////////////////////////////////////////////////
149 // draw:line context
150 
151 class SdXMLLineShapeContext : public SdXMLShapeContext
152 {
153 	sal_Int32					mnX1;
154 	sal_Int32					mnY1;
155 	sal_Int32					mnX2;
156 	sal_Int32					mnY2;
157 
158 public:
159 	TYPEINFO();
160 
161 	SdXMLLineShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
162 		const rtl::OUString& rLocalName,
163 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
164 		com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
165         sal_Bool bTemporaryShape);
166 	virtual ~SdXMLLineShapeContext();
167 	virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
168 
169 	// this is called from the parent group for each unparsed attribute in the attribute list
170 	virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
171 };
172 
173 //////////////////////////////////////////////////////////////////////////////
174 // draw:ellipse and draw:circle context
175 
176 class SdXMLEllipseShapeContext : public SdXMLShapeContext
177 {
178 	sal_Int32					mnCX;
179 	sal_Int32					mnCY;
180 	sal_Int32					mnRX;
181 	sal_Int32					mnRY;
182 
183 	sal_uInt16						meKind;
184 	sal_Int32					mnStartAngle;
185 	sal_Int32					mnEndAngle;
186 public:
187 	TYPEINFO();
188 
189 	SdXMLEllipseShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
190 		const rtl::OUString& rLocalName,
191 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
192 		com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
193         sal_Bool bTemporaryShape);
194 	virtual ~SdXMLEllipseShapeContext();
195 	virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
196 
197 	// this is called from the parent group for each unparsed attribute in the attribute list
198 	virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
199 };
200 
201 //////////////////////////////////////////////////////////////////////////////
202 // draw:polyline and draw:polygon context
203 
204 class SdXMLPolygonShapeContext : public SdXMLShapeContext
205 {
206 	rtl::OUString				maPoints;
207 	rtl::OUString				maViewBox;
208 	sal_Bool					mbClosed;
209 
210 public:
211 	TYPEINFO();
212 
213 	SdXMLPolygonShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
214 		const rtl::OUString& rLocalName,
215 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
216 		com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes, sal_Bool bClosed, sal_Bool bTemporaryShape);
217 	virtual ~SdXMLPolygonShapeContext();
218 	virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
219 
220 	// this is called from the parent group for each unparsed attribute in the attribute list
221 	virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
222 };
223 
224 //////////////////////////////////////////////////////////////////////////////
225 // draw:path context
226 
227 class SdXMLPathShapeContext : public SdXMLShapeContext
228 {
229 	rtl::OUString				maD;
230 	rtl::OUString				maViewBox;
231 	sal_Bool					mbClosed;
232 
233 public:
234 	TYPEINFO();
235 
236 	SdXMLPathShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
237 		const rtl::OUString& rLocalName,
238 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
239 		com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
240         sal_Bool bTemporaryShape);
241 	virtual ~SdXMLPathShapeContext();
242 	virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
243 
244 	// this is called from the parent group for each unparsed attribute in the attribute list
245 	virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
246 };
247 
248 //////////////////////////////////////////////////////////////////////////////
249 // draw:text-box context
250 
251 class SdXMLTextBoxShapeContext : public SdXMLShapeContext
252 {
253 	sal_Int32					mnRadius;
254 
255 public:
256 	TYPEINFO();
257 
258 	SdXMLTextBoxShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
259 		const rtl::OUString& rLocalName,
260 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
261 		com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
262         sal_Bool bTemporaryShape);
263 	virtual ~SdXMLTextBoxShapeContext();
264 	virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
265 
266 	// this is called from the parent group for each unparsed attribute in the attribute list
267 	virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
268 };
269 
270 //////////////////////////////////////////////////////////////////////////////
271 // draw:control context
272 
273 class SdXMLControlShapeContext : public SdXMLShapeContext
274 {
275 private:
276 	rtl::OUString maFormId;
277 
278 public:
279 	TYPEINFO();
280 
281 	SdXMLControlShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
282 		const rtl::OUString& rLocalName,
283 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
284 		com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
285         sal_Bool bTemporaryShape);
286 	virtual ~SdXMLControlShapeContext();
287 	virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
288 
289 	// this is called from the parent group for each unparsed attribute in the attribute list
290 	virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
291 };
292 
293 //////////////////////////////////////////////////////////////////////////////
294 // draw:connector context
295 
296 class SdXMLConnectorShapeContext : public SdXMLShapeContext
297 {
298 private:
299 	::com::sun::star::awt::Point maStart;
300 	::com::sun::star::awt::Point maEnd;
301 
302 	sal_uInt16		mnType;
303 
304 	rtl::OUString	maStartShapeId;
305 	sal_Int32		mnStartGlueId;
306 	rtl::OUString	maEndShapeId;
307 	sal_Int32		mnEndGlueId;
308 
309 	sal_Int32	mnDelta1;
310 	sal_Int32	mnDelta2;
311 	sal_Int32	mnDelta3;
312 
313 	com::sun::star::uno::Any maPath;
314 
315 public:
316 	TYPEINFO();
317 
318 	SdXMLConnectorShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
319 		const rtl::OUString& rLocalName,
320 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
321 		com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
322         sal_Bool bTemporaryShape);
323 	virtual ~SdXMLConnectorShapeContext();
324 	virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
325 
326 	// this is called from the parent group for each unparsed attribute in the attribute list
327 	virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
328 };
329 
330 //////////////////////////////////////////////////////////////////////////////
331 // draw:measure context
332 
333 class SdXMLMeasureShapeContext : public SdXMLShapeContext
334 {
335 private:
336 	::com::sun::star::awt::Point maStart;
337 	::com::sun::star::awt::Point maEnd;
338 
339 public:
340 	TYPEINFO();
341 
342 	SdXMLMeasureShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
343 		const rtl::OUString& rLocalName,
344 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
345 		com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
346         sal_Bool bTemporaryShape);
347 	virtual ~SdXMLMeasureShapeContext();
348 	virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
349 	virtual void EndElement();
350 
351 	// this is called from the parent group for each unparsed attribute in the attribute list
352 	virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
353 };
354 
355 //////////////////////////////////////////////////////////////////////////////
356 // draw:page context
357 
358 class SdXMLPageShapeContext : public SdXMLShapeContext
359 {
360 private:
361 	sal_Int32	mnPageNumber;
362 public:
363 	TYPEINFO();
364 
365 	SdXMLPageShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
366 		const rtl::OUString& rLocalName,
367 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
368 		com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
369         sal_Bool bTemporaryShape);
370 	virtual ~SdXMLPageShapeContext();
371 	virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
372 
373 	// this is called from the parent group for each unparsed attribute in the attribute list
374 	virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
375 };
376 
377 //////////////////////////////////////////////////////////////////////////////
378 // draw:caption context
379 
380 class SdXMLCaptionShapeContext : public SdXMLShapeContext
381 {
382 private:
383 	com::sun::star::awt::Point maCaptionPoint;
384 	sal_Int32 mnRadius;
385 
386 public:
387 	TYPEINFO();
388 
389 	SdXMLCaptionShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
390 		const rtl::OUString& rLocalName,
391 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
392 		com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
393         sal_Bool bTemporaryShape);
394 	virtual ~SdXMLCaptionShapeContext();
395 	virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
396 
397 	// this is called from the parent group for each unparsed attribute in the attribute list
398 	virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
399 };
400 
401 //////////////////////////////////////////////////////////////////////////////
402 // office:image context
403 
404 class SdXMLGraphicObjectShapeContext : public SdXMLShapeContext
405 {
406 private:
407 	::rtl::OUString maURL;
408 	::com::sun::star::uno::Reference < ::com::sun::star::io::XOutputStream > mxBase64Stream;
409 
410     /// bitfield
411     bool                mbLateAddToIdentifierMapper : 1;
412 
413 public:
414 	TYPEINFO();
415 
416 	SdXMLGraphicObjectShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
417 		const rtl::OUString& rLocalName,
418 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
419 		com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
420         sal_Bool bTemporaryShape);
421 	virtual ~SdXMLGraphicObjectShapeContext();
422 
423 	virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
424 	virtual void EndElement();
425 	virtual SvXMLImportContext * CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
426 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
427 
428 	// this is called from the parent group for each unparsed attribute in the attribute list
429 	virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
430 
431     /// support for LateAddToIdentifierMapper
432     bool getLateAddToIdentifierMapper() const { return mbLateAddToIdentifierMapper; }
433     void setLateAddToIdentifierMapper(bool bNew) { mbLateAddToIdentifierMapper = bNew; }
434 };
435 
436 //////////////////////////////////////////////////////////////////////////////
437 // chart:chart context
438 
439 class SdXMLChartShapeContext : public SdXMLShapeContext
440 {
441 	SvXMLImportContext*			mpChartContext;
442 
443 public:
444 	TYPEINFO();
445 
446 	SdXMLChartShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
447 		const rtl::OUString& rLocalName,
448 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
449 		com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
450         sal_Bool bTemporaryShape);
451 	virtual ~SdXMLChartShapeContext();
452 
453 	virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
454 	virtual void EndElement();
455 	virtual void Characters( const ::rtl::OUString& rChars );
456 	virtual SvXMLImportContext * CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
457 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
458 };
459 
460 //////////////////////////////////////////////////////////////////////////////
461 // draw:object and draw:object_ole context
462 
463 class SdXMLObjectShapeContext : public SdXMLShapeContext
464 {
465 private:
466 	rtl::OUString maCLSID;
467 	rtl::OUString maHref;
468 
469 	// #100592#
470 	::com::sun::star::uno::Reference < ::com::sun::star::io::XOutputStream > mxBase64Stream;
471 
472 public:
473 	TYPEINFO();
474 
475 	SdXMLObjectShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
476 		const rtl::OUString& rLocalName,
477 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
478 		com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
479         sal_Bool bTemporaryShape);
480 	virtual ~SdXMLObjectShapeContext();
481 
482 	virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
483 	virtual void EndElement();
484 
485 	// #100592#
486 	virtual SvXMLImportContext * CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
487 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
488 
489 	// this is called from the parent group for each unparsed attribute in the attribute list
490 	virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
491 };
492 
493 //////////////////////////////////////////////////////////////////////////////
494 // draw:applet
495 
496 class SdXMLAppletShapeContext : public SdXMLShapeContext
497 {
498 private:
499 	rtl::OUString maAppletName;
500 	rtl::OUString maAppletCode;
501 	rtl::OUString maHref;
502 	sal_Bool mbIsScript;
503 
504 	com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > maParams;
505 
506 public:
507 	TYPEINFO();
508 
509 	SdXMLAppletShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
510 		const rtl::OUString& rLocalName,
511 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
512 		com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
513         sal_Bool bTemporaryShape);
514 	virtual ~SdXMLAppletShapeContext();
515 
516 	virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
517 	virtual void EndElement();
518 
519 	virtual SvXMLImportContext * CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
520 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
521 
522 	// this is called from the parent group for each unparsed attribute in the attribute list
523 	virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
524 };
525 
526 //////////////////////////////////////////////////////////////////////////////
527 // draw:plugin
528 
529 class SdXMLPluginShapeContext : public SdXMLShapeContext
530 {
531 private:
532 	rtl::OUString 	maMimeType;
533 	rtl::OUString 	maHref;
534 	bool			mbMedia;
535 
536 	com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > maParams;
537 
538 public:
539 	TYPEINFO();
540 
541 	SdXMLPluginShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
542 		const rtl::OUString& rLocalName,
543 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
544 		com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
545         sal_Bool bTemporaryShape);
546 	virtual ~SdXMLPluginShapeContext();
547 
548 	virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
549 	virtual void EndElement();
550 
551 	virtual SvXMLImportContext * CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
552 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
553 
554 	// this is called from the parent group for each unparsed attribute in the attribute list
555 	virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
556 };
557 
558 //////////////////////////////////////////////////////////////////////////////
559 // draw:floating-frame
560 
561 class SdXMLFloatingFrameShapeContext : public SdXMLShapeContext
562 {
563 private:
564 	rtl::OUString maFrameName;
565 	rtl::OUString maHref;
566 
567 public:
568 	TYPEINFO();
569 
570 	SdXMLFloatingFrameShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
571 		const rtl::OUString& rLocalName,
572 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
573 		com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
574         sal_Bool bTemporaryShape);
575 	virtual ~SdXMLFloatingFrameShapeContext();
576 
577 	virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
578 	virtual void EndElement();
579 
580 	// this is called from the parent group for each unparsed attribute in the attribute list
581 	virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
582 };
583 
584 //////////////////////////////////////////////////////////////////////////////
585 // draw:-frame
586 
587 class SdXMLFrameShapeContext : public SdXMLShapeContext, public multiImageImportHelper
588 {
589 private:
590 	sal_Bool mbSupportsReplacement;
591 	SvXMLImportContextRef mxImplContext;
592 	SvXMLImportContextRef mxReplImplContext;
593 
594 protected:
595     /// helper to get the created xShape instance, needs to be overloaded
596     virtual rtl::OUString getGraphicURLFromImportContext(const SvXMLImportContext& rContext) const;
597     virtual void removeGraphicFromImportContext(const SvXMLImportContext& rContext) const;
598 
599 public:
600 	TYPEINFO();
601 
602 	SdXMLFrameShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
603 		const rtl::OUString& rLocalName,
604 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
605 		com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
606         sal_Bool bTemporaryShape);
607 	virtual ~SdXMLFrameShapeContext();
608 
609 	virtual SvXMLImportContext * CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
610 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
611 
612 	virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
613 	virtual void EndElement();
614 
615 	virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
616 };
617 
618 class SdXMLCustomShapeContext : public SdXMLShapeContext
619 {
620 
621 protected :
622 
623 	rtl::OUString maCustomShapeEngine;
624 	rtl::OUString maCustomShapeData;
625 
626 	std::vector< com::sun::star::beans::PropertyValue > maCustomShapeGeometry;
627 
628 public:
629 
630 	TYPEINFO();
631 
632 	SdXMLCustomShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLocalName,
633 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
634 		com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
635         sal_Bool bTemporaryShape);
636 	virtual ~SdXMLCustomShapeContext();
637 
638 	virtual void StartElement( const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
639 	virtual void EndElement();
640 
641 	virtual SvXMLImportContext * CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
642 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
643 
644 	// this is called from the parent group for each unparsed attribute in the attribute list
645 	virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
646 };
647 
648 //////////////////////////////////////////////////////////////////////////////
649 // draw:table
650 
651 class SdXMLTableShapeContext : public SdXMLShapeContext
652 {
653 public:
654 	TYPEINFO();
655 
656 	SdXMLTableShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
657 		const rtl::OUString& rLocalName,
658 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
659 		com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes );
660 	virtual ~SdXMLTableShapeContext();
661 
662 	virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
663 	virtual void EndElement();
664 
665 	virtual SvXMLImportContext * CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
666 
667 	// this is called from the parent group for each unparsed attribute in the attribute list
668 	virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
669 
670 private:
671 	SvXMLImportContextRef mxTableImportContext;
672 	rtl::OUString msTemplateStyleName;
673 	sal_Bool maTemplateStylesUsed[6];
674 };
675 
676 #endif	//  _XIMPSHAPE_HXX
677