27#include <oox/token/namespaces.hxx>
28#include <oox/token/tokens.hxx>
31#include <com/sun/star/beans/PropertyAttribute.hpp>
32#include <com/sun/star/beans/XPropertySet.hpp>
33#include <com/sun/star/beans/XPropertySetInfo.hpp>
34#include <com/sun/star/beans/XPropertyState.hpp>
35#include <com/sun/star/container/XEnumerationAccess.hpp>
36#include <com/sun/star/drawing/FillStyle.hpp>
37#include <com/sun/star/drawing/HomogenMatrix3.hpp>
38#include <com/sun/star/drawing/LineStyle.hpp>
39#include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
40#include <com/sun/star/geometry/IntegerRectangle2D.hpp>
41#include <com/sun/star/lang/XServiceInfo.hpp>
42#include <com/sun/star/text/XText.hpp>
43#include <com/sun/star/text/XTextCursor.hpp>
44#include <com/sun/star/text/WritingMode.hpp>
45#include <com/sun/star/text/WritingMode2.hpp>
53bool lcl_getTextPropsFromFrameText(
const uno::Reference<text::XText>& xText,
54 std::vector<beans::PropertyValue>& rTextPropVec)
58 uno::Reference<text::XTextCursor> xTextCursor = xText->createTextCursor();
59 xTextCursor->gotoStart(
false);
60 xTextCursor->gotoEnd(
true);
61 uno::Reference<container::XEnumerationAccess> paraEnumAccess(xText, uno::UNO_QUERY);
62 if (!paraEnumAccess.is())
64 uno::Reference<container::XEnumeration> paraEnum(paraEnumAccess->createEnumeration());
65 while (paraEnum->hasMoreElements())
67 uno::Reference<text::XTextRange> xParagraph(paraEnum->nextElement(), uno::UNO_QUERY);
68 uno::Reference<container::XEnumerationAccess> runEnumAccess(xParagraph, uno::UNO_QUERY);
69 if (!runEnumAccess.is())
71 uno::Reference<container::XEnumeration> runEnum = runEnumAccess->createEnumeration();
72 while (runEnum->hasMoreElements())
74 uno::Reference<text::XTextRange> xRun(runEnum->nextElement(), uno::UNO_QUERY);
75 if (xRun->getString().isEmpty())
77 uno::Reference<beans::XPropertySet> xRunPropSet(xRun, uno::UNO_QUERY);
78 if (!xRunPropSet.is())
80 auto xRunPropSetInfo = xRunPropSet->getPropertySetInfo();
81 if (!xRunPropSetInfo.is())
85 auto aRunPropInfoSequence = xRunPropSetInfo->getProperties();
86 for (
const beans::Property& aProp : aRunPropInfoSequence)
89 aProp.Name, xRunPropSet->getPropertyValue(aProp.Name)));
101bool lcl_getAttributeAsString(
const uno::Sequence<beans::PropertyValue>& aPropertyValueAsSeq,
102 const OUString& rName, OUString& rValue)
105 uno::Sequence<beans::PropertyValue> aAttributesSeq;
106 if (!((aPropertyValueAsMap.getValue(
"attributes") >>= aAttributesSeq)
107 && aAttributesSeq.hasElements()))
111 if (!(aAttributesMap.getValue(rName) >>= sRet))
118bool lcl_getAttributeAsNumber(
const uno::Sequence<beans::PropertyValue>& rPropertyValueAsSeq,
119 const OUString& rName, sal_Int32& rValue)
122 uno::Sequence<beans::PropertyValue> aAttributesSeq;
123 if (!((aPropertyValueAsMap.getValue(
"attributes") >>= aAttributesSeq)
124 && aAttributesSeq.hasElements()))
128 if (!(aAttributesMap.getValue(rName) >>= nRet))
134void lcl_getColorTransformationsFromPropSeq(
const uno::Sequence<beans::PropertyValue>& rPropSeq,
137 auto isValidPropName = [](
const OUString& rName) ->
bool {
138 return rName ==
u"tint" || rName ==
u"shade" || rName ==
u"alpha" || rName ==
u"hueMod"
139 || rName ==
u"sat" || rName ==
u"satOff" || rName ==
u"satMod" || rName ==
u"lum"
140 || rName ==
u"lumOff" || rName ==
u"lumMod";
142 for (
auto it = rPropSeq.begin(); it < rPropSeq.end(); ++it)
144 if (isValidPropName((*it).Name))
146 uno::Sequence<beans::PropertyValue> aValueSeq;
147 sal_Int32 nNumber(0);
148 if (((*it).Value >>= aValueSeq) && lcl_getAttributeAsNumber(aValueSeq, u
"val", nNumber))
151 if ((*it).Name == u
"alpha")
164bool lcl_getColorFromPropSeq(
const uno::Sequence<beans::PropertyValue>& rPropSeq,
167 bool bColorFound =
false;
169 uno::Sequence<beans::PropertyValue> aColorDetailSeq;
170 if (aPropMap.getValue(u
"schemeClr") >>= aColorDetailSeq)
172 OUString sColorString;
173 bColorFound = lcl_getAttributeAsString(aColorDetailSeq, u
"val", sColorString);
181 if (!bColorFound && (aPropMap.getValue(u
"srgbClr") >>= aColorDetailSeq))
183 OUString sColorString;
184 bColorFound = lcl_getAttributeAsString(aColorDetailSeq, u
"val", sColorString);
193 lcl_getColorTransformationsFromPropSeq(aColorDetailSeq, rColor);
197void lcl_getFillDetailsFromPropSeq(
const uno::Sequence<beans::PropertyValue>& rTextFillSeq,
202 if (!rTextFillSeq.hasElements())
205 if (aTextFillMap.find(u
"noFill") != aTextFillMap.end())
211 uno::Sequence<beans::PropertyValue> aPropSeq;
212 if ((aTextFillMap.getValue(u
"solidFill") >>= aPropSeq) && aPropSeq.hasElements())
214 rFillProperties.
moFillType = oox::XML_solidFill;
215 lcl_getColorFromPropSeq(aPropSeq, rFillProperties.
maFillColor);
219 if ((aTextFillMap.getValue(u
"gradFill") >>= aPropSeq) && aPropSeq.hasElements())
221 rFillProperties.
moFillType = oox::XML_gradFill;
226 uno::Sequence<beans::PropertyValue> aGsLstSeq;
227 if (aPropMap.getValue(
"gsLst") >>= aGsLstSeq)
229 for (
auto it = aGsLstSeq.begin(); it < aGsLstSeq.end(); ++it)
232 uno::Sequence<beans::PropertyValue> aColorStopSeq;
233 if ((*it).Value >>= aColorStopSeq)
238 if (lcl_getAttributeAsNumber(aColorStopSeq, u
"pos", nPos)
239 && lcl_getColorFromPropSeq(aColorStopSeq, aColor))
242 double fPos =
nPos / 100000.0;
249 uno::Sequence<beans::PropertyValue> aKindSeq;
250 if (aPropMap.getValue(
"lin") >>= aKindSeq)
254 if (lcl_getAttributeAsNumber(aKindSeq,
"ang", nAngle))
256 OUString sScaledString;
257 if (lcl_getAttributeAsString(aKindSeq,
"scaled", sScaledString))
259 = sScaledString ==
u"1" || sScaledString ==
u"true";
262 if (aPropMap.getValue(
"path") >>= aKindSeq)
268 if (lcl_getAttributeAsString(aKindSeq,
"path", sKind))
272 uno::Sequence<beans::PropertyValue> aFillToRectSeq;
273 if (aKindMap.getValue(
"fillToRect") >>= aFillToRectSeq)
278 geometry::IntegerRectangle2D aRect;
279 if (!lcl_getAttributeAsNumber(aFillToRectSeq, u
"l", aRect.X1))
281 if (!lcl_getAttributeAsNumber(aFillToRectSeq, u
"t", aRect.Y1))
283 if (!lcl_getAttributeAsNumber(aFillToRectSeq, u
"r", aRect.X2))
285 if (!lcl_getAttributeAsNumber(aFillToRectSeq, u
"b", aRect.Y2))
294void lcl_getLineDetailsFromPropSeq(
const uno::Sequence<beans::PropertyValue>& rTextOutlineSeq,
297 if (!rTextOutlineSeq.hasElements())
306 lcl_getFillDetailsFromPropSeq(rTextOutlineSeq, rLineProperties.
maLineFill);
310 if (aTextOutlineMap.find(u
"bevel") != aTextOutlineMap.end())
312 else if (aTextOutlineMap.find(u
"round") != aTextOutlineMap.end())
314 else if (aTextOutlineMap.find(u
"miter") != aTextOutlineMap.end())
318 sal_Int32 nMiterLimit = aTextOutlineMap.getUnpackedValueOrDefault(
"lim", sal_Int32(0));
319 if (nMiterLimit == 0)
326 uno::Sequence<beans::PropertyValue> aDashSeq;
327 if (aTextOutlineMap.getValue(u
"prstDash") >>= aDashSeq)
331 if (lcl_getAttributeAsString(aDashSeq, u
"val", sDashKind))
335 if (lcl_getAttributeAsString(rTextOutlineSeq, u
"cap", sCapKind))
340 if (lcl_getAttributeAsNumber(rTextOutlineSeq, u
"w", nWidth))
344 OUString sCompoundKind;
345 if (lcl_getAttributeAsString(rTextOutlineSeq, u
"cmpd", sCompoundKind))
360 uno::Sequence<beans::PropertyValue> aCharInteropGrabBagSeq;
361 if (!(aTextPropMap.
getValue(u
"CharInteropGrabBag") >>= aCharInteropGrabBagSeq))
362 return aLineProperties;
363 if (!aCharInteropGrabBagSeq.hasElements())
364 return aLineProperties;
366 beans::PropertyValue aProp;
367 if (!(aCharInteropGrabBagMap.getValue(u
"CharTextOutlineTextEffect") >>= aProp))
368 return aLineProperties;
369 uno::Sequence<beans::PropertyValue> aTextOutlineSeq;
370 if (!(aProp.Name ==
"textOutline" && (aProp.Value >>= aTextOutlineSeq)
371 && aTextOutlineSeq.hasElements()))
372 return aLineProperties;
375 lcl_getLineDetailsFromPropSeq(aTextOutlineSeq, aLineProperties);
376 return aLineProperties;
383 aFillProperties.
moFillType = oox::XML_solidFill;
386 uno::Sequence<beans::PropertyValue> aCharInteropGrabBagSeq;
387 if ((rTextPropMap.
getValue(u
"CharInteropGrabBag") >>= aCharInteropGrabBagSeq)
388 && aCharInteropGrabBagSeq.hasElements())
392 beans::PropertyValue aProp;
393 if (aCharInteropGrabBagMap.getValue(u
"CharTextFillTextEffect") >>= aProp)
395 uno::Sequence<beans::PropertyValue> aTextFillSeq;
396 if (aProp.Name ==
"textFill" && (aProp.Value >>= aTextFillSeq)
397 && aTextFillSeq.hasElements())
400 lcl_getFillDetailsFromPropSeq(aTextFillSeq, aFillProperties);
401 return aFillProperties;
406 bool bColorFound(
false);
407 OUString sColorString;
408 if (aCharInteropGrabBagMap.getValue(
"CharThemeOriginalColor") >>= sColorString)
414 if (aCharInteropGrabBagMap.getValue(
"CharThemeColor") >>= sColorString)
421 OUString sTransformString;
422 if (aCharInteropGrabBagMap.getValue(
"CharThemeColorTint") >>= sTransformString)
427 static_cast<sal_Int32
>(fTint + 0.5));
430 static_cast<sal_Int32
>(fOff + 0.5));
432 else if (aCharInteropGrabBagMap.getValue(
"CharThemeColorShade") >>= sTransformString)
437 static_cast<sal_Int32
>(fShade + 0.5));
441 return aFillProperties;
445 sal_Int32 aCharColor = 0;
446 if (rTextPropMap.
getValue(u
"CharColor") >>= aCharColor)
450 return aFillProperties;
453void lcl_applyShapePropsToShape(
const uno::Reference<beans::XPropertySet>& xShapePropertySet,
458 xShapePropertySet->setPropertyValue(rProp.Name, rProp.Value);
462void lcl_setTextAnchorFromTextProps(
const uno::Reference<beans::XPropertySet>& xShapePropertySet,
466 auto eHorzAdjust(drawing::TextHorizontalAdjust_CENTER);
467 sal_Int16 nParaAlign = sal_Int16(drawing::TextHorizontalAdjust_CENTER);
468 aTextPropMap.
getValue(
"ParaAdjust") >>= nParaAlign;
471 case sal_Int16(style::ParagraphAdjust_LEFT):
472 eHorzAdjust = drawing::TextHorizontalAdjust_LEFT;
474 case sal_Int16(style::ParagraphAdjust_RIGHT):
475 eHorzAdjust = drawing::TextHorizontalAdjust_RIGHT;
478 eHorzAdjust = drawing::TextHorizontalAdjust_CENTER;
480 xShapePropertySet->setPropertyValue(
"TextHorizontalAdjust",
uno::Any(eHorzAdjust));
481 xShapePropertySet->setPropertyValue(
"TextVerticalAdjust",
482 uno::Any(drawing::TextVerticalAdjust_TOP));
485void lcl_setTextPropsToShape(
const uno::Reference<beans::XPropertySet>& xShapePropertySet,
486 std::vector<beans::PropertyValue>& aTextPropVec)
488 auto xShapePropertySetInfo = xShapePropertySet->getPropertySetInfo();
489 if (!xShapePropertySetInfo.is())
491 for (
size_t i = 0;
i < aTextPropVec.size(); ++
i)
493 if (xShapePropertySetInfo->hasPropertyByName(aTextPropVec[
i].Name)
494 && !(xShapePropertySetInfo->getPropertyByName(aTextPropVec[
i].Name).Attributes
495 & beans::PropertyAttribute::READONLY)
496 && aTextPropVec[
i].Name != u
"CharInteropGrabBag")
498 xShapePropertySet->setPropertyValue(aTextPropVec[
i].Name, aTextPropVec[
i].Value);
503void lcl_applyUsedTextPropsToAllTextRuns(uno::Reference<text::XText>& xText,
504 const std::vector<beans::PropertyValue>& aTextPropVec)
508 uno::Reference<text::XTextCursor> xTextCursor = xText->createTextCursor();
509 xTextCursor->gotoStart(
false);
510 xTextCursor->gotoEnd(
true);
511 uno::Reference<container::XEnumerationAccess> paraEnumAccess(xText, uno::UNO_QUERY);
512 if (!paraEnumAccess.is())
514 uno::Reference<container::XEnumeration> paraEnum(paraEnumAccess->createEnumeration());
515 while (paraEnum->hasMoreElements())
517 uno::Reference<text::XTextRange> xParagraph(paraEnum->nextElement(), uno::UNO_QUERY);
518 uno::Reference<container::XEnumerationAccess> runEnumAccess(xParagraph, uno::UNO_QUERY);
519 if (!runEnumAccess.is())
521 uno::Reference<container::XEnumeration> runEnum = runEnumAccess->createEnumeration();
522 while (runEnum->hasMoreElements())
524 uno::Reference<text::XTextRange> xRun(runEnum->nextElement(), uno::UNO_QUERY);
525 if (xRun->getString().isEmpty())
527 uno::Reference<beans::XPropertySet> xRunPropSet(xRun, uno::UNO_QUERY);
528 if (!xRunPropSet.is())
530 auto xRunPropSetInfo = xRunPropSet->getPropertySetInfo();
531 if (!xRunPropSetInfo.is())
534 for (
size_t i = 0;
i < aTextPropVec.size(); ++
i)
536 if (xRunPropSetInfo->hasPropertyByName(aTextPropVec[
i].Name)
537 && !(xRunPropSetInfo->getPropertyByName(aTextPropVec[
i].Name).Attributes
538 & beans::PropertyAttribute::READONLY))
539 xRunPropSet->setPropertyValue(aTextPropVec[
i].Name, aTextPropVec[
i].Value);
557 if (
const auto pParent =
dynamic_cast<const WpgContext*
>(&rParent))
568 switch (getBaseToken(nElementToken))
578 uno::Reference<lang::XServiceInfo> xServiceInfo(
mxShape, uno::UNO_QUERY);
579 uno::Reference<beans::XPropertySet> xPropertySet(
mxShape, uno::UNO_QUERY);
580 sal_Int32 nVert = rAttribs.
getToken(XML_vert, XML_horz);
583 if (nVert == XML_eaVert || nVert == XML_wordArtVertRtl)
585 xPropertySet->setPropertyValue(
"TextWritingMode",
587 xPropertySet->setPropertyValue(
"WritingMode",
588 uno::Any(text::WritingMode2::TB_RL));
590 else if (nVert == XML_mongolianVert || nVert == XML_wordArtVert)
592 xPropertySet->setPropertyValue(
"WritingMode",
593 uno::Any(text::WritingMode2::TB_LR));
595 else if (nVert != XML_horz)
602 drawing::HomogenMatrix3 aMatrix;
603 xPropertySet->getPropertyValue(
"Transformation") >>= aMatrix;
605 aTransformation.
set(0, 0, aMatrix.Line1.Column1);
606 aTransformation.
set(0, 1, aMatrix.Line1.Column2);
607 aTransformation.
set(0, 2, aMatrix.Line1.Column3);
608 aTransformation.
set(1, 0, aMatrix.Line2.Column1);
609 aTransformation.
set(1, 1, aMatrix.Line2.Column2);
610 aTransformation.
set(1, 2, aMatrix.Line2.Column3);
611 aTransformation.
set(2, 0, aMatrix.Line3.Column1);
612 aTransformation.
set(2, 1, aMatrix.Line3.Column2);
613 aTransformation.
set(2, 2, aMatrix.Line3.Column3);
618 aTransformation.
decompose(aScale, aTranslate, fRotate, fShearX);
620 if ((nVert == XML_vert && nRotate == 270)
621 || (nVert == XML_vert270 && nRotate == 90))
623 xPropertySet->setPropertyValue(
"WritingMode",
624 uno::Any(text::WritingMode2::LR_TB));
627 else if (nVert == XML_vert)
628 xPropertySet->setPropertyValue(
"WritingMode",
629 uno::Any(text::WritingMode2::TB_RL90));
631 xPropertySet->setPropertyValue(
"WritingMode",
632 uno::Any(text::WritingMode2::BT_LR));
635 if (
bool bUpright = rAttribs.
getBool(XML_upright,
false))
637 uno::Sequence<beans::PropertyValue> aGrabBag;
638 xPropertySet->getPropertyValue(
"InteropGrabBag") >>= aGrabBag;
639 sal_Int32
length = aGrabBag.getLength();
640 aGrabBag.realloc(
length + 1);
641 auto pGrabBag = aGrabBag.getArray();
642 pGrabBag[
length].Name =
"Upright";
643 pGrabBag[
length].Value <<= bUpright;
644 xPropertySet->setPropertyValue(
"InteropGrabBag",
uno::Any(aGrabBag));
647 if (xServiceInfo.is())
650 sal_Int32 aInsets[] = { XML_lIns, XML_tIns, XML_rIns, XML_bIns };
651 std::optional<sal_Int32> oInsets[4];
654 std::optional<OUString> oValue = rAttribs.
getString(aInsets[
i]);
655 if (oValue.has_value())
660 = (aInsets[
i] == XML_lIns || aInsets[
i] == XML_rIns) ? 254 : 127;
662 const OUString aShapeProps[]
663 = { OUString(
"TextLeftDistance"), OUString(
"TextUpperDistance"),
664 OUString(
"TextRightDistance"), OUString(
"TextLowerDistance") };
667 xPropertySet->setPropertyValue(aShapeProps[
i],
uno::Any(*oInsets[
i]));
673 drawing::TextVerticalAdjust eAdjust
675 xPropertySet->setPropertyValue(
"TextVerticalAdjust",
uno::Any(eAdjust));
679 uno::Reference<text::XText> xText(
mxShape, uno::UNO_QUERY);
680 uno::Any xCharColor = xPropertySet->getPropertyValue(
"CharColor");
682 if ((xCharColor >>= aColor) && aColor !=
COL_AUTO)
687 if (uno::Reference<container::XEnumerationAccess> paraEnumAccess{
688 xText, uno::UNO_QUERY })
690 uno::Reference<container::XEnumeration> paraEnum(
691 paraEnumAccess->createEnumeration());
693 while (paraEnum->hasMoreElements())
695 uno::Reference<text::XTextRange> xParagraph(paraEnum->nextElement(),
697 uno::Reference<container::XEnumerationAccess> runEnumAccess(
698 xParagraph, uno::UNO_QUERY);
699 if (!runEnumAccess.is())
701 if (uno::Reference<beans::XPropertySet> xParaPropSet{ xParagraph,
703 if ((xParaPropSet->getPropertyValue(
"ParaBackColor") >>= aColor)
707 uno::Reference<container::XEnumeration> runEnum
708 = runEnumAccess->createEnumeration();
710 while (runEnum->hasMoreElements())
712 uno::Reference<text::XTextRange> xRun(runEnum->nextElement(),
714 const uno::Reference<beans::XPropertyState> xRunState(
715 xRun, uno::UNO_QUERY);
717 || xRunState->getPropertyState(
"CharColor")
718 == beans::PropertyState_DEFAULT_VALUE)
720 uno::Reference<beans::XPropertySet> xRunPropSet(xRun,
724 if ((xRunPropSet->getPropertyValue(
"CharBackColor") >>= aColor)
727 if (!(xRunPropSet->getPropertyValue(
"CharColor") >>= aColor)
729 xRunPropSet->setPropertyValue(
"CharColor", xCharColor);
736 auto nWrappingType = rAttribs.
getToken(XML_wrap, XML_square);
737 xPropertySet->setPropertyValue(
"TextWordWrap",
738 uno::Any(nWrappingType == XML_square));
753 drawing::TextVerticalAdjust eAdjust
755 pTextBody->getTextProperties().meVA = eAdjust;
758 sal_Int32 aInsets[] = { XML_lIns, XML_tIns, XML_rIns, XML_bIns };
759 for (
int i = 0;
i < 4; ++
i)
763 std::optional<OUString> oValue = rAttribs.
getString(aInsets[
i]);
764 if (oValue.has_value())
765 pTextBody->getTextProperties().moInsets[
i]
769 pTextBody->getTextProperties().moInsets[
i]
770 = (aInsets[
i] == XML_lIns || aInsets[
i] == XML_rIns) ? 254 : 127;
780 uno::Reference<lang::XServiceInfo> xServiceInfo(
mxShape, uno::UNO_QUERY);
784 uno::Reference<beans::XPropertySet> xPropertySet(
mxShape, uno::UNO_QUERY);
785 if (xPropertySet.is())
787 if (xServiceInfo->supportsService(
"com.sun.star.text.TextFrame"))
788 xPropertySet->setPropertyValue(
789 "FrameIsAutomaticHeight",
790 uno::Any(getBaseToken(nElementToken) == XML_spAutoFit));
792 xPropertySet->setPropertyValue(
793 "TextAutoGrowHeight",
794 uno::Any(getBaseToken(nElementToken) == XML_spAutoFit));
801 uno::Reference<beans::XPropertySet> xPropertySet(
mxShape, uno::UNO_QUERY);
802 if (xPropertySet.is())
804 std::optional<OUString> presetShapeName = rAttribs.
getString(XML_prst);
805 const OUString& preset = presetShapeName.value();
807 xPropertySet->getPropertyValue(
"CustomShapeGeometry"));
808 aCustomShapeGeometry[
"PresetTextWarp"] <<= preset;
809 xPropertySet->setPropertyValue(
810 "CustomShapeGeometry",
815 *
this, rAttribs, *(
getShape()->getCustomShapeProperties()));
818 mpShapePtr->getCustomShapeProperties()->setShapeTypeOverride(
true);
824 std::optional<OUString>
id = rAttribs.
getString(XML_id);
828 linkedTxtBoxAttr.
id =
id.value().toInt32();
830 mpShapePtr->setLinkedTxbxAttributes(linkedTxtBoxAttr);
840 mpShapePtr->getCustomShapeProperties()->setShapeTypeOverride(
true);
842 std::optional<OUString>
id = rAttribs.
getString(XML_id);
843 std::optional<OUString> seq = rAttribs.
getString(XML_seq);
844 if (
id.has_value() && seq.has_value())
847 linkedTxtBoxAttr.
id =
id.value().toInt32();
848 linkedTxtBoxAttr.
seq = seq.value().toInt32();
850 mpShapePtr->setLinkedTxbxAttributes(linkedTxtBoxAttr);
865 if (getBaseToken(getCurrentElement()) != XML_bodyPr)
873 uno::Reference<beans::XPropertySet> xShapePropertySet(
mxShape, uno::UNO_QUERY);
874 if (!xShapePropertySet.is())
877 uno::Reference<text::XText> xText(
mxShape, uno::UNO_QUERY);
881 OUString sMSPresetType;
883 xShapePropertySet->getPropertyValue(
"CustomShapeGeometry"));
884 aCustomShapeGeometry[
"PresetTextWarp"] >>= sMSPresetType;
885 if (sMSPresetType.isEmpty() || sMSPresetType ==
u"textNoShape")
892 aCustomShapeGeometry[
"Type"] >>=
sType;
893 if (
sType !=
u"ooxml-rect")
897 std::vector<beans::PropertyValue> aTextPropVec;
898 if (!lcl_getTextPropsFromFrameText(xText, aTextPropVec))
904 OUString sFrameContent(xText->getString());
905 pCustomShape->NbcSetText(sFrameContent);
908 xShapePropertySet->setPropertyValue(
"TextBox",
uno::Any(
false));
912 mpShapePtr->getCustomShapeProperties()->setShapeTypeOverride(
true);
914 sMSPresetType,
false);
917 lcl_setTextPropsToShape(xShapePropertySet, aTextPropVec);
918 lcl_setTextAnchorFromTextProps(xShapePropertySet, aTextPropMap);
925 = lcl_generateLinePropertiesFromTextProps(aTextPropMap);
927 lcl_applyShapePropsToShape(xShapePropertySet, aStrokeShapeProps);
931 = lcl_generateFillPropertiesFromTextProps(aTextPropMap);
935 pCustomShape->IsMirroredX(), pCustomShape->IsMirroredY(),
937 lcl_applyShapePropsToShape(xShapePropertySet, aFillShapeProps);
941 uno::Reference<text::XText> xNewText(pCustomShape->getUnoShape(), uno::UNO_QUERY);
943 lcl_applyUsedTextPropsToAllTextRuns(xNewText, aTextPropVec);
946 xShapePropertySet->setPropertyValue(
"TextAutoGrowHeight",
uno::Any(
false));
947 xShapePropertySet->setPropertyValue(
"TextAutoGrowWidth",
uno::Any(
false));
static SdrObject * getSdrObjectFromXShape(const css::uno::Reference< css::uno::XInterface > &xInt)
bool decompose(B2DTuple &rScale, B2DTuple &rTranslate, double &rRotate, double &rShearX) const
void set(sal_uInt16 nRow, sal_uInt16 nColumn, double fValue)
css::uno::Any getValue(const OUString &sKey) const
css::uno::Sequence< css::beans::PropertyValue > getAsConstPropertyValueList() const
static sal_Int32 decodeIntegerHex(std::u16string_view rValue)
Returns the 32-bit signed integer value from the passed string (hexadecimal).
static sal_Int32 decodeToken(std::u16string_view rValue)
Returns the XML token identifier from the passed string.
Provides access to attribute values of an element.
bool hasAttribute(sal_Int32 nAttrToken) const
Returns true, if the specified attribute is present.
std::optional< OUString > getString(sal_Int32 nAttrToken) const
Returns the string value of the specified attribute.
std::optional< bool > getBool(sal_Int32 nAttrToken) const
Returns the boolean value of the specified attribute.
std::optional< sal_Int32 > getToken(sal_Int32 nAttrToken) const
Returns the token identifier of the value of the specified attribute.
css::uno::Sequence< css::beans::PropertyValue > makePropertyValueSequence() const
Returns a sequence of property values, filled with all contained properties.
XmlFilterBase & getFilter() const
Returns the filter instance.
void addTransformation(sal_Int32 nElement, sal_Int32 nValue=-1)
Inserts the passed color transformation.
void setSchemeClr(sal_Int32 nToken)
Sets a scheme color from the a:schemeClr element.
void setUnused()
Sets the color to unused state.
void setSchemeName(const OUString &sSchemeName)
Sets the scheme name from the a:schemeClr element for interoperability purposes.
void setSrgbClr(sal_Int32 nRgb)
Sets an RGB value (hexadecimal RRGGBB) from the a:srgbClr element.
virtual ::oox::core::ContextHandlerRef onCreateContext(::sal_Int32 Element, const ::oox::AttributeList &rAttribs) override
const ShapePtr & getShape() const
Wpg is the drawingML equivalent of v:group.
oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElementToken, const oox::AttributeList &rAttribs) override
WpsContext(oox::core::ContextHandler2Helper const &rParent, css::uno::Reference< css::drawing::XShape > xShape, oox::drawingml::ShapePtr const &pMasterShapePtr, oox::drawingml::ShapePtr const &pShapePtr)
virtual void onEndElement() override
css::uno::Reference< css::drawing::XShape > mxShape
constexpr ::Color COL_AUTO(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
#define SAL_N_ELEMENTS(arr)
void putCustomShapeIntoTextPathMode(const css::uno::Reference< css::drawing::XShape > &xShape, const oox::drawingml::CustomShapePropertiesPtr &pCustomShapePropertiesPtr, const OUString &sMSPresetType, const bool bFromWordArt)
Changes the EnhancedCustomShapeGeometry of xShape shape so, that it becomes a LO Fontwork shape corre...
constexpr double rad2deg(double v)
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
TextVerticalAdjust GetTextVerticalAdjust(sal_Int32 nToken)
sal_Int32 GetCoordinate(sal_Int32 nValue)
converts EMUs into 1/100th mmm
std::shared_ptr< Shape > ShapePtr
const sal_Int32 MAX_PERCENT
std::shared_ptr< TextBody > TextBodyPtr
const ::Color API_RGB_TRANSPARENT(ColorTransparency, 0xffffffff)
Transparent color for API calls.
uno::Reference< drawing::XShape > const mxShape
void pushToPropMap(ShapePropertyMap &rPropMap, const GraphicHelper &rGraphicHelper, sal_Int32 nShapeRotation=0, ::Color nPhClr=API_RGB_TRANSPARENT, sal_Int16 nPhClrTheme=-1, bool bFlipH=false, bool bFlipV=false, bool bIsCustomShape=false) const
Writes the properties to the passed property map.
GradientFillProperties maGradientProps
Whether the background is used as fill type.
Color maFillColor
Fill type (OOXML token).
std::optional< sal_Int32 > moFillType
std::optional< css::geometry::IntegerRectangle2D > moFillToRect
Gradient stops (colors/transparence).
std::optional< sal_Int32 > moGradientPath
std::optional< bool > moShadeScaled
Flip mode of gradient, if not stretched to shape.
std::optional< sal_Int32 > moShadeAngle
If set, gradient follows rectangle, circle, or shape.
GradientStopMap maGradientStops
FillProperties maLineFill
End line arrow style.
std::optional< sal_Int32 > moLineCompound
Preset dash (OOXML token).
std::optional< sal_Int32 > moLineCap
Line compound type (OOXML token).
std::optional< sal_Int32 > moLineWidth
User-defined line dash style.
void pushToPropMap(ShapePropertyMap &rPropMap, const GraphicHelper &rGraphicHelper, ::Color nPhClr=API_RGB_TRANSPARENT, sal_Int16 nPhClrTheme=-1) const
Writes the properties to the passed property map.
std::optional< sal_Int32 > moLineJoint
Line cap (OOXML token).
std::optional< sal_Int32 > moPresetDash
Line width (EMUs).
Attributes for a linked textbox.