11 #include <com/sun/star/beans/XPropertySet.hpp>
12 #include <com/sun/star/drawing/PointSequenceSequence.hpp>
24 #include <oox/token/namespaces.hxx>
52 uno::Sequence<beans::PropertyValue> lclGetProperty(
const uno::Reference<drawing::XShape>& rShape,
53 const OUString& rPropName)
55 uno::Sequence<beans::PropertyValue> aResult;
56 uno::Reference<beans::XPropertySet> xPropertySet(rShape, uno::UNO_QUERY);
57 uno::Reference<beans::XPropertySetInfo> xPropSetInfo;
59 if (!xPropertySet.is())
62 xPropSetInfo = xPropertySet->getPropertySetInfo();
63 if (xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(rPropName))
65 xPropertySet->getPropertyValue(rPropName) >>= aResult;
70 OUString lclGetAnchorIdFromGrabBag(
const SdrObject* pObj)
73 uno::Reference<drawing::XShape> xShape(const_cast<SdrObject*>(pObj)->getUnoShape(),
75 OUString aGrabBagName;
76 uno::Reference<lang::XServiceInfo> xServiceInfo(xShape, uno::UNO_QUERY);
77 if (xServiceInfo->supportsService(
"com.sun.star.text.TextFrame"))
78 aGrabBagName =
"FrameInteropGrabBag";
80 aGrabBagName =
"InteropGrabBag";
81 const uno::Sequence<beans::PropertyValue> propList = lclGetProperty(xShape, aGrabBagName);
83 = std::find_if(propList.begin(), propList.end(),
84 [](
const beans::PropertyValue& rProp) {
return rProp.Name ==
"AnchorId"; });
85 if (pProp != propList.end())
86 pProp->Value >>= aResult;
90 void lclMovePositionWithRotation(awt::Point& aPos,
const Size& rSize,
Degree100 nRotation100)
106 if (nRotation100 == 0_deg100)
108 if (nRotation100 < 0_deg100)
109 nRotation100 = (36000_deg100 + nRotation100) % 36000_deg100;
110 if (nRotation100 % 18000_deg100 == 0_deg100)
111 nRotation100 = 0_deg100;
112 while (nRotation100 > 9000_deg100)
113 nRotation100 = 18000_deg100 - (nRotation100 % 18000_deg100);
116 double fCos = (nRotation100 == 9000_deg100) ? 0.0 : cos(fVal);
117 double fSin = sin(fVal);
119 double fWidthHalf =
static_cast<double>(rSize.
Width()) / 2.0;
120 double fHeightHalf =
static_cast<double>(rSize.
Height()) / 2.0;
122 double fXDiff = fSin * fHeightHalf + fCos * fWidthHalf - fWidthHalf;
123 double fYDiff = fSin * fWidthHalf + fCos * fHeightHalf - fHeightHalf;
125 aPos.X += fXDiff + 0.5;
126 aPos.Y += fYDiff + 0.5;
130 bool IsAnchorTypeInsideParagraph(
const ww8::Frame* pFrame)
133 return rAnchor.
GetAnchorId() != RndStdIds::FLY_AT_PAGE;
136 bool lcl_IsRotateAngleValid(
const SdrObject& rObj)
142 case SdrObjKind::Group:
143 case SdrObjKind::Line:
144 case SdrObjKind::PolyLine:
145 case SdrObjKind::PathLine:
146 case SdrObjKind::PathFill:
153 void lcl_calculateMSOBaseRectangle(
const SdrObject& rObj,
double& rfMSOLeft,
double& rfMSORight,
154 double& rfMSOTop,
double& rfMSOBottom,
155 const bool bIsWord2007Image)
168 if (((fRotation > 45.0 && fRotation <= 135.0) || (fRotation > 225.0 && fRotation <= 315.0))
169 && !bIsWord2007Image)
171 rfMSOLeft = fCenterX - fHalfHeight;
172 rfMSORight = fCenterX + fHalfHeight;
173 rfMSOTop = fCenterY - fHalfWidth;
174 rfMSOBottom = fCenterY + fHalfWidth;
178 rfMSOLeft = fCenterX - fHalfWidth;
179 rfMSORight = fCenterX + fHalfWidth;
180 rfMSOTop = fCenterY - fHalfHeight;
181 rfMSOBottom = fCenterY + fHalfHeight;
185 void lcl_calculateRawEffectExtent(sal_Int32& rLeft, sal_Int32& rTop, sal_Int32& rRight,
186 sal_Int32& rBottom,
const SdrObject& rObj,
187 const bool bUseBoundRect,
const bool bIsWord2007Image)
196 lcl_calculateMSOBaseRectangle(rObj, fMSOLeft, fMSORight, fMSOTop, fMSOBottom, bIsWord2007Image);
199 rLeft = fMSOLeft - aLORect.
Left();
200 rRight = aLORect.
Right() - fMSORight;
201 rTop = fMSOTop - aLORect.
Top();
202 rBottom = aLORect.
Bottom() - fMSOBottom;
207 bool lcl_makeSingleDistAndEffectExtentNonNegative(sal_Int64& rDist, sal_Int32& rExt)
214 if (rExt >= 0 && rDist >= 0)
216 if (rExt < 0 && rDist < 0)
222 if (rDist + static_cast<sal_Int64>(rExt) < 0)
242 bool lcl_makeDistAndExtentNonNegative(sal_Int64& rDistT, sal_Int64& rDistB, sal_Int64& rDistL,
243 sal_Int64& rDistR, sal_Int32& rLeftExt, sal_Int32& rTopExt,
244 sal_Int32& rRightExt, sal_Int32& rBottomExt)
246 bool bLeft = lcl_makeSingleDistAndEffectExtentNonNegative(rDistL, rLeftExt);
247 bool bTop = lcl_makeSingleDistAndEffectExtentNonNegative(rDistT, rTopExt);
248 bool bRight = lcl_makeSingleDistAndEffectExtentNonNegative(rDistR, rRightExt);
249 bool bBottom = lcl_makeSingleDistAndEffectExtentNonNegative(rDistB, rBottomExt);
250 return bLeft && bTop && bRight && bBottom;
253 void lcl_makeSingleDistZeroAndExtentNonNegative(sal_Int64& rDist, sal_Int32& rExt)
255 if (static_cast<double>(rDist) + static_cast<double>(rExt)
256 >= static_cast<double>(SAL_MAX_INT32))
258 else if (static_cast<double>(rDist) + static_cast<double>(rExt) <= 0)
262 rExt =
static_cast<sal_Int32
>(rDist + rExt);
269 void lcl_makeDistZeroAndExtentNonNegative(sal_Int64& rDistT, sal_Int64& rDistB, sal_Int64& rDistL,
270 sal_Int64& rDistR, sal_Int32& rLeftExt,
271 sal_Int32& rTopExt, sal_Int32& rRightExt,
272 sal_Int32& rBottomExt)
274 lcl_makeSingleDistZeroAndExtentNonNegative(rDistL, rLeftExt);
275 lcl_makeSingleDistZeroAndExtentNonNegative(rDistT, rTopExt);
276 lcl_makeSingleDistZeroAndExtentNonNegative(rDistR, rRightExt);
277 lcl_makeSingleDistZeroAndExtentNonNegative(rDistB, rBottomExt);
300 case SdrObjKind::CustomShape:
307 if (!pLineGeometryObj)
311 SdrObjListIter aIter(*pLineGeometryObj, SdrIterMode::DeepWithGroups);
312 while (aIter.IsMore())
316 if (
auto pPathObj = dynamic_cast<const SdrPathObj*>(pNext))
317 aPP = pPathObj->GetPathPoly();
329 if (!aPolyPolygon.
count())
336 aPolyPolygon.
transform(aTranslateToOrigin);
338 double fScaleX = fWidth == 0.0 ? 1.0 : 21600.0 / fWidth;
340 double fScaleY = fHeight == 0.0 ? 1.0 : 21600.0 / fHeight;
346 aPolyPolygon.
transform(aTranslateToCenter);
349 case SdrObjKind::Line:
356 case SdrObjKind::PathFill:
357 case SdrObjKind::PathLine:
358 case SdrObjKind::FreehandFill:
359 case SdrObjKind::FreehandLine:
360 case SdrObjKind::PathPoly:
361 case SdrObjKind::PathPolyLine:
380 aPolyPolygon.
append(aReverse);
387 aPolyPolygon.
transform(aTranslateToOrigin);
390 double fScaleX = fWidth == 0.0 ? 1.0 : 21600.0 / fWidth;
392 double fScaleY = fHeight == 0.0 ? 1.0 : 21600.0 / fHeight;
399 aPolyPolygon.
transform(aTranslateToCenter);
402 case SdrObjKind::NONE:
477 , m_pSerializer(
std::move(pSerializer))
478 , m_pDrawingML(pDrawingML)
479 , m_pFlyFrameSize(nullptr)
480 , m_bTextFrameSyntax(
false)
481 , m_bDMLTextFrameSyntax(
false)
482 , m_bDrawingOpen(
false)
483 , m_bParagraphSdtOpen(
false)
484 , m_bParagraphHasDrawing(
false)
485 , m_bDMLAndVMLDrawingOpen(
false)
496 m_pSerializer = pSerializer;
511 m_bDMLTextFrameSyntax = bDMLTextFrameSyntax;
518 m_pFlyAttrList = pFlyAttrList;
526 m_pTextboxAttrList = pTextboxAttrList;
546 m_bDMLAndVMLDrawingOpen = bDMLAndVMLDrawingOpen;
553 m_bParagraphHasDrawing = bParagraphHasDrawing;
566 m_pFlyWrapAttrList = pFlyWrapAttrList;
571 return m_pFlyWrapAttrList.get();
576 m_pBodyPrAttrList = pBodyPrAttrList;
594 m_nDMLandVMLTextFrameRotation = nDMLandVMLTextFrameRotation;
602 :
m_pImpl(
std::make_unique<
Impl>(rExport, pSerializer, pDrawingML))
610 m_pImpl->setSerializer(pSerializer);
621 return m_pImpl->getFlyAttrList();
626 return m_pImpl->getTextboxAttrList();
635 m_pImpl->setParagraphSdtOpen(bParagraphSdtOpen);
644 m_pImpl->setParagraphHasDrawing(bParagraphHasDrawing);
649 return m_pImpl->getFlyFillAttrList();
654 return m_pImpl->getBodyPrAttrList();
659 return m_pImpl->getDashLineStyleAttr();
665 m_pImpl->setFlyWrapAttrList(pAttrList);
673 m_pImpl->setParagraphHasDrawing(
true);
674 m_pImpl->getSerializer()->startElementNS(XML_w, XML_drawing);
684 if (
m_pImpl->getFlyFrameGraphic())
697 sal_Int64 nDistT = aULSpaceItem.
GetUpper();
698 sal_Int64 nDistB = aULSpaceItem.
GetLower();
699 sal_Int64 nDistL = aLRSpaceItem.
GetLeft();
700 sal_Int64 nDistR = aLRSpaceItem.
GetRight();
705 sal_Int32 nWidthDiff(0);
706 sal_Int32 nHeightDiff(0);
707 sal_Int32 nPosXDiff(0);
708 sal_Int32 nPosYDiff(0);
709 sal_Int32 nLeftExt(0);
710 sal_Int32 nRightExt(0);
711 sal_Int32 nTopExt(0);
712 sal_Int32 nBottomExt(0);
714 if ((!pObj) || (pObj && (pObj->
GetObjIdentifier() == SdrObjKind::SwFlyDrawObjIdentifier)))
719 if (aShadowItem.
GetLocation() != SvxShadowLocation::NONE)
721 sal_Int32 nShadowWidth(aShadowItem.
GetWidth());
724 case SvxShadowLocation::TopLeft:
725 nTopExt = nLeftExt = nShadowWidth;
726 nPosXDiff = nLeftExt;
728 nWidthDiff = -nLeftExt;
729 nHeightDiff = -nTopExt;
731 case SvxShadowLocation::TopRight:
732 nTopExt = nRightExt = nShadowWidth;
734 nWidthDiff = -nRightExt;
735 nHeightDiff = -nTopExt;
737 case SvxShadowLocation::BottomLeft:
738 nBottomExt = nLeftExt = nShadowWidth;
739 nPosXDiff = nLeftExt;
740 nWidthDiff = -nLeftExt;
741 nHeightDiff = -nBottomExt;
743 case SvxShadowLocation::BottomRight:
744 nBottomExt = nRightExt = nShadowWidth;
745 nWidthDiff = -nRightExt;
746 nHeightDiff = -nBottomExt;
748 case SvxShadowLocation::NONE:
749 case SvxShadowLocation::End:
764 if ((nRotation > 4500_deg100 && nRotation <= 13500_deg100)
765 || (nRotation > 22500_deg100 && nRotation <= 31500_deg100))
766 std::swap(nMSOWidth, nMSOHeight);
767 nBottomExt += (aBoundRect.Height() - 1 - nMSOHeight) / 2;
768 nTopExt += (aBoundRect.Height() - 1 - nMSOHeight) / 2;
769 nLeftExt += (aBoundRect.Width() - nMSOWidth) / 2;
770 nRightExt += (aBoundRect.Width() - nMSOWidth) / 2;
772 lcl_makeDistAndExtentNonNegative(nDistT, nDistB, nDistL, nDistR, nLeftExt, nTopExt,
773 nRightExt, nBottomExt);
781 sal_Int32 nMode =
m_pImpl->getExport().getWordCompatibilityModeFromGrabBag();
782 bool bIsWord2007Image(nMode > 0 && nMode < 14
789 lcl_calculateRawEffectExtent(nLeftExt, nTopExt, nRightExt, nBottomExt, *pObj,
true,
801 auto it = aGrabBag.
find(
"AnchorDistDiff");
802 if (it != aGrabBag.
end())
805 for (
const std::pair<const OUString, uno::Any>& rDiff : aAnchorDistDiff)
807 if (rDiff.first ==
"distTDiff" && rDiff.second.has<sal_Int32>())
808 nDistT -=
round(rDiff.second.get<sal_Int32>());
809 else if (rDiff.first ==
"distBDiff" && rDiff.second.has<sal_Int32>())
810 nDistB -=
round(rDiff.second.get<sal_Int32>());
811 else if (rDiff.first ==
"distLDiff" && rDiff.second.has<sal_Int32>())
812 nDistL -= rDiff.second.get<sal_Int32>();
813 else if (rDiff.first ==
"distRDiff" && rDiff.second.has<sal_Int32>())
814 nDistR -= rDiff.second.get<sal_Int32>();
819 lcl_makeDistAndExtentNonNegative(nDistT, nDistB, nDistL, nDistR, nLeftExt, nTopExt,
820 nRightExt, nBottomExt);
824 lcl_calculateRawEffectExtent(nLeftExt, nTopExt, nRightExt, nBottomExt, *pObj,
false,
829 lcl_makeDistZeroAndExtentNonNegative(nDistT, nDistB, nDistL, nDistR, nLeftExt, nTopExt,
830 nRightExt, nBottomExt);
839 bool bOpaque = pFrameFormat->
GetOpaque().GetValue();
850 attrList->add(XML_behindDoc, bOpaque ?
"0" :
"1");
852 attrList->add(XML_distT, OString::number(TwipsToEMU(nDistT)).getStr());
853 attrList->add(XML_distB, OString::number(TwipsToEMU(nDistB)).getStr());
854 attrList->add(XML_distL, OString::number(TwipsToEMU(nDistL)).getStr());
855 attrList->add(XML_distR, OString::number(TwipsToEMU(nDistR)).getStr());
857 attrList->add(XML_simplePos,
"0");
858 attrList->add(XML_locked,
"0");
860 bool bLclInTabCell =
true;
863 uno::Reference<drawing::XShape> xShape((const_cast<SdrObject*>(pObj)->getUnoShape()),
865 uno::Reference<beans::XPropertySet> xShapeProps(xShape, uno::UNO_QUERY);
866 if (xShapeProps.is())
867 xShapeProps->getPropertyValue(
"IsFollowingTextFlow") >>= bLclInTabCell;
870 attrList->add(XML_layoutInCell,
"1");
872 attrList->add(XML_layoutInCell,
"0");
875 attrList->add(XML_allowOverlap, bAllowOverlap ?
"1" :
"0");
879 attrList->add(XML_relativeHeight, OString::number(pObj->
GetOrdNum() + 2));
882 attrList->add(XML_relativeHeight,
"0");
886 OUString sAnchorId = lclGetAnchorIdFromGrabBag(pObj);
887 if (!sAnchorId.isEmpty())
888 attrList->addNS(XML_wp14, XML_anchorId,
892 m_pImpl->getSerializer()->startElementNS(XML_wp, XML_anchor, attrList);
894 m_pImpl->getSerializer()->singleElementNS(XML_wp, XML_simplePos, XML_x,
"0", XML_y,
904 if (pObj && lcl_IsRotateAngleValid(*pObj)
908 const char* relativeFromH;
909 const char* relativeFromV;
910 const char* alignH =
nullptr;
911 const char* alignV =
nullptr;
914 case text::RelOrientation::PAGE_PRINT_AREA:
915 relativeFromV =
"margin";
917 case text::RelOrientation::PAGE_PRINT_AREA_TOP:
918 relativeFromV =
"topMargin";
920 case text::RelOrientation::PAGE_PRINT_AREA_BOTTOM:
921 relativeFromV =
"bottomMargin";
923 case text::RelOrientation::PAGE_FRAME:
924 relativeFromV =
"page";
926 case text::RelOrientation::FRAME:
927 relativeFromV =
"paragraph";
929 case text::RelOrientation::TEXT_LINE:
931 relativeFromV =
"line";
936 case text::VertOrientation::TOP:
937 case text::VertOrientation::CHAR_TOP:
938 case text::VertOrientation::LINE_TOP:
940 == text::RelOrientation::TEXT_LINE)
945 case text::VertOrientation::BOTTOM:
946 case text::VertOrientation::CHAR_BOTTOM:
947 case text::VertOrientation::LINE_BOTTOM:
949 == text::RelOrientation::TEXT_LINE)
954 case text::VertOrientation::CENTER:
955 case text::VertOrientation::CHAR_CENTER:
956 case text::VertOrientation::LINE_CENTER:
964 case text::RelOrientation::PAGE_PRINT_AREA:
965 relativeFromH =
"margin";
967 case text::RelOrientation::PAGE_FRAME:
968 relativeFromH =
"page";
970 case text::RelOrientation::CHAR:
971 relativeFromH =
"character";
973 case text::RelOrientation::PAGE_RIGHT:
974 relativeFromH =
"rightMargin";
976 case text::RelOrientation::PAGE_LEFT:
977 relativeFromH =
"leftMargin";
979 case text::RelOrientation::FRAME:
981 relativeFromH =
"column";
986 case text::HoriOrientation::LEFT:
989 case text::HoriOrientation::RIGHT:
992 case text::HoriOrientation::CENTER:
995 case text::HoriOrientation::INSIDE:
998 case text::HoriOrientation::OUTSIDE:
1006 m_pImpl->getSerializer()->startElementNS(XML_wp, XML_positionH, XML_relativeFrom,
1017 if (alignH !=
nullptr)
1019 m_pImpl->getSerializer()->startElementNS(XML_wp, XML_align);
1020 m_pImpl->getSerializer()->write(alignH);
1021 m_pImpl->getSerializer()->endElementNS(XML_wp, XML_align);
1025 m_pImpl->getSerializer()->startElementNS(XML_wp, XML_posOffset);
1026 sal_Int64 nPosXEMU = TwipsToEMU(aPos.X);
1039 if (nPosXEMU > MAX_INTEGER_VALUE)
1041 nPosXEMU = MAX_INTEGER_VALUE;
1043 else if (nPosXEMU < MIN_INTEGER_VALUE)
1045 nPosXEMU = MIN_INTEGER_VALUE;
1047 m_pImpl->getSerializer()->write(nPosXEMU);
1048 m_pImpl->getSerializer()->endElementNS(XML_wp, XML_posOffset);
1050 m_pImpl->getSerializer()->endElementNS(XML_wp, XML_positionH);
1053 m_pImpl->getSerializer()->startElementNS(XML_wp, XML_positionV, XML_relativeFrom,
1055 sal_Int64 nPosYEMU = TwipsToEMU(aPos.Y);
1062 && (strcmp(relativeFromV,
"line") == 0 || strcmp(relativeFromV,
"paragraph") == 0)
1063 && (!alignV || strcmp(alignV,
"top") == 0))
1066 nPosYEMU = TwipsToEMU(1);
1069 if (alignV !=
nullptr)
1071 m_pImpl->getSerializer()->startElementNS(XML_wp, XML_align);
1072 m_pImpl->getSerializer()->write(alignV);
1073 m_pImpl->getSerializer()->endElementNS(XML_wp, XML_align);
1077 m_pImpl->getSerializer()->startElementNS(XML_wp, XML_posOffset);
1078 if (nPosYEMU > MAX_INTEGER_VALUE)
1080 nPosYEMU = MAX_INTEGER_VALUE;
1082 else if (nPosYEMU < MIN_INTEGER_VALUE)
1084 nPosYEMU = MIN_INTEGER_VALUE;
1086 m_pImpl->getSerializer()->write(nPosYEMU);
1087 m_pImpl->getSerializer()->endElementNS(XML_wp, XML_posOffset);
1089 m_pImpl->getSerializer()->endElementNS(XML_wp, XML_positionV);
1096 aAttrList->add(XML_distT, OString::number(0).getStr());
1097 aAttrList->add(XML_distB, OString::number(0).getStr());
1098 aAttrList->add(XML_distL, OString::number(0).getStr());
1099 aAttrList->add(XML_distR, OString::number(0).getStr());
1102 OUString sAnchorId = lclGetAnchorIdFromGrabBag(pObj);
1103 if (!sAnchorId.isEmpty())
1104 aAttrList->addNS(XML_wp14, XML_anchorId,
1107 m_pImpl->getSerializer()->startElementNS(XML_wp, XML_inline, aAttrList);
1128 sal_uInt64 cx = TwipsToEMU(
1131 sal_uInt64 cy = TwipsToEMU(
1135 m_pImpl->getSerializer()->singleElementNS(XML_wp, XML_extent, XML_cx, aWidth, XML_cy, aHeight);
1145 sal_Int64 nLeftExtEMU = TwipsToEMU(nLeftExt);
1146 sal_Int64 nTopExtEMU = TwipsToEMU(nTopExt);
1147 sal_Int64 nRightExtEMU = TwipsToEMU(nRightExt);
1148 sal_Int64 nBottomExtEMU = TwipsToEMU(nBottomExt);
1154 auto it = aGrabBag.
find(
"CT_EffectExtent");
1155 if (it != aGrabBag.
end())
1158 sal_Int64 nLeftExtGrabBag(0);
1159 sal_Int64 nTopExtGrabBag(0);
1160 sal_Int64 nRightExtGrabBag(0);
1161 sal_Int64 nBottomExtGrabBag(0);
1162 for (
const std::pair<const OUString, uno::Any>& rDirection : aEffectExtent)
1164 if (rDirection.first ==
"l" && rDirection.second.has<sal_Int32>())
1165 nLeftExtGrabBag = rDirection.second.get<sal_Int32>();
1166 else if (rDirection.first ==
"t" && rDirection.second.has<sal_Int32>())
1167 nTopExtGrabBag = rDirection.second.get<sal_Int32>();
1168 else if (rDirection.first ==
"r" && rDirection.second.has<sal_Int32>())
1169 nRightExtGrabBag = rDirection.second.get<sal_Int32>();
1170 else if (rDirection.first ==
"b" && rDirection.second.has<sal_Int32>())
1171 nBottomExtGrabBag = rDirection.second.get<sal_Int32>();
1173 if (
abs(nLeftExtEMU - nLeftExtGrabBag) <= 635 &&
abs(nTopExtEMU - nTopExtGrabBag) <= 635
1174 &&
abs(nRightExtEMU - nRightExtGrabBag) <= 635)
1176 nLeftExtEMU = nLeftExtGrabBag;
1177 nTopExtEMU = nTopExtGrabBag;
1178 nRightExtEMU = nRightExtGrabBag;
1179 nBottomExtEMU = nBottomExtGrabBag;
1183 m_pImpl->getSerializer()->singleElementNS(
1184 XML_wp, XML_effectExtent, XML_l, OString::number(nLeftExtEMU), XML_t,
1185 OString::number(nTopExtEMU), XML_r, OString::number(nRightExtEMU), XML_b,
1186 OString::number(nBottomExtEMU));
1197 m_pImpl->getSerializer()->singleElementNS(XML_wp, XML_wrapNone);
1203 m_pImpl->getSerializer()->singleElementNS(XML_wp, XML_wrapTopAndBottom);
1211 case text::WrapTextMode_DYNAMIC:
1212 sWrapType = OUString(
"largest");
1214 case text::WrapTextMode_LEFT:
1215 sWrapType = OUString(
"left");
1217 case text::WrapTextMode_RIGHT:
1218 sWrapType = OUString(
"right");
1220 case text::WrapTextMode_PARALLEL:
1222 sWrapType = OUString(
"bothSides");
1234 m_pImpl->getSerializer()->singleElementNS(XML_wp, XML_wrapSquare, XML_wrapText, sWrapType);
1239 sal_Int32 nWrapToken
1249 if (pPolyPoly && pPolyPoly->
Count())
1255 m_pImpl->getSerializer()->startElementNS(XML_wp, nWrapToken, XML_wrapText,
1258 m_pImpl->getSerializer()->startElementNS(XML_wp, XML_wrapPolygon, XML_edited,
"0");
1259 m_pImpl->getSerializer()->singleElementNS(XML_wp, XML_start, XML_x,
1260 OString::number(aPoly[0].
X()), XML_y,
1261 OString::number(aPoly[0].
Y()));
1262 for (sal_uInt16
i = 1;
i < aPoly.
GetSize(); ++
i)
1263 m_pImpl->getSerializer()->singleElementNS(XML_wp, XML_lineTo, XML_x,
1264 OString::number(aPoly[
i].
X()), XML_y,
1265 OString::number(aPoly[
i].
Y()));
1266 m_pImpl->getSerializer()->endElementNS(XML_wp, XML_wrapPolygon);
1268 m_pImpl->getSerializer()->endElementNS(XML_wp, nWrapToken);
1282 auto it = aGrabBag.
find(
"CT_WrapPath");
1283 if (it != aGrabBag.
end())
1285 m_pImpl->getSerializer()->startElementNS(XML_wp, nWrapToken, XML_wrapText, sWrapType);
1287 m_pImpl->getSerializer()->startElementNS(XML_wp, XML_wrapPolygon, XML_edited,
"0");
1288 auto aSeqSeq = it->second.get<drawing::PointSequenceSequence>();
1289 const auto& rPoints = aSeqSeq[0];
1290 for (
auto i = rPoints.begin();
i != rPoints.end(); ++
i)
1292 const awt::Point& rPoint = *
i;
1293 m_pImpl->getSerializer()->singleElementNS(
1294 XML_wp, (
i == rPoints.begin() ? XML_start : XML_lineTo), XML_x,
1295 OString::number(rPoint.X), XML_y, OString::number(rPoint.Y));
1297 m_pImpl->getSerializer()->endElementNS(XML_wp, XML_wrapPolygon);
1299 m_pImpl->getSerializer()->endElementNS(XML_wp, nWrapToken);
1307 tools::Polygon aContour = lcl_CreateContourPolygon(const_cast<SdrObject*>(pObj));
1310 m_pImpl->getSerializer()->startElementNS(XML_wp, nWrapToken, XML_wrapText, sWrapType);
1313 m_pImpl->getSerializer()->startElementNS(XML_wp, XML_wrapPolygon, XML_edited,
"0");
1314 m_pImpl->getSerializer()->singleElementNS(XML_wp, XML_start, XML_x,
1315 OString::number(aContour.
GetPoint(0).getX()), XML_y,
1316 OString::number(aContour.
GetPoint(0).getY()));
1317 for (sal_uInt32
i = 1;
i < aContour.
GetSize();
i++)
1318 m_pImpl->getSerializer()->singleElementNS(
1319 XML_wp, XML_lineTo, XML_x, OString::number(aContour.
GetPoint(
i).getX()), XML_y,
1320 OString::number(aContour.
GetPoint(
i).getY()));
1321 m_pImpl->getSerializer()->endElementNS(XML_wp, XML_wrapPolygon);
1323 m_pImpl->getSerializer()->endElementNS(XML_wp, nWrapToken);
1329 if (
m_pImpl->getFlyFrameGraphic())
1337 m_pImpl->getSerializer()->endElementNS(XML_wp, isAnchor ? XML_anchor : XML_inline);
1339 m_pImpl->getSerializer()->endElementNS(XML_w, XML_drawing);
1340 m_pImpl->setDrawingOpen(
false);
1345 m_pImpl->getSerializer()->startElementNS(XML_w, XML_pict);
1355 m_pImpl->getExport().VMLExporter().AddSdrObject(
1356 *sdrObj, rFlow.GetValue(), rHoriOri.GetHoriOrient(), rVertOri.
GetVertOrient(),
1357 rHoriOri.GetRelationOrient(), rVertOri.
GetRelationOrient(), pAttrList.get(),
true);
1358 m_pImpl->getSerializer()->endElementNS(XML_w, XML_pict);
1363 const uno::Sequence<beans::PropertyValue> propList = lclGetProperty(xShape,
"InteropGrabBag");
1368 return std::any_of(propList.begin(), propList.end(), [](
const beans::PropertyValue& rProp) {
1369 return rProp.Name ==
"LockedCanvas";
1376 uno::Reference<drawing::XShape> xShape(const_cast<SdrObject*>(pSdrObject)->getUnoShape());
1380 m_pImpl->getExport().DocxAttrOutput().GetSdtEndBefore(pSdrObject);
1388 pDocPrAttrList->add(XML_id, OString::number(nAnchorId).getStr());
1390 if (!pSdrObject->
GetTitle().isEmpty())
1391 pDocPrAttrList->add(XML_title,
1394 pDocPrAttrList->add(XML_descr,
1399 pDocPrAttrList->add(XML_hidden, OString::number(1).getStr());
1401 pFS->startElementNS(XML_wp, XML_docPr, pDocPrAttrList);
1403 if (!sHyperlink.isEmpty())
1405 OUString sRelId =
m_pImpl->getExport().GetFilter().addRelation(
1409 pFS->singleElementNS(XML_a, XML_hlinkClick,
FSNS(XML_r, XML_id), sRelId,
1410 FSNS(XML_xmlns, XML_a),
1411 m_pImpl->getExport().GetFilter().getNamespaceURL(OOX_NS(dml)));
1413 pFS->endElementNS(XML_wp, XML_docPr);
1415 uno::Reference<lang::XServiceInfo> xServiceInfo(xShape, uno::UNO_QUERY_THROW);
1416 const char* pNamespace =
"http://schemas.microsoft.com/office/word/2010/wordprocessingShape";
1417 if (xServiceInfo->supportsService(
"com.sun.star.drawing.GroupShape"))
1418 pNamespace =
"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup";
1419 else if (xServiceInfo->supportsService(
"com.sun.star.drawing.GraphicObjectShape"))
1420 pNamespace =
"http://schemas.openxmlformats.org/drawingml/2006/picture";
1421 pFS->startElementNS(XML_a, XML_graphic,
FSNS(XML_xmlns, XML_a),
1422 m_pImpl->getExport().GetFilter().getNamespaceURL(OOX_NS(dml)));
1423 pFS->startElementNS(XML_a, XML_graphicData, XML_uri, pNamespace);
1427 pFS->startElementNS(
1428 XML_lc, XML_lockedCanvas,
FSNS(XML_xmlns, XML_lc),
1429 m_pImpl->getExport().GetFilter().getNamespaceURL(OOX_NS(dmlLockedCanvas)));
1431 m_pImpl->getExport().OutputDML(xShape);
1434 pFS->endElementNS(XML_lc, XML_lockedCanvas);
1435 pFS->endElementNS(XML_a, XML_graphicData);
1436 pFS->endElementNS(XML_a, XML_graphic);
1445 case text::RelOrientation::FRAME:
1448 case text::RelOrientation::PAGE_LEFT:
1450 sValue =
"outsideMargin";
1452 sValue =
"leftMargin";
1454 case text::RelOrientation::PAGE_RIGHT:
1456 sValue =
"insideMargin";
1458 sValue =
"rightMargin";
1460 case text::RelOrientation::PAGE_FRAME:
1465 pFS->startElementNS(XML_wp14, XML_sizeRelH, XML_relativeFrom, sValue);
1466 pFS->startElementNS(XML_wp14, XML_pctWidth);
1469 pFS->endElementNS(XML_wp14, XML_pctWidth);
1470 pFS->endElementNS(XML_wp14, XML_sizeRelH);
1477 case text::RelOrientation::FRAME:
1480 case text::RelOrientation::PAGE_PRINT_AREA:
1481 sValue =
"topMargin";
1483 case text::RelOrientation::PAGE_PRINT_AREA_BOTTOM:
1484 sValue =
"bottomMargin";
1486 case text::RelOrientation::PAGE_FRAME:
1491 pFS->startElementNS(XML_wp14, XML_sizeRelV, XML_relativeFrom, sValue);
1492 pFS->startElementNS(XML_wp14, XML_pctHeight);
1495 pFS->endElementNS(XML_wp14, XML_pctHeight);
1496 pFS->endElementNS(XML_wp14, XML_sizeRelV);
1505 if (aShadowItem.
GetLocation() == SvxShadowLocation::NONE)
1508 OString aShadowWidth(OString::number(
double(aShadowItem.
GetWidth()) / 20) +
"pt");
1512 case SvxShadowLocation::TopLeft:
1513 aOffset =
"-" + aShadowWidth +
",-" + aShadowWidth;
1515 case SvxShadowLocation::TopRight:
1516 aOffset = aShadowWidth +
",-" + aShadowWidth;
1518 case SvxShadowLocation::BottomLeft:
1519 aOffset =
"-" + aShadowWidth +
"," + aShadowWidth;
1521 case SvxShadowLocation::BottomRight:
1522 aOffset = aShadowWidth +
"," + aShadowWidth;
1524 case SvxShadowLocation::NONE:
1525 case SvxShadowLocation::End:
1528 if (aOffset.isEmpty())
1532 m_pSerializer->singleElementNS(XML_v, XML_shadow, XML_on,
"t", XML_color,
"#" + aShadowColor,
1533 XML_offset, aOffset);
1538 uno::Reference<lang::XServiceInfo> xServiceInfo(xShape, uno::UNO_QUERY_THROW);
1539 if (xServiceInfo->supportsService(
"com.sun.star.drawing.PolyPolygonShape")
1540 || xServiceInfo->supportsService(
"com.sun.star.drawing.PolyLineShape"))
1544 if (xServiceInfo->supportsService(
"com.sun.star.drawing.GraphicObjectShape"))
1546 uno::Reference<beans::XPropertySet> xShapeProperties(xShape, uno::UNO_QUERY);
1547 bool bIsSignatureLineShape =
false;
1548 xShapeProperties->getPropertyValue(
"IsSignatureLine") >>= bIsSignatureLineShape;
1549 if (bIsSignatureLineShape)
1559 bool bDMLAndVMLDrawingOpen =
m_pImpl->getDMLAndVMLDrawingOpen();
1560 m_pImpl->setDMLAndVMLDrawingOpen(
true);
1563 OUString sShapeType;
1564 ShapeFlag nMirrorFlags = ShapeFlag::NONE;
1565 uno::Reference<drawing::XShape> xShape(const_cast<SdrObject*>(sdrObj)->getUnoShape());
1575 m_pImpl->getSerializer()->startElementNS(XML_mc, XML_AlternateContent);
1577 auto pObjGroup =
dynamic_cast<const SdrObjGroup*
>(sdrObj);
1578 m_pImpl->getSerializer()->startElementNS(XML_mc, XML_Choice, XML_Requires,
1579 (pObjGroup ?
"wpg" :
"wps"));
1581 m_pImpl->getSerializer()->endElementNS(XML_mc, XML_Choice);
1583 m_pImpl->getSerializer()->startElementNS(XML_mc, XML_Fallback);
1585 m_pImpl->getSerializer()->endElementNS(XML_mc, XML_Fallback);
1587 m_pImpl->getSerializer()->endElementNS(XML_mc, XML_AlternateContent);
1592 m_pImpl->setDMLAndVMLDrawingOpen(bDMLAndVMLDrawingOpen);
1600 sal_Int32 nAlphaPercent = float(rColor.
GetAlpha()) / 2.55;
1612 if (aShadowItem.
GetLocation() == SvxShadowLocation::NONE)
1617 = sqrt(static_cast<double>(aShadowItem.
GetWidth()) * aShadowItem.
GetWidth() * 2.0);
1618 OString aShadowDist(OString::number(TwipsToEMU(nShadowDist)));
1621 sal_uInt32 nShadowDir = 0;
1624 case SvxShadowLocation::TopLeft:
1625 nShadowDir = 13500000;
1627 case SvxShadowLocation::TopRight:
1628 nShadowDir = 18900000;
1630 case SvxShadowLocation::BottomLeft:
1631 nShadowDir = 8100000;
1633 case SvxShadowLocation::BottomRight:
1634 nShadowDir = 2700000;
1636 case SvxShadowLocation::NONE:
1637 case SvxShadowLocation::End:
1640 OString aShadowDir(OString::number(nShadowDir));
1642 m_pImpl->getSerializer()->startElementNS(XML_a, XML_effectLst);
1643 m_pImpl->getSerializer()->startElementNS(XML_a, XML_outerShdw, XML_dist, aShadowDist, XML_dir,
1645 if (aShadowAlpha.isEmpty())
1646 m_pImpl->getSerializer()->singleElementNS(XML_a, XML_srgbClr, XML_val, aShadowColor);
1649 m_pImpl->getSerializer()->startElementNS(XML_a, XML_srgbClr, XML_val, aShadowColor);
1650 m_pImpl->getSerializer()->singleElementNS(XML_a, XML_alpha, XML_val, aShadowAlpha);
1651 m_pImpl->getSerializer()->endElementNS(XML_a, XML_srgbClr);
1653 m_pImpl->getSerializer()->endElementNS(XML_a, XML_outerShdw);
1654 m_pImpl->getSerializer()->endElementNS(XML_a, XML_effectLst);
1660 uno::Reference<drawing::XShape> xShape(const_cast<SdrObject*>(sdrObject)->getUnoShape(),
1668 m_pImpl->getDrawingML()->WriteDiagram(xShape, nDiagramId);
1687 m_pImpl->getExport().WriteText();
1696 pBorderLine = rBox.
GetTop();
1719 OString sWidth(OString::number(TwipsToEMU(fConverted)));
1720 pFS->startElementNS(XML_a, XML_ln, XML_w, sWidth);
1722 pFS->startElementNS(XML_a, XML_solidFill);
1724 pFS->singleElementNS(XML_a, XML_srgbClr, XML_val, sColor);
1725 pFS->endElementNS(XML_a, XML_solidFill);
1728 pFS->singleElementNS(XML_a, XML_prstDash, XML_val,
"dash");
1730 pFS->endElementNS(XML_a, XML_ln);
1736 bool bDMLAndVMLDrawingOpen =
m_pImpl->getDMLAndVMLDrawingOpen();
1737 m_pImpl->setDMLAndVMLDrawingOpen(IsAnchorTypeInsideParagraph(pParentFrame));
1753 uno::Reference<drawing::XShape> xShape;
1756 xShape.set(const_cast<SdrObject*>(pSdrObj)->getUnoShape(), uno::UNO_QUERY);
1757 uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY);
1758 uno::Reference<beans::XPropertySetInfo> xPropSetInfo;
1759 if (xPropertySet.is())
1760 xPropSetInfo = xPropertySet->getPropertySetInfo();
1764 drawing::TextVerticalAdjust eAdjust = drawing::TextVerticalAdjust_TOP;
1765 if (xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(
"TextVerticalAdjust"))
1766 xPropertySet->getPropertyValue(
"TextVerticalAdjust") >>= eAdjust;
1767 m_pImpl->getBodyPrAttrList()->add(XML_anchor,
1777 pDocPrAttrList->add(XML_id, OString::number(nAnchorId).getStr());
1778 pDocPrAttrList->add(XML_name,
1781 pFS->startElementNS(XML_wp, XML_docPr, pDocPrAttrList);
1783 OUString sHyperlink;
1784 if (xPropertySet.is())
1785 xPropertySet->getPropertyValue(
"HyperLinkURL") >>= sHyperlink;
1786 if (!sHyperlink.isEmpty())
1788 OUString sRelId =
m_pImpl->getExport().GetFilter().addRelation(
1792 pFS->singleElementNS(XML_a, XML_hlinkClick,
FSNS(XML_r, XML_id), sRelId,
1793 FSNS(XML_xmlns, XML_a),
1794 m_pImpl->getExport().GetFilter().getNamespaceURL(OOX_NS(dml)));
1797 pFS->endElementNS(XML_wp, XML_docPr);
1799 pFS->startElementNS(XML_a, XML_graphic,
FSNS(XML_xmlns, XML_a),
1800 m_pImpl->getExport().GetFilter().getNamespaceURL(OOX_NS(dml)));
1801 pFS->startElementNS(XML_a, XML_graphicData, XML_uri,
1802 "http://schemas.microsoft.com/office/word/2010/wordprocessingShape");
1803 pFS->startElementNS(XML_wps, XML_wsp);
1804 pFS->singleElementNS(XML_wps, XML_cNvSpPr, XML_txBox,
"1");
1807 m_pImpl->setDMLandVMLTextFrameRotation(0_deg100);
1808 if (xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(
"FrameInteropGrabBag"))
1810 uno::Sequence<beans::PropertyValue> propList;
1811 xPropertySet->getPropertyValue(
"FrameInteropGrabBag") >>= propList;
1812 auto pProp = std::find_if(std::cbegin(propList), std::cend(propList),
1813 [](
const beans::PropertyValue& rProp) {
1814 return rProp.Name ==
"mso-rotation-angle";
1816 if (pProp != std::cend(propList))
1817 aRotation = pProp->
Value;
1820 if (aRotation >>= nTmp)
1822 OString sRotation(OString::number(
1825 pFS->startElementNS(XML_wps, XML_spPr);
1826 if (
m_pImpl->getDMLandVMLTextFrameRotation())
1828 pFS->startElementNS(XML_a, XML_xfrm, XML_rot, sRotation);
1832 pFS->startElementNS(XML_a, XML_xfrm);
1834 pFS->singleElementNS(XML_a, XML_off, XML_x,
"0", XML_y,
"0");
1835 OString aWidth(OString::number(TwipsToEMU(aSize.Width())));
1836 OString aHeight(OString::number(TwipsToEMU(aSize.Height())));
1837 pFS->singleElementNS(XML_a, XML_ext, XML_cx, aWidth, XML_cy, aHeight);
1838 pFS->endElementNS(XML_a, XML_xfrm);
1839 OUString shapeType =
"rect";
1840 if (xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(
"FrameInteropGrabBag"))
1842 uno::Sequence<beans::PropertyValue> propList;
1843 xPropertySet->getPropertyValue(
"FrameInteropGrabBag") >>= propList;
1844 auto pProp = std::find_if(std::cbegin(propList), std::cend(propList),
1845 [](
const beans::PropertyValue& rProp) {
1846 return rProp.Name ==
"mso-orig-shape-type";
1848 if (pProp != std::cend(propList))
1849 pProp->Value >>= shapeType;
1852 if (shapeType.isEmpty())
1855 pFS->singleElementNS(XML_a, XML_prstGeom, XML_prst, shapeType);
1856 m_pImpl->setDMLTextFrameSyntax(
true);
1858 m_pImpl->setDMLTextFrameSyntax(
false);
1860 pFS->endElementNS(XML_wps, XML_spPr);
1864 if (!
m_pImpl->getExport().m_bLinkedTextboxesHelperInitialized)
1867 for (
auto& rEntry :
m_pImpl->getExport().m_aLinkedTextboxesHelper)
1870 if (rEntry.second.sPrevChain.isEmpty() && !rEntry.second.sNextChain.isEmpty())
1874 rEntry.second.nId = ++
m_pImpl->getExport().m_nLinkedTextboxesChainId;
1875 rEntry.second.nSeq = nSeq;
1877 OUString sCheckForBrokenChains = rEntry.first;
1880 auto followChainIter
1881 =
m_pImpl->getExport().m_aLinkedTextboxesHelper.find(rEntry.second.sNextChain);
1882 while (followChainIter !=
m_pImpl->getExport().m_aLinkedTextboxesHelper.end())
1886 if (followChainIter->second.sPrevChain != sCheckForBrokenChains)
1889 followChainIter->second.nId =
m_pImpl->getExport().m_nLinkedTextboxesChainId;
1890 followChainIter->second.nSeq = ++nSeq;
1893 if (followChainIter->second.sNextChain.isEmpty())
1896 sCheckForBrokenChains = followChainIter->first;
1897 followChainIter =
m_pImpl->getExport().m_aLinkedTextboxesHelper.find(
1898 followChainIter->second.sNextChain);
1902 m_pImpl->getExport().m_bLinkedTextboxesHelperInitialized =
true;
1905 m_pImpl->getExport().m_pParentFrame =
nullptr;
1906 bool skipTxBxContent =
false;
1907 bool isTxbxLinked =
false;
1909 OUString sLinkChainName;
1910 if (xPropSetInfo.is())
1912 if (xPropSetInfo->hasPropertyByName(
"LinkDisplayName"))
1913 xPropertySet->getPropertyValue(
"LinkDisplayName") >>= sLinkChainName;
1914 else if (xPropSetInfo->hasPropertyByName(
"ChainName"))
1915 xPropertySet->getPropertyValue(
"ChainName") >>= sLinkChainName;
1919 auto linkedTextboxesIter =
m_pImpl->getExport().m_aLinkedTextboxesHelper.find(sLinkChainName);
1920 if (linkedTextboxesIter !=
m_pImpl->getExport().m_aLinkedTextboxesHelper.end())
1922 if ((linkedTextboxesIter->second.nId != 0) && (linkedTextboxesIter->second.nSeq != 0))
1925 pFS->singleElementNS(XML_wps, XML_linkedTxbx, XML_id,
1926 OString::number(linkedTextboxesIter->second.nId), XML_seq,
1927 OString::number(linkedTextboxesIter->second.nSeq));
1932 skipTxBxContent =
true;
1934 else if ((linkedTextboxesIter->second.nId != 0) && (linkedTextboxesIter->second.nSeq == 0))
1939 pFS->startElementNS(XML_wps, XML_txbx, XML_id,
1940 OString::number(linkedTextboxesIter->second.nId));
1941 isTxbxLinked =
true;
1945 if (!skipTxBxContent)
1948 pFS->startElementNS(XML_wps, XML_txbx);
1950 pFS->startElementNS(XML_w, XML_txbxContent);
1953 if (rDirection.GetValue() == SvxFrameDirection::Vertical_RL_TB)
1954 m_pImpl->getBodyPrAttrList()->add(XML_vert,
"eaVert");
1955 else if (rDirection.GetValue() == SvxFrameDirection::Vertical_LR_BT)
1956 m_pImpl->getBodyPrAttrList()->add(XML_vert,
"vert270");
1961 m_pImpl->getExport().WriteText();
1962 if (
m_pImpl->getParagraphSdtOpen())
1964 m_pImpl->getExport().DocxAttrOutput().EndParaSdtBlock();
1965 m_pImpl->setParagraphSdtOpen(
false);
1969 pFS->endElementNS(XML_w, XML_txbxContent);
1970 pFS->endElementNS(XML_wps, XML_txbx);
1976 if (
m_pImpl->getBodyPrAttrList())
1978 if (!
m_pImpl->getBodyPrAttrList()->hasAttribute(XML_lIns))
1979 m_pImpl->getBodyPrAttrList()->add(XML_lIns, OString::number(0));
1980 if (!
m_pImpl->getBodyPrAttrList()->hasAttribute(XML_tIns))
1981 m_pImpl->getBodyPrAttrList()->add(XML_tIns, OString::number(0));
1982 if (!
m_pImpl->getBodyPrAttrList()->hasAttribute(XML_rIns))
1983 m_pImpl->getBodyPrAttrList()->add(XML_rIns, OString::number(0));
1984 if (!
m_pImpl->getBodyPrAttrList()->hasAttribute(XML_bIns))
1985 m_pImpl->getBodyPrAttrList()->add(XML_bIns, OString::number(0));
1989 m_pImpl->setBodyPrAttrList(
nullptr);
1992 pFS->startElementNS(XML_wps, XML_bodyPr, xBodyPrAttrList);
1995 pFS->singleElementNS(
1998 pFS->endElementNS(XML_wps, XML_bodyPr);
2000 pFS->endElementNS(XML_wps, XML_wsp);
2001 pFS->endElementNS(XML_a, XML_graphicData);
2002 pFS->endElementNS(XML_a, XML_graphic);
2008 pFS->startElementNS(XML_wp14, XML_sizeRelH, XML_relativeFrom,
2012 pFS->startElementNS(XML_wp14, XML_pctWidth);
2014 pFS->endElementNS(XML_wp14, XML_pctWidth);
2015 pFS->endElementNS(XML_wp14, XML_sizeRelH);
2020 pFS->startElementNS(
2021 XML_wp14, XML_sizeRelV, XML_relativeFrom,
2024 pFS->startElementNS(XML_wp14, XML_pctHeight);
2026 pFS->endElementNS(XML_wp14, XML_pctHeight);
2027 pFS->endElementNS(XML_wp14, XML_sizeRelV);
2032 m_pImpl->setDMLAndVMLDrawingOpen(bDMLAndVMLDrawingOpen);
2037 bool bDMLAndVMLDrawingOpen =
m_pImpl->getDMLAndVMLDrawingOpen();
2038 m_pImpl->setDMLAndVMLDrawingOpen(IsAnchorTypeInsideParagraph(pParentFrame));
2053 m_pImpl->setFlyFrameSize(&aSize);
2055 m_pImpl->setTextFrameSyntax(
true);
2058 m_pImpl->getTextFrameStyle() =
"position:absolute";
2061 OString sRotation(OString::number(-
toDegrees(
m_pImpl->getDMLandVMLTextFrameRotation())));
2062 m_pImpl->getExport().SdrExporter().getTextFrameStyle().append(
";rotation:" + sRotation);
2065 m_pImpl->getFlyAttrList()->add(XML_style,
m_pImpl->getTextFrameStyle().makeStringAndClear());
2068 if (pObject !=
nullptr)
2070 OUString sAnchorId = lclGetAnchorIdFromGrabBag(pObject);
2071 if (!sAnchorId.isEmpty())
2072 m_pImpl->getFlyAttrList()->addNS(XML_w14, XML_anchorId,
2075 uno::Reference<drawing::XShape> xShape(const_cast<SdrObject*>(pObject)->getUnoShape(),
2077 uno::Reference<beans::XPropertySet> xShapeProps(xShape, uno::UNO_QUERY);
2078 OUString sHyperlink;
2079 if (xShapeProps.is())
2080 xShapeProps->getPropertyValue(
"HyperLinkURL") >>= sHyperlink;
2081 if (!sHyperlink.isEmpty())
2082 m_pImpl->getFlyAttrList()->add(XML_href,
2086 m_pImpl->getFlyAttrList().clear();
2088 m_pImpl->getTextboxAttrList().clear();
2089 m_pImpl->setTextFrameSyntax(
false);
2090 m_pImpl->setFlyFrameSize(
nullptr);
2091 m_pImpl->getExport().m_pParentFrame =
nullptr;
2095 pFS->startElementNS(XML_w, XML_pict);
2096 pFS->startElementNS(XML_v, XML_rect, xFlyAttrList);
2097 m_pImpl->textFrameShadow(rFrameFormat);
2098 if (
m_pImpl->getFlyFillAttrList().is())
2101 pFS->singleElementNS(XML_v, XML_fill, xFlyFillAttrList);
2103 if (
m_pImpl->getDashLineStyleAttr().is())
2106 pFS->singleElementNS(XML_v, XML_stroke, xDashLineStyleAttr);
2108 pFS->startElementNS(XML_v, XML_textbox, xTextboxAttrList);
2110 m_pImpl->getFlyFillAttrList().clear();
2111 m_pImpl->getDashLineStyleAttr().clear();
2113 pFS->startElementNS(XML_w, XML_txbxContent);
2117 m_pImpl->getExport().WriteText();
2118 if (
m_pImpl->getParagraphSdtOpen())
2120 m_pImpl->getExport().DocxAttrOutput().EndParaSdtBlock();
2121 m_pImpl->setParagraphSdtOpen(
false);
2124 pFS->endElementNS(XML_w, XML_txbxContent);
2127 pFS->endElementNS(XML_v, XML_textbox);
2129 if (
m_pImpl->getFlyWrapAttrList())
2132 m_pImpl->setFlyWrapAttrList(
nullptr);
2133 pFS->singleElementNS(XML_w10, XML_wrap, xFlyWrapAttrList);
2136 pFS->endElementNS(XML_v, XML_rect);
2137 pFS->endElementNS(XML_w, XML_pict);
2140 m_pImpl->setDMLAndVMLDrawingOpen(bDMLAndVMLDrawingOpen);
bool getTextFrameSyntax() const
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
void writeDMLAndVMLDrawing(const SdrObject *sdrObj, const SwFrameFormat &rFrameFormat, int nAnchorId)
Writes shape in both DML and VML format.
sax_fastparser::FastAttributeList * getFlyWrapAttrList() const
Helper class, so that the DocxExport::RestoreData() call will always happen.
SwNoTextNode * GetNoTextNodeFromSwFrameFormat(const SwFrameFormat &rFormat)
Get the SwNoTextNode associated with a SwFrameFormat if here is one.
static bool lcl_isLockedCanvas(const uno::Reference< drawing::XShape > &xShape)
SwNodeOffset EndOfSectionIndex() const
bool getParagraphHasDrawing() const
bool IsDrawingOpen() const
sal_uInt8 GetAlpha() const
virtual const tools::Rectangle & GetCurrentBoundRect() const
void setFlyWrapAttrList(rtl::Reference< sax_fastparser::FastAttributeList > const &pFlyWrapAttrList)
sal_uInt16 GetLower() const
const Size * m_pFlyFrameSize
double ConvertBorderWidthToWord(SvxBorderLineStyle, double)
std::unique_ptr< Impl > m_pImpl
TextVerticalAdjust GetTextVerticalAdjust(sal_Int32 nToken)
const sal_Int32 PER_PERCENT
void endDMLAnchorInline(const SwFrameFormat *pFrameFormat)
bool IsTransparent() const
oox::drawingml::DrawingML * m_pDrawingML
bool getDMLTextFrameSyntax() const
rtl::Reference< sax_fastparser::FastAttributeList > & getFlyAttrList()
sal_Int32 ExportRotateClockwisify(Degree100 input)
tools::Long GetRight() const
void writeDMLEffectLst(const SwFrameFormat &rFrameFormat)
OUString GetDescription() const
const SwFormatAnchor & GetAnchor(bool=true) const
tools::Long GetWidth() const
virtual void SaveData(SwNodeOffset nStt, SwNodeOffset nEnd)
Remember some of the members so that we can recurse in WriteText().
Holds data used by DocxSdrExport only.
void setFlyAttrList(const rtl::Reference< sax_fastparser::FastAttributeList > &pFlyAttrList)
const OUString & getHyperlink() const
bool IsParagraphHasDrawing() const
Of course Writer needs its own rectangles.
virtual SdrObjKind GetObjIdentifier() const
const editeng::SvxBorderLine * GetRight() const
SwNodeOffset abs(const SwNodeOffset &a)
The class that does all the actual DOCX export-related work.
sax_fastparser::FastAttributeList * getBodyPrAttrList()
Attributes of , used during DML export of text frames.
EmbeddedObjectRef * pObject
bool getParagraphSdtOpen() const
void startDMLAnchorInline(const SwFrameFormat *pFrameFormat, const Size &rSize)
UseOnPage GetUseOn() const
tools::Polygon PolygonFromPolyPolygon(const tools::PolyPolygon &rPolyPoly)
Make a best fit Polygon from a PolyPolygon.
rtl::Reference< sax_fastparser::FastAttributeList > & getFlyFillAttrList()
void writeDiagram(const SdrObject *sdrObject, const SwFrameFormat &rFrameFormat, int nDiagramId)
Writes a diagram (smartart).
void setFlyWrapAttrList(rtl::Reference< sax_fastparser::FastAttributeList > const &pAttrList)
void setDMLAndVMLDrawingOpen(bool bDMLAndVMLDrawingOpen)
constexpr TypedWhichId< SwFlyFrameFormat > RES_FLYFRMFMT(156)
static bool isTextBox(const SwFrameFormat &rFrameFormat)
Is this a standalone TextFrame, or used as a TextBox of a shape?
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
void writeDMLTextFrame(ww8::Frame const *pParentFrame, int nAnchorId, bool bTextBoxOnly=false)
Writes text frame in DML format.
virtual const tools::Rectangle & GetSnapRect() const
constexpr tools::Long Width() const
bool getDMLAndVMLDrawingOpen() const
SvxShadowLocation GetLocation() const
B2DHomMatrix createScaleB2DHomMatrix(double fScaleX, double fScaleY)
bool getDMLTextFrameSyntax() const
Degree100 & getDMLandVMLTextFrameRotation()
oox::drawingml::DrawingML * getDrawingML() const
Degree100 m_nDMLandVMLTextFrameRotation
List of TextBoxes in this document: they are exported as part of their shape, never alone...
bool m_bParagraphHasDrawing
const Size * getFlyFrameSize() const
static bool isTextBox(const SwFrameFormat *pFormat, sal_uInt16 nType, const SdrObject *pObject=nullptr)
Is the frame format a text box?
bool HasTextBoxContent(sal_uInt32 nShapeType)
SwNodeOffset GetIndex() const
rtl::Reference< sax_fastparser::FastAttributeList > m_pBodyPrAttrList
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
OUString getRelationship(Relationship eRelationship)
const OUStringLiteral sColor
ExportDataSaveRestore(DocxExport &rExport, SwNodeOffset nStt, SwNodeOffset nEnd, ww8::Frame const *pParentFrame)
DocxSdrExport(DocxExport &rExport, const sax_fastparser::FSHelperPtr &pSerializer, oox::drawingml::DrawingML *pDrawingML)
void setParagraphSdtOpen(bool bParagraphSdtOpen)
const SwFrameFormat & GetFrameFormat() const
Get the writer SwFrameFormat that this object describes.
rtl::Reference< FastAttributeList > SurroundToVMLWrap(SwFormatSurround const &rSurround)
Impl(DocxExport &rExport, sax_fastparser::FSHelperPtr pSerializer, oox::drawingml::DrawingML *pDrawingML)
virtual SdrLayerID GetInvisibleHellId() const =0
const sax_fastparser::FSHelperPtr & getSerializer() const
void setParagraphHasDrawing(bool bParagraphHasDrawing)
const Color & GetColor() const
rtl::Reference< sax_fastparser::FastAttributeList > & getTextboxAttrList()
Attributes of the next v:textbox element.
const editeng::SvxBorderLine * GetTop() const
tools::Polygon CorrectWordWrapPolygonForExport(const tools::PolyPolygon &rPolyPoly, const SwNoTextNode *pNd, bool bCorrectCrop)
Undo all scaling / move tricks of the wrap polygon done during import.
static rtl::Reference< FastAttributeList > createAttrList()
rtl::Reference< sax_fastparser::FastAttributeList > m_pTextboxAttrList
virtual void RestoreData()
Restore what was saved in SaveData().
const editeng::SvxBorderLine * GetLeft() const
rtl::Reference< sax_fastparser::FastAttributeList > & getFlyAttrList()
OStringBuffer & getTextFrameStyle()
rtl::Reference< sax_fastparser::FastAttributeList > m_pFlyWrapAttrList
void setFlyFrameSize(const Size *pFlyFrameSize)
const SwPageDesc & GetPageDesc(const size_t i) const
const Color & GetColor() const
bool getDrawingOpen() const
void setSerializer(const sax_fastparser::FSHelperPtr &pSerializer)
tools::Long GetLeft() const
const ww8::Frame * m_pParentFrame
OUString GetTitle() const
bool getTextFrameSyntax() const
void transform(const basegfx::B2DHomMatrix &rMatrix)
sal_uInt32 GetOrdNum() const
OStringBuffer & getTextFrameStyle()
bool m_bDMLTextFrameSyntax
OString ConvertColor(const Color &rColor)
Layout frame for SwNoTextNode, i.e. graphics and OLE nodes (including charts).
Marks a node in the document model.
void setDMLandVMLTextFrameRotation(Degree100 nDMLandVMLTextFrameRotation)
bool IsDMLAndVMLDrawingOpen() const
rtl::Reference< sax_fastparser::FastAttributeList > & getFlyFillAttrList()
std::shared_ptr< FastSerializerHelper > FSHelperPtr
void textFrameShadow(const SwFrameFormat &rFrameFormat)
Writes wp wrapper code around an SdrObject, which itself is written using drawingML syntax...
rtl::Reference< sax_fastparser::FastAttributeList > m_pFlyAttrList
const double * GetRelativeWidth() const
sax_fastparser::FSHelperPtr m_pSerializer
sal_Int16 GetRelativeWidthRelation() const
Degree100 NormAngle36000(Degree100 a)
virtual SdrLayerID GetHellId() const =0
virtual SdrLayerID GetLayer() const
const SwNodeIndex * GetContentIdx() const
void setParagraphSdtOpen(bool bParagraphSdtOpen)
Set if paragraph sdt open in the current drawing.
rtl::Reference< sax_fastparser::FastAttributeList > m_pDashLineStyleAttr
void append(const B2DPolygon &rPolygon, sal_uInt32 nCount=1)
void writeVMLTextFrame(ww8::Frame const *pParentFrame, bool bTextBoxOnly=false)
Writes text frame in VML format.
SdrObjectUniquePtr ConvertToPolyObj(bool bBezier, bool bLineToArea) const
rtl::Reference< sax_fastparser::FastAttributeList > & getDashLineStyle()
void setBodyPrAttrList(sax_fastparser::FastAttributeList *pBodyPrAttrList)
iterator find(const OUString &rKey)
void GetGrabBagItem(css::uno::Any &rVal) const
constexpr tools::Long Height() const
void writeDMLDrawing(const SdrObject *pSdrObject, const SwFrameFormat *pFrameFormat, int nAnchorId)
Writes a drawing as DML.
Make exporting a Writer Frame easy.
rtl::Reference< sax_fastparser::FastAttributeList > m_pFlyFillAttrList
Flag for checking drawing in a paragraph.
void writeOnlyTextOfFrame(ww8::Frame const *pParentFrame)
Writes text from Textbox for
void setTextFrameSyntax(bool bTextFrameSyntax)
void setTextboxAttrList(const rtl::Reference< sax_fastparser::FastAttributeList > &pTextboxAttrList)
const Size & GetSize() const
The Size of the contained element.
void writeBoxItemLine(const SvxBoxItem &rBox)
Writes the drawingML
markup of a box item.
std::unique_ptr< SdrObject, SdrObjectFreeOp > SdrObjectUniquePtr
o3tl::strong_int< sal_Int32, struct Tag_SwNodeOffset > SwNodeOffset
sax_fastparser::FastAttributeList * getBodyPrAttrList() const
void setDMLTextFrameSyntax(bool bDMLTextFrameSyntax)
const basegfx::B2DPolyPolygon & GetPathPoly() const
constexpr sal_Int32 FSNS(sal_Int32 namespc, sal_Int32 element)
void setSerializer(const sax_fastparser::FSHelperPtr &pSerializer)
void writeVMLDrawing(const SdrObject *sdrObj, const SwFrameFormat &rFrameFormat)
Writes a drawing as VML data.
SvxBorderLineStyle GetBorderLineStyle() const
static bool isSupportedDMLShape(const uno::Reference< drawing::XShape > &xShape)
rtl::Reference< sax_fastparser::FastAttributeList > & getTextboxAttrList()
sal_Int16 GetRelativeHeightRelation() const
virtual Degree100 GetRotateAngle() const
virtual const tools::Rectangle & GetLogicRect() const
bool getFlyFrameGraphic() const
OStringBuffer m_aTextFrameStyle
Frame is variable in Var-direction.
B2DHomMatrix createTranslateB2DHomMatrix(double fTranslateX, double fTranslateY)
bool m_bDMLAndVMLDrawingOpen
void setDrawingOpen(bool bDrawingOpen)
void setParagraphHasDrawing(bool bParagraphHasDrawing)
const OUString & GetName() const
const editeng::SvxBorderLine * GetBottom() const
const Size * getFlyFrameSize() const
When exporting fly frames, this holds the real size of the frame.
static MSO_SPT GetCustomShapeType(const css::uno::Reference< css::drawing::XShape > &rXShape, ShapeFlag &nMirrorFlags, OUString &rShapeType, bool bOOXML=false)
const double * GetRelativeHeight() const
rtl::Reference< sax_fastparser::FastAttributeList > & getDashLineStyleAttr()
sal_uInt16 GetUpper() const
DocxExport & getExport() const
bool m_bDetectedRangeSegmentation false
sal_uInt16 GetWidth() const
static OString lcl_TransparencyToDrawingMlAlpha(const Color &rColor)