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 94 SvXMLImport& GetImport() { return SvXMLImportContext::GetImport(); } 95 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 122 const rtl::OUString& getShapeId() const { return maShapeId; } 123 }; 124 125 ////////////////////////////////////////////////////////////////////////////// 126 // draw:rect context 127 128 class SdXMLRectShapeContext : public SdXMLShapeContext 129 { 130 sal_Int32 mnRadius; 131 132 public: 133 TYPEINFO(); 134 135 SdXMLRectShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx, 136 const rtl::OUString& rLocalName, 137 const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, 138 com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes, 139 sal_Bool bTemporaryShape); 140 virtual ~SdXMLRectShapeContext(); 141 virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList); 142 143 // this is called from the parent group for each unparsed attribute in the attribute list 144 virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ); 145 }; 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(); 159 160 SdXMLLineShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx, 161 const rtl::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 sal_Bool bTemporaryShape); 165 virtual ~SdXMLLineShapeContext(); 166 virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList); 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 ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ); 170 }; 171 172 ////////////////////////////////////////////////////////////////////////////// 173 // draw:ellipse and draw:circle context 174 175 class SdXMLEllipseShapeContext : public SdXMLShapeContext 176 { 177 sal_Int32 mnCX; 178 sal_Int32 mnCY; 179 sal_Int32 mnRX; 180 sal_Int32 mnRY; 181 182 sal_uInt16 meKind; 183 sal_Int32 mnStartAngle; 184 sal_Int32 mnEndAngle; 185 public: 186 TYPEINFO(); 187 188 SdXMLEllipseShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx, 189 const rtl::OUString& rLocalName, 190 const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, 191 com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes, 192 sal_Bool bTemporaryShape); 193 virtual ~SdXMLEllipseShapeContext(); 194 virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList); 195 196 // this is called from the parent group for each unparsed attribute in the attribute list 197 virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ); 198 }; 199 200 ////////////////////////////////////////////////////////////////////////////// 201 // draw:polyline and draw:polygon context 202 203 class SdXMLPolygonShapeContext : public SdXMLShapeContext 204 { 205 rtl::OUString maPoints; 206 rtl::OUString maViewBox; 207 sal_Bool mbClosed; 208 209 public: 210 TYPEINFO(); 211 212 SdXMLPolygonShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx, 213 const rtl::OUString& rLocalName, 214 const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, 215 com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes, sal_Bool bClosed, sal_Bool bTemporaryShape); 216 virtual ~SdXMLPolygonShapeContext(); 217 virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList); 218 219 // this is called from the parent group for each unparsed attribute in the attribute list 220 virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ); 221 }; 222 223 ////////////////////////////////////////////////////////////////////////////// 224 // draw:path context 225 226 class SdXMLPathShapeContext : public SdXMLShapeContext 227 { 228 rtl::OUString maD; 229 rtl::OUString maViewBox; 230 sal_Bool mbClosed; 231 232 public: 233 TYPEINFO(); 234 235 SdXMLPathShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx, 236 const rtl::OUString& rLocalName, 237 const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, 238 com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes, 239 sal_Bool bTemporaryShape); 240 virtual ~SdXMLPathShapeContext(); 241 virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList); 242 243 // this is called from the parent group for each unparsed attribute in the attribute list 244 virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ); 245 }; 246 247 ////////////////////////////////////////////////////////////////////////////// 248 // draw:text-box context 249 250 class SdXMLTextBoxShapeContext : public SdXMLShapeContext 251 { 252 sal_Int32 mnRadius; 253 254 public: 255 TYPEINFO(); 256 257 SdXMLTextBoxShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx, 258 const rtl::OUString& rLocalName, 259 const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, 260 com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes, 261 sal_Bool bTemporaryShape); 262 virtual ~SdXMLTextBoxShapeContext(); 263 virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList); 264 265 // this is called from the parent group for each unparsed attribute in the attribute list 266 virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ); 267 }; 268 269 ////////////////////////////////////////////////////////////////////////////// 270 // draw:control context 271 272 class SdXMLControlShapeContext : public SdXMLShapeContext 273 { 274 private: 275 rtl::OUString maFormId; 276 277 public: 278 TYPEINFO(); 279 280 SdXMLControlShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx, 281 const rtl::OUString& rLocalName, 282 const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, 283 com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes, 284 sal_Bool bTemporaryShape); 285 virtual ~SdXMLControlShapeContext(); 286 virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList); 287 288 // this is called from the parent group for each unparsed attribute in the attribute list 289 virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ); 290 }; 291 292 ////////////////////////////////////////////////////////////////////////////// 293 // draw:connector context 294 295 class SdXMLConnectorShapeContext : public SdXMLShapeContext 296 { 297 private: 298 ::com::sun::star::awt::Point maStart; 299 ::com::sun::star::awt::Point maEnd; 300 301 sal_uInt16 mnType; 302 303 rtl::OUString maStartShapeId; 304 sal_Int32 mnStartGlueId; 305 rtl::OUString maEndShapeId; 306 sal_Int32 mnEndGlueId; 307 308 sal_Int32 mnDelta1; 309 sal_Int32 mnDelta2; 310 sal_Int32 mnDelta3; 311 312 com::sun::star::uno::Any maPath; 313 314 public: 315 TYPEINFO(); 316 317 SdXMLConnectorShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx, 318 const rtl::OUString& rLocalName, 319 const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, 320 com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes, 321 sal_Bool bTemporaryShape); 322 virtual ~SdXMLConnectorShapeContext(); 323 virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList); 324 325 // this is called from the parent group for each unparsed attribute in the attribute list 326 virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ); 327 }; 328 329 ////////////////////////////////////////////////////////////////////////////// 330 // draw:measure context 331 332 class SdXMLMeasureShapeContext : public SdXMLShapeContext 333 { 334 private: 335 ::com::sun::star::awt::Point maStart; 336 ::com::sun::star::awt::Point maEnd; 337 338 public: 339 TYPEINFO(); 340 341 SdXMLMeasureShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx, 342 const rtl::OUString& rLocalName, 343 const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, 344 com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes, 345 sal_Bool bTemporaryShape); 346 virtual ~SdXMLMeasureShapeContext(); 347 virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList); 348 virtual void EndElement(); 349 350 // this is called from the parent group for each unparsed attribute in the attribute list 351 virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ); 352 }; 353 354 ////////////////////////////////////////////////////////////////////////////// 355 // draw:page context 356 357 class SdXMLPageShapeContext : public SdXMLShapeContext 358 { 359 private: 360 sal_Int32 mnPageNumber; 361 public: 362 TYPEINFO(); 363 364 SdXMLPageShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx, 365 const rtl::OUString& rLocalName, 366 const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, 367 com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes, 368 sal_Bool bTemporaryShape); 369 virtual ~SdXMLPageShapeContext(); 370 virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList); 371 372 // this is called from the parent group for each unparsed attribute in the attribute list 373 virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ); 374 }; 375 376 ////////////////////////////////////////////////////////////////////////////// 377 // draw:caption context 378 379 class SdXMLCaptionShapeContext : public SdXMLShapeContext 380 { 381 private: 382 com::sun::star::awt::Point maCaptionPoint; 383 sal_Int32 mnRadius; 384 385 public: 386 TYPEINFO(); 387 388 SdXMLCaptionShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx, 389 const rtl::OUString& rLocalName, 390 const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, 391 com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes, 392 sal_Bool bTemporaryShape); 393 virtual ~SdXMLCaptionShapeContext(); 394 virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList); 395 396 // this is called from the parent group for each unparsed attribute in the attribute list 397 virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ); 398 }; 399 400 ////////////////////////////////////////////////////////////////////////////// 401 // office:image context 402 403 class SdXMLGraphicObjectShapeContext : public SdXMLShapeContext 404 { 405 private: 406 ::rtl::OUString maURL; 407 ::com::sun::star::uno::Reference < ::com::sun::star::io::XOutputStream > mxBase64Stream; 408 409 /// bitfield 410 bool mbLateAddToIdentifierMapper : 1; 411 412 public: 413 TYPEINFO(); 414 415 SdXMLGraphicObjectShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx, 416 const rtl::OUString& rLocalName, 417 const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, 418 com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes, 419 sal_Bool bTemporaryShape); 420 virtual ~SdXMLGraphicObjectShapeContext(); 421 422 virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); 423 virtual void EndElement(); 424 virtual SvXMLImportContext * CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, 425 const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList ); 426 427 // this is called from the parent group for each unparsed attribute in the attribute list 428 virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ); 429 430 /// support for LateAddToIdentifierMapper 431 bool getLateAddToIdentifierMapper() const { return mbLateAddToIdentifierMapper; } 432 void setLateAddToIdentifierMapper(bool bNew) { mbLateAddToIdentifierMapper = bNew; } 433 }; 434 435 ////////////////////////////////////////////////////////////////////////////// 436 // chart:chart context 437 438 class SdXMLChartShapeContext : public SdXMLShapeContext 439 { 440 SvXMLImportContext* mpChartContext; 441 442 public: 443 TYPEINFO(); 444 445 SdXMLChartShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx, 446 const rtl::OUString& rLocalName, 447 const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, 448 com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes, 449 sal_Bool bTemporaryShape); 450 virtual ~SdXMLChartShapeContext(); 451 452 virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); 453 virtual void EndElement(); 454 virtual void Characters( const ::rtl::OUString& rChars ); 455 virtual SvXMLImportContext * CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, 456 const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList ); 457 }; 458 459 ////////////////////////////////////////////////////////////////////////////// 460 // draw:object and draw:object_ole context 461 462 class SdXMLObjectShapeContext : public SdXMLShapeContext 463 { 464 private: 465 rtl::OUString maCLSID; 466 rtl::OUString maHref; 467 468 // #100592# 469 ::com::sun::star::uno::Reference < ::com::sun::star::io::XOutputStream > mxBase64Stream; 470 471 public: 472 TYPEINFO(); 473 474 SdXMLObjectShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx, 475 const rtl::OUString& rLocalName, 476 const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, 477 com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes, 478 sal_Bool bTemporaryShape); 479 virtual ~SdXMLObjectShapeContext(); 480 481 virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); 482 virtual void EndElement(); 483 484 // #100592# 485 virtual SvXMLImportContext * CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, 486 const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList ); 487 488 // this is called from the parent group for each unparsed attribute in the attribute list 489 virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ); 490 }; 491 492 ////////////////////////////////////////////////////////////////////////////// 493 // draw:applet 494 495 class SdXMLAppletShapeContext : public SdXMLShapeContext 496 { 497 private: 498 rtl::OUString maAppletName; 499 rtl::OUString maAppletCode; 500 rtl::OUString maHref; 501 sal_Bool mbIsScript; 502 503 com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > maParams; 504 505 public: 506 TYPEINFO(); 507 508 SdXMLAppletShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx, 509 const rtl::OUString& rLocalName, 510 const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, 511 com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes, 512 sal_Bool bTemporaryShape); 513 virtual ~SdXMLAppletShapeContext(); 514 515 virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); 516 virtual void EndElement(); 517 518 virtual SvXMLImportContext * CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, 519 const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList ); 520 521 // this is called from the parent group for each unparsed attribute in the attribute list 522 virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ); 523 }; 524 525 ////////////////////////////////////////////////////////////////////////////// 526 // draw:plugin 527 528 class SdXMLPluginShapeContext : public SdXMLShapeContext 529 { 530 private: 531 rtl::OUString maMimeType; 532 rtl::OUString maHref; 533 bool mbMedia; 534 535 com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > maParams; 536 537 public: 538 TYPEINFO(); 539 540 SdXMLPluginShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx, 541 const rtl::OUString& rLocalName, 542 const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, 543 com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes, 544 sal_Bool bTemporaryShape); 545 virtual ~SdXMLPluginShapeContext(); 546 547 virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); 548 virtual void EndElement(); 549 550 virtual SvXMLImportContext * CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, 551 const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList ); 552 553 // this is called from the parent group for each unparsed attribute in the attribute list 554 virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ); 555 }; 556 557 ////////////////////////////////////////////////////////////////////////////// 558 // draw:floating-frame 559 560 class SdXMLFloatingFrameShapeContext : public SdXMLShapeContext 561 { 562 private: 563 rtl::OUString maFrameName; 564 rtl::OUString maHref; 565 566 public: 567 TYPEINFO(); 568 569 SdXMLFloatingFrameShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx, 570 const rtl::OUString& rLocalName, 571 const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, 572 com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes, 573 sal_Bool bTemporaryShape); 574 virtual ~SdXMLFloatingFrameShapeContext(); 575 576 virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); 577 virtual void EndElement(); 578 579 // this is called from the parent group for each unparsed attribute in the attribute list 580 virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ); 581 }; 582 583 ////////////////////////////////////////////////////////////////////////////// 584 // draw:-frame 585 586 class SdXMLFrameShapeContext : public SdXMLShapeContext, public multiImageImportHelper 587 { 588 private: 589 sal_Bool mbSupportsReplacement; 590 SvXMLImportContextRef mxImplContext; 591 SvXMLImportContextRef mxReplImplContext; 592 593 protected: 594 /// helper to get the created xShape instance, needs to be overloaded 595 virtual rtl::OUString getGraphicURLFromImportContext(const SvXMLImportContext& rContext) const; 596 virtual void removeGraphicFromImportContext(const SvXMLImportContext& rContext) const; 597 598 public: 599 TYPEINFO(); 600 601 SdXMLFrameShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx, 602 const rtl::OUString& rLocalName, 603 const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, 604 com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes, 605 sal_Bool bTemporaryShape); 606 virtual ~SdXMLFrameShapeContext(); 607 608 virtual SvXMLImportContext * CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, 609 const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList ); 610 611 virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); 612 virtual void EndElement(); 613 614 virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ); 615 }; 616 617 class SdXMLCustomShapeContext : public SdXMLShapeContext 618 { 619 620 protected : 621 622 rtl::OUString maCustomShapeEngine; 623 rtl::OUString maCustomShapeData; 624 625 std::vector< com::sun::star::beans::PropertyValue > maCustomShapeGeometry; 626 627 public: 628 629 TYPEINFO(); 630 631 SdXMLCustomShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLocalName, 632 const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, 633 com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes, 634 sal_Bool bTemporaryShape); 635 virtual ~SdXMLCustomShapeContext(); 636 637 virtual void StartElement( const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList ); 638 virtual void EndElement(); 639 640 virtual SvXMLImportContext * CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, 641 const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList ); 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 ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ); 645 }; 646 647 ////////////////////////////////////////////////////////////////////////////// 648 // draw:table 649 650 class SdXMLTableShapeContext : public SdXMLShapeContext 651 { 652 public: 653 TYPEINFO(); 654 655 SdXMLTableShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx, 656 const rtl::OUString& rLocalName, 657 const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, 658 com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes ); 659 virtual ~SdXMLTableShapeContext(); 660 661 virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); 662 virtual void EndElement(); 663 664 virtual SvXMLImportContext * CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList ); 665 666 // this is called from the parent group for each unparsed attribute in the attribute list 667 virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ); 668 669 private: 670 SvXMLImportContextRef mxTableImportContext; 671 rtl::OUString msTemplateStyleName; 672 sal_Bool maTemplateStylesUsed[6]; 673 }; 674 675 #endif // _XIMPSHAPE_HXX 676