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 );
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  // tdf#123626
774  if (!maShapeModel.maHyperlink.isEmpty())
775  PropertySet(xShape).setAnyProperty(PROP_HyperLinkURL, makeAny(maShapeModel.maHyperlink));
776  }
777  else
778  {
779  // FIXME Setting the relative width/height only for everything but text frames as
780  // TextFrames already have relative width/height feature... but currently not working
781  // in the way we need.
782 
783  // Set the relative width / height if any
784  if ( !maTypeModel.maWidthPercent.isEmpty( ) )
785  {
786  // Only page-relative width is supported ATM
787  if ( maTypeModel.maWidthRelative.isEmpty() || maTypeModel.maWidthRelative == "page" )
788  {
789  sal_Int16 nWidth = maTypeModel.maWidthPercent.toInt32() / 10;
790  // Only apply if nWidth != 0
791  if ( nWidth )
792  PropertySet( xShape ).setAnyProperty(PROP_RelativeWidth, makeAny( nWidth ) );
793  }
794  }
795  if ( !maTypeModel.maHeightPercent.isEmpty( ) )
796  {
797  // Only page-relative height is supported ATM
798  if ( maTypeModel.maHeightRelative.isEmpty() || maTypeModel.maHeightRelative == "page" )
799  {
800  sal_Int16 nHeight = maTypeModel.maHeightPercent.toInt32() / 10;
801  // Only apply if nHeight != 0
802  if ( nHeight )
803  PropertySet( xShape ).setAnyProperty(PROP_RelativeHeight, makeAny( nHeight ) );
804  }
805  }
806 
807  // drawinglayer default is center, MSO default is top.
808  drawing::TextVerticalAdjust eTextVerticalAdjust = drawing::TextVerticalAdjust_TOP;
809  if (maTypeModel.maVTextAnchor == "middle")
810  eTextVerticalAdjust = drawing::TextVerticalAdjust_CENTER;
811  else if (maTypeModel.maVTextAnchor == "bottom")
812  eTextVerticalAdjust = drawing::TextVerticalAdjust_BOTTOM;
813  PropertySet(xShape).setAnyProperty(PROP_TextVerticalAdjust, makeAny(eTextVerticalAdjust));
814 
815  // tdf#97618
816  if(!maTypeModel.maWrapStyle.isEmpty())
817  PropertySet(xShape).setAnyProperty(PROP_TextWordWrap, makeAny(maTypeModel.maWrapStyle == "square"));
818 
819  // tdf#123626
820  if (!maShapeModel.maHyperlink.isEmpty())
821  PropertySet(xShape).setAnyProperty(PROP_Hyperlink, makeAny(maShapeModel.maHyperlink));
822 
823  PropertySet(xShape).setAnyProperty(PROP_TextAutoGrowHeight,
825 
826  if (getTextBox())
827  {
828  getTextBox()->convert(xShape);
829  if (getTextBox()->borderDistanceSet)
830  {
831  awt::Size aSize = xShape->getSize();
832  PropertySet(xShape).setAnyProperty(PROP_TextLeftDistance, makeAny(sal_Int32(getTextBox()->borderDistanceLeft)));
833  PropertySet(xShape).setAnyProperty(PROP_TextUpperDistance, makeAny(sal_Int32(getTextBox()->borderDistanceTop)));
834  PropertySet(xShape).setAnyProperty(PROP_TextRightDistance, makeAny(sal_Int32(getTextBox()->borderDistanceRight)));
835  PropertySet(xShape).setAnyProperty(PROP_TextLowerDistance, makeAny(sal_Int32(getTextBox()->borderDistanceBottom)));
836  xShape->setSize(aSize);
837  }
838  }
839  }
840 
841  // Import Legacy Fragments (if any)
842  if( xShape.is() && !maShapeModel.maLegacyDiagramPath.isEmpty() )
843  {
845  if( xInStrm.is() )
846  PropertySet( xShape ).setProperty( PROP_LegacyFragment, xInStrm );
847  }
848 
849  PropertySet aPropertySet(xShape);
850  if (xShape.is())
851  {
852  if (oRotation)
853  {
854  aPropertySet.setAnyProperty(PROP_RotateAngle, makeAny((*oRotation).get()));
855  uno::Reference<lang::XServiceInfo> xServiceInfo(rxShapes, uno::UNO_QUERY);
856  if (!xServiceInfo->supportsService("com.sun.star.drawing.GroupShape"))
857  {
858  // If rotation is used, simple setPosition() is not enough.
859  aPropertySet.setAnyProperty(PROP_HoriOrientPosition, makeAny(aShapeRect.X));
860  aPropertySet.setAnyProperty(PROP_VertOrientPosition, makeAny(aShapeRect.Y));
861  }
862  }
863 
864  // custom shape geometry attributes
865  std::vector<css::beans::PropertyValue> aPropVec;
866 
867  // When flip has 'x' or 'y', the associated ShapeRect will be changed but direction change doesn't occur.
868  // It might occur internally in SdrObject of "sw" module, not here.
869  // The associated properties "PROP_MirroredX" and "PROP_MirroredY" have to be set here so that direction change will occur internally.
870  if (bFlipX)
871  aPropVec.push_back(comphelper::makePropertyValue("MirroredX", true));
872  if (bFlipY)
873  aPropVec.push_back(comphelper::makePropertyValue("MirroredY", true));
874 
875  if (!maTypeModel.maAdjustments.isEmpty())
876  {
877  std::vector<drawing::EnhancedCustomShapeAdjustmentValue> aAdjustmentValues;
878  sal_Int32 nIndex = 0;
879  do
880  {
881  OUString aToken = maTypeModel.maAdjustments.getToken(0, ',', nIndex);
882  drawing::EnhancedCustomShapeAdjustmentValue aAdjustmentValue;
883  if (aToken.isEmpty())
884  aAdjustmentValue.State = css::beans::PropertyState::PropertyState_DEFAULT_VALUE;
885  else
886  aAdjustmentValue.Value <<= aToken.toInt32();
887  aAdjustmentValues.push_back(aAdjustmentValue);
888  } while (nIndex >= 0);
889 
890  css::beans::PropertyValue aProp;
891  aProp.Name = "AdjustmentValues";
892  aProp.Value <<= comphelper::containerToSequence(aAdjustmentValues);
893  aPropVec.push_back(aProp);
894  }
895 
896  if (!aPropVec.empty())
897  aPropertySet.setAnyProperty(PROP_CustomShapeGeometry, makeAny(comphelper::containerToSequence(aPropVec)));
898  }
899 
900  lcl_SetAnchorType(aPropertySet, maTypeModel, rGraphicHelper );
901 
902  return xShape;
903 }
904 
905 Reference<XShape> SimpleShape::finalImplConvertAndInsert(const css::uno::Reference<css::drawing::XShape>& rxShape) const
906 {
907  // tdf#41466 This setting must be done here, because the position of textbox will be set as an
908  // effect of the PROP_TextBox property setting, and if we do this setting earlier (setting of
909  // properties of position and size) then the position of textbox will be set with wrong data.
910  // TODO: TextShape is set if we have rect shape in group; we should use the shape-with-textbox
911  // mechanism to handle this situation
912  if (getTextBox() && maService != "com.sun.star.text.TextFrame" && maService != "com.sun.star.drawing.TextShape"
914  {
915  const GraphicHelper& rGraphicHelper = mrDrawing.getFilter().getGraphicHelper();
916  const auto& nLeft = ConversionHelper::decodeMeasureToHmm(
917  rGraphicHelper, maTypeModel.maMarginLeft, 0, true, true);
918  PropertySet aPropertySet(rxShape);
919  aPropertySet.setProperty(PROP_HoriOrientPosition, nLeft);
920  const auto& nTop = ConversionHelper::decodeMeasureToHmm(
921  rGraphicHelper, maTypeModel.maMarginTop, 0, true, true);
922  aPropertySet.setProperty(PROP_VertOrientPosition, nTop);
923  aPropertySet.setProperty(PROP_TextBox, true);
924 
925  // And these properties must be set after textbox creation (set PROP_Textbox property).
926  // Note: if you set a new property then you have to handle it in the proper
927  // SwTextBoxHelper::syncProperty function.
928  if (maTypeModel.maLayoutFlowAlt == "bottom-to-top")
929  aPropertySet.setAnyProperty(PROP_TextWritingMode, uno::makeAny(text::WritingMode2::BT_LR));
930  }
931  return ShapeBase::finalImplConvertAndInsert(rxShape);
932 }
933 Reference< XShape > SimpleShape::createEmbeddedPictureObject( const Reference< XShapes >& rxShapes, const awt::Rectangle& rShapeRect, OUString const & rGraphicPath ) const
934 {
935  Reference<XGraphic> xGraphic = mrDrawing.getFilter().getGraphicHelper().importEmbeddedGraphic(rGraphicPath);
936  return SimpleShape::createPictureObject(rxShapes, rShapeRect, xGraphic);
937 }
938 
939 Reference< XShape > SimpleShape::createPictureObject(const Reference< XShapes >& rxShapes,
940  const awt::Rectangle& rShapeRect,
941  uno::Reference<graphic::XGraphic> const & rxGraphic) const
942 {
943  Reference< XShape > xShape = mrDrawing.createAndInsertXShape( "com.sun.star.drawing.GraphicObjectShape", rxShapes, rShapeRect );
944  if( xShape.is() )
945  {
946  PropertySet aPropSet(xShape);
947  if (rxGraphic.is())
948  {
949  aPropSet.setProperty(PROP_Graphic, rxGraphic);
950  }
951  uno::Reference< lang::XServiceInfo > xServiceInfo(rxShapes, uno::UNO_QUERY);
952  // If the shape has an absolute position, set the properties accordingly, unless we're inside a group shape.
953  if ( maTypeModel.maPosition == "absolute" && !xServiceInfo->supportsService("com.sun.star.drawing.GroupShape"))
954  {
955  aPropSet.setProperty(PROP_HoriOrientPosition, rShapeRect.X);
956  aPropSet.setProperty(PROP_VertOrientPosition, rShapeRect.Y);
957  aPropSet.setProperty(PROP_Opaque, false);
958  }
959  // fdo#70457: preserve rotation information
960  if ( !maTypeModel.maRotation.isEmpty() )
962 
963  const GraphicHelper& rGraphicHelper = mrDrawing.getFilter().getGraphicHelper();
964  lcl_SetAnchorType(aPropSet, maTypeModel, rGraphicHelper);
965 
966  const sal_Int32 nWrapDistanceLeft = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, maTypeModel.maWrapDistanceLeft, 0, true, true);
967  const sal_Int32 nWrapDistanceRight = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, maTypeModel.maWrapDistanceRight, 0, true, true);
968  const sal_Int32 nWrapDistanceTop = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, maTypeModel.maWrapDistanceTop, 0, false, true);
969  const sal_Int32 nWrapDistanceBottom = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, maTypeModel.maWrapDistanceBottom, 0, false, true);
970  aPropSet.setProperty(PROP_LeftMargin, uno::makeAny(nWrapDistanceLeft));
971  aPropSet.setProperty(PROP_RightMargin, uno::makeAny(nWrapDistanceRight));
972  aPropSet.setProperty(PROP_TopMargin, uno::makeAny(nWrapDistanceTop));
973  aPropSet.setProperty(PROP_BottomMargin, uno::makeAny(nWrapDistanceBottom));
974 
976  {
977  text::GraphicCrop aGraphicCrop;
978  awt::Size aOriginalSize = rGraphicHelper.getOriginalSize(rxGraphic);
979 
981  aGraphicCrop.Bottom = lclConvertCrop(maTypeModel.moCropBottom.get(), aOriginalSize.Height);
982  if (maTypeModel.moCropLeft.has())
983  aGraphicCrop.Left = lclConvertCrop(maTypeModel.moCropLeft.get(), aOriginalSize.Width);
985  aGraphicCrop.Right = lclConvertCrop(maTypeModel.moCropRight.get(), aOriginalSize.Width);
986  if (maTypeModel.moCropTop.has())
987  aGraphicCrop.Top = lclConvertCrop(maTypeModel.moCropTop.get(), aOriginalSize.Height);
988 
989  aPropSet.setProperty(PROP_GraphicCrop, aGraphicCrop);
990  }
991  }
992  return xShape;
993 }
994 
996  SimpleShape( rDrawing, "com.sun.star.drawing.RectangleShape" )
997 {
998 }
999 
1000 Reference<XShape> RectangleShape::implConvertAndInsert(const Reference<XShapes>& rxShapes, const awt::Rectangle& rShapeRect) const
1001 {
1002  OUString aGraphicPath = getGraphicPath();
1003 
1004  // try to create a picture object
1005  if(!aGraphicPath.isEmpty())
1006  return SimpleShape::createEmbeddedPictureObject(rxShapes, rShapeRect, aGraphicPath);
1007 
1008  // default: try to create a rectangle shape
1009  Reference<XShape> xShape = SimpleShape::implConvertAndInsert(rxShapes, rShapeRect);
1010  OUString sArcsize = maTypeModel.maArcsize;
1011  if ( !sArcsize.isEmpty( ) )
1012  {
1013  sal_Unicode cLastChar = sArcsize[sArcsize.getLength() - 1];
1014  sal_Int32 nValue = sArcsize.copy( 0, sArcsize.getLength() - 1 ).toInt32( );
1015  // Get the smallest half-side
1016  double size = std::min( rShapeRect.Height, rShapeRect.Width ) / 2.0;
1017  sal_Int32 nRadius = 0;
1018  if ( cLastChar == 'f' )
1019  nRadius = size * nValue / 65536;
1020  else if ( cLastChar == '%' )
1021  nRadius = size * nValue / 100;
1022  PropertySet( xShape ).setAnyProperty( PROP_CornerRadius, makeAny( nRadius ) );
1023  }
1024  return xShape;
1025 }
1026 
1028  SimpleShape( rDrawing, "com.sun.star.drawing.EllipseShape" )
1029 {
1030 }
1031 
1033  SimpleShape( rDrawing, "com.sun.star.drawing.PolyLineShape" )
1034 {
1035 }
1036 
1037 Reference< XShape > PolyLineShape::implConvertAndInsert( const Reference< XShapes >& rxShapes, const awt::Rectangle& rShapeRect ) const
1038 {
1039  ::std::vector<awt::Point> aAbsPoints;
1040  awt::Rectangle aCoordSys = getCoordSystem();
1041  if (!maShapeModel.maPoints.empty() && (aCoordSys.Width > 0) && (aCoordSys.Height > 0))
1042  {
1043  for (auto const& point : maShapeModel.maPoints)
1044  aAbsPoints.push_back(lclGetAbsPoint(point, rShapeRect, aCoordSys));
1045  // A polyline cannot be filled but only a polygon. We treat first point == last point as
1046  // indicator for being closed. In that case we force to type PolyPolygonShape.
1047  if (aAbsPoints.size() > 2 && aAbsPoints.front().X == aAbsPoints.back().X
1048  && aAbsPoints.front().Y == aAbsPoints.back().Y)
1049  {
1050  const_cast<PolyLineShape*>(this)->setService("com.sun.star.drawing.PolyPolygonShape");
1051  }
1052  }
1053 
1054  Reference<XShape> xShape = SimpleShape::implConvertAndInsert(rxShapes, rShapeRect);
1055 
1056  // polygon path
1057 
1058  if (!aAbsPoints.empty())
1059  {
1060  PointSequenceSequence aPointSeq( 1 );
1061  aPointSeq[ 0 ] = ContainerHelper::vectorToSequence( aAbsPoints );
1062  PropertySet aPropSet( xShape );
1063  aPropSet.setProperty( PROP_PolyPolygon, aPointSeq );
1064  }
1065  return xShape;
1066 }
1067 
1068 namespace
1069 {
1070  void doMirrorX(SdrObject* pShape)
1071  {
1072  Point aCenter(pShape->GetSnapRect().Center());
1073  Point aPoint2(aCenter);
1074  aPoint2.setY(aPoint2.getY() + 1);
1075  pShape->NbcMirror(aCenter, aPoint2);
1076  }
1077 
1078  void doMirrorY(SdrObject* pShape)
1079  {
1080  Point aCenter(pShape->GetSnapRect().Center());
1081  Point aPoint2(aCenter);
1082  aPoint2.setX(aPoint2.getX() + 1);
1083  pShape->NbcMirror(aCenter, aPoint2);
1084  }
1085 
1086  void handleMirroring(const ShapeTypeModel& rTypeModel, const Reference<XShape>& rxShape)
1087  {
1088  if (!rTypeModel.maFlip.isEmpty())
1089  {
1090  if (SdrObject* pShape = SdrObject::getSdrObjectFromXShape(rxShape))
1091  {
1092  if (rTypeModel.maFlip.startsWith("x"))
1093  doMirrorX(pShape);
1094  if (rTypeModel.maFlip.endsWith("y"))
1095  doMirrorY(pShape);
1096  }
1097  }
1098  }
1099 
1100  void handleRotation(const ShapeTypeModel& rTypeModel, const Reference<XShape>& rxShape)
1101  {
1102  if (!rTypeModel.maRotation.isEmpty())
1103  {
1104  if (SdrObject* pShape = SdrObject::getSdrObjectFromXShape(rxShape))
1105  {
1106  // The needed factor -1 for opposite direction and factor 100 for Degree100 is
1107  // contained in method decodeRotation().
1108  Degree100 nAngle(ConversionHelper::decodeRotation(rTypeModel.maRotation));
1109  pShape->NbcRotate(pShape->GetSnapRect().Center(), nAngle);
1110  }
1111  }
1112  }
1113 }
1114 
1116  : SimpleShape(rDrawing, "com.sun.star.drawing.LineShape")
1117 {
1118 }
1119 
1120 Reference<XShape> LineShape::implConvertAndInsert(const Reference<XShapes>& rxShapes, const awt::Rectangle& rShapeRect) const
1121 {
1122  Reference<XShape> xShape = SimpleShape::implConvertAndInsert(rxShapes, rShapeRect);
1123  // tdf#137765
1124  handleRotation(maTypeModel, xShape);
1125  // tdf#97517 tdf#137678
1126  // The MirroredX and MirroredY properties (in the CustomShapeGeometry property) are not
1127  // supported for the LineShape by UNO, so we have to make the mirroring here.
1128  handleMirroring(maTypeModel, xShape);
1129  return xShape;
1130 }
1131 
1132 awt::Rectangle LineShape::getAbsRectangle() const
1133 {
1134  const GraphicHelper& rGraphicHelper = mrDrawing.getFilter().getGraphicHelper();
1135  awt::Rectangle aShapeRect;
1136  sal_Int32 nIndex = 0;
1137 
1138  aShapeRect.X = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, maShapeModel.maFrom.getToken(0, ',', nIndex), 0, true, true);
1139  aShapeRect.Y = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, maShapeModel.maFrom.getToken(0, ',', nIndex), 0, false, true);
1140  nIndex = 0;
1141  aShapeRect.Width = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, maShapeModel.maTo.getToken(0, ',', nIndex), 0, true, true) - aShapeRect.X;
1142  aShapeRect.Height = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, maShapeModel.maTo.getToken(0, ',', nIndex), 0, false, true) - aShapeRect.Y;
1143  return aShapeRect;
1144 }
1145 
1146 awt::Rectangle LineShape::getRelRectangle() const
1147 {
1148  awt::Rectangle aShapeRect;
1149  sal_Int32 nIndex = 0;
1150 
1151  aShapeRect.X = maShapeModel.maFrom.getToken(0, ',', nIndex).toInt32();
1152  aShapeRect.Y = maShapeModel.maFrom.getToken(0, ',', nIndex).toInt32();
1153  nIndex = 0;
1154  aShapeRect.Width = maShapeModel.maTo.getToken(0, ',', nIndex).toInt32() - aShapeRect.X;
1155  aShapeRect.Height = maShapeModel.maTo.getToken(0, ',', nIndex).toInt32() - aShapeRect.Y;
1156  return aShapeRect;
1157 }
1158 
1160  : SimpleShape(rDrawing, "com.sun.star.drawing.OpenBezierShape")
1161 {
1162 }
1163 
1164 Reference< XShape > BezierShape::implConvertAndInsert( const Reference< XShapes >& rxShapes, const awt::Rectangle& rShapeRect ) const
1165 {
1166  // If we have an 'x' in the last part of the path it means it is closed...
1167  sal_Int32 nPos = maShapeModel.maVmlPath.lastIndexOf(',');
1168  if ( nPos != -1 && maShapeModel.maVmlPath.indexOf('x', nPos) != -1 )
1169  {
1170  const_cast<BezierShape*>( this )->setService( "com.sun.star.drawing.ClosedBezierShape" );
1171  }
1172 
1173  awt::Rectangle aCoordSys = getCoordSystem();
1174  PolyPolygonBezierCoords aBezierCoords;
1175 
1176  if( (aCoordSys.Width > 0) && (aCoordSys.Height > 0) )
1177  {
1178  const GraphicHelper& rGraphicHelper = mrDrawing.getFilter().getGraphicHelper();
1179 
1180  // Bezier paths may consist of one or more sub-paths
1181  typedef ::std::vector< ::std::vector< PolygonFlags > > FlagsList;
1182  std::vector< ::std::vector< awt::Point > > aCoordLists;
1183  FlagsList aFlagLists;
1184 
1185  // Curve defined by to, from, control1 and control2 attributes
1186  if ( maShapeModel.maVmlPath.isEmpty() )
1187  {
1188  aCoordLists.emplace_back( );
1189  aFlagLists.emplace_back( );
1190  sal_Int32 nIndex = 0;
1191 
1192  // Start point
1193  aCoordLists[ 0 ].emplace_back(
1194  ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maShapeModel.maFrom.getToken( 0, ',', nIndex ), 0, true, true ),
1195  ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maShapeModel.maFrom.getToken( 0, ',', nIndex ), 0, false, true ) );
1196  // Control point 1
1197  aCoordLists[ 0 ].emplace_back(
1198  ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maShapeModel.maControl1.getToken( 0, ',', nIndex ), 0, true, true ),
1199  ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maShapeModel.maControl1.getToken( 0, ',', nIndex ), 0, false, true ) );
1200  // Control point 2
1201  aCoordLists[ 0 ].emplace_back(
1202  ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maShapeModel.maControl2.getToken( 0, ',', nIndex ), 0, true, true ),
1203  ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maShapeModel.maControl2.getToken( 0, ',', nIndex ), 0, false, true ) );
1204  // End point
1205  aCoordLists[ 0 ].emplace_back(
1206  ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maShapeModel.maTo.getToken( 0, ',', nIndex ), 0, true, true ),
1207  ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maShapeModel.maTo.getToken( 0, ',', nIndex ), 0, false, true ) );
1208 
1209  // First and last points are normals, points 2 and 4 are controls
1210  aFlagLists[ 0 ].resize( aCoordLists[ 0 ].size(), PolygonFlags_CONTROL );
1211  aFlagLists[ 0 ][ 0 ] = PolygonFlags_NORMAL;
1212  aFlagLists[ 0 ].back() = PolygonFlags_NORMAL;
1213  }
1214  // Curve defined by path attribute
1215  else
1216  {
1217  // Parse VML path string and convert to absolute coordinates
1218  ConversionHelper::decodeVmlPath( aCoordLists, aFlagLists, maShapeModel.maVmlPath );
1219 
1220  for (auto & coordList : aCoordLists)
1221  for (auto & point : coordList)
1222  {
1223  point = lclGetAbsPoint( point, rShapeRect, aCoordSys );
1224  }
1225  }
1226 
1227  aBezierCoords.Coordinates.realloc( aCoordLists.size() );
1228  for ( size_t i = 0; i < aCoordLists.size(); i++ )
1229  aBezierCoords.Coordinates[i] = ContainerHelper::vectorToSequence( aCoordLists[i] );
1230 
1231  aBezierCoords.Flags.realloc( aFlagLists.size() );
1232  for ( size_t i = 0; i < aFlagLists.size(); i++ )
1233  aBezierCoords.Flags[i] = ContainerHelper::vectorToSequence( aFlagLists[i] );
1234 
1235  if( !aCoordLists.front().empty() && !aCoordLists.back().empty()
1236  && aCoordLists.front().front().X == aCoordLists.back().back().X
1237  && aCoordLists.front().front().Y == aCoordLists.back().back().Y )
1238  { // HACK: If the shape is in fact closed, which can be found out only when the path is known,
1239  // force to closed bezier shape (otherwise e.g. fill won't work).
1240  const_cast< BezierShape* >( this )->setService( "com.sun.star.drawing.ClosedBezierShape" );
1241  }
1242  }
1243 
1244  Reference< XShape > xShape = SimpleShape::implConvertAndInsert( rxShapes, rShapeRect );
1245 
1246  if( aBezierCoords.Coordinates.hasElements())
1247  {
1248  PropertySet aPropSet( xShape );
1249  aPropSet.setProperty( PROP_PolyPolygonBezier, aBezierCoords );
1250  }
1251 
1252  // tdf#105875 handle rotation
1253  // Note: must rotate before flip!
1254  handleRotation(maTypeModel, xShape);
1255 
1256  // Handle horizontal and vertical flip.
1257  handleMirroring(maTypeModel, xShape);
1258 
1259  return xShape;
1260 }
1261 
1263  SimpleShape( rDrawing, "com.sun.star.drawing.CustomShape" )
1264 {
1265 }
1266 
1267 Reference< XShape > CustomShape::implConvertAndInsert( const Reference< XShapes >& rxShapes, const awt::Rectangle& rShapeRect ) const
1268 {
1269  // try to create a custom shape
1270  Reference< XShape > xShape = SimpleShape::implConvertAndInsert( rxShapes, rShapeRect );
1271  if( xShape.is() ) try
1272  {
1273  // create the custom shape geometry
1274  Reference< XEnhancedCustomShapeDefaulter > xDefaulter( xShape, UNO_QUERY_THROW );
1275  xDefaulter->createCustomShapeDefaults( OUString::number( getShapeType() ) );
1276  // convert common properties
1277  convertShapeProperties( xShape );
1278  }
1279  catch( Exception& )
1280  {
1281  }
1282  return xShape;
1283 }
1284 
1286  CustomShape( rDrawing )
1287 {
1288 }
1289 
1290 Reference< XShape > ComplexShape::implConvertAndInsert( const Reference< XShapes >& rxShapes, const awt::Rectangle& rShapeRect ) const
1291 {
1292  XmlFilterBase& rFilter = mrDrawing.getFilter();
1293  sal_Int32 nShapeType = getShapeType();
1294  OUString aGraphicPath = getGraphicPath();
1295 
1296  // try to find registered OLE object info
1297  if( const OleObjectInfo* pOleObjectInfo = mrDrawing.getOleObjectInfo( maTypeModel.maShapeId ) )
1298  {
1299  SAL_WARN_IF(
1300  nShapeType != VML_SHAPETYPE_PICTUREFRAME, "oox",
1301  "ComplexShape::implConvertAndInsert - unexpected shape type");
1302 
1303  // if OLE object is embedded into a DrawingML shape (PPTX), do not create it here
1304  if( pOleObjectInfo->mbDmlShape )
1305  return Reference< XShape >();
1306 
1307  PropertyMap aOleProps;
1308  awt::Size aOleSize( rShapeRect.Width, rShapeRect.Height );
1309  if( rFilter.getOleObjectHelper().importOleObject( aOleProps, *pOleObjectInfo, aOleSize ) )
1310  {
1311  Reference< XShape > xShape = mrDrawing.createAndInsertXShape( "com.sun.star.drawing.OLE2Shape", rxShapes, rShapeRect );
1312  if( xShape.is() )
1313  {
1314  // set the replacement graphic
1315  if( !aGraphicPath.isEmpty() )
1316  {
1317  WmfExternal aExtHeader;
1318  aExtHeader.mapMode = 8;
1319  aExtHeader.xExt = rShapeRect.Width;
1320  aExtHeader.yExt = rShapeRect.Height;
1321 
1322  Reference< XGraphic > xGraphic = rFilter.getGraphicHelper().importEmbeddedGraphic(aGraphicPath, &aExtHeader);
1323  if (xGraphic.is())
1324  aOleProps.setProperty( PROP_Graphic, xGraphic);
1325  }
1326 
1327  PropertySet aPropSet( xShape );
1328  aPropSet.setProperties( aOleProps );
1329 
1330  return xShape;
1331  }
1332  }
1333  }
1334 
1335  // try to find registered form control info
1336  const ControlInfo* pControlInfo = mrDrawing.getControlInfo( maTypeModel.maShapeId );
1337  if( pControlInfo && !pControlInfo->maFragmentPath.isEmpty() )
1338  {
1339  if( !pControlInfo->maName.isEmpty() )
1340  {
1341  // load the control properties from fragment
1342  ::oox::ole::EmbeddedControl aControl(pControlInfo->maName);
1343  if( rFilter.importFragment( new ::oox::ole::AxControlFragment( rFilter, pControlInfo->maFragmentPath, aControl ) ) )
1344  {
1345  // create and return the control shape (including control model)
1346  sal_Int32 nCtrlIndex = -1;
1347  Reference< XShape > xShape = mrDrawing.createAndInsertXControlShape( aControl, rxShapes, rShapeRect, nCtrlIndex );
1348 
1349  if (pControlInfo->mbTextContentShape)
1350  {
1351  PropertySet aPropertySet(xShape);
1353  }
1354  // on error, proceed and try to create picture from replacement image
1355  if( xShape.is() )
1356  return xShape;
1357  }
1358  }
1359  }
1360 
1361  // host application wants to create the shape (do not try failed OLE controls again)
1362  if( (nShapeType == VML_SHAPETYPE_HOSTCONTROL) && !pControlInfo )
1363  {
1364  OSL_ENSURE( getClientData(), "ComplexShape::implConvertAndInsert - missing client data" );
1365  Reference< XShape > xShape = mrDrawing.createAndInsertClientXShape( *this, rxShapes, rShapeRect );
1366  if( xShape.is() )
1367  return xShape;
1368  }
1369 
1370 
1372  {
1373  uno::Reference<graphic::XGraphic> xGraphic;
1374  bool bIsSigned(false);
1375  try
1376  {
1377  // Get the document signatures
1378  Reference<security::XDocumentDigitalSignatures> xSignatures(
1379  security::DocumentDigitalSignatures::createDefault(
1381 
1382  uno::Reference<embed::XStorage> xStorage
1385  embed::ElementModes::READ);
1386  SAL_WARN_IF(!xStorage.is(), "oox.vml", "No xStorage!");
1387 
1388  const uno::Sequence<security::DocumentSignatureInformation> xSignatureInfo
1389  = xSignatures->verifyScriptingContentSignatures(xStorage,
1390  uno::Reference<io::XInputStream>());
1391 
1392  // Try to find matching signature line image - if none exists that is fine,
1393  // then the signature line is not digitally signed.
1394  auto pSignInfo = std::find_if(xSignatureInfo.begin(), xSignatureInfo.end(),
1395  [this](const security::DocumentSignatureInformation& rSigInfo) {
1396  return rSigInfo.SignatureLineId == getShapeModel().maSignatureId; });
1397  if (pSignInfo != xSignatureInfo.end())
1398  {
1399  bIsSigned = true;
1400  if (pSignInfo->SignatureIsValid)
1401  {
1402  // Signature is valid, use the 'valid' image
1403  SAL_WARN_IF(!pSignInfo->ValidSignatureLineImage.is(), "oox.vml",
1404  "No ValidSignatureLineImage!");
1405  xGraphic = pSignInfo->ValidSignatureLineImage;
1406  }
1407  else
1408  {
1409  // Signature is invalid, use the 'invalid' image
1410  SAL_WARN_IF(!pSignInfo->InvalidSignatureLineImage.is(), "oox.vml",
1411  "No InvalidSignatureLineImage!");
1412  xGraphic = pSignInfo->InvalidSignatureLineImage;
1413  }
1414  }
1415  }
1416  catch (css::uno::Exception&)
1417  {
1418  // DocumentDigitalSignatures service not available.
1419  // We continue by rendering the "unsigned" shape instead.
1420  }
1421 
1422  Reference< XShape > xShape;
1423  if (xGraphic.is())
1424  {
1425  // If available, use the signed image from the signature
1426  xShape = SimpleShape::createPictureObject(rxShapes, rShapeRect, xGraphic);
1427  }
1428  else
1429  {
1430  // Create shape with the fallback "unsigned" image
1431  xShape = SimpleShape::createEmbeddedPictureObject(rxShapes, rShapeRect, aGraphicPath);
1432  }
1433 
1434  // Store signature line properties
1435  uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY);
1436  xPropertySet->setPropertyValue("IsSignatureLine", uno::makeAny(true));
1437  xPropertySet->setPropertyValue("SignatureLineId",
1438  uno::makeAny(getShapeModel().maSignatureId));
1439  xPropertySet->setPropertyValue(
1440  "SignatureLineSuggestedSignerName",
1441  uno::makeAny(getShapeModel().maSignatureLineSuggestedSignerName));
1442  xPropertySet->setPropertyValue(
1443  "SignatureLineSuggestedSignerTitle",
1444  uno::makeAny(getShapeModel().maSignatureLineSuggestedSignerTitle));
1445  xPropertySet->setPropertyValue(
1446  "SignatureLineSuggestedSignerEmail",
1447  uno::makeAny(getShapeModel().maSignatureLineSuggestedSignerEmail));
1448  xPropertySet->setPropertyValue(
1449  "SignatureLineSigningInstructions",
1450  uno::makeAny(getShapeModel().maSignatureLineSigningInstructions));
1451  xPropertySet->setPropertyValue(
1452  "SignatureLineShowSignDate",
1453  uno::makeAny(getShapeModel().mbSignatureLineShowSignDate));
1454  xPropertySet->setPropertyValue(
1455  "SignatureLineCanAddComment",
1456  uno::makeAny(getShapeModel().mbSignatureLineCanAddComment));
1457  xPropertySet->setPropertyValue("SignatureLineIsSigned", uno::makeAny(bIsSigned));
1458 
1459  if (!aGraphicPath.isEmpty())
1460  {
1461  xGraphic = rFilter.getGraphicHelper().importEmbeddedGraphic(aGraphicPath);
1462  xPropertySet->setPropertyValue("SignatureLineUnsignedImage", uno::makeAny(xGraphic));
1463  }
1464  return xShape;
1465  }
1466 
1467  // try to create a picture object
1468  if( !aGraphicPath.isEmpty() )
1469  {
1470  Reference<XShape> xShape = SimpleShape::createEmbeddedPictureObject(rxShapes, rShapeRect, aGraphicPath);
1471  // AS_CHARACTER shape: vertical orientation default is bottom, MSO default is top.
1472  if ( maTypeModel.maPosition != "absolute" && maTypeModel.maPosition != "relative" )
1473  PropertySet( xShape ).setAnyProperty( PROP_VertOrient, makeAny(text::VertOrientation::TOP));
1474 
1475  // Apply stroke props from the type model.
1477  const GraphicHelper& rGraphicHelper = mrDrawing.getFilter().getGraphicHelper();
1478  maTypeModel.maStrokeModel.pushToPropMap(aPropMap, rGraphicHelper);
1479  // And, fill-color properties as well...
1480  maTypeModel.maFillModel.pushToPropMap(aPropMap, rGraphicHelper);
1481  PropertySet(xShape).setProperties(aPropMap);
1482 
1483  return xShape;
1484  }
1485 
1486  // default: try to create a custom shape
1487  return CustomShape::implConvertAndInsert( rxShapes, rShapeRect );
1488 }
1489 
1491  ShapeBase( rDrawing ),
1492  mxChildren( new ShapeContainer( rDrawing ) )
1493 {
1494 }
1495 
1497 {
1498 }
1499 
1501 {
1502  // basic shape processing
1504  // finalize all child shapes
1505  mxChildren->finalizeFragmentImport();
1506 }
1507 
1508 const ShapeType* GroupShape::getChildTypeById( const OUString& rShapeId ) const
1509 {
1510  return mxChildren->getShapeTypeById( rShapeId );
1511 }
1512 
1513 const ShapeBase* GroupShape::getChildById( const OUString& rShapeId ) const
1514 {
1515  return mxChildren->getShapeById( rShapeId );
1516 }
1517 
1518 Reference< XShape > GroupShape::implConvertAndInsert( const Reference< XShapes >& rxShapes, const awt::Rectangle& rShapeRect ) const
1519 {
1520  Reference< XShape > xGroupShape;
1521  // check that this shape contains children and a valid coordinate system
1522  ShapeParentAnchor aParentAnchor;
1523  aParentAnchor.maShapeRect = rShapeRect;
1524  aParentAnchor.maCoordSys = getCoordSystem();
1525  if( !mxChildren->empty() && (aParentAnchor.maCoordSys.Width > 0) && (aParentAnchor.maCoordSys.Height > 0) ) try
1526  {
1527  xGroupShape = mrDrawing.createAndInsertXShape( "com.sun.star.drawing.GroupShape", rxShapes, rShapeRect );
1528  Reference< XShapes > xChildShapes( xGroupShape, UNO_QUERY_THROW );
1529  mxChildren->convertAndInsert( xChildShapes, &aParentAnchor );
1530  if( !xChildShapes->hasElements() )
1531  {
1532  SAL_WARN("oox", "no child shape has been created - deleting the group shape");
1533  rxShapes->remove( xGroupShape );
1534  xGroupShape.clear();
1535  }
1536  }
1537  catch( Exception& )
1538  {
1539  }
1540 
1541  uno::Reference<beans::XPropertySet> xPropertySet;
1542  if (!maTypeModel.maEditAs.isEmpty())
1543  xPropertySet = uno::Reference<beans::XPropertySet>(xGroupShape, uno::UNO_QUERY);
1544  if (xPropertySet.is())
1545  {
1546  uno::Sequence<beans::PropertyValue> aGrabBag;
1547  xPropertySet->getPropertyValue("InteropGrabBag") >>= aGrabBag;
1548  beans::PropertyValue aPair;
1549  aPair.Name = "mso-edit-as";
1550  aPair.Value <<= maTypeModel.maEditAs;
1551  sal_Int32 nLength = aGrabBag.getLength();
1552  aGrabBag.realloc(nLength + 1);
1553  aGrabBag[nLength] = aPair;
1554  xPropertySet->setPropertyValue("InteropGrabBag", uno::makeAny(aGrabBag));
1555  }
1556  // Make sure group shapes are inline as well, unless there is an explicit different style.
1557  PropertySet aPropertySet(xGroupShape);
1558  const GraphicHelper& rGraphicHelper = mrDrawing.getFilter().getGraphicHelper();
1559  lcl_SetAnchorType(aPropertySet, maTypeModel, rGraphicHelper);
1560  if (!maTypeModel.maRotation.isEmpty())
1562  return xGroupShape;
1563 }
1564 
1565 } // namespace oox
1566 
1567 /* 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:204
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:1037
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:1159
OUString maSignatureId
ID of the signature.
Definition: vmlshape.hxx:212
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:211
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
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
Excel specific shape client data (such as cell anchor).
Definition: vmlshape.hxx:161
ShapeContainer & getShapes()
Returns read/write access to the container of shapes and templates.
Definition: vmldrawing.hxx:108
static SdrObject * getSdrObjectFromXShape(const css::uno::Reference< css::uno::XInterface > &xInt)
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:124
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:1164
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:1518
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:1120
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:1027
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:1146
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:995
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:210
OUString maEditAs
Edit As type (e.g. "canvas" etc)
Definition: vmlshape.hxx:91
OUString maType
Shape template with default properties.
Definition: vmlshape.hxx:201
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:136
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:1496
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:905
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
XML_TOKEN_INVALID
StrokeModel maStrokeModel
Border line formatting.
Definition: vmlshape.hxx:94
std::unique_ptr< TextBox > mxTextBox
Text contents and properties.
Definition: vmlshape.hxx:203
CustomShape(Drawing &rDrawing)
Definition: vmlshape.cxx:1262
OUString maHeightRelative
To what the height is relative.
Definition: vmlshape.hxx:84
OUString maHyperlink
The hyperlink assigned to the shape.
Definition: vmlshape.hxx:220
OUString maAnchor
Cell anchor as comma-separated string.
Definition: vmlshape.hxx:163
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:939
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:131
Container that holds a list of shapes and shape templates.
OUString maControl1
Bezier control point 1.
Definition: vmlshape.hxx:208
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:1267
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
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
A polygon shape object.
Definition: vmlshape.hxx:356
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:1132
OUString maRotation
Rotation of the shape, in degrees.
Definition: vmlshape.hxx:85
OUString maLegacyDiagramPath
Legacy Diagram Fragment Path.
Definition: vmlshape.hxx:205
OptValue< OUString > moWeight
Line width.
ComplexShape(Drawing &rDrawing)
Definition: vmlshape.cxx:1285
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.
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
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:1500
constexpr Point Center() const
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
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:1000
sal_uInt16 yExt
OUString maFrom
Start point for line shape.
Definition: vmlshape.hxx:206
#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:1508
ShapeContainer * getContainer() const
Definition: vmlshape.cxx:503
OUString maControl2
Bezier control point 2.
Definition: vmlshape.hxx:209
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:1115
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:155
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:933
Reference< XComponentContext > getProcessComponentContext()
SimpleShape(Drawing &rDrawing, const OUString &rService)
Definition: vmlshape.cxx:570
PolyLineShape(Drawing &rDrawing)
Definition: vmlshape.cxx:1032
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:1513
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:1490
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:156
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:207
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:1290
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.
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:202
css::uno::Any SAL_CALL makeAny(const SharedUNOComponent< INTERFACE, COMPONENT > &value)