LibreOffice Module oox (master)  1
shape.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 <oox/drawingml/shape.hxx>
22 #include <oox/drawingml/theme.hxx>
28 #include "effectproperties.hxx"
30 #include <drawingml/textbody.hxx>
37 #include <o3tl/safeint.hxx>
38 #include <o3tl/unit_conversion.hxx>
39 #include <oox/ppt/pptimport.hxx>
40 #include <oox/vml/vmldrawing.hxx>
41 #include <oox/vml/vmlshape.hxx>
48 #include <oox/mathml/import.hxx>
49 #include <oox/token/properties.hxx>
50 #include "diagram/datamodel.hxx"
51 
52 #include <comphelper/classids.hxx>
55 #include <comphelper/sequence.hxx>
56 #include <tools/diagnose_ex.h>
57 #include <tools/gen.hxx>
58 #include <tools/globname.hxx>
59 #include <tools/mapunit.hxx>
60 #include <tools/UnitConversion.hxx>
61 #include <editeng/unoprnms.hxx>
62 #include <com/sun/star/awt/Size.hpp>
63 #include <com/sun/star/awt/XBitmap.hpp>
64 #include <com/sun/star/awt/FontWeight.hpp>
65 #include <com/sun/star/graphic/XGraphic.hpp>
66 #include <com/sun/star/container/XNamed.hpp>
67 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
68 #include <com/sun/star/xml/dom/XDocument.hpp>
69 #include <com/sun/star/xml/sax/XFastSAXSerializable.hpp>
70 #include <com/sun/star/drawing/FillStyle.hpp>
71 #include <com/sun/star/drawing/HomogenMatrix3.hpp>
72 #include <com/sun/star/drawing/TextVerticalAdjust.hpp>
73 #include <com/sun/star/drawing/GraphicExportFilter.hpp>
74 #include <com/sun/star/drawing/XShapes.hpp>
75 #include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
76 #include <com/sun/star/drawing/EnhancedCustomShapeTextPathMode.hpp>
77 #include <com/sun/star/embed/XEmbeddedObject.hpp>
78 #include <com/sun/star/text/XText.hpp>
79 #include <com/sun/star/table/BorderLine2.hpp>
80 #include <com/sun/star/table/ShadowFormat.hpp>
81 #include <com/sun/star/chart2/XChartDocument.hpp>
82 #include <com/sun/star/style/ParagraphAdjust.hpp>
83 #include <com/sun/star/io/XOutputStream.hpp>
84 
89 #include <com/sun/star/document/XActionLockable.hpp>
90 #include <com/sun/star/chart2/data/XDataReceiver.hpp>
91 #include <svx/svdtrans.hxx>
92 #include <tools/stream.hxx>
93 #include <unotools/streamwrap.hxx>
94 #include <unotools/fltrcfg.hxx>
95 #include <vcl/graph.hxx>
96 #include <vcl/graphicfilter.hxx>
97 #include <vcl/svapp.hxx>
98 #include <vcl/wmfexternal.hxx>
99 #include <sal/log.hxx>
100 #include <svx/unoapi.hxx>
101 #include <svx/unoshape.hxx>
102 #include <svx/sdtaitm.hxx>
103 
104 using namespace ::oox::core;
105 using namespace ::com::sun::star;
106 using namespace ::com::sun::star::uno;
107 using namespace ::com::sun::star::beans;
108 using namespace ::com::sun::star::frame;
109 using namespace ::com::sun::star::text;
110 using namespace ::com::sun::star::drawing;
111 using namespace ::com::sun::star::style;
112 
113 namespace oox::drawingml {
114 
115 Shape::Shape( const char* pServiceName, bool bDefaultHeight )
116 : mpLinePropertiesPtr( std::make_shared<LineProperties>() )
117 , mpShapeRefLinePropPtr( std::make_shared<LineProperties>() )
118 , mpFillPropertiesPtr( std::make_shared<FillProperties>() )
119 , mpShapeRefFillPropPtr( std::make_shared<FillProperties>() )
120 , mpGraphicPropertiesPtr( std::make_shared<GraphicProperties>() )
121 , mpCustomShapePropertiesPtr( std::make_shared<CustomShapeProperties>() )
122 , mp3DPropertiesPtr( std::make_shared<Shape3DProperties>() )
123 , mpEffectPropertiesPtr( std::make_shared<EffectProperties>() )
124 , mpShapeRefEffectPropPtr( std::make_shared<EffectProperties>() )
125 , mpMasterTextListStyle( std::make_shared<TextListStyle>() )
126 , mnSubType( 0 )
127 , meFrameType( FRAMETYPE_GENERIC )
128 , mnRotation( 0 )
129 , mnDiagramRotation( 0 )
130 , mbFlipH( false )
131 , mbFlipV( false )
132 , mbHidden( false )
133 , mbHiddenMasterShape( false )
134 , mbLocked( false )
135 , mbLockedCanvas( false )
136 , mbWps( false )
137 , mbTextBox( false )
138 , mbHasLinkedTxbx( false )
139 , maDiagramDoms( 0 )
140 {
141  if ( pServiceName )
142  msServiceName = OUString::createFromAscii( pServiceName );
143  setDefaults(bDefaultHeight);
144 }
145 
146 Shape::Shape( const ShapePtr& pSourceShape )
147 : maChildren()
148 , mpTextBody(pSourceShape->mpTextBody)
149 , mpLinePropertiesPtr( pSourceShape->mpLinePropertiesPtr )
150 , mpShapeRefLinePropPtr( pSourceShape->mpShapeRefLinePropPtr )
151 , mpFillPropertiesPtr( pSourceShape->mpFillPropertiesPtr )
152 , mpShapeRefFillPropPtr( pSourceShape->mpShapeRefFillPropPtr )
153 , mpGraphicPropertiesPtr( pSourceShape->mpGraphicPropertiesPtr )
154 , mpCustomShapePropertiesPtr( pSourceShape->mpCustomShapePropertiesPtr )
155 , mpTablePropertiesPtr( pSourceShape->mpTablePropertiesPtr )
156 , mp3DPropertiesPtr( pSourceShape->mp3DPropertiesPtr )
157 , mpEffectPropertiesPtr (pSourceShape->mpEffectPropertiesPtr)
158 , mpShapeRefEffectPropPtr(pSourceShape->mpShapeRefEffectPropPtr)
159 , maShapeProperties( pSourceShape->maShapeProperties )
160 , mpMasterTextListStyle( pSourceShape->mpMasterTextListStyle )
161 , mxShape()
162 , msServiceName( pSourceShape->msServiceName )
163 , msName( pSourceShape->msName )
164 , msInternalName( pSourceShape->msInternalName )
165 , msId( pSourceShape->msId )
166 , mnSubType( pSourceShape->mnSubType )
167 , moSubTypeIndex( pSourceShape->moSubTypeIndex )
168 , maShapeStyleRefs( pSourceShape->maShapeStyleRefs )
169 , maSize( pSourceShape->maSize )
170 , maPosition( pSourceShape->maPosition )
171 , meFrameType( pSourceShape->meFrameType )
172 , mnRotation( pSourceShape->mnRotation )
173 , mnDiagramRotation( pSourceShape->mnDiagramRotation )
174 , mbFlipH( pSourceShape->mbFlipH )
175 , mbFlipV( pSourceShape->mbFlipV )
176 , mbHidden( pSourceShape->mbHidden )
177 , mbHiddenMasterShape( pSourceShape->mbHiddenMasterShape )
178 , mbLocked( pSourceShape->mbLocked )
179 , mbLockedCanvas( pSourceShape->mbLockedCanvas )
180 , mbWps( pSourceShape->mbWps )
181 , mbTextBox( pSourceShape->mbTextBox )
182 , maLinkedTxbxAttr()
183 , mbHasLinkedTxbx(false)
184 , maDiagramDoms( pSourceShape->maDiagramDoms )
185 , mnZOrder(pSourceShape->mnZOrder)
186 , mnZOrderOff(pSourceShape->mnZOrderOff)
187 , mnDataNodeType(pSourceShape->mnDataNodeType)
188 , mfAspectRatio(pSourceShape->mfAspectRatio)
189 , mbUseBgFill(pSourceShape->mbUseBgFill)
190 , maDiagramFontHeights(pSourceShape->maDiagramFontHeights)
191 {}
192 
194 {
195 }
196 
198 {
199  if ( !mpTablePropertiesPtr )
200  mpTablePropertiesPtr = std::make_shared<table::TableProperties>();
201  return mpTablePropertiesPtr;
202 }
203 
204 void Shape::setDefaults(bool bHeight)
205 {
206  maDefaultShapeProperties.setProperty(PROP_TextAutoGrowHeight, false);
207  maDefaultShapeProperties.setProperty(PROP_TextWordWrap, true);
208  maDefaultShapeProperties.setProperty(PROP_TextLeftDistance, static_cast< sal_Int32 >( 250 ));
209  maDefaultShapeProperties.setProperty(PROP_TextUpperDistance, static_cast< sal_Int32 >( 125 ));
210  maDefaultShapeProperties.setProperty(PROP_TextRightDistance, static_cast< sal_Int32 >( 250 ));
211  maDefaultShapeProperties.setProperty(PROP_TextLowerDistance, static_cast< sal_Int32 >( 125 ));
212  if (bHeight)
213  maDefaultShapeProperties.setProperty(PROP_CharHeight, static_cast< float >( 18.0 ));
214  maDefaultShapeProperties.setProperty(PROP_TextVerticalAdjust, TextVerticalAdjust_TOP);
215  maDefaultShapeProperties.setProperty(PROP_ParaAdjust,
216  static_cast<sal_Int16>(ParagraphAdjust_LEFT));
217 }
218 
220 {
221  OSL_ENSURE( meFrameType == FRAMETYPE_GENERIC, "Shape::setOleObjectType - multiple frame types" );
223  mxOleObjectInfo = std::make_shared<::oox::vml::OleObjectInfo>( true );
224  return *mxOleObjectInfo;
225 }
226 
227 ChartShapeInfo& Shape::setChartType( bool bEmbedShapes )
228 {
229  OSL_ENSURE( meFrameType == FRAMETYPE_GENERIC, "Shape::setChartType - multiple frame types" );
231  if (mbWps)
232  msServiceName = "com.sun.star.drawing.temporaryForXMLImportOLE2Shape";
233  else
234  msServiceName = "com.sun.star.drawing.OLE2Shape";
235  mxChartShapeInfo = std::make_shared<ChartShapeInfo>( bEmbedShapes );
236  return *mxChartShapeInfo;
237 }
238 
240 {
241  OSL_ENSURE( meFrameType == FRAMETYPE_GENERIC, "Shape::setDiagramType - multiple frame types" );
243  msServiceName = "com.sun.star.drawing.GroupShape";
244  mnSubType = 0;
245 }
246 
248 {
249  OSL_ENSURE( meFrameType == FRAMETYPE_GENERIC, "Shape::setTableType - multiple frame types" );
251  msServiceName = "com.sun.star.drawing.TableShape";
252  mnSubType = 0;
253 }
254 
255 void Shape::setServiceName( const char* pServiceName )
256 {
257  if ( pServiceName )
258  msServiceName = OUString::createFromAscii( pServiceName );
259 }
260 
261 const ShapeStyleRef* Shape::getShapeStyleRef( sal_Int32 nRefType ) const
262 {
263  ShapeStyleRefMap::const_iterator aIt = maShapeStyleRefs.find( nRefType );
264  return (aIt == maShapeStyleRefs.end()) ? nullptr : &aIt->second;
265 }
266 
268  ::oox::core::XmlFilterBase& rFilterBase,
269  const Theme* pTheme,
270  const Reference< XShapes >& rxShapes,
271  const basegfx::B2DHomMatrix& aTransformation,
272  FillProperties& rShapeOrParentShapeFillProps,
273  ShapeIdMap* pShapeMap,
274  oox::drawingml::ShapePtr pParentGroupShape)
275 {
276  SAL_INFO("oox.drawingml", "Shape::addShape: id='" << msId << "'");
277 
278  try
279  {
280  OUString sServiceName( msServiceName );
281  if( !sServiceName.isEmpty() )
282  {
283  basegfx::B2DHomMatrix aMatrix( aTransformation );
284  Reference< XShape > xShape( createAndInsert( rFilterBase, sServiceName, pTheme, rxShapes, false, false, aMatrix, rShapeOrParentShapeFillProps, pParentGroupShape) );
285 
286  if( pShapeMap && !msId.isEmpty() )
287  {
288  (*pShapeMap)[ msId ] = shared_from_this();
289  }
290 
291  // if this is a group shape, we have to add also each child shape
292  Reference< XShapes > xShapes( xShape, UNO_QUERY );
293  if ( xShapes.is() )
294  addChildren( rFilterBase, *this, pTheme, xShapes, pShapeMap, aMatrix );
295 
297  {
299  if( !SvtFilterOptions::Get().IsSmartArt2Shape() )
300  convertSmartArtToMetafile( rFilterBase );
301  }
302 
303  NamedShapePairs* pNamedShapePairs = rFilterBase.getDiagramFontHeights();
304  if (xShape.is() && pNamedShapePairs)
305  {
306  auto itPairs = pNamedShapePairs->find(getInternalName());
307  if (itPairs != pNamedShapePairs->end())
308  {
309  auto it = itPairs->second.find(shared_from_this());
310  if (it != itPairs->second.end())
311  {
312  // Our drawingml::Shape is in the list of an internal name, remember the now
313  // inserted XShape.
314  it->second = xShape;
315  }
316  }
317  }
318  }
319  }
320  catch( const Exception& )
321  {
322  TOOLS_WARN_EXCEPTION( "oox.drawingml", "Shape::addShape" );
323  }
324 }
325 
326 void Shape::setLockedCanvas(bool bLockedCanvas)
327 {
328  mbLockedCanvas = bLockedCanvas;
329 }
330 
331 void Shape::setWps(bool bWps)
332 {
333  mbWps = bWps;
334 }
335 
336 void Shape::setTextBox(bool bTextBox)
337 {
338  mbTextBox = bTextBox;
339 }
340 
341 void Shape::applyShapeReference( const Shape& rReferencedShape, bool bUseText )
342 {
343  SAL_INFO("oox.drawingml", "Shape::applyShapeReference: apply '" << rReferencedShape.msId << "' to '" << msId << "'");
344 
345  if ( rReferencedShape.mpTextBody && bUseText )
346  mpTextBody = std::make_shared<TextBody>( *rReferencedShape.mpTextBody );
347  else
348  mpTextBody.reset();
349  maShapeProperties = rReferencedShape.maShapeProperties;
350  mpShapeRefLinePropPtr = std::make_shared<LineProperties>( rReferencedShape.getActualLineProperties(nullptr) );
351  mpShapeRefFillPropPtr = std::make_shared<FillProperties>( rReferencedShape.getActualFillProperties(nullptr, nullptr) );
352  mpCustomShapePropertiesPtr = std::make_shared<CustomShapeProperties>( *rReferencedShape.mpCustomShapePropertiesPtr );
353  mpTablePropertiesPtr = rReferencedShape.mpTablePropertiesPtr ? std::make_shared<table::TableProperties>( *rReferencedShape.mpTablePropertiesPtr ) : nullptr;
354  mpShapeRefEffectPropPtr = std::make_shared<EffectProperties>( rReferencedShape.getActualEffectProperties(nullptr) );
355  mpMasterTextListStyle = std::make_shared<TextListStyle>( *rReferencedShape.mpMasterTextListStyle );
356  maSize = rReferencedShape.maSize;
357  maPosition = rReferencedShape.maPosition;
358  mnRotation = rReferencedShape.mnRotation;
359  mbFlipH = rReferencedShape.mbFlipH;
360  mbFlipV = rReferencedShape.mbFlipV;
361  mbHidden = rReferencedShape.mbHidden;
362  mbLocked = rReferencedShape.mbLocked;
363 }
364 
365 namespace {
366 
367 struct ActionLockGuard
368 {
369  explicit ActionLockGuard(Reference<drawing::XShape> const& xShape)
370  : m_xLockable(xShape, UNO_QUERY)
371  {
372  if (m_xLockable.is()) {
373  m_xLockable->addActionLock();
374  }
375  }
376  ~ActionLockGuard()
377  {
378  if (m_xLockable.is()) {
379  m_xLockable->removeActionLock();
380  }
381  }
382 private:
383  Reference<document::XActionLockable> m_xLockable;
384 };
385 
386 }
387 
388 // for group shapes, the following method is also adding each child
390  XmlFilterBase& rFilterBase,
391  Shape& rMaster,
392  const Theme* pTheme,
393  const Reference< XShapes >& rxShapes,
394  ShapeIdMap* pShapeMap,
395  const basegfx::B2DHomMatrix& aTransformation )
396 {
397  for (auto const& child : rMaster.maChildren)
398  {
399  child->setMasterTextListStyle( mpMasterTextListStyle );
400  child->addShape( rFilterBase, pTheme, rxShapes, aTransformation, getFillProperties(), pShapeMap, rMaster.shared_from_this());
401  }
402 }
403 
404 static void lcl_resetPropertyValue( std::vector<beans::PropertyValue>& rPropVec, const OUString& rName )
405 {
406  auto aIterator = std::find_if( rPropVec.begin(), rPropVec.end(),
407  [rName]( const beans::PropertyValue& rValue ) { return rValue.Name == rName; } );
408 
409  if (aIterator != rPropVec.end())
410  rPropVec.erase( aIterator );
411 }
412 
413 static void lcl_setPropertyValue( std::vector<beans::PropertyValue>& rPropVec,
414  const OUString& rName,
415  const beans::PropertyValue& rPropertyValue )
416 {
417  lcl_resetPropertyValue( rPropVec, rName );
418 
419  rPropVec.push_back( rPropertyValue );
420 }
421 
422 static SdrTextHorzAdjust lcl_convertAdjust( ParagraphAdjust eAdjust )
423 {
424  if (eAdjust == ParagraphAdjust_LEFT)
425  return SDRTEXTHORZADJUST_LEFT;
426  else if (eAdjust == ParagraphAdjust_RIGHT)
428  else if (eAdjust == ParagraphAdjust_CENTER)
430  return SDRTEXTHORZADJUST_LEFT;
431 }
432 
433 static void lcl_createPresetShape(const uno::Reference<drawing::XShape>& xShape,
434  const OUString& rClass, const OUString& rPresetType,
435  const CustomShapePropertiesPtr& pCustomShapePropertiesPtr,
436  const TextBodyPtr& pTextBody,
437  const GraphicHelper& rGraphicHelper)
438 {
439  if (!xShape.is() || !pCustomShapePropertiesPtr || !pTextBody)
440  return;
441 
442  uno::Reference<drawing::XEnhancedCustomShapeDefaulter> xDefaulter( xShape,
443  uno::UNO_QUERY );
444 
445  if (!xDefaulter.is() || rClass.isEmpty())
446  return;
447 
448  Reference<XPropertySet> xSet( xShape, UNO_QUERY );
449  if (!xSet.is())
450  return;
451 
452  // The DrawingML shapes from the presetTextWarpDefinitions are mapped to the definitions
453  // in svx/../EnhancedCustomShapeGeometry.cxx, which are used for WordArt shapes from
454  // binary MS Office. Therefore all adjustment values need to be adapted.
455  auto aAdjGdList = pCustomShapePropertiesPtr->getAdjustmentGuideList();
457  !aAdjGdList.empty() ? aAdjGdList.size() : 1 );
458 
459  int nIndex = 0;
460  for (const auto& aEntry : aAdjGdList)
461  {
462  double fValue = aEntry.maFormula.toDouble();
463  // then: polar-handle, else: XY-handle
464  // There exist only 8 polar-handles at all in presetTextWarp.
465  if ((rClass == "fontwork-arch-down-curve")
466  || (rClass == "fontwork-arch-down-pour" && aEntry.maName == "adj1")
467  || (rClass == "fontwork-arch-up-curve")
468  || (rClass == "fontwork-arch-up-pour" && aEntry.maName == "adj1")
469  || (rClass == "fontwork-open-circle-curve")
470  || (rClass == "fontwork-open-circle-pour" && aEntry.maName == "adj1")
471  || (rClass == "fontwork-circle-curve")
472  || (rClass == "fontwork-circle-pour" && aEntry.maName == "adj1"))
473  {
474  // DrawingML has 1/60000 degree unit, but WordArt simple degree. Range [0..360[
475  // or range ]-180..180] doesn't matter, because only cos(angle) and
476  // sin(angle) are used.
477  fValue = NormAngle360(fValue / 60000.0);
478  }
479  else
480  {
481  // DrawingML writes adjustment guides as relative value with 100% = 100000,
482  // but WordArt definitions use values absolute in viewBox 0 0 21600 21600,
483  // so scale with 21600/100000 = 0.216, with two exceptions:
484  // X-handles of waves describe increase/decrease relative to horizontal center.
485  // The gdRefR of pour-shapes is not relative to viewBox but to radius.
486  if ((rClass == "mso-spt158" && aEntry.maName == "adj2") // textDoubleWave1
487  || (rClass == "fontwork-wave" && aEntry.maName == "adj2") // textWave1
488  || (rClass == "mso-spt157" && aEntry.maName == "adj2") // textWave2
489  || (rClass == "mso-spt159" && aEntry.maName == "adj2")) // textWave4
490  {
491  fValue = (fValue + 50000.0) * 0.216;
492  }
493  else if ( (rClass == "fontwork-arch-down-pour" && aEntry.maName == "adj2")
494  || (rClass == "fontwork-arch-up-pour" && aEntry.maName == "adj2")
495  || (rClass == "fontwork-open-circle-pour" && aEntry.maName == "adj2")
496  || (rClass == "fontwork-circle-pour" && aEntry.maName == "adj2"))
497  {
498  fValue *= 0.108;
499  }
500  else
501  {
502  fValue *= 0.216;
503  }
504  }
505 
506  aAdjustment[nIndex].Value <<= fValue;
507  aAdjustment[nIndex++].State = css::beans::PropertyState_DIRECT_VALUE;
508  }
509 
510  // Set properties
511  xSet->setPropertyValue( UNO_NAME_TEXT_AUTOGROWHEIGHT, uno::makeAny( false ) );
512  xSet->setPropertyValue( UNO_NAME_TEXT_AUTOGROWWIDTH, uno::makeAny( false ) );
513  xSet->setPropertyValue( UNO_NAME_FILLSTYLE, uno::makeAny( drawing::FillStyle_SOLID ) );
514 
515  // ToDo: Old binary WordArt does not allow different styles for different paragraphs, so it
516  // was not necessary to examine all paragraphs. Solution for DrawingML is needed.
517  // Currently different alignment of paragraphs are lost, for example.
518  const TextParagraphVector& rParagraphs = pTextBody->getParagraphs();
519  if (!rParagraphs.empty() && !rParagraphs[0]->getRuns().empty())
520  {
521  std::shared_ptr<TextParagraph> pParagraph = rParagraphs[0];
522  std::shared_ptr<TextRun> pRun = pParagraph->getRuns()[0];
523  TextCharacterProperties& pProperties = pRun->getTextCharacterProperties();
524 
525  if (pProperties.moBold.has() && pProperties.moBold.get())
526  {
527  xSet->setPropertyValue( UNO_NAME_CHAR_WEIGHT, uno::makeAny( css::awt::FontWeight::BOLD ) );
528  }
529  if (pProperties.moItalic.has() && pProperties.moItalic.get())
530  {
531  xSet->setPropertyValue( UNO_NAME_CHAR_POSTURE, uno::makeAny( css::awt::FontSlant::FontSlant_ITALIC ) );
532  }
533  if (pProperties.moHeight.has())
534  {
535  sal_Int32 nHeight = pProperties.moHeight.get() / 100;
536  xSet->setPropertyValue( UNO_NAME_CHAR_HEIGHT, uno::makeAny( nHeight ) );
537  }
538  if (pProperties.maFillProperties.maFillColor.isUsed())
539  {
540  const sal_Int32 aFillColor = static_cast<sal_Int32>(
541  pProperties.maFillProperties.maFillColor.getColor( rGraphicHelper ).GetRGBColor() );
542  xSet->setPropertyValue( UNO_NAME_FILLCOLOR, uno::makeAny( aFillColor ) );
543  }
544  else
545  {
546  // Set default color
547  xSet->setPropertyValue( UNO_NAME_FILLCOLOR, uno::makeAny( COL_BLACK ) );
548  }
549  {
550  ParagraphAdjust eAdjust = ParagraphAdjust_LEFT;
551  if (pParagraph->getProperties().getParaAdjust())
552  eAdjust = *pParagraph->getProperties().getParaAdjust();
553  xSet->setPropertyValue( "ParaAdjust", uno::makeAny( eAdjust ) );
554  SdrObject* pShape = SdrObject::getSdrObjectFromXShape( xShape );
555  assert(pShape);
556  SdrTextHorzAdjust eHorzAdjust = lcl_convertAdjust( eAdjust );
557  pShape->SetMergedItem( SdrTextHorzAdjustItem( eHorzAdjust ) );
558  }
559  }
560 
561  // Apply vertical adjustment for text on arc
562  // ToDo: The property is currently not evaluated.
564  assert(pShape);
565  if (rClass == "fontwork-arch-up-curve")
566  pShape->SetMergedItem( SdrTextVertAdjustItem( SdrTextVertAdjust::SDRTEXTVERTADJUST_BOTTOM ) );
567  else if (rClass == "fontwork-arch-down-curve")
568  pShape->SetMergedItem( SdrTextVertAdjustItem( SdrTextVertAdjust::SDRTEXTVERTADJUST_TOP ) );
569 
570  // Apply preset shape
571  xDefaulter->createCustomShapeDefaults( rClass );
572 
573  auto aGeomPropSeq = xSet->getPropertyValue( "CustomShapeGeometry" )
574  .get<uno::Sequence<beans::PropertyValue>>();
575  auto aGeomPropVec
576  = comphelper::sequenceToContainer<std::vector<beans::PropertyValue>>(
577  aGeomPropSeq );
578 
579  // Reset old properties
580  static const OUStringLiteral sTextPath( u"TextPath" );
581  static const OUStringLiteral sAdjustmentValues( u"AdjustmentValues" );
582  static const OUStringLiteral sPresetTextWarp( u"PresetTextWarp" );
583 
584  lcl_resetPropertyValue( aGeomPropVec, "CoordinateSize" );
585  lcl_resetPropertyValue( aGeomPropVec, "Equations" );
586  lcl_resetPropertyValue( aGeomPropVec, "Path" );
587  lcl_resetPropertyValue( aGeomPropVec, sAdjustmentValues);
588 
589  bool bFromWordArt(false);
590  pTextBody->getTextProperties().maPropertyMap.getProperty(PROP_FromWordArt) >>= bFromWordArt;
591 
592  bool bScaleX(false);
593  if (!bFromWordArt
594  && (rPresetType == "textArchDown" || rPresetType == "textArchUp"
595  || rPresetType == "textCircle" || rPresetType == "textButton"))
596  {
597  bScaleX = true;
598  }
599 
600  // Apply geometry properties
601  uno::Sequence<beans::PropertyValue> aPropertyValues(
603  { { sTextPath, uno::makeAny( true ) },
604  { "TextPathMode",
605  uno::Any( drawing::EnhancedCustomShapeTextPathMode_PATH ) },
606  { "ScaleX", uno::Any(bScaleX) } } ) );
607 
608  lcl_setPropertyValue( aGeomPropVec, sTextPath,
609  comphelper::makePropertyValue( sTextPath, aPropertyValues ) );
610 
611  lcl_setPropertyValue( aGeomPropVec, sPresetTextWarp,
612  comphelper::makePropertyValue( sPresetTextWarp, rPresetType ) );
613 
614  if (!aAdjGdList.empty())
615  {
616  lcl_setPropertyValue( aGeomPropVec, sAdjustmentValues,
617  comphelper::makePropertyValue( sAdjustmentValues, aAdjustment ) );
618  }
619 
620  xSet->setPropertyValue(
621  "CustomShapeGeometry",
622  uno::makeAny(comphelper::containerToSequence(aGeomPropVec)));
623 }
624 
625 // Some helper methods for createAndInsert
626 namespace
627 {
628 // mirrors aTransformation at its center axis
629 // only valid if neither rotation or shear included
630 void lcl_mirrorAtCenter(basegfx::B2DHomMatrix& aTransformation, bool bFlipH, bool bFlipV)
631 {
632  if (!bFlipH && !bFlipV)
633  return;
634  basegfx::B2DPoint aCenter(0.5, 0.5);
635  aCenter *= aTransformation;
636  aTransformation.translate(-aCenter);
637  aTransformation.scale(bFlipH ? -1.0 : 1.0, bFlipV ? -1.0 : 1.0);
638  aTransformation.translate(aCenter);
639  return;
640 }
641 
642 // only valid if neither rotation or shear included
643 void lcl_doSpecialMSOWidthHeightToggle(basegfx::B2DHomMatrix& aTransformation)
644 {
645  // The values are directly set at the matrix without any matrix multiplication.
646  // That way it is valid for lines too. Those have zero width or height.
647  const double fSx(aTransformation.get(0, 0));
648  const double fSy(aTransformation.get(1, 1));
649  const double fTx(aTransformation.get(0, 2));
650  const double fTy(aTransformation.get(1, 2));
651  aTransformation.set(0, 0, fSy);
652  aTransformation.set(1, 1, fSx);
653  aTransformation.set(0, 2, fTx + 0.5 * (fSx - fSy));
654  aTransformation.set(1, 2, fTy + 0.5 * (fSy - fSx));
655  return;
656 }
657 
658 void lcl_RotateAtCenter(basegfx::B2DHomMatrix& aTransformation, const sal_Int32& rMSORotationAngle)
659 {
660  if (rMSORotationAngle == 0)
661  return;
662  double fRad = basegfx::deg2rad(rMSORotationAngle / 60000.0);
663  basegfx::B2DPoint aCenter(0.5, 0.5);
664  aCenter *= aTransformation;
665  aTransformation.translate(-aCenter);
666  aTransformation.rotate(fRad);
667  aTransformation.translate(aCenter);
668  return;
669 }
670 }
671 
673  ::oox::core::XmlFilterBase& rFilterBase,
674  const OUString& rServiceName,
675  const Theme* pTheme,
676  const css::uno::Reference< css::drawing::XShapes >& rxShapes,
677  bool bClearText,
678  bool bDoNotInsertEmptyTextBody,
679  basegfx::B2DHomMatrix& aParentTransformation,
680  FillProperties& rShapeOrParentShapeFillProps,
681  oox::drawingml::ShapePtr pParentGroupShape)
682 {
683  bool bIsEmbMedia = false;
684  SAL_INFO("oox.drawingml", "Shape::createAndInsert: id='" << msId << "' service='" << rServiceName << "'");
685 
686  formulaimport::XmlStreamBuilder * pMathXml(nullptr);
687  if (mpTextBody)
688  {
689  for (auto const& it : mpTextBody->getParagraphs())
690  {
691  if (it->HasMathXml())
692  {
693  if (!mpTextBody->isEmpty() || pMathXml != nullptr)
694  {
695  SAL_WARN("oox.drawingml", "losing a Math object...");
696  }
697  else
698  {
699  pMathXml = &it->GetMathXml();
700  }
701  }
702  }
703  }
704 
705  // tdf#90403 PowerPoint ignores a:ext cx and cy values of p:xfrm, and uses real table width and height
706  if ( mpTablePropertiesPtr && rServiceName == "com.sun.star.drawing.TableShape" )
707  {
708  maSize.Width = 0;
709  for (auto const& elem : mpTablePropertiesPtr->getTableGrid())
710  {
711  maSize.Width = o3tl::saturating_add(maSize.Width, static_cast<sal_Int32>(elem));
712  }
713  maSize.Height = 0;
714  for (auto const& elem : mpTablePropertiesPtr->getTableRows())
715  {
716  maSize.Height = o3tl::saturating_add(maSize.Height, elem.getHeight());
717  }
718  }
719 
720  awt::Rectangle aShapeRectHmm(
725 
726  OUString aServiceName;
727  if (pMathXml)
728  {
729  // convert this shape to OLE
730  aServiceName = "com.sun.star.drawing.OLE2Shape";
731  msServiceName = aServiceName;
732  meFrameType = FRAMETYPE_GENERIC; // not OLEOBJECT, no stream in package
733  mnSubType = 0;
734  }
735  else if (rServiceName == "com.sun.star.drawing.GraphicObjectShape" &&
736  mpGraphicPropertiesPtr && !mpGraphicPropertiesPtr->m_sMediaPackageURL.isEmpty())
737  {
738  aServiceName = finalizeServiceName( rFilterBase, "com.sun.star.presentation.MediaShape", aShapeRectHmm );
739  bIsEmbMedia = true;
740  }
741  else
742  {
743  aServiceName = finalizeServiceName( rFilterBase, rServiceName, aShapeRectHmm );
744  }
745  // Use custom shape instead of GraphicObjectShape if the image is cropped to
746  // shape. Except rectangle, which does not require further cropping
747  bool bIsCroppedGraphic = (aServiceName == "com.sun.star.drawing.GraphicObjectShape" &&
748  (mpCustomShapePropertiesPtr->getShapePresetType() >= 0 || mpCustomShapePropertiesPtr->getPath2DList().size() > 0) &&
749  mpCustomShapePropertiesPtr->getShapePresetType() != XML_Rect &&
750  mpCustomShapePropertiesPtr->getShapePresetType() != XML_rect);
751  // ToDo: Why is ConnectorShape here treated as custom shape, but below with start and end point?
752  bool bIsCustomShape = ( aServiceName == "com.sun.star.drawing.CustomShape" ||
753  aServiceName == "com.sun.star.drawing.ConnectorShape" ||
754  bIsCroppedGraphic);
755  if(bIsCroppedGraphic)
756  {
757  aServiceName = "com.sun.star.drawing.CustomShape";
758  mpGraphicPropertiesPtr->mbIsCustomShape = true;
759  }
760  bool bUseRotationTransform = ( !mbWps ||
761  aServiceName == "com.sun.star.drawing.LineShape" ||
762  aServiceName == "com.sun.star.drawing.GroupShape" ||
763  mbFlipH ||
764  mbFlipV );
765 
766  basegfx::B2DHomMatrix aTransformation; // will be cumulative transformation of this object
767 
768  // Special for SmartArt import. Rotate diagram's shape around object's center before sizing.
769  if (bUseRotationTransform && mnDiagramRotation != 0)
770  {
771  aTransformation.translate(-0.5, -0.5);
772  aTransformation.rotate(basegfx::deg2rad(mnDiagramRotation / 60000.0));
773  aTransformation.translate(0.5, 0.5);
774  }
775 
776  // Build object matrix from shape size and position; corresponds to MSO ext and off
777  // Only LineShape and ConnectorShape may have zero width or height.
778  if (aServiceName == "com.sun.star.drawing.LineShape"
779  || aServiceName == "com.sun.star.drawing.ConnectorShape")
780  aTransformation.scale(maSize.Width, maSize.Height);
781  else
782  {
783  aTransformation.scale(maSize.Width ? maSize.Width : 1.0,
784  maSize.Height ? maSize.Height : 1.0);
785  }
786 
787  // Evaluate object flip. Other shapes than custom shapes have no attribute for flip but use
788  // negative scale. Flip in MSO is at object center.
789  if (!bIsCustomShape && (mbFlipH || mbFlipV))
790  lcl_mirrorAtCenter(aTransformation, mbFlipH, mbFlipV);
791 
792  // Evaluate parent flip.
793  // A CustomShape has mirror not as negative scale, but as attributes.
794  basegfx::B2DVector aParentScale(1.0, 1.0);
795  basegfx::B2DVector aParentTranslate(0.0, 0.0);
796  double fParentRotate(0.0);
797  double fParentShearX(0.0);
798  if (pParentGroupShape)
799  {
800  aParentTransformation.decompose(aParentScale, aParentTranslate, fParentRotate, fParentShearX);
801  if (bIsCustomShape)
802  {
803  lcl_mirrorAtCenter(aTransformation, aParentScale.getX() < 0, aParentScale.getY() < 0);
804  if(aParentScale.getX() < 0)
805  mbFlipH = !mbFlipH;
806  if(aParentScale.getY() < 0)
807  mbFlipV = !mbFlipV;
808  }
809  }
810 
811  if (maPosition.X != 0 || maPosition.Y != 0)
812  {
813  // if global position is used, add it to transformation
814  if (mbWps && pParentGroupShape == nullptr)
815  aTransformation.translate(
818  else
819  aTransformation.translate(maPosition.X, maPosition.Y);
820  }
821 
822  // Apply further parent transformations. First scale object then rotate. Other way round would
823  // introduce shearing.
824 
825  // The attributes chExt and chOff of the group in oox file contain the values on which the size
826  // and position of the child is based on. If they differ from the actual size of the group as
827  // given in its ext and off attributes, the child has to be transformed according the new values.
828  if (pParentGroupShape)
829  {
830  // ToDo: A diagram in a group might need special handling because it cannot flip and only
831  // resize uniformly. But currently it is imported with zero size, see tdf#139575. That needs
832  // to be fixed beforehand.
833 
834  // Scaling is done from left/top edges of the group. So these need to become coordinate axes.
835  aTransformation.translate(-pParentGroupShape->maChPosition.X,
836  -pParentGroupShape->maChPosition.Y);
837 
838  // oox allows zero or missing attribute chExt. In that case the scaling factor is 1.
839  // Transform2DContext::onCreateContext has set maChSize to maSize for groups in oox file in
840  // such cases. For own made groups (e.g. diagrams) that is missing.
841  // The factors cumulate on the way through the parent groups, so we do not use maSize of the
842  // direct parent group but the cumulated value from aParentScale.
843  double fFactorX = 1.0;
844  double fFactorY = 1.0;
845  if (pParentGroupShape->maChSize.Width != 0)
846  fFactorX = aParentScale.getX() / pParentGroupShape->maChSize.Width;
847  if (pParentGroupShape->maChSize.Height != 0)
848  fFactorY = aParentScale.getY() / pParentGroupShape->maChSize.Height;
849  if (fFactorX != 1 || fFactorY != 1)
850  {
851  // It depends on the object rotation angle whether scaling is applied to switched
852  // width and height. MSO acts strange in that case (as of May 2021).
853  const sal_Int32 nDeg(mnRotation / 60000);
854  const bool bNeedsMSOWidhtHeightToggle
855  = (nDeg >= 45 && nDeg < 135) || (nDeg >= 225 && nDeg < 315);
856  if (bNeedsMSOWidhtHeightToggle)
857  lcl_doSpecialMSOWidthHeightToggle(aTransformation);
858 
859  aTransformation.scale(fFactorX, fFactorY);
860 
861  if (bNeedsMSOWidhtHeightToggle)
862  {
863  lcl_doSpecialMSOWidthHeightToggle(aTransformation);
864  // In case of flip the special case needs an additional 180deg rotation.
865  if ((aParentScale.getX() < 0) != (aParentScale.getY() < 0))
866  lcl_RotateAtCenter(aTransformation, 10800000);
867  }
868  }
869  }
870 
871  // Apply object rotation at current object center
872  // The flip contained in aParentScale will affect orientation of object rotation angle.
873  sal_Int16 nOrientation = ((aParentScale.getX() < 0) != (aParentScale.getY() < 0)) ? -1 : 1;
874  // ToDo: Not sure about the restrictions given by bUseRotationTransform.
875  if (bUseRotationTransform && mnRotation != 0)
876  lcl_RotateAtCenter(aTransformation, nOrientation * mnRotation);
877 
878  if (fParentRotate != 0.0)
879  aTransformation.rotate(fParentRotate);
880  if (!aParentTranslate.equalZero())
881  aTransformation.translate(aParentTranslate);
882 
883  aParentTransformation = aTransformation;
884 
885  constexpr double fEmuToMm100 = o3tl::convert(1.0, o3tl::Length::emu, o3tl::Length::mm100);
886  aTransformation.scale(fEmuToMm100, fEmuToMm100);
887 
888  // OOXML flips shapes before rotating them, so the rotation needs to be inverted
889  if( bIsCustomShape && mbFlipH != mbFlipV )
890  {
891  basegfx::B2DVector aScale, aTranslate;
892  double fRotate, fShearX;
893  aTransformation.decompose(aScale, aTranslate, fRotate, fShearX);
894 
895  if(fRotate != 0)
896  {
897  basegfx::B2DPoint aCenter(0.5, 0.5);
898  aCenter *= aTransformation;
899  aTransformation.translate( -aCenter.getX(), -aCenter.getY() );
900  aTransformation.rotate( fRotate * -2.0 );
901  aTransformation.translate( aCenter.getX(), aCenter.getY() );
902  }
903  }
904 
905  // special for lineshape
906  if ( aServiceName == "com.sun.star.drawing.LineShape" )
907  {
908  ::basegfx::B2DPolygon aPoly;
909  aPoly.insert( 0, ::basegfx::B2DPoint( 0, 0 ) );
910  aPoly.insert( 1, ::basegfx::B2DPoint( maSize.Width ? 1 : 0, maSize.Height ? 1 : 0 ) );
911  aPoly.transform( aTransformation );
912 
913  // now creating the corresponding PolyPolygon
914  sal_Int32 i, nNumPoints = aPoly.count();
915  uno::Sequence< awt::Point > aPointSequence( nNumPoints );
916  awt::Point* pPoints = aPointSequence.getArray();
917  uno::Reference<lang::XServiceInfo> xModelInfo(rFilterBase.getModel(), uno::UNO_QUERY);
918  for( i = 0; i < nNumPoints; ++i )
919  {
920  basegfx::B2DPoint aPoint( aPoly.getB2DPoint( i ) );
921 
922  // Guard against zero width or height.
923  if (i)
924  {
925  const basegfx::B2DPoint& rPreviousPoint = aPoly.getB2DPoint(i - 1);
926  if (aPoint.getX() - rPreviousPoint.getX() == 0)
927  aPoint.setX(aPoint.getX() + 1);
928  if (aPoint.getY() - rPreviousPoint.getY() == 0)
929  aPoint.setY(aPoint.getY() + 1);
930  }
931 
932  pPoints[i] = awt::Point(static_cast<sal_Int32>(aPoint.getX()), static_cast<sal_Int32>(aPoint.getY()));
933  }
934  uno::Sequence< uno::Sequence< awt::Point > > aPolyPolySequence( 1 );
935  aPolyPolySequence.getArray()[ 0 ] = aPointSequence;
936 
937  maShapeProperties.setProperty(PROP_PolyPolygon, aPolyPolySequence);
938  }
939  else if ( aServiceName == "com.sun.star.drawing.ConnectorShape" )
940  {
941  ::basegfx::B2DPolygon aPoly;
942  aPoly.insert( 0, ::basegfx::B2DPoint( 0, 0 ) );
943  aPoly.insert( 1, ::basegfx::B2DPoint( maSize.Width ? 1 : 0, maSize.Height ? 1 : 0 ) );
944  aPoly.transform( aTransformation );
945 
946  basegfx::B2DPoint aStartPosition( aPoly.getB2DPoint( 0 ) );
947  basegfx::B2DPoint aEndPosition( aPoly.getB2DPoint( 1 ) );
948  awt::Point aAWTStartPosition( static_cast< sal_Int32 >( aStartPosition.getX() ), static_cast< sal_Int32 >( aStartPosition.getY() ) );
949  awt::Point aAWTEndPosition( static_cast< sal_Int32 >( aEndPosition.getX() ), static_cast< sal_Int32 >( aEndPosition.getY() ) );
950 
951  maShapeProperties.setProperty(PROP_StartPosition, aAWTStartPosition);
952  maShapeProperties.setProperty(PROP_EndPosition, aAWTEndPosition);
953  }
954  else
955  {
956  // now set transformation for this object
957  HomogenMatrix3 aMatrix;
958 
959  aMatrix.Line1.Column1 = aTransformation.get(0,0);
960  aMatrix.Line1.Column2 = aTransformation.get(0,1);
961  aMatrix.Line1.Column3 = aTransformation.get(0,2);
962 
963  aMatrix.Line2.Column1 = aTransformation.get(1,0);
964  aMatrix.Line2.Column2 = aTransformation.get(1,1);
965  aMatrix.Line2.Column3 = aTransformation.get(1,2);
966 
967  aMatrix.Line3.Column1 = aTransformation.get(2,0);
968  aMatrix.Line3.Column2 = aTransformation.get(2,1);
969  aMatrix.Line3.Column3 = aTransformation.get(2,2);
970 
971  maShapeProperties.setProperty(PROP_Transformation, aMatrix);
972  }
973 
974  Reference< lang::XMultiServiceFactory > xServiceFact( rFilterBase.getModel(), UNO_QUERY_THROW );
975  if ( !mxShape.is() )
976  mxShape.set( xServiceFact->createInstance( aServiceName ), UNO_QUERY_THROW );
977 
978  Reference< XPropertySet > xSet( mxShape, UNO_QUERY );
979  if (xSet.is())
980  {
981  if( !msName.isEmpty() )
982  {
983  Reference< container::XNamed > xNamed( mxShape, UNO_QUERY );
984  if( xNamed.is() )
985  xNamed->setName( msName );
986  }
987  if( !msDescription.isEmpty() )
988  {
989  xSet->setPropertyValue( "Description", Any( msDescription ) );
990  }
991  if (aServiceName != "com.sun.star.text.TextFrame")
992  rxShapes->add( mxShape );
993 
994  if ( mbHidden || mbHiddenMasterShape )
995  {
996  SAL_INFO("oox.drawingml", "Shape::createAndInsert: invisible shape with id='" << msId << "'");
997  xSet->setPropertyValue( "Visible", Any( false ) );
998  // In Excel hidden means not printed, let's use visibility for now until that's handled separately
999  xSet->setPropertyValue( "Printable", Any( false ) );
1000  }
1001 
1002  if (mbLocked)
1003  {
1004  xSet->setPropertyValue("MoveProtect", Any(true));
1005  xSet->setPropertyValue("SizeProtect", Any(true));
1006  }
1007 
1008  ActionLockGuard const alg(mxShape);
1009 
1010  // sj: removing default text of placeholder objects such as SlideNumberShape or HeaderShape
1011  if ( bClearText )
1012  {
1013  uno::Reference< text::XText > xText( mxShape, uno::UNO_QUERY );
1014  if ( xText.is() )
1015  {
1016  xText->setString( "" );
1017  }
1018  }
1019 
1020  if (pMathXml)
1021  {
1022  // the "EmbeddedObject" property is read-only, so we have to create
1023  // the shape first, and it can be read only after the shape is
1024  // inserted into the document, so delay the actual import until here
1026  xSet->setPropertyValue("CLSID", uno::makeAny(name.GetHexName()));
1027  uno::Reference<embed::XEmbeddedObject> const xObj(
1028  xSet->getPropertyValue("EmbeddedObject"), uno::UNO_QUERY);
1029  if (xObj.is())
1030  {
1031  uno::Reference<uno::XInterface> const xMathModel(xObj->getComponent());
1032  oox::FormulaImportBase *const pMagic(
1033  dynamic_cast<oox::FormulaImportBase*>(xMathModel.get()));
1034  assert(pMagic);
1035  pMagic->readFormulaOoxml(*pMathXml);
1036  }
1037  }
1038 
1039  const GraphicHelper& rGraphicHelper = rFilterBase.getGraphicHelper();
1040 
1041  ::Color nLinePhClr(ColorTransparency, 0xffffffff);
1042  ::Color nFillPhClr(ColorTransparency, 0xffffffff);
1043  // TODO: use ph color when applying effect properties
1044  //sal_Int32 nEffectPhClr = -1;
1045 
1046  // dmapper needs the original rotation angle for calculating square wrap. This angle is not
1047  // available as property there, so store it in InteropGrabBag.
1048  putPropertyToGrabBag("mso-rotation-angle", Any(mnRotation));
1049 
1050  if( pTheme )
1051  {
1052  if( const ShapeStyleRef* pLineRef = getShapeStyleRef( XML_lnRef ) )
1053  {
1054  LineProperties aLineProperties;
1055  aLineProperties.maLineFill.moFillType = XML_noFill;
1056  if( const LineProperties* pLineProps = pTheme->getLineStyle( pLineRef->mnThemedIdx ) )
1057  aLineProperties.assignUsed( *pLineProps );
1058  nLinePhClr = pLineRef->maPhClr.getColor( rGraphicHelper );
1059 
1060  // Store style-related properties to InteropGrabBag to be able to export them back
1061  uno::Sequence<beans::PropertyValue> aProperties = comphelper::InitPropertySequence(
1062  {
1063  {"SchemeClr", uno::makeAny(pLineRef->maPhClr.getSchemeName())},
1064  {"Idx", uno::makeAny(pLineRef->mnThemedIdx)},
1065  {"Color", uno::makeAny(nLinePhClr)},
1066  {"LineStyle", uno::makeAny(aLineProperties.getLineStyle())},
1067  {"LineCap", uno::makeAny(aLineProperties.getLineCap())},
1068  {"LineJoint", uno::makeAny(aLineProperties.getLineJoint())},
1069  {"LineWidth", uno::makeAny(aLineProperties.getLineWidth())},
1070  {"Transformations", uno::makeAny(pLineRef->maPhClr.getTransformations())}
1071  });
1072  putPropertyToGrabBag( "StyleLnRef", Any( aProperties ) );
1073  }
1074  if( const ShapeStyleRef* pFillRef = getShapeStyleRef( XML_fillRef ) )
1075  {
1076  if (!mbUseBgFill)
1077  {
1078  nFillPhClr = pFillRef->maPhClr.getColor(rGraphicHelper);
1079  }
1080 
1081  OUString sColorScheme = pFillRef->maPhClr.getSchemeName();
1082  if( !sColorScheme.isEmpty() )
1083  {
1084  uno::Sequence<beans::PropertyValue> aProperties = comphelper::InitPropertySequence(
1085  {
1086  {"SchemeClr", uno::makeAny(sColorScheme)},
1087  {"Idx", uno::makeAny(pFillRef->mnThemedIdx)},
1088  {"Color", uno::makeAny(nFillPhClr)},
1089  {"Transformations", uno::makeAny(pFillRef->maPhClr.getTransformations())}
1090  });
1091 
1092  putPropertyToGrabBag( "StyleFillRef", Any( aProperties ) );
1093  }
1094  }
1095  if( const ShapeStyleRef* pEffectRef = getShapeStyleRef( XML_effectRef ) )
1096  {
1097  // TODO: use ph color when applying effect properties
1098  // nEffectPhClr = pEffectRef->maPhClr.getColor( rGraphicHelper );
1099 
1100  // Store style-related properties to InteropGrabBag to be able to export them back
1101  uno::Sequence<beans::PropertyValue> aProperties = comphelper::InitPropertySequence(
1102  {
1103  {"SchemeClr", uno::makeAny(pEffectRef->maPhClr.getSchemeName())},
1104  {"Idx", uno::makeAny(pEffectRef->mnThemedIdx)},
1105  {"Transformations", uno::makeAny(pEffectRef->maPhClr.getTransformations())}
1106  });
1107  putPropertyToGrabBag( "StyleEffectRef", Any( aProperties ) );
1108  }
1109  }
1110  ShapePropertyMap aShapeProps( rFilterBase.getModelObjectHelper() );
1111 
1112  // add properties from textbody to shape properties
1113  if( mpTextBody )
1114  {
1115  mpTextBody->getTextProperties().pushRotationAdjustments();
1116  aShapeProps.assignUsed( mpTextBody->getTextProperties().maPropertyMap );
1117  // Push char properties as well - specifically useful when this is a placeholder
1118  if( mpMasterTextListStyle && mpMasterTextListStyle->getListStyle()[0].getTextCharacterProperties().moHeight.has() )
1119  aShapeProps.setProperty(PROP_CharHeight, GetFontHeight( mpMasterTextListStyle->getListStyle()[0].getTextCharacterProperties().moHeight.get() ));
1120  }
1121 
1122  // applying properties
1123  aShapeProps.assignUsed( getShapeProperties() );
1124  aShapeProps.assignUsed( maDefaultShapeProperties );
1125  if(mnRotation != 0 && bIsCustomShape)
1126  aShapeProps.setProperty( PROP_RotateAngle, sal_Int32( NormAngle36000( Degree100(mnRotation / -600) ) ));
1127  if( bIsEmbMedia ||
1128  bIsCustomShape ||
1129  aServiceName == "com.sun.star.drawing.GraphicObjectShape" ||
1130  aServiceName == "com.sun.star.drawing.OLE2Shape")
1131  {
1132  mpGraphicPropertiesPtr->pushToPropMap( aShapeProps, rGraphicHelper, mbFlipH, mbFlipV );
1133  }
1134  if ( mpTablePropertiesPtr && aServiceName == "com.sun.star.drawing.TableShape" )
1135  mpTablePropertiesPtr->pushToPropSet( rFilterBase, xSet, mpMasterTextListStyle );
1136 
1137  FillProperties aFillProperties = getActualFillProperties(pTheme, &rShapeOrParentShapeFillProps);
1138  if (getFillProperties().moFillType.has() && getFillProperties().moFillType.get() == XML_grpFill)
1139  getFillProperties().assignUsed(aFillProperties);
1140  if(!bIsCroppedGraphic)
1141  aFillProperties.pushToPropMap( aShapeProps, rGraphicHelper, mnRotation, nFillPhClr, mbFlipH, mbFlipV, bIsCustomShape );
1142  LineProperties aLineProperties = getActualLineProperties(pTheme);
1143  aLineProperties.pushToPropMap( aShapeProps, rGraphicHelper, nLinePhClr );
1144  EffectProperties aEffectProperties = getActualEffectProperties(pTheme);
1145  // TODO: use ph color when applying effect properties
1146  aEffectProperties.pushToPropMap( aShapeProps, rGraphicHelper );
1147 
1148  // applying autogrowheight property before setting shape size, because
1149  // the shape size might be changed if currently autogrowheight is true
1150  // we must also check that the PropertySet supports the property.
1151  Reference< XPropertySetInfo > xSetInfo( xSet->getPropertySetInfo() );
1152  const OUString& rPropName = PropertyMap::getPropertyName( PROP_TextAutoGrowHeight );
1153  if( xSetInfo.is() && xSetInfo->hasPropertyByName( rPropName ) )
1154  if( aShapeProps.hasProperty( PROP_TextAutoGrowHeight ) )
1155  xSet->setPropertyValue( rPropName, Any( false ) );
1156 
1157  // do not set properties at a group shape (this causes
1158  // assertions from svx) ...
1159  if( aServiceName != "com.sun.star.drawing.GroupShape" )
1160  {
1161  if (aServiceName == "com.sun.star.text.TextFrame")
1162  {
1163  if (mpCustomShapePropertiesPtr && mpCustomShapePropertiesPtr->getShapeTypeOverride())
1164  {
1165  uno::Reference<beans::XPropertySet> propertySet (mxShape, uno::UNO_QUERY);
1166  uno::Sequence<beans::PropertyValue> aGrabBag;
1167  propertySet->getPropertyValue("FrameInteropGrabBag") >>= aGrabBag;
1168  sal_Int32 length = aGrabBag.getLength();
1169  aGrabBag.realloc( length+1);
1170  aGrabBag[length].Name = "mso-orig-shape-type";
1171  uno::Sequence< sal_Int8 > const & aNameSeq =
1172  mpCustomShapePropertiesPtr->getShapePresetTypeName();
1173  OUString sShapePresetTypeName(reinterpret_cast< const char* >(
1174  aNameSeq.getConstArray()), aNameSeq.getLength(), RTL_TEXTENCODING_UTF8);
1175  aGrabBag[length].Value <<= sShapePresetTypeName;
1176  propertySet->setPropertyValue("FrameInteropGrabBag",uno::makeAny(aGrabBag));
1177  }
1178  //If the text box has links then save the link information so that
1179  //it can be accessed in DomainMapper_Impl.cxx while chaining the text frames.
1180  if (isLinkedTxbx())
1181  {
1182  uno::Reference<beans::XPropertySet> propertySet (mxShape, uno::UNO_QUERY);
1183  uno::Sequence<beans::PropertyValue> aGrabBag;
1184  propertySet->getPropertyValue("FrameInteropGrabBag") >>= aGrabBag;
1185  sal_Int32 length = aGrabBag.getLength();
1186  aGrabBag.realloc( length + 3 );
1187  aGrabBag[length].Name = "TxbxHasLink";
1188  aGrabBag[length].Value <<= isLinkedTxbx();
1189  aGrabBag[length + 1 ].Name = "Txbx-Id";
1190  aGrabBag[length + 1 ].Value <<= getLinkedTxbxAttributes().id;
1191  aGrabBag[length + 2 ].Name = "Txbx-Seq";
1192  aGrabBag[length + 2 ].Value <<= getLinkedTxbxAttributes().seq;
1193  propertySet->setPropertyValue("FrameInteropGrabBag",uno::makeAny(aGrabBag));
1194  }
1195 
1196  // TextFrames have BackColor, not FillColor
1197  if (aShapeProps.hasProperty(PROP_FillColor))
1198  {
1199  aShapeProps.setAnyProperty(PROP_BackColor, aShapeProps.getProperty(PROP_FillColor));
1200  aShapeProps.erase(PROP_FillColor);
1201  }
1202  // TextFrames have BackColorTransparency, not FillTransparence
1203  if (aShapeProps.hasProperty(PROP_FillTransparence))
1204  {
1205  aShapeProps.setAnyProperty(PROP_BackColorTransparency, aShapeProps.getProperty(PROP_FillTransparence));
1206  aShapeProps.erase(PROP_FillTransparence);
1207  }
1208  // TextFrames have BackGraphic, not FillBitmap
1209  if (aShapeProps.hasProperty(PROP_FillBitmap))
1210  {
1211  aShapeProps.setAnyProperty(PROP_BackGraphic, aShapeProps.getProperty(PROP_FillBitmap));
1212  aShapeProps.erase(PROP_FillBitmap);
1213  }
1214  if (aShapeProps.hasProperty(PROP_FillBitmapName))
1215  {
1216  uno::Any aAny = aShapeProps.getProperty(PROP_FillBitmapName);
1217  OUString aFillBitmapName = aAny.get<OUString>();
1218  uno::Reference<awt::XBitmap> xBitmap = rFilterBase.getModelObjectHelper().getFillBitmap(aFillBitmapName);
1219  uno::Reference<graphic::XGraphic> xGraphic(xBitmap, uno::UNO_QUERY);
1220  aShapeProps.setProperty(PROP_BackGraphic, xGraphic);
1221  // aShapeProps.erase(PROP_FillBitmapName); // Maybe, leave the name as well
1222  }
1223  // And no LineColor property; individual borders can have colors
1224  if (aShapeProps.hasProperty(PROP_LineColor))
1225  {
1226  uno::Reference<beans::XPropertySet> xPropertySet(mxShape, uno::UNO_QUERY);
1227  static const sal_Int32 aBorders[] =
1228  {
1229  PROP_TopBorder, PROP_LeftBorder, PROP_BottomBorder, PROP_RightBorder
1230  };
1231  for (sal_Int32 nBorder : aBorders)
1232  {
1233  css::table::BorderLine2 aBorderLine = xPropertySet->getPropertyValue(PropertyMap::getPropertyName(nBorder)).get<css::table::BorderLine2>();
1234  aBorderLine.Color = aShapeProps.getProperty(PROP_LineColor).get<sal_Int32>();
1235  if (aLineProperties.moLineWidth.has())
1236  aBorderLine.LineWidth = convertEmuToHmm(aLineProperties.moLineWidth.get());
1237  aShapeProps.setProperty(nBorder, aBorderLine);
1238  }
1239  aShapeProps.erase(PROP_LineColor);
1240  }
1241  if(mnRotation)
1242  {
1243  uno::Reference<beans::XPropertySet> xPropertySet(mxShape, uno::UNO_QUERY);
1244  static const OUStringLiteral aGrabBagPropName = u"FrameInteropGrabBag";
1245  uno::Sequence<beans::PropertyValue> aGrabBag;
1246  xPropertySet->getPropertyValue(aGrabBagPropName) >>= aGrabBag;
1247  beans::PropertyValue aPair;
1248  aPair.Name = "mso-rotation-angle";
1249  aPair.Value <<= mnRotation;
1250  if (aGrabBag.hasElements())
1251  {
1252  sal_Int32 nLength = aGrabBag.getLength();
1253  aGrabBag.realloc(nLength + 1);
1254  aGrabBag[nLength] = aPair;
1255  }
1256  else
1257  {
1258  aGrabBag.realloc(1);
1259  aGrabBag[0] = aPair;
1260  }
1261  xPropertySet->setPropertyValue(aGrabBagPropName, uno::makeAny(aGrabBag));
1262  }
1263  // TextFrames have ShadowFormat, not individual shadow properties.
1264  std::optional<sal_Int32> oShadowDistance;
1265  if (aShapeProps.hasProperty(PROP_ShadowXDistance))
1266  {
1267  oShadowDistance = aShapeProps.getProperty(PROP_ShadowXDistance).get<sal_Int32>();
1268  aShapeProps.erase(PROP_ShadowXDistance);
1269  }
1270  if (aShapeProps.hasProperty(PROP_ShadowYDistance))
1271  {
1272  // There is a single 'dist' attribute, so no need to count the avg of x and y.
1273  aShapeProps.erase(PROP_ShadowYDistance);
1274  }
1275  std::optional<sal_Int32> oShadowColor;
1276  if (aShapeProps.hasProperty(PROP_ShadowColor))
1277  {
1278  oShadowColor = aShapeProps.getProperty(PROP_ShadowColor).get<sal_Int32>();
1279  aShapeProps.erase(PROP_ShadowColor);
1280  }
1281  if (aShapeProps.hasProperty(PROP_Shadow))
1282  aShapeProps.erase(PROP_Shadow);
1283 
1284  if (oShadowDistance || oShadowColor || aEffectProperties.maShadow.moShadowDir.has())
1285  {
1286  css::table::ShadowFormat aFormat;
1287  if (oShadowColor)
1288  aFormat.Color = *oShadowColor;
1289  if (aEffectProperties.maShadow.moShadowDir.has())
1290  {
1291  css::table::ShadowLocation nLocation = css::table::ShadowLocation_NONE;
1292  switch (aEffectProperties.maShadow.moShadowDir.get())
1293  {
1294  case 13500000:
1295  nLocation = css::table::ShadowLocation_TOP_LEFT;
1296  break;
1297  case 18900000:
1298  nLocation = css::table::ShadowLocation_TOP_RIGHT;
1299  break;
1300  case 8100000:
1301  nLocation = css::table::ShadowLocation_BOTTOM_LEFT;
1302  break;
1303  case 2700000:
1304  nLocation = css::table::ShadowLocation_BOTTOM_RIGHT;
1305  break;
1306  }
1307  aFormat.Location = nLocation;
1308  }
1309  aFormat.ShadowWidth = *oShadowDistance;
1310  aShapeProps.setProperty(PROP_ShadowFormat, aFormat);
1311  }
1312 
1313  }
1314  else if (mbTextBox)
1315  {
1316  aShapeProps.setProperty(PROP_TextBox, true);
1317  }
1318 
1319  if (aServiceName != "com.sun.star.text.TextFrame" && isLinkedTxbx())
1320  {
1321  uno::Reference<beans::XPropertySet> propertySet (mxShape, uno::UNO_QUERY);
1322  uno::Sequence<beans::PropertyValue> aGrabBag;
1323  propertySet->getPropertyValue("InteropGrabBag") >>= aGrabBag;
1324  sal_Int32 length = aGrabBag.getLength();
1325  aGrabBag.realloc( length + 3 );
1326  aGrabBag[length].Name = "TxbxHasLink";
1327  aGrabBag[length].Value <<= isLinkedTxbx();
1328  aGrabBag[length + 1 ].Name = "Txbx-Id";
1329  aGrabBag[length + 1 ].Value <<= getLinkedTxbxAttributes().id;
1330  aGrabBag[length + 2 ].Name = "Txbx-Seq";
1331  aGrabBag[length + 2 ].Value <<= getLinkedTxbxAttributes().seq;
1332  propertySet->setPropertyValue("InteropGrabBag",uno::makeAny(aGrabBag));
1333  }
1334 
1335  PropertySet( xSet ).setProperties( aShapeProps );
1336  if (mbLockedCanvas)
1337  {
1338  putPropertyToGrabBag( "LockedCanvas", Any( true ) );
1339  if (aServiceName == "com.sun.star.drawing.LineShape")
1340  {
1341  // It seems the position and size for lines inside a locked canvas is absolute.
1342  mxShape->setPosition(awt::Point(aShapeRectHmm.X, aShapeRectHmm.Y));
1343  mxShape->setSize(awt::Size(aShapeRectHmm.Width, aShapeRectHmm.Height));
1344  }
1345  }
1346 
1347  // Store original fill and line colors of the shape and the theme color name to InteropGrabBag
1348  std::vector<beans::PropertyValue> aProperties;
1349  aProperties.push_back(comphelper::makePropertyValue("EmuLineWidth", aLineProperties.moLineWidth.get(0)));
1350  aProperties.push_back(comphelper::makePropertyValue("OriginalSolidFillClr", aShapeProps.getProperty(PROP_FillColor)));
1351  aProperties.push_back(comphelper::makePropertyValue("OriginalLnSolidFillClr", aShapeProps.getProperty(PROP_LineColor)));
1352  OUString sColorFillScheme = aFillProperties.maFillColor.getSchemeName();
1353  if( !aFillProperties.maFillColor.isPlaceHolder() && !sColorFillScheme.isEmpty() )
1354  {
1355  aProperties.push_back(comphelper::makePropertyValue("SpPrSolidFillSchemeClr", sColorFillScheme));
1356  aProperties.push_back(comphelper::makePropertyValue("SpPrSolidFillSchemeClrTransformations", aFillProperties.maFillColor.getTransformations()));
1357  }
1358  OUString sLnColorFillScheme = aLineProperties.maLineFill.maFillColor.getSchemeName();
1359  if( !aLineProperties.maLineFill.maFillColor.isPlaceHolder() && !sLnColorFillScheme.isEmpty() )
1360  {
1361  aProperties.push_back(comphelper::makePropertyValue("SpPrLnSolidFillSchemeClr", sLnColorFillScheme));
1362  auto aResolvedSchemeClr = aLineProperties.maLineFill.maFillColor;
1363  aResolvedSchemeClr.clearTransformations();
1364  aProperties.push_back(comphelper::makePropertyValue("SpPrLnSolidFillResolvedSchemeClr", aResolvedSchemeClr.getColor(rGraphicHelper, nFillPhClr)));
1365  aProperties.push_back(comphelper::makePropertyValue("SpPrLnSolidFillSchemeClrTransformations", aLineProperties.maLineFill.maFillColor.getTransformations()));
1366  }
1368 
1369  // Store original gradient fill of the shape to InteropGrabBag
1370  // LibreOffice doesn't support all the kinds of gradient so we save its complete definition
1371  if( aShapeProps.hasProperty( PROP_FillGradient ) )
1372  {
1373  std::vector<beans::PropertyValue> aGradientStops;
1374  size_t i = 0;
1375  for( const auto& [rPos, rColor] : aFillProperties.maGradientProps.maGradientStops )
1376  { // for each stop in the gradient definition:
1377 
1378  // save position
1379  std::vector<beans::PropertyValue> aGradientStop;
1380  aGradientStop.push_back(comphelper::makePropertyValue("Pos", rPos));
1381 
1382  OUString sStopColorScheme = rColor.getSchemeName();
1383  if( sStopColorScheme.isEmpty() )
1384  {
1385  // save RGB color
1386  aGradientStop.push_back(comphelper::makePropertyValue("RgbClr", rColor.getColor(rGraphicHelper, nFillPhClr)));
1387  // in the case of a RGB color, transformations are already applied to
1388  // the color with the exception of alpha transformations. We only need
1389  // to keep the transparency value to calculate the alpha value later.
1390  if( rColor.hasTransparency() )
1391  aGradientStop.push_back(comphelper::makePropertyValue("Transparency", rColor.getTransparency()));
1392  }
1393  else
1394  {
1395  // save color with scheme name
1396  aGradientStop.push_back(comphelper::makePropertyValue("SchemeClr", sStopColorScheme));
1397  // save all color transformations
1398  aGradientStop.push_back(comphelper::makePropertyValue("Transformations", rColor.getTransformations()));
1399  }
1400 
1401  aGradientStops.push_back(comphelper::makePropertyValue(OUString::number(i), comphelper::containerToSequence(aGradientStop)));
1402  ++i;
1403  }
1404  // If getFillProperties.moFillType is unused that means gradient is defined by a theme
1405  // which is already saved into StyleFillRef property, so no need to save the explicit values too
1406  if( getFillProperties().moFillType.has() )
1407  putPropertyToGrabBag( "GradFillDefinition", uno::Any(comphelper::containerToSequence(aGradientStops)));
1408  putPropertyToGrabBag( "OriginalGradFill", aShapeProps.getProperty(PROP_FillGradient) );
1409  }
1410 
1411  // store unsupported effect attributes in the grab bag
1412  if (!aEffectProperties.m_Effects.empty())
1413  {
1414  std::vector<beans::PropertyValue> aEffects;
1415  sal_uInt32 i = 0;
1416  for (auto const& it : aEffectProperties.m_Effects)
1417  {
1418  PropertyValue aEffect = it->getEffect();
1419  if( !aEffect.Name.isEmpty() )
1420  {
1421  std::vector<beans::PropertyValue> aEffectsGrabBag;
1422  aEffectsGrabBag.push_back(comphelper::makePropertyValue("Attribs", aEffect.Value));
1423 
1424  Color& aColor( it->moColor );
1425  OUString sColorScheme = aColor.getSchemeName();
1426  if( sColorScheme.isEmpty() )
1427  {
1428  // RGB color and transparency value
1429  aEffectsGrabBag.push_back(comphelper::makePropertyValue("RgbClr", aColor.getColor(rGraphicHelper, nFillPhClr)));
1430  aEffectsGrabBag.push_back(comphelper::makePropertyValue("RgbClrTransparency", aColor.getTransparency()));
1431  }
1432  else
1433  {
1434  // scheme color with name and transformations
1435  aEffectsGrabBag.push_back(comphelper::makePropertyValue("SchemeClr", sColorScheme));
1436  aEffectsGrabBag.push_back(comphelper::makePropertyValue("SchemeClrTransformations", aColor.getTransformations()));
1437  }
1438  aEffects.push_back(comphelper::makePropertyValue(aEffect.Name, comphelper::containerToSequence(aEffectsGrabBag)));
1439  ++i;
1440  }
1441  }
1442  putPropertyToGrabBag("EffectProperties", uno::Any(comphelper::containerToSequence(aEffects)));
1443  }
1444 
1445  // add 3D effects if any
1448  Sequence< PropertyValue > aShape3DEffects = get3DProperties().getShape3DAttributes( rGraphicHelper, nFillPhClr );
1449  if( aCamera3DEffects.hasElements() || aLightRig3DEffects.hasElements() || aShape3DEffects.hasElements() )
1450  {
1451  uno::Sequence<beans::PropertyValue> a3DEffectsGrabBag = comphelper::InitPropertySequence(
1452  {
1453  {"Camera", uno::makeAny(aCamera3DEffects)},
1454  {"LightRig", uno::makeAny(aLightRig3DEffects)},
1455  {"Shape3D", uno::makeAny(aShape3DEffects)}
1456  });
1457  putPropertyToGrabBag( "3DEffectProperties", Any( a3DEffectsGrabBag ) );
1458  }
1459 
1460  if( bIsCustomShape && getTextBody())
1461  {
1462 
1463  Sequence< PropertyValue > aTextCamera3DEffects = getTextBody()->get3DProperties().getCameraAttributes();
1464  Sequence< PropertyValue > aTextLightRig3DEffects = getTextBody()->get3DProperties().getLightRigAttributes();
1465  Sequence< PropertyValue > aTextShape3DEffects = getTextBody()->get3DProperties().getShape3DAttributes( rGraphicHelper, nFillPhClr );
1466  if( aTextCamera3DEffects.hasElements() || aTextLightRig3DEffects.hasElements() || aTextShape3DEffects.hasElements() )
1467  {
1468  uno::Sequence<beans::PropertyValue> aText3DEffectsGrabBag = comphelper::InitPropertySequence(
1469  {
1470  {"Camera", uno::makeAny(aTextCamera3DEffects)},
1471  {"LightRig", uno::makeAny(aTextLightRig3DEffects)},
1472  {"Shape3D", uno::makeAny(aTextShape3DEffects)}
1473  });
1474  putPropertyToGrabBag( "Text3DEffectProperties", Any( aText3DEffectsGrabBag ) );
1475  }
1476  }
1477 
1478  // store bitmap artistic effects in the grab bag
1479  if( !mpGraphicPropertiesPtr->maBlipProps.maEffect.isEmpty() )
1480  putPropertyToGrabBag( "ArtisticEffectProperties",
1481  Any( mpGraphicPropertiesPtr->maBlipProps.maEffect.getEffect() ) );
1482  }
1483 
1484  else if( mbLockedCanvas )
1485  {
1486  //If we have aServiceName as "com.sun.star.drawing.GroupShape" and lockedCanvas
1487  putPropertyToGrabBag( "LockedCanvas", Any( true ) );
1488  }
1489 
1490  // These can have a custom geometry, so position should be set here,
1491  // after creation but before custom shape handling, using the position
1492  // we got from the caller.
1493  if (mbWps && aServiceName == "com.sun.star.drawing.LineShape")
1494  mxShape->setPosition(maPosition);
1495 
1496  if( bIsCustomShape )
1497  {
1498  if ( mbFlipH )
1499  mpCustomShapePropertiesPtr->setMirroredX( true );
1500  if ( mbFlipV )
1501  mpCustomShapePropertiesPtr->setMirroredY( true );
1502  if( getTextBody() )
1503  {
1504  sal_Int32 nTextCameraZRotation = static_cast< sal_Int32 >( getTextBody()->get3DProperties().maCameraRotation.mnRevolution.get() );
1505  mpCustomShapePropertiesPtr->setTextCameraZRotateAngle( nTextCameraZRotation / 60000 );
1506 
1507  sal_Int32 nTextRotateAngle = static_cast< sal_Int32 >( getTextBody()->getTextProperties().moRotation.get( 0 ) );
1508 
1509  nTextRotateAngle -= mnDiagramRotation;
1510  /* OOX measures text rotation clockwise in 1/60000th degrees,
1511  relative to the containing shape. setTextRotateAngle wants degrees anticlockwise. */
1512  nTextRotateAngle = -1 * nTextRotateAngle / 60000;
1513 
1514  if (getTextBody()->getTextProperties().moUpright)
1515  {
1516  // When upright is set, we want the text without any rotation.
1517  // But if we set 0 here, the text is still rotated if the
1518  // shape containing it is rotated.
1519  // Hence, we rotate the text into the opposite direction of
1520  // the rotation of the shape, by as much as the shape was rotated.
1521  mpCustomShapePropertiesPtr->setTextRotateAngle((mnRotation / 60000) + nTextRotateAngle);
1522  // Also put the initial angles away in a GrabBag.
1523  putPropertyToGrabBag("Upright", Any(true));
1524  putPropertyToGrabBag("nShapeRotationAtImport", Any(mnRotation / 60000));
1525  putPropertyToGrabBag("nTextRotationAtImport", Any(nTextRotateAngle));
1526  }
1527  else
1528  {
1529  mpCustomShapePropertiesPtr->setTextRotateAngle(nTextRotateAngle);
1530  }
1531 
1532  auto sHorzOverflow = getTextBody()->getTextProperties().msHorzOverflow;
1533  if (!sHorzOverflow.isEmpty())
1534  putPropertyToGrabBag("horzOverflow", uno::makeAny(getTextBody()->getTextProperties().msHorzOverflow));
1535  auto nVertOverflow = getTextBody()->getTextProperties().msVertOverflow;
1536  if (!nVertOverflow.isEmpty())
1537  putPropertyToGrabBag("vertOverflow", uno::makeAny(getTextBody()->getTextProperties().msVertOverflow));
1538  }
1539 
1540  // Note that the script oox/source/drawingml/customshapes/generatePresetsData.pl looks
1541  // for these ==cscode== and ==csdata== markers, so don't "clean up" these SAL_INFOs
1542  SAL_INFO("oox.cscode", "==cscode== shape name: '" << msName << "'");
1543  SAL_INFO("oox.csdata", "==csdata== shape name: '" << msName << "'");
1544  mpCustomShapePropertiesPtr->pushToPropSet( xSet, mxShape, maSize );
1545 
1546  if (mpTextBody)
1547  {
1548  bool bIsPresetShape = !mpTextBody->getTextProperties().msPrst.isEmpty();
1549  if (bIsPresetShape)
1550  {
1551  OUString sClass;
1552  const OUString sPresetType = mpTextBody->getTextProperties().msPrst;
1553  sClass = PresetGeometryTypeNames::GetFontworkType( sPresetType );
1554 
1555  lcl_createPresetShape( mxShape, sClass, sPresetType, mpCustomShapePropertiesPtr, mpTextBody, rGraphicHelper );
1556  }
1557  }
1558  }
1559  else if( getTextBody() )
1560  getTextBody()->getTextProperties().pushVertSimulation();
1561 
1562  // tdf#133037: a bit hackish: force Shape to rotate in the opposite direction the camera would rotate
1563  const sal_Int32 nCameraRotation = get3DProperties().maCameraRotation.mnRevolution.get(0);
1564 
1565  PropertySet aPropertySet(mxShape);
1566  if ( !bUseRotationTransform && (mnRotation != 0 || nCameraRotation != 0) )
1567  {
1568  // use the same logic for rotation from VML exporter (SimpleShape::implConvertAndInsert at vmlshape.cxx)
1569  Degree100 nAngle = NormAngle36000( Degree100((mnRotation - nCameraRotation) / -600) );
1570  aPropertySet.setAnyProperty( PROP_RotateAngle, makeAny( sal_Int32( nAngle.get() ) ) );
1571  aPropertySet.setAnyProperty( PROP_HoriOrientPosition, makeAny( maPosition.X ) );
1572  aPropertySet.setAnyProperty( PROP_VertOrientPosition, makeAny( maPosition.Y ) );
1573  }
1574 
1575  // in some cases, we don't have any text body.
1576  if( getTextBody() && ( !bDoNotInsertEmptyTextBody || !mpTextBody->isEmpty() ) )
1577  {
1578  Reference < XText > xText( mxShape, UNO_QUERY );
1579  if ( xText.is() ) // not every shape is supporting an XText interface (e.g. GroupShape)
1580  {
1581  TextCharacterProperties aCharStyleProperties;
1582  if( const ShapeStyleRef* pFontRef = getShapeStyleRef( XML_fontRef ) )
1583  {
1584  if( pFontRef->mnThemedIdx != 0 )
1585  {
1586  if( pTheme )
1587  if( const TextCharacterProperties* pCharProps = pTheme->getFontStyle( pFontRef->mnThemedIdx ) )
1588  aCharStyleProperties.assignUsed( *pCharProps );
1589  SAL_INFO("oox.drawingml", "Shape::createAndInsert: use font color");
1590  if ( pFontRef->maPhClr.isUsed() )
1591  {
1592  aCharStyleProperties.maFillProperties.maFillColor = pFontRef->maPhClr;
1593  aCharStyleProperties.maFillProperties.moFillType.set(XML_solidFill);
1594  }
1595  }
1596  }
1597  xText->setString("");
1598  Reference < XTextCursor > xAt = xText->createTextCursor();
1599  getTextBody()->insertAt( rFilterBase, xText, xAt, aCharStyleProperties, mpMasterTextListStyle );
1600 
1601  const TextParagraphVector& rParagraphs = getTextBody()->getParagraphs();
1602  if (!rParagraphs.empty())
1603  {
1604  const std::shared_ptr<TextParagraph>& pParagraph = rParagraphs[0];
1605  if (pParagraph->getProperties().getParaAdjust())
1606  {
1607  style::ParagraphAdjust eAdjust = *pParagraph->getProperties().getParaAdjust();
1608  if (eAdjust == style::ParagraphAdjust_CENTER)
1609  {
1610  // If the first paragraph is centered, then set the para adjustment of
1611  // the shape itself to centered as well.
1612  aPropertySet.setAnyProperty(PROP_ParaAdjust, uno::makeAny(eAdjust));
1613  }
1614  }
1615  }
1616  }
1617  }
1618  else if (mbTextBox)
1619  {
1620  // No drawingML text, but WPS text is expected: save the theme
1621  // character color on the shape, then.
1622  if(const ShapeStyleRef* pFontRef = getShapeStyleRef(XML_fontRef))
1623  {
1624  ::Color nCharColor = pFontRef->maPhClr.getColor(rGraphicHelper);
1625  aPropertySet.setAnyProperty(PROP_CharColor, uno::makeAny(nCharColor));
1626  }
1627  }
1628 
1629  // Set glow effect properties
1630  if ( aEffectProperties.maGlow.moGlowRad.has() )
1631  {
1632  uno::Reference<beans::XPropertySet> propertySet (mxShape, uno::UNO_QUERY);
1633  propertySet->setPropertyValue("GlowEffectRadius", makeAny(convertEmuToHmm(aEffectProperties.maGlow.moGlowRad.get())));
1634  propertySet->setPropertyValue("GlowEffectColor", makeAny(aEffectProperties.maGlow.moGlowColor.getColor(rGraphicHelper)));
1635  propertySet->setPropertyValue("GlowEffectTransparency", makeAny(aEffectProperties.maGlow.moGlowColor.getTransparency()));
1636  }
1637 
1638  // Set soft edge effect properties
1639  if (aEffectProperties.maSoftEdge.moRad.has())
1640  {
1641  uno::Reference<beans::XPropertySet> propertySet(mxShape, uno::UNO_QUERY);
1642  propertySet->setPropertyValue(
1643  "SoftEdgeRadius", makeAny(convertEmuToHmm(aEffectProperties.maSoftEdge.moRad.get())));
1644  }
1645  }
1646 
1647  if( mxShape.is() )
1648  finalizeXShape( rFilterBase, rxShapes );
1649 
1650  return mxShape;
1651 }
1652 
1653 void Shape::keepDiagramDrawing(XmlFilterBase& rFilterBase, const OUString& rFragmentPath)
1654 {
1655  uno::Sequence<uno::Any> diagramDrawing(2);
1656  // drawingValue[0] => dom, drawingValue[1] => Sequence of associated relationships
1657 
1658  sal_Int32 length = maDiagramDoms.getLength();
1659  maDiagramDoms.realloc(length + 1);
1660 
1661  diagramDrawing[0] <<= rFilterBase.importFragment(rFragmentPath);
1662  diagramDrawing[1] <<= resolveRelationshipsOfTypeFromOfficeDoc(rFilterBase, rFragmentPath, u"image");
1663 
1664  beans::PropertyValue* pValue = maDiagramDoms.getArray();
1665  pValue[length].Name = "OOXDrawing";
1666  pValue[length].Value <<= diagramDrawing;
1667 }
1668 
1670 {
1671  try
1672  {
1673  if( !maDiagramDoms.hasElements() )
1674  return;
1675 
1676  Reference < XPropertySet > xSet( mxShape, UNO_QUERY_THROW );
1677  Reference < XPropertySetInfo > xSetInfo( xSet->getPropertySetInfo() );
1678  if ( !xSetInfo.is() )
1679  return;
1680 
1681  if (mpDiagramData)
1682  {
1684  pObj->SetDiagramData(mpDiagramData);
1685  }
1686 
1687  const OUString aGrabBagPropName = UNO_NAME_MISC_OBJ_INTEROPGRABBAG;
1688  if( !xSetInfo->hasPropertyByName( aGrabBagPropName ) )
1689  return;
1690 
1691  Sequence < PropertyValue > aGrabBag;
1692  xSet->getPropertyValue( aGrabBagPropName ) >>= aGrabBag;
1693 
1694  // We keep the previous items, if present
1695  if ( aGrabBag.hasElements() )
1696  xSet->setPropertyValue( aGrabBagPropName, Any( comphelper::concatSequences(aGrabBag, maDiagramDoms) ) );
1697  else
1698  xSet->setPropertyValue( aGrabBagPropName, Any( maDiagramDoms ) );
1699  }
1700  catch( const Exception& )
1701  {
1702  TOOLS_WARN_EXCEPTION( "oox.drawingml", "Shape::keepDiagramCompatibilityInfo" );
1703  }
1704 }
1705 
1707 {
1708  // Each name represents a group of shapes, for which the font height should have the same
1709  // scaling.
1710  for (const auto& rNameAndPairs : maDiagramFontHeights)
1711  {
1712  // Find out the minimum scale within this group.
1713  const ShapePairs& rShapePairs = rNameAndPairs.second;
1714  sal_Int16 nMinScale = 100;
1715  for (const auto& rShapePair : rShapePairs)
1716  {
1717  uno::Reference<beans::XPropertySet> xPropertySet(rShapePair.second, uno::UNO_QUERY);
1718  if (xPropertySet.is())
1719  {
1720  sal_Int16 nTextFitToSizeScale = 0;
1721  xPropertySet->getPropertyValue("TextFitToSizeScale") >>= nTextFitToSizeScale;
1722  if (nTextFitToSizeScale > 0 && nTextFitToSizeScale < nMinScale)
1723  {
1724  nMinScale = nTextFitToSizeScale;
1725  }
1726  }
1727  }
1728 
1729  // Set that minimum scale for all members of the group.
1730  if (nMinScale < 100)
1731  {
1732  for (const auto& rShapePair : rShapePairs)
1733  {
1734  uno::Reference<beans::XPropertySet> xPropertySet(rShapePair.second, uno::UNO_QUERY);
1735  if (xPropertySet.is())
1736  {
1737  xPropertySet->setPropertyValue("TextFitToSizeScale", uno::makeAny(nMinScale));
1738  }
1739  }
1740  }
1741  }
1742 }
1743 
1745 {
1746  try
1747  {
1748  Reference<XPropertySet> xSet(mxShape, UNO_QUERY_THROW);
1749 
1750  xSet->setPropertyValue("MoveProtect", Any(true));
1751  xSet->setPropertyValue("SizeProtect", Any(true));
1752 
1753  // Replace existing shapes with a new Graphic Object rendered
1754  // from them
1755  Reference<XShape> xShape(renderDiagramToGraphic(rFilterBase));
1756  Reference<XShapes> xShapes(mxShape, UNO_QUERY_THROW);
1757  while (xShapes->hasElements())
1758  xShapes->remove(Reference<XShape>(xShapes->getByIndex(0), UNO_QUERY_THROW));
1759  xShapes->add(xShape);
1760  }
1761  catch (const Exception&)
1762  {
1763  TOOLS_WARN_EXCEPTION("oox.drawingml", "Shape::convertSmartArtToMetafile");
1764  }
1765 }
1766 
1768 {
1769  Reference< XShape > xShape;
1770 
1771  try
1772  {
1773  if( !maDiagramDoms.hasElements() )
1774  return xShape;
1775 
1776  // Stream in which to place the rendered shape
1777  SvMemoryStream aTempStream;
1779  Reference < io::XOutputStream > xOutputStream( xStream->getOutputStream() );
1780 
1781  // Size of the rendering
1782  awt::Size aActualSize = mxShape->getSize();
1783  Size aResolution(Application::GetDefaultDevice()->LogicToPixel(Size(100, 100), MapMode(MapUnit::MapCM)));
1784  double fPixelsPer100thmm = static_cast < double > ( aResolution.Width() ) / 100000.0;
1785  awt::Size aSize( static_cast < sal_Int32 > ( ( fPixelsPer100thmm * aActualSize.Width ) + 0.5 ),
1786  static_cast < sal_Int32 > ( ( fPixelsPer100thmm * aActualSize.Height ) + 0.5 ) );
1787 
1788  Sequence< PropertyValue > aFilterData( 4 );
1789  aFilterData[ 0 ].Name = "PixelWidth";
1790  aFilterData[ 0 ].Value <<= aSize.Width;
1791  aFilterData[ 1 ].Name = "PixelHeight";
1792  aFilterData[ 1 ].Value <<= aSize.Height;
1793  aFilterData[ 2 ].Name = "LogicalWidth";
1794  aFilterData[ 2 ].Value <<= aActualSize.Width;
1795  aFilterData[ 3 ].Name = "LogicalHeight";
1796  aFilterData[ 3 ].Value <<= aActualSize.Height;
1797 
1798  Sequence < PropertyValue > aDescriptor( 3 );
1799  aDescriptor[ 0 ].Name = "OutputStream";
1800  aDescriptor[ 0 ].Value <<= xOutputStream;
1801  aDescriptor[ 1 ].Name = "FilterName";
1802  aDescriptor[ 1 ].Value <<= OUString("SVM"); // Rendering format
1803  aDescriptor[ 2 ].Name = "FilterData";
1804  aDescriptor[ 2 ].Value <<= aFilterData;
1805 
1806  Reference < lang::XComponent > xSourceDoc( mxShape, UNO_QUERY_THROW );
1807  Reference < XGraphicExportFilter > xGraphicExporter = GraphicExportFilter::create( rFilterBase.getComponentContext() );
1808  xGraphicExporter->setSourceDocument( xSourceDoc );
1809  xGraphicExporter->filter( aDescriptor );
1810 
1811  aTempStream.Seek( STREAM_SEEK_TO_BEGIN );
1812 
1813  Graphic aGraphic;
1814  GraphicFilter aFilter( false );
1815  if ( aFilter.ImportGraphic( aGraphic, "", aTempStream, GRFILTER_FORMAT_NOTFOUND, nullptr, GraphicFilterImportFlags::NONE, static_cast < Sequence < PropertyValue >* > ( nullptr ) ) != ERRCODE_NONE )
1816  {
1817  SAL_WARN( "oox.drawingml", "Shape::renderDiagramToGraphic: Unable to import rendered stream into graphic object" );
1818  return xShape;
1819  }
1820 
1821  Reference < graphic::XGraphic > xGraphic( aGraphic.GetXGraphic() );
1822  Reference < lang::XMultiServiceFactory > xServiceFact( rFilterBase.getModel(), UNO_QUERY_THROW );
1823  xShape.set( xServiceFact->createInstance( "com.sun.star.drawing.GraphicObjectShape" ), UNO_QUERY_THROW );
1824  Reference < XPropertySet > xPropSet( xShape, UNO_QUERY_THROW );
1825  xPropSet->setPropertyValue( "Graphic", Any( xGraphic ) );
1826  xPropSet->setPropertyValue( "MoveProtect", Any( true ) );
1827  xPropSet->setPropertyValue( "SizeProtect", Any( true ) );
1828  xPropSet->setPropertyValue( "Name", Any( OUString( "RenderedShapes" ) ) );
1829  }
1830  catch( const Exception& )
1831  {
1832  TOOLS_WARN_EXCEPTION( "oox.drawingml", "Shape::renderDiagramToGraphic" );
1833  }
1834 
1835  return xShape;
1836 }
1837 
1838 void Shape::setTextBody(const TextBodyPtr & pTextBody)
1839 {
1840  mpTextBody = pTextBody;
1841 }
1842 
1843 void Shape::setMasterTextListStyle( const TextListStylePtr& pMasterTextListStyle )
1844 {
1845  SAL_INFO("oox.drawingml", "Shape::setMasterTextListStyle: Set master text list style to shape id='" << msId << "'");
1846 
1847  mpMasterTextListStyle = pMasterTextListStyle;
1848 }
1849 
1850 OUString Shape::finalizeServiceName( XmlFilterBase& rFilter, const OUString& rServiceName, const awt::Rectangle& rShapeRect )
1851 {
1852  OUString aServiceName = rServiceName;
1853  switch( meFrameType )
1854  {
1855  case FRAMETYPE_OLEOBJECT:
1856  {
1857  awt::Size aOleSize( rShapeRect.Width, rShapeRect.Height );
1859  aServiceName = "com.sun.star.drawing.OLE2Shape";
1860 
1861  // get the path to the representation graphic
1862  OUString aGraphicPath;
1863  if( !mxOleObjectInfo->maShapeId.isEmpty() )
1864  if( ::oox::vml::Drawing* pVmlDrawing = rFilter.getVmlDrawing() )
1865  if( const ::oox::vml::ShapeBase* pVmlShape = pVmlDrawing->getShapes().getShapeById( mxOleObjectInfo->maShapeId ) )
1866  aGraphicPath = pVmlShape->getGraphicPath();
1867 
1868  // import and store the graphic
1869  if( !aGraphicPath.isEmpty() )
1870  {
1871  // Transfer shape's width and height to graphicsfilter (can be used by WMF/EMF)
1872  WmfExternal aExtHeader;
1873  aExtHeader.mapMode = 8; // MM_ANISOTROPIC
1874  aExtHeader.xExt = rShapeRect.Width;
1875  aExtHeader.yExt = rShapeRect.Height;
1876 
1877  Reference< graphic::XGraphic > xGraphic = rFilter.getGraphicHelper().importEmbeddedGraphic( aGraphicPath, &aExtHeader );
1878  if( xGraphic.is() )
1879  maShapeProperties.setProperty(PROP_Graphic, xGraphic);
1880  }
1881  }
1882  break;
1883 
1884  default:;
1885  }
1886  return aServiceName;
1887 }
1888 
1889 void Shape::finalizeXShape( XmlFilterBase& rFilter, const Reference< XShapes >& rxShapes )
1890 {
1891  switch( meFrameType )
1892  {
1893  case FRAMETYPE_CHART:
1894  {
1895  OSL_ENSURE( !mxChartShapeInfo->maFragmentPath.isEmpty(), "Shape::finalizeXShape - missing chart fragment" );
1896  if( mxShape.is() && !mxChartShapeInfo->maFragmentPath.isEmpty() ) try
1897  {
1898  // set the chart2 OLE class ID at the OLE shape
1899  PropertySet aShapeProp( mxShape );
1900  aShapeProp.setProperty( PROP_CLSID, OUString( "12dcae26-281f-416f-a234-c3086127382e" ) );
1901 
1902  // get the XModel interface of the embedded object from the OLE shape
1903  Reference< frame::XModel > xDocModel;
1904  aShapeProp.getProperty( xDocModel, PROP_Model );
1905  Reference< chart2::XChartDocument > xChartDoc( xDocModel, UNO_QUERY_THROW );
1906 
1907  // load the chart data from the XML fragment
1908  bool bMSO2007Doc = rFilter.isMSO2007Document();
1909  chart::ChartSpaceModel aModel(bMSO2007Doc);
1911  rFilter, mxChartShapeInfo->maFragmentPath, aModel );
1912  const OUString aThemeOverrideFragmentPath( pChartSpaceFragment->
1913  getFragmentPathFromFirstTypeFromOfficeDoc(u"themeOverride") );
1914  rFilter.importFragment( pChartSpaceFragment );
1915  ::oox::ppt::PowerPointImport *pPowerPointImport =
1916  dynamic_cast< ::oox::ppt::PowerPointImport* >(&rFilter);
1917  if (!aThemeOverrideFragmentPath.isEmpty() && pPowerPointImport)
1918  {
1919  uno::Reference< xml::sax::XFastSAXSerializable > xDoc(
1920  rFilter.importFragment(aThemeOverrideFragmentPath), uno::UNO_QUERY_THROW);
1921  ThemePtr pTheme = pPowerPointImport->getActualSlidePersist()->getTheme();
1923  rFilter, aThemeOverrideFragmentPath, *pTheme), xDoc);
1924  pPowerPointImport->getActualSlidePersist()->setTheme(pTheme);
1925  }
1926 
1927  // convert imported chart model to chart document
1928  Reference< drawing::XShapes > xExternalPage;
1929  if( !mxChartShapeInfo->mbEmbedShapes )
1930  xExternalPage = rxShapes;
1931  if( rFilter.getChartConverter() )
1932  {
1933  rFilter.getChartConverter()->convertFromModel( rFilter, aModel, xChartDoc, xExternalPage, mxShape->getPosition(), mxShape->getSize() );
1934  if( !xChartDoc->hasInternalDataProvider() )
1935  {
1936  Reference< chart2::data::XDataReceiver > xDataRec( xChartDoc, UNO_QUERY );
1937  Reference< chart2::data::XDataSource > xData = xDataRec->getUsedData();
1938  if( !xData->getDataSequences().hasElements() || !xData->getDataSequences()[0]->getValues().is() ||
1939  !xData->getDataSequences()[0]->getValues()->getData().hasElements() )
1940  {
1941  rFilter.useInternalChartDataTable( true );
1942  rFilter.getChartConverter()->convertFromModel( rFilter, aModel, xChartDoc, xExternalPage, mxShape->getPosition(), mxShape->getSize() );
1943  rFilter.useInternalChartDataTable( false );
1944  }
1945  }
1946 
1947  }
1948  }
1949  catch( Exception& )
1950  {
1951  }
1952  }
1953  break;
1954 
1955  default:;
1956  }
1957 }
1958 
1959 void Shape::putPropertyToGrabBag( const OUString& sPropertyName, const Any& aPropertyValue )
1960 {
1961  PropertyValue aNewProperty;
1962  aNewProperty.Name = sPropertyName;
1963  aNewProperty.Value = aPropertyValue;
1964  putPropertyToGrabBag( aNewProperty );
1965 }
1966 
1967 void Shape::putPropertyToGrabBag( const PropertyValue& pProperty )
1968 {
1969  Reference< XPropertySet > xSet( mxShape, UNO_QUERY );
1970  Reference< XPropertySetInfo > xSetInfo( xSet->getPropertySetInfo() );
1971  const OUString aGrabBagPropName = UNO_NAME_MISC_OBJ_INTEROPGRABBAG;
1972  if( mxShape.is() && xSet.is() && xSetInfo.is() && xSetInfo->hasPropertyByName( aGrabBagPropName ) )
1973  {
1974  Sequence< PropertyValue > aGrabBag;
1975  xSet->getPropertyValue( aGrabBagPropName ) >>= aGrabBag;
1976 
1977  sal_Int32 length = aGrabBag.getLength();
1978  aGrabBag.realloc( length + 1 );
1979  aGrabBag[length] = pProperty;
1980 
1981  xSet->setPropertyValue( aGrabBagPropName, Any( aGrabBag ) );
1982  }
1983 }
1984 
1986 {
1987  Reference< XPropertySet > xSet( mxShape, UNO_QUERY );
1988  Reference< XPropertySetInfo > xSetInfo( xSet->getPropertySetInfo() );
1989  const OUString aGrabBagPropName = UNO_NAME_MISC_OBJ_INTEROPGRABBAG;
1990  if( !(mxShape.is() && xSet.is() && xSetInfo.is() && xSetInfo->hasPropertyByName( aGrabBagPropName )) )
1991  return;
1992 
1993  // get existing grab bag
1994  Sequence< PropertyValue > aGrabBag;
1995  xSet->getPropertyValue( aGrabBagPropName ) >>= aGrabBag;
1996 
1997  std::vector<PropertyValue> aVec;
1998  aVec.reserve(aProperties.getLength());
1999 
2000  // put the new items
2001  std::transform(aProperties.begin(), aProperties.end(), std::back_inserter(aVec),
2002  [](const PropertyValue& rProp) {
2003  PropertyValue aProp;
2004  aProp.Name = rProp.Name;
2005  aProp.Value = rProp.Value;
2006  return aProp;
2007  });
2008 
2009  // put it back to the shape
2010  xSet->setPropertyValue( aGrabBagPropName, Any( comphelper::concatSequences(aGrabBag, aVec) ) );
2011 }
2012 
2013 FillProperties Shape::getActualFillProperties(const Theme* pTheme, const FillProperties* pParentShapeFillProps) const
2014 {
2015  FillProperties aFillProperties;
2016  aFillProperties.moFillType = XML_noFill;
2017 
2018  // Reference shape properties
2019  aFillProperties.assignUsed( *mpShapeRefFillPropPtr );
2020 
2021  // Theme
2022  if( pTheme != nullptr )
2023  {
2024  if( const ShapeStyleRef* pFillRef = getShapeStyleRef( XML_fillRef ) )
2025  {
2026  if( const FillProperties* pFillProps = pTheme->getFillStyle( pFillRef->mnThemedIdx ) )
2027  aFillProperties.assignUsed( *pFillProps );
2028  }
2029  }
2030 
2031  // Properties specified directly for this shape
2032  aFillProperties.assignUsed(getFillProperties());
2033 
2034  // Parent shape's properties
2035  if ( pParentShapeFillProps != nullptr)
2036  if( getFillProperties().moFillType.has() && getFillProperties().moFillType.get() == XML_grpFill )
2037  aFillProperties.assignUsed( *pParentShapeFillProps );
2038 
2039  return aFillProperties;
2040 }
2041 
2043 {
2044  LineProperties aLineProperties;
2045  aLineProperties.maLineFill.moFillType = XML_noFill;
2046 
2047  // Reference shape properties
2048  aLineProperties.assignUsed( *mpShapeRefLinePropPtr );
2049 
2050  // Theme
2051  if( pTheme != nullptr )
2052  {
2053  if( const ShapeStyleRef* pLineRef = getShapeStyleRef( XML_lnRef ) )
2054  {
2055  if( const LineProperties* pLineProps = pTheme->getLineStyle( pLineRef->mnThemedIdx ) )
2056  aLineProperties.assignUsed( *pLineProps );
2057  }
2058  }
2059 
2060  // Properties specified directly for this shape
2061  aLineProperties.assignUsed( getLineProperties() );
2062 
2063  return aLineProperties;
2064 }
2065 
2067 {
2068  EffectProperties aEffectProperties;
2069 
2070  // Reference shape properties
2071  aEffectProperties.assignUsed( *mpShapeRefEffectPropPtr );
2072 
2073  // Theme
2074  if( pTheme != nullptr )
2075  {
2076  if( const ShapeStyleRef* pEffectRef = getShapeStyleRef( XML_effectRef ) )
2077  {
2078  if( const EffectProperties* pEffectProps = pTheme->getEffectStyle( pEffectRef->mnThemedIdx ) )
2079  aEffectProperties.assignUsed( *pEffectProps );
2080  }
2081  }
2082 
2083  // Properties specified directly for this shape
2084  aEffectProperties.assignUsed ( getEffectProperties() );
2085 
2086  return aEffectProperties;
2087 }
2088 
2089 uno::Sequence< uno::Sequence< uno::Any > > Shape::resolveRelationshipsOfTypeFromOfficeDoc(core::XmlFilterBase& rFilter, const OUString& sFragment, std::u16string_view sType )
2090 {
2091  uno::Sequence< uno::Sequence< uno::Any > > xRelListTemp;
2092  sal_Int32 counter = 0;
2093 
2094  core::RelationsRef xRels = rFilter.importRelations( sFragment );
2095  if ( xRels )
2096  {
2097  core::RelationsRef xImageRels = xRels->getRelationsFromTypeFromOfficeDoc( sType );
2098  if ( xImageRels )
2099  {
2100  xRelListTemp.realloc( xImageRels->size() );
2101  for (auto const& imageRel : *xImageRels)
2102  {
2103  uno::Sequence< uno::Any > diagramRelTuple (3);
2104  // [0] => RID, [1] => InputStream [2] => extension
2105  OUString sRelId = imageRel.second.maId;
2106 
2107  diagramRelTuple[0] <<= sRelId;
2108  OUString sTarget = xImageRels->getFragmentPathFromRelId( sRelId );
2109 
2110  uno::Reference< io::XInputStream > xImageInputStrm( rFilter.openInputStream( sTarget ), uno::UNO_SET_THROW );
2111  StreamDataSequence dataSeq;
2112  if ( rFilter.importBinaryData( dataSeq, sTarget ) )
2113  {
2114  diagramRelTuple[1] <<= dataSeq;
2115  }
2116 
2117  diagramRelTuple[2] <<= sTarget.copy( sTarget.lastIndexOf(".") );
2118 
2119  xRelListTemp[counter] = diagramRelTuple;
2120  ++counter;
2121  }
2122  xRelListTemp.realloc(counter);
2123 
2124  }
2125  }
2126  return xRelListTemp;
2127 }
2128 
2130 {
2131  auto pFillProperties = std::make_shared<FillProperties>();
2132  pFillProperties->assignUsed(*mpFillPropertiesPtr);
2133  mpFillPropertiesPtr = pFillProperties;
2134 }
2135 }
2136 
2137 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Provides helper functions for colors, device measurement conversion, graphics, and graphic objects ha...
std::shared_ptr< Relations > RelationsRef
Definition: relations.hxx:63
double getY() const
css::uno::Reference< css::graphic::XGraphic > importEmbeddedGraphic(const OUString &rStreamName, const WmfExternal *pExtHeader=nullptr) const
Imports a graphic from the storage stream with the passed path and name.
FrameType meFrameType
Type for graphic frame shapes.
Definition: shape.hxx:342
std::vector< Reference< XAnimationNode > > maChildren
void keepDiagramDrawing(::oox::core::XmlFilterBase &rFilterBase, const OUString &rFragmentPath)
Definition: shape.cxx:1653
GraphicPropertiesPtr mpGraphicPropertiesPtr
Definition: shape.hxx:316
Shape(const char *pServiceType=nullptr, bool bDefaultHeight=true)
Definition: shape.cxx:115
Shape3DProperties & get3DProperties()
Definition: shape.hxx:128
virtual void useInternalChartDataTable(bool)
Helper to switch chart data table - specifically for xlsx imports.
sal_Int32 nIndex
DiagramDataPtr mpDiagramData
Definition: shape.hxx:368
sal_Int32 convertEmuToHmm(sal_Int64 nValue)
Converts the passed 64-bit integer value from EMUs to 1/100 mm.
std::vector< std::unique_ptr< Effect > > m_Effects
Stores all effect properties, including those not supported by core yet.
ErrCode ImportGraphic(Graphic &rGraphic, const INetURLObject &rPath, sal_uInt16 nFormat=GRFILTER_FORMAT_DONTKNOW, sal_uInt16 *pDeterminedFormat=nullptr, GraphicFilterImportFlags nImportFlags=GraphicFilterImportFlags::NONE)
bool isLinkedTxbx() const
Definition: shape.hxx:218
void set(sal_uInt16 nRow, sal_uInt16 nColumn, double fValue)
void putPropertiesToGrabBag(const css::uno::Sequence< css::beans::PropertyValue > &aProperties)
Definition: shape.cxx:1985
This class is used for creating XmlStream.
OUString msServiceName
Definition: shape.hxx:327
const EffectProperties * getEffectStyle(sal_Int32 nIndex) const
Definition: theme.cxx:57
void addChildren(::oox::core::XmlFilterBase &rFilterBase, Shape &rMaster, const Theme *pTheme, const css::uno::Reference< css::drawing::XShapes > &rxShapes, ShapeIdMap *pShapeMap, const basegfx::B2DHomMatrix &aTransformation)
Definition: shape.cxx:389
PropertyMap & getShapeProperties()
Definition: shape.hxx:115
Handler for a chart fragment (c:chartSpace root element).
std::map< OUString, ShapePairs > NamedShapePairs
std::shared_ptr< TableProperties > TablePropertiesPtr
OptValue< sal_Int32 > moFillType
static SdrTextHorzAdjust lcl_convertAdjust(ParagraphAdjust eAdjust)
Definition: shape.cxx:422
SdrTextHorzAdjust
sal_Int32 mnSubType
Definition: shape.hxx:332
static SdrObject * getSdrObjectFromXShape(const css::uno::Reference< css::uno::XInterface > &xInt)
const ShapeStyleRef * getShapeStyleRef(sal_Int32 nRefType) const
Definition: shape.cxx:261
constexpr Point convert(const Point &rPoint, o3tl::Length eFrom, o3tl::Length eTo)
#define UNO_NAME_FILLSTYLE
void putPropertyToGrabBag(const OUString &sPropertyName, const css::uno::Any &aPropertyValue)
bool setProperty(sal_Int32 nPropId, Type &&rValue)
Sets the specified property to the passed value.
Definition: propertymap.hxx:70
CustomShapePropertiesPtr mpCustomShapePropertiesPtr
Definition: shape.hxx:317
void setMasterTextListStyle(const TextListStylePtr &pMasterTextListStyle)
Definition: shape.cxx:1843
sal_uInt64 Seek(sal_uInt64 nPos)
bool importFragment(const rtl::Reference< FragmentHandler > &rxHandler)
Imports a fragment using the passed fragment handler, which contains the full path to the fragment st...
ModelObjectHelper & getModelObjectHelper() const
Returns a helper with containers for various named drawing objects for the imported document...
Definition: filterbase.cxx:350
geometry::RealPoint2D maPosition
ChartShapeInfo & setChartType(bool bEmbedShapes)
Definition: shape.cxx:227
PropertyMap maDefaultShapeProperties
Definition: shape.hxx:323
static void lcl_setPropertyValue(std::vector< beans::PropertyValue > &rPropVec, const OUString &rName, const beans::PropertyValue &rPropertyValue)
Definition: shape.cxx:413
sal_Int32 getLineWidth() const
Calculates the line width attribute from the internal state of the object.
#define SO3_SM_CLASSID
std::shared_ptr< T > make_shared(Args &&...args)
const OUString & getInternalName() const
Definition: shape.hxx:154
OUString GetFontworkType(const OUString &rMsoType)
bool mbTextBox
This shape has a textbox.
Definition: shape.hxx:363
css::drawing::LineJoint getLineJoint() const
Calculates the line joint attribute from the internal state of the object.
void setX(double fX)
css::uno::Reference< css::graphic::XGraphic > GetXGraphic() const
css::uno::Reference< css::awt::XBitmap > getFillBitmap(OUString const &rGraphicName)
::oox::vml::OleObjectInfo & setOleObjectType()
Definition: shape.cxx:219
#define UNO_NAME_TEXT_AUTOGROWWIDTH
void syncDiagramFontHeights()
Definition: shape.cxx:1706
double get(sal_uInt16 nRow, sal_uInt16 nColumn) const
GraphicHelper & getGraphicHelper() const
Returns a helper for the handling of graphics and graphic objects.
Definition: filterbase.cxx:343
static OutputDevice * GetDefaultDevice()
#define UNO_NAME_FILLCOLOR
bool equalZero() const
void setProperties(const css::uno::Sequence< OUString > &rPropNames, const css::uno::Sequence< css::uno::Any > &rValues)
Puts the passed properties into the property set.
constexpr tools::Long Width() const
uno::Reference< drawing::XShape > const mxShape
css::uno::Any const & rValue
LinePropertiesPtr mpShapeRefLinePropPtr
Definition: shape.hxx:313
void setTextBody(const TextBodyPtr &pTextBody)
Definition: shape.cxx:1838
void setLockedCanvas(bool bLockedCanvas)
Definition: shape.cxx:326
const OUString & getSchemeName() const
Returns the scheme name from the a:schemeClr element for interoperability purposes.
Definition: color.hxx:100
bool importBinaryData(StreamDataSequence &orDataSeq, const OUString &rStreamName)
Imports the raw binary data from the specified stream.
Definition: filterbase.cxx:379
Reference< document::XActionLockable > m_xLockable
Definition: shape.cxx:383
Reference< XInputStream > xStream
PropertiesInfo aProperties
void set(const Type &rValue)
Definition: helper.hxx:188
constexpr OUStringLiteral sServiceName
OUString finalizeServiceName(::oox::core::XmlFilterBase &rFilter, const OUString &rServiceName, const css::awt::Rectangle &rShapeRect)
Definition: shape.cxx:1850
void insert(sal_uInt32 nIndex, const basegfx::B2DPoint &rPoint, sal_uInt32 nCount=1)
const Type & get() const
Definition: helper.hxx:185
css::awt::Point maPosition
Definition: shape.hxx:338
SDRTEXTHORZADJUST_CENTER
Degree100 NormAngle36000(Degree100 deg100)
EffectProperties & getEffectProperties() const
Definition: shape.hxx:133
void setTextBox(bool bTextBox)
Definition: shape.cxx:336
bool setAnyProperty(sal_Int32 nPropId, const css::uno::Any &rValue)
Puts the passed any into the property set.
Definition: propertyset.cxx:70
css::uno::Sequence< css::beans::PropertyValue > InitPropertySequence(::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)
#define UNO_NAME_CHAR_POSTURE
float GetFontHeight(sal_Int32 nHeight)
ChartShapeInfoRef mxChartShapeInfo
Additional data for chart shapes.
Definition: shape.hxx:350
#define UNO_NAME_MISC_OBJ_INTEROPGRABBAG
css::uno::Reference< css::drawing::XShape > mxShape
Definition: shape.hxx:325
sal_Int32 mnRotation
Definition: shape.hxx:352
EffectSoftEdgeProperties maSoftEdge
OLE object embedded in a shape.
Definition: shape.hxx:253
sal_uInt16 mapMode
T NormAngle360(T angle)
css::drawing::LineStyle getLineStyle() const
Calculates the line style attribute from the internal state of the object.
table::TablePropertiesPtr mpTablePropertiesPtr
Definition: shape.hxx:318
void pushToPropMap(ShapePropertyMap &rPropMap, const GraphicHelper &rGraphicHelper,::Color nPhClr=API_RGB_TRANSPARENT) const
Writes the properties to the passed property map.
std::vector< ShapePtr > maChildren
Definition: shape.hxx:307
bool mbWps
Is this a wps shape?
Definition: shape.hxx:362
SDRTEXTHORZADJUST_LEFT
css::uno::Sequence< sal_Int8 > StreamDataSequence
UNDERLYING_TYPE get() const
Interface class, StarMath will implement readFormulaOoxml() to read OOXML representing the formula an...
Definition: import.hxx:29
#define TOOLS_WARN_EXCEPTION(area, stream)
::Color getColor(const GraphicHelper &rGraphicHelper,::Color nPhClr=API_RGB_TRANSPARENT) const
Returns the final RGB color value.
Definition: color.cxx:481
static SvtFilterOptions & Get()
virtual void finalizeXShape(::oox::core::XmlFilterBase &rFilter, const css::uno::Reference< css::drawing::XShapes > &rxShapes)
void clearTransformations()
Removes all color transformations.
Definition: color.cxx:361
OleObjectInfoRef mxOleObjectInfo
Additional data for OLE objects.
Definition: shape.hxx:349
LineProperties & getLineProperties()
Definition: shape.hxx:117
css::awt::Size maSize
Definition: shape.hxx:337
bool isUsed() const
Returns true, if the color is initialized.
Definition: color.hxx:87
bool mbLockedCanvas
Is this shape part of a locked canvas?
Definition: shape.hxx:361
::oox::ole::OleObjectHelper & getOleObjectHelper() const
Returns a helper for the handling of OLE objects.
Definition: filterbase.cxx:365
Contains information about an OLE object embedded in a draw page.
Definition: vmldrawing.hxx:62
bool decompose(B2DTuple &rScale, B2DTuple &rTranslate, double &rRotate, double &rShearX) const
void rotate(double fRadiant)
OUString GetHexName() const
#define STREAM_SEEK_TO_BEGIN
virtual ~Shape()
Definition: shape.cxx:193
bool importOleObject(PropertyMap &rPropMap, const OleObjectInfo &rOleObject, const css::awt::Size &rObjSize)
TextBodyPtr mpTextBody
Definition: shape.hxx:311
std::enable_if< std::is_signed< T >::value, T >::type saturating_add(T a, T b)
A table embedded in a shape.
Definition: shape.hxx:256
void pushToPropMap(PropertyMap &rPropMap, const GraphicHelper &rGraphicHelper) const
Writes the properties to the passed property map.
void setDefaults(bool bHeight)
Definition: shape.cxx:204
GradientFillProperties maGradientProps
Solid fill color and transparence.
float u
FillProperties getActualFillProperties(const Theme *pTheme, const FillProperties *pParentShapeFillProps) const
Definition: shape.cxx:2013
void scale(double fX, double fY)
const css::uno::Reference< css::uno::XComponentContext > & getComponentContext() const
Returns the component context passed in the filter constructor (always existing). ...
Definition: filterbase.cxx:212
SVXCORE_DLLPUBLIC SdrObject * GetSdrObjectFromXShape(const css::uno::Reference< css::drawing::XShape > &xShape) noexcept
constexpr double deg2rad(double v)
void SetMergedItem(const SfxPoolItem &rItem)
void addShape(::oox::core::XmlFilterBase &rFilterBase, const Theme *pTheme, const css::uno::Reference< css::drawing::XShapes > &rxShapes, const basegfx::B2DHomMatrix &aTransformation, FillProperties &rShapeOrParentShapeFillProps, ShapeIdMap *pShapeMap=nullptr, oox::drawingml::ShapePtr pParentGroupShape=nullptr)
Definition: shape.cxx:267
void convertSmartArtToMetafile(::oox::core::XmlFilterBase const &rFilterBase)
Definition: shape.cxx:1744
Additional information for a chart embedded in a drawing shape.
Definition: shape.hxx:87
ColorTransparency
PropertyValueVector_t aPropertyValues
std::shared_ptr< TextBody > TextBodyPtr
A wrapper for a UNO property set.
Definition: propertyset.hxx:57
virtual ::oox::vml::Drawing * getVmlDrawing()=0
Has to be implemented by each filter to return the collection of VML shapes.
void pushToPropMap(ShapePropertyMap &rPropMap, const GraphicHelper &rGraphicHelper, sal_Int32 nShapeRotation=0,::Color nPhClr=API_RGB_TRANSPARENT, bool bFlipH=false, bool bFlipV=false, bool bIsCustomShape=false) const
Writes the properties to the passed property map.
css::uno::Sequence< T > concatSequences(const css::uno::Sequence< T > &rS1, const Ss &...rSn)
void convertFromModel(::oox::core::XmlFilterBase &rFilter, ChartSpaceModel &rChartModel, const css::uno::Reference< css::chart2::XChartDocument > &rxChartDoc, const css::uno::Reference< css::drawing::XShapes > &rxExternalPage, const css::awt::Point &rChartPos, const css::awt::Size &rChartSize)
Converts the passed OOXML chart model to the passed chart2 document.
LineProperties getActualLineProperties(const Theme *pTheme) const
Definition: shape.cxx:2042
EffectPropertiesPtr mpShapeRefEffectPropPtr
Definition: shape.hxx:321
const css::uno::Sequence< css::beans::PropertyValue > & getTransformations() const
Returns the unaltered list of transformations for interoperability purposes.
Definition: color.hxx:102
const css::uno::Reference< css::frame::XModel > & getModel() const
Returns the document model (always existing).
Definition: filterbase.cxx:217
sal_uInt16 xExt
void transform(const basegfx::B2DHomMatrix &rMatrix)
const LineProperties * getLineStyle(sal_Int32 nIndex) const
Returns the line properties of the passed one-based themed style index.
Definition: theme.cxx:52
tools::Long const nBorder
const SlidePersistPtr & getActualSlidePersist() const
Definition: pptimport.hxx:69
static void lcl_createPresetShape(const uno::Reference< drawing::XShape > &xShape, const OUString &rClass, const OUString &rPresetType, const CustomShapePropertiesPtr &pCustomShapePropertiesPtr, const TextBodyPtr &pTextBody, const GraphicHelper &rGraphicHelper)
Definition: shape.cxx:433
const TextCharacterProperties * getFontStyle(sal_Int32 nSchemeType) const
Returns theme font properties by scheme type (major/minor).
Definition: theme.cxx:62
SDRTEXTHORZADJUST_RIGHT
std::map< std::shared_ptr< drawingml::Shape >, css::uno::Reference< css::drawing::XShape >> ShapePairs
const TextBodyPtr & getTextBody() const
Definition: shape.hxx:175
std::shared_ptr< TextListStyle > TextListStylePtr
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
void assignUsed(const EffectProperties &rSourceProps)
Overwrites all members that are explicitly set in rSourceProps.
static const OUString & getPropertyName(sal_Int32 nPropId)
Returns the name of the passed property identifier.
sal_uInt16 yExt
FillProperties maLineFill
End line arrow style.
#define ERRCODE_NONE
#define UNO_NAME_CHAR_WEIGHT
TextListStylePtr mpMasterTextListStyle
Definition: shape.hxx:324
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
css::uno::Sequence< css::beans::PropertyValue > getShape3DAttributes(const GraphicHelper &rGraphicHelper,::Color rPhClr)
EffectProperties getActualEffectProperties(const Theme *pTheme) const
Definition: shape.cxx:2066
#define SAL_INFO(area, stream)
NamedShapePairs * getDiagramFontHeights()
css::uno::Reference< css::io::XInputStream > openInputStream(const OUString &rStreamName) const
Opens and returns the specified input stream from the base storage.
Definition: filterbase.cxx:324
css::drawing::LineCap getLineCap() const
Calculates the line cap attribute from the internal state of the object.
::std::map< OUString, ShapePtr > ShapeIdMap
Definition: shape.hxx:72
css::uno::Reference< css::drawing::XShape > const & createAndInsert(::oox::core::XmlFilterBase &rFilterBase, const OUString &rServiceName, const Theme *pTheme, const css::uno::Reference< css::drawing::XShapes > &rxShapes, bool bClearText, bool bDoNotInsertEmptyTextBody, basegfx::B2DHomMatrix &aTransformation, FillProperties &rShapeOrParentShapeFillProps, oox::drawingml::ShapePtr pParentGroupShape=nullptr)
Definition: shape.cxx:672
oox::core::NamedShapePairs maDiagramFontHeights
For SmartArt, this contains groups of shapes: automatic font size is the same in each group...
Definition: shape.hxx:389
bool isPlaceHolder() const
Returns true, if the color is a placeholder color in theme style lists.
Definition: color.hxx:89
#define UNO_NAME_TEXT_AUTOGROWHEIGHT
void keepDiagramCompatibilityInfo()
Definition: shape.cxx:1669
const char * name
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_BLACK
sal_Int16 getTransparency() const
Returns the transparency of the color (0 = opaque, 100 = full transparent).
Definition: color.cxx:658
void assignUsed(const TextCharacterProperties &rSourceProps)
Overwrites all members that are explicitly set in rSourceProps.
virtual ::oox::drawingml::chart::ChartConverter * getChartConverter()=0
Has to be implemented by each filter, returns a filter-specific chart converter object, that should be global per imported document.
bool mbUseBgFill
The shape fill should be set to that of the slide background surface.
Definition: shape.hxx:386
void translate(double fX, double fY)
ShapeStyleRefMap maShapeStyleRefs
Definition: shape.hxx:335
RelationsRef importRelations(const OUString &rFragmentPath)
Imports the relations fragment associated with the specified fragment.
void assignUsed(const FillProperties &rSourceProps)
Properties for bitmap fills.
Represents the collection of VML shapes for a complete draw page.
Definition: vmldrawing.hxx:93
#define UNO_NAME_CHAR_HEIGHT
std::shared_ptr< CustomShapeProperties > CustomShapePropertiesPtr
static void lcl_resetPropertyValue(std::vector< beans::PropertyValue > &rPropVec, const OUString &rName)
Definition: shape.cxx:404
#define SAL_WARN(area, stream)
double getX() const
OUString msDescription
Definition: shape.hxx:331
std::shared_ptr< Shape > ShapePtr
Color maFillColor
Fill type (OOXML token).
sal_Int32 nLength
css::uno::Sequence< css::beans::PropertyValue > getCameraAttributes()
css::uno::Reference< css::drawing::XShape > renderDiagramToGraphic(::oox::core::XmlFilterBase const &rFilterBase)
Definition: shape.cxx:1767
void setServiceName(const char *pServiceName)
Definition: shape.cxx:255
void assignUsed(const LineProperties &rSourceProps)
Line joint type (OOXML token).
void applyShapeReference(const Shape &rReferencedShape, bool bUseText=true)
Definition: shape.cxx:341
FillPropertiesPtr mpShapeRefFillPropPtr
Definition: shape.hxx:315
OptValue< sal_Int32 > moLineWidth
User-defined line dash style.
FillProperties & getFillProperties()
Definition: shape.hxx:120
PropertyMap maShapeProperties
Definition: shape.hxx:322
sal_Int32 mnDiagramRotation
Definition: shape.hxx:353
Complex diagram drawing shape.
Definition: shape.hxx:255
Chart embedded in a shape.
Definition: shape.hxx:254
void setWps(bool bWps)
Definition: shape.cxx:331
bool has() const
Definition: helper.hxx:181
css::uno::Sequence< css::uno::Sequence< css::uno::Any > > resolveRelationshipsOfTypeFromOfficeDoc(core::XmlFilterBase &rFilter, const OUString &sFragment, std::u16string_view sType)
Definition: shape.cxx:2089
std::shared_ptr< Theme > ThemePtr
Generic shape, no special type.
Definition: shape.hxx:252
const FillProperties * getFillStyle(sal_Int32 nIndex) const
Returns the fill properties of the passed one-based themed style index.
Definition: theme.cxx:45
void cloneFillProperties()
Changes reference semantics to value semantics for fill properties.
Definition: shape.cxx:2129
OUString msName
const LinkedTxbxAttr & getLinkedTxbxAttributes() const
Definition: shape.hxx:217
table::TablePropertiesPtr const & getTableProperties()
Definition: shape.cxx:197
FillPropertiesPtr mpFillPropertiesPtr
Definition: shape.hxx:314
::basegfx::B2IVector maSize
sal_uInt32 count() const
#define GRFILTER_FORMAT_NOTFOUND
basegfx::B2DPoint const & getB2DPoint(sal_uInt32 nIndex) const
css::uno::Sequence< css::beans::PropertyValue > getLightRigAttributes()
css::uno::Sequence< css::beans::PropertyValue > maDiagramDoms
Definition: shape.hxx:367
css::uno::Any SAL_CALL makeAny(const SharedUNOComponent< INTERFACE, COMPONENT > &value)