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