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>
59#include <oox/token/properties.hxx>
60#include <oox/token/tokens.hxx>
75using ::com::sun::star::beans::XPropertySet;
76using ::com::sun::star::uno::Any;
88using ::oox::core::XmlFilterBase;
92const sal_Int32 VML_SHAPETYPE_PICTUREFRAME = 75;
93const sal_Int32 VML_SHAPETYPE_HOSTCONTROL = 201;
95awt::Point lclGetAbsPoint(
const awt::Point& rRelPoint,
const awt::Rectangle& rShapeRect,
const awt::Rectangle& rCoordSys )
97 double fWidthRatio =
static_cast< double >( rShapeRect.Width ) / rCoordSys.Width;
98 double fHeightRatio =
static_cast< double >( rShapeRect.Height ) / rCoordSys.Height;
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 );
105awt::Rectangle lclGetAbsRect(
const awt::Rectangle& rRelRect,
const awt::Rectangle& rShapeRect,
const awt::Rectangle& rCoordSys )
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 );
118sal_Int32 lclConvertCrop(std::u16string_view rCrop, sal_uInt32 nSize)
123 sal_uInt32 nCrop =
o3tl::toUInt32(rCrop.substr(0, rCrop.size() - 1));
124 return (nCrop * nSize) / 65536;
133 mbAutoHeight( false ),
152 mrDrawing( rDrawing )
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 );
183 return pParentAnchor ?
205 SAL_WARN(
"oox",
"overflow in addition");
211 return awt::Rectangle(
227 return awt::Rectangle(
235 mnTextHAlign( XML_Left ),
236 mnTextVAlign( XML_Top ),
240 mnDropStyle( XML_Combo ),
247 mnSelType( XML_Single ),
249 mbPrintObject( true ),
254 mbMultiLine( false ),
256 mbSecretEdit( false )
261 : mbIsSignatureLine(false)
262 , mbSignatureLineShowSignDate(true)
263 , mbSignatureLineCanAddComment(false)
295 if (aType[ 0 ] ==
'#')
296 aType = aType.copy(1);
302 aMergedStrokeModel.
assignUsed(pShapeType->getTypeModel().maStrokeModel);
305 aMergedFillModel.
assignUsed(pShapeType->getTypeModel().maFillModel);
315 static constexpr OUStringLiteral sShapeTypePrefix =
u"shapetype_";
317 if (aType.startsWith(sShapeTypePrefix)) {
320 else if (aType.startsWith(
"_x0000_t", &tmp)) {
332 if( !aBaseName.isEmpty() )
336 return aBaseName + OUStringChar(
' ') + OUString::number( nShapeIdx );
354 Reference< XShape > xShape;
361 if( ((aShapeRect.Width > 0) || (aShapeRect.Height > 0)) && rxShapes.is() )
370 uno::Reference< lang::XServiceInfo > xSInfo( xShape, uno::UNO_QUERY_THROW );
374 sal_Int32 idPos = sLinkChainName.indexOf(
"_x");
378 sal_Int32 seqPos = sLinkChainName.indexOf(
"_s",idPos);
381 auto idPosEnd = idPos+2;
382 id =
o3tl::toInt32(sLinkChainName.subView(idPosEnd, seqPos - idPosEnd));
387 OUString s_mso_next_textbox;
390 if( s_mso_next_textbox.startsWith(
"#") )
391 s_mso_next_textbox = s_mso_next_textbox.copy(1);
393 if (xSInfo->supportsService(
"com.sun.star.text.TextFrame"))
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> >());
401 if( !s_mso_next_textbox.isEmpty() )
404 if( !sLinkChainName.isEmpty() )
415 sal_Int32 backColorTransparency = 0;
416 propertySet->getPropertyValue(
"BackColorTransparency")
417 >>= backColorTransparency;
418 if (propertySet->getPropertyValue(
"FillStyle") == FillStyle_NONE &&
419 backColorTransparency == 100)
422 propertySet->setPropertyValue(
"FillTransparence",
Any(sal_Int16(100)));
429 uno::Sequence<beans::PropertyValue> aGrabBag;
430 uno::Reference<beans::XPropertySet> propertySet (xShape, uno::UNO_QUERY);
431 propertySet->getPropertyValue(
"InteropGrabBag") >>= aGrabBag;
434 length = aGrabBag.getLength();
435 aGrabBag.realloc(
length+1 );
436 auto pGrabBag = aGrabBag.getArray();
437 pGrabBag[
length].Name =
"VML-Z-ORDER";
440 if( !s_mso_next_textbox.isEmpty() )
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;
449 if( !sLinkChainName.isEmpty() )
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;
463 propertySet->setPropertyValue(
"InteropGrabBag",
uno::Any(aGrabBag) );
466 Reference< XControlShape > xControlShape( xShape, uno::UNO_QUERY );
469 PropertySet aControlShapeProp( xControlShape->getControl() );
477 bool bGroupChild = pParentAnchor !=
nullptr;
482 SAL_WARN(
"oox",
"not converting shape, as calculated rectangle is empty");
497 if( (aShapeRect.Width > 0) || (aShapeRect.Height > 0) )
499 rxShape->setPosition( awt::Point( aShapeRect.X, aShapeRect.Y ) );
500 rxShape->setSize( awt::Size( aShapeRect.Width, aShapeRect.Height ) );
515 awt::Rectangle aShapeRect;
529 uno::Reference<lang::XServiceInfo> xSInfo(rxShape, uno::UNO_QUERY_THROW);
530 if (xSInfo->supportsService(
"com.sun.star.text.TextFrame"))
547 std::optional<sal_Int32> oLineWidth;
553 uno::Reference<beans::XPropertySet> xPropertySet(rxShape, uno::UNO_QUERY);
554 static const sal_Int32 aBorders[] = {
557 for (sal_Int32
nBorder : aBorders)
562 aBorderLine.LineWidth = *oLineWidth;
568 else if (xSInfo->supportsService(
"com.sun.star.drawing.CustomShape"))
576 maService(
std::move( aService ))
582 OUString aWrapType = rTypeModel.
moWrapType.value_or(
"");
586 if (nMarginTop < -35277)
589 css::text::WrapTextMode nSurround = css::text::WrapTextMode_THROUGH;
590 if ( aWrapType ==
"square" || aWrapType ==
"tight" ||
591 aWrapType ==
"through" )
593 nSurround = css::text::WrapTextMode_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;
601 else if ( aWrapType ==
"topAndBottom" )
602 nSurround = css::text::WrapTextMode_NONE;
604 rPropSet.
setProperty(PROP_Surround,
static_cast<sal_Int32
>(nSurround));
638 else if( rTypeModel.
maPosition ==
"relative" )
697 awt::Rectangle aShapeRect(rShapeRect);
698 std::optional<Degree100> oRotation;
699 bool bFlipX =
false, bFlipY =
false;
736 OUString aWrapDistanceLeft = OUString::number(0x0001BE7C);
741 OUString aWrapDistanceRight = OUString::number(0x0001BE7C);
746 sal_Int32 nWrapDistanceTop = 0;
750 sal_Int32 nWrapDistanceBottom = 0;
755 if (
maService ==
"com.sun.star.text.TextFrame" )
767 sal_Int16 nWritingMode = text::WritingMode2::LR_TB;
770 nWritingMode = text::WritingMode2::TB_RL;
774 nWritingMode = text::WritingMode2::BT_LR;
776 if (nWritingMode != text::WritingMode2::LR_TB)
815 drawing::TextVerticalAdjust eTextVerticalAdjust = drawing::TextVerticalAdjust_TOP;
817 eTextVerticalAdjust = drawing::TextVerticalAdjust_CENTER;
819 eTextVerticalAdjust = drawing::TextVerticalAdjust_BOTTOM;
838 awt::Size aSize = xShape->getSize();
843 xShape->setSize(aSize);
862 uno::Reference<lang::XServiceInfo> xServiceInfo(rxShapes, uno::UNO_QUERY);
863 if (!xServiceInfo->supportsService(
"com.sun.star.drawing.GroupShape"))
872 std::vector<css::beans::PropertyValue> aPropVec;
884 std::vector<drawing::EnhancedCustomShapeAdjustmentValue> aAdjustmentValues;
889 drawing::EnhancedCustomShapeAdjustmentValue aAdjustmentValue;
891 aAdjustmentValue.State = css::beans::PropertyState::PropertyState_DEFAULT_VALUE;
894 aAdjustmentValues.push_back(aAdjustmentValue);
897 css::beans::PropertyValue aProp;
898 aProp.Name =
"AdjustmentValues";
900 aPropVec.push_back(aProp);
903 if (!aPropVec.empty())
947 const awt::Rectangle& rShapeRect,
948 uno::Reference<graphic::XGraphic>
const & rxGraphic)
const
958 uno::Reference< lang::XServiceInfo > xServiceInfo(rxShapes, uno::UNO_QUERY);
960 if (
maTypeModel.
maPosition ==
"absolute" && !xServiceInfo->supportsService(
"com.sun.star.drawing.GroupShape"))
984 text::GraphicCrop aGraphicCrop;
1009 SimpleShape( rDrawing,
"com.sun.star.drawing.RectangleShape" )
1018 if(!aGraphicPath.isEmpty())
1024 if ( !sArcsize.isEmpty( ) )
1026 sal_Unicode cLastChar = sArcsize[sArcsize.getLength() - 1];
1029 double size = std::min( rShapeRect.Height, rShapeRect.Width ) / 2.0;
1030 sal_Int32 nRadius = 0;
1031 if ( cLastChar ==
'f' )
1033 else if ( cLastChar ==
'%' )
1041 SimpleShape( rDrawing,
"com.sun.star.drawing.EllipseShape" )
1046 SimpleShape( rDrawing,
"com.sun.star.drawing.PolyLineShape" )
1052 ::std::vector<awt::Point> aAbsPoints;
1057 aAbsPoints.push_back(lclGetAbsPoint(
point, rShapeRect, aCoordSys));
1060 if (aAbsPoints.size() > 2 && aAbsPoints.front().X == aAbsPoints.back().X
1061 && aAbsPoints.front().Y == aAbsPoints.back().Y)
1071 if (!aAbsPoints.empty())
1075 aPropSet.
setProperty( PROP_PolyPolygon, aPointSeq );
1085 Point aPoint2(aCenter);
1086 aPoint2.setY(aPoint2.getY() + 1);
1093 Point aPoint2(aCenter);
1094 aPoint2.setX(aPoint2.getX() + 1);
1098 void handleMirroring(
const ShapeTypeModel& rTypeModel,
const Reference<XShape>& rxShape)
1100 if (!rTypeModel.maFlip.isEmpty())
1104 if (rTypeModel.maFlip.startsWith(
"x"))
1106 if (rTypeModel.maFlip.endsWith(
"y"))
1112 void handleRotation(
const ShapeTypeModel& rTypeModel,
const Reference<XShape>& rxShape)
1114 if (!rTypeModel.maRotation.isEmpty())
1128 :
SimpleShape(rDrawing,
"com.sun.star.drawing.LineShape")
1147 awt::Rectangle aShapeRect;
1160 awt::Rectangle aShapeRect;
1172 :
SimpleShape(rDrawing,
"com.sun.star.drawing.OpenBezierShape")
1186 PolyPolygonBezierCoords aBezierCoords;
1188 if( (aCoordSys.Width > 0) && (aCoordSys.Height > 0) )
1193 typedef ::std::vector< ::std::vector< PolygonFlags > > FlagsList;
1194 std::vector< ::std::vector< awt::Point > > aCoordLists;
1195 FlagsList aFlagLists;
1200 aCoordLists.emplace_back( );
1201 aFlagLists.emplace_back( );
1205 aCoordLists[ 0 ].emplace_back(
1209 aCoordLists[ 0 ].emplace_back(
1213 aCoordLists[ 0 ].emplace_back(
1217 aCoordLists[ 0 ].emplace_back(
1222 aFlagLists[ 0 ].resize( aCoordLists[ 0 ].
size(), PolygonFlags_CONTROL );
1223 aFlagLists[ 0 ][ 0 ] = PolygonFlags_NORMAL;
1224 aFlagLists[ 0 ].back() = PolygonFlags_NORMAL;
1232 for (
auto & coordList : aCoordLists)
1233 for (
auto &
point : coordList)
1235 point = lclGetAbsPoint(
point, rShapeRect, aCoordSys );
1239 aBezierCoords.Coordinates.realloc( aCoordLists.size() );
1240 auto pCoordinates = aBezierCoords.Coordinates.getArray();
1241 for (
size_t i = 0;
i < aCoordLists.size();
i++ )
1244 aBezierCoords.Flags.realloc( aFlagLists.size() );
1245 auto pFlags = aBezierCoords.Flags.getArray();
1246 for (
size_t i = 0;
i < aFlagLists.size();
i++ )
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 )
1260 if( aBezierCoords.Coordinates.hasElements())
1263 aPropSet.
setProperty( PROP_PolyPolygonBezier, aBezierCoords );
1277 SimpleShape( rDrawing,
"com.sun.star.drawing.CustomShape" )
1285 if( xShape.is() )
try
1288 Reference< XEnhancedCustomShapeDefaulter > xDefaulter( xShape, UNO_QUERY_THROW );
1289 xDefaulter->createCustomShapeDefaults( OUString::number(
getShapeType() ) );
1314 nShapeType != VML_SHAPETYPE_PICTUREFRAME,
"oox",
1315 "ComplexShape::implConvertAndInsert - unexpected shape type");
1318 if( pOleObjectInfo->mbDmlShape )
1319 return Reference< XShape >();
1322 awt::Size aOleSize( rShapeRect.Width, rShapeRect.Height );
1323 if( rFilter.getOleObjectHelper().importOleObject( aOleProps, *pOleObjectInfo, aOleSize ) )
1329 if( !aGraphicPath.isEmpty() )
1333 aExtHeader.
xExt = rShapeRect.Width;
1334 aExtHeader.
yExt = rShapeRect.Height;
1336 Reference< XGraphic > xGraphic = rFilter.getGraphicHelper().importEmbeddedGraphic(aGraphicPath, &aExtHeader);
1353 if( !pControlInfo->
maName.isEmpty() )
1357 if( rFilter.importFragment( new ::oox::ole::AxControlFragment( rFilter, pControlInfo->
maFragmentPath, aControl ) ) )
1360 sal_Int32 nCtrlIndex = -1;
1376 if( (nShapeType == VML_SHAPETYPE_HOSTCONTROL) && !pControlInfo )
1378 OSL_ENSURE(
getClientData(),
"ComplexShape::implConvertAndInsert - missing client data" );
1387 uno::Reference<graphic::XGraphic> xGraphic;
1388 bool bIsSigned(
false);
1392 Reference<security::XDocumentDigitalSignatures> xSignatures(
1393 security::DocumentDigitalSignatures::createDefault(
1396 uno::Reference<embed::XStorage> xStorage
1399 embed::ElementModes::READ);
1400 SAL_WARN_IF(!xStorage.is(),
"oox.vml",
"No xStorage!");
1402 const uno::Sequence<security::DocumentSignatureInformation> xSignatureInfo
1403 = xSignatures->verifyScriptingContentSignatures(xStorage,
1404 uno::Reference<io::XInputStream>());
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())
1414 if (pSignInfo->SignatureIsValid)
1417 SAL_WARN_IF(!pSignInfo->ValidSignatureLineImage.is(),
"oox.vml",
1418 "No ValidSignatureLineImage!");
1419 xGraphic = pSignInfo->ValidSignatureLineImage;
1424 SAL_WARN_IF(!pSignInfo->InvalidSignatureLineImage.is(),
"oox.vml",
1425 "No InvalidSignatureLineImage!");
1426 xGraphic = pSignInfo->InvalidSignatureLineImage;
1430 catch (css::uno::Exception&)
1436 Reference< XShape > xShape;
1449 uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY);
1450 xPropertySet->setPropertyValue(
"IsSignatureLine",
uno::Any(
true));
1451 xPropertySet->setPropertyValue(
"SignatureLineId",
1453 xPropertySet->setPropertyValue(
1454 "SignatureLineSuggestedSignerName",
1456 xPropertySet->setPropertyValue(
1457 "SignatureLineSuggestedSignerTitle",
1459 xPropertySet->setPropertyValue(
1460 "SignatureLineSuggestedSignerEmail",
1462 xPropertySet->setPropertyValue(
1463 "SignatureLineSigningInstructions",
1465 xPropertySet->setPropertyValue(
1466 "SignatureLineShowSignDate",
1468 xPropertySet->setPropertyValue(
1469 "SignatureLineCanAddComment",
1471 xPropertySet->setPropertyValue(
"SignatureLineIsSigned",
uno::Any(bIsSigned));
1473 if (!aGraphicPath.isEmpty())
1475 xGraphic = rFilter.getGraphicHelper().importEmbeddedGraphic(aGraphicPath);
1476 xPropertySet->setPropertyValue(
"SignatureLineUnsignedImage",
uno::Any(xGraphic));
1482 if( !aGraphicPath.isEmpty() )
1524 return mxChildren->getShapeTypeById( rShapeId );
1534 Reference< XShape > xGroupShape;
1542 Reference< XShapes > xChildShapes( xGroupShape, UNO_QUERY_THROW );
1543 mxChildren->convertAndInsert( xChildShapes, &aParentAnchor );
1544 if( !xChildShapes->hasElements() )
1546 SAL_WARN(
"oox",
"no child shape has been created - deleting the group shape");
1547 rxShapes->remove( xGroupShape );
1548 xGroupShape.clear();
1555 uno::Reference<beans::XPropertySet> xPropertySet;
1557 xPropertySet = uno::Reference<beans::XPropertySet>(xGroupShape, uno::UNO_QUERY);
1558 if (xPropertySet.is())
1560 uno::Sequence<beans::PropertyValue> aGrabBag;
1561 xPropertySet->getPropertyValue(
"InteropGrabBag") >>= aGrabBag;
1562 sal_Int32
nLength = aGrabBag.getLength();
1563 aGrabBag.realloc(
nLength + 1);
1565 xPropertySet->setPropertyValue(
"InteropGrabBag",
uno::Any(aGrabBag));
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.
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.
A wrapper for a UNO property set.
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.
bool hasProperty(sal_Int32 nPropId) const
Returns true, if the specified property is supported by the property set.
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.
css::uno::Reference< css::io::XInputStream > openInputStream(const OUString &rStreamName) const
Opens and returns the specified input stream from the base storage.
GraphicHelper & getGraphicHelper() const
Returns a helper for the handling of graphics and graphic objects.
ModelObjectHelper & getModelObjectHelper() const
Returns a helper with containers for various named drawing objects for the imported document.
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.
Bezier shape object that supports to, from, control1 and control2 attribute or path attribute specifi...
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.
BezierShape(Drawing &rDrawing)
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.
ComplexShape(Drawing &rDrawing)
A shape object with custom geometry.
CustomShape(Drawing &rDrawing)
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.
Represents the collection of VML shapes for a complete draw page.
const ControlInfo * getControlInfo(const OUString &rShapeId) const
Returns the registered info structure for a form control, if extant.
ShapeContainer & getShapes()
Returns read/write access to the container of shapes and templates.
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...
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.
::oox::core::XmlFilterBase & getFilter() const
Returns the filter object that imports/exports this VML drawing.
sal_Int32 getLocalShapeIndex(std::u16string_view rShapeId) const
Returns the local shape index from the passed global shape identifier.
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.
virtual bool isShapeSupported(const ShapeBase &rShape) const
Derived classes may disable conversion of specific shapes.
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.
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,...
const OleObjectInfo * getOleObjectInfo(const OUString &rShapeId) const
Returns the registered info structure for an OLE object, if extant.
virtual OUString getShapeBaseName(const ShapeBase &rShape) const
Derived classes may return additional base names for automatic shape name creation.
EllipseShape(Drawing &rDrawing)
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.
virtual const ShapeType * getChildTypeById(const OUString &rShapeId) const override
Returns the shape template with the passed identifier from the child shapes.
virtual void finalizeFragmentImport() override
Final processing after import of the drawing fragment.
virtual ~GroupShape() override
std::unique_ptr< ShapeContainer > mxChildren
Shapes and templates that are part of this group.
virtual const ShapeBase * getChildById(const OUString &rShapeId) const override
Returns the shape with the passed identifier from the child shapes.
GroupShape(Drawing &rDrawing)
LineShape(Drawing &rDrawing)
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.
virtual css::awt::Rectangle getRelRectangle() const override
Returns the rectangle relative to the parent coordinate system.
virtual css::awt::Rectangle getAbsRectangle() const override
Returns the absolute shape rectangle.
PolyLineShape(Drawing &rDrawing)
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.
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.
RectangleShape(Drawing &rDrawing)
A shape object that is part of a drawing.
void setContainer(ShapeContainer *pContainer)
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.
const TextBox * getTextBox() const
Returns read access to the shape textbox.
virtual const ShapeType * getChildTypeById(const OUString &rShapeId) const
Returns the shape template with the passed identifier from the child shapes.
OUString getShapeName() const
Returns the real shape name if existing, or a generated shape name.
css::awt::Rectangle calcShapeRectangle(const ShapeParentAnchor *pParentAnchor) const
Calculates the final shape rectangle according to the passed anchor, if present, otherwise according ...
void convertShapeProperties(const css::uno::Reference< css::drawing::XShape > &rxShape) const
Converts common shape properties such as formatting attributes.
ShapeContainer * getContainer() const
const ClientData * getClientData() const
Returns read access to the shape client data structure.
virtual void finalizeFragmentImport()
Final processing after import of the drawing fragment.
ShapeContainer * mpContainer
ShapeBase(Drawing &rDrawing)
void convertFormatting(const css::uno::Reference< css::drawing::XShape > &rxShape) const
Converts position and formatting into the passed existing XShape.
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.
ShapeModel & getShapeModel()
Returns read/write access to the shape model structure.
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.
virtual const ShapeBase * getChildById(const OUString &rShapeId) const
Returns the shape with the passed identifier from the child shapes.
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 ...
css::awt::Rectangle getCoordSystem() const
Returns the coordinate system of this shape.
ShapeTypeModel maTypeModel
The model structure containing shape type data.
virtual css::awt::Rectangle getRelRectangle() const
Returns the rectangle relative to the parent coordinate system.
const OUString & getShapeId() const
Returns the shape identifier (which is unique through the containing drawing).
Drawing & mrDrawing
The VML drawing page that contains this shape.
ShapeType(Drawing &rDrawing)
css::awt::Rectangle getRectangle(const ShapeParentAnchor *pParentAnchor) const
Returns the absolute shape rectangle according to the passed anchor.
sal_Int32 getShapeType() const
Returns the application defined shape type.
OUString getGraphicPath() const
Returns the fragment path to the embedded graphic used by this shape.
ShapeTypeModel & getTypeModel()
Returns read/write access to the shape template model structure.
virtual css::awt::Rectangle getAbsRectangle() const
Returns the absolute shape rectangle.
A simple shape object based on a specific UNO shape service.
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.
SimpleShape(Drawing &rDrawing, OUString aService)
void setService(const OUString &aService)
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.
OUString maService
Name of the UNO shape service.
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.
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
The textbox contains all text contents and properties.
void convert(const css::uno::Reference< css::drawing::XShape > &xShape) const
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
tools::Long const nBorder
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
::std::pair< sal_Int32, sal_Int32 > Int32Pair
const sal_Int32 VML_CLIENTDATA_UNCHECKED
static void lcl_setSurround(PropertySet &rPropSet, const ShapeTypeModel &rTypeModel, const GraphicHelper &rGraphicHelper)
static void lcl_SetAnchorType(PropertySet &rPropSet, const ShapeTypeModel &rTypeModel, const GraphicHelper &rGraphicHelper)
void assignIfUsed(std::optional< Type > &rDestValue, const std::optional< Type > &rSourceValue)
SdrOnOffItem makeSdrTextAutoGrowHeightItem(bool bAuto)
SdrOnOffItem makeSdrTextAutoGrowWidthItem(bool bAuto)
constexpr OUStringLiteral ZIP_STORAGE_FORMAT_STRING
UNDERLYING_TYPE get() const
Excel specific shape client data (such as cell anchor).
OUString maAnchor
Cell anchor as comma-separated string.
Contains information about a form control embedded in a draw page.
OUString maName
Programmatical name of the form control.
bool mbTextContentShape
Whether this control shape will be imported to Writer or not (has AnchorType property or not).
OUString maFragmentPath
Path to the fragment describing the form control properties.
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.
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.
std::unique_ptr< ClientData > mxClientData
Excel specific client data.
OUString maLegacyDiagramPath
Legacy Diagram Fragment Path.
PointVector maPoints
Points for the polyline shape.
OUString maHyperlink
The hyperlink assigned to the shape.
OUString maControl2
Bezier control point 2.
OUString maVmlPath
VML path for this shape.
std::unique_ptr< TextBox > mxTextBox
Text contents and properties.
OUString maType
Shape template with default properties.
ClientData & createClientData()
Creates and returns a new shape client data structure.
OUString maControl1
Bezier control point 1.
OUString maTo
End point for line shape.
OUString maFrom
Start point for line shape.
css::awt::Rectangle maShapeRect
css::awt::Rectangle maCoordSys
The shape model structure contains all properties shared by all types of shapes.
void assignUsed(const ShapeTypeModel &rSource)
OUString maHeightPercent
The height in percents of the HeightRelative.
OUString maWrapDistanceTop
Distance from the top of the shape to the text that wraps around it.
OUString maPosition
Position type of the shape.
OUString maShapeName
Name of the shape, if present.
OUString maFlip
Flip type of the shape (can be "x" or "y").
ShadowModel maShadowModel
Shape shadow formatting.
OUString maPositionVertical
The Y position orientation.
std::optional< Int32Pair > moCoordPos
Top-left position of coordinate system for children scaling.
OUString maHeightRelative
To what the height is relative.
std::optional< Int32Pair > moCoordSize
Size of coordinate system for children scaling.
FillModel maFillModel
Shape fill formatting.
OUString maTop
Y position of the shape bounding box (number with unit).
std::optional< OUString > moGraphicTitle
Title of the graphic.
OUString maWrapDistanceRight
Distance from the right side of the shape to the text that wraps around it.
OUString maEditAs
Edit As type (e.g. "canvas" etc)
OUString maWrapStyle
Wrapping mode for text.
std::optional< OUString > moGraphicPath
Path to a graphic for this shape.
std::optional< OUString > moCropLeft
Specifies how much to crop the image from the left in as a fraction of picture size.
std::optional< OUString > moCropTop
Specifies how much to crop the image from the top down as a fraction of picture size.
std::optional< OUString > moCropRight
Specifies how much to crop the image from the right in as a fraction of picture size.
OUString maRotation
Rotation of the shape, in degrees.
OUString maHeight
Height of the shape bounding box (number with unit).
OUString maAdjustments
Shape adjustment values.
sal_Int16 mnBlacklevel
The image brightness, on a 0..0x10000 scale.
bool mbAutoHeight
If true, the height value is a minimum value (mostly used for textboxes)
std::optional< OUString > moWrapType
How to wrap the text around the object.
OUString maShapeId
Unique identifier of the shape.
OUString maWidthPercent
The width in percents of the WidthRelative.
StrokeModel maStrokeModel
Border line formatting.
OUString maPositionVerticalRelative
The Y position is relative to this.
OUString maWidth
Width of the shape bounding box (number with unit).
OUString maLeft
X position of the shape bounding box (number with unit).
OUString maMarginTop
Y position of the shape bounding box to shape anchor (number with unit).
std::optional< OUString > moWrapSide
On which side to wrap the text around the object.
OUString maPositionHorizontalRelative
The X position is relative to this.
OUString maArcsize
round rectangles arc size
OUString maZIndex
ZIndex of the shape.
std::optional< OUString > moCropBottom
Specifies the how much to crop the image from the bottom up as a fraction of picture size.
OUString maWidthRelative
To what the width is relative.
OUString maVTextAnchor
How the text inside the shape is anchored vertically.
OUString maLegacyId
Plaintext identifier of the shape.
OUString maPositionHorizontal
The X position orientation (default: absolute).
OUString maLayoutFlowAlt
Specifies the alternate layout flow for text in textboxes.
OUString maWrapDistanceBottom
Distance from the bottom of the shape to the text that wraps around it.
std::optional< sal_Int32 > moShapeType
Builtin shape type identifier.
OUString maMarginLeft
X position of the shape bounding box to shape anchor (number with unit).
OUString maWrapDistanceLeft
Distance from the left side of the shape to the text that wraps around it.
TextpathModel maTextpathModel
Shape textpath formatting.
sal_Int32 mnGain
An adjustment for the intensity of all colors, i.e. contrast, on a 0..0x10000 scale.
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.
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