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