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