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/HomogenMatrix3.hpp>
37#include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
38#include <com/sun/star/geometry/IntegerRectangle2D.hpp>
39#include <com/sun/star/lang/XServiceInfo.hpp>
40#include <com/sun/star/text/XText.hpp>
41#include <com/sun/star/text/XTextCursor.hpp>
42#include <com/sun/star/text/WritingMode.hpp>
43#include <com/sun/star/text/WritingMode2.hpp>
51bool lcl_getTextPropsFromFrameText(
const uno::Reference<text::XText>& xText,
52 std::vector<beans::PropertyValue>& rTextPropVec)
56 uno::Reference<text::XTextCursor> xTextCursor = xText->createTextCursor();
57 xTextCursor->gotoStart(
false);
58 xTextCursor->gotoEnd(
true);
59 uno::Reference<container::XEnumerationAccess> paraEnumAccess(xText, uno::UNO_QUERY);
60 if (!paraEnumAccess.is())
62 uno::Reference<container::XEnumeration> paraEnum(paraEnumAccess->createEnumeration());
63 while (paraEnum->hasMoreElements())
65 uno::Reference<text::XTextRange> xParagraph(paraEnum->nextElement(), uno::UNO_QUERY);
66 uno::Reference<container::XEnumerationAccess> runEnumAccess(xParagraph, uno::UNO_QUERY);
67 if (!runEnumAccess.is())
69 uno::Reference<container::XEnumeration> runEnum = runEnumAccess->createEnumeration();
70 while (runEnum->hasMoreElements())
72 uno::Reference<text::XTextRange> xRun(runEnum->nextElement(), uno::UNO_QUERY);
73 if (xRun->getString().isEmpty())
75 uno::Reference<beans::XPropertySet> xRunPropSet(xRun, uno::UNO_QUERY);
76 if (!xRunPropSet.is())
78 auto xRunPropSetInfo = xRunPropSet->getPropertySetInfo();
79 if (!xRunPropSetInfo.is())
83 auto aRunPropInfoSequence = xRunPropSetInfo->getProperties();
84 for (
const beans::Property& aProp : aRunPropInfoSequence)
87 aProp.Name, xRunPropSet->getPropertyValue(aProp.Name)));
99bool lcl_getAttributeAsString(
const uno::Sequence<beans::PropertyValue>& aPropertyValueAsSeq,
100 const OUString& rName, OUString& rValue)
103 uno::Sequence<beans::PropertyValue> aAttributesSeq;
104 if (!((aPropertyValueAsMap.getValue(
"attributes") >>= aAttributesSeq)
105 && aAttributesSeq.hasElements()))
109 if (!(aAttributesMap.getValue(rName) >>= sRet))
116bool lcl_getAttributeAsNumber(
const uno::Sequence<beans::PropertyValue>& rPropertyValueAsSeq,
117 const OUString& rName, sal_Int32& rValue)
120 uno::Sequence<beans::PropertyValue> aAttributesSeq;
121 if (!((aPropertyValueAsMap.getValue(
"attributes") >>= aAttributesSeq)
122 && aAttributesSeq.hasElements()))
126 if (!(aAttributesMap.getValue(rName) >>= nRet))
132void lcl_getColorTransformationsFromPropSeq(
const uno::Sequence<beans::PropertyValue>& rPropSeq,
135 auto isValidPropName = [](
const OUString& rName) ->
bool {
136 return rName ==
u"tint" || rName ==
u"shade" || rName ==
u"alpha" || rName ==
u"hueMod"
137 || rName ==
u"sat" || rName ==
u"satOff" || rName ==
u"satMod" || rName ==
u"lum"
138 || rName ==
u"lumOff" || rName ==
u"lumMod";
140 for (
auto it = rPropSeq.begin(); it < rPropSeq.end(); ++it)
142 if (isValidPropName((*it).Name))
144 uno::Sequence<beans::PropertyValue> aValueSeq;
145 sal_Int32 nNumber(0);
146 if (((*it).Value >>= aValueSeq) && lcl_getAttributeAsNumber(aValueSeq, u
"val", nNumber))
149 if ((*it).Name == u
"alpha")
162bool lcl_getColorFromPropSeq(
const uno::Sequence<beans::PropertyValue>& rPropSeq,
165 bool bColorFound =
false;
167 uno::Sequence<beans::PropertyValue> aColorDetailSeq;
168 if (aPropMap.getValue(u
"schemeClr") >>= aColorDetailSeq)
170 OUString sColorString;
171 bColorFound = lcl_getAttributeAsString(aColorDetailSeq, u
"val", sColorString);
179 if (!bColorFound && (aPropMap.getValue(u
"srgbClr") >>= aColorDetailSeq))
181 OUString sColorString;
182 bColorFound = lcl_getAttributeAsString(aColorDetailSeq, u
"val", sColorString);
191 lcl_getColorTransformationsFromPropSeq(aColorDetailSeq, rColor);
195void lcl_getFillDetailsFromPropSeq(
const uno::Sequence<beans::PropertyValue>& rTextFillSeq,
200 if (!rTextFillSeq.hasElements())
203 if (aTextFillMap.find(u
"noFill") != aTextFillMap.end())
209 uno::Sequence<beans::PropertyValue> aPropSeq;
210 if ((aTextFillMap.getValue(u
"solidFill") >>= aPropSeq) && aPropSeq.hasElements())
212 rFillProperties.
moFillType = oox::XML_solidFill;
213 lcl_getColorFromPropSeq(aPropSeq, rFillProperties.
maFillColor);
217 if ((aTextFillMap.getValue(u
"gradFill") >>= aPropSeq) && aPropSeq.hasElements())
219 rFillProperties.
moFillType = oox::XML_gradFill;
224 uno::Sequence<beans::PropertyValue> aGsLstSeq;
225 if (aPropMap.getValue(
"gsLst") >>= aGsLstSeq)
227 for (
auto it = aGsLstSeq.begin(); it < aGsLstSeq.end(); ++it)
230 uno::Sequence<beans::PropertyValue> aColorStopSeq;
231 if ((*it).Value >>= aColorStopSeq)
236 if (lcl_getAttributeAsNumber(aColorStopSeq, u
"pos", nPos)
237 && lcl_getColorFromPropSeq(aColorStopSeq, aColor))
240 double fPos =
nPos / 100000.0;
247 uno::Sequence<beans::PropertyValue> aKindSeq;
248 if (aPropMap.getValue(
"lin") >>= aKindSeq)
252 if (lcl_getAttributeAsNumber(aKindSeq,
"ang", nAngle))
254 OUString sScaledString;
255 if (lcl_getAttributeAsString(aKindSeq,
"scaled", sScaledString))
257 = sScaledString ==
u"1" || sScaledString ==
u"true";
260 if (aPropMap.getValue(
"path") >>= aKindSeq)
266 if (lcl_getAttributeAsString(aKindSeq,
"path", sKind))
270 uno::Sequence<beans::PropertyValue> aFillToRectSeq;
271 if (aKindMap.getValue(
"fillToRect") >>= aFillToRectSeq)
276 geometry::IntegerRectangle2D aRect;
277 if (!lcl_getAttributeAsNumber(aFillToRectSeq, u
"l", aRect.X1))
279 if (!lcl_getAttributeAsNumber(aFillToRectSeq, u
"t", aRect.Y1))
281 if (!lcl_getAttributeAsNumber(aFillToRectSeq, u
"r", aRect.X2))
283 if (!lcl_getAttributeAsNumber(aFillToRectSeq, u
"b", aRect.Y2))
292void lcl_getLineDetailsFromPropSeq(
const uno::Sequence<beans::PropertyValue>& rTextOutlineSeq,
295 if (!rTextOutlineSeq.hasElements())
304 lcl_getFillDetailsFromPropSeq(rTextOutlineSeq, rLineProperties.
maLineFill);
308 if (aTextOutlineMap.find(u
"bevel") != aTextOutlineMap.end())
310 else if (aTextOutlineMap.find(u
"round") != aTextOutlineMap.end())
312 else if (aTextOutlineMap.find(u
"miter") != aTextOutlineMap.end())
316 sal_Int32 nMiterLimit = aTextOutlineMap.getUnpackedValueOrDefault(
"lim", sal_Int32(0));
317 if (nMiterLimit == 0)
324 uno::Sequence<beans::PropertyValue> aDashSeq;
325 if (aTextOutlineMap.getValue(u
"prstDash") >>= aDashSeq)
329 if (lcl_getAttributeAsString(aDashSeq, u
"val", sDashKind))
333 if (lcl_getAttributeAsString(rTextOutlineSeq, u
"cap", sCapKind))
338 if (lcl_getAttributeAsNumber(rTextOutlineSeq, u
"w", nWidth))
342 OUString sCompoundKind;
343 if (lcl_getAttributeAsString(rTextOutlineSeq, u
"cmpd", sCompoundKind))
358 uno::Sequence<beans::PropertyValue> aCharInteropGrabBagSeq;
359 if (!(aTextPropMap.
getValue(u
"CharInteropGrabBag") >>= aCharInteropGrabBagSeq))
360 return aLineProperties;
361 if (!aCharInteropGrabBagSeq.hasElements())
362 return aLineProperties;
364 beans::PropertyValue aProp;
365 if (!(aCharInteropGrabBagMap.getValue(u
"CharTextOutlineTextEffect") >>= aProp))
366 return aLineProperties;
367 uno::Sequence<beans::PropertyValue> aTextOutlineSeq;
368 if (!(aProp.Name ==
"textOutline" && (aProp.Value >>= aTextOutlineSeq)
369 && aTextOutlineSeq.hasElements()))
370 return aLineProperties;
373 lcl_getLineDetailsFromPropSeq(aTextOutlineSeq, aLineProperties);
374 return aLineProperties;
381 aFillProperties.
moFillType = oox::XML_solidFill;
384 uno::Sequence<beans::PropertyValue> aCharInteropGrabBagSeq;
385 if ((rTextPropMap.
getValue(u
"CharInteropGrabBag") >>= aCharInteropGrabBagSeq)
386 && aCharInteropGrabBagSeq.hasElements())
390 beans::PropertyValue aProp;
391 if (aCharInteropGrabBagMap.getValue(u
"CharTextFillTextEffect") >>= aProp)
393 uno::Sequence<beans::PropertyValue> aTextFillSeq;
394 if (aProp.Name ==
"textFill" && (aProp.Value >>= aTextFillSeq)
395 && aTextFillSeq.hasElements())
398 lcl_getFillDetailsFromPropSeq(aTextFillSeq, aFillProperties);
399 return aFillProperties;
404 bool bColorFound(
false);
405 OUString sColorString;
406 if (aCharInteropGrabBagMap.getValue(
"CharThemeOriginalColor") >>= sColorString)
412 if (aCharInteropGrabBagMap.getValue(
"CharThemeColor") >>= sColorString)
419 OUString sTransformString;
420 if (aCharInteropGrabBagMap.getValue(
"CharThemeColorTint") >>= sTransformString)
425 static_cast<sal_Int32
>(fTint + 0.5));
428 static_cast<sal_Int32
>(fOff + 0.5));
430 else if (aCharInteropGrabBagMap.getValue(
"CharThemeColorShade") >>= sTransformString)
435 static_cast<sal_Int32
>(fShade + 0.5));
439 return aFillProperties;
443 sal_Int32 aCharColor = 0;
444 if (rTextPropMap.
getValue(u
"CharColor") >>= aCharColor)
448 return aFillProperties;
451void lcl_applyShapePropsToShape(
const uno::Reference<beans::XPropertySet>& xShapePropertySet,
456 xShapePropertySet->setPropertyValue(rProp.Name, rProp.Value);
460void lcl_setTextAnchorFromTextProps(
const uno::Reference<beans::XPropertySet>& xShapePropertySet,
464 auto eHorzAdjust(drawing::TextHorizontalAdjust_CENTER);
465 sal_Int16 nParaAlign = sal_Int16(drawing::TextHorizontalAdjust_CENTER);
466 aTextPropMap.
getValue(
"ParaAdjust") >>= nParaAlign;
469 case sal_Int16(style::ParagraphAdjust_LEFT):
470 eHorzAdjust = drawing::TextHorizontalAdjust_LEFT;
472 case sal_Int16(style::ParagraphAdjust_RIGHT):
473 eHorzAdjust = drawing::TextHorizontalAdjust_RIGHT;
476 eHorzAdjust = drawing::TextHorizontalAdjust_CENTER;
478 xShapePropertySet->setPropertyValue(
"TextHorizontalAdjust",
uno::Any(eHorzAdjust));
479 xShapePropertySet->setPropertyValue(
"TextVerticalAdjust",
480 uno::Any(drawing::TextVerticalAdjust_TOP));
483void lcl_setTextPropsToShape(
const uno::Reference<beans::XPropertySet>& xShapePropertySet,
484 std::vector<beans::PropertyValue>& aTextPropVec)
486 auto xShapePropertySetInfo = xShapePropertySet->getPropertySetInfo();
487 if (!xShapePropertySetInfo.is())
489 for (
size_t i = 0;
i < aTextPropVec.size(); ++
i)
491 if (xShapePropertySetInfo->hasPropertyByName(aTextPropVec[
i].Name)
492 && !(xShapePropertySetInfo->getPropertyByName(aTextPropVec[
i].Name).Attributes
493 & beans::PropertyAttribute::READONLY)
494 && aTextPropVec[
i].Name != u
"CharInteropGrabBag")
496 xShapePropertySet->setPropertyValue(aTextPropVec[
i].Name, aTextPropVec[
i].Value);
501void lcl_applyUsedTextPropsToAllTextRuns(uno::Reference<text::XText>& xText,
502 const std::vector<beans::PropertyValue>& aTextPropVec)
506 uno::Reference<text::XTextCursor> xTextCursor = xText->createTextCursor();
507 xTextCursor->gotoStart(
false);
508 xTextCursor->gotoEnd(
true);
509 uno::Reference<container::XEnumerationAccess> paraEnumAccess(xText, uno::UNO_QUERY);
510 if (!paraEnumAccess.is())
512 uno::Reference<container::XEnumeration> paraEnum(paraEnumAccess->createEnumeration());
513 while (paraEnum->hasMoreElements())
515 uno::Reference<text::XTextRange> xParagraph(paraEnum->nextElement(), uno::UNO_QUERY);
516 uno::Reference<container::XEnumerationAccess> runEnumAccess(xParagraph, uno::UNO_QUERY);
517 if (!runEnumAccess.is())
519 uno::Reference<container::XEnumeration> runEnum = runEnumAccess->createEnumeration();
520 while (runEnum->hasMoreElements())
522 uno::Reference<text::XTextRange> xRun(runEnum->nextElement(), uno::UNO_QUERY);
523 if (xRun->getString().isEmpty())
525 uno::Reference<beans::XPropertySet> xRunPropSet(xRun, uno::UNO_QUERY);
526 if (!xRunPropSet.is())
528 auto xRunPropSetInfo = xRunPropSet->getPropertySetInfo();
529 if (!xRunPropSetInfo.is())
532 for (
size_t i = 0;
i < aTextPropVec.size(); ++
i)
534 if (xRunPropSetInfo->hasPropertyByName(aTextPropVec[
i].Name)
535 && !(xRunPropSetInfo->getPropertyByName(aTextPropVec[
i].Name).Attributes
536 & beans::PropertyAttribute::READONLY))
537 xRunPropSet->setPropertyValue(aTextPropVec[
i].Name, aTextPropVec[
i].Value);
555 if (
const auto pParent =
dynamic_cast<const WpgContext*
>(&rParent))
566 switch (getBaseToken(nElementToken))
576 uno::Reference<lang::XServiceInfo> xServiceInfo(
mxShape, uno::UNO_QUERY);
577 uno::Reference<beans::XPropertySet> xPropertySet(
mxShape, uno::UNO_QUERY);
578 sal_Int32 nVert = rAttribs.
getToken(XML_vert, XML_horz);
581 if (nVert == XML_eaVert || nVert == XML_wordArtVertRtl)
583 xPropertySet->setPropertyValue(
"TextWritingMode",
585 xPropertySet->setPropertyValue(
"WritingMode",
586 uno::Any(text::WritingMode2::TB_RL));
588 else if (nVert == XML_mongolianVert || nVert == XML_wordArtVert)
590 xPropertySet->setPropertyValue(
"WritingMode",
591 uno::Any(text::WritingMode2::TB_LR));
593 else if (nVert != XML_horz)
600 drawing::HomogenMatrix3 aMatrix;
601 xPropertySet->getPropertyValue(
"Transformation") >>= aMatrix;
603 aTransformation.
set(0, 0, aMatrix.Line1.Column1);
604 aTransformation.
set(0, 1, aMatrix.Line1.Column2);
605 aTransformation.
set(0, 2, aMatrix.Line1.Column3);
606 aTransformation.
set(1, 0, aMatrix.Line2.Column1);
607 aTransformation.
set(1, 1, aMatrix.Line2.Column2);
608 aTransformation.
set(1, 2, aMatrix.Line2.Column3);
610 assert(aMatrix.Line3.Column1 == 0);
611 assert(aMatrix.Line3.Column2 == 0);
612 assert(aMatrix.Line3.Column3 == 1);
617 aTransformation.
decompose(aScale, aTranslate, fRotate, fShearX);
619 if ((nVert == XML_vert && nRotate == 270)
620 || (nVert == XML_vert270 && nRotate == 90))
622 xPropertySet->setPropertyValue(
"WritingMode",
623 uno::Any(text::WritingMode2::LR_TB));
626 else if (nVert == XML_vert)
627 xPropertySet->setPropertyValue(
"WritingMode",
628 uno::Any(text::WritingMode2::TB_RL90));
630 xPropertySet->setPropertyValue(
"WritingMode",
631 uno::Any(text::WritingMode2::BT_LR));
634 if (
bool bUpright = rAttribs.
getBool(XML_upright,
false))
636 uno::Sequence<beans::PropertyValue> aGrabBag;
637 xPropertySet->getPropertyValue(
"InteropGrabBag") >>= aGrabBag;
638 sal_Int32
length = aGrabBag.getLength();
639 aGrabBag.realloc(
length + 1);
640 auto pGrabBag = aGrabBag.getArray();
641 pGrabBag[
length].Name =
"Upright";
642 pGrabBag[
length].Value <<= bUpright;
643 xPropertySet->setPropertyValue(
"InteropGrabBag",
uno::Any(aGrabBag));
646 if (xServiceInfo.is())
649 sal_Int32 aInsets[] = { XML_lIns, XML_tIns, XML_rIns, XML_bIns };
650 std::optional<sal_Int32> oInsets[4];
653 std::optional<OUString> oValue = rAttribs.
getString(aInsets[
i]);
654 if (oValue.has_value())
659 = (aInsets[
i] == XML_lIns || aInsets[
i] == XML_rIns) ? 254 : 127;
661 const OUString aShapeProps[]
662 = { OUString(
"TextLeftDistance"), OUString(
"TextUpperDistance"),
663 OUString(
"TextRightDistance"), OUString(
"TextLowerDistance") };
666 xPropertySet->setPropertyValue(aShapeProps[
i],
uno::Any(*oInsets[
i]));
672 drawing::TextVerticalAdjust eAdjust
674 xPropertySet->setPropertyValue(
"TextVerticalAdjust",
uno::Any(eAdjust));
678 uno::Reference<text::XText> xText(
mxShape, uno::UNO_QUERY);
679 uno::Any xCharColor = xPropertySet->getPropertyValue(
"CharColor");
681 if ((xCharColor >>= aColor) && aColor !=
COL_AUTO)
686 if (uno::Reference<container::XEnumerationAccess> paraEnumAccess{
687 xText, uno::UNO_QUERY })
689 uno::Reference<container::XEnumeration> paraEnum(
690 paraEnumAccess->createEnumeration());
692 while (paraEnum->hasMoreElements())
694 uno::Reference<text::XTextRange> xParagraph(paraEnum->nextElement(),
696 uno::Reference<container::XEnumerationAccess> runEnumAccess(
697 xParagraph, uno::UNO_QUERY);
698 if (!runEnumAccess.is())
700 if (uno::Reference<beans::XPropertySet> xParaPropSet{ xParagraph,
702 if ((xParaPropSet->getPropertyValue(
"ParaBackColor") >>= aColor)
706 uno::Reference<container::XEnumeration> runEnum
707 = runEnumAccess->createEnumeration();
709 while (runEnum->hasMoreElements())
711 uno::Reference<text::XTextRange> xRun(runEnum->nextElement(),
713 const uno::Reference<beans::XPropertyState> xRunState(
714 xRun, uno::UNO_QUERY);
716 || xRunState->getPropertyState(
"CharColor")
717 == beans::PropertyState_DEFAULT_VALUE)
719 uno::Reference<beans::XPropertySet> xRunPropSet(xRun,
723 if ((xRunPropSet->getPropertyValue(
"CharBackColor") >>= aColor)
726 if (!(xRunPropSet->getPropertyValue(
"CharColor") >>= aColor)
728 xRunPropSet->setPropertyValue(
"CharColor", xCharColor);
735 auto nWrappingType = rAttribs.
getToken(XML_wrap, XML_square);
736 xPropertySet->setPropertyValue(
"TextWordWrap",
737 uno::Any(nWrappingType == XML_square));
752 drawing::TextVerticalAdjust eAdjust
754 pTextBody->getTextProperties().meVA = eAdjust;
757 sal_Int32 aInsets[] = { XML_lIns, XML_tIns, XML_rIns, XML_bIns };
758 for (
int i = 0;
i < 4; ++
i)
762 std::optional<OUString> oValue = rAttribs.
getString(aInsets[
i]);
763 if (oValue.has_value())
764 pTextBody->getTextProperties().moInsets[
i]
768 pTextBody->getTextProperties().moInsets[
i]
769 = (aInsets[
i] == XML_lIns || aInsets[
i] == XML_rIns) ? 254 : 127;
779 uno::Reference<lang::XServiceInfo> xServiceInfo(
mxShape, uno::UNO_QUERY);
783 uno::Reference<beans::XPropertySet> xPropertySet(
mxShape, uno::UNO_QUERY);
784 if (xPropertySet.is())
786 if (xServiceInfo->supportsService(
"com.sun.star.text.TextFrame"))
787 xPropertySet->setPropertyValue(
788 "FrameIsAutomaticHeight",
789 uno::Any(getBaseToken(nElementToken) == XML_spAutoFit));
791 xPropertySet->setPropertyValue(
792 "TextAutoGrowHeight",
793 uno::Any(getBaseToken(nElementToken) == XML_spAutoFit));
800 uno::Reference<beans::XPropertySet> xPropertySet(
mxShape, uno::UNO_QUERY);
801 if (xPropertySet.is())
803 std::optional<OUString> presetShapeName = rAttribs.
getString(XML_prst);
804 const OUString& preset = presetShapeName.value();
806 xPropertySet->getPropertyValue(
"CustomShapeGeometry"));
807 aCustomShapeGeometry[
"PresetTextWarp"] <<= preset;
808 xPropertySet->setPropertyValue(
809 "CustomShapeGeometry",
814 *
this, rAttribs, *(
getShape()->getCustomShapeProperties()));
817 mpShapePtr->getCustomShapeProperties()->setShapeTypeOverride(
true);
823 std::optional<OUString>
id = rAttribs.
getString(XML_id);
827 linkedTxtBoxAttr.
id =
id.value().toInt32();
829 mpShapePtr->setLinkedTxbxAttributes(linkedTxtBoxAttr);
839 mpShapePtr->getCustomShapeProperties()->setShapeTypeOverride(
true);
841 std::optional<OUString>
id = rAttribs.
getString(XML_id);
842 std::optional<OUString> seq = rAttribs.
getString(XML_seq);
843 if (
id.has_value() && seq.has_value())
846 linkedTxtBoxAttr.
id =
id.value().toInt32();
847 linkedTxtBoxAttr.
seq = seq.value().toInt32();
849 mpShapePtr->setLinkedTxbxAttributes(linkedTxtBoxAttr);
864 if (getBaseToken(getCurrentElement()) != XML_bodyPr)
872 uno::Reference<beans::XPropertySet> xShapePropertySet(
mxShape, uno::UNO_QUERY);
873 if (!xShapePropertySet.is())
876 uno::Reference<text::XText> xText(
mxShape, uno::UNO_QUERY);
880 OUString sMSPresetType;
882 xShapePropertySet->getPropertyValue(
"CustomShapeGeometry"));
883 aCustomShapeGeometry[
"PresetTextWarp"] >>= sMSPresetType;
884 if (sMSPresetType.isEmpty() || sMSPresetType ==
u"textNoShape")
891 aCustomShapeGeometry[
"Type"] >>=
sType;
892 if (
sType !=
u"ooxml-rect")
896 std::vector<beans::PropertyValue> aTextPropVec;
897 if (!lcl_getTextPropsFromFrameText(xText, aTextPropVec))
903 OUString sFrameContent(xText->getString());
904 pCustomShape->NbcSetText(sFrameContent);
907 xShapePropertySet->setPropertyValue(
"TextBox",
uno::Any(
false));
911 mpShapePtr->getCustomShapeProperties()->setShapeTypeOverride(
true);
913 sMSPresetType,
false);
916 lcl_setTextPropsToShape(xShapePropertySet, aTextPropVec);
917 lcl_setTextAnchorFromTextProps(xShapePropertySet, aTextPropMap);
924 = lcl_generateLinePropertiesFromTextProps(aTextPropMap);
926 lcl_applyShapePropsToShape(xShapePropertySet, aStrokeShapeProps);
930 = lcl_generateFillPropertiesFromTextProps(aTextPropMap);
934 css::awt::Size(0, 0), -1,
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
GradientFillProperties maGradientProps
Whether the background is used as fill type.
void pushToPropMap(ShapePropertyMap &rPropMap, const GraphicHelper &rGraphicHelper, sal_Int32 nShapeRotation=0, ::Color nPhClr=API_RGB_TRANSPARENT, const css::awt::Size &rSize={}, sal_Int16 nPhClrTheme=-1, bool bFlipH=false, bool bFlipV=false, bool bIsCustomShape=false) const
Writes the properties to the passed property map.
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.