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