LibreOffice Module xmloff (master)  1
ximpshap.cxx
Go to the documentation of this file.
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 #include <config_wasm_strip.h>
21 
22 #include <cassert>
23 
24 #include <sal/log.hxx>
25 #include <com/sun/star/document/XEventsSupplier.hpp>
26 #include <com/sun/star/container/XNameReplace.hpp>
27 #include <com/sun/star/presentation/ClickAction.hpp>
28 #include <com/sun/star/drawing/FillStyle.hpp>
29 #include <com/sun/star/drawing/LineStyle.hpp>
31 #include <com/sun/star/drawing/XGluePointsSupplier.hpp>
32 #include <com/sun/star/drawing/GluePoint2.hpp>
33 #include <com/sun/star/drawing/Alignment.hpp>
34 #include <com/sun/star/drawing/EscapeDirection.hpp>
35 #include <com/sun/star/media/ZoomLevel.hpp>
36 #include <com/sun/star/awt/Rectangle.hpp>
37 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
38 #include <com/sun/star/container/XNameAccess.hpp>
39 #include "ximpshap.hxx"
42 #include <xmloff/xmluconv.hxx>
43 #include <com/sun/star/container/XNamed.hpp>
44 #include <com/sun/star/beans/XPropertySet.hpp>
45 #include <com/sun/star/awt/XControlModel.hpp>
46 #include <com/sun/star/drawing/XControlShape.hpp>
47 #include <com/sun/star/drawing/PointSequenceSequence.hpp>
48 #include <com/sun/star/drawing/PointSequence.hpp>
49 #include <com/sun/star/lang/XServiceInfo.hpp>
50 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
51 #include <com/sun/star/util/XCloneable.hpp>
52 #include <com/sun/star/beans/XMultiPropertyStates.hpp>
53 #include <xexptran.hxx>
54 #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
55 #include <com/sun/star/beans/XPropertySetInfo.hpp>
56 #include <com/sun/star/drawing/HomogenMatrix3.hpp>
57 #include <com/sun/star/graphic/XGraphic.hpp>
58 #include <com/sun/star/style/XStyle.hpp>
59 
60 #include <sax/tools/converter.hxx>
61 #include <comphelper/sequence.hxx>
62 #include <tools/diagnose_ex.h>
63 
64 #include <xmloff/families.hxx>
66 #include <xmloff/xmltoken.hxx>
69 #include <XMLImageMapContext.hxx>
70 #include "sdpropls.hxx"
71 #include "eventimp.hxx"
72 #include "descriptionimp.hxx"
73 #include "SignatureLineContext.hxx"
74 #include "QRCodeContext.hxx"
75 #include "ximpcustomshape.hxx"
77 #include <xmloff/xmlerror.hxx>
80 #include <xmloff/attrlist.hxx>
82 #include <com/sun/star/drawing/XEnhancedCustomShapeDefaulter.hpp>
83 #include <com/sun/star/container/XChild.hpp>
84 #include <com/sun/star/text/XTextDocument.hpp>
92 #include <o3tl/any.hxx>
93 #include <o3tl/safeint.hxx>
94 
95 using namespace ::com::sun::star;
96 using namespace ::com::sun::star::uno;
97 using namespace ::com::sun::star::drawing;
98 using namespace ::com::sun::star::style;
99 using namespace ::com::sun::star::container;
100 using namespace ::com::sun::star::document;
101 using namespace ::xmloff::token;
102 using namespace ::xmloff::EnhancedCustomShapeToken;
103 
105 {
106  { XML_TOP_LEFT, drawing::Alignment_TOP_LEFT },
107  { XML_TOP, drawing::Alignment_TOP },
108  { XML_TOP_RIGHT, drawing::Alignment_TOP_RIGHT },
109  { XML_LEFT, drawing::Alignment_LEFT },
110  { XML_CENTER, drawing::Alignment_CENTER },
111  { XML_RIGHT, drawing::Alignment_RIGHT },
112  { XML_BOTTOM_LEFT, drawing::Alignment_BOTTOM_LEFT },
113  { XML_BOTTOM, drawing::Alignment_BOTTOM },
114  { XML_BOTTOM_RIGHT, drawing::Alignment_BOTTOM_RIGHT },
115  { XML_TOKEN_INVALID, drawing::Alignment(0) }
116 };
117 
119 {
120  { XML_AUTO, drawing::EscapeDirection_SMART },
121  { XML_LEFT, drawing::EscapeDirection_LEFT },
122  { XML_RIGHT, drawing::EscapeDirection_RIGHT },
123  { XML_UP, drawing::EscapeDirection_UP },
124  { XML_DOWN, drawing::EscapeDirection_DOWN },
125  { XML_HORIZONTAL, drawing::EscapeDirection_HORIZONTAL },
126  { XML_VERTICAL, drawing::EscapeDirection_VERTICAL },
127  { XML_TOKEN_INVALID, drawing::EscapeDirection(0) }
128 };
129 
130 static bool ImpIsEmptyURL( std::u16string_view rURL )
131 {
132  if( rURL.empty() )
133  return true;
134 
135  // #i13140# Also compare against 'toplevel' URLs. which also
136  // result in empty filename strings.
137  if( rURL == u"#./" )
138  return true;
139 
140  return false;
141 }
142 
143 
145  SvXMLImport& rImport,
146  const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
147  uno::Reference< drawing::XShapes > const & rShapes,
148  bool bTemporaryShape)
149  : SvXMLShapeContext( rImport, bTemporaryShape )
150  , mxShapes( rShapes )
151  , mxAttrList(xAttrList)
152  , mbListContextPushed( false )
153  , mnStyleFamily(XmlStyleFamily::SD_GRAPHICS_ID)
154  , mbIsPlaceholder(false)
155  , mbClearDefaultAttributes( true )
156  , mbIsUserTransformed(false)
157  , mnZOrder(-1)
158  , maSize(1, 1)
159  , mnRelWidth(0)
160  , mnRelHeight(0)
161  , maPosition(0, 0)
162  , mbVisible(true)
163  , mbPrintable(true)
164  , mbHaveXmlId(false)
165  , mbTextBox(false)
166 {
167 }
168 
170 {
171 }
172 
173 css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLShapeContext::createFastChildContext(
174  sal_Int32 nElement,
175  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
176 {
177  SvXMLImportContextRef xContext;
178  // #i68101#
179  if( nElement == XML_ELEMENT(SVG, XML_TITLE) || nElement == XML_ELEMENT(SVG, XML_DESC)
180  || nElement == XML_ELEMENT(SVG_COMPAT, XML_TITLE) || nElement == XML_ELEMENT(SVG_COMPAT, XML_DESC) )
181  {
182  xContext = new SdXMLDescriptionContext( GetImport(), nElement, mxShape );
183  }
184  else if( nElement == XML_ELEMENT(LO_EXT, XML_SIGNATURELINE) )
185  {
186  xContext = new SignatureLineContext( GetImport(), nElement, xAttrList, mxShape );
187  }
188  else if( nElement == XML_ELEMENT(LO_EXT, XML_QRCODE) )
189  {
190  xContext = new QRCodeContext( GetImport(), nElement, xAttrList, mxShape );
191  }
192  else if( nElement == XML_ELEMENT(OFFICE, XML_EVENT_LISTENERS) )
193  {
194  xContext = new SdXMLEventsContext( GetImport(), mxShape );
195  }
196  else if( nElement == XML_ELEMENT(DRAW, XML_GLUE_POINT) )
197  {
198  addGluePoint( xAttrList );
199  }
200  else if( nElement == XML_ELEMENT(DRAW, XML_THUMBNAIL) )
201  {
202  // search attributes for xlink:href
203  maThumbnailURL = xAttrList->getOptionalValue(XML_ELEMENT(XLINK, XML_HREF));
204  }
205  else
206  {
207  // create text cursor on demand
208  if( !mxCursor.is() )
209  {
210  uno::Reference< text::XText > xText( mxShape, uno::UNO_QUERY );
211  if( xText.is() )
212  {
215  mxOldCursor = xTxtImport->GetCursor();
216  mxCursor = xText->createTextCursor();
217  if( mxCursor.is() )
218  {
219  xTxtImport->SetCursor( mxCursor );
220  }
221 
222  // remember old list item and block (#91964#) and reset them
223  // for the text frame
224  xTxtImport->PushListContext();
225  mbListContextPushed = true;
226  }
227  }
228 
229  // if we have a text cursor, lets try to import some text
230  if( mxCursor.is() )
231  {
232  xContext = GetImport().GetTextImport()->CreateTextChildContext(
233  GetImport(), nElement, xAttrList,
235  }
236  }
237 
238  if (!xContext)
239  XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement);
240 
241  return xContext;
242 }
243 
244 void SdXMLShapeContext::addGluePoint( const uno::Reference< xml::sax::XFastAttributeList>& xAttrList )
245 {
246  // get the gluepoints container for this shape if it's not already there
247  if( !mxGluePoints.is() )
248  {
249  uno::Reference< drawing::XGluePointsSupplier > xSupplier( mxShape, uno::UNO_QUERY );
250  if( !xSupplier.is() )
251  return;
252 
253  mxGluePoints.set( xSupplier->getGluePoints(), UNO_QUERY );
254 
255  if( !mxGluePoints.is() )
256  return;
257  }
258 
259  drawing::GluePoint2 aGluePoint;
260  aGluePoint.IsUserDefined = true;
261  aGluePoint.Position.X = 0;
262  aGluePoint.Position.Y = 0;
263  aGluePoint.Escape = drawing::EscapeDirection_SMART;
264  aGluePoint.PositionAlignment = drawing::Alignment_CENTER;
265  aGluePoint.IsRelative = true;
266 
267  sal_Int32 nId = -1;
268 
269  // read attributes for the 3DScene
270  for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
271  {
272  switch(aIter.getToken())
273  {
274  case XML_ELEMENT(SVG, XML_X):
275  case XML_ELEMENT(SVG_COMPAT, XML_X):
277  aGluePoint.Position.X, aIter.toString());
278  break;
279  case XML_ELEMENT(SVG, XML_Y):
280  case XML_ELEMENT(SVG_COMPAT, XML_Y):
282  aGluePoint.Position.Y, aIter.toString());
283  break;
284  case XML_ELEMENT(DRAW, XML_ID):
285  nId = aIter.toInt32();
286  break;
287  case XML_ELEMENT(DRAW, XML_ALIGN):
288  {
289  drawing::Alignment eKind;
290  if( SvXMLUnitConverter::convertEnum( eKind, aIter.toView(), aXML_GlueAlignment_EnumMap ) )
291  {
292  aGluePoint.PositionAlignment = eKind;
293  aGluePoint.IsRelative = false;
294  }
295  break;
296  }
298  {
299  SvXMLUnitConverter::convertEnum( aGluePoint.Escape, aIter.toView(), aXML_GlueEscapeDirection_EnumMap );
300  break;
301  }
302  default:
303  XMLOFF_WARN_UNKNOWN("xmloff", aIter);
304  }
305  }
306 
307  if( nId != -1 )
308  {
309  try
310  {
311  sal_Int32 nInternalId = mxGluePoints->insert( uno::makeAny( aGluePoint ) );
312  GetImport().GetShapeImport()->addGluePointMapping( mxShape, nId, nInternalId );
313  }
314  catch(const uno::Exception&)
315  {
316  DBG_UNHANDLED_EXCEPTION( "xmloff", "during setting of gluepoints");
317  }
318  }
319 }
320 
321 void SdXMLShapeContext::startFastElement (sal_Int32 /*nElement*/,
322  const css::uno::Reference< css::xml::sax::XFastAttributeList >& /*xAttrList*/)
323 {
324  GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes );
325 }
326 
328 {
329  if(mxCursor.is())
330  {
331  // delete addition newline
332  mxCursor->gotoEnd( false );
333  mxCursor->goLeft( 1, true );
334  mxCursor->setString( "" );
335 
336  // reset cursor
337  GetImport().GetTextImport()->ResetCursor();
338  }
339 
340  if(mxOldCursor.is())
341  GetImport().GetTextImport()->SetCursor( mxOldCursor );
342 
343  // reinstall old list item (if necessary) #91964#
344  if (mbListContextPushed) {
345  GetImport().GetTextImport()->PopListContext();
346  }
347 
348  if( !msHyperlink.isEmpty() ) try
349  {
350  uno::Reference< beans::XPropertySet > xProp( mxShape, uno::UNO_QUERY );
351 
352  if ( xProp.is() && xProp->getPropertySetInfo()->hasPropertyByName( "Hyperlink" ) )
353  xProp->setPropertyValue( "Hyperlink", uno::Any( msHyperlink ) );
354  Reference< XEventsSupplier > xEventsSupplier( mxShape, UNO_QUERY );
355 
356  if( xEventsSupplier.is() )
357  {
358  Reference< XNameReplace > xEvents( xEventsSupplier->getEvents(), UNO_SET_THROW );
359 
360  uno::Sequence< beans::PropertyValue > aProperties{
361  { /* Name */ "EventType",
362  /* Handle */ -1,
363  /* Value */ uno::Any(OUString( "Presentation" )),
364  /* State */ beans::PropertyState_DIRECT_VALUE },
365 
366  { /* Name */ "ClickAction",
367  /* Handle */ -1,
368  /* Value */ uno::Any(css::presentation::ClickAction_DOCUMENT),
369  /* State */ beans::PropertyState_DIRECT_VALUE },
370 
371  { /* Name */ "Bookmark",
372  /* Handle */ -1,
373  /* Value */ uno::Any(msHyperlink),
374  /* State */ beans::PropertyState_DIRECT_VALUE }
375  };
376 
377  xEvents->replaceByName( "OnClick", Any( aProperties ) );
378  }
379  else
380  {
381  // in draw use the Bookmark property
382  Reference< beans::XPropertySet > xSet( mxShape, UNO_QUERY_THROW );
383  xSet->setPropertyValue( "Bookmark", Any( msHyperlink ) );
384  xSet->setPropertyValue("OnClick", Any( css::presentation::ClickAction_DOCUMENT ) );
385  }
386  }
387  catch(const Exception&)
388  {
389  DBG_UNHANDLED_EXCEPTION("xmloff", "while setting hyperlink");
390  }
391 
392  if( mxLockable.is() )
393  mxLockable->removeActionLock();
394 }
395 
396 void SdXMLShapeContext::AddShape(uno::Reference< drawing::XShape >& xShape)
397 {
398  if(xShape.is())
399  {
400  // set shape local
401  mxShape = xShape;
402 
403  if(!maShapeName.isEmpty())
404  {
405  uno::Reference< container::XNamed > xNamed( mxShape, uno::UNO_QUERY );
406  if( xNamed.is() )
407  xNamed->setName( maShapeName );
408  }
409 
410  rtl::Reference< XMLShapeImportHelper > xImp( GetImport().GetShapeImport() );
411  xImp->addShape( xShape, mxAttrList, mxShapes );
412 
414  {
415  uno::Reference<beans::XMultiPropertyStates> xMultiPropertyStates(xShape, uno::UNO_QUERY );
416  if (xMultiPropertyStates.is())
417  xMultiPropertyStates->setAllPropertiesToDefault();
418  }
419 
420  if( !mbVisible || !mbPrintable ) try
421  {
422  uno::Reference< beans::XPropertySet > xSet( xShape, uno::UNO_QUERY_THROW );
423  if( !mbVisible )
424  xSet->setPropertyValue("Visible", uno::Any( false ) );
425 
426  if( !mbPrintable )
427  xSet->setPropertyValue("Printable", uno::Any( false ) );
428  }
429  catch(const Exception&)
430  {
431  DBG_UNHANDLED_EXCEPTION( "xmloff", "while setting visible or printable" );
432  }
433 
434  if(!mbTemporaryShape && (!GetImport().HasTextImport()
435  || !GetImport().GetTextImport()->IsInsideDeleteContext()))
436  {
437  xImp->shapeWithZIndexAdded( xShape, mnZOrder );
438  }
439 
440  if (mnRelWidth || mnRelHeight)
441  {
442  uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY);
443  uno::Reference<beans::XPropertySetInfo> xPropertySetInfo = xPropertySet->getPropertySetInfo();
444  if (mnRelWidth && xPropertySetInfo->hasPropertyByName("RelativeWidth"))
445  xPropertySet->setPropertyValue("RelativeWidth", uno::makeAny(mnRelWidth));
446  if (mnRelHeight && xPropertySetInfo->hasPropertyByName("RelativeHeight"))
447  xPropertySet->setPropertyValue("RelativeHeight", uno::makeAny(mnRelHeight));
448  }
449 
450  if( !maShapeId.isEmpty() )
451  {
452  uno::Reference< uno::XInterface > xRef( static_cast<uno::XInterface *>(xShape.get()) );
454  }
455 
456  // #91065# count only if counting for shape import is enabled
457  if(GetImport().GetShapeImport()->IsHandleProgressBarEnabled())
458  {
459  // #80365# increment progress bar at load once for each draw object
461  }
462  }
463 
464  mxLockable.set( xShape, UNO_QUERY );
465 
466  if( mxLockable.is() )
467  mxLockable->addActionLock();
468 
469 }
470 
471 void SdXMLShapeContext::AddShape(OUString const & serviceName)
472 {
473  uno::Reference< lang::XMultiServiceFactory > xServiceFact(GetImport().GetModel(), uno::UNO_QUERY);
474  if(!xServiceFact.is())
475  return;
476 
477  try
478  {
479  /* Since fix for issue i33294 the Writer model doesn't support
480  com.sun.star.drawing.OLE2Shape anymore.
481  To handle Draw OLE objects it's decided to import these
482  objects as com.sun.star.drawing.OLE2Shape and convert these
483  objects after the import into com.sun.star.drawing.GraphicObjectShape.
484  */
485  uno::Reference< drawing::XShape > xShape;
486  if ( serviceName == "com.sun.star.drawing.OLE2Shape" &&
487  uno::Reference< text::XTextDocument >(GetImport().GetModel(), uno::UNO_QUERY).is() )
488  {
489  xShape.set(xServiceFact->createInstance("com.sun.star.drawing.temporaryForXMLImportOLE2Shape"), uno::UNO_QUERY);
490  }
491  else if (serviceName == "com.sun.star.drawing.GraphicObjectShape"
492  || serviceName == "com.sun.star.drawing.MediaShape"
493  || serviceName == "com.sun.star.presentation.MediaShape")
494  {
495  xShape.set( xServiceFact->createInstanceWithArguments(serviceName, { css::uno::Any(GetImport().GetDocumentBase()) }),
496  css::uno::UNO_QUERY);
497  }
498  else
499  {
500  xShape.set(xServiceFact->createInstance(serviceName), uno::UNO_QUERY);
501  }
502  if( xShape.is() )
503  AddShape( xShape );
504  }
505  catch(const uno::Exception& e)
506  {
507  uno::Sequence<OUString> aSeq { serviceName };
509  aSeq, e.Message, nullptr );
510  }
511 }
512 
514 {
515  if(!mxShape.is())
516  return;
517 
518  uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
519  if(!xPropSet.is())
520  return;
521 
523 
524  if(maSize.Width != 1 || maSize.Height != 1)
525  {
526  // take care there are no zeros used by error
527  if(0 == maSize.Width)
528  maSize.Width = 1;
529  if(0 == maSize.Height)
530  maSize.Height = 1;
531 
532  // set global size. This should always be used.
533  maUsedTransformation.scale(maSize.Width, maSize.Height);
534  }
535 
536  if(maPosition.X != 0 || maPosition.Y != 0)
537  {
538  // if global position is used, add it to transformation
540  }
541 
543  {
544  // transformation is used, apply to object.
545  // NOTICE: The transformation is applied AFTER evtl. used
546  // global positioning and scaling is used, so any shear or
547  // rotate used herein is applied around the (0,0) position
548  // of the PAGE object !!!
551 
552  // now add to transformation
553  maUsedTransformation *= aMat;
554  }
555 
556  // now set transformation for this object
557 
558  // maUsedTransformtion contains the mathematical correct matrix, which if
559  // applied to a unit square would generate the transformed shape. But the property
560  // "Transformation" contains a matrix, which can be used in TRSetBaseGeometry
561  // and would be created by TRGetBaseGeometry. And those use a mathematically wrong
562  // sign for the shearing angle. So we need to adapt the matrix here.
563  basegfx::B2DTuple aScale;
564  basegfx::B2DTuple aTranslate;
565  double fRotate;
566  double fShearX;
567  maUsedTransformation.decompose(aScale, aTranslate, fRotate, fShearX);
568  basegfx::B2DHomMatrix aB2DHomMatrix;
570  aScale,
571  basegfx::fTools::equalZero(fShearX) ? 0.0 : -fShearX,
572  basegfx::fTools::equalZero(fRotate) ? 0.0 : fRotate,
573  aTranslate);
574  drawing::HomogenMatrix3 aUnoMatrix;
575 
576  aUnoMatrix.Line1.Column1 = aB2DHomMatrix.get(0, 0);
577  aUnoMatrix.Line1.Column2 = aB2DHomMatrix.get(0, 1);
578  aUnoMatrix.Line1.Column3 = aB2DHomMatrix.get(0, 2);
579 
580  aUnoMatrix.Line2.Column1 = aB2DHomMatrix.get(1, 0);
581  aUnoMatrix.Line2.Column2 = aB2DHomMatrix.get(1, 1);
582  aUnoMatrix.Line2.Column3 = aB2DHomMatrix.get(1, 2);
583 
584  aUnoMatrix.Line3.Column1 = aB2DHomMatrix.get(2, 0);
585  aUnoMatrix.Line3.Column2 = aB2DHomMatrix.get(2, 1);
586  aUnoMatrix.Line3.Column3 = aB2DHomMatrix.get(2, 2);
587 
588  xPropSet->setPropertyValue("Transformation", Any(aUnoMatrix));
589 }
590 
591 void SdXMLShapeContext::SetStyle( bool bSupportsStyle /* = true */)
592 {
593  try
594  {
595  uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
596  if( !xPropSet.is() )
597  return;
598 
599  do
600  {
601  // set style on shape
602  if(maDrawStyleName.isEmpty())
603  break;
604 
605  const SvXMLStyleContext* pStyle = nullptr;
606  bool bAutoStyle(false);
607 
608  if(GetImport().GetShapeImport()->GetAutoStylesContext())
609  pStyle = GetImport().GetShapeImport()->GetAutoStylesContext()->FindStyleChildContext(mnStyleFamily, maDrawStyleName);
610 
611  if(pStyle)
612  bAutoStyle = true;
613 
614  if(!pStyle && GetImport().GetShapeImport()->GetStylesContext())
615  pStyle = GetImport().GetShapeImport()->GetStylesContext()->FindStyleChildContext(mnStyleFamily, maDrawStyleName);
616 
617  OUString aStyleName = maDrawStyleName;
618  uno::Reference< style::XStyle > xStyle;
619 
620  XMLPropStyleContext* pDocStyle
621  = dynamic_cast<XMLShapeStyleContext*>(const_cast<SvXMLStyleContext*>(pStyle));
622  if (pDocStyle)
623  {
624  if( pDocStyle->GetStyle().is() )
625  {
626  xStyle = pDocStyle->GetStyle();
627  }
628  else
629  {
630  aStyleName = pDocStyle->GetParentName();
631  }
632  }
633 
634  if( !xStyle.is() && !aStyleName.isEmpty() )
635  {
636  try
637  {
638 
639  uno::Reference< style::XStyleFamiliesSupplier > xFamiliesSupplier( GetImport().GetModel(), uno::UNO_QUERY );
640 
641  if( xFamiliesSupplier.is() )
642  {
643  uno::Reference< container::XNameAccess > xFamilies( xFamiliesSupplier->getStyleFamilies() );
644  if( xFamilies.is() )
645  {
646 
647  uno::Reference< container::XNameAccess > xFamily;
648 
650  {
651  aStyleName = GetImport().GetStyleDisplayName(
653  aStyleName );
654  sal_Int32 nPos = aStyleName.lastIndexOf( '-' );
655  if( -1 != nPos )
656  {
657  OUString aFamily( aStyleName.copy( 0, nPos ) );
658 
659  xFamilies->getByName( aFamily ) >>= xFamily;
660  aStyleName = aStyleName.copy( nPos + 1 );
661  }
662  }
663  else
664  {
665  // get graphics family
666  xFamilies->getByName("graphics") >>= xFamily;
667  aStyleName = GetImport().GetStyleDisplayName(
669  aStyleName );
670  }
671 
672  if( xFamily.is() )
673  xFamily->getByName( aStyleName ) >>= xStyle;
674  }
675  }
676  }
677  catch(const uno::Exception&)
678  {
679  DBG_UNHANDLED_EXCEPTION( "xmloff", "finding style for shape" );
680  }
681  }
682 
683  if( bSupportsStyle && xStyle.is() )
684  {
685  try
686  {
687  // set style on object
688  xPropSet->setPropertyValue("Style", Any(xStyle));
689  }
690  catch(const uno::Exception&)
691  {
692  DBG_UNHANDLED_EXCEPTION( "xmloff", "setting style for shape" );
693  }
694  }
695 
696  // Writer shapes: if this one has a TextBox, set it here. We need to do it before
697  // pDocStyle->FillPropertySet, because setting some properties depend on the format
698  // having RES_CNTNT attribute (e.g., UNO_NAME_TEXT_(LEFT|RIGHT|UPPER|LOWER)DIST; see
699  // SwTextBoxHelper::syncProperty, which indirectly calls SwTextBoxHelper::isTextBox)
700  uno::Reference<beans::XPropertySetInfo> xPropertySetInfo
701  = xPropSet->getPropertySetInfo();
702  if (xPropertySetInfo->hasPropertyByName("TextBox"))
703  xPropSet->setPropertyValue("TextBox", uno::makeAny(mbTextBox));
704 
705  // if this is an auto style, set its properties
706  if(bAutoStyle && pDocStyle)
707  {
708  // set PropertySet on object
709  pDocStyle->FillPropertySet(xPropSet);
710  }
711 
712  } while(false);
713 
714  // try to set text auto style
715  do
716  {
717  // set style on shape
718  if( maTextStyleName.isEmpty() )
719  break;
720 
721  if( nullptr == GetImport().GetShapeImport()->GetAutoStylesContext())
722  break;
723 
724  const SvXMLStyleContext* pTempStyle = GetImport().GetShapeImport()->GetAutoStylesContext()->FindStyleChildContext(XmlStyleFamily::TEXT_PARAGRAPH, maTextStyleName);
725  XMLPropStyleContext* pStyle = const_cast<XMLPropStyleContext*>(dynamic_cast<const XMLPropStyleContext*>( pTempStyle ) ); // use temp var, PTR_CAST is a bad macro, FindStyleChildContext will be called twice
726  if( pStyle == nullptr )
727  break;
728 
729  // set PropertySet on object
730  pStyle->FillPropertySet(xPropSet);
731 
732  } while(false);
733  }
734  catch(const uno::Exception&)
735  {
736  }
737 }
738 
740 {
741  if( maLayerName.isEmpty() )
742  return;
743 
744  try
745  {
746  uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
747  if(xPropSet.is() )
748  {
749  xPropSet->setPropertyValue("LayerName", Any(maLayerName));
750  return;
751  }
752  }
753  catch(const uno::Exception&)
754  {
755  }
756 }
757 
759 {
760  if( maThumbnailURL.isEmpty() )
761  return;
762 
763  try
764  {
765  uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
766  if( !xPropSet.is() )
767  return;
768 
769  uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
770  if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName( "ThumbnailGraphic" ) )
771  {
772  // load the thumbnail graphic and export it to a wmf stream so we can set
773  // it at the api
774 
775  uno::Reference<graphic::XGraphic> xGraphic = GetImport().loadGraphicByURL(maThumbnailURL);
776  xPropSet->setPropertyValue("ThumbnailGraphic", uno::makeAny(xGraphic));
777  }
778  }
779  catch(const uno::Exception&)
780  {
781  }
782 }
783 
784 // this is called from the parent group for each unparsed attribute in the attribute list
786 {
787  sal_Int32 nTmp;
788  switch (aIter.getToken())
789  {
790  case XML_ELEMENT(DRAW, XML_ZINDEX):
791  case XML_ELEMENT(DRAW_EXT, XML_ZINDEX):
792  mnZOrder = aIter.toInt32();
793  break;
794  case XML_ELEMENT(DRAW, XML_ID):
795  case XML_ELEMENT(DRAW_EXT, XML_ID):
796  if (!mbHaveXmlId) { maShapeId = aIter.toString(); }
797  break;
798  case XML_ELEMENT(DRAW, XML_NAME):
799  case XML_ELEMENT(DRAW_EXT, XML_NAME):
800  maShapeName = aIter.toString();
801  break;
803  case XML_ELEMENT(DRAW_EXT, XML_STYLE_NAME):
804  maDrawStyleName = aIter.toString();
805  break;
807  case XML_ELEMENT(DRAW_EXT, XML_TEXT_STYLE_NAME):
808  maTextStyleName = aIter.toString();
809  break;
810  case XML_ELEMENT(DRAW, XML_LAYER):
811  case XML_ELEMENT(DRAW_EXT, XML_LAYER):
812  maLayerName = aIter.toString();
813  break;
815  case XML_ELEMENT(DRAW_EXT, XML_TRANSFORM):
817  break;
819  case XML_ELEMENT(DRAW_EXT, XML_DISPLAY):
820  mbVisible = IsXMLToken( aIter, XML_ALWAYS ) || IsXMLToken( aIter, XML_SCREEN );
821  mbPrintable = IsXMLToken( aIter, XML_ALWAYS ) || IsXMLToken( aIter, XML_PRINTER );
822  break;
823  case XML_ELEMENT(PRESENTATION, XML_USER_TRANSFORMED):
825  break;
826  case XML_ELEMENT(PRESENTATION, XML_PLACEHOLDER):
827  mbIsPlaceholder = IsXMLToken( aIter, XML_TRUE );
828  if( mbIsPlaceholder )
829  mbClearDefaultAttributes = false;
830  break;
831  case XML_ELEMENT(PRESENTATION, XML_CLASS):
832  maPresentationClass = aIter.toString();
833  break;
834  case XML_ELEMENT(PRESENTATION, XML_STYLE_NAME):
835  maDrawStyleName = aIter.toString();
837  break;
838  case XML_ELEMENT(SVG, XML_X):
839  case XML_ELEMENT(SVG_COMPAT, XML_X):
841  maPosition.X, aIter.toView());
842  break;
843  case XML_ELEMENT(SVG, XML_Y):
844  case XML_ELEMENT(SVG_COMPAT, XML_Y):
846  maPosition.Y, aIter.toView());
847  break;
848  case XML_ELEMENT(SVG, XML_WIDTH):
849  case XML_ELEMENT(SVG_COMPAT, XML_WIDTH):
851  maSize.Width, aIter.toView());
852  if (maSize.Width > 0)
853  maSize.Width = o3tl::saturating_add<sal_Int32>(maSize.Width, 1);
854  else if (maSize.Width < 0)
855  maSize.Width = o3tl::saturating_add<sal_Int32>(maSize.Width, -1);
856  break;
857  case XML_ELEMENT(SVG, XML_HEIGHT):
858  case XML_ELEMENT(SVG_COMPAT, XML_HEIGHT):
860  maSize.Height, aIter.toView());
861  if (maSize.Height > 0)
862  maSize.Height = o3tl::saturating_add<sal_Int32>(maSize.Height, 1);
863  else if (maSize.Height < 0)
864  maSize.Height = o3tl::saturating_add<sal_Int32>(maSize.Height, -1);
865  break;
867  case XML_ELEMENT(SVG_COMPAT, XML_TRANSFORM):
868  // because of #85127# take svg:transform into account and handle like
869  // draw:transform for compatibility
871  break;
873  if (sax::Converter::convertPercent(nTmp, aIter.toView()))
874  mnRelWidth = static_cast<sal_Int16>(nTmp);
875  break;
877  if (sax::Converter::convertPercent(nTmp, aIter.toView()))
878  mnRelHeight = static_cast<sal_Int16>(nTmp);
879  break;
880  case XML_ELEMENT(NONE, XML_ID):
881  case XML_ELEMENT(XML, XML_ID):
882  maShapeId = aIter.toString();
883  mbHaveXmlId = true;
884  break;
885  default:
886  return false;
887  }
888  return true;
889 }
890 
892 {
893  if( !maPresentationClass.isEmpty() && const_cast<SdXMLShapeContext*>(this)->GetImport().GetShapeImport()->IsPresentationShapesSupported() )
894  {
896  {
897  return true;
898  }
899 
902  {
903  return true;
904  }
905  }
906 
907  return false;
908 }
909 
911  SvXMLImport& rImport,
912  const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
913  uno::Reference< drawing::XShapes > const & rShapes,
914  bool bTemporaryShape)
915 : SdXMLShapeContext( rImport, xAttrList, rShapes, bTemporaryShape ),
916  mnRadius( 0 )
917 {
918 }
919 
921 {
922 }
923 
924 // this is called from the parent group for each unparsed attribute in the attribute list
926 {
927  switch (aIter.getToken())
928  {
931  mnRadius, aIter.toView());
932  break;
933  default:
934  return SdXMLShapeContext::processAttribute( aIter );
935  }
936  return true;
937 }
938 
940  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList)
941 {
942  // create rectangle shape
943  AddShape("com.sun.star.drawing.RectangleShape");
944  if(!mxShape.is())
945  return;
946 
947  // Add, set Style and properties from base shape
948  SetStyle();
949  SetLayer();
950 
951  // set pos, size, shear and rotate
953 
954  if(mnRadius)
955  {
956  uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
957  if(xPropSet.is())
958  {
959  try
960  {
961  xPropSet->setPropertyValue("CornerRadius", uno::makeAny( mnRadius ) );
962  }
963  catch(const uno::Exception&)
964  {
965  DBG_UNHANDLED_EXCEPTION( "xmloff", "setting corner radius");
966  }
967  }
968  }
969  SdXMLShapeContext::startFastElement(nElement, xAttrList);
970 }
971 
972 
974  SvXMLImport& rImport,
975  const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
976  uno::Reference< drawing::XShapes > const & rShapes,
977  bool bTemporaryShape)
978 : SdXMLShapeContext( rImport, xAttrList, rShapes, bTemporaryShape ),
979  mnX1( 0 ),
980  mnY1( 0 ),
981  mnX2( 1 ),
982  mnY2( 1 )
983 {
984 }
985 
987 {
988 }
989 
990 // this is called from the parent group for each unparsed attribute in the attribute list
992 {
993  switch (aIter.getToken())
994  {
995  case XML_ELEMENT(SVG, XML_X1):
996  case XML_ELEMENT(SVG_COMPAT, XML_X1):
998  mnX1, aIter.toView());
999  break;
1000  case XML_ELEMENT(SVG, XML_Y1):
1001  case XML_ELEMENT(SVG_COMPAT, XML_Y1):
1003  mnY1, aIter.toView());
1004  break;
1005  case XML_ELEMENT(SVG, XML_X2):
1006  case XML_ELEMENT(SVG_COMPAT, XML_X2):
1008  mnX2, aIter.toView());
1009  break;
1010  case XML_ELEMENT(SVG, XML_Y2):
1011  case XML_ELEMENT(SVG_COMPAT, XML_Y2):
1013  mnY2, aIter.toView());
1014  break;
1015  default:
1016  return SdXMLShapeContext::processAttribute( aIter );
1017  }
1018  return true;
1019 }
1020 
1022  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList)
1023 {
1024  // #85920# use SetTransformation() to handle import of simple lines.
1025  // This is necessary to take into account all anchor positions and
1026  // other things. All shape imports use the same import schemata now.
1027  // create necessary shape (Line Shape)
1028  AddShape("com.sun.star.drawing.PolyLineShape");
1029 
1030  if(!mxShape.is())
1031  return;
1032 
1033  // Add, set Style and properties from base shape
1034  SetStyle();
1035  SetLayer();
1036 
1037  // get sizes and offsets
1038  awt::Point aTopLeft(mnX1, mnY1);
1039  awt::Point aBottomRight(mnX2, mnY2);
1040 
1041  if(mnX1 > mnX2)
1042  {
1043  aTopLeft.X = mnX2;
1044  aBottomRight.X = mnX1;
1045  }
1046 
1047  if(mnY1 > mnY2)
1048  {
1049  aTopLeft.Y = mnY2;
1050  aBottomRight.Y = mnY1;
1051  }
1052 
1053  // set local parameters on shape
1054  uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
1055  if(xPropSet.is())
1056  {
1057  drawing::PointSequenceSequence aPolyPoly(1);
1058  drawing::PointSequence* pOuterSequence = aPolyPoly.getArray();
1059  pOuterSequence->realloc(2);
1060  awt::Point* pInnerSequence = pOuterSequence->getArray();
1061 
1062  *pInnerSequence = awt::Point(o3tl::saturating_sub(mnX1, aTopLeft.X), o3tl::saturating_sub(mnY1, aTopLeft.Y));
1063  pInnerSequence++;
1064  *pInnerSequence = awt::Point(o3tl::saturating_sub(mnX2, aTopLeft.X), o3tl::saturating_sub(mnY2, aTopLeft.Y));
1065 
1066  xPropSet->setPropertyValue("Geometry", Any(aPolyPoly));
1067  }
1068 
1069  // Size is included in point coordinates
1070  maSize.Width = 1;
1071  maSize.Height = 1;
1072  maPosition.X = aTopLeft.X;
1073  maPosition.Y = aTopLeft.Y;
1074 
1075  // set pos, size, shear and rotate and get copy of matrix
1077 
1078  SdXMLShapeContext::startFastElement(nElement, xAttrList);
1079 }
1080 
1081 
1083  SvXMLImport& rImport,
1084  const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
1085  uno::Reference< drawing::XShapes > const & rShapes,
1086  bool bTemporaryShape)
1087 : SdXMLShapeContext( rImport, xAttrList, rShapes, bTemporaryShape ),
1088  mnCX( 0 ),
1089  mnCY( 0 ),
1090  mnRX( 1 ),
1091  mnRY( 1 ),
1092  meKind( drawing::CircleKind_FULL ),
1093  mnStartAngle( 0 ),
1094  mnEndAngle( 0 )
1095 {
1096 }
1097 
1099 {
1100 }
1101 
1102 // this is called from the parent group for each unparsed attribute in the attribute list
1104 {
1105  switch (aIter.getToken())
1106  {
1107  case XML_ELEMENT(SVG, XML_RX):
1108  case XML_ELEMENT(SVG_COMPAT, XML_RX):
1110  mnRX, aIter.toView());
1111  break;
1112  case XML_ELEMENT(SVG, XML_RY):
1113  case XML_ELEMENT(SVG_COMPAT, XML_RY):
1115  mnRY, aIter.toView());
1116  break;
1117  case XML_ELEMENT(SVG, XML_CX):
1118  case XML_ELEMENT(SVG_COMPAT, XML_CX):
1120  mnCX, aIter.toView());
1121  break;
1122  case XML_ELEMENT(SVG, XML_CY):
1123  case XML_ELEMENT(SVG_COMPAT, XML_CY):
1125  mnCY, aIter.toView());
1126  break;
1127  case XML_ELEMENT(SVG, XML_R):
1128  case XML_ELEMENT(SVG_COMPAT, XML_R):
1129  // single radius, it's a circle and both radii are the same
1131  mnRX, aIter.toView());
1132  mnRY = mnRX;
1133  break;
1134  case XML_ELEMENT(DRAW, XML_KIND):
1136  break;
1138  {
1139  double dStartAngle;
1140  if (::sax::Converter::convertDouble( dStartAngle, aIter.toView() ))
1141  mnStartAngle = static_cast<sal_Int32>(dStartAngle * 100.0);
1142  break;
1143  }
1145  {
1146  double dEndAngle;
1147  if (::sax::Converter::convertDouble( dEndAngle, aIter.toView() ))
1148  mnEndAngle = static_cast<sal_Int32>(dEndAngle * 100.0);
1149  break;
1150  }
1151  default:
1152  return SdXMLShapeContext::processAttribute( aIter );
1153  }
1154  return true;
1155 }
1156 
1158  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList)
1159 {
1160  // create rectangle shape
1161  AddShape("com.sun.star.drawing.EllipseShape");
1162  if(!mxShape.is())
1163  return;
1164 
1165  // Add, set Style and properties from base shape
1166  SetStyle();
1167  SetLayer();
1168 
1169  if(mnCX != 0 || mnCY != 0 || mnRX != 1 || mnRY != 1)
1170  {
1171  // #i121972# center/radius is used, put to pos and size
1172  maSize.Width = 2 * mnRX;
1173  maSize.Height = 2 * mnRY;
1174  maPosition.X = mnCX - mnRX;
1175  maPosition.Y = mnCY - mnRY;
1176  }
1177  // set pos, size, shear and rotate
1179 
1180  if( meKind != drawing::CircleKind_FULL )
1181  {
1182  uno::Reference< beans::XPropertySet > xPropSet( mxShape, uno::UNO_QUERY );
1183  if( xPropSet.is() )
1184  {
1185  // calculate the correct start and end angle
1186  sal_Int32 mnOldStartAngle = mnStartAngle;
1187  sal_Int32 mnOldEndAngle = mnEndAngle;
1188  basegfx::B2DTuple aScale;
1189  basegfx::B2DTuple aTranslate;
1190  double fRotate;
1191  double fShearX;
1192  maUsedTransformation.decompose(aScale, aTranslate, fRotate, fShearX);
1193  if (aScale.getX() < 0 || aScale.getY() < 0)
1194  {
1195  // The angle for a horizontal flip is the same as the angle for a
1196  // vertical flip because a vertical flip is treated as a horizontal
1197  // flip plus a rotation.
1198 
1199  // To perform the flip, the start and end angle are switched and we
1200  // use the fact performing a horizontal flip on a shape will change
1201  // the angle that a radius makes with the origin to 180 degrees
1202  // minus that angle (we use 54000 hundredths of a degree to get the
1203  // modulus operation to give a value between 0 and 36000).
1204 
1205  mnStartAngle = (54000 - mnOldEndAngle) % 36000;
1206  mnEndAngle = (54000 - mnOldStartAngle) % 36000;
1207  }
1208 
1209  xPropSet->setPropertyValue("CircleKind", Any( meKind) );
1210  xPropSet->setPropertyValue("CircleStartAngle", Any(mnStartAngle) );
1211  xPropSet->setPropertyValue("CircleEndAngle", Any(mnEndAngle) );
1212  }
1213  }
1214 
1215  SdXMLShapeContext::startFastElement(nElement, xAttrList);
1216 }
1217 
1218 
1220  SvXMLImport& rImport,
1221  const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
1222  uno::Reference< drawing::XShapes > const & rShapes, bool bClosed, bool bTemporaryShape)
1223 : SdXMLShapeContext( rImport, xAttrList, rShapes, bTemporaryShape ),
1224  mbClosed( bClosed )
1225 {
1226 }
1227 
1228 // this is called from the parent group for each unparsed attribute in the attribute list
1230 {
1231  switch (aIter.getToken())
1232  {
1233  case XML_ELEMENT(SVG, XML_VIEWBOX):
1234  case XML_ELEMENT(SVG_COMPAT, XML_VIEWBOX):
1235  maViewBox = aIter.toString();
1236  break;
1237  case XML_ELEMENT(DRAW, XML_POINTS):
1238  maPoints = aIter.toString();
1239  break;
1240  default:
1241  return SdXMLShapeContext::processAttribute( aIter);
1242  }
1243  return true;
1244 }
1245 
1247 {
1248 }
1249 
1251  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList)
1252 {
1253  // Add, set Style and properties from base shape
1254  if(mbClosed)
1255  AddShape("com.sun.star.drawing.PolyPolygonShape");
1256  else
1257  AddShape("com.sun.star.drawing.PolyLineShape");
1258 
1259  if( !mxShape.is() )
1260  return;
1261 
1262  SetStyle();
1263  SetLayer();
1264 
1265  // set local parameters on shape
1266  uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
1267  if(xPropSet.is())
1268  {
1269  // set polygon
1270  if(!maPoints.isEmpty() && !maViewBox.isEmpty())
1271  {
1272  const SdXMLImExViewBox aViewBox(maViewBox, GetImport().GetMM100UnitConverter());
1273  basegfx::B2DVector aSize(aViewBox.GetWidth(), aViewBox.GetHeight());
1274 
1275  // Is this correct? It overrides ViewBox stuff; OTOH it makes no
1276  // sense to have the geometry content size different from object size
1277  if(maSize.Width != 0 && maSize.Height != 0)
1278  {
1279  aSize = basegfx::B2DVector(maSize.Width, maSize.Height);
1280  }
1281 
1282  basegfx::B2DPolygon aPolygon;
1283 
1285  {
1286  if(aPolygon.count())
1287  {
1288  const basegfx::B2DRange aSourceRange(
1289  aViewBox.GetX(), aViewBox.GetY(),
1290  aViewBox.GetX() + aViewBox.GetWidth(), aViewBox.GetY() + aViewBox.GetHeight());
1291  const basegfx::B2DRange aTargetRange(
1292  aViewBox.GetX(), aViewBox.GetY(),
1293  aViewBox.GetX() + aSize.getX(), aViewBox.GetY() + aSize.getY());
1294 
1295  if(!aSourceRange.equal(aTargetRange))
1296  {
1297  aPolygon.transform(
1299  aSourceRange,
1300  aTargetRange));
1301  }
1302 
1303  css::drawing::PointSequenceSequence aPointSequenceSequence;
1305  xPropSet->setPropertyValue("Geometry", Any(aPointSequenceSequence));
1306  // Size is now contained in the point coordinates, adapt maSize for
1307  // to use the correct transformation matrix in SetTransformation()
1308  maSize.Width = 1;
1309  maSize.Height = 1;
1310  }
1311  }
1312  }
1313  }
1314 
1315  // set pos, size, shear and rotate and get copy of matrix
1317 
1318  SdXMLShapeContext::startFastElement(nElement, xAttrList);
1319 }
1320 
1321 
1323  SvXMLImport& rImport,
1324  const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
1325  uno::Reference< drawing::XShapes > const & rShapes,
1326  bool bTemporaryShape)
1327 : SdXMLShapeContext( rImport, xAttrList, rShapes, bTemporaryShape )
1328 {
1329 }
1330 
1332 {
1333 }
1334 
1335 // this is called from the parent group for each unparsed attribute in the attribute list
1337 {
1338  switch (aIter.getToken())
1339  {
1340  case XML_ELEMENT(SVG, XML_VIEWBOX):
1341  case XML_ELEMENT(SVG_COMPAT, XML_VIEWBOX):
1342  maViewBox = aIter.toString();
1343  break;
1344  case XML_ELEMENT(SVG, XML_D):
1345  case XML_ELEMENT(SVG_COMPAT, XML_D):
1346  maD = aIter.toString();
1347  break;
1348  default:
1349  return SdXMLShapeContext::processAttribute( aIter );
1350  }
1351  return true;
1352 }
1353 
1355  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList)
1356 {
1357  // create polygon shape
1358  if(maD.isEmpty())
1359  return;
1360 
1361  const SdXMLImExViewBox aViewBox(maViewBox, GetImport().GetMM100UnitConverter());
1362  basegfx::B2DVector aSize(aViewBox.GetWidth(), aViewBox.GetHeight());
1363 
1364  // Is this correct? It overrides ViewBox stuff; OTOH it makes no
1365  // sense to have the geometry content size different from object size
1366  if(maSize.Width != 0 && maSize.Height != 0)
1367  {
1368  aSize = basegfx::B2DVector(maSize.Width, maSize.Height);
1369  }
1370 
1371  basegfx::B2DPolyPolygon aPolyPolygon;
1372 
1373  if(!basegfx::utils::importFromSvgD(aPolyPolygon, maD, GetImport().needFixPositionAfterZ(), nullptr))
1374  return;
1375 
1376  if(!aPolyPolygon.count())
1377  return;
1378 
1379  const basegfx::B2DRange aSourceRange(
1380  aViewBox.GetX(), aViewBox.GetY(),
1381  aViewBox.GetX() + aViewBox.GetWidth(), aViewBox.GetY() + aViewBox.GetHeight());
1382  const basegfx::B2DRange aTargetRange(
1383  aViewBox.GetX(), aViewBox.GetY(),
1384  aViewBox.GetX() + aSize.getX(), aViewBox.GetY() + aSize.getY());
1385 
1386  if(!aSourceRange.equal(aTargetRange))
1387  {
1388  aPolyPolygon.transform(
1390  aSourceRange,
1391  aTargetRange));
1392  }
1393 
1394  // create shape
1395  OUString service;
1396 
1397  if(aPolyPolygon.areControlPointsUsed())
1398  {
1399  if(aPolyPolygon.isClosed())
1400  {
1401  service = "com.sun.star.drawing.ClosedBezierShape";
1402  }
1403  else
1404  {
1405  service = "com.sun.star.drawing.OpenBezierShape";
1406  }
1407  }
1408  else
1409  {
1410  if(aPolyPolygon.isClosed())
1411  {
1412  service = "com.sun.star.drawing.PolyPolygonShape";
1413  }
1414  else
1415  {
1416  service = "com.sun.star.drawing.PolyLineShape";
1417  }
1418  }
1419 
1420  // Add, set Style and properties from base shape
1421  AddShape(service);
1422 
1423  // #89344# test for mxShape.is() and not for mxShapes.is() to support
1424  // shape import helper classes WITHOUT XShapes (member mxShapes). This
1425  // is used by the writer.
1426  if( !mxShape.is() )
1427  return;
1428 
1429  SetStyle();
1430  SetLayer();
1431 
1432  // set local parameters on shape
1433  uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
1434 
1435  if(xPropSet.is())
1436  {
1437  uno::Any aAny;
1438 
1439  // set polygon data
1440  if(aPolyPolygon.areControlPointsUsed())
1441  {
1442  drawing::PolyPolygonBezierCoords aSourcePolyPolygon;
1443 
1445  aPolyPolygon,
1446  aSourcePolyPolygon);
1447  aAny <<= aSourcePolyPolygon;
1448  }
1449  else
1450  {
1451  drawing::PointSequenceSequence aSourcePolyPolygon;
1452 
1454  aPolyPolygon,
1455  aSourcePolyPolygon);
1456  aAny <<= aSourcePolyPolygon;
1457  }
1458 
1459  xPropSet->setPropertyValue("Geometry", aAny);
1460  // Size is now contained in the point coordinates, adapt maSize for
1461  // to use the correct transformation matrix in SetTransformation()
1462  maSize.Width = 1;
1463  maSize.Height = 1;
1464  }
1465 
1466  // set pos, size, shear and rotate
1468 
1469  SdXMLShapeContext::startFastElement(nElement, xAttrList);
1470 }
1471 
1472 
1474  SvXMLImport& rImport,
1475  const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
1476  uno::Reference< drawing::XShapes > const & rShapes)
1477 : SdXMLShapeContext( rImport, xAttrList, rShapes, false/*bTemporaryShape*/ ),
1478  mnRadius(0),
1479  maChainNextName("")
1480 {
1481 }
1482 
1484 {
1485 }
1486 
1487 // this is called from the parent group for each unparsed attribute in the attribute list
1489 {
1490  switch (aIter.getToken())
1491  {
1494  mnRadius, aIter.toView());
1495  break;
1497  maChainNextName = aIter.toString();
1498  break;
1499  default:
1500  return SdXMLShapeContext::processAttribute( aIter );
1501  }
1502  return true;
1503 }
1504 
1506  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList)
1507 {
1508  // create textbox shape
1509  bool bIsPresShape = false;
1510  bool bClearText = false;
1511 
1512  OUString service;
1513 
1514  if( isPresentationShape() )
1515  {
1516  // check if the current document supports presentation shapes
1517  if( GetImport().GetShapeImport()->IsPresentationShapesSupported() )
1518  {
1520  {
1521  // XmlShapeTypePresSubtitleShape
1522  service = "com.sun.star.presentation.SubtitleShape";
1523  }
1525  {
1526  // XmlShapeTypePresOutlinerShape
1527  service = "com.sun.star.presentation.OutlinerShape";
1528  }
1530  {
1531  // XmlShapeTypePresNotesShape
1532  service = "com.sun.star.presentation.NotesShape";
1533  }
1535  {
1536  // XmlShapeTypePresHeaderShape
1537  service = "com.sun.star.presentation.HeaderShape";
1538  bClearText = true;
1539  }
1541  {
1542  // XmlShapeTypePresFooterShape
1543  service = "com.sun.star.presentation.FooterShape";
1544  bClearText = true;
1545  }
1547  {
1548  // XmlShapeTypePresSlideNumberShape
1549  service = "com.sun.star.presentation.SlideNumberShape";
1550  bClearText = true;
1551  }
1553  {
1554  // XmlShapeTypePresDateTimeShape
1555  service = "com.sun.star.presentation.DateTimeShape";
1556  bClearText = true;
1557  }
1558  else // IsXMLToken( maPresentationClass, XML_TITLE ) )
1559  {
1560  // XmlShapeTypePresTitleTextShape
1561  service = "com.sun.star.presentation.TitleTextShape";
1562  }
1563  bIsPresShape = true;
1564  }
1565  }
1566 
1567  if( service.isEmpty() )
1568  {
1569  // normal text shape
1570  service = "com.sun.star.drawing.TextShape";
1571  }
1572 
1573  // Add, set Style and properties from base shape
1574  AddShape(service);
1575 
1576  if( !mxShape.is() )
1577  return;
1578 
1579  SetStyle();
1580  SetLayer();
1581 
1582  if(bIsPresShape)
1583  {
1584  uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY);
1585  if(xProps.is())
1586  {
1587  uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() );
1588  if( xPropsInfo.is() )
1589  {
1590  if( !mbIsPlaceholder && xPropsInfo->hasPropertyByName("IsEmptyPresentationObject"))
1591  xProps->setPropertyValue("IsEmptyPresentationObject", css::uno::Any(false) );
1592 
1593  if( mbIsUserTransformed && xPropsInfo->hasPropertyByName("IsPlaceholderDependent"))
1594  xProps->setPropertyValue("IsPlaceholderDependent", css::uno::Any(false) );
1595  }
1596  }
1597  }
1598 
1599  if( bClearText )
1600  {
1601  uno::Reference< text::XText > xText( mxShape, uno::UNO_QUERY );
1602  xText->setString( "" );
1603  }
1604 
1605  // set parameters on shape
1606 //A AW->CL: Eventually You need to strip scale and translate from the transformation
1607 //A to reach the same goal again.
1608 //A if(!bIsPresShape || mbIsUserTransformed)
1609 //A {
1610 //A // set pos and size on shape, this should remove binding
1611 //A // to pres object on masterpage
1612 //A SetSizeAndPosition();
1613 //A }
1614 
1615  // set pos, size, shear and rotate
1617 
1618  if(mnRadius)
1619  {
1620  uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
1621  if(xPropSet.is())
1622  {
1623  try
1624  {
1625  xPropSet->setPropertyValue("CornerRadius", uno::makeAny( mnRadius ) );
1626  }
1627  catch(const uno::Exception&)
1628  {
1629  DBG_UNHANDLED_EXCEPTION( "xmloff", "setting corner radius");
1630  }
1631  }
1632  }
1633 
1634  if(!maChainNextName.isEmpty())
1635  {
1636  uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
1637  if(xPropSet.is())
1638  {
1639  try
1640  {
1641  xPropSet->setPropertyValue("TextChainNextName",
1642  uno::makeAny( maChainNextName ) );
1643  }
1644  catch(const uno::Exception&)
1645  {
1646  DBG_UNHANDLED_EXCEPTION( "xmloff", "setting name of next chain link");
1647  }
1648  }
1649  }
1650 
1651  SdXMLShapeContext::startFastElement(nElement, xAttrList);
1652 }
1653 
1654 
1656  SvXMLImport& rImport,
1657  const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
1658  uno::Reference< drawing::XShapes > const & rShapes,
1659  bool bTemporaryShape)
1660 : SdXMLShapeContext( rImport, xAttrList, rShapes, bTemporaryShape )
1661 {
1662 }
1663 
1665 {
1666 }
1667 
1668 // this is called from the parent group for each unparsed attribute in the attribute list
1670 {
1671  switch (aIter.getToken())
1672  {
1673  case XML_ELEMENT(DRAW, XML_CONTROL):
1674  maFormId = aIter.toString();
1675  break;
1676  default:
1677  return SdXMLShapeContext::processAttribute( aIter );
1678  }
1679  return true;
1680 }
1681 
1683  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList)
1684 {
1685  // create Control shape
1686  // add, set style and properties from base shape
1687  AddShape("com.sun.star.drawing.ControlShape");
1688  if( !mxShape.is() )
1689  return;
1690 
1691  SAL_WARN_IF( !!maFormId.isEmpty(), "xmloff", "draw:control without a form:id attribute!" );
1692  if( !maFormId.isEmpty() )
1693  {
1694  if( GetImport().IsFormsSupported() )
1695  {
1696  uno::Reference< awt::XControlModel > xControlModel( GetImport().GetFormImport()->lookupControl( maFormId ), uno::UNO_QUERY );
1697  if( xControlModel.is() )
1698  {
1699  uno::Reference< drawing::XControlShape > xControl( mxShape, uno::UNO_QUERY );
1700  if( xControl.is() )
1701  xControl->setControl( xControlModel );
1702 
1703  }
1704  }
1705  }
1706 
1707  SetStyle();
1708  SetLayer();
1709 
1710  // set pos, size, shear and rotate
1712 
1713  SdXMLShapeContext::startFastElement(nElement, xAttrList);
1714 }
1715 
1716 
1718  SvXMLImport& rImport,
1719  const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
1720  uno::Reference< drawing::XShapes > const & rShapes,
1721  bool bTemporaryShape)
1722 : SdXMLShapeContext( rImport, xAttrList, rShapes, bTemporaryShape ),
1723  maStart(0,0),
1724  maEnd(1,1),
1725  mnType( drawing::ConnectorType_STANDARD ),
1726  mnStartGlueId(-1),
1727  mnEndGlueId(-1),
1728  mnDelta1(0),
1729  mnDelta2(0),
1730  mnDelta3(0)
1731 {
1732 }
1733 
1735 {
1736 }
1737 
1739 {
1740  bool bWrongPositionAfterZ( false );
1741  sal_Int32 nUPD( 0 );
1742  sal_Int32 nBuildId( 0 );
1743  if ( getBuildIds( nUPD, nBuildId ) && // test OOo and old versions of LibO and AOO
1744  ( ( ( nUPD == 641 ) || ( nUPD == 645 ) || ( nUPD == 680 ) || ( nUPD == 300 ) ||
1745  ( nUPD == 310 ) || ( nUPD == 320 ) || ( nUPD == 330 ) || ( nUPD == 340 ) ||
1746  ( nUPD == 350 && nBuildId < 202 ) )
1747  || (getGeneratorVersion() == SvXMLImport::AOO_40x))) // test if AOO 4.0.x
1748  // apparently bug was fixed in AOO by i#123433 f15874d8f976f3874bdbcb53429eeefa65c28841
1749  {
1750  bWrongPositionAfterZ = true;
1751  }
1752  return bWrongPositionAfterZ;
1753 }
1754 
1755 
1756 // this is called from the parent group for each unparsed attribute in the attribute list
1758 {
1759  switch( aIter.getToken() )
1760  {
1762  maStartShapeId = aIter.toString();
1763  break;
1765  mnStartGlueId = aIter.toInt32();
1766  break;
1768  maEndShapeId = aIter.toString();
1769  break;
1771  mnEndGlueId = aIter.toInt32();
1772  break;
1774  {
1775  OUString sValue = aIter.toString();
1776  SvXMLTokenEnumerator aTokenEnum( sValue );
1777  std::u16string_view aToken;
1778  if( aTokenEnum.getNextToken( aToken ) )
1779  {
1781  mnDelta1, aToken);
1782  if( aTokenEnum.getNextToken( aToken ) )
1783  {
1785  mnDelta2, aToken);
1786  if( aTokenEnum.getNextToken( aToken ) )
1787  {
1789  mnDelta3, aToken);
1790  }
1791  }
1792  }
1793  break;
1794  }
1795  case XML_ELEMENT(DRAW, XML_TYPE):
1796  {
1798  break;
1799  }
1800  // #121965# draw:transform may be used in ODF1.2, e.g. exports from MS seem to use these
1803  break;
1804 
1805  case XML_ELEMENT(SVG, XML_X1):
1806  case XML_ELEMENT(SVG_COMPAT, XML_X1):
1808  maStart.X, aIter.toView());
1809  break;
1810  case XML_ELEMENT(SVG, XML_Y1):
1811  case XML_ELEMENT(SVG_COMPAT, XML_Y1):
1813  maStart.Y, aIter.toView());
1814  break;
1815  case XML_ELEMENT(SVG, XML_X2):
1816  case XML_ELEMENT(SVG_COMPAT, XML_X2):
1818  maEnd.X, aIter.toView());
1819  break;
1820  case XML_ELEMENT(SVG, XML_Y2):
1821  case XML_ELEMENT(SVG_COMPAT, XML_Y2):
1823  maEnd.Y, aIter.toView());
1824  break;
1825  case XML_ELEMENT(SVG, XML_D):
1826  case XML_ELEMENT(SVG_COMPAT, XML_D):
1827  {
1828  basegfx::B2DPolyPolygon aPolyPolygon;
1829 
1830  if(basegfx::utils::importFromSvgD(aPolyPolygon, aIter.toString(), GetImport().needFixPositionAfterZ(), nullptr))
1831  {
1832  if(aPolyPolygon.count())
1833  {
1834  drawing::PolyPolygonBezierCoords aSourcePolyPolygon;
1835 
1837  aPolyPolygon,
1838  aSourcePolyPolygon);
1839  maPath <<= aSourcePolyPolygon;
1840  }
1841  }
1842  break;
1843  }
1844  default:
1845  return SdXMLShapeContext::processAttribute( aIter );
1846  }
1847  return true;
1848 }
1849 
1851  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList)
1852 {
1853  // For security reasons, do not add empty connectors. There may have been an error in EA2
1854  // that created empty, far set off connectors (e.g. 63 meters below top of document). This
1855  // is not guaranteed, but it's definitely safe to not add empty connectors.
1856  bool bDoAdd(true);
1857 
1858  if( maStartShapeId.isEmpty()
1859  && maEndShapeId.isEmpty()
1860  && maStart.X == maEnd.X
1861  && maStart.Y == maEnd.Y
1862  && 0 == mnDelta1
1863  && 0 == mnDelta2
1864  && 0 == mnDelta3
1865  )
1866  {
1867  bDoAdd = false;
1868  }
1869 
1870  if(!bDoAdd)
1871  return;
1872 
1873  // create Connector shape
1874  // add, set style and properties from base shape
1875  AddShape("com.sun.star.drawing.ConnectorShape");
1876  if(!mxShape.is())
1877  return;
1878 
1879  // #121965# if draw:transform is used, apply directly to the start
1880  // and end positions before using these
1881  if(mnTransform.NeedsAction())
1882  {
1883  // transformation is used, apply to object.
1886 
1887  if(!aMat.isIdentity())
1888  {
1889  basegfx::B2DPoint aStart(maStart.X, maStart.Y);
1890  basegfx::B2DPoint aEnd(maEnd.X, maEnd.Y);
1891 
1892  aStart = aMat * aStart;
1893  aEnd = aMat * aEnd;
1894 
1895  maStart.X = basegfx::fround(aStart.getX());
1896  maStart.Y = basegfx::fround(aStart.getY());
1897  maEnd.X = basegfx::fround(aEnd.getX());
1898  maEnd.Y = basegfx::fround(aEnd.getY());
1899  }
1900  }
1901 
1902  // add connection ids
1903  if( !maStartShapeId.isEmpty() )
1904  GetImport().GetShapeImport()->addShapeConnection( mxShape, true, maStartShapeId, mnStartGlueId );
1905  if( !maEndShapeId.isEmpty() )
1906  GetImport().GetShapeImport()->addShapeConnection( mxShape, false, maEndShapeId, mnEndGlueId );
1907 
1908  uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY );
1909  if( xProps.is() )
1910  {
1911  xProps->setPropertyValue("StartPosition", Any(maStart));
1912  xProps->setPropertyValue("EndPosition", Any(maEnd) );
1913  xProps->setPropertyValue("EdgeKind", Any(mnType) );
1914  xProps->setPropertyValue("EdgeLine1Delta", Any(mnDelta1) );
1915  xProps->setPropertyValue("EdgeLine2Delta", Any(mnDelta2) );
1916  xProps->setPropertyValue("EdgeLine3Delta", Any(mnDelta3) );
1917  }
1918  SetStyle();
1919  SetLayer();
1920 
1921  if ( maPath.hasValue() )
1922  {
1923  // #i115492#
1924  // Ignore svg:d attribute for text documents created by OpenOffice.org
1925  // versions before OOo 3.3, because these OOo versions are storing
1926  // svg:d values not using the correct unit.
1927  bool bApplySVGD( true );
1928  if ( uno::Reference< text::XTextDocument >(GetImport().GetModel(), uno::UNO_QUERY).is() )
1929  {
1930  sal_Int32 nUPD( 0 );
1931  sal_Int32 nBuild( 0 );
1932  const bool bBuildIdFound = GetImport().getBuildIds( nUPD, nBuild );
1933  if ( GetImport().IsTextDocInOOoFileFormat() ||
1934  ( bBuildIdFound &&
1935  ( ( nUPD == 641 ) || ( nUPD == 645 ) || // prior OOo 2.0
1936  ( nUPD == 680 ) || // OOo 2.x
1937  ( nUPD == 300 ) || // OOo 3.0 - OOo 3.0.1
1938  ( nUPD == 310 ) || // OOo 3.1 - OOo 3.1.1
1939  ( nUPD == 320 ) ) ) ) // OOo 3.2 - OOo 3.2.1
1940  {
1941  bApplySVGD = false;
1942  }
1943  }
1944 
1945  if ( bApplySVGD )
1946  {
1947  // tdf#83360 use path data only when redundant data of start and end point coordinates of
1948  // path start/end and connector start/end is equal. This is to avoid using erraneous
1949  // or inconsistent path data at import of foreign formats. Office itself always
1950  // writes out a consistent data set. Not using it when there is inconsistency
1951  // is okay since the path data is redundant, buffered data just to avoid recalculation
1952  // of the connector's layout at load time, no real information would be lost.
1953  // A 'connected' end has prio to direct coordinate data in Start/EndPosition
1954  // to the path data (which should have the start/end redundant in the path)
1955  const drawing::PolyPolygonBezierCoords* pSource = static_cast< const drawing::PolyPolygonBezierCoords* >(maPath.getValue());
1956  const sal_uInt32 nSequenceCount(pSource->Coordinates.getLength());
1957  bool bStartEqual(false);
1958  bool bEndEqual(false);
1959 
1960  if(nSequenceCount)
1961  {
1962  const drawing::PointSequence& rStartSeq = pSource->Coordinates[0];
1963  const sal_uInt32 nStartCount = rStartSeq.getLength();
1964 
1965  if(nStartCount)
1966  {
1967  const awt::Point& rStartPoint = rStartSeq.getConstArray()[0];
1968 
1969  if(rStartPoint.X == maStart.X && rStartPoint.Y == maStart.Y)
1970  {
1971  bStartEqual = true;
1972  }
1973  }
1974 
1975  const drawing::PointSequence& rEndSeq = pSource->Coordinates[nSequenceCount - 1];
1976  const sal_uInt32 nEndCount = rEndSeq.getLength();
1977 
1978  if(nEndCount)
1979  {
1980  const awt::Point& rEndPoint = rEndSeq.getConstArray()[nEndCount - 1];
1981 
1982  if(rEndPoint.X == maEnd.X && rEndPoint.Y == maEnd.Y)
1983  {
1984  bEndEqual = true;
1985  }
1986  }
1987  }
1988 
1989  if(!bStartEqual || !bEndEqual)
1990  {
1991  bApplySVGD = false;
1992  }
1993  }
1994 
1995  if ( bApplySVGD )
1996  {
1998  xProps->setPropertyValue("PolyPolygonBezier", maPath);
1999  }
2000  }
2001 
2002  SdXMLShapeContext::startFastElement(nElement, xAttrList);
2003 }
2004 
2005 
2007  SvXMLImport& rImport,
2008  const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
2009  uno::Reference< drawing::XShapes > const & rShapes,
2010  bool bTemporaryShape)
2011 : SdXMLShapeContext( rImport, xAttrList, rShapes, bTemporaryShape ),
2012  maStart(0,0),
2013  maEnd(1,1)
2014 {
2015 }
2016 
2018 {
2019 }
2020 
2021 // this is called from the parent group for each unparsed attribute in the attribute list
2023 {
2024  switch( aIter.getToken() )
2025  {
2026  case XML_ELEMENT(SVG, XML_X1):
2027  case XML_ELEMENT(SVG_COMPAT, XML_X1):
2028  {
2030  maStart.X, aIter.toView());
2031  break;
2032  }
2033  case XML_ELEMENT(SVG, XML_Y1):
2034  case XML_ELEMENT(SVG_COMPAT, XML_Y1):
2035  {
2037  maStart.Y, aIter.toView());
2038  break;
2039  }
2040  case XML_ELEMENT(SVG, XML_X2):
2041  case XML_ELEMENT(SVG_COMPAT, XML_X2):
2042  {
2044  maEnd.X, aIter.toView());
2045  break;
2046  }
2047  case XML_ELEMENT(SVG, XML_Y2):
2048  case XML_ELEMENT(SVG_COMPAT, XML_Y2):
2049  {
2051  maEnd.Y, aIter.toView());
2052  break;
2053  }
2054  default:
2055  return SdXMLShapeContext::processAttribute( aIter );
2056  }
2057  return true;
2058 }
2059 
2061  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList)
2062 {
2063  // create Measure shape
2064  // add, set style and properties from base shape
2065  AddShape("com.sun.star.drawing.MeasureShape");
2066  if(!mxShape.is())
2067  return;
2068 
2069  SetStyle();
2070  SetLayer();
2071 
2072  uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY );
2073  if( xProps.is() )
2074  {
2075  xProps->setPropertyValue("StartPosition", Any(maStart));
2076  xProps->setPropertyValue("EndPosition", Any(maEnd) );
2077  }
2078 
2079  // delete pre created fields
2080  uno::Reference< text::XText > xText( mxShape, uno::UNO_QUERY );
2081  if( xText.is() )
2082  {
2083  xText->setString( " " );
2084  }
2085 
2086  SdXMLShapeContext::startFastElement(nElement, xAttrList);
2087 }
2088 
2090 {
2091  do
2092  {
2093  // delete pre created fields
2094  uno::Reference< text::XText > xText( mxShape, uno::UNO_QUERY );
2095  if( !xText.is() )
2096  break;
2097 
2098  uno::Reference< text::XTextCursor > xCursor( xText->createTextCursor() );
2099  if( !xCursor.is() )
2100  break;
2101 
2102  xCursor->collapseToStart();
2103  xCursor->goRight( 1, true );
2104  xCursor->setString( "" );
2105  }
2106  while(false);
2107 
2109 }
2110 
2111 
2113  SvXMLImport& rImport,
2114  const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
2115  uno::Reference< drawing::XShapes > const & rShapes,
2116  bool bTemporaryShape)
2117 : SdXMLShapeContext( rImport, xAttrList, rShapes, bTemporaryShape ), mnPageNumber(0)
2118 {
2119  mbClearDefaultAttributes = false;
2120 }
2121 
2123 {
2124 }
2125 
2126 // this is called from the parent group for each unparsed attribute in the attribute list
2128 {
2129  if( aIter.getToken() == XML_ELEMENT(DRAW, XML_PAGE_NUMBER) )
2130  mnPageNumber = aIter.toInt32();
2131  else
2132  return SdXMLShapeContext::processAttribute( aIter );
2133  return true;
2134 }
2135 
2137  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList)
2138 {
2139  // create Page shape
2140  // add, set style and properties from base shape
2141 
2142  // #86163# take into account which type of PageShape needs to
2143  // be constructed. It's a pres shape if presentation:XML_CLASS == XML_PAGE.
2144  bool bIsPresentation = !maPresentationClass.isEmpty() &&
2145  GetImport().GetShapeImport()->IsPresentationShapesSupported();
2146 
2147  uno::Reference< lang::XServiceInfo > xInfo( mxShapes, uno::UNO_QUERY );
2148  const bool bIsOnHandoutPage = xInfo.is() && xInfo->supportsService("com.sun.star.presentation.HandoutMasterPage");
2149 
2150  if( bIsOnHandoutPage )
2151  {
2152  AddShape("com.sun.star.presentation.HandoutShape");
2153  }
2154  else
2155  {
2156  if(bIsPresentation && !IsXMLToken( maPresentationClass, XML_PAGE ) )
2157  {
2158  bIsPresentation = false;
2159  }
2160 
2161  if(bIsPresentation)
2162  {
2163  AddShape("com.sun.star.presentation.PageShape");
2164  }
2165  else
2166  {
2167  AddShape("com.sun.star.drawing.PageShape");
2168  }
2169  }
2170 
2171  if(!mxShape.is())
2172  return;
2173 
2174  SetStyle();
2175  SetLayer();
2176 
2177  // set pos, size, shear and rotate
2179 
2180  uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
2181  if(xPropSet.is())
2182  {
2183  uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
2184  static const OUStringLiteral aPageNumberStr(u"PageNumber");
2185  if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(aPageNumberStr))
2186  xPropSet->setPropertyValue(aPageNumberStr, uno::makeAny( mnPageNumber ));
2187  }
2188 
2189  SdXMLShapeContext::startFastElement(nElement, xAttrList);
2190 }
2191 
2192 
2194  SvXMLImport& rImport,
2195  const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
2196  uno::Reference< drawing::XShapes > const & rShapes,
2197  bool bTemporaryShape)
2198 : SdXMLShapeContext( rImport, xAttrList, rShapes, bTemporaryShape ),
2199  // #86616# for correct edge rounding import mnRadius needs to be initialized
2200  mnRadius( 0 )
2201 {
2202 }
2203 
2205 {
2206 }
2207 
2209  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList)
2210 {
2211  // create Caption shape
2212  // add, set style and properties from base shape
2213  AddShape("com.sun.star.drawing.CaptionShape");
2214  if( !mxShape.is() )
2215  return;
2216 
2217  SetStyle();
2218  SetLayer();
2219 
2220  uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY );
2221 
2222  // SJ: If AutoGrowWidthItem is set, SetTransformation will lead to the wrong SnapRect
2223  // because NbcAdjustTextFrameWidthAndHeight() is called (text is set later and center alignment
2224  // is the default setting, so the top left reference point that is used by the caption point is
2225  // no longer correct) There are two ways to solve this problem, temporarily disabling the
2226  // autogrowwidth as we are doing here or to apply the CaptionPoint after setting text
2227  bool bIsAutoGrowWidth = false;
2228  if ( xProps.is() )
2229  {
2230  uno::Any aAny( xProps->getPropertyValue("TextAutoGrowWidth") );
2231  aAny >>= bIsAutoGrowWidth;
2232 
2233  if ( bIsAutoGrowWidth )
2234  xProps->setPropertyValue("TextAutoGrowWidth", uno::makeAny( false ) );
2235  }
2236 
2237  // set pos, size, shear and rotate
2239  if( xProps.is() )
2240  xProps->setPropertyValue("CaptionPoint", uno::makeAny( maCaptionPoint ) );
2241 
2242  if ( bIsAutoGrowWidth )
2243  xProps->setPropertyValue("TextAutoGrowWidth", uno::makeAny( true ) );
2244 
2245  if(mnRadius)
2246  {
2247  uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
2248  if(xPropSet.is())
2249  {
2250  try
2251  {
2252  xPropSet->setPropertyValue("CornerRadius", uno::makeAny( mnRadius ) );
2253  }
2254  catch(const uno::Exception&)
2255  {
2256  DBG_UNHANDLED_EXCEPTION( "xmloff", "setting corner radius");
2257  }
2258  }
2259  }
2260 
2261  SdXMLShapeContext::startFastElement(nElement, xAttrList);
2262 }
2263 
2264 // this is called from the parent group for each unparsed attribute in the attribute list
2266 {
2267  switch (aIter.getToken())
2268  {
2271  maCaptionPoint.X, aIter.toView());
2272  break;
2275  maCaptionPoint.Y, aIter.toView());
2276  break;
2279  mnRadius, aIter.toView());
2280  break;
2281  default:
2282  return SdXMLShapeContext::processAttribute( aIter );
2283  }
2284  return true;
2285 }
2286 
2287 
2289  SvXMLImport& rImport,
2290  const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
2291  uno::Reference< drawing::XShapes > const & rShapes)
2292 : SdXMLShapeContext( rImport, xAttrList, rShapes, false/*bTemporaryShape*/ )
2293 {
2294 }
2295 
2296 // this is called from the parent group for each unparsed attribute in the attribute list
2298 {
2299  if( aIter.getToken() == XML_ELEMENT(XLINK, XML_HREF) )
2300  maURL = aIter.toString();
2301  else
2302  return SdXMLShapeContext::processAttribute( aIter );
2303  return true;
2304 }
2305 
2307  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList)
2308 {
2309  // create graphic object shape
2310  OUString service;
2311 
2312  if( IsXMLToken( maPresentationClass, XML_GRAPHIC ) && GetImport().GetShapeImport()->IsPresentationShapesSupported() )
2313  {
2314  service = "com.sun.star.presentation.GraphicObjectShape";
2315  }
2316  else
2317  {
2318  service = "com.sun.star.drawing.GraphicObjectShape";
2319  }
2320 
2321  AddShape(service);
2322 
2323  if(!mxShape.is())
2324  return;
2325 
2326  SetStyle();
2327  SetLayer();
2328 
2329  uno::Reference< beans::XPropertySet > xPropset(mxShape, uno::UNO_QUERY);
2330  if(xPropset.is())
2331  {
2332  // since OOo 1.x had no line or fill style for graphics, but may create
2333  // documents with them, we have to override them here
2334  sal_Int32 nUPD, nBuildId;
2335  if( GetImport().getBuildIds( nUPD, nBuildId ) && (nUPD == 645) ) try
2336  {
2337  xPropset->setPropertyValue("FillStyle", Any( FillStyle_NONE ) );
2338  xPropset->setPropertyValue("LineStyle", Any( LineStyle_NONE ) );
2339  }
2340  catch(const Exception&)
2341  {
2342  }
2343 
2344  uno::Reference< beans::XPropertySetInfo > xPropsInfo( xPropset->getPropertySetInfo() );
2345  if( xPropsInfo.is() && xPropsInfo->hasPropertyByName("IsEmptyPresentationObject"))
2346  xPropset->setPropertyValue("IsEmptyPresentationObject", css::uno::makeAny( mbIsPlaceholder ) );
2347 
2348  if( !mbIsPlaceholder )
2349  {
2350  if( !maURL.isEmpty() )
2351  {
2352  uno::Reference<graphic::XGraphic> xGraphic = GetImport().loadGraphicByURL(maURL);
2353  if (xGraphic.is())
2354  {
2355  xPropset->setPropertyValue("Graphic", uno::makeAny(xGraphic));
2356  }
2357  }
2358  }
2359  }
2360 
2362  {
2363  uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY);
2364  if(xProps.is())
2365  {
2366  uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() );
2367  if( xPropsInfo.is() )
2368  {
2369  if( xPropsInfo->hasPropertyByName("IsPlaceholderDependent"))
2370  xProps->setPropertyValue("IsPlaceholderDependent", css::uno::Any(false) );
2371  }
2372  }
2373  }
2374 
2375  // set pos, size, shear and rotate
2377 
2378  SdXMLShapeContext::startFastElement(nElement, xAttrList);
2379 }
2380 
2382 {
2383  if (mxBase64Stream.is())
2384  {
2385  uno::Reference<graphic::XGraphic> xGraphic(GetImport().loadGraphicFromBase64(mxBase64Stream));
2386  if (xGraphic.is())
2387  {
2388  uno::Reference<beans::XPropertySet> xProperties(mxShape, uno::UNO_QUERY);
2389  if (xProperties.is())
2390  {
2391  xProperties->setPropertyValue("Graphic", uno::makeAny(xGraphic));
2392  }
2393  }
2394  }
2395 
2397 }
2398 
2399 css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLGraphicObjectShapeContext::createFastChildContext(
2400  sal_Int32 nElement,
2401  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
2402 {
2403  css::uno::Reference< css::xml::sax::XFastContextHandler > xContext;
2404 
2405  if( nElement == XML_ELEMENT(OFFICE, XML_BINARY_DATA) )
2406  {
2407  if( maURL.isEmpty() && !mxBase64Stream.is() )
2408  {
2410  if( mxBase64Stream.is() )
2411  xContext = new XMLBase64ImportContext( GetImport(),
2412  mxBase64Stream );
2413  }
2414  }
2415 
2416  // delegate to parent class if no context could be created
2417  if (!xContext)
2418  xContext = SdXMLShapeContext::createFastChildContext(nElement,
2419  xAttrList);
2420 
2421  if (!xContext)
2422  XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement);
2423 
2424  return xContext;
2425 }
2426 
2428 {
2429 
2430 }
2431 
2432 
2434  SvXMLImport& rImport,
2435  const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
2436  uno::Reference< drawing::XShapes > const & rShapes,
2437  bool bTemporaryShape)
2438 : SdXMLShapeContext( rImport, xAttrList, rShapes, bTemporaryShape )
2439 {
2440 }
2441 
2443  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList)
2444 {
2445  const bool bIsPresentation = isPresentationShape();
2446 
2447  AddShape(
2448  bIsPresentation
2449  ? OUString("com.sun.star.presentation.ChartShape")
2450  : OUString("com.sun.star.drawing.OLE2Shape"));
2451 
2452  if(!mxShape.is())
2453  return;
2454 
2455  SetStyle();
2456  SetLayer();
2457 
2458  if( !mbIsPlaceholder )
2459  {
2460  uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY);
2461  if(xProps.is())
2462  {
2463  uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() );
2464  if( xPropsInfo.is() && xPropsInfo->hasPropertyByName("IsEmptyPresentationObject"))
2465  xProps->setPropertyValue("IsEmptyPresentationObject", css::uno::Any(false) );
2466 
2467  uno::Any aAny;
2468 
2469  xProps->setPropertyValue("CLSID", Any(OUString("12DCAE26-281F-416F-a234-c3086127382e")) );
2470 
2471  aAny = xProps->getPropertyValue("Model");
2472  uno::Reference< frame::XModel > xChartModel;
2473  if( aAny >>= xChartModel )
2474  {
2475 #if !ENABLE_WASM_STRIP_CHART
2476  // WASM_CHART change
2477  // TODO: Maybe use SdXMLGraphicObjectShapeContext completely instead
2478  // or try to create as mbIsPlaceholder object adding a Chart visualization
2479  // that should be available somehow
2480  mxChartContext.set( GetImport().GetChartImport()->CreateChartContext( GetImport(), xChartModel ) );
2481 #endif
2482  }
2483  }
2484  }
2485 
2487  {
2488  uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY);
2489  if(xProps.is())
2490  {
2491  uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() );
2492  if( xPropsInfo.is() )
2493  {
2494  if( xPropsInfo->hasPropertyByName("IsPlaceholderDependent"))
2495  xProps->setPropertyValue("IsPlaceholderDependent", css::uno::Any(false) );
2496  }
2497  }
2498  }
2499 
2500  // set pos, size, shear and rotate
2502 
2503  SdXMLShapeContext::startFastElement(nElement, xAttrList);
2504 
2505  if( mxChartContext.is() )
2506  mxChartContext->startFastElement( nElement, xAttrList );
2507 }
2508 
2510 {
2511  if( mxChartContext.is() )
2512  mxChartContext->endFastElement(nElement);
2513 
2515 }
2516 
2517 void SdXMLChartShapeContext::characters( const OUString& rChars )
2518 {
2519  if( mxChartContext.is() )
2520  mxChartContext->characters( rChars );
2521 }
2522 
2523 css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLChartShapeContext::createFastChildContext(
2524  sal_Int32 nElement,
2525  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
2526 {
2527  if( mxChartContext.is() )
2528  return mxChartContext->createFastChildContext( nElement, xAttrList );
2529 
2530  return nullptr;
2531 }
2532 
2533 
2535  const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
2536  css::uno::Reference< css::drawing::XShapes > const & rShapes)
2537 : SdXMLShapeContext( rImport, xAttrList, rShapes, false/*bTemporaryShape*/ )
2538 {
2539 }
2540 
2542 {
2543 }
2544 
2545 void SdXMLObjectShapeContext::startFastElement (sal_Int32 /*nElement*/,
2546  const css::uno::Reference< css::xml::sax::XFastAttributeList >& /*xAttrList*/)
2547 {
2548  // #96717# in theorie, if we don't have a URL we shouldn't even
2549  // export this OLE shape. But practically it's too risky right now
2550  // to change this so we better dispose this on load
2551  //if( !mbIsPlaceholder && ImpIsEmptyURL(maHref) )
2552  // return;
2553 
2554  // #100592# this BugFix prevents that a shape is created. CL
2555  // is thinking about an alternative.
2556  // #i13140# Check for more than empty string in maHref, there are
2557  // other possibilities that maHref results in empty container
2558  // storage names
2559  if( !(GetImport().getImportFlags() & SvXMLImportFlags::EMBEDDED) && !mbIsPlaceholder && ImpIsEmptyURL(maHref) )
2560  return;
2561 
2562  OUString service("com.sun.star.drawing.OLE2Shape");
2563 
2564  bool bIsPresShape = !maPresentationClass.isEmpty() && GetImport().GetShapeImport()->IsPresentationShapesSupported();
2565 
2566  if( bIsPresShape )
2567  {
2569  {
2570  service = "com.sun.star.presentation.ChartShape";
2571  }
2573  {
2574  service = "com.sun.star.presentation.CalcShape";
2575  }
2577  {
2578  service = "com.sun.star.presentation.OLE2Shape";
2579  }
2580  }
2581 
2582  AddShape(service);
2583 
2584  if( !mxShape.is() )
2585  return;
2586 
2587  SetLayer();
2588 
2589  if(bIsPresShape)
2590  {
2591  uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY);
2592  if(xProps.is())
2593  {
2594  uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() );
2595  if( xPropsInfo.is() )
2596  {
2597  if( !mbIsPlaceholder && xPropsInfo->hasPropertyByName("IsEmptyPresentationObject"))
2598  xProps->setPropertyValue("IsEmptyPresentationObject", css::uno::Any(false) );
2599 
2600  if( mbIsUserTransformed && xPropsInfo->hasPropertyByName("IsPlaceholderDependent"))
2601  xProps->setPropertyValue("IsPlaceholderDependent", css::uno::Any(false) );
2602  }
2603  }
2604  }
2605 
2606  if( !mbIsPlaceholder && !maHref.isEmpty() )
2607  {
2608  uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY );
2609 
2610  if( xProps.is() )
2611  {
2612  OUString aPersistName = GetImport().ResolveEmbeddedObjectURL( maHref, maCLSID );
2613 
2614  if ( GetImport().IsPackageURL( maHref ) )
2615  {
2616  static const OUStringLiteral sURL( u"vnd.sun.star.EmbeddedObject:" );
2617 
2618  if ( aPersistName.startsWith( sURL ) )
2619  aPersistName = aPersistName.copy( sURL.getLength() );
2620 
2621  xProps->setPropertyValue("PersistName",
2622  uno::makeAny( aPersistName ) );
2623  }
2624  else
2625  {
2626  // this is OOo link object
2627  xProps->setPropertyValue("LinkURL",
2628  uno::makeAny( aPersistName ) );
2629  }
2630  }
2631  }
2632 
2633  // set pos, size, shear and rotate
2635 
2636  SetStyle();
2637 
2638  GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes );
2639 }
2640 
2642 {
2643  if (GetImport().isGeneratorVersionOlderThan(
2645  {
2646  // #i118485#
2647  // If it's an old file from us written before OOo3.4, we need to correct
2648  // FillStyle and LineStyle for OLE2 objects. The error was that the old paint
2649  // implementations just ignored added fill/linestyles completely, thus
2650  // those objects need to be corrected to not show blue and hairline which
2651  // always was the default, but would be shown now
2652  uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY);
2653 
2654  if( xProps.is() )
2655  {
2656  xProps->setPropertyValue("FillStyle", uno::makeAny(drawing::FillStyle_NONE));
2657  xProps->setPropertyValue("LineStyle", uno::makeAny(drawing::LineStyle_NONE));
2658  }
2659  }
2660 
2661  if( mxBase64Stream.is() )
2662  {
2663  OUString aPersistName( GetImport().ResolveEmbeddedObjectURLFromBase64() );
2664  static const OUStringLiteral sURL( u"vnd.sun.star.EmbeddedObject:" );
2665 
2666  aPersistName = aPersistName.copy( sURL.getLength() );
2667 
2668  uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY);
2669  if( xProps.is() )
2670  xProps->setPropertyValue("PersistName", uno::makeAny( aPersistName ) );
2671  }
2672 
2674 }
2675 
2676 // this is called from the parent group for each unparsed attribute in the attribute list
2678 {
2679  switch( aIter.getToken() )
2680  {
2681  case XML_ELEMENT(DRAW, XML_CLASS_ID):
2682  maCLSID = aIter.toString();
2683  break;
2684  case XML_ELEMENT(XLINK, XML_HREF):
2685  maHref = aIter.toString();
2686  break;
2687  default:
2688  return SdXMLShapeContext::processAttribute( aIter );
2689  }
2690  return true;
2691 }
2692 
2693 css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLObjectShapeContext::createFastChildContext(
2694  sal_Int32 nElement,
2695  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
2696 {
2697  if(nElement == XML_ELEMENT(OFFICE, XML_BINARY_DATA))
2698  {
2700  if( mxBase64Stream.is() )
2702  }
2703  else if( nElement == XML_ELEMENT(OFFICE, XML_DOCUMENT) ||
2704  nElement == XML_ELEMENT(MATH, XML_MATH) )
2705  {
2707  new XMLEmbeddedObjectImportContext(GetImport(), nElement, xAttrList));
2708  maCLSID = xEContext->GetFilterCLSID();
2709  if( !maCLSID.isEmpty() )
2710  {
2711  uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
2712  if( xPropSet.is() )
2713  {
2714  xPropSet->setPropertyValue("CLSID", uno::makeAny( maCLSID ) );
2715 
2716  uno::Reference< lang::XComponent > xComp;
2717  xPropSet->getPropertyValue("Model") >>= xComp;
2718  SAL_WARN_IF( !xComp.is(), "xmloff", "no xModel for own OLE format" );
2719  xEContext->SetComponent(xComp);
2720  }
2721  }
2722  return xEContext;
2723  }
2724 
2725  // delegate to parent class if no context could be created
2726  return SdXMLShapeContext::createFastChildContext(nElement, xAttrList);
2727 }
2728 
2730  const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
2731  css::uno::Reference< css::drawing::XShapes > const & rShapes)
2732 : SdXMLShapeContext( rImport, xAttrList, rShapes, false/*bTemporaryShape*/ ),
2733  mbIsScript( false )
2734 {
2735 }
2736 
2738 {
2739 }
2740 
2741 void SdXMLAppletShapeContext::startFastElement (sal_Int32 /*nElement*/,
2742  const css::uno::Reference< css::xml::sax::XFastAttributeList >& /*xAttrList*/)
2743 {
2744  AddShape("com.sun.star.drawing.AppletShape");
2745 
2746  if( mxShape.is() )
2747  {
2748  SetLayer();
2749 
2750  // set pos, size, shear and rotate
2752  GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes );
2753  }
2754 }
2755 
2756 // this is called from the parent group for each unparsed attribute in the attribute list
2758 {
2759  switch( aIter.getToken() )
2760  {
2762  maAppletName = aIter.toString();
2763  break;
2764  case XML_ELEMENT(DRAW, XML_CODE):
2765  maAppletCode = aIter.toString();
2766  break;
2768  mbIsScript = IsXMLToken( aIter, XML_TRUE );
2769  break;
2770  case XML_ELEMENT(XLINK, XML_HREF):
2772  break;
2773  default:
2774  return SdXMLShapeContext::processAttribute( aIter );
2775  }
2776  return true;
2777 }
2778 
2780 {
2781  uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY );
2782  if( xProps.is() )
2783  {
2784  if ( maSize.Width && maSize.Height )
2785  {
2786  // the visual area for applet must be set on loading
2787  awt::Rectangle aRect( 0, 0, maSize.Width, maSize.Height );
2788  xProps->setPropertyValue("VisibleArea", Any(aRect) );
2789  }
2790 
2791  if( maParams.hasElements() )
2792  {
2793  xProps->setPropertyValue("AppletCommands", Any(maParams) );
2794  }
2795 
2796  if( !maHref.isEmpty() )
2797  {
2798  xProps->setPropertyValue("AppletCodeBase", Any(maHref) );
2799  }
2800 
2801  if( !maAppletName.isEmpty() )
2802  {
2803  xProps->setPropertyValue("AppletName", Any(maAppletName) );
2804  }
2805 
2806  if( mbIsScript )
2807  {
2808  xProps->setPropertyValue("AppletIsScript", Any(mbIsScript) );
2809 
2810  }
2811 
2812  if( !maAppletCode.isEmpty() )
2813  {
2814  xProps->setPropertyValue("AppletCode", Any(maAppletCode) );
2815  }
2816 
2817  xProps->setPropertyValue("AppletDocBase", Any(GetImport().GetDocumentBase()) );
2818 
2819  SetThumbnail();
2820  }
2821 
2823 }
2824 
2825 css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLAppletShapeContext::createFastChildContext(
2826  sal_Int32 nElement,
2827  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
2828 {
2829  if( nElement == XML_ELEMENT(DRAW, XML_PARAM) )
2830  {
2831  OUString aParamName, aParamValue;
2832  // now parse the attribute list and look for draw:name and draw:value
2833  for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
2834  {
2835  if( aIter.getToken() == XML_ELEMENT(DRAW, XML_NAME) )
2836  aParamName = aIter.toString();
2837  if( aIter.getToken() == XML_ELEMENT(DRAW, XML_VALUE) )
2838  aParamValue = aIter.toString();
2839  }
2840 
2841  if( !aParamName.isEmpty() )
2842  {
2843  sal_Int32 nIndex = maParams.getLength();
2844  maParams.realloc( nIndex + 1 );
2845  auto pParams = maParams.getArray();
2846  pParams[nIndex].Name = aParamName;
2847  pParams[nIndex].Handle = -1;
2848  pParams[nIndex].Value <<= aParamValue;
2849  pParams[nIndex].State = beans::PropertyState_DIRECT_VALUE;
2850  }
2851 
2852  return new SvXMLImportContext( GetImport() );
2853  }
2854 
2855  return SdXMLShapeContext::createFastChildContext( nElement, xAttrList );
2856 }
2857 
2858 
2860  const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
2861  css::uno::Reference< css::drawing::XShapes > const & rShapes) :
2862 SdXMLShapeContext( rImport, xAttrList, rShapes, false/*bTemporaryShape*/ ),
2863 mbMedia( false )
2864 {
2865 }
2866 
2868 {
2869 }
2870 
2871 void SdXMLPluginShapeContext::startFastElement (sal_Int32 /*nElement*/,
2872  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList)
2873 {
2874 
2875  // watch for MimeType attribute to see if we have a media object
2876  for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
2877  {
2878  if( aIter.getToken() == XML_ELEMENT(DRAW, XML_MIME_TYPE) )
2879  {
2880  if( aIter.toString() == "application/vnd.sun.star.media" )
2881  mbMedia = true;
2882  // leave this loop
2883  break;
2884  }
2885  }
2886 
2887  OUString service;
2888 
2889  bool bIsPresShape = false;
2890 
2891  if( mbMedia )
2892  {
2893  service = "com.sun.star.drawing.MediaShape";
2894 
2895  bIsPresShape = !maPresentationClass.isEmpty() && GetImport().GetShapeImport()->IsPresentationShapesSupported();
2896  if( bIsPresShape )
2897  {
2899  {
2900  service = "com.sun.star.presentation.MediaShape";
2901  }
2902  }
2903  }
2904  else
2905  service = "com.sun.star.drawing.PluginShape";
2906 
2907  AddShape(service);
2908 
2909  if( !mxShape.is() )
2910  return;
2911 
2912  SetLayer();
2913 
2914  if(bIsPresShape)
2915  {
2916  uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY );
2917  if(xProps.is())
2918  {
2919  uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() );
2920  if( xPropsInfo.is() )
2921  {
2922  if( !mbIsPlaceholder && xPropsInfo->hasPropertyByName("IsEmptyPresentationObject"))
2923  xProps->setPropertyValue("IsEmptyPresentationObject", css::uno::Any(false) );
2924 
2925  if( mbIsUserTransformed && xPropsInfo->hasPropertyByName("IsPlaceholderDependent"))
2926  xProps->setPropertyValue("IsPlaceholderDependent", css::uno::Any(false) );
2927  }
2928  }
2929  }
2930 
2931  // set pos, size, shear and rotate
2933  GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes );
2934 }
2935 
2936 static OUString
2937 lcl_GetMediaReference(SvXMLImport const& rImport, OUString const& rURL)
2938 {
2939  if (rImport.IsPackageURL(rURL))
2940  {
2941  return "vnd.sun.star.Package:" + rURL;
2942  }
2943  else
2944  {
2945  return rImport.GetAbsoluteReference(rURL);
2946  }
2947 }
2948 
2949 // this is called from the parent group for each unparsed attribute in the attribute list
2951 {
2952  switch( aIter.getToken() )
2953  {
2955  maMimeType = aIter.toString();
2956  break;
2957  case XML_ELEMENT(XLINK, XML_HREF):
2959  break;
2960  default:
2961  return SdXMLShapeContext::processAttribute( aIter );
2962  }
2963  return true;
2964 }
2965 
2967 {
2968  uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY );
2969 
2970  if( xProps.is() )
2971  {
2972  if ( maSize.Width && maSize.Height )
2973  {
2974  static const OUStringLiteral sVisibleArea( u"VisibleArea" );
2975  uno::Reference< beans::XPropertySetInfo > aXPropSetInfo( xProps->getPropertySetInfo() );
2976  if ( !aXPropSetInfo.is() || aXPropSetInfo->hasPropertyByName( sVisibleArea ) )
2977  {
2978  // the visual area for a plugin must be set on loading
2979  awt::Rectangle aRect( 0, 0, maSize.Width, maSize.Height );
2980  xProps->setPropertyValue( sVisibleArea, Any(aRect) );
2981  }
2982  }
2983 
2984  if( !mbMedia )
2985  {
2986  // in case we have a plugin object
2987  if( maParams.hasElements() )
2988  {
2989  xProps->setPropertyValue("PluginCommands", Any(maParams) );
2990  }
2991 
2992  if( !maMimeType.isEmpty() )
2993  {
2994  xProps->setPropertyValue("PluginMimeType", Any(maMimeType) );
2995  }
2996 
2997  if( !maHref.isEmpty() )
2998  {
2999  xProps->setPropertyValue("PluginURL", Any(maHref) );
3000  }
3001  }
3002  else
3003  {
3004  // in case we have a media object
3005  xProps->setPropertyValue( "MediaURL", uno::makeAny(maHref));
3006 
3007  xProps->setPropertyValue("MediaMimeType", uno::makeAny(maMimeType) );
3008 
3009  for( const auto& rParam : std::as_const(maParams) )
3010  {
3011  const OUString& rName = rParam.Name;
3012 
3013  if( rName == "Loop" )
3014  {
3015  OUString aValueStr;
3016  rParam.Value >>= aValueStr;
3017  xProps->setPropertyValue("Loop",
3018  uno::makeAny( aValueStr == "true" ) );
3019  }
3020  else if( rName == "Mute" )
3021  {
3022  OUString aValueStr;
3023  rParam.Value >>= aValueStr;
3024  xProps->setPropertyValue("Mute",
3025  uno::makeAny( aValueStr == "true" ) );
3026  }
3027  else if( rName == "VolumeDB" )
3028  {
3029  OUString aValueStr;
3030  rParam.Value >>= aValueStr;
3031  xProps->setPropertyValue("VolumeDB",
3032  uno::makeAny( static_cast< sal_Int16 >( aValueStr.toInt32() ) ) );
3033  }
3034  else if( rName == "Zoom" )
3035  {
3036  OUString aZoomStr;
3037  media::ZoomLevel eZoomLevel;
3038 
3039  rParam.Value >>= aZoomStr;
3040 
3041  if( aZoomStr == "25%" )
3042  eZoomLevel = media::ZoomLevel_ZOOM_1_TO_4;
3043  else if( aZoomStr == "50%" )
3044  eZoomLevel = media::ZoomLevel_ZOOM_1_TO_2;
3045  else if( aZoomStr == "100%" )
3046  eZoomLevel = media::ZoomLevel_ORIGINAL;
3047  else if( aZoomStr == "200%" )
3048  eZoomLevel = media::ZoomLevel_ZOOM_2_TO_1;
3049  else if( aZoomStr == "400%" )
3050  eZoomLevel = media::ZoomLevel_ZOOM_4_TO_1;
3051  else if( aZoomStr == "fit" )
3052  eZoomLevel = media::ZoomLevel_FIT_TO_WINDOW;
3053  else if( aZoomStr == "fixedfit" )
3054  eZoomLevel = media::ZoomLevel_FIT_TO_WINDOW_FIXED_ASPECT;
3055  else if( aZoomStr == "fullscreen" )
3056  eZoomLevel = media::ZoomLevel_FULLSCREEN;
3057  else
3058  eZoomLevel = media::ZoomLevel_NOT_AVAILABLE;
3059 
3060  xProps->setPropertyValue("Zoom", uno::makeAny( eZoomLevel ) );
3061  }
3062  }
3063  }
3064 
3065  SetThumbnail();
3066  }
3067 
3069 }
3070 
3071 css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLPluginShapeContext::createFastChildContext(
3072  sal_Int32 nElement,
3073  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
3074 {
3075  if( nElement == XML_ELEMENT(DRAW, XML_PARAM) )
3076  {
3077  OUString aParamName, aParamValue;
3078  // now parse the attribute list and look for draw:name and draw:value
3079  for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
3080  {
3081  if( aIter.getToken() == XML_ELEMENT(DRAW, XML_NAME) )
3082  aParamName = aIter.toString();
3083  else if( aIter.getToken() == XML_ELEMENT(DRAW, XML_VALUE) )
3084  aParamValue = aIter.toString();
3085  }
3086 
3087  if( !aParamName.isEmpty() )
3088  {
3089  sal_Int32 nIndex = maParams.getLength();
3090  maParams.realloc( nIndex + 1 );
3091  auto pParams = maParams.getArray();
3092  pParams[nIndex].Name = aParamName;
3093  pParams[nIndex].Handle = -1;
3094  pParams[nIndex].Value <<= aParamValue;
3095  pParams[nIndex].State = beans::PropertyState_DIRECT_VALUE;
3096  }
3097 
3098  return new SvXMLImportContext( GetImport() );
3099  }
3100 
3101  return SdXMLShapeContext::createFastChildContext( nElement, xAttrList );
3102 }
3103 
3104 
3106  const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
3107  css::uno::Reference< css::drawing::XShapes > const & rShapes)
3108 : SdXMLShapeContext( rImport, xAttrList, rShapes, false/*bTemporaryShape*/ )
3109 {
3110 }
3111 
3113 {
3114 }
3115 
3117  const css::uno::Reference< css::xml::sax::XFastAttributeList >& /*xAttrList*/)
3118 {
3119  AddShape("com.sun.star.drawing.FrameShape");
3120 
3121  if( !mxShape.is() )
3122  return;
3123 
3124  SetLayer();
3125 
3126  // set pos, size, shear and rotate
3128 
3129  uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY );
3130  if( xProps.is() )
3131  {
3132  if( !maFrameName.isEmpty() )
3133  {
3134  xProps->setPropertyValue("FrameName", Any(maFrameName) );
3135  }
3136 
3137  if( !maHref.isEmpty() )
3138  {
3139  xProps->setPropertyValue("FrameURL", Any(maHref) );
3140  }
3141  }
3142 
3143  SetStyle();
3144 
3145  GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes );
3146 }
3147 
3148 // this is called from the parent group for each unparsed attribute in the attribute list
3150 {
3151  switch( aIter.getToken() )
3152  {
3154  maFrameName = aIter.toString();
3155  break;
3156  case XML_ELEMENT(XLINK, XML_HREF):
3158  break;
3159  default:
3160  return SdXMLShapeContext::processAttribute( aIter );
3161  }
3162  return true;
3163 }
3164 
3166 {
3167  uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY );
3168 
3169  if( xProps.is() )
3170  {
3171  if ( maSize.Width && maSize.Height )
3172  {
3173  // the visual area for a floating frame must be set on loading
3174  awt::Rectangle aRect( 0, 0, maSize.Width, maSize.Height );
3175  xProps->setPropertyValue("VisibleArea", Any(aRect) );
3176  }
3177  }
3178 
3179  SetThumbnail();
3181 }
3182 
3183 
3185  const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
3186  css::uno::Reference< css::drawing::XShapes > const & rShapes,
3187  bool bTemporaryShape)
3188 : SdXMLShapeContext( rImport, xAttrList, rShapes, bTemporaryShape ),
3189  mbSupportsReplacement( false )
3190 {
3191  uno::Reference < util::XCloneable > xClone( xAttrList, uno::UNO_QUERY );
3192  if( xClone.is() )
3193  mxAttrList.set( xClone->createClone(), uno::UNO_QUERY );
3194  else
3196 }
3197 
3199 {
3200 }
3201 
3203 {
3204  const SdXMLGraphicObjectShapeContext* pSdXMLGraphicObjectShapeContext = dynamic_cast< const SdXMLGraphicObjectShapeContext* >(&rContext);
3205 
3206  if(!pSdXMLGraphicObjectShapeContext)
3207  return;
3208 
3209  try
3210  {
3211  uno::Reference< container::XChild > xChild(pSdXMLGraphicObjectShapeContext->getShape(), uno::UNO_QUERY_THROW);
3212 
3213  uno::Reference< drawing::XShapes > xParent(xChild->getParent(), uno::UNO_QUERY_THROW);
3214 
3215  // remove from parent
3216  xParent->remove(pSdXMLGraphicObjectShapeContext->getShape());
3217 
3218  // dispose
3219  uno::Reference< lang::XComponent > xComp(pSdXMLGraphicObjectShapeContext->getShape(), UNO_QUERY);
3220 
3221  if(xComp.is())
3222  {
3223  xComp->dispose();
3224  }
3225  }
3226  catch( uno::Exception& )
3227  {
3228  DBG_UNHANDLED_EXCEPTION( "xmloff", "Error in cleanup of multiple graphic object import." );
3229  }
3230 }
3231 
3232 namespace
3233 {
3234 uno::Reference<beans::XPropertySet> getGraphicPropertySetFromImportContext(const SvXMLImportContext& rContext)
3235 {
3236  uno::Reference<beans::XPropertySet> aPropertySet;
3237  const SdXMLGraphicObjectShapeContext* pSdXMLGraphicObjectShapeContext = dynamic_cast<const SdXMLGraphicObjectShapeContext*>(&rContext);
3238 
3239  if (pSdXMLGraphicObjectShapeContext)
3240  aPropertySet.set(pSdXMLGraphicObjectShapeContext->getShape(), uno::UNO_QUERY);
3241 
3242  return aPropertySet;
3243 }
3244 
3245 } // end anonymous namespace
3246 
3247 uno::Reference<graphic::XGraphic> SdXMLFrameShapeContext::getGraphicFromImportContext(const SvXMLImportContext& rContext) const
3248 {
3249  uno::Reference<graphic::XGraphic> xGraphic;
3250  try
3251  {
3252  const uno::Reference<beans::XPropertySet> xPropertySet = getGraphicPropertySetFromImportContext(rContext);
3253 
3254  if (xPropertySet.is())
3255  {
3256  xPropertySet->getPropertyValue("Graphic") >>= xGraphic;
3257  }
3258  }
3259  catch( uno::Exception& )
3260  {
3261  DBG_UNHANDLED_EXCEPTION("xmloff", "Error in cleanup of multiple graphic object import.");
3262  }
3263 
3264  return xGraphic;
3265 }
3266 
3268 {
3269  OUString aRetval;
3270  const SdXMLGraphicObjectShapeContext* pSdXMLGraphicObjectShapeContext = dynamic_cast< const SdXMLGraphicObjectShapeContext* >(&rContext);
3271 
3272  if(pSdXMLGraphicObjectShapeContext)
3273  {
3274  try
3275  {
3276  const uno::Reference< beans::XPropertySet > xPropSet(pSdXMLGraphicObjectShapeContext->getShape(), uno::UNO_QUERY_THROW);
3277 
3278  xPropSet->getPropertyValue("GraphicStreamURL") >>= aRetval;
3279  }
3280  catch( uno::Exception& )
3281  {
3282  DBG_UNHANDLED_EXCEPTION( "xmloff", "Error in cleanup of multiple graphic object import." );
3283  }
3284  }
3285 
3286  return aRetval;
3287 }
3288 
3289 css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLFrameShapeContext::createFastChildContext(
3290  sal_Int32 nElement,
3291  const uno::Reference< xml::sax::XFastAttributeList>& xAttrList )
3292 {
3293  SvXMLImportContextRef xContext;
3294  if( !mxImplContext.is() )
3295  {
3297  GetImport(), nElement, xAttrList, mxShapes, mxAttrList );
3298 
3299  xContext = pShapeContext;
3300 
3301  // propagate the hyperlink to child context
3302  if ( !msHyperlink.isEmpty() )
3303  pShapeContext->setHyperlink( msHyperlink );
3304 
3305  auto nToken = nElement & TOKEN_MASK;
3306  // Ignore gltf model if necessary and so the fallback image will be imported
3307  if( nToken == XML_PLUGIN )
3308  {
3309  SdXMLPluginShapeContext* pPluginContext = dynamic_cast<SdXMLPluginShapeContext*>(pShapeContext);
3310  if( pPluginContext && pPluginContext->getMimeType() == "model/vnd.gltf+json" )
3311  {
3312  mxImplContext = nullptr;
3313  return new SvXMLImportContext(GetImport());
3314  }
3315  }
3316 
3317  mxImplContext = xContext;
3320 
3321  if(getSupportsMultipleContents() && dynamic_cast< SdXMLGraphicObjectShapeContext* >(xContext.get()))
3322  {
3323  if ( !maShapeId.isEmpty() )
3325 
3327  }
3328  }
3329  else if(getSupportsMultipleContents() && nElement == XML_ELEMENT(DRAW, XML_IMAGE))
3330  {
3331  // read another image
3333  GetImport(), nElement, xAttrList, mxShapes, mxAttrList);
3334  mxImplContext = xContext;
3335 
3336  if(dynamic_cast< SdXMLGraphicObjectShapeContext* >(xContext.get()))
3337  {
3339  }
3340  }
3341  else if( mbSupportsReplacement && !mxReplImplContext.is() &&
3342  nElement == XML_ELEMENT(DRAW, XML_IMAGE) )
3343  {
3344  // read replacement image
3345  SvXMLImportContext *pImplContext = mxImplContext.get();
3346  SdXMLShapeContext *pSContext =
3347  dynamic_cast<SdXMLShapeContext*>( pImplContext );
3348  if( pSContext )
3349  {
3350  uno::Reference < beans::XPropertySet > xPropSet(
3351  pSContext->getShape(), uno::UNO_QUERY );
3352  if( xPropSet.is() )
3353  {
3354  xContext = new XMLReplacementImageContext( GetImport(),
3355  nElement, xAttrList, xPropSet );
3356  mxReplImplContext = xContext;
3357  }
3358  }
3359  }
3360  else if( nElement == XML_ELEMENT(SVG, XML_TITLE) || // #i68101#
3361  nElement == XML_ELEMENT(SVG_COMPAT, XML_TITLE) ||
3362  nElement == XML_ELEMENT(SVG, XML_DESC) ||
3363  nElement == XML_ELEMENT(SVG_COMPAT, XML_DESC) ||
3364  nElement == XML_ELEMENT(OFFICE, XML_EVENT_LISTENERS) ||
3365  nElement == XML_ELEMENT(DRAW, XML_GLUE_POINT) ||
3366  nElement == XML_ELEMENT(DRAW, XML_THUMBNAIL) )
3367  {
3369  { // tdf#103567 ensure props are set on surviving shape
3370  // note: no more draw:image can be added once we get here
3372  }
3373  SvXMLImportContext *pImplContext = mxImplContext.get();
3374  xContext = static_cast<SvXMLImportContext*>(dynamic_cast<SdXMLShapeContext&>(*pImplContext).createFastChildContext( nElement,
3375  xAttrList ).get());
3376  }
3377  else if ( nElement == XML_ELEMENT(DRAW, XML_IMAGE_MAP) )
3378  {
3380  { // tdf#103567 ensure props are set on surviving shape
3381  // note: no more draw:image can be added once we get here
3383  }
3384  SdXMLShapeContext *pSContext = dynamic_cast< SdXMLShapeContext* >( mxImplContext.get() );
3385  if( pSContext )
3386  {
3387  uno::Reference < beans::XPropertySet > xPropSet( pSContext->getShape(), uno::UNO_QUERY );
3388  if (xPropSet.is())
3389  {
3390  xContext = new XMLImageMapContext(GetImport(), xPropSet);
3391  }
3392  }
3393  }
3394  else if ( nElement == XML_ELEMENT(LO_EXT, XML_SIGNATURELINE) )
3395  {
3396  SdXMLShapeContext* pSContext = dynamic_cast<SdXMLShapeContext*>(mxImplContext.get());
3397  if (pSContext)
3398  {
3399  uno::Reference<beans::XPropertySet> xPropSet(pSContext->getShape(), uno::UNO_QUERY);
3400  if (xPropSet.is())
3401  {
3402  xContext = new SignatureLineContext(GetImport(), nElement, xAttrList,
3403  pSContext->getShape());
3404  }
3405  }
3406  }
3407  else if ( nElement == XML_ELEMENT(LO_EXT, XML_QRCODE))
3408  {
3409  SdXMLShapeContext* pSContext = dynamic_cast<SdXMLShapeContext*>(mxImplContext.get());
3410  if (pSContext)
3411  {
3412  uno::Reference<beans::XPropertySet> xPropSet(pSContext->getShape(), uno::UNO_QUERY);
3413  if (xPropSet.is())
3414  {
3415  xContext = new QRCodeContext(GetImport(), nElement, xAttrList,
3416  pSContext->getShape());
3417  }
3418  }
3419  }
3420 
3421  return xContext;
3422 }
3423 
3424 void SdXMLFrameShapeContext::startFastElement (sal_Int32 /*nElement*/,
3425  const css::uno::Reference< css::xml::sax::XFastAttributeList >& /*xAttrList*/)
3426 {
3427  // ignore
3428 }
3429 
3431 {
3432  // solve if multiple image child contexts were imported
3433  SvXMLImportContextRef const pSelectedContext(solveMultipleImages());
3434  const SdXMLGraphicObjectShapeContext* pShapeContext(
3435  dynamic_cast<const SdXMLGraphicObjectShapeContext*>(pSelectedContext.get()));
3436  if ( pShapeContext )
3437  {
3438  assert( mxImplContext.is() );
3439  const uno::Reference< uno::XInterface > xShape( pShapeContext->getShape() );
3441  }
3442 
3443  if( !mxImplContext.is() )
3444  {
3445  // now check if this is an empty presentation object
3447  {
3448  switch (aIter.getToken())
3449  {
3450  case XML_ELEMENT(PRESENTATION, XML_PLACEHOLDER):
3451  mbIsPlaceholder = IsXMLToken( aIter, XML_TRUE );
3452  break;
3453  case XML_ELEMENT(PRESENTATION, XML_CLASS):
3454  maPresentationClass = aIter.toString();
3455  break;
3456  default:;
3457  }
3458  }
3459 
3460  if( (!maPresentationClass.isEmpty()) && mbIsPlaceholder )
3461  {
3462  uno::Reference< xml::sax::XFastAttributeList> xEmpty;
3463 
3465 
3467  {
3468  eToken = XML_IMAGE;
3469 
3470  }
3471  else if( IsXMLToken( maPresentationClass, XML_PAGE ) )
3472  {
3473  eToken = XML_PAGE_THUMBNAIL;
3474  }
3475  else if( IsXMLToken( maPresentationClass, XML_CHART ) ||
3478  {
3479  eToken = XML_OBJECT;
3480  }
3481 
3482  auto x = XML_ELEMENT(DRAW, eToken);
3484  GetImport(), x, mxAttrList, mxShapes, xEmpty );
3485 
3486  if( mxImplContext.is() )
3487  {
3488  mxImplContext->startFastElement( x, mxAttrList );
3489  mxImplContext->endFastElement(x);
3490  }
3491  }
3492  }
3493 
3494  mxImplContext = nullptr;
3496 }
3497 
3499 {
3500  bool bId( false );
3501 
3502  switch ( aIter.getToken() )
3503  {
3504  case XML_ELEMENT(DRAW, XML_ID):
3505  case XML_ELEMENT(DRAW_EXT, XML_ID):
3506  case XML_ELEMENT(NONE, XML_ID):
3507  case XML_ELEMENT(XML, XML_ID) :
3508  bId = true;
3509  break;
3510  default:;
3511  }
3512 
3513  if ( bId )
3514  return SdXMLShapeContext::processAttribute( aIter );
3515  return true; // deliberately ignoring other attributes
3516 }
3517 
3518 
3520  SvXMLImport& rImport,
3521  const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
3522  uno::Reference< drawing::XShapes > const & rShapes)
3523 : SdXMLShapeContext( rImport, xAttrList, rShapes, false/*bTemporaryShape*/ )
3524 {
3525  // See the XMLTextFrameContext ctor, a frame has Writer content (and not
3526  // editeng) if its autostyle has a parent style. Do the same for shapes as well.
3527  for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
3528  {
3529  if (aIter.getToken() == XML_ELEMENT(DRAW, XML_STYLE_NAME))
3530  {
3531  OUString aStyleName = aIter.toString();
3532  if(!aStyleName.isEmpty())
3533  {
3535  XMLPropStyleContext* pStyle = xTxtImport->FindAutoFrameStyle(aStyleName);
3536  // Note that this an API name, so intentionally not localized.
3537  // Also allow other Frame styles with the same prefix, we just want to reject
3538  // Graphics after all.
3539  if (pStyle && pStyle->GetParentName().startsWith("Frame"))
3540  {
3541  mbTextBox = true;
3542  break;
3543  }
3544  }
3545  }
3546  }
3547 }
3548 
3550 {
3551 }
3552 
3553 // this is called from the parent group for each unparsed attribute in the attribute list
3555 {
3556  if( aIter.getToken() == XML_ELEMENT(DRAW, XML_ENGINE) )
3557  {
3558  maCustomShapeEngine = aIter.toString();
3559  }
3560  else if (aIter.getToken() == XML_ELEMENT(DRAW, XML_DATA) )
3561  {
3562  maCustomShapeData = aIter.toString();
3563  }
3564  else
3565  return SdXMLShapeContext::processAttribute( aIter );
3566  return true;
3567 }
3568 
3570  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList)
3571 {
3572  // create rectangle shape
3573  AddShape("com.sun.star.drawing.CustomShape");
3574  if ( !mxShape.is() )
3575  return;
3576 
3577  // Add, set Style and properties from base shape
3578  SetStyle();
3579  SetLayer();
3580 
3581  // set pos, size, shear and rotate
3583 
3584  try
3585  {
3586  uno::Reference< beans::XPropertySet > xPropSet( mxShape, uno::UNO_QUERY );
3587  if( xPropSet.is() )
3588  {
3589  if ( !maCustomShapeEngine.isEmpty() )
3590  {
3591  xPropSet->setPropertyValue( EASGet( EAS_CustomShapeEngine ), Any(maCustomShapeEngine) );
3592  }
3593  if ( !maCustomShapeData.isEmpty() )
3594  {
3595  xPropSet->setPropertyValue( EASGet( EAS_CustomShapeData ), Any(maCustomShapeData) );
3596  }
3597  }
3598  }
3599  catch(const uno::Exception&)
3600  {
3601  DBG_UNHANDLED_EXCEPTION( "xmloff", "setting enhanced customshape geometry" );
3602  }
3603  SdXMLShapeContext::startFastElement(nElement, xAttrList);
3604 }
3605 
3607 {
3608  // Customshapes remember mirror state in its enhanced geometry.
3609  // SetTransformation() in StartElement() may have applied mirroring, but that is not yet
3610  // contained. Merge that information here before writing the property.
3612  {
3613  basegfx::B2DVector aScale, aTranslate;
3614  double fRotate, fShearX;
3615 
3616  maUsedTransformation.decompose(aScale, aTranslate, fRotate, fShearX);
3617 
3618  if (aScale.getX() < 0.0)
3619  {
3620  static const OUStringLiteral sName(u"MirroredX");
3621  //fdo#84043 Merge, if property exists, otherwise append it
3622  auto aI = std::find_if(maCustomShapeGeometry.begin(), maCustomShapeGeometry.end(),
3623  [](beans::PropertyValue& rValue) { return rValue.Name == sName; });
3624  if (aI != maCustomShapeGeometry.end())
3625  {
3626  beans::PropertyValue& rItem = *aI;
3627  bool bMirroredX = *o3tl::doAccess<bool>(rItem.Value);
3628  rItem.Value <<= !bMirroredX;
3629  rItem.Handle = -1;
3630  rItem.State = beans::PropertyState_DIRECT_VALUE;
3631  }
3632  else
3633  {
3634  beans::PropertyValue* pItem;
3635  maCustomShapeGeometry.emplace_back();
3636  pItem = &maCustomShapeGeometry.back();
3637  pItem->Name = sName;
3638  pItem->Handle = -1;
3639  pItem->Value <<= true;
3640  pItem->State = beans::PropertyState_DIRECT_VALUE;
3641  }
3642  }
3643 
3644  if (aScale.getY() < 0.0)
3645  {
3646  static const OUStringLiteral sName(u"MirroredY");
3647  //fdo#84043 Merge, if property exists, otherwise append it
3648  auto aI = std::find_if(maCustomShapeGeometry.begin(), maCustomShapeGeometry.end(),
3649  [](beans::PropertyValue& rValue) { return rValue.Name == sName; });
3650  if (aI != maCustomShapeGeometry.end())
3651  {
3652  beans::PropertyValue& rItem = *aI;
3653  bool bMirroredY = *o3tl::doAccess<bool>(rItem.Value);
3654  rItem.Value <<= !bMirroredY;
3655  rItem.Handle = -1;
3656  rItem.State = beans::PropertyState_DIRECT_VALUE;
3657  }
3658  else
3659  {
3660  beans::PropertyValue* pItem;
3661  maCustomShapeGeometry.emplace_back();
3662  pItem = &maCustomShapeGeometry.back();
3663  pItem->Name = sName;
3664  pItem->Handle = -1;
3665  pItem->Value <<= true;
3666  pItem->State = beans::PropertyState_DIRECT_VALUE;
3667  }
3668  }
3669  }
3670 
3671  if ( !maCustomShapeGeometry.empty() )
3672  {
3673  // converting the vector to a sequence
3674  uno::Sequence< beans::PropertyValue > aSeq( comphelper::containerToSequence(maCustomShapeGeometry) );
3675 
3676  try
3677  {
3678  uno::Reference< beans::XPropertySet > xPropSet( mxShape, uno::UNO_QUERY );
3679  if( xPropSet.is() )
3680  {
3681  xPropSet->setPropertyValue( "CustomShapeGeometry", Any(aSeq) );
3682  }
3683  }
3684  catch(const uno::Exception&)
3685  {
3686  DBG_UNHANDLED_EXCEPTION( "xmloff", "setting enhanced customshape geometry" );
3687  }
3688 
3689  sal_Int32 nUPD;
3690  sal_Int32 nBuild;
3691  if (GetImport().getBuildIds(nUPD, nBuild))
3692  {
3693  if( ((nUPD >= 640 && nUPD <= 645) || (nUPD == 680)) && (nBuild <= 9221) )
3694  {
3695  Reference< drawing::XEnhancedCustomShapeDefaulter > xDefaulter( mxShape, UNO_QUERY );
3696  if( xDefaulter.is() )
3697  {
3698  xDefaulter->createCustomShapeDefaults( "" );
3699  }
3700  }
3701  }
3702  }
3703 
3705 
3706  // tdf#98163 call a custom slot to be able to reset the UNO API
3707  // implementations held on the SdrObjects of type
3708  // SdrObjCustomShape - those tend to linger until the entire file
3709  // is loaded. For large files with a lot of these, 32bit systems
3710  // may crash due to being out of resources after ca. 4200
3711  // Outliners and VirtualDevices used there as RefDevice
3712  try
3713  {
3714  uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
3715 
3716  if(xPropSet.is())
3717  {
3718  xPropSet->setPropertyValue(
3719  "FlushCustomShapeUnoApiObjects", css::uno::Any(true));
3720  }
3721  }
3722  catch(const uno::Exception&)
3723  {
3724  DBG_UNHANDLED_EXCEPTION("xmloff", "flushing after load");
3725  }
3726 }
3727 
3728 css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLCustomShapeContext::createFastChildContext(
3729  sal_Int32 nElement,
3730  const uno::Reference< xml::sax::XFastAttributeList>& xAttrList )
3731 {
3732  css::uno::Reference< css::xml::sax::XFastContextHandler > xContext;
3733  if ( nElement == XML_ELEMENT(DRAW, XML_ENHANCED_GEOMETRY) )
3734  {
3735  uno::Reference< beans::XPropertySet > xPropSet( mxShape,uno::UNO_QUERY );
3736  if ( xPropSet.is() )
3738  }
3739  // delegate to parent class if no context could be created
3740  if (!xContext)
3741  xContext = SdXMLShapeContext::createFastChildContext( nElement,
3742  xAttrList);
3743  return xContext;
3744 }
3745 
3746 SdXMLTableShapeContext::SdXMLTableShapeContext( SvXMLImport& rImport, const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList, css::uno::Reference< css::drawing::XShapes > const & rShapes )
3747 : SdXMLShapeContext( rImport, xAttrList, rShapes, false )
3748 {
3749 }
3750 
3752 {
3753 }
3754 
3756  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList)
3757 {
3758  OUString service("com.sun.star.drawing.TableShape");
3759 
3760  bool bIsPresShape = !maPresentationClass.isEmpty() && GetImport().GetShapeImport()->IsPresentationShapesSupported();
3761  if( bIsPresShape )
3762  {
3764  {
3765  service = "com.sun.star.presentation.TableShape";
3766  }
3767  }
3768 
3769  AddShape(service);
3770 
3771  if( !mxShape.is() )
3772  return;
3773 
3774  SetLayer();
3775 
3776  uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY);
3777 
3778  if(bIsPresShape && xProps.is())
3779  {
3780  uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() );
3781  if( xPropsInfo.is() )
3782  {
3783  if( !mbIsPlaceholder && xPropsInfo->hasPropertyByName("IsEmptyPresentationObject"))
3784  xProps->setPropertyValue("IsEmptyPresentationObject", css::uno::Any(false) );
3785 
3786  if( mbIsUserTransformed && xPropsInfo->hasPropertyByName("IsPlaceholderDependent"))
3787  xProps->setPropertyValue("IsPlaceholderDependent", css::uno::Any(false) );
3788  }
3789  }
3790 
3791  SetStyle();
3792 
3793  if( xProps.is() )
3794  {
3795  if( !msTemplateStyleName.isEmpty() ) try
3796  {
3797  Reference< XStyleFamiliesSupplier > xFamiliesSupp( GetImport().GetModel(), UNO_QUERY_THROW );
3798  Reference< XNameAccess > xFamilies( xFamiliesSupp->getStyleFamilies() );
3799  Reference< XNameAccess > xTableFamily( xFamilies->getByName( "table" ), UNO_QUERY_THROW );
3800  Reference< XStyle > xTableStyle( xTableFamily->getByName( msTemplateStyleName ), UNO_QUERY_THROW );
3801  xProps->setPropertyValue("TableTemplate", Any( xTableStyle ) );
3802  }
3803  catch(const Exception&)
3804  {
3805  DBG_UNHANDLED_EXCEPTION("xmloff.draw");
3806  }
3807 
3808  const XMLPropertyMapEntry* pEntry = &aXMLTableShapeAttributes[0];
3809  for( int i = 0; pEntry->msApiName && (i < 6); i++, pEntry++ )
3810  {
3811  try
3812  {
3813  const OUString sAPIPropertyName( pEntry->msApiName, pEntry->nApiNameLength, RTL_TEXTENCODING_ASCII_US );
3814  xProps->setPropertyValue( sAPIPropertyName, Any( maTemplateStylesUsed[i] ) );
3815  }
3816  catch(const Exception&)
3817  {
3818  DBG_UNHANDLED_EXCEPTION("xmloff.draw");
3819  }
3820  }
3821  }
3822 
3823  GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes );
3824 
3825  const rtl::Reference< XMLTableImport >& xTableImport( GetImport().GetShapeImport()->GetShapeTableImport() );
3826  if( xTableImport.is() && xProps.is() )
3827  {
3828  uno::Reference< table::XColumnRowRange > xColumnRowRange(
3829  xProps->getPropertyValue("Model"), uno::UNO_QUERY );
3830 
3831  if( xColumnRowRange.is() )
3832  mxTableImportContext = xTableImport->CreateTableContext( xColumnRowRange );
3833 
3834  if( mxTableImportContext.is() )
3835  mxTableImportContext->startFastElement( nElement, xAttrList );
3836  }
3837 }
3838 
3840 {
3841  if( mxTableImportContext.is() )
3842  mxTableImportContext->endFastElement(nElement);
3843 
3845 
3846  if( mxShape.is() )
3847  {
3848  // set pos, size, shear and rotate
3850  }
3851 }
3852 
3853 // this is called from the parent group for each unparsed attribute in the attribute list
3855 {
3856  auto nElement = aIter.getToken();
3857  if( IsTokenInNamespace(nElement, XML_NAMESPACE_TABLE) )
3858  {
3859  if( (nElement & TOKEN_MASK) == XML_TEMPLATE_NAME )
3860  {
3861  msTemplateStyleName = aIter.toString();
3862  }
3863  else
3864  {
3865  int i = 0;
3866  const XMLPropertyMapEntry* pEntry = &aXMLTableShapeAttributes[0];
3867  while( pEntry->msApiName && (i < 6) )
3868  {
3869  if( (nElement & TOKEN_MASK) == pEntry->meXMLName )
3870  {
3871  if( IsXMLToken( aIter, XML_TRUE ) )
3872  maTemplateStylesUsed[i] = true;
3873  break;
3874  }
3875  pEntry++;
3876  i++;
3877  }
3878  }
3879  }
3880  return SdXMLShapeContext::processAttribute( aIter );
3881 }
3882 
3883 css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLTableShapeContext::createFastChildContext(
3884  sal_Int32 nElement,
3885  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
3886 {
3888  return mxTableImportContext->createFastChildContext(nElement, xAttrList);
3889  return SdXMLShapeContext::createFastChildContext(nElement, xAttrList);
3890 }
3891 
3892 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetTransformation()
Definition: ximpshap.cxx:513
virtual bool processAttribute(const sax_fastparser::FastAttributeList::FastAttributeIter &) override
Definition: ximpshap.cxx:1336
SdXMLAppletShapeContext(SvXMLImport &rImport, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, css::uno::Reference< css::drawing::XShapes > const &rShapes)
Definition: ximpshap.cxx:2729
virtual bool processAttribute(const sax_fastparser::FastAttributeList::FastAttributeIter &) override
Definition: ximpshap.cxx:1757
bool importFromSvgPoints(B2DPolygon &o_rPoly, const OUString &rSvgPointsAttribute)
virtual ~SdXMLRectShapeContext() override
Definition: ximpshap.cxx:920
double getY() const
sal_Int32 nApiNameLength
Property-Name.
Definition: maptype.hxx:34
bool reserveIdentifier(const OUString &rIdentifier)
reserves an identifier for later registration.
OUString maLayerName
Definition: ximpshap.hxx:69
css::uno::Sequence< css::beans::PropertyValue > maParams
Definition: ximpshap.hxx:500
bool convertMeasureToCore(sal_Int32 &rValue, std::u16string_view rString, sal_Int32 nMin=SAL_MIN_INT32, sal_Int32 nMax=SAL_MAX_INT32) const
convert string to measure with meCoreMeasureUnit, using optional min and max values ...
Definition: xmluconv.cxx:186
SdXMLGraphicObjectShapeContext(SvXMLImport &rImport, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, css::uno::Reference< css::drawing::XShapes > const &rShapes)
Definition: ximpshap.cxx:2288
sal_Int32 nIndex
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: ximpshap.cxx:939
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: ximpshap.cxx:2399
sal_Int32 mnZOrder
Definition: ximpshap.hxx:67
bool mbListContextPushed
whether to restore list context (#91964#)
Definition: ximpshap.hxx:61
virtual ~SdXMLPageShapeContext() override
Definition: ximpshap.cxx:2122
SvXMLImportContextRef mxReplImplContext
Definition: ximpshap.hxx:554
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
Definition: ximpshap.cxx:3606
bool NeedsAction() const
Definition: xexptran.hxx:55
void removeGraphicFromImportContext(const SvXMLImportContext &rContext) override
helper to get the created xShape instance, needs to be overridden
Definition: ximpshap.cxx:3202
SdXMLConnectorShapeContext(SvXMLImport &rImport, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, css::uno::Reference< css::drawing::XShapes > const &rShapes, bool bTemporaryShape)
Definition: ximpshap.cxx:1717
EnhancedCustomShapeTokenEnum EASGet(const OUString &rShapeType)
css::uno::Reference< css::text::XTextCursor > mxCursor
Definition: ximpshap.hxx:48
css::uno::Reference< css::io::XOutputStream > mxBase64Stream
Definition: ximpshap.hxx:439
css::uno::Reference< css::graphic::XGraphic > getGraphicFromImportContext(const SvXMLImportContext &rContext) const override
Definition: ximpshap.cxx:3247
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: ximpshap.cxx:2545
css::uno::Reference< css::container::XIdentifierContainer > mxGluePoints
Definition: ximpshap.hxx:51
virtual ~SdXMLPluginShapeContext() override
Definition: ximpshap.cxx:2867
bool isPresentationShape() const
Definition: ximpshap.cxx:891
bool equalZero(const T &rfVal)
void B2DPolyPolygonToUnoPointSequenceSequence(const B2DPolyPolygon &rPolyPolygon, css::drawing::PointSequenceSequence &rPointSequenceSequenceRetval)
SvXMLEnumMapEntry< drawing::ConnectorType > const aXML_ConnectionKind_EnumMap[]
Definition: sdpropls.cxx:499
SdXMLCaptionShapeContext(SvXMLImport &rImport, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, css::uno::Reference< css::drawing::XShapes > const &rShapes, bool bTemporaryShape)
Definition: ximpshap.cxx:2193
virtual bool processAttribute(const sax_fastparser::FastAttributeList::FastAttributeIter &) override
Definition: ximpshap.cxx:2022
virtual ~SdXMLGraphicObjectShapeContext() override
Definition: ximpshap.cxx:2427
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
Definition: ximpshap.cxx:2381
bool mbTextBox
If the text of this shape is handled by a Writer TextFrame.
Definition: ximpshap.hxx:81
bool getSupportsMultipleContents() const
read/write access to boolean switch
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: ximpshap.cxx:3424
css::uno::Reference< css::text::XTextCursor > mxOldCursor
Definition: ximpshap.hxx:49
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: ximpshap.cxx:2741
SvXMLImport & GetImport()
Definition: xmlictxt.hxx:60
double GetWidth() const
Definition: xexptran.hxx:96
const css::uno::Reference< css::style::XStyle > & GetStyle() const
Definition: prstylei.hxx:106
virtual ~SdXMLPathShapeContext() override
Definition: ximpshap.cxx:1331
virtual ~SdXMLEllipseShapeContext() override
Definition: ximpshap.cxx:1098
OUString msTemplateStyleName
Definition: ximpshap.hxx:631
SdXMLPathShapeContext(SvXMLImport &rImport, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, css::uno::Reference< css::drawing::XShapes > const &rShapes, bool bTemporaryShape)
Definition: ximpshap.cxx:1322
sal_Int16 nId
SdXMLControlShapeContext(SvXMLImport &rImport, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, css::uno::Reference< css::drawing::XShapes > const &rShapes, bool bTemporaryShape)
Definition: ximpshap.cxx:1655
virtual ~SdXMLLineShapeContext() override
Definition: ximpshap.cxx:986
virtual ~SdXMLMeasureShapeContext() override
Definition: ximpshap.cxx:2017
bool importFromSvgD(B2DPolyPolygon &o_rPolyPoly, const OUString &rSvgDAttribute, bool bHandleRelativeNextPointCompatible, PointIndexSet *pHelpPointIndexSet)
geometry::RealPoint2D maPosition
bool IsXMLToken(std::u16string_view rString, enum XMLTokenEnum eToken)
compare eToken to the string
Definition: xmltoken.cxx:3528
css::uno::Reference< css::io::XOutputStream > GetStreamForEmbeddedObjectURLFromBase64() const
Definition: xmlimp.cxx:1355
FastAttributeList & castToFastAttributeList(const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
css::awt::Point maStart
Definition: ximpshap.hxx:319
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: ximpshap.cxx:2208
SdXMLMeasureShapeContext(SvXMLImport &rImport, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, css::uno::Reference< css::drawing::XShapes > const &rShapes, bool bTemporaryShape)
Definition: ximpshap.cxx:2006
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &AttrList) override
Definition: ximpshap.cxx:3883
virtual bool processAttribute(const sax_fastparser::FastAttributeList::FastAttributeIter &) override
Definition: ximpshap.cxx:2757
css::uno::Reference< css::graphic::XGraphic > loadGraphicByURL(OUString const &rURL)
Definition: xmlimp.cxx:1280
virtual bool processAttribute(const sax_fastparser::FastAttributeList::FastAttributeIter &) override
Definition: ximpshap.cxx:2677
static const sal_uInt16 AOO_40x
Definition: xmlimp.hxx:541
rtl::Reference< XMLTextImportHelper > const & GetTextImport()
Definition: xmlimp.hxx:599
static const sal_uInt16 LO_41x
Definition: xmlimp.hxx:550
T saturating_sub(T a, T b)
virtual bool processAttribute(const sax_fastparser::FastAttributeList::FastAttributeIter &) override
Definition: ximpshap.cxx:3149
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &AttrList) override
Definition: ximpshap.cxx:173
float x
OUString maTextStyleName
Definition: ximpshap.hxx:55
void setHyperlink(const OUString &rHyperlink)
virtual ~SdXMLObjectShapeContext() override
Definition: ximpshap.cxx:2541
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: ximpshap.cxx:2306
css::awt::Point maEnd
Definition: ximpshap.hxx:320
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: ximpshap.cxx:1021
SdXMLEllipseShapeContext(SvXMLImport &rImport, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, css::uno::Reference< css::drawing::XShapes > const &rShapes, bool bTemporaryShape)
Definition: ximpshap.cxx:1082
double get(sal_uInt16 nRow, sal_uInt16 nColumn) const
NONE
virtual ~SdXMLCustomShapeContext() override
Definition: ximpshap.cxx:3549
#define XMLERROR_API
Definition: xmlerror.hxx:71
static void convertDouble(OUStringBuffer &rBuffer, double fNumber, bool bWriteUnits, sal_Int16 nSourceUnit, sal_Int16 nTargetUnit)
void AddShape(css::uno::Reference< css::drawing::XShape > &xShape)
OUString maThumbnailURL
Definition: ximpshap.hxx:58
sal_Int16 mnRelWidth
Definition: ximpshap.hxx:73
XmlStyleFamily
Definition: families.hxx:49
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: ximpshap.cxx:1157
void setSupportsMultipleContents(bool bNew)
sal_uInt16 getGeneratorVersion() const
this checks the build ID and returns
Definition: xmlimp.cxx:1838
PropertiesInfo aProperties
virtual ~SdXMLFrameShapeContext() override
Definition: ximpshap.cxx:3198
DRAW
B2DHomMatrix createScaleShearXRotateTranslateB2DHomMatrix(double fScaleX, double fScaleY, double fShearX, double fRadiant, double fTranslateX, double fTranslateY)
SdXMLLineShapeContext(SvXMLImport &rImport, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, css::uno::Reference< css::drawing::XShapes > const &rShapes, bool bTemporaryShape)
Definition: ximpshap.cxx:973
static const sal_uInt16 OOo_34x
Definition: xmlimp.hxx:539
virtual bool processAttribute(const sax_fastparser::FastAttributeList::FastAttributeIter &) override
Definition: ximpshap.cxx:1669
#define XMLOFF_WARN_UNKNOWN(area, rIter)
Definition: xmlictxt.hxx:114
virtual ~SdXMLConnectorShapeContext() override
Definition: ximpshap.cxx:1734
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: ximpshap.cxx:3569
OUString ResolveEmbeddedObjectURL(const OUString &rURL, std::u16string_view rClassId)
Definition: xmlimp.cxx:1325
bool mbClearDefaultAttributes
Definition: ximpshap.hxx:65
Definition: txtimp.hxx:72
::comphelper::UnoInterfaceToUniqueIdentifierMapper & getInterfaceToIdentifierMapper()
Definition: xmlimp.cxx:1781
OUString maPresentationClass
Definition: ximpshap.hxx:56
const css::uno::Reference< css::drawing::XShape > & getShape() const
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &AttrList) override
Definition: ximpshap.cxx:3289
static bool ImpIsEmptyURL(std::u16string_view rURL)
Definition: ximpshap.cxx:130
bool maTemplateStylesUsed[6]
Definition: ximpshap.hxx:632
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: ximpshap.cxx:321
SdXMLShapeContext(SvXMLImport &rImport, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, css::uno::Reference< css::drawing::XShapes > const &rShapes, bool bTemporaryShape)
Definition: ximpshap.cxx:144
virtual void SAL_CALL characters(const OUString &rChars) override
This method is called for all characters that are contained in the current element.
Definition: ximpshap.cxx:2517
css::uno::Reference< css::io::XOutputStream > GetStreamForGraphicObjectURLFromBase64() const
Definition: xmlimp.cxx:1314
B2IRange fround(const B2DRange &rRange)
const char * sName
void addContent(const SvXMLImportContext &rSvXMLImportContext)
add a content to the remembered image import contexts
std::vector< css::beans::PropertyValue > maCustomShapeGeometry
Definition: ximpshap.hxx:586
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: ximpshap.cxx:3116
OUString maShapeId
Definition: ximpshap.hxx:68
css::uno::Reference< css::document::XActionLockable > mxLockable
Definition: ximpshap.hxx:52
const XMLPropertyMapEntry aXMLTableShapeAttributes[]
contains the attribute to property mapping for a drawing layer table WARNING: if attributes are added...
Definition: sdpropls.cxx:371
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: ximpshap.cxx:1505
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: ximpshap.cxx:2136
B2DHomMatrix createSourceRangeTargetRangeTransform(const B2DRange &rSourceRange, const B2DRange &rTargetRange)
void Increment(sal_Int32 nInc=1)
#define DBG_UNHANDLED_EXCEPTION(...)
SvXMLImportContextRef mxChartContext
Definition: ximpshap.hxx:413
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: ximpshap.cxx:2825
css::awt::Point maCaptionPoint
Definition: ximpshap.hxx:364
SdXMLPluginShapeContext(SvXMLImport &rImport, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, css::uno::Reference< css::drawing::XShapes > const &rShapes)
Definition: ximpshap.cxx:2859
sal_Int16 mnRelHeight
Definition: ximpshap.hxx:74
bool isClosed() const
bool mbIsUserTransformed
Definition: ximpshap.hxx:66
virtual ~SdXMLPolygonShapeContext() override
Definition: ximpshap.cxx:1246
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: ximpshap.cxx:1354
void addGluePoint(const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
Definition: ximpshap.cxx:244
int i
css::awt::Size maSize
Definition: ximpshap.hxx:72
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
Definition: ximpshap.cxx:3165
virtual void FillPropertySet(const css::uno::Reference< css::beans::XPropertySet > &rPropSet)
Definition: prstylei.cxx:222
bool getBuildIds(sal_Int32 &rUPD, sal_Int32 &rBuild) const
returns the upd and build id (f.e.
Definition: xmlimp.cxx:1818
bool IsFormsSupported() const
Definition: xmlimp.hxx:457
bool getNextToken(std::u16string_view &rToken)
Definition: xmluconv.cxx:516
void SetString(const OUString &rNew, const SvXMLUnitConverter &rConv)
Definition: xexptran.cxx:349
bool decompose(B2DTuple &rScale, B2DTuple &rTranslate, double &rRotate, double &rShearX) const
sal_Int32 mnType
bool IsPackageURL(const OUString &rURL) const
Definition: xmlimp.cxx:1232
virtual ~SdXMLTextBoxShapeContext() override
Definition: ximpshap.cxx:1483
MATH
virtual ~SdXMLFloatingFrameShapeContext() override
Definition: ximpshap.cxx:3112
const char * msApiName
Definition: maptype.hxx:33
Represents a property with its API-name, its XML-name and the type of its value.
Definition: maptype.hxx:31
float u
void scale(double fX, double fY)
css::uno::Reference< css::drawing::XShape > mxShape
void transform(const basegfx::B2DHomMatrix &rMatrix)
virtual ~SdXMLCaptionShapeContext() override
Definition: ximpshap.cxx:2204
ProgressBarHelper * GetProgressBarHelper()
Definition: xmlimp.cxx:1441
virtual ~SdXMLAppletShapeContext() override
Definition: ximpshap.cxx:2737
SvXMLImportContext(SvXMLImport &rImport)
A contexts constructor does anything that is required if an element starts.
Definition: xmlictxt.cxx:30
OUString maDrawStyleName
Definition: ximpshap.hxx:54
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: ximpshap.cxx:1250
css::uno::Type const & get()
bool isIdentity() const
css::awt::Point maStart
Definition: ximpshap.hxx:282
const Point maEnd
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: ximpshap.cxx:3071
virtual bool processAttribute(const sax_fastparser::FastAttributeList::FastAttributeIter &) override
Definition: ximpshap.cxx:3854
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
Definition: ximpshap.cxx:3430
bool registerReservedReference(const OUString &rIdentifier, const css::uno::Reference< css::uno::XInterface > &rInterface)
registers the given uno object with reserved identifier.
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
Definition: ximpshap.cxx:2966
virtual bool processAttribute(const sax_fastparser::FastAttributeList::FastAttributeIter &) override
Definition: ximpshap.cxx:1103
virtual bool processAttribute(const sax_fastparser::FastAttributeList::FastAttributeIter &) override
Definition: ximpshap.cxx:991
css::uno::Reference< css::xml::sax::XFastAttributeList > mxAttrList
Definition: ximpshap.hxx:50
void transform(const basegfx::B2DHomMatrix &rMatrix)
static SvXMLShapeContext * CreateFrameChildContext(SvXMLImport &rImport, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, css::uno::Reference< css::drawing::XShapes > const &rShapes, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xFrameAttrList)
static bool convertPercent(sal_Int32 &rValue, std::u16string_view rString)
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: ximpshap.cxx:1682
This class deliberately does not support XWeak, to improve performance when loading large documents...
Definition: xmlictxt.hxx:45
SvXMLImportContextRef solveMultipleImages()
solve multiple imported images.
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
Definition: ximpshap.cxx:2641
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: ximpshap.cxx:2060
Map an XMLTokenEnum to an enum value.
Definition: ximpshap.hxx:39
DefTokenId nToken
css::awt::Point maPosition
Definition: ximpshap.hxx:75
virtual bool processAttribute(const sax_fastparser::FastAttributeList::FastAttributeIter &) override
Definition: ximpshap.cxx:3498
SdXMLPolygonShapeContext(SvXMLImport &rImport, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, css::uno::Reference< css::drawing::XShapes > const &rShapes, bool bClosed, bool bTemporaryShape)
Definition: ximpshap.cxx:1219
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
Definition: ximpshap.cxx:2779
css::uno::Reference< css::drawing::XShapes > mxShapes
Definition: ximpshap.hxx:47
SvXMLEnumMapEntry< drawing::Alignment > const aXML_GlueAlignment_EnumMap[]
Definition: ximpshap.cxx:104
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
Definition: ximpshap.cxx:2089
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
Definition: ximpshap.cxx:3839
sal_uInt32 count() const
bool mbVisible
constexpr sal_uInt16 XML_NAMESPACE_TABLE
const OUString & GetParentName() const
Definition: xmlstyle.hxx:81
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: ximpshap.cxx:1850
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &AttrList) override
Definition: ximpshap.cxx:2523
constexpr bool IsTokenInNamespace(sal_Int32 nToken, sal_uInt16 nNamespacePrefix)
Definition: xmlimp.hxx:104
OUString GetAbsoluteReference(const OUString &rValue) const
Definition: xmlimp.cxx:1613
css::drawing::CircleKind meKind
Definition: ximpshap.hxx:172
virtual bool processAttribute(const sax_fastparser::FastAttributeList::FastAttributeIter &) override
Definition: ximpshap.cxx:2127
OUString GetStyleDisplayName(XmlStyleFamily nFamily, const OUString &rName) const
Definition: xmlimp.cxx:1415
#define SAL_WARN_IF(condition, area, stream)
virtual ~SdXMLTableShapeContext() override
Definition: ximpshap.cxx:3751
virtual bool processAttribute(const sax_fastparser::FastAttributeList::FastAttributeIter &) override
Definition: ximpshap.cxx:1229
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: ximpshap.cxx:2442
bool needFixPositionAfterZ() const
Definition: ximpshap.cxx:1738
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
Handling of tokens in XML:
virtual bool processAttribute(const sax_fastparser::FastAttributeList::FastAttributeIter &) override
Definition: ximpshap.cxx:3554
SdXMLFrameShapeContext(SvXMLImport &rImport, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, css::uno::Reference< css::drawing::XShapes > const &rShapes, bool bTemporaryShape)
Definition: ximpshap.cxx:3184
XmlStyleFamily mnStyleFamily
Definition: ximpshap.hxx:63
void SetStyle(bool bSupportsStyle=true)
if bSupportsStyle is false, auto styles will be set but not a style
Definition: ximpshap.cxx:591
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: ximpshap.cxx:2871
Point maStart
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &AttrList) override
Definition: ximpshap.cxx:2693
SdXMLRectShapeContext(SvXMLImport &rImport, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, css::uno::Reference< css::drawing::XShapes > const &rShapes, bool bTemporaryShape)
Definition: ximpshap.cxx:910
SdXMLObjectShapeContext(SvXMLImport &rImport, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, css::uno::Reference< css::drawing::XShapes > const &rShapes)
Definition: ximpshap.cxx:2534
#define XMLERROR_FLAG_ERROR
Definition: xmlerror.hxx:36
SvXMLImportContextRef mxImplContext
Definition: ximpshap.hxx:553
#define XML_ELEMENT(prefix, name)
Definition: xmlimp.hxx:97
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
Definition: ximpshap.cxx:2509
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: ximpshap.cxx:3755
virtual bool processAttribute(const sax_fastparser::FastAttributeList::FastAttributeIter &)
Definition: ximpshap.cxx:785
static bool convertEnum(EnumT &rEnum, std::u16string_view rValue, const SvXMLEnumMapEntry< EnumT > *pMap)
convert string to enum using given enum map, if the enum is not found in the map, this method will re...
Definition: xmluconv.hxx:145
const SvXMLUnitConverter & GetMM100UnitConverter() const
Definition: xmlimp.hxx:400
SvXMLEnumMapEntry< drawing::EscapeDirection > const aXML_GlueEscapeDirection_EnumMap[]
Definition: ximpshap.cxx:118
OUString getGraphicPackageURLFromImportContext(const SvXMLImportContext &rContext) const override
Definition: ximpshap.cxx:3267
XMLTokenEnum
The enumeration of all XML tokens.
Definition: xmltoken.hxx:49
void SetError(sal_Int32 nId, const css::uno::Sequence< OUString > &rMsgParams, const OUString &rExceptionMessage, const css::uno::Reference< css::xml::sax::XLocator > &rLocator)
Record an error condition that occurred during import.
Sequence< sal_Int8 > aSeq
SdXMLCustomShapeContext(SvXMLImport &rImport, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, css::uno::Reference< css::drawing::XShapes > const &rShapes)
Definition: ximpshap.cxx:3519
css::uno::Reference< css::io::XOutputStream > mxBase64Stream
Definition: ximpshap.hxx:388
void translate(double fX, double fY)
virtual bool processAttribute(const sax_fastparser::FastAttributeList::FastAttributeIter &) override
Definition: ximpshap.cxx:2265
double GetHeight() const
Definition: xexptran.hxx:97
void GetFullTransform(::basegfx::B2DHomMatrix &rFullTrans)
Definition: xexptran.cxx:482
enum::xmloff::token::XMLTokenEnum meXMLName
length of property name
Definition: maptype.hxx:35
virtual ~SdXMLControlShapeContext() override
Definition: ximpshap.cxx:1664
SdXMLPageShapeContext(SvXMLImport &rImport, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, css::uno::Reference< css::drawing::XShapes > const &rShapes, bool bTemporaryShape)
Definition: ximpshap.cxx:2112
void B2DPolyPolygonToUnoPolyPolygonBezierCoords(const B2DPolyPolygon &rPolyPolygon, css::drawing::PolyPolygonBezierCoords &rPolyPolygonBezierCoordsRetval)
double getX() const
OUString maShapeName
Definition: ximpshap.hxx:57
constexpr sal_Int32 TOKEN_MASK
Definition: xmlimp.hxx:94
#define XMLOFF_WARN_UNKNOWN_ELEMENT(area, token)
Definition: xmlictxt.hxx:120
sal_Int32 mnPageNumber
Definition: ximpshap.hxx:343
basegfx::B2DHomMatrix maUsedTransformation
Definition: ximpshap.hxx:76
css::awt::Point maEnd
Definition: ximpshap.hxx:283
SvXMLImportContextRef mxTableImportContext
Definition: ximpshap.hxx:630
SdXMLFloatingFrameShapeContext(SvXMLImport &rImport, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, css::uno::Reference< css::drawing::XShapes > const &rShapes)
Definition: ximpshap.cxx:3105
const OUString & registerReference(const css::uno::Reference< css::uno::XInterface > &rInterface)
returns a unique identifier for the given uno object.
virtual ~SdXMLShapeContext() override
Definition: ximpshap.cxx:169
static OUString lcl_GetMediaReference(SvXMLImport const &rImport, OUString const &rURL)
Definition: ximpshap.cxx:2937
virtual bool processAttribute(const sax_fastparser::FastAttributeList::FastAttributeIter &) override
Definition: ximpshap.cxx:1488
SdXMLTableShapeContext(SvXMLImport &rImport, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, css::uno::Reference< css::drawing::XShapes > const &rShapes)
Definition: ximpshap.cxx:3746
bool areControlPointsUsed() const
XMLTokenEnum eToken
Definition: xmltoken.cxx:40
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &AttrList) override
Definition: ximpshap.cxx:3728
virtual bool processAttribute(const sax_fastparser::FastAttributeList::FastAttributeIter &) override
Definition: ximpshap.cxx:925
double GetX() const
Definition: xexptran.hxx:94
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
Definition: ximpshap.cxx:327
double GetY() const
Definition: xexptran.hxx:95
virtual bool processAttribute(const sax_fastparser::FastAttributeList::FastAttributeIter &) override
Definition: ximpshap.cxx:2297
SvXMLEnumMapEntry< drawing::CircleKind > const aXML_CircleKind_EnumMap[]
Definition: sdpropls.cxx:571
SdXMLChartShapeContext(SvXMLImport &rImport, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, css::uno::Reference< css::drawing::XShapes > const &rShapes, bool bTemporaryShape)
Definition: ximpshap.cxx:2433
virtual bool processAttribute(const sax_fastparser::FastAttributeList::FastAttributeIter &) override
Definition: ximpshap.cxx:2950
SdXMLImExTransform2D mnTransform
Definition: ximpshap.hxx:71
sal_uInt16 nPos
css::drawing::ConnectorType mnType
Definition: ximpshap.hxx:286
css::uno::Sequence< css::beans::PropertyValue > maParams
Definition: ximpshap.hxx:470
::basegfx::B2IVector maSize
rtl::Reference< XMLShapeImportHelper > const & GetShapeImport()
Definition: xmlimp.hxx:607
SdXMLTextBoxShapeContext(SvXMLImport &rImport, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, css::uno::Reference< css::drawing::XShapes > const &rShapes)
Definition: ximpshap.cxx:1473
sal_uInt32 count() const
const OUString & getMimeType() const
Definition: ximpshap.hxx:520
OUString maCustomShapeEngine
Definition: ximpshap.hxx:583
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo