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