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