LibreOffice Module oox (master)  1
vmlshape.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 <algorithm>
21 
22 #include <optional>
23 
24 #include <o3tl/safeint.hxx>
25 #include <oox/vml/vmlshape.hxx>
26 #include <vcl/wmfexternal.hxx>
27 
28 #include <com/sun/star/beans/XPropertySet.hpp>
29 #include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
30 #include <com/sun/star/drawing/FillStyle.hpp>
31 #include <com/sun/star/drawing/PointSequenceSequence.hpp>
32 #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
33 #include <com/sun/star/drawing/TextVerticalAdjust.hpp>
34 #include <com/sun/star/drawing/XEnhancedCustomShapeDefaulter.hpp>
35 #include <com/sun/star/drawing/XShapes.hpp>
36 #include <com/sun/star/drawing/XControlShape.hpp>
37 #include <com/sun/star/graphic/XGraphic.hpp>
38 #include <com/sun/star/table/BorderLine2.hpp>
39 #include <com/sun/star/text/HoriOrientation.hpp>
40 #include <com/sun/star/text/RelOrientation.hpp>
41 #include <com/sun/star/text/SizeType.hpp>
42 #include <com/sun/star/text/VertOrientation.hpp>
43 #include <com/sun/star/text/WrapTextMode.hpp>
44 #include <com/sun/star/lang/XServiceInfo.hpp>
45 #include <com/sun/star/text/TextContentAnchorType.hpp>
46 #include <com/sun/star/text/GraphicCrop.hpp>
47 #include <com/sun/star/security/DocumentDigitalSignatures.hpp>
48 #include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
49 #include <com/sun/star/text/WritingMode2.hpp>
50 #include <sal/log.hxx>
54 #include <oox/ole/axcontrol.hxx>
57 #include <oox/token/properties.hxx>
58 #include <oox/token/tokens.hxx>
59 #include <oox/vml/vmldrawing.hxx>
61 #include <oox/vml/vmltextbox.hxx>
65 #include <svx/unoapi.hxx>
66 #include <svx/sdtagitm.hxx>
67 #include <svx/svdobj.hxx>
68 #include <comphelper/sequence.hxx>
73 
74 using ::com::sun::star::beans::XPropertySet;
75 using ::com::sun::star::uno::Any;
76 
77 using namespace ::com::sun::star;
78 using namespace ::com::sun::star::text;
79 
80 namespace oox::vml {
81 
82 using namespace ::com::sun::star::drawing;
83 using namespace ::com::sun::star::graphic;
84 using namespace ::com::sun::star::uno;
85 using namespace ::com::sun::star::io;
86 
87 using ::oox::core::XmlFilterBase;
88 
89 namespace {
90 
91 const sal_Int32 VML_SHAPETYPE_PICTUREFRAME = 75;
92 const sal_Int32 VML_SHAPETYPE_HOSTCONTROL = 201;
93 
94 awt::Point lclGetAbsPoint( const awt::Point& rRelPoint, const awt::Rectangle& rShapeRect, const awt::Rectangle& rCoordSys )
95 {
96  double fWidthRatio = static_cast< double >( rShapeRect.Width ) / rCoordSys.Width;
97  double fHeightRatio = static_cast< double >( rShapeRect.Height ) / rCoordSys.Height;
98  awt::Point aAbsPoint;
99  aAbsPoint.X = static_cast< sal_Int32 >( rShapeRect.X + fWidthRatio * (rRelPoint.X - rCoordSys.X) + 0.5 );
100  aAbsPoint.Y = static_cast< sal_Int32 >( rShapeRect.Y + fHeightRatio * (rRelPoint.Y - rCoordSys.Y) + 0.5 );
101  return aAbsPoint;
102 }
103 
104 awt::Rectangle lclGetAbsRect( const awt::Rectangle& rRelRect, const awt::Rectangle& rShapeRect, const awt::Rectangle& rCoordSys )
105 {
106  double fWidthRatio = static_cast< double >( rShapeRect.Width ) / rCoordSys.Width;
107  double fHeightRatio = static_cast< double >( rShapeRect.Height ) / rCoordSys.Height;
108  awt::Rectangle aAbsRect;
109  aAbsRect.X = static_cast< sal_Int32 >( rShapeRect.X + fWidthRatio * (rRelRect.X - rCoordSys.X) + 0.5 );
110  aAbsRect.Y = static_cast< sal_Int32 >( rShapeRect.Y + fHeightRatio * (rRelRect.Y - rCoordSys.Y) + 0.5 );
111  aAbsRect.Width = static_cast< sal_Int32 >( fWidthRatio * rRelRect.Width + 0.5 );
112  aAbsRect.Height = static_cast< sal_Int32 >( fHeightRatio * rRelRect.Height + 0.5 );
113  return aAbsRect;
114 }
115 
117 sal_Int32 lclConvertCrop(const OUString& rCrop, sal_uInt32 nSize)
118 {
119  if (rCrop.endsWith("f"))
120  {
121  // Numeric value is specified in 1/65536-ths.
122  sal_uInt32 nCrop = rCrop.copy(0, rCrop.getLength() - 1).toUInt32();
123  return (nCrop * nSize) / 65536;
124  }
125 
126  return 0;
127 }
128 
129 } // namespace
130 
132  mbAutoHeight( false ),
133  mbVisible( true )
134 {
135 }
136 
138 {
142  /* The style properties position, left, top, width, height, margin-left,
143  margin-top are not derived from shape template to shape. */
148 }
149 
151  mrDrawing( rDrawing )
152 {
153 }
154 
156 {
157 }
158 
159 sal_Int32 ShapeType::getShapeType() const
160 {
161  return maTypeModel.moShapeType.get( 0 );
162 }
163 
165 {
166  return maTypeModel.moGraphicPath.get( OUString() );
167 }
168 
169 awt::Rectangle ShapeType::getCoordSystem() const
170 {
171  Int32Pair aCoordPos = maTypeModel.moCoordPos.get( Int32Pair( 0, 0 ) );
172  Int32Pair aCoordSize = maTypeModel.moCoordSize.get( Int32Pair( 1000, 1000 ) );
173  if( aCoordSize.first == 0 )
174  aCoordSize.first = 1;
175  if( aCoordSize.second == 0 )
176  aCoordSize.second = 1;
177  return awt::Rectangle( aCoordPos.first, aCoordPos.second, aCoordSize.first, aCoordSize.second );
178 }
179 
180 awt::Rectangle ShapeType::getRectangle( const ShapeParentAnchor* pParentAnchor ) const
181 {
182  return pParentAnchor ?
183  lclGetAbsRect( getRelRectangle(), pParentAnchor->maShapeRect, pParentAnchor->maCoordSys ) :
184  getAbsRectangle();
185 }
186 
187 awt::Rectangle ShapeType::getAbsRectangle() const
188 {
189  const GraphicHelper& rGraphicHelper = mrDrawing.getFilter().getGraphicHelper();
190 
191  sal_Int32 nWidth = ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maTypeModel.maWidth, 0, true, true );
192  if ( nWidth == 0 )
193  nWidth = 1;
194 
195  sal_Int32 nHeight = ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maTypeModel.maHeight, 0, false, true );
196  if ( nHeight == 0 )
197  nHeight = 1;
198 
199  sal_Int32 nLeft;
200  if (o3tl::checked_add<sal_Int32>(ConversionHelper::decodeMeasureToHmm(rGraphicHelper, maTypeModel.maLeft, 0, true, true),
201  ConversionHelper::decodeMeasureToHmm(rGraphicHelper, maTypeModel.maMarginLeft, 0, true, true),
202  nLeft))
203  {
204  SAL_WARN("oox", "overflow in addition");
205  nLeft = 0;
206  }
207  if (nLeft == 0 && maTypeModel.maPosition == "absolute")
208  nLeft = 1;
209 
210  return awt::Rectangle(
211  nLeft,
212  ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maTypeModel.maTop, 0, false, true ) + ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maTypeModel.maMarginTop, 0, false, true ),
213  nWidth, nHeight );
214 }
215 
216 awt::Rectangle ShapeType::getRelRectangle() const
217 {
218  sal_Int32 nWidth = maTypeModel.maWidth.toInt32();
219  if ( nWidth == 0 )
220  nWidth = 1;
221 
222  sal_Int32 nHeight = maTypeModel.maHeight.toInt32();
223  if ( nHeight == 0 )
224  nHeight = 1;
225 
226  return awt::Rectangle(
227  maTypeModel.maLeft.toInt32(),
228  maTypeModel.maTop.toInt32(),
229  nWidth, nHeight );
230 }
231 
233  mnObjType( XML_TOKEN_INVALID ),
234  mnTextHAlign( XML_Left ),
235  mnTextVAlign( XML_Top ),
236  mnCol( -1 ),
237  mnRow( -1 ),
238  mnChecked( VML_CLIENTDATA_UNCHECKED ),
239  mnDropStyle( XML_Combo ),
240  mnDropLines( 1 ),
241  mnVal( 0 ),
242  mnMin( 0 ),
243  mnMax( 0 ),
244  mnInc( 0 ),
245  mnPage( 0 ),
246  mnSelType( XML_Single ),
247  mnVTEdit( VML_CLIENTDATA_TEXT ),
248  mbPrintObject( true ),
249  mbVisible( false ),
250  mbDde( false ),
251  mbNo3D( false ),
252  mbNo3D2( false ),
253  mbMultiLine( false ),
254  mbVScroll( false ),
255  mbSecretEdit( false )
256 {
257 }
258 
260  : mbIsSignatureLine(false)
261  , mbSignatureLineShowSignDate(true)
262  , mbSignatureLineCanAddComment(false)
263  , mbInGroup(false)
264 {
265 }
266 
268 {
269 }
270 
272 {
273  mxTextBox.reset( new TextBox(rModel) );
274  return *mxTextBox;
275 }
276 
278 {
279  mxClientData.reset( new ClientData );
280  return *mxClientData;
281 }
282 
284  ShapeType( rDrawing )
285 {
286 }
287 
289 {
290  if( maShapeModel.maType.getLength() <= 1 )
291  return;
292 
293  OUString aType = maShapeModel.maType;
294  if (aType[ 0 ] == '#')
295  aType = aType.copy(1);
296  if( const ShapeType* pShapeType = mrDrawing.getShapes().getShapeTypeById( aType ) )
297  {
298  // Make sure that the props from maTypeModel have priority over the props from
299  // the shape type.
300  StrokeModel aMergedStrokeModel;
301  aMergedStrokeModel.assignUsed(pShapeType->getTypeModel().maStrokeModel);
302  aMergedStrokeModel.assignUsed(maTypeModel.maStrokeModel);
303  FillModel aMergedFillModel;
304  aMergedFillModel.assignUsed(pShapeType->getTypeModel().maFillModel);
305  aMergedFillModel.assignUsed(maTypeModel.maFillModel);
306 
307  maTypeModel.assignUsed( pShapeType->getTypeModel() );
308  maTypeModel.maStrokeModel = aMergedStrokeModel;
309  maTypeModel.maFillModel = aMergedFillModel;
310  }
311  else {
312  // Temporary fix, shapetype not found if referenced from different substream
313  // FIXME: extend scope of ShapeContainer to store all shapetypes from the document
314  static const OUStringLiteral sShapeTypePrefix = u"shapetype_";
315  OUString tmp;
316  if (aType.startsWith(sShapeTypePrefix)) {
317  maTypeModel.moShapeType = aType.copy(sShapeTypePrefix.getLength()).toInt32();
318  }
319  else if (aType.startsWith("_x0000_t", &tmp)) {
320  maTypeModel.moShapeType = tmp.toInt32();
321  }
322  }
323 }
324 
325 OUString ShapeBase::getShapeName() const
326 {
327  if( !maTypeModel.maShapeName.isEmpty() )
328  return maTypeModel.maShapeName;
329 
330  OUString aBaseName = mrDrawing.getShapeBaseName( *this );
331  if( !aBaseName.isEmpty() )
332  {
333  sal_Int32 nShapeIdx = mrDrawing.getLocalShapeIndex( getShapeId() );
334  if( nShapeIdx > 0 )
335  return aBaseName + OUStringChar(' ') + OUString::number( nShapeIdx );
336  }
337 
338  return OUString();
339 }
340 
341 const ShapeType* ShapeBase::getChildTypeById( const OUString& ) const
342 {
343  return nullptr;
344 }
345 
346 const ShapeBase* ShapeBase::getChildById( const OUString& ) const
347 {
348  return nullptr;
349 }
350 
351 Reference< XShape > ShapeBase::convertAndInsert( const Reference< XShapes >& rxShapes, const ShapeParentAnchor* pParentAnchor ) const
352 {
353  Reference< XShape > xShape;
354  if( mrDrawing.isShapeSupported( *this ) )
355  {
356  /* Calculate shape rectangle. Applications may do something special
357  according to some imported shape client data (e.g. Excel cell anchor). */
358  awt::Rectangle aShapeRect = calcShapeRectangle( pParentAnchor );
359 
360  if( ((aShapeRect.Width > 0) || (aShapeRect.Height > 0)) && rxShapes.is() )
361  {
362  xShape = implConvertAndInsert( rxShapes, aShapeRect );
363  if( xShape.is() )
364  {
365  // set imported or generated shape name (not supported by form controls)
366  PropertySet aShapeProp( xShape );
367  if( aShapeProp.hasProperty( PROP_Name ) )
368  aShapeProp.setProperty( PROP_Name, getShapeName() );
369  uno::Reference< lang::XServiceInfo > xSInfo( xShape, uno::UNO_QUERY_THROW );
370 
371  OUString sLinkChainName = getTypeModel().maLegacyId;
372  sal_Int32 id = 0;
373  sal_Int32 idPos = sLinkChainName.indexOf("_x");
374  sal_Int32 seq = 0;
375  if (idPos >= 0)
376  {
377  sal_Int32 seqPos = sLinkChainName.indexOf("_s",idPos);
378  if (idPos < seqPos)
379  {
380  auto idPosEnd = idPos+2;
381  id = sLinkChainName.copy(idPosEnd, seqPos - idPosEnd).toInt32();
382  seq = sLinkChainName.copy(seqPos+2).toInt32();
383  }
384  }
385 
386  OUString s_mso_next_textbox;
387  if( getTextBox() )
388  s_mso_next_textbox = getTextBox()->msNextTextbox;
389  if( s_mso_next_textbox.startsWith("#") )
390  s_mso_next_textbox = s_mso_next_textbox.copy(1);
391 
392  if (xSInfo->supportsService("com.sun.star.text.TextFrame"))
393  {
394  uno::Reference<beans::XPropertySet> propertySet (xShape, uno::UNO_QUERY);
395  uno::Any aAny = propertySet->getPropertyValue("FrameInteropGrabBag");
396  auto aGrabBag = comphelper::sequenceToContainer< std::vector<beans::PropertyValue> >(aAny.get< uno::Sequence<beans::PropertyValue> >());
397 
398  aGrabBag.push_back(comphelper::makePropertyValue("VML-Z-ORDER", maTypeModel.maZIndex.toInt32()));
399 
400  if( !s_mso_next_textbox.isEmpty() )
401  aGrabBag.push_back(comphelper::makePropertyValue("mso-next-textbox", s_mso_next_textbox));
402 
403  if( !sLinkChainName.isEmpty() )
404  {
405  aGrabBag.push_back(comphelper::makePropertyValue("TxbxHasLink", true));
406  aGrabBag.push_back(comphelper::makePropertyValue("Txbx-Id", id));
407  aGrabBag.push_back(comphelper::makePropertyValue("Txbx-Seq", seq));
408  aGrabBag.push_back(comphelper::makePropertyValue("LinkChainName", sLinkChainName));
409  }
410 
411  if(!maTypeModel.maRotation.isEmpty())
412  aGrabBag.push_back(comphelper::makePropertyValue("mso-rotation-angle", ConversionHelper::decodeRotation(maTypeModel.maRotation).get()));
413  propertySet->setPropertyValue("FrameInteropGrabBag", uno::makeAny(comphelper::containerToSequence(aGrabBag)));
414  sal_Int32 backColorTransparency = 0;
415  propertySet->getPropertyValue("BackColorTransparency")
416  >>= backColorTransparency;
417  if (propertySet->getPropertyValue("FillStyle") == FillStyle_NONE &&
418  backColorTransparency == 100)
419  {
420  // If there is no fill, the Word default is 100% transparency.
421  propertySet->setPropertyValue("FillTransparence", makeAny(sal_Int16(100)));
422  }
423  }
424  else
425  {
426  if( maTypeModel.maZIndex.toInt32() )
427  {
428  uno::Sequence<beans::PropertyValue> aGrabBag;
429  uno::Reference<beans::XPropertySet> propertySet (xShape, uno::UNO_QUERY);
430  propertySet->getPropertyValue("InteropGrabBag") >>= aGrabBag;
431  sal_Int32 length;
432 
433  length = aGrabBag.getLength();
434  aGrabBag.realloc( length+1 );
435  aGrabBag[length].Name = "VML-Z-ORDER";
436  aGrabBag[length].Value <<= maTypeModel.maZIndex.toInt32();
437 
438  if( !s_mso_next_textbox.isEmpty() )
439  {
440  length = aGrabBag.getLength();
441  aGrabBag.realloc( length+1 );
442  aGrabBag[length].Name = "mso-next-textbox";
443  aGrabBag[length].Value <<= s_mso_next_textbox;
444  }
445 
446  if( !sLinkChainName.isEmpty() )
447  {
448  length = aGrabBag.getLength();
449  aGrabBag.realloc( length+4 );
450  aGrabBag[length].Name = "TxbxHasLink";
451  aGrabBag[length].Value <<= true;
452  aGrabBag[length+1].Name = "Txbx-Id";
453  aGrabBag[length+1].Value <<= id;
454  aGrabBag[length+2].Name = "Txbx-Seq";
455  aGrabBag[length+2].Value <<= seq;
456  aGrabBag[length+3].Name = "LinkChainName";
457  aGrabBag[length+3].Value <<= sLinkChainName;
458  }
459  propertySet->setPropertyValue( "InteropGrabBag", uno::makeAny(aGrabBag) );
460  }
461  }
462  Reference< XControlShape > xControlShape( xShape, uno::UNO_QUERY );
463  if ( xControlShape.is() && !getTypeModel().mbVisible )
464  {
465  PropertySet aControlShapeProp( xControlShape->getControl() );
466  aControlShapeProp.setProperty( PROP_EnableVisible, uno::makeAny( false ) );
467  }
468 
469  xShape = finalImplConvertAndInsert(xShape);
470  /* Notify the drawing that a new shape has been inserted. For
471  convenience, pass the rectangle that contains position and
472  size of the shape. */
473  bool bGroupChild = pParentAnchor != nullptr;
474  mrDrawing.notifyXShapeInserted( xShape, aShapeRect, *this, bGroupChild );
475  }
476  }
477  else
478  SAL_WARN("oox", "not converting shape, as calculated rectangle is empty");
479  }
480  return xShape;
481 }
482 
483 void ShapeBase::convertFormatting( const Reference< XShape >& rxShape ) const
484 {
485  if( !rxShape.is() )
486  return;
487 
488  /* Calculate shape rectangle. Applications may do something special
489  according to some imported shape client data (e.g. Excel cell anchor). */
490  awt::Rectangle aShapeRect = calcShapeRectangle( nullptr );
491 
492  // convert the shape, if the calculated rectangle is not empty
493  if( (aShapeRect.Width > 0) || (aShapeRect.Height > 0) )
494  {
495  rxShape->setPosition( awt::Point( aShapeRect.X, aShapeRect.Y ) );
496  rxShape->setSize( awt::Size( aShapeRect.Width, aShapeRect.Height ) );
497  convertShapeProperties( rxShape );
498  }
499 }
500 
501 void ShapeBase::setContainer(ShapeContainer* pContainer) { mpContainer = pContainer; }
502 
504 
505 // protected ------------------------------------------------------------------
506 
507 awt::Rectangle ShapeBase::calcShapeRectangle( const ShapeParentAnchor* pParentAnchor ) const
508 {
509  /* Calculate shape rectangle. Applications may do something special
510  according to some imported shape client data (e.g. Excel cell anchor). */
511  awt::Rectangle aShapeRect;
512  const ClientData* pClientData = getClientData();
513  if( !pClientData || !mrDrawing.convertClientAnchor( aShapeRect, pClientData->maAnchor ) )
514  aShapeRect = getRectangle( pParentAnchor );
515  return aShapeRect;
516 }
517 
518 void ShapeBase::convertShapeProperties( const Reference< XShape >& rxShape ) const
519 {
521  const GraphicHelper& rGraphicHelper = mrDrawing.getFilter().getGraphicHelper();
522  maTypeModel.maStrokeModel.pushToPropMap( aPropMap, rGraphicHelper );
523  maTypeModel.maFillModel.pushToPropMap( aPropMap, rGraphicHelper );
524 
525  uno::Reference<lang::XServiceInfo> xSInfo(rxShape, uno::UNO_QUERY_THROW);
526  if (xSInfo->supportsService("com.sun.star.text.TextFrame"))
527  {
528  // Any other service supporting the ShadowFormat property?
529  maTypeModel.maShadowModel.pushToPropMap(aPropMap, rGraphicHelper);
530  // TextFrames have BackColor, not FillColor
531  if (aPropMap.hasProperty(PROP_FillColor))
532  {
533  aPropMap.setAnyProperty(PROP_BackColor, aPropMap.getProperty(PROP_FillColor));
534  aPropMap.erase(PROP_FillColor);
535  }
536  // TextFrames have BackColorTransparency, not FillTransparence
537  if (aPropMap.hasProperty(PROP_FillTransparence))
538  {
539  aPropMap.setAnyProperty(PROP_BackColorTransparency, aPropMap.getProperty(PROP_FillTransparence));
540  aPropMap.erase(PROP_FillTransparence);
541  }
542  // And no LineColor property; individual borders can have colors and widths
543  std::optional<sal_Int32> oLineWidth;
546  rGraphicHelper, maTypeModel.maStrokeModel.moWeight.get(), 0, false, false);
547  if (aPropMap.hasProperty(PROP_LineColor))
548  {
549  uno::Reference<beans::XPropertySet> xPropertySet(rxShape, uno::UNO_QUERY);
550  static const sal_Int32 aBorders[] = {
551  PROP_TopBorder, PROP_LeftBorder, PROP_BottomBorder, PROP_RightBorder
552  };
553  for (sal_Int32 nBorder : aBorders)
554  {
555  table::BorderLine2 aBorderLine = xPropertySet->getPropertyValue(PropertyMap::getPropertyName(nBorder)).get<table::BorderLine2>();
556  aBorderLine.Color = aPropMap.getProperty(PROP_LineColor).get<sal_Int32>();
557  if (oLineWidth)
558  aBorderLine.LineWidth = *oLineWidth;
559  aPropMap.setProperty(nBorder, aBorderLine);
560  }
561  aPropMap.erase(PROP_LineColor);
562  }
563  }
564  else if (xSInfo->supportsService("com.sun.star.drawing.CustomShape"))
565  maTypeModel.maTextpathModel.pushToPropMap(aPropMap, rxShape, rGraphicHelper);
566 
567  PropertySet( rxShape ).setProperties( aPropMap );
568 }
569 
570 SimpleShape::SimpleShape( Drawing& rDrawing, const OUString& rService ) :
571  ShapeBase( rDrawing ),
572  maService( rService )
573 {
574 }
575 
576 static void lcl_setSurround(PropertySet& rPropSet, const ShapeTypeModel& rTypeModel, const GraphicHelper& rGraphicHelper)
577 {
578  OUString aWrapType = rTypeModel.moWrapType.get();
579 
580  // Extreme negative top margin? Then the shape will end up at the top of the page, it's pointless to perform any kind of wrapping.
581  sal_Int32 nMarginTop = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, rTypeModel.maMarginTop, 0, false, true);
582  if (nMarginTop < -35277) // Less than 1000 points.
583  aWrapType.clear();
584 
585  css::text::WrapTextMode nSurround = css::text::WrapTextMode_THROUGH;
586  if ( aWrapType == "square" || aWrapType == "tight" ||
587  aWrapType == "through" )
588  {
589  nSurround = css::text::WrapTextMode_PARALLEL;
590  if ( rTypeModel.moWrapSide.get() == "left" )
591  nSurround = css::text::WrapTextMode_LEFT;
592  else if ( rTypeModel.moWrapSide.get() == "right" )
593  nSurround = css::text::WrapTextMode_RIGHT;
594  }
595  else if ( aWrapType == "topAndBottom" )
596  nSurround = css::text::WrapTextMode_NONE;
597 
598  rPropSet.setProperty(PROP_Surround, static_cast<sal_Int32>(nSurround));
599  rPropSet.setProperty(PROP_SurroundContour, aWrapType == "tight");
600 }
601 
602 static void lcl_SetAnchorType(PropertySet& rPropSet, const ShapeTypeModel& rTypeModel, const GraphicHelper& rGraphicHelper)
603 {
604  if ( rTypeModel.maPosition == "absolute" )
605  {
606  // Word supports as-character (inline) and at-character only, absolute can't be inline.
607  rPropSet.setProperty(PROP_AnchorType, text::TextContentAnchorType_AT_CHARACTER);
608  // anchor is set after insertion, so reset to NONE
609  rPropSet.setAnyProperty(PROP_VertOrient, makeAny(text::VertOrientation::NONE));
610 
611  if ( rTypeModel.maPositionVerticalRelative == "page" )
612  {
613  rPropSet.setProperty(PROP_VertOrientRelation, text::RelOrientation::PAGE_FRAME);
614  }
615  else if ( rTypeModel.maPositionVerticalRelative == "margin" )
616  {
617  rPropSet.setProperty(PROP_VertOrientRelation, text::RelOrientation::PAGE_PRINT_AREA);
618  }
619  else if (rTypeModel.maPositionVerticalRelative == "top-margin-area")
620  {
621  rPropSet.setProperty(PROP_VertOrientRelation, text::RelOrientation::PAGE_PRINT_AREA_TOP);
622  }
623  else if (rTypeModel.maPositionVerticalRelative == "bottom-margin-area")
624  {
625  rPropSet.setProperty(PROP_VertOrientRelation, text::RelOrientation::PAGE_PRINT_AREA_BOTTOM);
626  }
627  else
628  {
629  rPropSet.setProperty(PROP_VertOrientRelation, text::RelOrientation::FRAME);
630  }
631  }
632  else if( rTypeModel.maPosition == "relative" )
633  { // I'm not very sure this is correct either.
634  rPropSet.setProperty(PROP_AnchorType, text::TextContentAnchorType_AT_PARAGRAPH);
635  // anchor is set after insertion, so reset to NONE
636  rPropSet.setAnyProperty(PROP_VertOrient, makeAny(text::VertOrientation::NONE));
637  }
638  else // static (is the default) means anchored inline
639  {
640  rPropSet.setProperty(PROP_AnchorType, text::TextContentAnchorType_AS_CHARACTER);
641  // Use top orientation, this one seems similar to what MSO uses as inline
642  rPropSet.setAnyProperty(PROP_VertOrient, makeAny(text::VertOrientation::TOP));
643  }
644 
645  if ( rTypeModel.maPositionHorizontal == "center" )
646  rPropSet.setAnyProperty(PROP_HoriOrient, makeAny(text::HoriOrientation::CENTER));
647  else if ( rTypeModel.maPositionHorizontal == "left" )
648  rPropSet.setAnyProperty(PROP_HoriOrient, makeAny(text::HoriOrientation::LEFT));
649  else if ( rTypeModel.maPositionHorizontal == "right" )
650  rPropSet.setAnyProperty(PROP_HoriOrient, makeAny(text::HoriOrientation::RIGHT));
651  else if ( rTypeModel.maPositionHorizontal == "inside" )
652  {
653  rPropSet.setAnyProperty(PROP_HoriOrient, makeAny(text::HoriOrientation::LEFT));
654  rPropSet.setAnyProperty(PROP_PageToggle, makeAny(true));
655  }
656  else if ( rTypeModel.maPositionHorizontal == "outside" )
657  {
658  rPropSet.setAnyProperty(PROP_HoriOrient, makeAny(text::HoriOrientation::RIGHT));
659  rPropSet.setAnyProperty(PROP_PageToggle, makeAny(true));
660  }
661 
662  if ( rTypeModel.maPositionHorizontalRelative == "page" )
663  rPropSet.setAnyProperty(PROP_HoriOrientRelation, makeAny(text::RelOrientation::PAGE_FRAME));
664  else if ( rTypeModel.maPositionHorizontalRelative == "margin" )
665  rPropSet.setProperty(PROP_HoriOrientRelation, text::RelOrientation::PAGE_PRINT_AREA);
666  else if (rTypeModel.maPositionHorizontalRelative == "right-margin-area" ||
667  rTypeModel.maPositionHorizontalRelative == "inner-margin-area")
668  rPropSet.setProperty(PROP_HoriOrientRelation, text::RelOrientation::PAGE_RIGHT);
669  else if (rTypeModel.maPositionHorizontalRelative == "left-margin-area" ||
670  rTypeModel.maPositionHorizontalRelative == "outer-margin-area")
671  rPropSet.setProperty(PROP_HoriOrientRelation, text::RelOrientation::PAGE_LEFT);
672  else if ( rTypeModel.maPositionHorizontalRelative == "text" )
673  rPropSet.setProperty(PROP_HoriOrientRelation, text::RelOrientation::FRAME);
674 
675  if ( rTypeModel.maPositionVertical == "center" )
676  rPropSet.setAnyProperty(PROP_VertOrient, makeAny(text::VertOrientation::CENTER));
677  else if ( rTypeModel.maPositionVertical == "top" )
678  rPropSet.setAnyProperty(PROP_VertOrient, makeAny(text::VertOrientation::TOP));
679  else if ( rTypeModel.maPositionVertical == "bottom" )
680  rPropSet.setAnyProperty(PROP_VertOrient, makeAny(text::VertOrientation::BOTTOM));
681  else if ( rTypeModel.maPositionVertical == "inside" )
682  rPropSet.setAnyProperty(PROP_VertOrient, makeAny(text::VertOrientation::TOP));
683  else if ( rTypeModel.maPositionVertical == "outside" )
684  rPropSet.setAnyProperty(PROP_VertOrient, makeAny(text::VertOrientation::BOTTOM));
685 
686  lcl_setSurround( rPropSet, rTypeModel, rGraphicHelper );
687 }
688 
689 Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes >& rxShapes, const awt::Rectangle& rShapeRect ) const
690 {
691  awt::Rectangle aShapeRect(rShapeRect);
692  std::optional<Degree100> oRotation;
693  bool bFlipX = false, bFlipY = false;
694  // tdf#137765: skip this rotation for line shapes
695  if (!maTypeModel.maRotation.isEmpty() && maService != "com.sun.star.drawing.LineShape")
697  if (!maTypeModel.maFlip.isEmpty())
698  {
699  if (maTypeModel.maFlip.startsWith("x"))
700  {
701  bFlipX = true;
702  }
703  if (maTypeModel.maFlip.endsWith("y"))
704  {
705  bFlipY = true;
706  }
707  }
708 
709  Reference< XShape > xShape = mrDrawing.createAndInsertXShape( maService, rxShapes, aShapeRect );
710  SdrObject* pShape = GetSdrObjectFromXShape( xShape );
711  if( pShape && getShapeType() >= 0 )
712  {
713  OUString aShapeType = EnhancedCustomShapeTypeNames::Get( static_cast< MSO_SPT >(getShapeType()) );
714  //The resize autoshape to fit text attr of FontWork/Word-Art should always be false
715  //for the fallback geometry.
716  if(aShapeType.startsWith("fontwork"))
717  {
720  }
721  }
722  convertShapeProperties( xShape );
723 
724  // Handle left/right/top/bottom wrap distance.
725  // Default value of mso-wrap-distance-left/right is supposed to be 0 (see
726  // 19.1.2.19 of the VML spec), but Word implements a non-zero value.
727  // [MS-ODRAW] says the below default value in 2.3.4.9.
728  const GraphicHelper& rGraphicHelper = mrDrawing.getFilter().getGraphicHelper();
729  OUString aWrapDistanceLeft = OUString::number(0x0001BE7C);
730  if (!maTypeModel.maWrapDistanceLeft.isEmpty())
731  aWrapDistanceLeft = maTypeModel.maWrapDistanceLeft;
732  sal_Int32 nWrapDistanceLeft = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, aWrapDistanceLeft, 0, true, false);
733  PropertySet(xShape).setAnyProperty(PROP_LeftMargin, uno::makeAny(nWrapDistanceLeft));
734  OUString aWrapDistanceRight = OUString::number(0x0001BE7C);
735  if (!maTypeModel.maWrapDistanceRight.isEmpty())
736  aWrapDistanceRight = maTypeModel.maWrapDistanceRight;
737  sal_Int32 nWrapDistanceRight = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, aWrapDistanceRight, 0, true, false);
738  PropertySet(xShape).setAnyProperty(PROP_RightMargin, uno::makeAny(nWrapDistanceRight));
739  sal_Int32 nWrapDistanceTop = 0;
740  if (!maTypeModel.maWrapDistanceTop.isEmpty())
741  nWrapDistanceTop = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, maTypeModel.maWrapDistanceTop, 0, false, true);
742  PropertySet(xShape).setAnyProperty(PROP_TopMargin, uno::makeAny(nWrapDistanceTop));
743  sal_Int32 nWrapDistanceBottom = 0;
744  if (!maTypeModel.maWrapDistanceBottom.isEmpty())
745  nWrapDistanceBottom = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, maTypeModel.maWrapDistanceBottom, 0, false, true);
746  PropertySet(xShape).setAnyProperty(PROP_BottomMargin, uno::makeAny(nWrapDistanceBottom));
747 
748  if ( maService == "com.sun.star.text.TextFrame" )
749  {
750  PropertySet( xShape ).setAnyProperty( PROP_FrameIsAutomaticHeight, makeAny( maTypeModel.mbAutoHeight ) );
751  PropertySet( xShape ).setAnyProperty( PROP_SizeType, makeAny( maTypeModel.mbAutoHeight ? SizeType::MIN : SizeType::FIX ) );
752  if( getTextBox()->borderDistanceSet )
753  {
754  PropertySet( xShape ).setAnyProperty( PROP_LeftBorderDistance, makeAny( sal_Int32( getTextBox()->borderDistanceLeft )));
755  PropertySet( xShape ).setAnyProperty( PROP_TopBorderDistance, makeAny( sal_Int32( getTextBox()->borderDistanceTop )));
756  PropertySet( xShape ).setAnyProperty( PROP_RightBorderDistance, makeAny( sal_Int32( getTextBox()->borderDistanceRight )));
757  PropertySet( xShape ).setAnyProperty( PROP_BottomBorderDistance, makeAny( sal_Int32( getTextBox()->borderDistanceBottom )));
758  }
759 
760  sal_Int16 nWritingMode = text::WritingMode2::LR_TB;
761  if (getTextBox()->maLayoutFlow == "vertical" && maTypeModel.maLayoutFlowAlt.isEmpty())
762  {
763  nWritingMode = text::WritingMode2::TB_RL;
764  }
765  else if (maTypeModel.maLayoutFlowAlt == "bottom-to-top")
766  {
767  nWritingMode = text::WritingMode2::BT_LR;
768  }
769  if (nWritingMode != text::WritingMode2::LR_TB)
770  {
771  PropertySet(xShape).setAnyProperty(PROP_WritingMode, uno::makeAny(nWritingMode));
772  }
773  }
774  else
775  {
776  // FIXME Setting the relative width/height only for everything but text frames as
777  // TextFrames already have relative width/height feature... but currently not working
778  // in the way we need.
779 
780  // Set the relative width / height if any
781  if ( !maTypeModel.maWidthPercent.isEmpty( ) )
782  {
783  // Only page-relative width is supported ATM
784  if ( maTypeModel.maWidthRelative.isEmpty() || maTypeModel.maWidthRelative == "page" )
785  {
786  sal_Int16 nWidth = maTypeModel.maWidthPercent.toInt32() / 10;
787  // Only apply if nWidth != 0
788  if ( nWidth )
789  PropertySet( xShape ).setAnyProperty(PROP_RelativeWidth, makeAny( nWidth ) );
790  }
791  }
792  if ( !maTypeModel.maHeightPercent.isEmpty( ) )
793  {
794  // Only page-relative height is supported ATM
795  if ( maTypeModel.maHeightRelative.isEmpty() || maTypeModel.maHeightRelative == "page" )
796  {
797  sal_Int16 nHeight = maTypeModel.maHeightPercent.toInt32() / 10;
798  // Only apply if nHeight != 0
799  if ( nHeight )
800  PropertySet( xShape ).setAnyProperty(PROP_RelativeHeight, makeAny( nHeight ) );
801  }
802  }
803 
804  // drawinglayer default is center, MSO default is top.
805  drawing::TextVerticalAdjust eTextVerticalAdjust = drawing::TextVerticalAdjust_TOP;
806  if (maTypeModel.maVTextAnchor == "middle")
807  eTextVerticalAdjust = drawing::TextVerticalAdjust_CENTER;
808  else if (maTypeModel.maVTextAnchor == "bottom")
809  eTextVerticalAdjust = drawing::TextVerticalAdjust_BOTTOM;
810  PropertySet(xShape).setAnyProperty(PROP_TextVerticalAdjust, makeAny(eTextVerticalAdjust));
811 
812  // tdf#97618
813  if(!maTypeModel.maWrapStyle.isEmpty())
814  PropertySet(xShape).setAnyProperty(PROP_TextWordWrap, makeAny(maTypeModel.maWrapStyle == "square"));
815 
816  // tdf#123626
817  if (!maTypeModel.maHyperlink.isEmpty())
818  PropertySet(xShape).setAnyProperty(PROP_Hyperlink, makeAny(maTypeModel.maHyperlink));
819 
820  PropertySet(xShape).setAnyProperty(PROP_TextAutoGrowHeight,
822 
823  if (getTextBox())
824  {
825  getTextBox()->convert(xShape);
826  if (getTextBox()->borderDistanceSet)
827  {
828  awt::Size aSize = xShape->getSize();
829  PropertySet(xShape).setAnyProperty(PROP_TextLeftDistance, makeAny(sal_Int32(getTextBox()->borderDistanceLeft)));
830  PropertySet(xShape).setAnyProperty(PROP_TextUpperDistance, makeAny(sal_Int32(getTextBox()->borderDistanceTop)));
831  PropertySet(xShape).setAnyProperty(PROP_TextRightDistance, makeAny(sal_Int32(getTextBox()->borderDistanceRight)));
832  PropertySet(xShape).setAnyProperty(PROP_TextLowerDistance, makeAny(sal_Int32(getTextBox()->borderDistanceBottom)));
833  xShape->setSize(aSize);
834  }
835  }
836  }
837 
838  // Import Legacy Fragments (if any)
839  if( xShape.is() && !maShapeModel.maLegacyDiagramPath.isEmpty() )
840  {
842  if( xInStrm.is() )
843  PropertySet( xShape ).setProperty( PROP_LegacyFragment, xInStrm );
844  }
845 
846  PropertySet aPropertySet(xShape);
847  if (xShape.is())
848  {
849  if (oRotation)
850  {
851  aPropertySet.setAnyProperty(PROP_RotateAngle, makeAny((*oRotation).get()));
852  uno::Reference<lang::XServiceInfo> xServiceInfo(rxShapes, uno::UNO_QUERY);
853  if (!xServiceInfo->supportsService("com.sun.star.drawing.GroupShape"))
854  {
855  // If rotation is used, simple setPosition() is not enough.
856  aPropertySet.setAnyProperty(PROP_HoriOrientPosition, makeAny(aShapeRect.X));
857  aPropertySet.setAnyProperty(PROP_VertOrientPosition, makeAny(aShapeRect.Y));
858  }
859  }
860 
861  // custom shape geometry attributes
862  std::vector<css::beans::PropertyValue> aPropVec;
863 
864  // When flip has 'x' or 'y', the associated ShapeRect will be changed but direction change doesn't occur.
865  // It might occur internally in SdrObject of "sw" module, not here.
866  // The associated properties "PROP_MirroredX" and "PROP_MirroredY" have to be set here so that direction change will occur internally.
867  if (bFlipX)
868  aPropVec.push_back(comphelper::makePropertyValue("MirroredX", true));
869  if (bFlipY)
870  aPropVec.push_back(comphelper::makePropertyValue("MirroredY", true));
871 
872  if (!maTypeModel.maAdjustments.isEmpty())
873  {
874  std::vector<drawing::EnhancedCustomShapeAdjustmentValue> aAdjustmentValues;
875  sal_Int32 nIndex = 0;
876  do
877  {
878  OUString aToken = maTypeModel.maAdjustments.getToken(0, ',', nIndex);
879  drawing::EnhancedCustomShapeAdjustmentValue aAdjustmentValue;
880  if (aToken.isEmpty())
881  aAdjustmentValue.State = css::beans::PropertyState::PropertyState_DEFAULT_VALUE;
882  else
883  aAdjustmentValue.Value <<= aToken.toInt32();
884  aAdjustmentValues.push_back(aAdjustmentValue);
885  } while (nIndex >= 0);
886 
887  css::beans::PropertyValue aProp;
888  aProp.Name = "AdjustmentValues";
889  aProp.Value <<= comphelper::containerToSequence(aAdjustmentValues);
890  aPropVec.push_back(aProp);
891  }
892 
893  if (!aPropVec.empty())
894  aPropertySet.setAnyProperty(PROP_CustomShapeGeometry, makeAny(comphelper::containerToSequence(aPropVec)));
895  }
896 
897  lcl_SetAnchorType(aPropertySet, maTypeModel, rGraphicHelper );
898 
899  return xShape;
900 }
901 
902 Reference<XShape> SimpleShape::finalImplConvertAndInsert(const css::uno::Reference<css::drawing::XShape>& rxShape) const
903 {
904  // tdf#41466 This setting must be done here, because the position of textbox will be set as an
905  // effect of the PROP_TextBox property setting, and if we do this setting earlier (setting of
906  // properties of position and size) then the position of textbox will be set with wrong data.
907  // TODO: TextShape is set if we have rect shape in group; we should use the shape-with-textbox
908  // mechanism to handle this situation
909  if (getTextBox() && maService != "com.sun.star.text.TextFrame" && maService != "com.sun.star.drawing.TextShape"
911  {
912  const GraphicHelper& rGraphicHelper = mrDrawing.getFilter().getGraphicHelper();
913  const auto& nLeft = ConversionHelper::decodeMeasureToHmm(
914  rGraphicHelper, maTypeModel.maMarginLeft, 0, true, true);
915  PropertySet aPropertySet(rxShape);
916  aPropertySet.setProperty(PROP_HoriOrientPosition, nLeft);
917  const auto& nTop = ConversionHelper::decodeMeasureToHmm(
918  rGraphicHelper, maTypeModel.maMarginTop, 0, true, true);
919  aPropertySet.setProperty(PROP_VertOrientPosition, nTop);
920  aPropertySet.setProperty(PROP_TextBox, true);
921 
922  // And these properties must be set after textbox creation (set PROP_Textbox property).
923  // Note: if you set a new property then you have to handle it in the proper
924  // SwTextBoxHelper::syncProperty function.
925  if (maTypeModel.maLayoutFlowAlt == "bottom-to-top")
926  aPropertySet.setAnyProperty(PROP_TextWritingMode, uno::makeAny(text::WritingMode2::BT_LR));
927  }
928  return ShapeBase::finalImplConvertAndInsert(rxShape);
929 }
930 Reference< XShape > SimpleShape::createEmbeddedPictureObject( const Reference< XShapes >& rxShapes, const awt::Rectangle& rShapeRect, OUString const & rGraphicPath ) const
931 {
932  Reference<XGraphic> xGraphic = mrDrawing.getFilter().getGraphicHelper().importEmbeddedGraphic(rGraphicPath);
933  return SimpleShape::createPictureObject(rxShapes, rShapeRect, xGraphic);
934 }
935 
936 Reference< XShape > SimpleShape::createPictureObject(const Reference< XShapes >& rxShapes,
937  const awt::Rectangle& rShapeRect,
938  uno::Reference<graphic::XGraphic> const & rxGraphic) const
939 {
940  Reference< XShape > xShape = mrDrawing.createAndInsertXShape( "com.sun.star.drawing.GraphicObjectShape", rxShapes, rShapeRect );
941  if( xShape.is() )
942  {
943  PropertySet aPropSet(xShape);
944  if (rxGraphic.is())
945  {
946  aPropSet.setProperty(PROP_Graphic, rxGraphic);
947  }
948  uno::Reference< lang::XServiceInfo > xServiceInfo(rxShapes, uno::UNO_QUERY);
949  // If the shape has an absolute position, set the properties accordingly, unless we're inside a group shape.
950  if ( maTypeModel.maPosition == "absolute" && !xServiceInfo->supportsService("com.sun.star.drawing.GroupShape"))
951  {
952  aPropSet.setProperty(PROP_HoriOrientPosition, rShapeRect.X);
953  aPropSet.setProperty(PROP_VertOrientPosition, rShapeRect.Y);
954  aPropSet.setProperty(PROP_Opaque, false);
955  }
956  // fdo#70457: preserve rotation information
957  if ( !maTypeModel.maRotation.isEmpty() )
959 
960  const GraphicHelper& rGraphicHelper = mrDrawing.getFilter().getGraphicHelper();
961  lcl_SetAnchorType(aPropSet, maTypeModel, rGraphicHelper);
962 
963  const sal_Int32 nWrapDistanceLeft = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, maTypeModel.maWrapDistanceLeft, 0, true, true);
964  const sal_Int32 nWrapDistanceRight = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, maTypeModel.maWrapDistanceRight, 0, true, true);
965  const sal_Int32 nWrapDistanceTop = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, maTypeModel.maWrapDistanceTop, 0, false, true);
966  const sal_Int32 nWrapDistanceBottom = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, maTypeModel.maWrapDistanceBottom, 0, false, true);
967  aPropSet.setProperty(PROP_LeftMargin, uno::makeAny(nWrapDistanceLeft));
968  aPropSet.setProperty(PROP_RightMargin, uno::makeAny(nWrapDistanceRight));
969  aPropSet.setProperty(PROP_TopMargin, uno::makeAny(nWrapDistanceTop));
970  aPropSet.setProperty(PROP_BottomMargin, uno::makeAny(nWrapDistanceBottom));
971 
973  {
974  text::GraphicCrop aGraphicCrop;
975  awt::Size aOriginalSize = rGraphicHelper.getOriginalSize(rxGraphic);
976 
978  aGraphicCrop.Bottom = lclConvertCrop(maTypeModel.moCropBottom.get(), aOriginalSize.Height);
979  if (maTypeModel.moCropLeft.has())
980  aGraphicCrop.Left = lclConvertCrop(maTypeModel.moCropLeft.get(), aOriginalSize.Width);
982  aGraphicCrop.Right = lclConvertCrop(maTypeModel.moCropRight.get(), aOriginalSize.Width);
983  if (maTypeModel.moCropTop.has())
984  aGraphicCrop.Top = lclConvertCrop(maTypeModel.moCropTop.get(), aOriginalSize.Height);
985 
986  aPropSet.setProperty(PROP_GraphicCrop, aGraphicCrop);
987  }
988  }
989  return xShape;
990 }
991 
993  SimpleShape( rDrawing, "com.sun.star.drawing.RectangleShape" )
994 {
995 }
996 
997 Reference<XShape> RectangleShape::implConvertAndInsert(const Reference<XShapes>& rxShapes, const awt::Rectangle& rShapeRect) const
998 {
999  OUString aGraphicPath = getGraphicPath();
1000 
1001  // try to create a picture object
1002  if(!aGraphicPath.isEmpty())
1003  return SimpleShape::createEmbeddedPictureObject(rxShapes, rShapeRect, aGraphicPath);
1004 
1005  // default: try to create a rectangle shape
1006  Reference<XShape> xShape = SimpleShape::implConvertAndInsert(rxShapes, rShapeRect);
1007  OUString sArcsize = maTypeModel.maArcsize;
1008  if ( !sArcsize.isEmpty( ) )
1009  {
1010  sal_Unicode cLastChar = sArcsize[sArcsize.getLength() - 1];
1011  sal_Int32 nValue = sArcsize.copy( 0, sArcsize.getLength() - 1 ).toInt32( );
1012  // Get the smallest half-side
1013  double size = std::min( rShapeRect.Height, rShapeRect.Width ) / 2.0;
1014  sal_Int32 nRadius = 0;
1015  if ( cLastChar == 'f' )
1016  nRadius = size * nValue / 65536;
1017  else if ( cLastChar == '%' )
1018  nRadius = size * nValue / 100;
1019  PropertySet( xShape ).setAnyProperty( PROP_CornerRadius, makeAny( nRadius ) );
1020  }
1021  return xShape;
1022 }
1023 
1025  SimpleShape( rDrawing, "com.sun.star.drawing.EllipseShape" )
1026 {
1027 }
1028 
1030  SimpleShape( rDrawing, "com.sun.star.drawing.PolyLineShape" )
1031 {
1032 }
1033 
1034 Reference< XShape > PolyLineShape::implConvertAndInsert( const Reference< XShapes >& rxShapes, const awt::Rectangle& rShapeRect ) const
1035 {
1036  Reference< XShape > xShape = SimpleShape::implConvertAndInsert( rxShapes, rShapeRect );
1037  // polygon path
1038  awt::Rectangle aCoordSys = getCoordSystem();
1039  if( !maShapeModel.maPoints.empty() && (aCoordSys.Width > 0) && (aCoordSys.Height > 0) )
1040  {
1041  ::std::vector< awt::Point > aAbsPoints;
1042  for (auto const& point : maShapeModel.maPoints)
1043  aAbsPoints.push_back( lclGetAbsPoint( point, rShapeRect, aCoordSys ) );
1044  PointSequenceSequence aPointSeq( 1 );
1045  aPointSeq[ 0 ] = ContainerHelper::vectorToSequence( aAbsPoints );
1046  PropertySet aPropSet( xShape );
1047  aPropSet.setProperty( PROP_PolyPolygon, aPointSeq );
1048  }
1049  return xShape;
1050 }
1051 
1052 namespace
1053 {
1054  void doMirrorX(SdrObject* pShape)
1055  {
1056  Point aCenter(pShape->GetSnapRect().Center());
1057  Point aPoint2(aCenter);
1058  aPoint2.setY(aPoint2.getY() + 1);
1059  pShape->NbcMirror(aCenter, aPoint2);
1060  }
1061 
1062  void doMirrorY(SdrObject* pShape)
1063  {
1064  Point aCenter(pShape->GetSnapRect().Center());
1065  Point aPoint2(aCenter);
1066  aPoint2.setX(aPoint2.getX() + 1);
1067  pShape->NbcMirror(aCenter, aPoint2);
1068  }
1069 
1070  void handleMirroring(const ShapeTypeModel& rTypeModel, Reference<XShape>& rxShape)
1071  {
1072  if (!rTypeModel.maFlip.isEmpty())
1073  {
1074  if (SdrObject* pShape = GetSdrObjectFromXShape(rxShape))
1075  {
1076  if (rTypeModel.maFlip.startsWith("x"))
1077  doMirrorX(pShape);
1078  if (rTypeModel.maFlip.endsWith("y"))
1079  doMirrorY(pShape);
1080  }
1081  }
1082  }
1083 
1084  void handleRotation(const ShapeTypeModel& rTypeModel, Reference<XShape>& rxShape)
1085  {
1086  if (!rTypeModel.maRotation.isEmpty())
1087  {
1088  if (SdrObject* pShape = GetSdrObjectFromXShape(rxShape))
1089  {
1090  // The needed factor -1 for opposite direction and factor 100 for Degree100 is
1091  // contained in method decodeRotation().
1092  Degree100 nAngle(ConversionHelper::decodeRotation(rTypeModel.maRotation));
1093  pShape->NbcRotate(pShape->GetSnapRect().Center(), nAngle);
1094  }
1095  }
1096  }
1097 }
1098 
1100  : SimpleShape(rDrawing, "com.sun.star.drawing.LineShape")
1101 {
1102 }
1103 
1104 Reference<XShape> LineShape::implConvertAndInsert(const Reference<XShapes>& rxShapes, const awt::Rectangle& rShapeRect) const
1105 {
1106  Reference<XShape> xShape = SimpleShape::implConvertAndInsert(rxShapes, rShapeRect);
1107  // tdf#137765
1108  handleRotation(maTypeModel, xShape);
1109  // tdf#97517 tdf#137678
1110  // The MirroredX and MirroredY properties (in the CustomShapeGeometry property) are not
1111  // supported for the LineShape by UNO, so we have to make the mirroring here.
1112  handleMirroring(maTypeModel, xShape);
1113  return xShape;
1114 }
1115 
1116 awt::Rectangle LineShape::getAbsRectangle() const
1117 {
1118  const GraphicHelper& rGraphicHelper = mrDrawing.getFilter().getGraphicHelper();
1119  awt::Rectangle aShapeRect;
1120  sal_Int32 nIndex = 0;
1121 
1122  aShapeRect.X = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, maShapeModel.maFrom.getToken(0, ',', nIndex), 0, true, true);
1123  aShapeRect.Y = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, maShapeModel.maFrom.getToken(0, ',', nIndex), 0, false, true);
1124  nIndex = 0;
1125  aShapeRect.Width = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, maShapeModel.maTo.getToken(0, ',', nIndex), 0, true, true) - aShapeRect.X;
1126  aShapeRect.Height = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, maShapeModel.maTo.getToken(0, ',', nIndex), 0, false, true) - aShapeRect.Y;
1127  return aShapeRect;
1128 }
1129 
1130 awt::Rectangle LineShape::getRelRectangle() const
1131 {
1132  awt::Rectangle aShapeRect;
1133  sal_Int32 nIndex = 0;
1134 
1135  aShapeRect.X = maShapeModel.maFrom.getToken(0, ',', nIndex).toInt32();
1136  aShapeRect.Y = maShapeModel.maFrom.getToken(0, ',', nIndex).toInt32();
1137  nIndex = 0;
1138  aShapeRect.Width = maShapeModel.maTo.getToken(0, ',', nIndex).toInt32() - aShapeRect.X;
1139  aShapeRect.Height = maShapeModel.maTo.getToken(0, ',', nIndex).toInt32() - aShapeRect.Y;
1140  return aShapeRect;
1141 }
1142 
1144  : SimpleShape(rDrawing, "com.sun.star.drawing.OpenBezierShape")
1145 {
1146 }
1147 
1148 Reference< XShape > BezierShape::implConvertAndInsert( const Reference< XShapes >& rxShapes, const awt::Rectangle& rShapeRect ) const
1149 {
1150  // If we have an 'x' in the last part of the path it means it is closed...
1151  sal_Int32 nPos = maShapeModel.maVmlPath.lastIndexOf(',');
1152  if ( nPos != -1 && maShapeModel.maVmlPath.indexOf('x', nPos) != -1 )
1153  {
1154  const_cast<BezierShape*>( this )->setService( "com.sun.star.drawing.ClosedBezierShape" );
1155  }
1156 
1157  awt::Rectangle aCoordSys = getCoordSystem();
1158  PolyPolygonBezierCoords aBezierCoords;
1159 
1160  if( (aCoordSys.Width > 0) && (aCoordSys.Height > 0) )
1161  {
1162  const GraphicHelper& rGraphicHelper = mrDrawing.getFilter().getGraphicHelper();
1163 
1164  // Bezier paths may consist of one or more sub-paths
1165  typedef ::std::vector< ::std::vector< PolygonFlags > > FlagsList;
1166  std::vector< ::std::vector< awt::Point > > aCoordLists;
1167  FlagsList aFlagLists;
1168 
1169  // Curve defined by to, from, control1 and control2 attributes
1170  if ( maShapeModel.maVmlPath.isEmpty() )
1171  {
1172  aCoordLists.emplace_back( );
1173  aFlagLists.emplace_back( );
1174  sal_Int32 nIndex = 0;
1175 
1176  // Start point
1177  aCoordLists[ 0 ].emplace_back(
1178  ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maShapeModel.maFrom.getToken( 0, ',', nIndex ), 0, true, true ),
1179  ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maShapeModel.maFrom.getToken( 0, ',', nIndex ), 0, false, true ) );
1180  // Control point 1
1181  aCoordLists[ 0 ].emplace_back(
1182  ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maShapeModel.maControl1.getToken( 0, ',', nIndex ), 0, true, true ),
1183  ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maShapeModel.maControl1.getToken( 0, ',', nIndex ), 0, false, true ) );
1184  // Control point 2
1185  aCoordLists[ 0 ].emplace_back(
1186  ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maShapeModel.maControl2.getToken( 0, ',', nIndex ), 0, true, true ),
1187  ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maShapeModel.maControl2.getToken( 0, ',', nIndex ), 0, false, true ) );
1188  // End point
1189  aCoordLists[ 0 ].emplace_back(
1190  ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maShapeModel.maTo.getToken( 0, ',', nIndex ), 0, true, true ),
1191  ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maShapeModel.maTo.getToken( 0, ',', nIndex ), 0, false, true ) );
1192 
1193  // First and last points are normals, points 2 and 4 are controls
1194  aFlagLists[ 0 ].resize( aCoordLists[ 0 ].size(), PolygonFlags_CONTROL );
1195  aFlagLists[ 0 ][ 0 ] = PolygonFlags_NORMAL;
1196  aFlagLists[ 0 ].back() = PolygonFlags_NORMAL;
1197  }
1198  // Curve defined by path attribute
1199  else
1200  {
1201  // Parse VML path string and convert to absolute coordinates
1202  ConversionHelper::decodeVmlPath( aCoordLists, aFlagLists, maShapeModel.maVmlPath );
1203 
1204  for (auto & coordList : aCoordLists)
1205  for (auto & point : coordList)
1206  {
1207  point = lclGetAbsPoint( point, rShapeRect, aCoordSys );
1208  }
1209  }
1210 
1211  aBezierCoords.Coordinates.realloc( aCoordLists.size() );
1212  for ( size_t i = 0; i < aCoordLists.size(); i++ )
1213  aBezierCoords.Coordinates[i] = ContainerHelper::vectorToSequence( aCoordLists[i] );
1214 
1215  aBezierCoords.Flags.realloc( aFlagLists.size() );
1216  for ( size_t i = 0; i < aFlagLists.size(); i++ )
1217  aBezierCoords.Flags[i] = ContainerHelper::vectorToSequence( aFlagLists[i] );
1218 
1219  if( !aCoordLists.front().empty() && !aCoordLists.back().empty()
1220  && aCoordLists.front().front().X == aCoordLists.back().back().X
1221  && aCoordLists.front().front().Y == aCoordLists.back().back().Y )
1222  { // HACK: If the shape is in fact closed, which can be found out only when the path is known,
1223  // force to closed bezier shape (otherwise e.g. fill won't work).
1224  const_cast< BezierShape* >( this )->setService( "com.sun.star.drawing.ClosedBezierShape" );
1225  }
1226  }
1227 
1228  Reference< XShape > xShape = SimpleShape::implConvertAndInsert( rxShapes, rShapeRect );
1229 
1230  if( aBezierCoords.Coordinates.hasElements())
1231  {
1232  PropertySet aPropSet( xShape );
1233  aPropSet.setProperty( PROP_PolyPolygonBezier, aBezierCoords );
1234  }
1235 
1236  // tdf#105875 handle rotation
1237  // Note: must rotate before flip!
1238  handleRotation(maTypeModel, xShape);
1239 
1240  // Handle horizontal and vertical flip.
1241  handleMirroring(maTypeModel, xShape);
1242 
1243  return xShape;
1244 }
1245 
1247  SimpleShape( rDrawing, "com.sun.star.drawing.CustomShape" )
1248 {
1249 }
1250 
1251 Reference< XShape > CustomShape::implConvertAndInsert( const Reference< XShapes >& rxShapes, const awt::Rectangle& rShapeRect ) const
1252 {
1253  // try to create a custom shape
1254  Reference< XShape > xShape = SimpleShape::implConvertAndInsert( rxShapes, rShapeRect );
1255  if( xShape.is() ) try
1256  {
1257  // create the custom shape geometry
1258  Reference< XEnhancedCustomShapeDefaulter > xDefaulter( xShape, UNO_QUERY_THROW );
1259  xDefaulter->createCustomShapeDefaults( OUString::number( getShapeType() ) );
1260  // convert common properties
1261  convertShapeProperties( xShape );
1262  }
1263  catch( Exception& )
1264  {
1265  }
1266  return xShape;
1267 }
1268 
1270  CustomShape( rDrawing )
1271 {
1272 }
1273 
1274 Reference< XShape > ComplexShape::implConvertAndInsert( const Reference< XShapes >& rxShapes, const awt::Rectangle& rShapeRect ) const
1275 {
1276  XmlFilterBase& rFilter = mrDrawing.getFilter();
1277  sal_Int32 nShapeType = getShapeType();
1278  OUString aGraphicPath = getGraphicPath();
1279 
1280  // try to find registered OLE object info
1281  if( const OleObjectInfo* pOleObjectInfo = mrDrawing.getOleObjectInfo( maTypeModel.maShapeId ) )
1282  {
1283  SAL_WARN_IF(
1284  nShapeType != VML_SHAPETYPE_PICTUREFRAME, "oox",
1285  "ComplexShape::implConvertAndInsert - unexpected shape type");
1286 
1287  // if OLE object is embedded into a DrawingML shape (PPTX), do not create it here
1288  if( pOleObjectInfo->mbDmlShape )
1289  return Reference< XShape >();
1290 
1291  PropertyMap aOleProps;
1292  awt::Size aOleSize( rShapeRect.Width, rShapeRect.Height );
1293  if( rFilter.getOleObjectHelper().importOleObject( aOleProps, *pOleObjectInfo, aOleSize ) )
1294  {
1295  Reference< XShape > xShape = mrDrawing.createAndInsertXShape( "com.sun.star.drawing.OLE2Shape", rxShapes, rShapeRect );
1296  if( xShape.is() )
1297  {
1298  // set the replacement graphic
1299  if( !aGraphicPath.isEmpty() )
1300  {
1301  WmfExternal aExtHeader;
1302  aExtHeader.mapMode = 8;
1303  aExtHeader.xExt = rShapeRect.Width;
1304  aExtHeader.yExt = rShapeRect.Height;
1305 
1306  Reference< XGraphic > xGraphic = rFilter.getGraphicHelper().importEmbeddedGraphic(aGraphicPath, &aExtHeader);
1307  if (xGraphic.is())
1308  aOleProps.setProperty( PROP_Graphic, xGraphic);
1309  }
1310 
1311  PropertySet aPropSet( xShape );
1312  aPropSet.setProperties( aOleProps );
1313 
1314  return xShape;
1315  }
1316  }
1317  }
1318 
1319  // try to find registered form control info
1320  const ControlInfo* pControlInfo = mrDrawing.getControlInfo( maTypeModel.maShapeId );
1321  if( pControlInfo && !pControlInfo->maFragmentPath.isEmpty() )
1322  {
1323  if( !pControlInfo->maName.isEmpty() )
1324  {
1325  // load the control properties from fragment
1326  ::oox::ole::EmbeddedControl aControl(pControlInfo->maName);
1327  if( rFilter.importFragment( new ::oox::ole::AxControlFragment( rFilter, pControlInfo->maFragmentPath, aControl ) ) )
1328  {
1329  // create and return the control shape (including control model)
1330  sal_Int32 nCtrlIndex = -1;
1331  Reference< XShape > xShape = mrDrawing.createAndInsertXControlShape( aControl, rxShapes, rShapeRect, nCtrlIndex );
1332 
1333  if (pControlInfo->mbTextContentShape)
1334  {
1335  PropertySet aPropertySet(xShape);
1337  }
1338  // on error, proceed and try to create picture from replacement image
1339  if( xShape.is() )
1340  return xShape;
1341  }
1342  }
1343  }
1344 
1345  // host application wants to create the shape (do not try failed OLE controls again)
1346  if( (nShapeType == VML_SHAPETYPE_HOSTCONTROL) && !pControlInfo )
1347  {
1348  OSL_ENSURE( getClientData(), "ComplexShape::implConvertAndInsert - missing client data" );
1349  Reference< XShape > xShape = mrDrawing.createAndInsertClientXShape( *this, rxShapes, rShapeRect );
1350  if( xShape.is() )
1351  return xShape;
1352  }
1353 
1354 
1356  {
1357  uno::Reference<graphic::XGraphic> xGraphic;
1358  bool bIsSigned(false);
1359  try
1360  {
1361  // Get the document signatures
1362  Reference<security::XDocumentDigitalSignatures> xSignatures(
1363  security::DocumentDigitalSignatures::createDefault(
1365 
1366  uno::Reference<embed::XStorage> xStorage
1369  embed::ElementModes::READ);
1370  SAL_WARN_IF(!xStorage.is(), "oox.vml", "No xStorage!");
1371 
1372  const uno::Sequence<security::DocumentSignatureInformation> xSignatureInfo
1373  = xSignatures->verifyScriptingContentSignatures(xStorage,
1374  uno::Reference<io::XInputStream>());
1375 
1376  // Try to find matching signature line image - if none exists that is fine,
1377  // then the signature line is not digitally signed.
1378  auto pSignInfo = std::find_if(xSignatureInfo.begin(), xSignatureInfo.end(),
1379  [this](const security::DocumentSignatureInformation& rSigInfo) {
1380  return rSigInfo.SignatureLineId == getShapeModel().maSignatureId; });
1381  if (pSignInfo != xSignatureInfo.end())
1382  {
1383  bIsSigned = true;
1384  if (pSignInfo->SignatureIsValid)
1385  {
1386  // Signature is valid, use the 'valid' image
1387  SAL_WARN_IF(!pSignInfo->ValidSignatureLineImage.is(), "oox.vml",
1388  "No ValidSignatureLineImage!");
1389  xGraphic = pSignInfo->ValidSignatureLineImage;
1390  }
1391  else
1392  {
1393  // Signature is invalid, use the 'invalid' image
1394  SAL_WARN_IF(!pSignInfo->InvalidSignatureLineImage.is(), "oox.vml",
1395  "No InvalidSignatureLineImage!");
1396  xGraphic = pSignInfo->InvalidSignatureLineImage;
1397  }
1398  }
1399  }
1400  catch (css::uno::Exception&)
1401  {
1402  // DocumentDigitalSignatures service not available.
1403  // We continue by rendering the "unsigned" shape instead.
1404  }
1405 
1406  Reference< XShape > xShape;
1407  if (xGraphic.is())
1408  {
1409  // If available, use the signed image from the signature
1410  xShape = SimpleShape::createPictureObject(rxShapes, rShapeRect, xGraphic);
1411  }
1412  else
1413  {
1414  // Create shape with the fallback "unsigned" image
1415  xShape = SimpleShape::createEmbeddedPictureObject(rxShapes, rShapeRect, aGraphicPath);
1416  }
1417 
1418  // Store signature line properties
1419  uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY);
1420  xPropertySet->setPropertyValue("IsSignatureLine", uno::makeAny(true));
1421  xPropertySet->setPropertyValue("SignatureLineId",
1422  uno::makeAny(getShapeModel().maSignatureId));
1423  xPropertySet->setPropertyValue(
1424  "SignatureLineSuggestedSignerName",
1425  uno::makeAny(getShapeModel().maSignatureLineSuggestedSignerName));
1426  xPropertySet->setPropertyValue(
1427  "SignatureLineSuggestedSignerTitle",
1428  uno::makeAny(getShapeModel().maSignatureLineSuggestedSignerTitle));
1429  xPropertySet->setPropertyValue(
1430  "SignatureLineSuggestedSignerEmail",
1431  uno::makeAny(getShapeModel().maSignatureLineSuggestedSignerEmail));
1432  xPropertySet->setPropertyValue(
1433  "SignatureLineSigningInstructions",
1434  uno::makeAny(getShapeModel().maSignatureLineSigningInstructions));
1435  xPropertySet->setPropertyValue(
1436  "SignatureLineShowSignDate",
1437  uno::makeAny(getShapeModel().mbSignatureLineShowSignDate));
1438  xPropertySet->setPropertyValue(
1439  "SignatureLineCanAddComment",
1440  uno::makeAny(getShapeModel().mbSignatureLineCanAddComment));
1441  xPropertySet->setPropertyValue("SignatureLineIsSigned", uno::makeAny(bIsSigned));
1442 
1443  if (!aGraphicPath.isEmpty())
1444  {
1445  xGraphic = rFilter.getGraphicHelper().importEmbeddedGraphic(aGraphicPath);
1446  xPropertySet->setPropertyValue("SignatureLineUnsignedImage", uno::makeAny(xGraphic));
1447  }
1448  return xShape;
1449  }
1450 
1451  // try to create a picture object
1452  if( !aGraphicPath.isEmpty() )
1453  {
1454  Reference<XShape> xShape = SimpleShape::createEmbeddedPictureObject(rxShapes, rShapeRect, aGraphicPath);
1455  // AS_CHARACTER shape: vertical orientation default is bottom, MSO default is top.
1456  if ( maTypeModel.maPosition != "absolute" && maTypeModel.maPosition != "relative" )
1457  PropertySet( xShape ).setAnyProperty( PROP_VertOrient, makeAny(text::VertOrientation::TOP));
1458 
1459  // Apply stroke props from the type model.
1461  const GraphicHelper& rGraphicHelper = mrDrawing.getFilter().getGraphicHelper();
1462  maTypeModel.maStrokeModel.pushToPropMap(aPropMap, rGraphicHelper);
1463  // And, fill-color properties as well...
1464  maTypeModel.maFillModel.pushToPropMap(aPropMap, rGraphicHelper);
1465  PropertySet(xShape).setProperties(aPropMap);
1466 
1467  return xShape;
1468  }
1469 
1470  // default: try to create a custom shape
1471  return CustomShape::implConvertAndInsert( rxShapes, rShapeRect );
1472 }
1473 
1475  ShapeBase( rDrawing ),
1476  mxChildren( new ShapeContainer( rDrawing ) )
1477 {
1478 }
1479 
1481 {
1482 }
1483 
1485 {
1486  // basic shape processing
1488  // finalize all child shapes
1489  mxChildren->finalizeFragmentImport();
1490 }
1491 
1492 const ShapeType* GroupShape::getChildTypeById( const OUString& rShapeId ) const
1493 {
1494  return mxChildren->getShapeTypeById( rShapeId );
1495 }
1496 
1497 const ShapeBase* GroupShape::getChildById( const OUString& rShapeId ) const
1498 {
1499  return mxChildren->getShapeById( rShapeId );
1500 }
1501 
1502 Reference< XShape > GroupShape::implConvertAndInsert( const Reference< XShapes >& rxShapes, const awt::Rectangle& rShapeRect ) const
1503 {
1504  Reference< XShape > xGroupShape;
1505  // check that this shape contains children and a valid coordinate system
1506  ShapeParentAnchor aParentAnchor;
1507  aParentAnchor.maShapeRect = rShapeRect;
1508  aParentAnchor.maCoordSys = getCoordSystem();
1509  if( !mxChildren->empty() && (aParentAnchor.maCoordSys.Width > 0) && (aParentAnchor.maCoordSys.Height > 0) ) try
1510  {
1511  xGroupShape = mrDrawing.createAndInsertXShape( "com.sun.star.drawing.GroupShape", rxShapes, rShapeRect );
1512  Reference< XShapes > xChildShapes( xGroupShape, UNO_QUERY_THROW );
1513  mxChildren->convertAndInsert( xChildShapes, &aParentAnchor );
1514  if( !xChildShapes->hasElements() )
1515  {
1516  SAL_WARN("oox", "no child shape has been created - deleting the group shape");
1517  rxShapes->remove( xGroupShape );
1518  xGroupShape.clear();
1519  }
1520  }
1521  catch( Exception& )
1522  {
1523  }
1524 
1525  uno::Reference<beans::XPropertySet> xPropertySet;
1526  if (!maTypeModel.maEditAs.isEmpty())
1527  xPropertySet = uno::Reference<beans::XPropertySet>(xGroupShape, uno::UNO_QUERY);
1528  if (xPropertySet.is())
1529  {
1530  uno::Sequence<beans::PropertyValue> aGrabBag;
1531  xPropertySet->getPropertyValue("InteropGrabBag") >>= aGrabBag;
1532  beans::PropertyValue aPair;
1533  aPair.Name = "mso-edit-as";
1534  aPair.Value <<= maTypeModel.maEditAs;
1535  sal_Int32 nLength = aGrabBag.getLength();
1536  aGrabBag.realloc(nLength + 1);
1537  aGrabBag[nLength] = aPair;
1538  xPropertySet->setPropertyValue("InteropGrabBag", uno::makeAny(aGrabBag));
1539  }
1540  // Make sure group shapes are inline as well, unless there is an explicit different style.
1541  PropertySet aPropertySet(xGroupShape);
1542  const GraphicHelper& rGraphicHelper = mrDrawing.getFilter().getGraphicHelper();
1543  lcl_SetAnchorType(aPropertySet, maTypeModel, rGraphicHelper);
1544  if (!maTypeModel.maRotation.isEmpty())
1546  return xGroupShape;
1547 }
1548 
1549 } // namespace oox
1550 
1551 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
The shape model structure contains all properties shared by all types of shapes.
Definition: vmlshape.hxx:60
Provides helper functions for colors, device measurement conversion, graphics, and graphic objects ha...
OptValue< OUString > moGraphicTitle
Title of the graphic.
Definition: vmlshape.hxx:100
css::awt::Rectangle maShapeRect
virtual css::uno::Reference< css::drawing::XShape > finalImplConvertAndInsert(const css::uno::Reference< css::drawing::XShape > &rxShape) const
Always called after implConvertAndInsert for the same task.
Definition: vmlshape.hxx:281
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.
const TextBox * getTextBox() const
Returns read access to the shape textbox.
Definition: vmlshape.hxx:243
const OleObjectInfo * getOleObjectInfo(const OUString &rShapeId) const
Returns the registered info structure for an OLE object, if extant.
Definition: vmldrawing.cxx:249
OOX_DLLPUBLIC sal_Int32 decodeMeasureToHmm(const GraphicHelper &rGraphicHelper, const OUString &rValue, sal_Int32 nRefValue, bool bPixelX, bool bDefaultAsPixel)
Converts the passed VML measure string to 1/100 mm.
sal_Int32 nIndex
virtual bool isShapeSupported(const ShapeBase &rShape) const
Derived classes may disable conversion of specific shapes.
Definition: vmldrawing.cxx:317
std::unique_ptr< ClientData > mxClientData
Excel specific client data.
Definition: vmlshape.hxx:205
ShapeModel maShapeModel
The model structure containing shape data.
Definition: vmlshape.hxx:297
A helper that maps property identifiers to property values.
Definition: propertymap.hxx:52
A shape object that is part of a drawing.
Definition: vmlshape.hxx:234
virtual css::uno::Reference< css::drawing::XShape > implConvertAndInsert(const css::uno::Reference< css::drawing::XShapes > &rxShapes, const css::awt::Rectangle &rShapeRect) const override
Creates the corresponding XShape and inserts it into the passed container.
Definition: vmlshape.cxx:1034
void pushToPropMap(oox::drawingml::ShapePropertyMap &rPropMap, const css::uno::Reference< css::drawing::XShape > &xShape, const GraphicHelper &rGraphicHelper) const
Writes the properties to the passed property map.
OUString maZIndex
ZIndex of the shape.
Definition: vmlshape.hxx:70
BezierShape(Drawing &rDrawing)
Definition: vmlshape.cxx:1143
OUString maSignatureId
ID of the signature.
Definition: vmlshape.hxx:213
void convertFormatting(const css::uno::Reference< css::drawing::XShape > &rxShape) const
Converts position and formatting into the passed existing XShape.
Definition: vmlshape.cxx:483
OUString maTop
Y position of the shape bounding box (number with unit).
Definition: vmlshape.hxx:72
OUString maPositionVertical
The Y position orientation.
Definition: vmlshape.hxx:80
bool mbIsSignatureLine
Shape is a signature line.
Definition: vmlshape.hxx:212
virtual void NbcRotate(const Point &rRef, Degree100 nAngle, double sn, double cs)
The stroke model structure contains all shape border properties.
css::awt::Rectangle calcShapeRectangle(const ShapeParentAnchor *pParentAnchor) const
Calculates the final shape rectangle according to the passed anchor, if present, otherwise according ...
Definition: vmlshape.cxx:507
sal_Int32 getShapeType() const
Returns the application defined shape type.
Definition: vmlshape.cxx:159
Excel specific shape client data (such as cell anchor).
Definition: vmlshape.hxx:162
ShapeContainer & getShapes()
Returns read/write access to the container of shapes and templates.
Definition: vmldrawing.hxx:108
sal_Int32 toInt32(OUString const &rStr)
A shape template contains all formatting properties of shapes and can serve as templates for several ...
Definition: vmlshape.hxx:125
sal_Int32 mnCol
def point()
virtual css::uno::Reference< css::drawing::XShape > implConvertAndInsert(const css::uno::Reference< css::drawing::XShapes > &rxShapes, const css::awt::Rectangle &rShapeRect) const override
Creates the corresponding XShape and inserts it into the passed container.
Definition: vmlshape.cxx:1148
OUString maHeight
Height of the shape bounding box (number with unit).
Definition: vmlshape.hxx:74
OUString maService
Name of the UNO shape service.
Definition: vmlshape.hxx:329
virtual css::uno::Reference< css::drawing::XShape > createAndInsertClientXShape(const ShapeBase &rShape, const css::uno::Reference< css::drawing::XShapes > &rxShapes, const css::awt::Rectangle &rShapeRect) const
Derived classes create a UNO shape according to the passed shape model.
Definition: vmldrawing.cxx:332
OUString maMarginTop
Y position of the shape bounding box to shape anchor (number with unit).
Definition: vmlshape.hxx:76
OUString maHeightPercent
The height in percents of the HeightRelative.
Definition: vmlshape.hxx:82
ModelObjectHelper & getModelObjectHelper() const
Returns a helper with containers for various named drawing objects for the imported document...
Definition: filterbase.cxx:350
const sal_Int32 VML_CLIENTDATA_UNCHECKED
Definition: vmlshape.hxx:48
OOX_DLLPUBLIC Degree100 decodeRotation(const OUString &rValue)
Converts the passed VML rotation value to degrees.
OUString maLegacyId
Plaintext identifier of the shape.
Definition: vmlshape.hxx:63
bool hasProperty(sal_Int32 nPropId) const
Returns true, if the specified property is supported by the property set.
Definition: propertyset.cxx:47
OUString maWidthRelative
To what the width is relative.
Definition: vmlshape.hxx:83
virtual css::uno::Reference< css::drawing::XShape > implConvertAndInsert(const css::uno::Reference< css::drawing::XShapes > &rxShapes, const css::awt::Rectangle &rShapeRect) const override
Creates the corresponding XShape and inserts it into the passed container.
Definition: vmlshape.cxx:1502
OptValue< sal_Int32 > moShapeType
Builtin shape type identifier.
Definition: vmlshape.hxx:65
virtual css::uno::Reference< css::drawing::XShape > implConvertAndInsert(const css::uno::Reference< css::drawing::XShapes > &rxShapes, const css::awt::Rectangle &rShapeRect) const override
Creates the corresponding XShape and inserts it into the passed container.
Definition: vmlshape.cxx:1104
const ControlInfo * getControlInfo(const OUString &rShapeId) const
Returns the registered info structure for a form control, if extant.
Definition: vmldrawing.cxx:254
void pushToPropMap(oox::drawingml::ShapePropertyMap &rPropMap, const GraphicHelper &rGraphicHelper) const
Writes the properties to the passed property map.
virtual void notifyXShapeInserted(const css::uno::Reference< css::drawing::XShape > &rxShape, const css::awt::Rectangle &rShapeRect, const ShapeBase &rShape, bool bGroupChild)
Derived classes may want to know that a UNO shape has been inserted.
Definition: vmldrawing.cxx:338
EllipseShape(Drawing &rDrawing)
Definition: vmlshape.cxx:1024
SdrOnOffItem makeSdrTextAutoGrowHeightItem(bool bAuto)
virtual OUString getShapeBaseName(const ShapeBase &rShape) const
Derived classes may return additional base names for automatic shape name creation.
Definition: vmldrawing.cxx:322
virtual css::awt::Rectangle getRelRectangle() const override
Returns the rectangle relative to the parent coordinate system.
Definition: vmlshape.cxx:1130
void convertShapeProperties(const css::uno::Reference< css::drawing::XShape > &rxShape) const
Converts common shape properties such as formatting attributes.
Definition: vmlshape.cxx:518
virtual const tools::Rectangle & GetSnapRect() const
GraphicHelper & getGraphicHelper() const
Returns a helper for the handling of graphics and graphic objects.
Definition: filterbase.cxx:343
void setContainer(ShapeContainer *pContainer)
Definition: vmlshape.cxx:501
A form control embedded in a document draw page.
Definition: axcontrol.hxx:897
void setProperties(const css::uno::Sequence< OUString > &rPropNames, const css::uno::Sequence< css::uno::Any > &rValues)
Puts the passed properties into the property set.
RectangleShape(Drawing &rDrawing)
Definition: vmlshape.cxx:992
sal_uInt16 sal_Unicode
void convert(const css::uno::Reference< css::drawing::XShape > &xShape) const
Definition: vmltextbox.cxx:77
OUString maVmlPath
VML path for this shape.
Definition: vmlshape.hxx:211
OUString maEditAs
Edit As type (e.g. "canvas" etc)
Definition: vmlshape.hxx:91
OUString maType
Shape template with default properties.
Definition: vmlshape.hxx:202
TextBox & createTextBox(ShapeTypeModel &rModel)
Creates and returns a new shape textbox structure.
Definition: vmlshape.cxx:271
OUString maWrapDistanceLeft
Distance from the left side of the shape to the text that wraps around it.
Definition: vmlshape.hxx:106
const OUString & getShapeId() const
Returns the shape identifier (which is unique through the containing drawing).
Definition: vmlshape.hxx:137
css::uno::Reference< css::drawing::XShape > createAndInsertXShape(const OUString &rService, const css::uno::Reference< css::drawing::XShapes > &rxShapes, const css::awt::Rectangle &rShapeRect) const
Creates a new UNO shape object, inserts it into the passed UNO shape container, and sets the shape po...
Definition: vmldrawing.cxx:259
OUString getShapeName() const
Returns the real shape name if existing, or a generated shape name.
Definition: vmlshape.cxx:325
The fill model structure contains all shape fill properties.
Bezier shape object that supports to, from, control1 and control2 attribute or path attribute specifi...
Definition: vmlshape.hxx:389
const Type & get() const
Definition: helper.hxx:185
OptValue< Int32Pair > moCoordPos
Top-left position of coordinate system for children scaling.
Definition: vmlshape.hxx:67
virtual css::awt::Rectangle getRelRectangle() const
Returns the rectangle relative to the parent coordinate system.
Definition: vmlshape.cxx:216
virtual ~GroupShape() override
Definition: vmlshape.cxx:1480
virtual css::uno::Reference< css::drawing::XShape > finalImplConvertAndInsert(const css::uno::Reference< css::drawing::XShape > &rxShape) const override
Always called after implConvertAndInsert for the same task.
Definition: vmlshape.cxx:902
SdrOnOffItem makeSdrTextAutoGrowWidthItem(bool bAuto)
bool setAnyProperty(sal_Int32 nPropId, const css::uno::Any &rValue)
Puts the passed any into the property set.
Definition: propertyset.cxx:70
StrokeModel maStrokeModel
Border line formatting.
Definition: vmlshape.hxx:94
std::unique_ptr< TextBox > mxTextBox
Text contents and properties.
Definition: vmlshape.hxx:204
CustomShape(Drawing &rDrawing)
Definition: vmlshape.cxx:1246
OUString maHeightRelative
To what the height is relative.
Definition: vmlshape.hxx:84
OUString maAnchor
Cell anchor as comma-separated string.
Definition: vmlshape.hxx:164
sal_uInt16 mapMode
css::awt::Rectangle getCoordSystem() const
Returns the coordinate system of this shape.
Definition: vmlshape.cxx:169
css::uno::Reference< css::drawing::XShape > createPictureObject(const css::uno::Reference< css::drawing::XShapes > &rxShapes, const css::awt::Rectangle &rShapeRect, css::uno::Reference< css::graphic::XGraphic > const &rxGraphic) const
Definition: vmlshape.cxx:936
ShapeContainer * mpContainer
Definition: vmlshape.hxx:298
Contains information about a form control embedded in a draw page.
Definition: vmldrawing.hxx:78
bool mbVisible
Visible or Hidden.
Definition: vmlshape.hxx:88
OUString maAdjustments
Shape adjustment values.
Definition: vmlshape.hxx:92
sal_Int32 getLocalShapeIndex(const OUString &rShapeId) const
Returns the local shape index from the passed global shape identifier.
Definition: vmldrawing.cxx:208
ShapeTypeModel & getTypeModel()
Returns read/write access to the shape template model structure.
Definition: vmlshape.hxx:132
Container that holds a list of shapes and shape templates.
OUString maControl1
Bezier control point 1.
Definition: vmlshape.hxx:209
virtual css::uno::Reference< css::drawing::XShape > implConvertAndInsert(const css::uno::Reference< css::drawing::XShapes > &rxShapes, const css::awt::Rectangle &rShapeRect) const override
Creates the corresponding XShape and inserts it into the passed container.
Definition: vmlshape.cxx:1251
OUString maPositionHorizontalRelative
The X position is relative to this.
Definition: vmlshape.hxx:77
UNDERLYING_TYPE get() const
void assignUsed(const ShapeTypeModel &rSource)
Definition: vmlshape.cxx:137
bool mbTextContentShape
Whether this control shape will be imported to Writer or not (has AnchorType property or not)...
Definition: vmldrawing.hxx:83
OUString maPositionVerticalRelative
The Y position is relative to this.
Definition: vmlshape.hxx:78
The textbox contains all text contents and properties.
Definition: vmltextbox.hxx:79
virtual css::uno::Reference< css::drawing::XShape > implConvertAndInsert(const css::uno::Reference< css::drawing::XShapes > &rxShapes, const css::awt::Rectangle &rShapeRect) const =0
Derived classes create the corresponding XShape and insert it into the passed container.
Contains information about an OLE object embedded in a draw page.
Definition: vmldrawing.hxx:62
OUString maHyperlink
The hyperlink assigned to the shape.
Definition: vmlshape.hxx:115
void assignIfUsed(const OptValue &rValue)
Definition: helper.hxx:196
virtual void NbcMirror(const Point &rRef1, const Point &rRef2)
::oox::core::XmlFilterBase & getFilter() const
Returns the filter object that imports/exports this VML drawing.
Definition: vmldrawing.hxx:104
ClientData & createClientData()
Creates and returns a new shape client data structure.
Definition: vmlshape.cxx:277
virtual css::awt::Rectangle getAbsRectangle() const override
Returns the absolute shape rectangle.
Definition: vmlshape.cxx:1116
OUString maRotation
Rotation of the shape, in degrees.
Definition: vmlshape.hxx:85
OUString maLegacyDiagramPath
Legacy Diagram Fragment Path.
Definition: vmlshape.hxx:206
OptValue< OUString > moWeight
Line width.
ComplexShape(Drawing &rDrawing)
Definition: vmlshape.cxx:1269
virtual void finalizeFragmentImport()
Final processing after import of the drawing fragment.
Definition: vmlshape.cxx:288
float u
OUString maFlip
Flip type of the shape (can be "x" or "y").
Definition: vmlshape.hxx:86
const ShapeType * getShapeTypeById(const OUString &rShapeId) const
Returns the shape template with the passed identifier.
XML_TOKEN_INVALID
OptValue< OUString > moWrapSide
On which side to wrap the text around the object.
Definition: vmlshape.hxx:104
OUString maName
Programmatical name of the form control.
Definition: vmldrawing.hxx:82
SVXCORE_DLLPUBLIC SdrObject * GetSdrObjectFromXShape(const css::uno::Reference< css::drawing::XShape > &xShape) noexcept
size
ShadowModel maShadowModel
Shape shadow formatting.
Definition: vmlshape.hxx:96
void SetMergedItem(const SfxPoolItem &rItem)
css::awt::Rectangle getRectangle(const ShapeParentAnchor *pParentAnchor) const
Returns the absolute shape rectangle according to the passed anchor.
Definition: vmlshape.cxx:180
static void lcl_SetAnchorType(PropertySet &rPropSet, const ShapeTypeModel &rTypeModel, const GraphicHelper &rGraphicHelper)
Definition: vmlshape.cxx:602
OOX_DLLPUBLIC void decodeVmlPath(::std::vector< ::std::vector< css::awt::Point > > &rPoints,::std::vector< ::std::vector< css::drawing::PolygonFlags > > &rFlags, const OUString &rPath)
Converts VML path string into point and flag vectors.
void assignUsed(const StrokeModel &rSource)
OUString maArcsize
round rectangles arc size
Definition: vmlshape.hxx:90
A wrapper for a UNO property set.
Definition: propertyset.hxx:57
OUString maFragmentPath
Path to the fragment describing the form control properties.
Definition: vmldrawing.hxx:81
const sal_Int32 VML_CLIENTDATA_TEXT
Definition: vmlshape.hxx:52
A simple shape object based on a specific UNO shape service.
Definition: vmlshape.hxx:303
OptValue< OUString > moCropTop
Specifies how much to crop the image from the top down as a fraction of picture size.
Definition: vmlshape.hxx:113
static void lcl_setSurround(PropertySet &rPropSet, const ShapeTypeModel &rTypeModel, const GraphicHelper &rGraphicHelper)
Definition: vmlshape.cxx:576
sal_uInt16 xExt
virtual void finalizeFragmentImport() override
Final processing after import of the drawing fragment.
Definition: vmlshape.cxx:1484
OUString maWrapDistanceRight
Distance from the right side of the shape to the text that wraps around it.
Definition: vmlshape.hxx:107
static css::uno::Reference< css::embed::XStorage > GetStorageOfFormatFromURL(const OUString &aFormat, const OUString &aURL, sal_Int32 nStorageMode, const css::uno::Reference< css::uno::XComponentContext > &rxContext=css::uno::Reference< css::uno::XComponentContext >())
css::awt::Rectangle maCoordSys
OUString maWidth
Width of the shape bounding box (number with unit).
Definition: vmlshape.hxx:73
tools::Long const nBorder
virtual css::uno::Reference< css::drawing::XShape > implConvertAndInsert(const css::uno::Reference< css::drawing::XShapes > &rxShapes, const css::awt::Rectangle &rShapeRect) const override
Creates the corresponding XShape and inserts it into the passed container.
Definition: vmlshape.cxx:689
OptValue< OUString > moGraphicPath
Path to a graphic for this shape.
Definition: vmlshape.hxx:99
const ClientData * getClientData() const
Returns read access to the shape client data structure.
Definition: vmlshape.hxx:245
const OUString & getFileUrl() const
Returns the URL of the imported or exported file.
Definition: filterbase.cxx:247
OUString maWrapStyle
Wrapping mode for text.
Definition: vmlshape.hxx:89
OUString maLeft
X position of the shape bounding box (number with unit).
Definition: vmlshape.hxx:71
std::unique_ptr< ShapeContainer > mxChildren
Shapes and templates that are part of this group.
Definition: vmlshape.hxx:462
bool mbVisible
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
OptValue< OUString > moCropBottom
Specifies the how much to crop the image from the bottom up as a fraction of picture size...
Definition: vmlshape.hxx:110
static const OUString & getPropertyName(sal_Int32 nPropId)
Returns the name of the passed property identifier.
virtual css::uno::Reference< css::drawing::XShape > implConvertAndInsert(const css::uno::Reference< css::drawing::XShapes > &rxShapes, const css::awt::Rectangle &rShapeRect) const override
Creates the corresponding XShape and inserts it into the passed container.
Definition: vmlshape.cxx:997
sal_uInt16 yExt
OUString maFrom
Start point for line shape.
Definition: vmlshape.hxx:207
#define SAL_WARN_IF(condition, area, stream)
OUString maWrapDistanceTop
Distance from the top of the shape to the text that wraps around it.
Definition: vmlshape.hxx:108
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
virtual const ShapeType * getChildTypeById(const OUString &rShapeId) const override
Returns the shape template with the passed identifier from the child shapes.
Definition: vmlshape.cxx:1492
ShapeContainer * getContainer() const
Definition: vmlshape.cxx:503
OUString maControl2
Bezier control point 2.
Definition: vmlshape.hxx:210
css::uno::Reference< css::drawing::XShape > createAndInsertXControlShape(const ::oox::ole::EmbeddedControl &rControl, const css::uno::Reference< css::drawing::XShapes > &rxShapes, const css::awt::Rectangle &rShapeRect, sal_Int32 &rnCtrlIndex) const
Creates a new UNO shape object for a form control, inserts the control model into the form...
Definition: vmldrawing.cxx:295
OptValue< OUString > moWrapType
How to wrap the text around the object.
Definition: vmlshape.hxx:103
ShapeType(Drawing &rDrawing)
Definition: vmlshape.cxx:150
OUString getGraphicPath() const
Returns the fragment path to the embedded graphic used by this shape.
Definition: vmlshape.cxx:164
LineShape(Drawing &rDrawing)
Definition: vmlshape.cxx:1099
virtual ~ShapeType()
Definition: vmlshape.cxx:155
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
OUString maMarginLeft
X position of the shape bounding box to shape anchor (number with unit).
Definition: vmlshape.hxx:75
#define ZIP_STORAGE_FORMAT_STRING
Drawing & mrDrawing
The VML drawing page that contains this shape.
Definition: vmlshape.hxx:156
css::uno::Reference< css::drawing::XShape > createEmbeddedPictureObject(const css::uno::Reference< css::drawing::XShapes > &rxShapes, const css::awt::Rectangle &rShapeRect, OUString const &rGraphicPath) const
Used by both RectangleShape and ComplexShape.
Definition: vmlshape.cxx:930
Reference< XComponentContext > getProcessComponentContext()
SimpleShape(Drawing &rDrawing, const OUString &rService)
Definition: vmlshape.cxx:570
PolyLineShape(Drawing &rDrawing)
Definition: vmlshape.cxx:1029
css::uno::Reference< css::drawing::XShape > convertAndInsert(const css::uno::Reference< css::drawing::XShapes > &rxShapes, const ShapeParentAnchor *pParentAnchor=nullptr) const
Creates the corresponding XShape and inserts it into the passed container.
Definition: vmlshape.cxx:351
static css::uno::Sequence< typename VectorType::value_type > vectorToSequence(const VectorType &rVector)
Creates a UNO sequence from a std::vector with copies of all elements.
Represents the collection of VML shapes for a complete draw page.
Definition: vmldrawing.hxx:93
OUString maShapeId
Unique identifier of the shape.
Definition: vmlshape.hxx:62
virtual const ShapeBase * getChildById(const OUString &rShapeId) const override
Returns the shape with the passed identifier from the child shapes.
Definition: vmlshape.cxx:1497
ShapeModel & getShapeModel()
Returns read/write access to the shape model structure.
Definition: vmlshape.hxx:238
void setService(const OUString &aService)
Definition: vmlshape.hxx:308
GroupShape(Drawing &rDrawing)
Definition: vmlshape.cxx:1474
void assignUsed(const FillModel &rSource)
OUString maWrapDistanceBottom
Distance from the bottom of the shape to the text that wraps around it.
Definition: vmlshape.hxx:109
OUString msNextTextbox
Definition: vmltextbox.hxx:100
OptValue< Int32Pair > moCoordSize
Size of coordinate system for children scaling.
Definition: vmlshape.hxx:68
#define SAL_WARN(area, stream)
SVXCORE_DLLPUBLIC MSO_SPT Get(const OUString &)
OUString maVTextAnchor
How the text inside the shape is anchored vertically.
Definition: vmlshape.hxx:105
sal_Int32 nLength
css::awt::Size getOriginalSize(const css::uno::Reference< css::graphic::XGraphic > &rxGraphic) const
calculates the original size of a graphic which is necessary to be able to calculate cropping values ...
sal_Int32 mnRow
ShapeTypeModel maTypeModel
The model structure containing shape type data.
Definition: vmlshape.hxx:157
FillModel maFillModel
Shape fill formatting.
Definition: vmlshape.hxx:95
OUString maPosition
Position type of the shape.
Definition: vmlshape.hxx:69
::std::pair< sal_Int32, sal_Int32 > Int32Pair
OUString maLayoutFlowAlt
Specifies the alternate layout flow for text in textboxes.
Definition: vmlshape.hxx:114
A shape object with custom geometry.
Definition: vmlshape.hxx:404
bool has() const
Definition: helper.hxx:181
OUString maTo
End point for line shape.
Definition: vmlshape.hxx:208
ShapeBase(Drawing &rDrawing)
Definition: vmlshape.cxx:283
OptValue< OUString > moCropLeft
Specifies how much to crop the image from the left in as a fraction of picture size.
Definition: vmlshape.hxx:111
virtual css::uno::Reference< css::drawing::XShape > implConvertAndInsert(const css::uno::Reference< css::drawing::XShapes > &rxShapes, const css::awt::Rectangle &rShapeRect) const override
Creates the corresponding XShape and inserts it into the passed container.
Definition: vmlshape.cxx:1274
virtual const ShapeBase * getChildById(const OUString &rShapeId) const
Returns the shape with the passed identifier from the child shapes.
Definition: vmlshape.cxx:346
OUString maShapeName
Name of the shape, if present.
Definition: vmlshape.hxx:64
virtual css::awt::Rectangle getAbsRectangle() const
Returns the absolute shape rectangle.
Definition: vmlshape.cxx:187
OUString maPositionHorizontal
The X position orientation (default: absolute).
Definition: vmlshape.hxx:79
virtual bool convertClientAnchor(css::awt::Rectangle &orShapeRect, const OUString &rShapeAnchor) const
Derived classes may calculate the shape rectangle from a non-standard anchor information string...
Definition: vmldrawing.cxx:327
void pushToPropMap(::oox::drawingml::ShapePropertyMap &rPropMap, const GraphicHelper &rGraphicHelper) const
Writes the properties to the passed property map.
bool mbAutoHeight
If true, the height value is a minimum value (mostly used for textboxes)
Definition: vmlshape.hxx:87
OUString maWidthPercent
The width in percents of the WidthRelative.
Definition: vmlshape.hxx:81
bool setProperty(sal_Int32 nPropId, const Type &rValue)
Puts the passed value into the property set.
void pushToPropMap(::oox::drawingml::ShapePropertyMap &rPropMap, const GraphicHelper &rGraphicHelper) const
Writes the properties to the passed property map.
Point Center() const
sal_uInt16 nPos
virtual const ShapeType * getChildTypeById(const OUString &rShapeId) const
Returns the shape template with the passed identifier from the child shapes.
Definition: vmlshape.cxx:341
OptValue< OUString > moCropRight
Specifies how much to crop the image from the right in as a fraction of picture size.
Definition: vmlshape.hxx:112
sal_Int16 nValue
TextpathModel maTextpathModel
Shape textpath formatting.
Definition: vmlshape.hxx:97
PointVector maPoints
Points for the polyline shape.
Definition: vmlshape.hxx:203
css::uno::Any SAL_CALL makeAny(const SharedUNOComponent< INTERFACE, COMPONENT > &value)