11#include <com/sun/star/beans/XPropertySet.hpp>
12#include <com/sun/star/drawing/PointSequenceSequence.hpp>
24#include <oox/token/namespaces.hxx>
52uno::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;
70OUString 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;
90void 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;
130bool IsAnchorTypeInsideParagraph(
const ww8::Frame* pFrame)
133 return rAnchor.
GetAnchorId() != RndStdIds::FLY_AT_PAGE;
136bool 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:
153void 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;
185void 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;
207bool 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)
242bool 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;
253void 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);
269void 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();
321 = pLineGeometryObj->ConvertToPolyObj(
false,
false);
330 if (!aPolyPolygon.
count())
337 aPolyPolygon.
transform(aTranslateToOrigin);
339 double fScaleX = fWidth == 0.0 ? 1.0 : 21600.0 / fWidth;
341 double fScaleY = fHeight == 0.0 ? 1.0 : 21600.0 / fHeight;
347 aPolyPolygon.
transform(aTranslateToCenter);
350 case SdrObjKind::Line:
357 case SdrObjKind::PathFill:
358 case SdrObjKind::PathLine:
359 case SdrObjKind::FreehandFill:
360 case SdrObjKind::FreehandLine:
361 case SdrObjKind::PathPoly:
362 case SdrObjKind::PathPolyLine:
381 aPolyPolygon.
append(aReverse);
388 aPolyPolygon.
transform(aTranslateToOrigin);
391 double fScaleX = fWidth == 0.0 ? 1.0 : 21600.0 / fWidth;
393 double fScaleY = fHeight == 0.0 ? 1.0 : 21600.0 / fHeight;
400 aPolyPolygon.
transform(aTranslateToCenter);
403 case SdrObjKind::NONE:
604 :
m_pImpl(
std::make_unique<
Impl>(rExport, pSerializer, pDrawingML))
612 m_pImpl->setSerializer(pSerializer);
623 return m_pImpl->getFlyAttrList();
628 return m_pImpl->getTextboxAttrList();
637 m_pImpl->setParagraphSdtOpen(bParagraphSdtOpen);
646 m_pImpl->setParagraphHasDrawing(bParagraphHasDrawing);
651 return m_pImpl->getFlyFillAttrList();
656 return m_pImpl->getBodyPrAttrList();
661 return m_pImpl->getDashLineStyleAttr();
667 m_pImpl->setFlyWrapAttrList(pAttrList);
675 m_pImpl->setParagraphHasDrawing(
true);
676 m_pImpl->getSerializer()->startElementNS(XML_w, XML_drawing);
686 if (
m_pImpl->getFlyFrameGraphic())
699 sal_Int64 nDistT = aULSpaceItem.
GetUpper();
700 sal_Int64 nDistB = aULSpaceItem.
GetLower();
701 sal_Int64 nDistL = aLRSpaceItem.
GetLeft();
702 sal_Int64 nDistR = aLRSpaceItem.
GetRight();
707 sal_Int32 nWidthDiff(0);
708 sal_Int32 nHeightDiff(0);
709 sal_Int32 nPosXDiff(0);
710 sal_Int32 nPosYDiff(0);
711 sal_Int32 nLeftExt(0);
712 sal_Int32 nRightExt(0);
713 sal_Int32 nTopExt(0);
714 sal_Int32 nBottomExt(0);
716 if ((!pObj) || (pObj && (pObj->
GetObjIdentifier() == SdrObjKind::SwFlyDrawObjIdentifier)))
721 if (aShadowItem.
GetLocation() != SvxShadowLocation::NONE)
723 sal_Int32 nShadowWidth(aShadowItem.
GetWidth());
726 case SvxShadowLocation::TopLeft:
727 nTopExt = nLeftExt = nShadowWidth;
728 nPosXDiff = nLeftExt;
730 nWidthDiff = -nLeftExt;
731 nHeightDiff = -nTopExt;
733 case SvxShadowLocation::TopRight:
734 nTopExt = nRightExt = nShadowWidth;
736 nWidthDiff = -nRightExt;
737 nHeightDiff = -nTopExt;
739 case SvxShadowLocation::BottomLeft:
740 nBottomExt = nLeftExt = nShadowWidth;
741 nPosXDiff = nLeftExt;
742 nWidthDiff = -nLeftExt;
743 nHeightDiff = -nBottomExt;
745 case SvxShadowLocation::BottomRight:
746 nBottomExt = nRightExt = nShadowWidth;
747 nWidthDiff = -nRightExt;
748 nHeightDiff = -nBottomExt;
750 case SvxShadowLocation::NONE:
751 case SvxShadowLocation::End:
766 if ((nRotation > 4500_deg100 && nRotation <= 13500_deg100)
767 || (nRotation > 22500_deg100 && nRotation <= 31500_deg100))
768 std::swap(nMSOWidth, nMSOHeight);
769 nBottomExt += (aBoundRect.
Height() - 1 - nMSOHeight) / 2;
770 nTopExt += (aBoundRect.
Height() - 1 - nMSOHeight) / 2;
771 nLeftExt += (aBoundRect.
Width() - nMSOWidth) / 2;
772 nRightExt += (aBoundRect.
Width() - nMSOWidth) / 2;
774 lcl_makeDistAndExtentNonNegative(nDistT, nDistB, nDistL, nDistR, nLeftExt, nTopExt,
775 nRightExt, nBottomExt);
783 sal_Int32 nMode =
m_pImpl->getExport().getWordCompatibilityModeFromGrabBag();
784 bool bIsWord2007Image(nMode > 0 && nMode < 14
791 lcl_calculateRawEffectExtent(nLeftExt, nTopExt, nRightExt, nBottomExt, *pObj,
true,
803 auto it = aGrabBag.
find(
"AnchorDistDiff");
804 if (it != aGrabBag.
end())
807 for (
const std::pair<const comphelper::OUStringAndHashCode, uno::Any>& rDiff :
810 const OUString& rName = rDiff.first.maString;
811 if (rName ==
"distTDiff" && rDiff.second.has<sal_Int32>())
812 nDistT -=
round(rDiff.second.get<sal_Int32>());
813 else if (rName ==
"distBDiff" && rDiff.second.has<sal_Int32>())
814 nDistB -=
round(rDiff.second.get<sal_Int32>());
815 else if (rName ==
"distLDiff" && rDiff.second.has<sal_Int32>())
816 nDistL -= rDiff.second.get<sal_Int32>();
817 else if (rName ==
"distRDiff" && rDiff.second.has<sal_Int32>())
818 nDistR -= rDiff.second.get<sal_Int32>();
823 lcl_makeDistAndExtentNonNegative(nDistT, nDistB, nDistL, nDistR, nLeftExt, nTopExt,
824 nRightExt, nBottomExt);
828 lcl_calculateRawEffectExtent(nLeftExt, nTopExt, nRightExt, nBottomExt, *pObj,
false,
833 lcl_makeDistZeroAndExtentNonNegative(nDistT, nDistB, nDistL, nDistR, nLeftExt, nTopExt,
834 nRightExt, nBottomExt);
843 bool bOpaque = pFrameFormat->
GetOpaque().GetValue();
854 attrList->add(XML_behindDoc, bOpaque ?
"0" :
"1");
856 attrList->add(XML_distT, OString::number(TwipsToEMU(nDistT)));
857 attrList->add(XML_distB, OString::number(TwipsToEMU(nDistB)));
858 attrList->add(XML_distL, OString::number(TwipsToEMU(nDistL)));
859 attrList->add(XML_distR, OString::number(TwipsToEMU(nDistR)));
861 attrList->add(XML_simplePos,
"0");
862 attrList->add(XML_locked,
"0");
864 bool bLclInTabCell =
true;
867 uno::Reference<drawing::XShape> xShape((
const_cast<SdrObject*
>(pObj)->getUnoShape()),
869 uno::Reference<beans::XPropertySet> xShapeProps(xShape, uno::UNO_QUERY);
870 if (xShapeProps.is())
871 xShapeProps->getPropertyValue(
"IsFollowingTextFlow") >>= bLclInTabCell;
879 bLclInTabCell =
true;
883 attrList->add(XML_layoutInCell,
"1");
885 attrList->add(XML_layoutInCell,
"0");
888 attrList->add(XML_allowOverlap, bAllowOverlap ?
"1" :
"0");
892 attrList->add(XML_relativeHeight, OString::number(pObj->
GetOrdNum() + 2));
895 attrList->add(XML_relativeHeight,
"0");
899 OUString sAnchorId = lclGetAnchorIdFromGrabBag(pObj);
900 if (!sAnchorId.isEmpty())
901 attrList->addNS(XML_wp14, XML_anchorId, sAnchorId);
904 m_pImpl->getSerializer()->startElementNS(XML_wp, XML_anchor, attrList);
906 m_pImpl->getSerializer()->singleElementNS(XML_wp, XML_simplePos, XML_x,
"0", XML_y,
916 if (pObj && lcl_IsRotateAngleValid(*pObj)
920 const char* relativeFromH;
921 const char* relativeFromV;
922 const char* alignH =
nullptr;
923 const char* alignV =
nullptr;
926 case text::RelOrientation::PAGE_PRINT_AREA:
927 relativeFromV =
"margin";
929 case text::RelOrientation::PAGE_PRINT_AREA_TOP:
930 relativeFromV =
"topMargin";
932 case text::RelOrientation::PAGE_PRINT_AREA_BOTTOM:
933 relativeFromV =
"bottomMargin";
935 case text::RelOrientation::PAGE_FRAME:
936 relativeFromV =
"page";
938 case text::RelOrientation::FRAME:
939 relativeFromV =
"paragraph";
941 case text::RelOrientation::TEXT_LINE:
943 relativeFromV =
"line";
948 case text::VertOrientation::TOP:
949 case text::VertOrientation::CHAR_TOP:
950 case text::VertOrientation::LINE_TOP:
952 == text::RelOrientation::TEXT_LINE)
957 case text::VertOrientation::BOTTOM:
958 case text::VertOrientation::CHAR_BOTTOM:
959 case text::VertOrientation::LINE_BOTTOM:
961 == text::RelOrientation::TEXT_LINE)
966 case text::VertOrientation::CENTER:
967 case text::VertOrientation::CHAR_CENTER:
968 case text::VertOrientation::LINE_CENTER:
976 case text::RelOrientation::PAGE_PRINT_AREA:
977 relativeFromH =
"margin";
979 case text::RelOrientation::PAGE_FRAME:
980 relativeFromH =
"page";
982 case text::RelOrientation::CHAR:
983 relativeFromH =
"character";
985 case text::RelOrientation::PAGE_RIGHT:
986 relativeFromH =
"rightMargin";
988 case text::RelOrientation::PAGE_LEFT:
989 relativeFromH =
"leftMargin";
991 case text::RelOrientation::FRAME:
993 relativeFromH =
"column";
998 case text::HoriOrientation::LEFT:
1001 case text::HoriOrientation::RIGHT:
1004 case text::HoriOrientation::CENTER:
1007 case text::HoriOrientation::INSIDE:
1010 case text::HoriOrientation::OUTSIDE:
1018 m_pImpl->getSerializer()->startElementNS(XML_wp, XML_positionH, XML_relativeFrom,
1029 if (alignH !=
nullptr)
1031 m_pImpl->getSerializer()->startElementNS(XML_wp, XML_align);
1032 m_pImpl->getSerializer()->write(alignH);
1033 m_pImpl->getSerializer()->endElementNS(XML_wp, XML_align);
1037 m_pImpl->getSerializer()->startElementNS(XML_wp, XML_posOffset);
1038 sal_Int64 nPosXEMU = TwipsToEMU(aPos.X);
1051 if (nPosXEMU > MAX_INTEGER_VALUE)
1053 nPosXEMU = MAX_INTEGER_VALUE;
1055 else if (nPosXEMU < MIN_INTEGER_VALUE)
1057 nPosXEMU = MIN_INTEGER_VALUE;
1059 m_pImpl->getSerializer()->write(nPosXEMU);
1060 m_pImpl->getSerializer()->endElementNS(XML_wp, XML_posOffset);
1062 m_pImpl->getSerializer()->endElementNS(XML_wp, XML_positionH);
1065 m_pImpl->getSerializer()->startElementNS(XML_wp, XML_positionV, XML_relativeFrom,
1067 sal_Int64 nPosYEMU = TwipsToEMU(aPos.Y);
1074 && (strcmp(relativeFromV,
"line") == 0 || strcmp(relativeFromV,
"paragraph") == 0)
1075 && (!alignV || strcmp(alignV,
"top") == 0))
1078 nPosYEMU = TwipsToEMU(1);
1081 if (alignV !=
nullptr)
1083 m_pImpl->getSerializer()->startElementNS(XML_wp, XML_align);
1084 m_pImpl->getSerializer()->write(alignV);
1085 m_pImpl->getSerializer()->endElementNS(XML_wp, XML_align);
1089 m_pImpl->getSerializer()->startElementNS(XML_wp, XML_posOffset);
1090 if (nPosYEMU > MAX_INTEGER_VALUE)
1092 nPosYEMU = MAX_INTEGER_VALUE;
1094 else if (nPosYEMU < MIN_INTEGER_VALUE)
1096 nPosYEMU = MIN_INTEGER_VALUE;
1098 m_pImpl->getSerializer()->write(nPosYEMU);
1099 m_pImpl->getSerializer()->endElementNS(XML_wp, XML_posOffset);
1101 m_pImpl->getSerializer()->endElementNS(XML_wp, XML_positionV);
1108 aAttrList->add(XML_distT, OString::number(0));
1109 aAttrList->add(XML_distB, OString::number(0));
1110 aAttrList->add(XML_distL, OString::number(0));
1111 aAttrList->add(XML_distR, OString::number(0));
1114 OUString sAnchorId = lclGetAnchorIdFromGrabBag(pObj);
1115 if (!sAnchorId.isEmpty())
1116 aAttrList->addNS(XML_wp14, XML_anchorId, sAnchorId);
1118 m_pImpl->getSerializer()->startElementNS(XML_wp, XML_inline, aAttrList);
1139 sal_uInt64 cx = TwipsToEMU(
1142 sal_uInt64 cy = TwipsToEMU(
1146 m_pImpl->getSerializer()->singleElementNS(XML_wp, XML_extent, XML_cx, aWidth, XML_cy, aHeight);
1156 sal_Int64 nLeftExtEMU = TwipsToEMU(nLeftExt);
1157 sal_Int64 nTopExtEMU = TwipsToEMU(nTopExt);
1158 sal_Int64 nRightExtEMU = TwipsToEMU(nRightExt);
1159 sal_Int64 nBottomExtEMU = TwipsToEMU(nBottomExt);
1165 auto it = aGrabBag.
find(
"CT_EffectExtent");
1166 if (it != aGrabBag.
end())
1169 sal_Int64 nLeftExtGrabBag(0);
1170 sal_Int64 nTopExtGrabBag(0);
1171 sal_Int64 nRightExtGrabBag(0);
1172 sal_Int64 nBottomExtGrabBag(0);
1173 for (
const std::pair<const comphelper::OUStringAndHashCode, uno::Any>& rDirection :
1176 const OUString& rName = rDirection.first.maString;
1177 if (rName ==
"l" && rDirection.second.has<sal_Int32>())
1178 nLeftExtGrabBag = rDirection.second.get<sal_Int32>();
1179 else if (rName ==
"t" && rDirection.second.has<sal_Int32>())
1180 nTopExtGrabBag = rDirection.second.get<sal_Int32>();
1181 else if (rName ==
"r" && rDirection.second.has<sal_Int32>())
1182 nRightExtGrabBag = rDirection.second.get<sal_Int32>();
1183 else if (rName ==
"b" && rDirection.second.has<sal_Int32>())
1184 nBottomExtGrabBag = rDirection.second.get<sal_Int32>();
1186 if (
abs(nLeftExtEMU - nLeftExtGrabBag) <= 635 &&
abs(nTopExtEMU - nTopExtGrabBag) <= 635
1187 &&
abs(nRightExtEMU - nRightExtGrabBag) <= 635)
1189 nLeftExtEMU = nLeftExtGrabBag;
1190 nTopExtEMU = nTopExtGrabBag;
1191 nRightExtEMU = nRightExtGrabBag;
1192 nBottomExtEMU = nBottomExtGrabBag;
1196 m_pImpl->getSerializer()->singleElementNS(
1197 XML_wp, XML_effectExtent, XML_l, OString::number(nLeftExtEMU), XML_t,
1198 OString::number(nTopExtEMU), XML_r, OString::number(nRightExtEMU), XML_b,
1199 OString::number(nBottomExtEMU));
1210 m_pImpl->getSerializer()->singleElementNS(XML_wp, XML_wrapNone);
1216 m_pImpl->getSerializer()->singleElementNS(XML_wp, XML_wrapTopAndBottom);
1224 case text::WrapTextMode_DYNAMIC:
1225 sWrapType = OUString(
"largest");
1227 case text::WrapTextMode_LEFT:
1228 sWrapType = OUString(
"left");
1230 case text::WrapTextMode_RIGHT:
1231 sWrapType = OUString(
"right");
1233 case text::WrapTextMode_PARALLEL:
1235 sWrapType = OUString(
"bothSides");
1247 m_pImpl->getSerializer()->singleElementNS(XML_wp, XML_wrapSquare, XML_wrapText, sWrapType);
1252 sal_Int32 nWrapToken
1262 if (pPolyPoly && pPolyPoly->
Count())
1268 m_pImpl->getSerializer()->startElementNS(XML_wp, nWrapToken, XML_wrapText,
1271 m_pImpl->getSerializer()->startElementNS(XML_wp, XML_wrapPolygon, XML_edited,
"0");
1272 m_pImpl->getSerializer()->singleElementNS(XML_wp, XML_start, XML_x,
1273 OString::number(aPoly[0].
X()), XML_y,
1274 OString::number(aPoly[0].
Y()));
1275 for (sal_uInt16
i = 1;
i < aPoly.
GetSize(); ++
i)
1276 m_pImpl->getSerializer()->singleElementNS(XML_wp, XML_lineTo, XML_x,
1277 OString::number(aPoly[
i].
X()), XML_y,
1278 OString::number(aPoly[
i].
Y()));
1279 m_pImpl->getSerializer()->endElementNS(XML_wp, XML_wrapPolygon);
1281 m_pImpl->getSerializer()->endElementNS(XML_wp, nWrapToken);
1295 auto it = aGrabBag.
find(
"CT_WrapPath");
1296 if (it != aGrabBag.
end())
1298 m_pImpl->getSerializer()->startElementNS(XML_wp, nWrapToken, XML_wrapText, sWrapType);
1300 m_pImpl->getSerializer()->startElementNS(XML_wp, XML_wrapPolygon, XML_edited,
"0");
1301 auto aSeqSeq = it->second.get<drawing::PointSequenceSequence>();
1302 const auto& rPoints = aSeqSeq[0];
1303 for (
auto i = rPoints.begin();
i != rPoints.end(); ++
i)
1305 const awt::Point& rPoint = *
i;
1306 m_pImpl->getSerializer()->singleElementNS(
1307 XML_wp, (
i == rPoints.begin() ? XML_start : XML_lineTo), XML_x,
1308 OString::number(rPoint.X), XML_y, OString::number(rPoint.Y));
1310 m_pImpl->getSerializer()->endElementNS(XML_wp, XML_wrapPolygon);
1312 m_pImpl->getSerializer()->endElementNS(XML_wp, nWrapToken);
1323 m_pImpl->getSerializer()->startElementNS(XML_wp, nWrapToken, XML_wrapText, sWrapType);
1326 m_pImpl->getSerializer()->startElementNS(XML_wp, XML_wrapPolygon, XML_edited,
"0");
1327 m_pImpl->getSerializer()->singleElementNS(XML_wp, XML_start, XML_x,
1330 for (sal_uInt32
i = 1;
i < aContour.
GetSize();
i++)
1331 m_pImpl->getSerializer()->singleElementNS(
1332 XML_wp, XML_lineTo, XML_x, OString::number(aContour.
GetPoint(
i).
getX()), XML_y,
1334 m_pImpl->getSerializer()->endElementNS(XML_wp, XML_wrapPolygon);
1336 m_pImpl->getSerializer()->endElementNS(XML_wp, nWrapToken);
1342 if (
m_pImpl->getFlyFrameGraphic())
1350 m_pImpl->getSerializer()->endElementNS(XML_wp, isAnchor ? XML_anchor : XML_inline);
1352 m_pImpl->getSerializer()->endElementNS(XML_w, XML_drawing);
1353 m_pImpl->setDrawingOpen(
false);
1358 m_pImpl->getSerializer()->startElementNS(XML_w, XML_pict);
1368 m_pImpl->getExport().VMLExporter().AddSdrObject(
1371 m_pImpl->getSerializer()->endElementNS(XML_w, XML_pict);
1376 const uno::Sequence<beans::PropertyValue> propList = lclGetProperty(xShape,
"InteropGrabBag");
1381 return std::any_of(propList.begin(), propList.end(), [](
const beans::PropertyValue& rProp) {
1382 return rProp.Name ==
"LockedCanvas";
1387 uno::Reference<beans::XPropertySet>
const& xShape)
1389 if (xShape->getPropertyValue(
"Decorative").get<
bool>())
1391 pFS->startElementNS(XML_a, XML_extLst,
1393 FSNS(XML_xmlns, XML_a),
1395 pFS->startElementNS(XML_a, XML_ext,
1397 XML_uri,
"{C183D7F6-B498-43B3-948B-1728B52AA6E4}");
1398 pFS->singleElementNS(XML_adec, XML_decorative,
FSNS(XML_xmlns, XML_adec),
1399 "http://schemas.microsoft.com/office/drawing/2017/decorative", XML_val,
1401 pFS->endElementNS(XML_a, XML_ext);
1402 pFS->endElementNS(XML_a, XML_extLst);
1409 uno::Reference<drawing::XShape> xShape(
const_cast<SdrObject*
>(pSdrObject)->getUnoShape());
1413 m_pImpl->getExport().DocxAttrOutput().GetSdtEndBefore(pSdrObject);
1422 pDocPrAttrList->add(XML_id, OString::number(nAnchorId));
1423 pDocPrAttrList->add(XML_name, pSdrObject->
GetName());
1424 if (!pSdrObject->
GetTitle().isEmpty())
1425 pDocPrAttrList->add(XML_title, pSdrObject->
GetTitle());
1431 pDocPrAttrList->add(XML_hidden, OString::number(1));
1433 pFS->startElementNS(XML_wp, XML_docPr, pDocPrAttrList);
1435 if (!sHyperlink.isEmpty())
1437 OUString sRelId =
m_pImpl->getExport().GetFilter().addRelation(
1441 pFS->singleElementNS(XML_a, XML_hlinkClick,
FSNS(XML_r, XML_id), sRelId,
1442 FSNS(XML_xmlns, XML_a),
1443 m_pImpl->getExport().GetFilter().getNamespaceURL(OOX_NS(dml)));
1445 uno::Reference<beans::XPropertySet>
const xShapeProps(xShape, uno::UNO_QUERY_THROW);
1448 pFS->endElementNS(XML_wp, XML_docPr);
1450 uno::Reference<lang::XServiceInfo> xServiceInfo(xShape, uno::UNO_QUERY_THROW);
1451 const char* pNamespace =
"http://schemas.microsoft.com/office/word/2010/wordprocessingShape";
1452 if (xServiceInfo->supportsService(
"com.sun.star.drawing.GroupShape"))
1453 pNamespace =
"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup";
1454 else if (xServiceInfo->supportsService(
"com.sun.star.drawing.GraphicObjectShape"))
1455 pNamespace =
"http://schemas.openxmlformats.org/drawingml/2006/picture";
1456 pFS->startElementNS(XML_a, XML_graphic,
FSNS(XML_xmlns, XML_a),
1457 m_pImpl->getExport().GetFilter().getNamespaceURL(OOX_NS(dml)));
1458 pFS->startElementNS(XML_a, XML_graphicData, XML_uri, pNamespace);
1462 pFS->startElementNS(
1463 XML_lc, XML_lockedCanvas,
FSNS(XML_xmlns, XML_lc),
1464 m_pImpl->getExport().GetFilter().getNamespaceURL(OOX_NS(dmlLockedCanvas)));
1466 m_pImpl->getExport().OutputDML(xShape);
1469 pFS->endElementNS(XML_lc, XML_lockedCanvas);
1470 pFS->endElementNS(XML_a, XML_graphicData);
1471 pFS->endElementNS(XML_a, XML_graphic);
1480 case text::RelOrientation::FRAME:
1483 case text::RelOrientation::PAGE_LEFT:
1485 sValue =
"outsideMargin";
1487 sValue =
"leftMargin";
1489 case text::RelOrientation::PAGE_RIGHT:
1491 sValue =
"insideMargin";
1493 sValue =
"rightMargin";
1495 case text::RelOrientation::PAGE_FRAME:
1500 pFS->startElementNS(XML_wp14, XML_sizeRelH, XML_relativeFrom, sValue);
1501 pFS->startElementNS(XML_wp14, XML_pctWidth);
1504 pFS->endElementNS(XML_wp14, XML_pctWidth);
1505 pFS->endElementNS(XML_wp14, XML_sizeRelH);
1512 case text::RelOrientation::FRAME:
1515 case text::RelOrientation::PAGE_PRINT_AREA:
1516 sValue =
"topMargin";
1518 case text::RelOrientation::PAGE_PRINT_AREA_BOTTOM:
1519 sValue =
"bottomMargin";
1521 case text::RelOrientation::PAGE_FRAME:
1526 pFS->startElementNS(XML_wp14, XML_sizeRelV, XML_relativeFrom, sValue);
1527 pFS->startElementNS(XML_wp14, XML_pctHeight);
1530 pFS->endElementNS(XML_wp14, XML_pctHeight);
1531 pFS->endElementNS(XML_wp14, XML_sizeRelV);
1540 if (aShadowItem.
GetLocation() == SvxShadowLocation::NONE)
1543 OString aShadowWidth(OString::number(
double(aShadowItem.
GetWidth()) / 20) +
"pt");
1547 case SvxShadowLocation::TopLeft:
1548 aOffset =
"-" + aShadowWidth +
",-" + aShadowWidth;
1550 case SvxShadowLocation::TopRight:
1551 aOffset = aShadowWidth +
",-" + aShadowWidth;
1553 case SvxShadowLocation::BottomLeft:
1554 aOffset =
"-" + aShadowWidth +
"," + aShadowWidth;
1556 case SvxShadowLocation::BottomRight:
1557 aOffset = aShadowWidth +
"," + aShadowWidth;
1559 case SvxShadowLocation::NONE:
1560 case SvxShadowLocation::End:
1563 if (aOffset.isEmpty())
1567 m_pSerializer->singleElementNS(XML_v, XML_shadow, XML_on,
"t", XML_color,
"#" + aShadowColor,
1568 XML_offset, aOffset);
1574 uno::Reference<lang::XServiceInfo> xServiceInfo(xShape, uno::UNO_QUERY_THROW);
1575 if (xServiceInfo->supportsService(
"com.sun.star.drawing.PolyPolygonShape")
1576 || xServiceInfo->supportsService(
"com.sun.star.drawing.PolyLineShape"))
1579 uno::Reference<beans::XPropertySet> xShapeProperties(xShape, uno::UNO_QUERY);
1581 if (xServiceInfo->supportsService(
"com.sun.star.drawing.GraphicObjectShape"))
1583 bool bIsSignatureLineShape =
false;
1584 xShapeProperties->getPropertyValue(
"IsSignatureLine") >>= bIsSignatureLineShape;
1585 if (bIsSignatureLineShape)
1593 css::drawing::FillStyle eFillStyle = css::drawing::FillStyle_SOLID;
1594 xShapeProperties->getPropertyValue(
"FillStyle") >>= eFillStyle;
1595 if (eFillStyle == css::drawing::FillStyle_BITMAP)
1604 bool bDMLAndVMLDrawingOpen =
m_pImpl->getDMLAndVMLDrawingOpen();
1605 m_pImpl->setDMLAndVMLDrawingOpen(
true);
1608 OUString sShapeType;
1609 ShapeFlag nMirrorFlags = ShapeFlag::NONE;
1610 uno::Reference<drawing::XShape> xShape(
const_cast<SdrObject*
>(sdrObj)->getUnoShape());
1620 m_pImpl->getSerializer()->startElementNS(XML_mc, XML_AlternateContent);
1622 auto pObjGroup =
dynamic_cast<const SdrObjGroup*
>(sdrObj);
1623 m_pImpl->getSerializer()->startElementNS(XML_mc, XML_Choice, XML_Requires,
1624 (pObjGroup ?
"wpg" :
"wps"));
1626 m_pImpl->getSerializer()->endElementNS(XML_mc, XML_Choice);
1628 m_pImpl->getSerializer()->startElementNS(XML_mc, XML_Fallback);
1630 m_pImpl->getSerializer()->endElementNS(XML_mc, XML_Fallback);
1632 m_pImpl->getSerializer()->endElementNS(XML_mc, XML_AlternateContent);
1637 m_pImpl->setDMLAndVMLDrawingOpen(bDMLAndVMLDrawingOpen);
1645 sal_Int32 nAlphaPercent = float(rColor.
GetAlpha()) / 2.55;
1657 if (aShadowItem.
GetLocation() == SvxShadowLocation::NONE)
1662 = sqrt(
static_cast<double>(aShadowItem.
GetWidth()) * aShadowItem.
GetWidth() * 2.0);
1663 OString aShadowDist(OString::number(TwipsToEMU(nShadowDist)));
1666 sal_uInt32 nShadowDir = 0;
1669 case SvxShadowLocation::TopLeft:
1670 nShadowDir = 13500000;
1672 case SvxShadowLocation::TopRight:
1673 nShadowDir = 18900000;
1675 case SvxShadowLocation::BottomLeft:
1676 nShadowDir = 8100000;
1678 case SvxShadowLocation::BottomRight:
1679 nShadowDir = 2700000;
1681 case SvxShadowLocation::NONE:
1682 case SvxShadowLocation::End:
1685 OString aShadowDir(OString::number(nShadowDir));
1687 m_pImpl->getSerializer()->startElementNS(XML_a, XML_effectLst);
1688 m_pImpl->getSerializer()->startElementNS(XML_a, XML_outerShdw, XML_dist, aShadowDist, XML_dir,
1690 if (aShadowAlpha.isEmpty())
1691 m_pImpl->getSerializer()->singleElementNS(XML_a, XML_srgbClr, XML_val, aShadowColor);
1694 m_pImpl->getSerializer()->startElementNS(XML_a, XML_srgbClr, XML_val, aShadowColor);
1695 m_pImpl->getSerializer()->singleElementNS(XML_a, XML_alpha, XML_val, aShadowAlpha);
1696 m_pImpl->getSerializer()->endElementNS(XML_a, XML_srgbClr);
1698 m_pImpl->getSerializer()->endElementNS(XML_a, XML_outerShdw);
1699 m_pImpl->getSerializer()->endElementNS(XML_a, XML_effectLst);
1705 uno::Reference<drawing::XShape> xShape(
const_cast<SdrObject*
>(sdrObject)->getUnoShape(),
1713 m_pImpl->getDrawingML()->WriteDiagram(xShape, nDiagramId);
1732 m_pImpl->getExport().WriteText();
1741 pBorderLine = rBox.
GetTop();
1763 pFS->startElementNS(XML_a, XML_ln);
1768 OString sWidth(OString::number(TwipsToEMU(fConverted)));
1769 pFS->startElementNS(XML_a, XML_ln, XML_w, sWidth);
1772 pFS->startElementNS(XML_a, XML_solidFill);
1774 pFS->singleElementNS(XML_a, XML_srgbClr, XML_val,
sColor);
1775 pFS->endElementNS(XML_a, XML_solidFill);
1778 pFS->singleElementNS(XML_a, XML_prstDash, XML_val,
"dash");
1780 pFS->endElementNS(XML_a, XML_ln);
1786 bool bDMLAndVMLDrawingOpen =
m_pImpl->getDMLAndVMLDrawingOpen();
1787 m_pImpl->setDMLAndVMLDrawingOpen(IsAnchorTypeInsideParagraph(pParentFrame));
1803 uno::Reference<drawing::XShape> xShape;
1806 xShape.set(
const_cast<SdrObject*
>(pSdrObj)->getUnoShape(), uno::UNO_QUERY);
1807 uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY);
1808 uno::Reference<beans::XPropertySetInfo> xPropSetInfo;
1809 if (xPropertySet.is())
1810 xPropSetInfo = xPropertySet->getPropertySetInfo();
1814 drawing::TextVerticalAdjust eAdjust = drawing::TextVerticalAdjust_TOP;
1815 if (xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(
"TextVerticalAdjust"))
1816 xPropertySet->getPropertyValue(
"TextVerticalAdjust") >>= eAdjust;
1817 m_pImpl->getBodyPrAttrList()->add(XML_anchor,
1827 pDocPrAttrList->add(XML_id, OString::number(nAnchorId));
1828 pDocPrAttrList->add(XML_name, rFrameFormat.
GetName());
1830 pFS->startElementNS(XML_wp, XML_docPr, pDocPrAttrList);
1832 OUString sHyperlink;
1833 if (xPropertySet.is())
1834 xPropertySet->getPropertyValue(
"HyperLinkURL") >>= sHyperlink;
1835 if (!sHyperlink.isEmpty())
1837 OUString sRelId =
m_pImpl->getExport().GetFilter().addRelation(
1841 pFS->singleElementNS(XML_a, XML_hlinkClick,
FSNS(XML_r, XML_id), sRelId,
1842 FSNS(XML_xmlns, XML_a),
1843 m_pImpl->getExport().GetFilter().getNamespaceURL(OOX_NS(dml)));
1846 pFS->endElementNS(XML_wp, XML_docPr);
1848 pFS->startElementNS(XML_a, XML_graphic,
FSNS(XML_xmlns, XML_a),
1849 m_pImpl->getExport().GetFilter().getNamespaceURL(OOX_NS(dml)));
1850 pFS->startElementNS(XML_a, XML_graphicData, XML_uri,
1851 "http://schemas.microsoft.com/office/word/2010/wordprocessingShape");
1852 pFS->startElementNS(XML_wps, XML_wsp);
1853 pFS->singleElementNS(XML_wps, XML_cNvSpPr, XML_txBox,
"1");
1856 m_pImpl->setDMLandVMLTextFrameRotation(0_deg100);
1857 if (xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(
"FrameInteropGrabBag"))
1859 uno::Sequence<beans::PropertyValue> propList;
1860 xPropertySet->getPropertyValue(
"FrameInteropGrabBag") >>= propList;
1861 auto pProp = std::find_if(std::cbegin(propList), std::cend(propList),
1862 [](
const beans::PropertyValue& rProp) {
1863 return rProp.Name ==
"mso-rotation-angle";
1865 if (pProp != std::cend(propList))
1866 aRotation = pProp->
Value;
1869 if (aRotation >>= nTmp)
1871 OString sRotation(OString::number(
1874 pFS->startElementNS(XML_wps, XML_spPr);
1875 if (
m_pImpl->getDMLandVMLTextFrameRotation())
1877 pFS->startElementNS(XML_a, XML_xfrm, XML_rot, sRotation);
1881 pFS->startElementNS(XML_a, XML_xfrm);
1883 pFS->singleElementNS(XML_a, XML_off, XML_x,
"0", XML_y,
"0");
1884 OString aWidth(OString::number(TwipsToEMU(aSize.
Width())));
1885 OString aHeight(OString::number(TwipsToEMU(aSize.
Height())));
1886 pFS->singleElementNS(XML_a, XML_ext, XML_cx, aWidth, XML_cy, aHeight);
1887 pFS->endElementNS(XML_a, XML_xfrm);
1888 OUString shapeType =
"rect";
1889 if (xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(
"FrameInteropGrabBag"))
1891 uno::Sequence<beans::PropertyValue> propList;
1892 xPropertySet->getPropertyValue(
"FrameInteropGrabBag") >>= propList;
1893 auto pProp = std::find_if(std::cbegin(propList), std::cend(propList),
1894 [](
const beans::PropertyValue& rProp) {
1895 return rProp.Name ==
"mso-orig-shape-type";
1897 if (pProp != std::cend(propList))
1898 pProp->Value >>= shapeType;
1901 if (shapeType.isEmpty())
1904 pFS->singleElementNS(XML_a, XML_prstGeom, XML_prst, shapeType);
1905 m_pImpl->setDMLTextFrameSyntax(
true);
1907 m_pImpl->setDMLTextFrameSyntax(
false);
1909 pFS->endElementNS(XML_wps, XML_spPr);
1913 if (!
m_pImpl->getExport().m_bLinkedTextboxesHelperInitialized)
1916 for (
auto& rEntry :
m_pImpl->getExport().m_aLinkedTextboxesHelper)
1919 if (rEntry.second.sPrevChain.isEmpty() && !rEntry.second.sNextChain.isEmpty())
1923 rEntry.second.nId = ++
m_pImpl->getExport().m_nLinkedTextboxesChainId;
1924 rEntry.second.nSeq = nSeq;
1926 OUString sCheckForBrokenChains = rEntry.first;
1929 auto followChainIter
1930 =
m_pImpl->getExport().m_aLinkedTextboxesHelper.find(rEntry.second.sNextChain);
1931 while (followChainIter !=
m_pImpl->getExport().m_aLinkedTextboxesHelper.end())
1935 if (followChainIter->second.sPrevChain != sCheckForBrokenChains)
1938 followChainIter->second.nId =
m_pImpl->getExport().m_nLinkedTextboxesChainId;
1939 followChainIter->second.nSeq = ++nSeq;
1942 if (followChainIter->second.sNextChain.isEmpty())
1945 sCheckForBrokenChains = followChainIter->first;
1946 followChainIter =
m_pImpl->getExport().m_aLinkedTextboxesHelper.find(
1947 followChainIter->second.sNextChain);
1951 m_pImpl->getExport().m_bLinkedTextboxesHelperInitialized =
true;
1954 m_pImpl->getExport().m_pParentFrame =
nullptr;
1955 bool skipTxBxContent =
false;
1956 bool isTxbxLinked =
false;
1958 OUString sLinkChainName;
1959 if (xPropSetInfo.is())
1961 if (xPropSetInfo->hasPropertyByName(
"LinkDisplayName"))
1962 xPropertySet->getPropertyValue(
"LinkDisplayName") >>= sLinkChainName;
1963 else if (xPropSetInfo->hasPropertyByName(
"ChainName"))
1964 xPropertySet->getPropertyValue(
"ChainName") >>= sLinkChainName;
1968 auto linkedTextboxesIter =
m_pImpl->getExport().m_aLinkedTextboxesHelper.find(sLinkChainName);
1969 if (linkedTextboxesIter !=
m_pImpl->getExport().m_aLinkedTextboxesHelper.end())
1971 if ((linkedTextboxesIter->second.nId != 0) && (linkedTextboxesIter->second.nSeq != 0))
1974 pFS->singleElementNS(XML_wps, XML_linkedTxbx, XML_id,
1975 OString::number(linkedTextboxesIter->second.nId), XML_seq,
1976 OString::number(linkedTextboxesIter->second.nSeq));
1981 skipTxBxContent =
true;
1983 else if ((linkedTextboxesIter->second.nId != 0) && (linkedTextboxesIter->second.nSeq == 0))
1988 pFS->startElementNS(XML_wps, XML_txbx, XML_id,
1989 OString::number(linkedTextboxesIter->second.nId));
1990 isTxbxLinked =
true;
1994 if (!skipTxBxContent)
1997 pFS->startElementNS(XML_wps, XML_txbx);
1999 pFS->startElementNS(XML_w, XML_txbxContent);
2002 if (rDirection.GetValue() == SvxFrameDirection::Vertical_RL_TB)
2003 m_pImpl->getBodyPrAttrList()->add(XML_vert,
"eaVert");
2004 else if (rDirection.GetValue() == SvxFrameDirection::Vertical_LR_BT)
2005 m_pImpl->getBodyPrAttrList()->add(XML_vert,
"vert270");
2006 else if (rDirection.GetValue() == SvxFrameDirection::Vertical_LR_TB)
2007 m_pImpl->getBodyPrAttrList()->add(XML_vert,
"mongolianVert");
2008 else if (rDirection.GetValue() == SvxFrameDirection::Vertical_RL_TB90)
2009 m_pImpl->getBodyPrAttrList()->add(XML_vert,
"vert");
2013 m_pImpl->getExport().WriteText();
2014 if (
m_pImpl->getParagraphSdtOpen())
2016 m_pImpl->getExport().DocxAttrOutput().EndParaSdtBlock();
2017 m_pImpl->setParagraphSdtOpen(
false);
2021 pFS->endElementNS(XML_w, XML_txbxContent);
2022 pFS->endElementNS(XML_wps, XML_txbx);
2028 if (
m_pImpl->getBodyPrAttrList())
2030 if (!
m_pImpl->getBodyPrAttrList()->hasAttribute(XML_lIns))
2031 m_pImpl->getBodyPrAttrList()->add(XML_lIns, OString::number(0));
2032 if (!
m_pImpl->getBodyPrAttrList()->hasAttribute(XML_tIns))
2033 m_pImpl->getBodyPrAttrList()->add(XML_tIns, OString::number(0));
2034 if (!
m_pImpl->getBodyPrAttrList()->hasAttribute(XML_rIns))
2035 m_pImpl->getBodyPrAttrList()->add(XML_rIns, OString::number(0));
2036 if (!
m_pImpl->getBodyPrAttrList()->hasAttribute(XML_bIns))
2037 m_pImpl->getBodyPrAttrList()->add(XML_bIns, OString::number(0));
2041 m_pImpl->setBodyPrAttrList(
nullptr);
2044 pFS->startElementNS(XML_wps, XML_bodyPr, xBodyPrAttrList);
2047 pFS->singleElementNS(
2050 pFS->endElementNS(XML_wps, XML_bodyPr);
2052 pFS->endElementNS(XML_wps, XML_wsp);
2053 pFS->endElementNS(XML_a, XML_graphicData);
2054 pFS->endElementNS(XML_a, XML_graphic);
2060 pFS->startElementNS(XML_wp14, XML_sizeRelH, XML_relativeFrom,
2064 pFS->startElementNS(XML_wp14, XML_pctWidth);
2066 pFS->endElementNS(XML_wp14, XML_pctWidth);
2067 pFS->endElementNS(XML_wp14, XML_sizeRelH);
2072 pFS->startElementNS(
2073 XML_wp14, XML_sizeRelV, XML_relativeFrom,
2076 pFS->startElementNS(XML_wp14, XML_pctHeight);
2078 pFS->endElementNS(XML_wp14, XML_pctHeight);
2079 pFS->endElementNS(XML_wp14, XML_sizeRelV);
2084 m_pImpl->setDMLAndVMLDrawingOpen(bDMLAndVMLDrawingOpen);
2089 bool bDMLAndVMLDrawingOpen =
m_pImpl->getDMLAndVMLDrawingOpen();
2090 m_pImpl->setDMLAndVMLDrawingOpen(IsAnchorTypeInsideParagraph(pParentFrame));
2105 m_pImpl->setFlyFrameSize(&aSize);
2107 m_pImpl->setTextFrameSyntax(
true);
2110 m_pImpl->getTextFrameStyle() =
"position:absolute";
2113 OString sRotation(OString::number(-
toDegrees(
m_pImpl->getDMLandVMLTextFrameRotation())));
2114 m_pImpl->getExport().SdrExporter().getTextFrameStyle().append(
";rotation:" + sRotation);
2117 m_pImpl->getFlyAttrList()->add(XML_style,
m_pImpl->getTextFrameStyle().makeStringAndClear());
2122 OUString sAnchorId = lclGetAnchorIdFromGrabBag(
pObject);
2123 if (!sAnchorId.isEmpty())
2124 m_pImpl->getFlyAttrList()->addNS(XML_w14, XML_anchorId, sAnchorId);
2126 uno::Reference<drawing::XShape> xShape(
const_cast<SdrObject*
>(
pObject)->getUnoShape(),
2128 uno::Reference<beans::XPropertySet> xShapeProps(xShape, uno::UNO_QUERY);
2129 OUString sHyperlink;
2130 if (xShapeProps.is())
2131 xShapeProps->getPropertyValue(
"HyperLinkURL") >>= sHyperlink;
2132 if (!sHyperlink.isEmpty())
2133 m_pImpl->getFlyAttrList()->add(XML_href, sHyperlink);
2136 m_pImpl->getFlyAttrList().clear();
2138 m_pImpl->getTextboxAttrList().clear();
2139 m_pImpl->setTextFrameSyntax(
false);
2140 m_pImpl->setFlyFrameSize(
nullptr);
2141 m_pImpl->getExport().m_pParentFrame =
nullptr;
2145 pFS->startElementNS(XML_w, XML_pict);
2146 pFS->startElementNS(XML_v, XML_rect, xFlyAttrList);
2147 m_pImpl->textFrameShadow(rFrameFormat);
2148 if (
m_pImpl->getFlyFillAttrList().is())
2151 pFS->singleElementNS(XML_v, XML_fill, xFlyFillAttrList);
2153 if (
m_pImpl->getDashLineStyleAttr().is())
2156 pFS->singleElementNS(XML_v, XML_stroke, xDashLineStyleAttr);
2158 pFS->startElementNS(XML_v, XML_textbox, xTextboxAttrList);
2160 m_pImpl->getFlyFillAttrList().clear();
2161 m_pImpl->getDashLineStyleAttr().clear();
2163 pFS->startElementNS(XML_w, XML_txbxContent);
2167 m_pImpl->getExport().WriteText();
2168 if (
m_pImpl->getParagraphSdtOpen())
2170 m_pImpl->getExport().DocxAttrOutput().EndParaSdtBlock();
2171 m_pImpl->setParagraphSdtOpen(
false);
2174 pFS->endElementNS(XML_w, XML_txbxContent);
2177 pFS->endElementNS(XML_v, XML_textbox);
2179 if (
m_pImpl->getFlyWrapAttrList())
2182 m_pImpl->setFlyWrapAttrList(
nullptr);
2183 pFS->singleElementNS(XML_w10, XML_wrap, xFlyWrapAttrList);
2186 pFS->endElementNS(XML_v, XML_rect);
2187 pFS->endElementNS(XML_w, XML_pict);
2190 m_pImpl->setDMLAndVMLDrawingOpen(bDMLAndVMLDrawingOpen);
sal_uInt8 GetAlpha() const
bool IsTransparent() const
The class that does all the actual DOCX export-related work.
DocxExportFilter & GetFilter()
void writeVMLDrawing(const SdrObject *sdrObj, const SwFrameFormat &rFrameFormat)
Writes a drawing as VML data.
void endDMLAnchorInline(const SwFrameFormat *pFrameFormat)
void setParagraphSdtOpen(bool bParagraphSdtOpen)
Set if paragraph sdt open in the current drawing.
void writeDMLEffectLst(const SwFrameFormat &rFrameFormat)
Write <a:effectLst>, the effect list.
static bool isTextBox(const SwFrameFormat &rFrameFormat)
Is this a standalone TextFrame, or used as a TextBox of a shape?
rtl::Reference< sax_fastparser::FastAttributeList > & getFlyAttrList()
bool getTextFrameSyntax() const
void writeDMLDrawing(const SdrObject *pSdrObject, const SwFrameFormat *pFrameFormat, int nAnchorId)
Writes a drawing as DML.
bool IsDrawingOpen() const
void writeBoxItemLine(const SvxBoxItem &rBox)
Writes the drawingML <a:ln> markup of a box item.
rtl::Reference< sax_fastparser::FastAttributeList > & getFlyFillAttrList()
bool getDMLTextFrameSyntax() const
void writeVMLTextFrame(ww8::Frame const *pParentFrame, bool bTextBoxOnly=false)
Writes text frame in VML format.
rtl::Reference< sax_fastparser::FastAttributeList > & getTextboxAttrList()
Attributes of the next v:textbox element.
void setFlyWrapAttrList(rtl::Reference< sax_fastparser::FastAttributeList > const &pAttrList)
DocxSdrExport(DocxExport &rExport, const sax_fastparser::FSHelperPtr &pSerializer, oox::drawingml::DrawingML *pDrawingML)
bool IsDMLAndVMLDrawingOpen() const
void writeDiagram(const SdrObject *sdrObject, const SwFrameFormat &rFrameFormat, int nDiagramId)
Writes a diagram (smartart).
void writeOnlyTextOfFrame(ww8::Frame const *pParentFrame)
Writes text from Textbox for <w:framePr>
void writeDMLTextFrame(ww8::Frame const *pParentFrame, int nAnchorId, bool bTextBoxOnly=false)
Writes text frame in DML format.
const Size * getFlyFrameSize() const
When exporting fly frames, this holds the real size of the frame.
bool IsParagraphHasDrawing() const
void setParagraphHasDrawing(bool bParagraphHasDrawing)
sax_fastparser::FastAttributeList * getBodyPrAttrList()
Attributes of <wps:bodyPr>, used during DML export of text frames.
void startDMLAnchorInline(const SwFrameFormat *pFrameFormat, const Size &rSize)
void writeDMLAndVMLDrawing(const SdrObject *sdrObj, const SwFrameFormat &rFrameFormat, int nAnchorId)
Writes shape in both DML and VML format.
rtl::Reference< sax_fastparser::FastAttributeList > & getDashLineStyle()
OStringBuffer & getTextFrameStyle()
std::unique_ptr< Impl > m_pImpl
void setSerializer(const sax_fastparser::FSHelperPtr &pSerializer)
static MSO_SPT GetCustomShapeType(const css::uno::Reference< css::drawing::XShape > &rXShape, ShapeFlag &nMirrorFlags, OUString &rShapeType, bool bOOXML=false)
Helper class, so that the DocxExport::RestoreData() call will always happen.
ExportDataSaveRestore(DocxExport &rExport, SwNodeOffset nStt, SwNodeOffset nEnd, ww8::Frame const *pParentFrame)
virtual SdrLayerID GetHellId() const =0
virtual SdrLayerID GetInvisibleHellId() const =0
virtual void SaveData(SwNodeOffset nStt, SwNodeOffset nEnd)
Remember some of the members so that we can recurse in WriteText().
virtual void RestoreData()
Restore what was saved in SaveData().
const ww8::Frame * m_pParentFrame
constexpr tools::Long getX() const
constexpr tools::Long getY() const
virtual Degree100 GetRotateAngle() const
const OUString & getHyperlink() const
const double * GetRelativeHeight() const
virtual OUString GetTitle() const
sal_uInt32 GetOrdNum() const
rtl::Reference< SdrObject > ConvertToPolyObj(bool bBezier, bool bLineToArea) const
virtual const tools::Rectangle & GetCurrentBoundRect() const
virtual OUString GetDescription() const
const double * GetRelativeWidth() const
virtual const tools::Rectangle & GetSnapRect() const
virtual const OUString & GetName() const
virtual bool IsTextPath() const
sal_Int16 GetRelativeHeightRelation() const
virtual SdrObjKind GetObjIdentifier() const
virtual SdrLayerID GetLayer() const
sal_Int16 GetRelativeWidthRelation() const
void GetGrabBagItem(css::uno::Any &rVal) const
virtual const tools::Rectangle & GetLogicRect() const
const basegfx::B2DPolyPolygon & GetPathPoly() const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
static const sal_Int16 Hairline
const editeng::SvxBorderLine * GetTop() const
const editeng::SvxBorderLine * GetRight() const
const editeng::SvxBorderLine * GetLeft() const
const editeng::SvxBorderLine * GetBottom() const
tools::Long GetRight() const
tools::Long GetLeft() const
sal_uInt16 GetWidth() const
const Color & GetColor() const
SvxShadowLocation GetLocation() const
sal_uInt16 GetUpper() const
sal_uInt16 GetLower() const
const SwFormatAnchor & GetAnchor(bool=true) const
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
const SwPageDesc & GetPageDesc(const size_t i) const
const SwNodeIndex * GetContentIdx() const
Layout frame for SwNoTextNode, i.e. graphics and OLE nodes (including charts).
Marks a node in the document model.
SwNodeOffset GetIndex() const
SwNodeOffset EndOfSectionIndex() const
UseOnPage GetUseOn() const
Of course Writer needs its own rectangles.
void Height(tools::Long nNew)
void Width(tools::Long nNew)
static bool isTextBox(const SwFrameFormat *pFormat, sal_uInt16 nType, const SdrObject *pObject=nullptr)
Is the frame format a text box?
void append(const B2DPolygon &rPolygon, sal_uInt32 nCount=1)
void transform(const basegfx::B2DHomMatrix &rMatrix)
iterator find(const OUString &rKey)
const Color & GetColor() const
tools::Long GetWidth() const
SvxBorderLineStyle GetBorderLineStyle() const
OUString getNamespaceURL(sal_Int32 nNSID) const
static rtl::Reference< FastAttributeList > createAttrList()
Make exporting a Writer Frame easy.
const Size & GetSize() const
The Size of the contained element.
const SwFrameFormat & GetFrameFormat() const
Get the writer SwFrameFormat that this object describes.
constexpr OUStringLiteral sColor
void AddExtLst(sax_fastparser::FSHelperPtr const &pFS, DocxExport const &rExport, uno::Reference< beans::XPropertySet > const &xShape)
static bool lcl_isLockedCanvas(const uno::Reference< drawing::XShape > &xShape)
static OString lcl_TransparencyToDrawingMlAlpha(const Color &rColor)
EmbeddedObjectRef * pObject
@ Variable
Frame is variable in Var-direction.
constexpr sal_Int32 FSNS(sal_Int32 namespc, sal_Int32 element)
constexpr TypedWhichId< SwFlyFrameFormat > RES_FLYFRMFMT(162)
B2DHomMatrix createScaleB2DHomMatrix(double fScaleX, double fScaleY)
B2DHomMatrix createTranslateB2DHomMatrix(double fTranslateX, double fTranslateY)
rtl::Reference< FastAttributeList > SurroundToVMLWrap(SwFormatSurround const &rSurround)
double ConvertBorderWidthToWord(SvxBorderLineStyle, double)
OString ConvertColor(const Color &rColor)
bool HasTextBoxContent(sal_uInt32 nShapeType)
TextVerticalAdjust GetTextVerticalAdjust(sal_Int32 nToken)
sal_Int32 ExportRotateClockwisify(Degree100 input)
const sal_Int32 PER_PERCENT
OUString getRelationship(Relationship eRelationship)
std::shared_ptr< FastSerializerHelper > FSHelperPtr
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
tools::Polygon PolygonFromPolyPolygon(const tools::PolyPolygon &rPolyPoly)
Make a best fit Polygon from a PolyPolygon.
SwNoTextNode * GetNoTextNodeFromSwFrameFormat(const SwFrameFormat &rFormat)
Get the SwNoTextNode associated with a SwFrameFormat if here is one.
tools::Polygon CorrectWordWrapPolygonForExport(const tools::PolyPolygon &rPolyPoly, const SwNoTextNode *pNd, bool bCorrectCrop)
Undo all scaling / move tricks of the wrap polygon done during import.
o3tl::strong_int< sal_Int32, struct Tag_SwNodeOffset > SwNodeOffset
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
SwNodeOffset abs(const SwNodeOffset &a)
Holds data used by DocxSdrExport only.
rtl::Reference< sax_fastparser::FastAttributeList > m_pFlyFillAttrList
Flag for checking drawing in a paragraph.
void setDMLTextFrameSyntax(bool bDMLTextFrameSyntax)
Degree100 & getDMLandVMLTextFrameRotation()
Degree100 m_nDMLandVMLTextFrameRotation
List of TextBoxes in this document: they are exported as part of their shape, never alone.
void setFlyAttrList(const rtl::Reference< sax_fastparser::FastAttributeList > &pFlyAttrList)
bool getDrawingOpen() const
void setTextFrameSyntax(bool bTextFrameSyntax)
bool getDMLAndVMLDrawingOpen() const
rtl::Reference< sax_fastparser::FastAttributeList > m_pFlyAttrList
sax_fastparser::FastAttributeList * getFlyWrapAttrList() const
const Size * m_pFlyFrameSize
OStringBuffer m_aTextFrameStyle
bool getDMLTextFrameSyntax() const
rtl::Reference< sax_fastparser::FastAttributeList > m_pTextboxAttrList
bool getParagraphSdtOpen() const
rtl::Reference< sax_fastparser::FastAttributeList > m_pDashLineStyleAttr
bool m_bDMLTextFrameSyntax
oox::drawingml::DrawingML * m_pDrawingML
DocxExport & getExport() const
const sax_fastparser::FSHelperPtr & getSerializer() const
void setDrawingOpen(bool bDrawingOpen)
void setDMLAndVMLDrawingOpen(bool bDMLAndVMLDrawingOpen)
rtl::Reference< sax_fastparser::FastAttributeList > & getDashLineStyleAttr()
const Size * getFlyFrameSize() const
Impl(DocxExport &rExport, sax_fastparser::FSHelperPtr pSerializer, oox::drawingml::DrawingML *pDrawingML)
bool getTextFrameSyntax() const
void setSerializer(const sax_fastparser::FSHelperPtr &pSerializer)
OStringBuffer & getTextFrameStyle()
void setDMLandVMLTextFrameRotation(Degree100 nDMLandVMLTextFrameRotation)
rtl::Reference< sax_fastparser::FastAttributeList > m_pFlyWrapAttrList
void textFrameShadow(const SwFrameFormat &rFrameFormat)
Writes wp wrapper code around an SdrObject, which itself is written using drawingML syntax.
static bool isSupportedDMLShape(const uno::Reference< drawing::XShape > &xShape, const SdrObject *pSdrObject)
bool m_bDMLAndVMLDrawingOpen
bool getFlyFrameGraphic() const
rtl::Reference< sax_fastparser::FastAttributeList > m_pBodyPrAttrList
bool getParagraphHasDrawing() const
rtl::Reference< sax_fastparser::FastAttributeList > & getFlyFillAttrList()
void setParagraphSdtOpen(bool bParagraphSdtOpen)
void setFlyWrapAttrList(rtl::Reference< sax_fastparser::FastAttributeList > const &pFlyWrapAttrList)
void setParagraphHasDrawing(bool bParagraphHasDrawing)
oox::drawingml::DrawingML * getDrawingML() const
void setFlyFrameSize(const Size *pFlyFrameSize)
void setBodyPrAttrList(sax_fastparser::FastAttributeList *pBodyPrAttrList)
rtl::Reference< sax_fastparser::FastAttributeList > & getTextboxAttrList()
rtl::Reference< sax_fastparser::FastAttributeList > & getFlyAttrList()
bool m_bParagraphHasDrawing
sax_fastparser::FastAttributeList * getBodyPrAttrList() const
sax_fastparser::FSHelperPtr m_pSerializer
void setTextboxAttrList(const rtl::Reference< sax_fastparser::FastAttributeList > &pTextboxAttrList)
SVXCORE_DLLPUBLIC Degree100 NormAngle36000(Degree100 a)