20#include <config_wasm_strip.h>
31#include <oox/token/namespaces.hxx>
33#include <oox/token/tokens.hxx>
35#include <initializer_list>
38#include <com/sun/star/beans/PropertyValues.hpp>
39#include <com/sun/star/beans/XPropertySet.hpp>
40#include <com/sun/star/beans/XPropertySetInfo.hpp>
41#include <com/sun/star/beans/XPropertyState.hpp>
42#include <com/sun/star/container/XChild.hpp>
43#include <com/sun/star/document/XExporter.hpp>
44#include <com/sun/star/document/XStorageBasedDocument.hpp>
45#include <com/sun/star/drawing/CircleKind.hpp>
46#include <com/sun/star/drawing/FillStyle.hpp>
47#include <com/sun/star/drawing/ConnectorType.hpp>
48#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
49#include <com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp>
50#include <com/sun/star/embed/Aspects.hpp>
51#include <com/sun/star/embed/EmbedStates.hpp>
52#include <com/sun/star/embed/XEmbeddedObject.hpp>
53#include <com/sun/star/embed/XEmbedPersist.hpp>
54#include <com/sun/star/frame/XStorable.hpp>
55#include <com/sun/star/graphic/XGraphic.hpp>
56#include <com/sun/star/i18n/ScriptType.hpp>
57#include <com/sun/star/io/XOutputStream.hpp>
58#include <com/sun/star/text/XSimpleText.hpp>
59#include <com/sun/star/text/XText.hpp>
60#include <com/sun/star/table/XTable.hpp>
61#include <com/sun/star/table/XMergeableCell.hpp>
62#include <com/sun/star/chart2/XChartDocument.hpp>
63#include <com/sun/star/frame/XModel.hpp>
64#include <com/sun/star/uno/XComponentContext.hpp>
65#include <com/sun/star/drawing/XDrawPages.hpp>
66#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
67#include <com/sun/star/presentation/ClickAction.hpp>
68#include <com/sun/star/drawing/XGluePointsSupplier.hpp>
69#include <com/sun/star/container/XIdentifierAccess.hpp>
70#include <com/sun/star/table/BorderLineStyle.hpp>
89using namespace ::css::beans;
90using namespace ::css::uno;
91using namespace ::css::drawing;
92using namespace ::css::i18n;
93using namespace ::css::table;
94using namespace ::css::container;
95using namespace ::css::document;
96using namespace ::css::text;
98using ::css::io::XOutputStream;
99using ::css::chart2::XChartDocument;
100using ::css::frame::XModel;
102using ::oox::core::XmlFilterBase;
103using ::sax_fastparser::FSHelperPtr;
109 OUString & o_rMediaType, OUString & o_rRelationType, OUString & o_rFileExtension)
111 if (rProgID ==
u"Excel.Sheet.12")
113 o_rMediaType =
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
115 o_rFileExtension =
"xlsx";
119 o_rMediaType =
"application/vnd.ms-excel.sheet.binary.macroEnabled.12";
121 o_rFileExtension =
"xlsb";
125 o_rMediaType =
"application/vnd.ms-excel.sheet.macroEnabled.12";
127 o_rFileExtension =
"xlsm";
131 o_rMediaType =
"application/vnd.ms-excel";
133 o_rFileExtension =
"xls";
135 else if (rProgID ==
u"PowerPoint.Show.12")
137 o_rMediaType =
"application/vnd.openxmlformats-officedocument.presentationml.presentation";
139 o_rFileExtension =
"pptx";
141 else if (rProgID ==
u"PowerPoint.ShowMacroEnabled.12")
143 o_rMediaType =
"application/vnd.ms-powerpoint.presentation.macroEnabled.12";
145 o_rFileExtension =
"pptm";
149 o_rMediaType =
"application/vnd.ms-powerpoint";
151 o_rFileExtension =
"ppt";
155 o_rMediaType =
"application/vnd.openxmlformats-officedocument.presentationml.slide";
157 o_rFileExtension =
"sldx";
159 else if (rProgID ==
u"PowerPoint.SlideMacroEnabled.12")
161 o_rMediaType =
"application/vnd.ms-powerpoint.slide.macroEnabled.12";
163 o_rFileExtension =
"sldm";
165 else if (rProgID ==
u"Word.DocumentMacroEnabled.12")
167 o_rMediaType =
"application/vnd.ms-word.document.macroEnabled.12";
169 o_rFileExtension =
"docm";
171 else if (rProgID ==
u"Word.Document.12")
173 o_rMediaType =
"application/vnd.openxmlformats-officedocument.wordprocessingml.document";
175 o_rFileExtension =
"docx";
177 else if (rProgID ==
u"Word.Document.8")
179 o_rMediaType =
"application/msword";
181 o_rFileExtension =
"doc";
183 else if (rProgID ==
u"Excel.Chart.8")
185 o_rMediaType =
"application/vnd.ms-excel";
187 o_rFileExtension =
"xls";
189 else if (rProgID ==
u"AcroExch.Document.11")
191 o_rMediaType =
"application/pdf";
193 o_rFileExtension =
"pdf";
197 o_rMediaType =
"application/vnd.openxmlformats-officedocument.oleObject";
199 o_rFileExtension =
"bin";
204 uno::Reference<uno::XComponentContext>
const& xContext,
205 uno::Reference<embed::XEmbeddedObject>
const& xObj,
206 char const*& o_rpProgID,
207 OUString & o_rMediaType, OUString & o_rRelationType, OUString & o_rSuffix)
213 sal_uInt8 b8, b9, b10, b11, b12, b13, b14, b15;
215 char const* pFilterName;
216 char const* pMediaType;
219 }
const s_Mapping[] = {
220 { {
SO3_SW_CLASSID_60},
"MS Word 2007 XML",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"Word.Document.12",
"docx" },
221 { {
SO3_SC_CLASSID_60},
"Calc MS Excel 2007 XML",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"Excel.Sheet.12",
"xlsx" },
222 { {
SO3_SIMPRESS_CLASSID_60},
"Impress MS PowerPoint 2007 XML",
"application/vnd.openxmlformats-officedocument.presentationml.presentation",
"PowerPoint.Show.12",
"pptx" },
229 const char * pFilterName(
nullptr);
231 for (
auto &
i : s_Mapping)
233 auto const& rId(
i.ClassId);
234 SvGlobalName const temp(rId.n1, rId.n2, rId.n3, rId.b8, rId.b9, rId.b10, rId.b11, rId.b12, rId.b13, rId.b14, rId.b15);
239 pFilterName =
i.pFilterName;
240 o_rMediaType = OUString::createFromAscii(
i.pMediaType);
241 o_rpProgID =
i.pProgID;
242 o_rSuffix = OUString::createFromAscii(
i.pSuffix);
250 SAL_WARN(
"oox.shape",
"oox::GetOLEObjectStream: unknown ClassId " << classId.
GetHexName());
254 if (embed::EmbedStates::LOADED == xObj->getCurrentState())
256 xObj->changeState(embed::EmbedStates::RUNNING);
260 uno::Reference<io::XStream>
const xTempStream(
261 xContext->getServiceManager()->createInstanceWithContext(
262 "com.sun.star.comp.MemoryStream", xContext),
263 uno::UNO_QUERY_THROW);
265 {
"OutputStream",
Any(xTempStream->getOutputStream()) },
266 {
"FilterName",
Any(OUString::createFromAscii(pFilterName)) }
268 uno::Reference<frame::XStorable> xStorable(xObj->getComponent(), uno::UNO_QUERY);
271 xStorable->storeToURL(
"private:stream",
args);
273 catch (uno::Exception
const&)
278 xTempStream->getOutputStream()->closeOutput();
279 return xTempStream->getInputStream();
283 uno::Reference<uno::XComponentContext>
const& xContext,
284 uno::Reference<embed::XEmbeddedObject>
const& xObj,
285 std::u16string_view i_rProgID,
286 OUString & o_rMediaType,
287 OUString & o_rRelationType,
288 OUString & o_rSuffix,
289 const char *& o_rpProgID)
291 uno::Reference<io::XInputStream> xInStream;
294 uno::Reference<document::XStorageBasedDocument>
const xParent(
295 uno::Reference<container::XChild>(xObj, uno::UNO_QUERY_THROW)->getParent(),
296 uno::UNO_QUERY_THROW);
297 uno::Reference<embed::XStorage>
const xParentStorage(xParent->getDocumentStorage());
298 OUString
const entryName(
299 uno::Reference<embed::XEmbedPersist>(xObj, uno::UNO_QUERY_THROW)->getEntryName());
301 if (xParentStorage->isStreamElement(entryName))
304 xInStream = xParentStorage->cloneStreamElement(entryName)->getInputStream();
310 o_rpProgID, o_rMediaType, o_rRelationType, o_rSuffix);
313 catch (uno::Exception
const&)
325 :
DrawingML(
std::move(pFS), pFB, eDocumentType, pTextExport )
326 , m_nEmbeddedObjects(0)
328 , mbUserShapes( bUserShapes )
329 , mnXmlNamespace( nXmlNamespace )
332 , mpShapeMap( pShapeMap ? pShapeMap : &maShapeMap )
346 if ( !aRetSize.
Width() )
350 return awt::Size( aRetSize.
Width(), aRetSize.
Height() );
356 return xText->getString().getLength();
368 if ( xPropSetInfo.is() )
370 if ( xPropSetInfo->hasPropertyByName(
"IsEmptyPresentationObject" ) )
372 bool bIsEmptyPresObj =
false;
373 if ( xPropSet->getPropertyValue(
"IsEmptyPresentationObject" ) >>= bIsEmptyPresObj )
375 SAL_INFO(
"oox.shape",
"empty presentation object " << bIsEmptyPresObj <<
" , props:");
376 if( bIsEmptyPresObj )
381 if ( xPropSetInfo->hasPropertyByName(
"IsPresentationObject" ) )
383 bool bIsPresObj =
false;
384 if ( xPropSet->getPropertyValue(
"IsPresentationObject" ) >>= bIsPresObj )
386 SAL_INFO(
"oox.shape",
"presentation object " << bIsPresObj <<
", props:");
399 SAL_INFO(
"oox.shape",
"write polypolygon shape");
404 awt::Point aPos = xShape->getPosition();
408 awt::Point aParentPos =
m_xParent->getPosition();
409 aPos.X -= aParentPos.X;
410 aPos.Y -= aParentPos.Y;
412 awt::Size aSize = xShape->getSize();
415#if OSL_DEBUG_LEVEL > 0
418 SAL_INFO(
"oox.shape",
"poly count " << aPolyPolygon.
Count());
472 sal_Int32 nGroupShapeToken = XML_grpSp;
476 nGroupShapeToken = XML_wgp;
502 uno::Reference<drawing::XShapes> xGroupShape(xShape, uno::UNO_QUERY_THROW);
503 uno::Reference<drawing::XShape> xParent =
m_xParent;
505 for (sal_Int32
i = 0;
i < xGroupShape->getCount(); ++
i)
507 uno::Reference<drawing::XShape> xChild(xGroupShape->getByIndex(
i), uno::UNO_QUERY_THROW);
510 uno::Reference<lang::XServiceInfo> xServiceInfo(xChild, uno::UNO_QUERY_THROW);
516 if (xServiceInfo->supportsService(
"com.sun.star.drawing.GraphicObjectShape")
534 static const std::initializer_list<std::u16string_view> vDenylist = {
550 u"round-rectangular-callout",
551 u"rectangular-callout",
559 u"horizontal-scroll",
564 u"flowchart-process",
565 u"flowchart-alternate-process",
566 u"flowchart-decision",
568 u"flowchart-predefined-process",
569 u"flowchart-internal-storage",
570 u"flowchart-document",
571 u"flowchart-multidocument",
572 u"flowchart-terminator",
573 u"flowchart-preparation",
574 u"flowchart-manual-input",
575 u"flowchart-manual-operation",
576 u"flowchart-connector",
577 u"flowchart-off-page-connector",
579 u"flowchart-punched-tape",
580 u"flowchart-summing-junction",
582 u"flowchart-collate",
584 u"flowchart-extract",
586 u"flowchart-stored-data",
588 u"flowchart-sequential-access",
589 u"flowchart-magnetic-disk",
590 u"flowchart-direct-access-storage",
594 return std::find(vDenylist.begin(), vDenylist.end(), rShapeType) != vDenylist.end();
599 static const std::initializer_list<std::u16string_view> vAllowlist = {
606 return std::find(vAllowlist.begin(), vAllowlist.end(), rShapeType) != vAllowlist.end();
612 if ( rParam.Value.getValueTypeClass() == TypeClass_DOUBLE )
615 if ( rParam.Value >>= fValue )
616 nValue =
static_cast<sal_Int32
>(fValue);
621 if ( rParam.Type == EnhancedCustomShapeParameterType::ADJUSTMENT)
625 if ( nIdx < rSeq.getLength() )
627 if ( rSeq[ nIdx ] .
Value.getValueTypeClass() == TypeClass_DOUBLE )
630 rSeq[ nIdx ].Value >>= fValue;
636 rSeq[ nIdx ].Value >>=
nValue;
644 std::vector< std::pair< sal_Int32, sal_Int32> > &rHandlePositionList,
649 static const OUStringLiteral sPosition(
u"Position" );
650 bool bPosition =
false;
651 EnhancedCustomShapeParameterPair aPosition;
652 for (
const PropertyValue& rPropVal: rPropSeq )
654 if ( rPropVal.Name == sPosition )
656 if ( rPropVal.Value >>= aPosition )
662 sal_Int32 nXPosition = 0;
663 sal_Int32 nYPosition = 0;
667 rHandlePositionList.emplace_back( nXPosition, nYPosition );
674 rAvList.emplace_back( nAdjIdx ,
nValue );
679 nAngle = nAngle % 360;
680 return nAngle < 0 ? ( nAngle + 360 ) : nAngle ;
685 if (nWidth != 0 || nHeight != 0)
687 double fAngle = basegfx::deg2rad<100>(nInternAngle);
688 fAngle = atan2(nHeight * sin(fAngle), nWidth * cos(fAngle));
689 fAngle = basegfx::rad2deg<60000>(fAngle);
691 nAngle = nAngle % 21600000;
692 return nAngle < 0 ? (nAngle + 21600000) : nAngle;
698static OUString
lcl_GetTarget(
const css::uno::Reference<css::frame::XModel>& xModel,
699 std::u16string_view rURL)
703 sal_uInt32 nPageCount = xDrawPages->getCount();
706 for (sal_uInt32
i = 0;
i < nPageCount; ++
i)
709 xDrawPages->getByIndex(
i) >>= xDrawPage;
713 OUString sSlideName =
"#" + xNamed->getName();
714 if (rURL == sSlideName)
716 sTarget =
"slide" + OUString::number(
i + 1) +
".xml";
726 SAL_INFO(
"oox.shape",
"write custom shape");
736 bool bHasGeometrySeq(
false);
738 OUString sShapeType(
"non-primitive");
741 SAL_INFO(
"oox.shape",
"got custom shape geometry");
742 if (
mAny >>= aGeometrySeq)
744 bHasGeometrySeq =
true;
745 SAL_INFO(
"oox.shape",
"got custom shape geometry sequence");
746 for (
const PropertyValue& rProp : std::as_const(aGeometrySeq))
748 SAL_INFO(
"oox.shape",
"geometry property: " << rProp.Name);
749 if (rProp.Name ==
"Type")
750 rProp.Value >>= sShapeType;
755 bool bPredefinedHandlesUsed =
true;
756 bool bHasHandles =
false;
758 ShapeFlag nMirrorFlags = ShapeFlag::NONE;
762 const bool bIsDefaultObject(
767 SAL_INFO(
"oox.shape",
"custom shape type: " << sShapeType <<
" ==> " << sPresetShape);
769 sal_Int32 nAdjustmentValuesIndex = -1;
770 awt::Rectangle aViewBox;
771 uno::Sequence<beans::PropertyValues> aHandles;
778 for (
int i = 0;
i < aGeometrySeq.getLength();
i++)
780 const PropertyValue& rProp = aGeometrySeq[
i ];
781 SAL_INFO(
"oox.shape",
"geometry property: " << rProp.Name);
783 if ( rProp.Name ==
"MirroredX" )
784 rProp.Value >>= bFlipH;
786 if ( rProp.Name ==
"MirroredY" )
787 rProp.Value >>= bFlipV;
788 if ( rProp.Name ==
"AdjustmentValues" )
789 nAdjustmentValuesIndex =
i;
790 else if ( rProp.Name ==
"Handles" )
792 rProp.Value >>= aHandles;
793 if ( aHandles.hasElements() )
795 if( !bIsDefaultObject )
796 bPredefinedHandlesUsed =
false;
799 else if ( rProp.Name ==
"ViewBox" )
800 rProp.Value >>= aViewBox;
808 bool bUseBackground =
false;
809 if (
GetProperty(rXPropSet,
"FillUseSlideBackground"))
810 mAny >>= bUseBackground;
816 bool isVisible = true ;
831 if( !sURL.isEmpty() )
838 mpFS->singleElementNS(XML_a, XML_hlinkClick,
FSNS(XML_r, XML_id), sRelId);
849 presentation::ClickAction eClickAction = presentation::ClickAction_NONE;
850 mAny >>= eClickAction;
851 if (eClickAction != presentation::ClickAction_NONE)
853 switch (eClickAction)
855 case presentation::ClickAction_STOPPRESENTATION:
856 sPPAction =
"ppaction://hlinkshowjump?jump=endshow";
858 case presentation::ClickAction_NEXTPAGE:
859 sPPAction =
"ppaction://hlinkshowjump?jump=nextslide";
861 case presentation::ClickAction_LASTPAGE:
862 sPPAction =
"ppaction://hlinkshowjump?jump=lastslide";
864 case presentation::ClickAction_PREVPAGE:
865 sPPAction =
"ppaction://hlinkshowjump?jump=previousslide";
867 case presentation::ClickAction_FIRSTPAGE:
868 sPPAction =
"ppaction://hlinkshowjump?jump=firstslide";
870 case presentation::ClickAction_BOOKMARK:
871 sBookmark =
"#" + sBookmark;
877 if (!sPPAction.isEmpty())
878 pFS->singleElementNS(XML_a, XML_hlinkClick,
FSNS(XML_r, XML_id),
"", XML_action,
881 if (!sBookmark.isEmpty())
892 mpFS->singleElementNS(XML_a, XML_hlinkClick,
FSNS(XML_r, XML_id), sRelId);
894 mpFS->singleElementNS(XML_a, XML_hlinkClick,
FSNS(XML_r, XML_id), sRelId,
895 XML_action,
"ppaction://hlinksldjump");
923 mpFS->singleElementNS(XML_a, XML_hlinkClick,
FSNS(XML_r, XML_id), sRelId);
939 bool bCustGeom =
true;
940 bool bOnDenylist =
false;
941 if( sShapeType ==
"ooxml-non-primitive" )
943 else if( sShapeType.startsWith(
"ooxml") )
953 bool bPresetWriteSuccessful =
false;
956 if (!sShapeType.startsWith(
"ooxml") && sShapeType !=
"non-primitive" && !
mbUserShapes
957 && xShape->getShapeType() ==
"com.sun.star.drawing.CustomShape"
961 bPresetWriteSuccessful = aCustomShapeConverter.
WriteShape();
964 if (bPresetWriteSuccessful)
977 else if (bOnDenylist && bHasHandles && nAdjustmentValuesIndex !=-1 && !sShapeType.startsWith(
"mso-spt"))
981 std::vector< std::pair< sal_Int32, sal_Int32> > aHandlePositionList;
982 std::vector< std::pair< sal_Int32, sal_Int32> > aAvList;
983 aGeometrySeq[ nAdjustmentValuesIndex ].Value >>= aAdjustmentSeq ;
987 sal_Int32 nXPosition = 0;
988 sal_Int32 nYPosition = 0;
989 if ( !aHandlePositionList.empty() )
991 nXPosition = aHandlePositionList[0].first ;
992 nYPosition = aHandlePositionList[0].second ;
998 sal_Int32 adj3 = double(nYPosition)/aViewBox.Height *100000;
999 sal_Int32 adj4 = double(nXPosition)/aViewBox.Width *100000;
1008 sal_Int32 adj5 = double(nYPosition)/aViewBox.Height *100000;
1009 sal_Int32 adj6 = double(nXPosition)/aViewBox.Width *100000;
1010 sal_Int32 adj3 = 18750;
1011 sal_Int32 adj4 = -16667;
1014 if ( aHandlePositionList.size() > 1 )
1016 nXPosition = aHandlePositionList[1].first ;
1017 nYPosition = aHandlePositionList[1].second ;
1018 adj3 = double(nYPosition)/aViewBox.Height *100000;
1019 adj4 = double(nXPosition)/aViewBox.Width *100000;
1032 sal_Int32 adj1 = (double(nXPosition)/aViewBox.Width -0.5) *100000;
1033 sal_Int32 adj2 = (double(nYPosition)/aViewBox.Height -0.5) *100000;
1045 sal_Int32 adj = double( aViewBox.Width - nXPosition) / std::min( aViewBox.Width,aViewBox.Height ) * 100000;
1057 sal_Int32 adj = double( nXPosition )/aViewBox.Width*100000 ;
1066 sal_Int32 adj = double( nYPosition )/aViewBox.Height *100000 ;
1072 sal_Int32 adj = double( nYPosition )/aViewBox.Height *100000 - 76458.0;
1078 sal_Int32 nRadius = 50000 * ( 1 - double(nXPosition) / 10800);
1091 if ( sPresetShape ==
"frame" )
1093 sal_Int32 adj1 = double( nYPosition )/aViewBox.Height *100000 ;
1104 if( nAdjustmentValuesIndex != -1 )
1107 aGeometrySeq[ nAdjustmentValuesIndex ] );
1112 if( rXPropSet.is() )
1114 WriteFill(rXPropSet, xShape->getSize());
1118 bool bHas3DEffectinShape =
false;
1119 uno::Sequence<beans::PropertyValue> grabBag;
1120 rXPropSet->getPropertyValue(
"InteropGrabBag") >>= grabBag;
1122 for (
auto const& it : std::as_const(grabBag))
1123 if (it.Name ==
"3DEffectProperties")
1124 bHas3DEffectinShape =
true;
1126 if( bHas3DEffectinShape)
1146 SAL_INFO(
"oox.shape",
"write ellipse shape");
1169 CircleKind eCircleKind(CircleKind_FULL);
1171 xProps->getPropertyValue(
"CircleKind" ) >>= eCircleKind;
1177 if (CircleKind_FULL == eCircleKind)
1181 sal_Int32 nStartAngleIntern(9000);
1182 sal_Int32 nEndAngleIntern(0);
1185 xProps->getPropertyValue(
"CircleStartAngle" ) >>= nStartAngleIntern;
1186 xProps->getPropertyValue(
"CircleEndAngle") >>= nEndAngleIntern;
1188 std::vector< std::pair<sal_Int32,sal_Int32>> aAvList;
1189 awt::Size aSize = xShape->getSize();
1190 if (aSize.Width != 0 || aSize.Height != 0)
1199 switch (eCircleKind)
1201 case CircleKind_ARC :
1204 case CircleKind_SECTION :
1207 case CircleKind_CUT :
1216 if (CircleKind_ARC == eCircleKind)
1223 aNewValue <<= eFillStyle;
1224 xProps->setPropertyValue(
"FillStyle", aNewValue);
1248 SAL_INFO(
"oox.shape",
"write graphic object shape");
1252 SAL_INFO(
"oox.shape",
"graphicObject: wrote only text");
1259 SAL_INFO(
"oox.shape",
"graphicObject without text");
1261 uno::Reference<graphic::XGraphic> xGraphic;
1270 else if (xShapeProps.is() && xShapeProps->getPropertySetInfo()->hasPropertyByName(
"Graphic"))
1272 xShapeProps->getPropertyValue(
"Graphic") >>= xGraphic;
1275 bool bHasMediaURL = xShapeProps.is() && xShapeProps->getPropertySetInfo()->hasPropertyByName(
"MediaURL") && (xShapeProps->getPropertyValue(
"MediaURL") >>= sMediaURL);
1277 if (!xGraphic.is() && !bHasMediaURL)
1279 SAL_INFO(
"oox.shape",
"no graphic or media URL found");
1294 presentation::ClickAction eClickAction = presentation::ClickAction_NONE;
1295 OUString sDescr, sURL, sBookmark, sPPAction;
1298 if ( ( bHaveDesc =
GetProperty( xShapeProps,
"Description" ) ) )
1305 mAny >>= eClickAction;
1312 if (eClickAction != presentation::ClickAction_NONE)
1314 switch (eClickAction)
1316 case presentation::ClickAction_STOPPRESENTATION:
1317 sPPAction =
"ppaction://hlinkshowjump?jump=endshow";
1319 case presentation::ClickAction_NEXTPAGE:
1320 sPPAction =
"ppaction://hlinkshowjump?jump=nextslide";
1322 case presentation::ClickAction_LASTPAGE:
1323 sPPAction =
"ppaction://hlinkshowjump?jump=lastslide";
1325 case presentation::ClickAction_PREVPAGE:
1326 sPPAction =
"ppaction://hlinkshowjump?jump=previousslide";
1328 case presentation::ClickAction_FIRSTPAGE:
1329 sPPAction =
"ppaction://hlinkshowjump?jump=firstslide";
1331 case presentation::ClickAction_BOOKMARK:
1332 sBookmark =
"#" + sBookmark;
1340 if (bHasMediaURL || !sPPAction.isEmpty())
1341 pFS->singleElementNS(XML_a, XML_hlinkClick,
FSNS(XML_r, XML_id),
"", XML_action,
1342 bHasMediaURL ?
"ppaction://media" : sPPAction);
1343 if( !sURL.isEmpty() )
1350 mpFS->singleElementNS(XML_a, XML_hlinkClick,
FSNS(XML_r, XML_id), sRelId);
1353 if (!sBookmark.isEmpty())
1361 sBookmark, bExtURL);
1364 mpFS->singleElementNS(XML_a, XML_hlinkClick,
FSNS(XML_r, XML_id), sRelId);
1366 mpFS->singleElementNS(XML_a, XML_hlinkClick,
FSNS(XML_r, XML_id), sRelId, XML_action,
1367 "ppaction://hlinksldjump");
1387 else if (bHasMediaURL)
1390 if (xShapeProps->getPropertySetInfo()->hasPropertyByName(
"FallbackGraphic"))
1391 xShapeProps->getPropertyValue(
"FallbackGraphic") >>= xFallbackGraphic;
1403 bool bStretch =
false;
1404 if( !pGraphic &&
GetProperty( xShapeProps,
"FillBitmapStretch" ) )
1407 if ( pGraphic || bStretch )
1408 pFS->singleElementNS(XML_a, XML_stretch);
1413 pFS->startElementNS(XML_a, XML_stretch);
1414 pFS->singleElementNS(XML_a, XML_fillRect);
1415 pFS->endElementNS(XML_a, XML_stretch);
1422 bool bFlipH =
false;
1423 if( xShapeProps->getPropertySetInfo()->hasPropertyByName(
"IsMirrored") )
1425 xShapeProps->getPropertyValue(
"IsMirrored") >>= bFlipH;
1440static void lcl_Rotate(sal_Int32 nAngle, Point center, awt::Point& pt)
1442 sal_Int16 nCos, nSin;
1468 Point aStart = aPoly[0];
1471 if (aStart.X() > aEnd.X() && aStart.Y() > aEnd.Y())
1487 if (aStart.X() < aEnd.X() && aStart.Y() < aEnd.Y())
1501 if (aStart.Y() < aEnd.Y() && aStart.X() > aEnd.X())
1519 if (aStart.Y() > aEnd.Y() && aStart.X() < aEnd.X())
1539 Point aStartPoint = aPoly[0];
1541 if (aStartPoint.X() == aPoly[1].X())
1543 if ((aStartPoint.X() < aEndPoint.X() && aStartPoint.Y() > aEndPoint.Y())
1544 || (aStartPoint.X() > aEndPoint.X() && aStartPoint.Y() < aEndPoint.Y()))
1553 if (aStartPoint.X() > aPoly[1].X())
1564 ConnectorType eConnectorType,
1565 std::vector<std::pair<sal_Int32, sal_Int32>>& rAvList)
1567 sal_Int32 nAdjCount = 0;
1568 if (eConnectorType == ConnectorType_CURVE)
1572 if ((aPoly[0].
X() == aPoly[1].
X() && aPoly[2].
X() == aPoly[3].
X())
1573 || (aPoly[0].
Y() == aPoly[1].
Y() && aPoly[2].
Y() == aPoly[3].
Y()))
1582 if ((aPoly[2].
X() == aPoly[3].
X() && aPoly[3].
X() == aPoly[4].
X())
1583 || (aPoly[2].
Y() == aPoly[3].
Y() && aPoly[3].
Y() == aPoly[4].
Y()))
1612 sal_Int32 nAdjustValue;
1613 Point aStart = aPoly[0];
1616 for (sal_Int32
i = 1;
i <= nAdjCount; ++
i)
1620 if (aEnd.Y() == aStart.Y())
1621 aEnd.setY(aStart.Y() + 1);
1622 if (aEnd.X() == aStart.X())
1623 aEnd.setX(aStart.X() + 1);
1625 bool bVertical = aPoly[1].X() - aStart.X() != 0 ? true :
false;
1628 bVertical = !bVertical;
1630 if (eConnectorType == ConnectorType_CURVE)
1632 awt::Size aSize = xShape->getSize();
1633 awt::Point aShapePosition = xShape->getPosition();
1639 aPt.setY(aPoly[
i + 1].
Y());
1640 else if (aStart.Y() > aPt.Y())
1641 aPt.setY(aShapePosition.Y);
1643 aPt.setY(aShapePosition.Y + aSize.Height);
1648 aPt.setX(aPoly[
i + 1].
X());
1649 else if (aStart.X() > aPt.X())
1650 aPt.setX(aShapePosition.X);
1652 aPt.setX(aShapePosition.X + aSize.Width);
1657 nAdjustValue = ((aPt.Y() - aStart.Y()) * 100000) / (aEnd.Y() - aStart.Y());
1659 nAdjustValue = ((aPt.X() - aStart.X()) * 100000) / (aEnd.X() - aStart.X());
1661 rAvList.emplace_back(
i, nAdjustValue);
1668 if (nGluePointId > 3)
1669 return nGluePointId - 4;
1672 bool bFlipH =
false;
1673 bool bFlipV =
false;
1675 if (xShapeProps->getPropertySetInfo()->hasPropertyByName(
"CustomShapeGeometry"))
1678 xShapeProps->getPropertyValue(
"CustomShapeGeometry") >>= aGeometrySeq;
1679 for (
int i = 0;
i < aGeometrySeq.getLength();
i++)
1681 const PropertyValue& rProp = aGeometrySeq[
i];
1682 if (rProp.Name ==
"MirroredX")
1683 rProp.Value >>= bFlipH;
1685 if (rProp.Name ==
"MirroredY")
1686 rProp.Value >>= bFlipV;
1690 if ((!bFlipH && !bFlipV) || (bFlipH && bFlipV))
1693 if (nGluePointId == 1)
1695 else if (nGluePointId == 3)
1700 return nGluePointId;
1705 bool bFlipH =
false;
1706 bool bFlipV =
false;
1707 sal_Int32 nAngle = 0;
1708 sal_Int32 nStartGlueId = 0;
1709 sal_Int32 nEndGlueId = 0;
1711 SAL_INFO(
"oox.shape",
"write connector shape");
1716 std::vector<std::pair<sal_Int32, sal_Int32>> aAdjustValueList;
1719 awt::Point aStartPoint, aEndPoint;
1722 PropertyState eState;
1723 ConnectorType eConnectorType = ConnectorType_STANDARD;
1725 mAny >>= eConnectorType;
1727 switch( eConnectorType ) {
1728 case ConnectorType_CURVE:
1729 sGeometry =
"curvedConnector";
1731 case ConnectorType_LINES:
1732 case ConnectorType_STANDARD:
1733 sGeometry =
"bentConnector";
1736 case ConnectorType_LINE:
1737 sGeometry =
"straightConnector1";
1741 if (
GetPropertyAndState( rXPropSet, rXPropState,
"EdgeStartPoint", eState ) && eState == beans::PropertyState_DIRECT_VALUE )
1743 mAny >>= aStartPoint;
1744 if (
GetPropertyAndState( rXPropSet, rXPropState,
"EdgeEndPoint", eState ) && eState == beans::PropertyState_DIRECT_VALUE )
1747 if (
GetProperty(rXPropSet,
"EdgeStartConnection"))
1752 if (
GetProperty(rXPropSet,
"StartGluePointIndex"))
1753 mAny >>= nStartGlueId;
1754 if (nStartGlueId != -1)
1758 mAny >>= nEndGlueId;
1759 if (nEndGlueId != -1)
1765 awt::Point aParentPos =
m_xParent->getPosition();
1766 aStartPoint.X -= aParentPos.X;
1767 aStartPoint.Y -= aParentPos.Y;
1768 aEndPoint.X -= aParentPos.X;
1769 aEndPoint.Y -= aParentPos.Y;
1773 if (eConnectorType != ConnectorType_LINE)
1776 if (aPolyPolygon.
Count() > 0)
1784 Point center((aEndPoint.X + aStartPoint.X) / 2, (aEndPoint.Y + aStartPoint.Y) / 2);
1789 sGeometry = sGeometry + OUString::number(aAdjustValueList.size() + 2);
1796 aRect.
setWidth( aStartPoint.X - aEndPoint.X );
1797 if (eConnectorType == ConnectorType_LINE)
1802 aRect.
SetTop(aEndPoint.Y);
1803 aRect.
setHeight( aStartPoint.Y - aEndPoint.Y );
1804 if (eConnectorType == ConnectorType_LINE)
1809 const auto nShapeNode = (
mnXmlNamespace == XML_wps ? XML_wsp : XML_cxnSp);
1844 if( xShapeProps.is() )
1849 if( nShapeNode != XML_cxnSp )
1862 bool bFlipH =
false;
1863 bool bFlipV =
false;
1865 SAL_INFO(
"oox.shape",
"write line shape");
1872 if( aPolyPolygon.
Count() == 1 && aPolyPolygon[ 0 ].GetSize() == 2)
1876 bFlipH = ( rPoly[ 0 ].X() > rPoly[ 1 ].X() );
1877 bFlipV = ( rPoly[ 0 ].Y() > rPoly[ 1 ].Y() );
1900 if( xShapeProps.is() )
1934 SAL_INFO(
"oox.shape",
"write rectangle shape");
1940 sal_Int32 nRadius = 0;
1943 if( xShapeProps.is() )
1945 xShapeProps->getPropertyValue(
"CornerRadius" ) >>= nRadius;
1950 nRadius =
MapSize( awt::Size( nRadius, 0 ) ).Width;
2029 return shape_converters;
2035 throw lang::IllegalArgumentException();
2037 OUString sShapeType = xShape->getShapeType();
2038 SAL_INFO(
"oox.shape",
"write shape: " << sShapeType);
2039 NameToConvertMapType::const_iterator aConverter
2043 SAL_INFO(
"oox.shape",
"unknown shape");
2050 if (xShapeProperties && xShapeProperties->getPropertySetInfo()
2051 && xShapeProperties->getPropertySetInfo()->hasPropertyByName(
"IsPresentationObject")
2052 && xShapeProperties->getPropertyValue(
"IsPresentationObject").hasValue())
2053 mbPlaceholder = xShapeProperties->getPropertyValue(
"IsPresentationObject").get<
bool>();
2056 (this->*(aConverter->second))( xShape );
2063 uno::Reference<beans::XPropertySet> xPropertySet(xIface, uno::UNO_QUERY);
2064 if (!xPropertySet.is())
2066 uno::Reference<beans::XPropertySetInfo> xPropertySetInfo = xPropertySet->getPropertySetInfo();
2067 if (!xPropertySetInfo->hasPropertyByName(
"TextBox"))
2069 css::uno::Any aTextBox(xPropertySet->getPropertyValue(
"TextBox"));
2070 if (!aTextBox.hasValue())
2072 return aTextBox.get<
bool>();
2083 WriteText( xIface,
true,
false, nXmlNamespace );
2094 pFS->startElementNS(nXmlNamespace,
2097 0, bWritePropertiesAsLstStyles);
2100 WriteText( xIface,
true,
false, nXmlNamespace );
2103 mpFS->singleElementNS(nXmlNamespace, XML_bodyPr);
2113 mpFS->startElementNS(XML_a, XML_graphic);
2114 mpFS->startElementNS(XML_a, XML_graphicData,
2115 XML_uri,
"http://schemas.openxmlformats.org/drawingml/2006/table");
2117 if ( xPropSet.is() && ( xPropSet->getPropertyValue(
"Model" ) >>= xTable ) )
2119 mpFS->startElementNS(XML_a, XML_tbl);
2120 mpFS->startElementNS(XML_a, XML_tblPr);
2122 mpFS->endElementNS(XML_a, XML_tblPr);
2126 sal_uInt16 nRowCount =
static_cast< sal_uInt16
>( xRows->getCount() );
2127 sal_uInt16 nColumnCount =
static_cast< sal_uInt16
>( xColumns->getCount() );
2129 mpFS->startElementNS(XML_a, XML_tblGrid);
2131 for ( sal_Int32
x = 0;
x < nColumnCount;
x++ )
2134 sal_Int32 nWidth(0);
2135 xColPropSet->getPropertyValue(
"Width" ) >>= nWidth;
2137 mpFS->singleElementNS(XML_a, XML_gridCol,
2141 mpFS->endElementNS( XML_a, XML_tblGrid );
2144 typedef std::unordered_map<sal_Int32, std::pair<sal_Int32, Reference< XMergeableCell> > > transposeTableMap;
2145 transposeTableMap mergedCellMap;
2147 for( sal_Int32 nRow = 0; nRow < nRowCount; nRow++ )
2150 sal_Int32 nRowHeight(0);
2152 xRowPropSet->getPropertyValue(
"Height" ) >>= nRowHeight;
2154 mpFS->startElementNS(XML_a, XML_tr,
2156 for( sal_Int32 nColumn = 0; nColumn < nColumnCount; nColumn++ )
2160 sal_Int32 transposedIndexofCell = (nRow * nColumnCount) + nColumn;
2163 bool bCellOpened =
true;
2165 if(xCell->getColumnSpan() > 1 && xCell->getRowSpan() > 1)
2168 mpFS->startElementNS(XML_a, XML_tc,
2169 XML_gridSpan, OString::number(xCell->getColumnSpan()),
2170 XML_rowSpan, OString::number(xCell->getRowSpan()));
2175 for(sal_Int32 columnIndex = nColumn; columnIndex < nColumn+xCell->getColumnSpan(); ++columnIndex)
2177 for(sal_Int32 rowIndex = nRow; rowIndex < nRow+xCell->getRowSpan(); ++rowIndex)
2179 sal_Int32 transposeIndexForMergeCell =
2180 (rowIndex * nColumnCount) + columnIndex;
2181 mergedCellMap[transposeIndexForMergeCell] =
2182 std::make_pair(transposedIndexofCell, xCell);
2187 else if(xCell->getColumnSpan() > 1)
2190 mpFS->startElementNS(XML_a, XML_tc,
2191 XML_gridSpan, OString::number(xCell->getColumnSpan()));
2192 for(sal_Int32 columnIndex = nColumn; columnIndex < nColumn + xCell->getColumnSpan(); ++columnIndex) {
2193 sal_Int32 transposeIndexForMergeCell = (nRow*nColumnCount) + columnIndex;
2194 mergedCellMap[transposeIndexForMergeCell] =
2195 std::make_pair(transposedIndexofCell, xCell);
2198 else if(xCell->getRowSpan() > 1)
2201 mpFS->startElementNS(XML_a, XML_tc,
2202 XML_rowSpan, OString::number(xCell->getRowSpan()));
2204 for(sal_Int32 rowIndex = nRow; rowIndex < nRow + xCell->getRowSpan(); ++rowIndex) {
2205 sal_Int32 transposeIndexForMergeCell = (rowIndex*nColumnCount) + nColumn;
2206 mergedCellMap[transposeIndexForMergeCell] =
2207 std::make_pair(transposedIndexofCell, xCell);
2214 if(!xCell->isMerged())
2217 mpFS->startElementNS(XML_a, XML_tc);
2223 transposeTableMap::iterator it = mergedCellMap.find(transposedIndexofCell);
2224 if(it != mergedCellMap.end())
2226 sal_Int32 transposeIndexOfParent = it->second.first;
2229 sal_Int32 parentColumnIndex = transposeIndexOfParent % nColumnCount;
2230 sal_Int32 parentRowIndex = transposeIndexOfParent / nColumnCount;
2231 if(nColumn == parentColumnIndex)
2234 if(parentCell->getColumnSpan() > 1)
2237 mpFS->startElementNS(XML_a, XML_tc,
2238 XML_vMerge, OString::number(1),
2239 XML_gridSpan, OString::number(xCell->getColumnSpan()));
2244 mpFS->startElementNS(XML_a, XML_tc,
2245 XML_vMerge, OString::number(1));
2248 else if(nRow == parentRowIndex)
2251 if(parentCell->getRowSpan() > 1)
2254 mpFS->startElementNS(XML_a, XML_tc,
2255 XML_hMerge, OString::number(1),
2256 XML_rowSpan, OString::number(xCell->getRowSpan()));
2261 mpFS->startElementNS(XML_a, XML_tc,
2262 XML_hMerge, OString::number(1));
2268 mpFS->startElementNS(XML_a, XML_tc,
2269 XML_vMerge, OString::number(1),
2270 XML_hMerge, OString::number(1));
2274 bCellOpened =
false;
2285 mpFS->endElementNS( XML_a, XML_tc );
2289 mpFS->endElementNS( XML_a, XML_tr );
2292 mpFS->endElementNS( XML_a, XML_tbl );
2295 mpFS->endElementNS( XML_a, XML_graphicData );
2296 mpFS->endElementNS( XML_a, XML_graphic );
2302 TextVerticalAdjust eVerticalAlignment;
2303 const char* sVerticalAlignment;
2305 Any aLeftMargin = xCellPropSet->getPropertyValue(
"TextLeftDistance");
2308 Any aRightMargin = xCellPropSet->getPropertyValue(
"TextRightDistance");
2311 Any aVerticalAlignment = xCellPropSet->getPropertyValue(
"TextVerticalAdjust");
2312 aVerticalAlignment >>= eVerticalAlignment;
2315 sal_Int32 nRotateAngle = 0;
2316 Any aRotateAngle = xCellPropSet->getPropertyValue(
"RotateAngle");
2317 aRotateAngle >>= nRotateAngle;
2321 if( !aTextVerticalValue &&
2322 (xCellPropSet->getPropertyValue(
"CellInteropGrabBag") >>= aGrabBag) )
2324 for (
auto const& rIt : std::as_const(aGrabBag))
2326 if (rIt.Name ==
"mso-tcPr-vert-value")
2328 aTextVerticalValue = rIt.Value.get<OUString>().toUtf8();
2334 mpFS->startElementNS(XML_a, XML_tcPr, XML_anchor, sVerticalAlignment,
2335 XML_vert, aTextVerticalValue,
2344 mpFS->endElementNS( XML_a, XML_tcPr );
2357 mpFS->startElementNS(XML_a, XML_line, XML_w, OString::number(
nBorderWidth));
2358 if ( rBorderLine.Color == sal_Int32(
COL_AUTO ) )
2359 mpFS->singleElementNS(XML_a, XML_noFill);
2363 OUString sBorderStyle;
2364 sal_Int16 nStyle = rBorderLine.LineStyle;
2366 switch (*o3tl::doAccess<sal_Int16>(
mAny))
2368 case ::table::BorderLineStyle::SOLID:
2369 sBorderStyle =
"solid";
2371 case ::table::BorderLineStyle::DOTTED:
2372 sBorderStyle =
"dot";
2374 case ::table::BorderLineStyle::DASHED:
2375 sBorderStyle =
"dash";
2377 case ::table::BorderLineStyle::DASH_DOT:
2378 sBorderStyle =
"dashDot";
2380 case ::table::BorderLineStyle::DASH_DOT_DOT:
2381 sBorderStyle =
"sysDashDotDot";
2384 mpFS->singleElementNS(XML_a, XML_prstDash, XML_val, sBorderStyle);
2385 mpFS->endElementNS(XML_a, XML_line);
2389 mpFS->startElementNS(XML_a, XML_line);
2390 mpFS->singleElementNS(XML_a, XML_noFill);
2391 mpFS->endElementNS( XML_a, XML_line );
2397 BorderLine2 aBorderLine;
2400 xCellPropSet->getPropertyValue(
"LeftBorder") >>= aBorderLine;
2404 xCellPropSet->getPropertyValue(
"RightBorder") >>= aBorderLine;
2408 xCellPropSet->getPropertyValue(
"TopBorder") >>= aBorderLine;
2412 xCellPropSet->getPropertyValue(
"BottomBorder") >>= aBorderLine;
2460 if (!sURL.isEmpty())
2467 mpFS->singleElementNS(XML_a, XML_hlinkClick,
FSNS(XML_r, XML_id), sRelId);
2471 pFS->singleElementNS(
mnXmlNamespace, XML_cNvSpPr, XML_txBox,
"1");
2482 uno::Reference<beans::XPropertySet> xPropertySet(xShape, UNO_QUERY);
2501 assert(xPropSet.is());
2503 xPropSet->getPropertyValue(
"Model") >>= xMathModel;
2504 assert(xMathModel.is());
2510 mpFS->startElementNS(XML_mc, XML_AlternateContent);
2511 mpFS->startElementNS(XML_mc, XML_Choice,
2513 XML_Requires,
"a14");
2527 mpFS->startElementNS(XML_a, XML_bodyPr);
2528 mpFS->endElementNS(XML_a, XML_bodyPr);
2529 mpFS->startElementNS(XML_a, XML_p);
2530 mpFS->startElementNS(XML_a14, XML_m);
2532 oox::FormulaImExportBase *
const pMagic(
2533 dynamic_cast<oox::FormulaImExportBase*
>(xMathModel.get()));
2536 FormulaImExportBase::eFormulaAlign::INLINE);
2538 mpFS->endElementNS(XML_a14, XML_m);
2539 mpFS->endElementNS(XML_a, XML_p);
2542 mpFS->endElementNS(XML_mc, XML_Choice);
2543 mpFS->startElementNS(XML_mc, XML_Fallback);
2545 mpFS->endElementNS(XML_mc, XML_Fallback);
2546 mpFS->endElementNS(XML_mc, XML_AlternateContent);
2557 xPropSet->getPropertyValue(
"CLSID") >>= clsid;
2558 if (!clsid.isEmpty())
2561 bool const isValid =
aClassID.MakeId(clsid);
2562 assert(isValid); (void)isValid;
2572 xPropSet->getPropertyValue(
"Model") >>= xChartDoc;
2573 assert(xChartDoc.is());
2575#if !ENABLE_WASM_STRIP_CHART
2591 uno::Reference<embed::XEmbeddedObject>
const xObj(
2592 xPropSet->getPropertyValue(
"EmbeddedObject"), uno::UNO_QUERY);
2596 SAL_WARN(
"oox.shape",
"ShapeExport::WriteOLE2Shape: no object");
2600 if (
auto pOle2Obj =
dynamic_cast<SdrOle2Obj*
>(pSdrOLE2))
2602 const Graphic* pGraphic = pOle2Obj->GetGraphic();
2610 uno::Sequence<beans::PropertyValue> grabBag;
2614 uno::Reference<beans::XPropertySet>
const xParent(
2615 uno::Reference<container::XChild>(xObj, uno::UNO_QUERY_THROW)->getParent(),
2616 uno::UNO_QUERY_THROW);
2618 xParent->getPropertyValue(
"InteropGrabBag") >>= grabBag;
2620 entryName = uno::Reference<embed::XEmbedPersist>(xObj, uno::UNO_QUERY_THROW)->getEntryName();
2622 catch (uno::Exception
const&)
2630 for (
auto const& it : std::as_const(grabBag))
2632 if (it.Name ==
"EmbeddedObjects")
2634 uno::Sequence<beans::PropertyValue> objects;
2635 it.Value >>= objects;
2636 for (
auto const&
object : std::as_const(objects))
2638 if (
object.
Name == entryName)
2640 uno::Sequence<beans::PropertyValue>
props;
2641 object.Value >>=
props;
2642 for (
auto const& prop : std::as_const(
props))
2644 if (prop.Name ==
"ProgID")
2646 prop.Value >>= progID;
2658 OUString sRelationType;
2660 const char * pProgID(
nullptr);
2661 OString anotherProgID;
2663 uno::Reference<io::XInputStream>
const xInStream =
2670 if (!xInStream.is())
2672 xPropSet->getPropertyValue(
"LinkURL") >>= sURL;
2681 if (!pProgID && !progID.isEmpty())
2684 pProgID = anotherProgID.getStr();
2688 assert(!sRelationType.isEmpty());
2695 assert(xOutStream.is());
2701 catch (uno::Exception
const&)
2707 mpFS->getOutputStream(), sRelationType,
2712 bool bShowAsIcon = (xPropSet->getPropertyValue(
"Aspect") >>= nAspect)
2713 && nAspect == embed::Aspects::MSOLE_ICON;
2731 mpFS->startElementNS(XML_a, XML_graphic);
2732 mpFS->startElementNS(XML_a, XML_graphicData,
2733 XML_uri,
"http://schemas.openxmlformats.org/presentationml/2006/ole");
2738 XML_progId, pProgID,
2739 FSNS(XML_r, XML_id), sRelId,
2747 FSNS(XML_r, XML_id), sRelId,
2762 if (
auto pOle2Obj =
dynamic_cast<SdrOle2Obj*
>(pSdrOLE2))
2764 const Graphic* pGraphic = pOle2Obj->GetGraphic();
2771 mpFS->endElementNS( XML_a, XML_graphicData );
2772 mpFS->endElementNS( XML_a, XML_graphic );
2795 sal_Int32 nID = pFB->GetUniqueId();
2797 (*mpShapeMap)[ rXShape ] = nID;
2812 ShapeHashMap::const_iterator aIter = pShapeMap->find( rXShape );
2814 if( aIter == pShapeMap->end() )
2817 return aIter->second;
constexpr OUStringLiteral sMediaType
static MSO_SPT GetCustomShapeType(const css::uno::Reference< css::drawing::XShape > &rXShape, ShapeFlag &nMirrorFlags, OUString &rShapeType, bool bOOXML=false)
static tools::PolyPolygon GetPolyPolygon(const css::uno::Reference< css::drawing::XShape > &rXShape)
static bool IsDefaultObject(const SdrObjCustomShape &rSdrObjCustomShape, const MSO_SPT eShapeType)
css::uno::Reference< css::graphic::XGraphic > GetXGraphic() const
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
static SdrObject * getSdrObjectFromXShape(const css::uno::Reference< css::uno::XInterface > &xInt)
constexpr tools::Long Height() const
tools::Long AdjustHeight(tools::Long n)
tools::Long AdjustWidth(tools::Long n)
constexpr tools::Long Width() const
static sal_uInt16 IsChart(const SvGlobalName &rName)
static sal_uInt16 IsMath(const SvGlobalName &rName)
OUString GetHexName() const
static void CopyInputToOutput(const css::uno::Reference< css::io::XInputStream > &xInput, const css::uno::Reference< css::io::XOutputStream > &xOutput)
#define SO3_SC_CLASSID_60
#define SO3_SM_CLASSID_60
#define SO3_SW_CLASSID_60
#define SO3_SCH_CLASSID_60
#define SO3_SIMPRESS_CLASSID_60
OoxmlVersion getVersion() const
const css::uno::Reference< css::uno::XComponentContext > & getComponentContext() const
Returns the component context passed in the filter constructor (always existing).
OUString addRelation(const OUString &rType, std::u16string_view rTarget)
Adds new relation.
css::uno::Reference< css::io::XOutputStream > openFragmentStream(const OUString &rStreamName, const OUString &rMediaType)
Opens and returns the specified output stream from the base storage with specified media type.
OUString getNamespaceURL(sal_Int32 nNSID) const
void WriteChartObj(const css::uno::Reference< css::drawing::XShape > &xShape, sal_Int32 nID, sal_Int32 nChartCount)
Class for exporting the custom shapes to OOXML preset ones, if possible.
Interface to be implemented by the parent exporter that knows how to handle shape text.
virtual void WriteTextBox(css::uno::Reference< css::drawing::XShape > xShape)=0
Write the contents of the textbox that is associated to this shape.
const char * GetComponentDir() const
::oox::core::XmlFilterBase * mpFB
void WriteShapeStyle(const css::uno::Reference< css::beans::XPropertySet > &rXPropSet)
static sal_Int32 mnChartCount
void WriteEmptyCustomGeometry()
DMLTextExport * GetTextExport()
The application-specific text exporter callback, if there is one.
void WriteMediaNonVisualProperties(const css::uno::Reference< css::drawing::XShape > &xShape)
Output the media (including copying a video from vnd.sun.star.Package: to the output if necessary).
void WriteShapeEffects(const css::uno::Reference< css::beans::XPropertySet > &rXPropSet)
void WriteText(const css::uno::Reference< css::uno::XInterface > &rXIface, bool bBodyPr, bool bText=true, sal_Int32 nXmlNamespace=0, bool bWritePropertiesAsLstStyles=false)
::sax_fastparser::FSHelperPtr mpFS
bool GetProperty(const css::uno::Reference< css::beans::XPropertySet > &rXPropSet, const OUString &aName)
void WriteConnectorConnections(sal_Int32 nStartGlueId, sal_Int32 nEndGlueId, sal_Int32 nStartID, sal_Int32 nEndID)
void Write3DEffects(const css::uno::Reference< css::beans::XPropertySet > &rXPropSet, bool bIsText)
Populates scene3d tag.
bool WriteCustomGeometry(const css::uno::Reference< css::drawing::XShape > &rXShape, const SdrObjCustomShape &rSdrObjCustomShape)
void WriteFill(const css::uno::Reference< css::beans::XPropertySet > &xPropSet, const css::awt::Size &rSize={})
bool IsFontworkShape(const css::uno::Reference< css::beans::XPropertySet > &rXShapePropSet)
const ::sax_fastparser::FSHelperPtr & GetFS() const
void WriteTransformation(const css::uno::Reference< css::drawing::XShape > &xShape, const tools::Rectangle &rRectangle, sal_Int32 nXmlNamespace, bool bFlipH=false, bool bFlipV=false, sal_Int32 nRotation=0, bool bIsGroupShape=false)
::oox::core::XmlFilterBase * GetFB()
void WriteBlipOrNormalFill(const css::uno::Reference< css::beans::XPropertySet > &rXPropSet, const OUString &rURLPropName, const css::awt::Size &rSize={})
DocumentType GetDocumentType() const
css::uno::Reference< css::drawing::XShape > m_xParent
If set, this is the parent of the currently handled shape.
const char * GetRelationCompPrefix() const
void WriteShapeTransformation(const css::uno::Reference< css::drawing::XShape > &rXShape, sal_Int32 nXmlNamespace, bool bFlipH=false, bool bFlipV=false, bool bSuppressRotation=false, bool bSuppressFlipping=false, bool bFlippedBeforeRotation=false)
void WriteSolidFill(::Color nColor, sal_Int32 nAlpha=MAX_PERCENT)
bool GetPropertyAndState(const css::uno::Reference< css::beans::XPropertySet > &rXPropSet, const css::uno::Reference< css::beans::XPropertyState > &rXPropState, const OUString &aName, css::beans::PropertyState &eState)
void WriteSrcRectXGraphic(css::uno::Reference< css::beans::XPropertySet > const &rxPropertySet, css::uno::Reference< css::graphic::XGraphic > const &rxGraphic)
bool mbPlaceholder
True when exporting presentation placeholder shape.
void WritePresetShape(const OString &pShape, std::vector< std::pair< sal_Int32, sal_Int32 > > &rAvList)
void WritePolyPolygon(const css::uno::Reference< css::drawing::XShape > &rXShape, const bool bClosed)
void WriteOutline(const css::uno::Reference< css::beans::XPropertySet > &rXPropSet, css::uno::Reference< css::frame::XModel > const &xModel=nullptr)
OUString WriteXGraphicBlip(css::uno::Reference< css::beans::XPropertySet > const &rXPropSet, css::uno::Reference< css::graphic::XGraphic > const &rxGraphic, bool bRelPathToMedia)
css::awt::Size MapSize(const css::awt::Size &) const
virtual ShapeExport & WriteTextShape(const css::uno::Reference< css::drawing::XShape > &xShape)
ShapeExport & WriteCustomShape(const css::uno::Reference< css::drawing::XShape > &xShape)
ShapeExport & WriteGroupShape(const css::uno::Reference< css::drawing::XShape > &xShape)
OUString GetShapeName(const css::uno::Reference< css::drawing::XShape > &xShape)
ShapeExport & WriteClosedPolyPolygonShape(const css::uno::Reference< css::drawing::XShape > &xShape)
virtual ShapeExport & WriteNonVisualProperties(const css::uno::Reference< css::drawing::XShape > &xShape)
ShapeHashMap * mpShapeMap
ShapeExport & WriteGraphicObjectShape(const css::uno::Reference< css::drawing::XShape > &xShape)
ShapeExport & WriteRectangleShape(const css::uno::Reference< css::drawing::XShape > &xShape)
ShapeExport & WriteLineShape(const css::uno::Reference< css::drawing::XShape > &xShape)
ShapeExport & WriteOpenPolyPolygonShape(const css::uno::Reference< css::drawing::XShape > &xShape)
ShapeExport(sal_Int32 nXmlNamespace, ::sax_fastparser::FSHelperPtr pFS, ShapeHashMap *pShapeMap, ::oox::core::XmlFilterBase *pFB, DocumentType eDocumentType=DOCUMENT_PPTX, DMLTextExport *pTextExport=nullptr, bool bUserShapes=false)
sal_Int32 GetNewShapeID(const css::uno::Reference< css::drawing::XShape > &rShape)
ShapeExport & WriteEllipseShape(const css::uno::Reference< css::drawing::XShape > &xShape)
std::unordered_map< css::uno::Reference< css::drawing::XShape >, sal_Int32 > ShapeHashMap
sal_Int32 GetShapeID(const css::uno::Reference< css::drawing::XShape > &rShape)
ShapeExport & WritePolyPolygonShape(const css::uno::Reference< css::drawing::XShape > &xShape, bool bClosed)
ShapeExport & WriteConnectorShape(const css::uno::Reference< css::drawing::XShape > &xShape)
void SetURLTranslator(const std::shared_ptr< URLTransformer > &pTransformer)
ShapeExport & WriteNonVisualDrawingProperties(const css::uno::Reference< css::drawing::XShape > &xShape, const char *sName)
std::shared_ptr< URLTransformer > mpURLTransformer
void WriteTableCellBorders(const css::uno::Reference< css::beans::XPropertySet > &rXPropSet)
void WriteMathShape(css::uno::Reference< css::drawing::XShape > const &xShape)
virtual ShapeExport & WriteUnknownShape(const css::uno::Reference< css::drawing::XShape > &xShape)
static bool NonEmptyText(const css::uno::Reference< css::uno::XInterface > &xIface)
ShapeExport & WriteTableShape(const css::uno::Reference< css::drawing::XShape > &xShape)
ShapeExport & WriteShape(const css::uno::Reference< css::drawing::XShape > &xShape)
Write the DrawingML for a particular shape.
void WriteGraphicObjectShapePart(const css::uno::Reference< css::drawing::XShape > &xShape, const Graphic *pGraphic=nullptr)
ShapeExport & WriteTextBox(const css::uno::Reference< css::uno::XInterface > &xIface, sal_Int32 nXmlNamespace, bool bWritePropertiesAsLstStyles=false)
void WriteTableCellProperties(const css::uno::Reference< css::beans::XPropertySet > &rXPropSet)
void WriteTable(const css::uno::Reference< css::drawing::XShape > &rXShape)
void WriteBorderLine(const sal_Int32 XML_line, const css::table::BorderLine2 &rBorderLine)
ShapeExport & WriteOLE2Shape(const css::uno::Reference< css::drawing::XShape > &xShape)
constexpr ::Color COL_AUTO(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
#define TOOLS_WARN_EXCEPTION(area, stream)
constexpr sal_Int32 FSNS(sal_Int32 namespc, sal_Int32 element)
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
mso_sptWedgeEllipseCallout
tools::Long const nRightMargin
tools::Long const nLeftMargin
B2IRange fround(const B2DRange &rRange)
enum SAL_DLLPUBLIC_RTTI FillStyle
css::uno::Sequence< css::beans::PropertyValue > InitPropertySequence(::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)
OString GetOOXMLPresetGeometry(std::u16string_view rShapeType)
constexpr bool starts_with(std::basic_string_view< charT, traits > sv, std::basic_string_view< charT, traits > x) noexcept
@ ECMA_376_1ST_EDITION
There are currently 5 editions of ECMA-376, latest is from 2021.
TextVerticalAdjust GetTextVerticalAdjust(sal_Int32 nToken)
static const NameToConvertMapType & lcl_GetConverters()
static void lcl_Rotate(sal_Int32 nAngle, Point center, awt::Point &pt)
static sal_Int32 lcl_GetAngle(tools::Polygon aPoly)
static sal_Int32 lcl_GetGluePointId(const Reference< XShape > &xShape, sal_Int32 nGluePointId)
static bool lcl_IsOnDenylist(OUString const &rShapeType)
static bool lcl_isTextBox(const Reference< XInterface > &xIface)
std::optional< OString > GetTextVerticalType(sal_Int32 nRotateAngle)
Converts nRotate angle to TextVerticalType string appearing in ooxml.
static void lcl_AnalyzeHandles(const uno::Sequence< beans::PropertyValues > &rHandles, std::vector< std::pair< sal_Int32, sal_Int32 > > &rHandlePositionList, const Sequence< EnhancedCustomShapeAdjustmentValue > &rSeq)
static void lcl_FlipHFlipV(tools::Polygon aPoly, sal_Int32 nAngle, bool &rFlipH, bool &rFlipV)
static sal_Int32 lcl_NormalizeAngle(sal_Int32 nAngle)
static OUString lcl_GetTarget(const css::uno::Reference< css::frame::XModel > &xModel, OUString &rURL)
std::unordered_map< const char *, ShapeConverter, rtl::CStringHash, rtl::CStringEqual > NameToConvertMapType
static void lcl_AppendAdjustmentValue(std::vector< std::pair< sal_Int32, sal_Int32 > > &rAvList, sal_Int32 nAdjIdx, sal_Int32 nValue)
static bool lcl_IsOnAllowlist(OUString const &rShapeType)
static void lcl_GetConnectorAdjustValue(const Reference< XShape > &xShape, tools::Polygon aPoly, ConnectorType eConnectorType, std::vector< std::pair< sal_Int32, sal_Int32 > > &rAvList)
ShapeExport &(ShapeExport::* ShapeConverter)(const Reference< XShape > &)
static bool IsNonEmptySimpleText(const Reference< XInterface > &xIface)
static bool lcl_GetHandlePosition(sal_Int32 &nValue, const EnhancedCustomShapeParameter &rParam, const Sequence< EnhancedCustomShapeAdjustmentValue > &rSeq)
static sal_Int32 lcl_CircleAngle2CustomShapeEllipseAngleOOX(const sal_Int32 nInternAngle, const sal_Int32 nWidth, const sal_Int32 nHeight)
sal_Int64 convertHmmToEmu(sal_Int32 nValue)
Converts the passed 32-bit integer value from 1/100 mm to EMUs.
uno::Reference< io::XInputStream > GetOLEObjectStream(uno::Reference< uno::XComponentContext > const &xContext, uno::Reference< embed::XEmbeddedObject > const &xObj, std::u16string_view i_rProgID, OUString &o_rMediaType, OUString &o_rRelationType, OUString &o_rSuffix, const char *&o_rpProgID)
static uno::Reference< io::XInputStream > lcl_StoreOwnAsOOXML(uno::Reference< uno::XComponentContext > const &xContext, uno::Reference< embed::XEmbeddedObject > const &xObj, char const *&o_rpProgID, OUString &o_rMediaType, OUString &o_rRelationType, OUString &o_rSuffix)
OUString getRelationship(Relationship eRelationship)
static void lcl_ConvertProgID(std::u16string_view rProgID, OUString &o_rMediaType, OUString &o_rRelationType, OUString &o_rFileExtension)
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
const char * UseIf(const char *s, bool bUse)
std::shared_ptr< FastSerializerHelper > FSHelperPtr
const char *const aClassID
Reference< XModel > xModel