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 if (xShape->getPropertySetInfo()->hasPropertyByName(
"Decorative")
400 && xShape->getPropertyValue(
"Decorative").get<
bool>())
402 pFS->startElementNS(XML_a, XML_extLst);
404 pFS->startElementNS(XML_a, XML_ext,
406 XML_uri,
"{C183D7F6-B498-43B3-948B-1728B52AA6E4}");
407 pFS->singleElementNS(XML_adec, XML_decorative,
408 FSNS(XML_xmlns, XML_adec),
"http://schemas.microsoft.com/office/drawing/2017/decorative",
410 pFS->endElementNS(XML_a, XML_ext);
411 pFS->endElementNS(XML_a, XML_extLst);
417 SAL_INFO(
"oox.shape",
"write polypolygon shape");
422 awt::Point aPos = xShape->getPosition();
426 awt::Point aParentPos =
m_xParent->getPosition();
427 aPos.X -= aParentPos.X;
428 aPos.Y -= aParentPos.Y;
430 awt::Size aSize = xShape->getSize();
433#if OSL_DEBUG_LEVEL > 0
436 SAL_INFO(
"oox.shape",
"poly count " << aPolyPolygon.
Count());
492 sal_Int32 nGroupShapeToken = XML_grpSp;
496 nGroupShapeToken = XML_wgp;
510 uno::Reference<beans::XPropertySet>
const xShapeProps(xShape, uno::UNO_QUERY_THROW);
525 uno::Reference<drawing::XShapes> xGroupShape(xShape, uno::UNO_QUERY_THROW);
526 uno::Reference<drawing::XShape> xParent =
m_xParent;
528 for (sal_Int32
i = 0;
i < xGroupShape->getCount(); ++
i)
530 uno::Reference<drawing::XShape> xChild(xGroupShape->getByIndex(
i), uno::UNO_QUERY_THROW);
533 uno::Reference<lang::XServiceInfo> xServiceInfo(xChild, uno::UNO_QUERY_THROW);
539 if (xServiceInfo->supportsService(
"com.sun.star.drawing.GraphicObjectShape")
557 static const std::initializer_list<std::u16string_view> vDenylist = {
573 u"round-rectangular-callout",
574 u"rectangular-callout",
582 u"horizontal-scroll",
587 u"flowchart-process",
588 u"flowchart-alternate-process",
589 u"flowchart-decision",
591 u"flowchart-predefined-process",
592 u"flowchart-internal-storage",
593 u"flowchart-document",
594 u"flowchart-multidocument",
595 u"flowchart-terminator",
596 u"flowchart-preparation",
597 u"flowchart-manual-input",
598 u"flowchart-manual-operation",
599 u"flowchart-connector",
600 u"flowchart-off-page-connector",
602 u"flowchart-punched-tape",
603 u"flowchart-summing-junction",
605 u"flowchart-collate",
607 u"flowchart-extract",
609 u"flowchart-stored-data",
611 u"flowchart-sequential-access",
612 u"flowchart-magnetic-disk",
613 u"flowchart-direct-access-storage",
617 return std::find(vDenylist.begin(), vDenylist.end(), rShapeType) != vDenylist.end();
622 static const std::initializer_list<std::u16string_view> vAllowlist = {
629 return std::find(vAllowlist.begin(), vAllowlist.end(), rShapeType) != vAllowlist.end();
635 if ( rParam.Value.getValueTypeClass() == TypeClass_DOUBLE )
638 if ( rParam.Value >>= fValue )
639 nValue =
static_cast<sal_Int32
>(fValue);
644 if ( rParam.Type == EnhancedCustomShapeParameterType::ADJUSTMENT)
648 if ( nIdx < rSeq.getLength() )
650 if ( rSeq[ nIdx ] .
Value.getValueTypeClass() == TypeClass_DOUBLE )
653 rSeq[ nIdx ].Value >>= fValue;
659 rSeq[ nIdx ].Value >>=
nValue;
667 std::vector< std::pair< sal_Int32, sal_Int32> > &rHandlePositionList,
672 static constexpr OUStringLiteral sPosition(
u"Position" );
673 bool bPosition =
false;
674 EnhancedCustomShapeParameterPair aPosition;
675 for (
const PropertyValue& rPropVal: rPropSeq )
677 if ( rPropVal.Name == sPosition )
679 if ( rPropVal.Value >>= aPosition )
685 sal_Int32 nXPosition = 0;
686 sal_Int32 nYPosition = 0;
690 rHandlePositionList.emplace_back( nXPosition, nYPosition );
697 rAvList.emplace_back( nAdjIdx ,
nValue );
702 nAngle = nAngle % 360;
703 return nAngle < 0 ? ( nAngle + 360 ) : nAngle ;
708 if (nWidth != 0 || nHeight != 0)
710 double fAngle = basegfx::deg2rad<100>(nInternAngle);
711 fAngle = atan2(nHeight * sin(fAngle), nWidth * cos(fAngle));
712 fAngle = basegfx::rad2deg<60000>(fAngle);
714 nAngle = nAngle % 21600000;
715 return nAngle < 0 ? (nAngle + 21600000) : nAngle;
721static OUString
lcl_GetTarget(
const css::uno::Reference<css::frame::XModel>& xModel,
722 std::u16string_view rURL)
726 sal_uInt32 nPageCount = xDrawPages->getCount();
729 for (sal_uInt32
i = 0;
i < nPageCount; ++
i)
732 xDrawPages->getByIndex(
i) >>= xDrawPage;
736 OUString sSlideName =
"#" + xNamed->getName();
737 if (rURL == sSlideName)
739 sTarget =
"slide" + OUString::number(
i + 1) +
".xml";
749 SAL_INFO(
"oox.shape",
"write custom shape");
759 bool bHasGeometrySeq(
false);
761 OUString sShapeType(
"non-primitive");
764 SAL_INFO(
"oox.shape",
"got custom shape geometry");
765 if (
mAny >>= aGeometrySeq)
767 bHasGeometrySeq =
true;
768 SAL_INFO(
"oox.shape",
"got custom shape geometry sequence");
769 for (
const PropertyValue& rProp : std::as_const(aGeometrySeq))
771 SAL_INFO(
"oox.shape",
"geometry property: " << rProp.Name);
772 if (rProp.Name ==
"Type")
773 rProp.Value >>= sShapeType;
778 bool bPredefinedHandlesUsed =
true;
779 bool bHasHandles =
false;
781 ShapeFlag nMirrorFlags = ShapeFlag::NONE;
785 const bool bIsDefaultObject(
790 SAL_INFO(
"oox.shape",
"custom shape type: " << sShapeType <<
" ==> " << sPresetShape);
792 sal_Int32 nAdjustmentValuesIndex = -1;
793 awt::Rectangle aViewBox;
794 uno::Sequence<beans::PropertyValues> aHandles;
801 for (
int i = 0;
i < aGeometrySeq.getLength();
i++)
803 const PropertyValue& rProp = aGeometrySeq[
i ];
804 SAL_INFO(
"oox.shape",
"geometry property: " << rProp.Name);
806 if ( rProp.Name ==
"MirroredX" )
807 rProp.Value >>= bFlipH;
809 if ( rProp.Name ==
"MirroredY" )
810 rProp.Value >>= bFlipV;
811 if ( rProp.Name ==
"AdjustmentValues" )
812 nAdjustmentValuesIndex =
i;
813 else if ( rProp.Name ==
"Handles" )
815 rProp.Value >>= aHandles;
816 if ( aHandles.hasElements() )
818 if( !bIsDefaultObject )
819 bPredefinedHandlesUsed =
false;
822 else if ( rProp.Name ==
"ViewBox" )
823 rProp.Value >>= aViewBox;
831 bool bUseBackground =
false;
832 if (
GetProperty(rXPropSet,
"FillUseSlideBackground"))
833 mAny >>= bUseBackground;
839 bool isVisible = true ;
854 if( !sURL.isEmpty() )
861 mpFS->singleElementNS(XML_a, XML_hlinkClick,
FSNS(XML_r, XML_id), sRelId);
872 presentation::ClickAction eClickAction = presentation::ClickAction_NONE;
873 mAny >>= eClickAction;
874 if (eClickAction != presentation::ClickAction_NONE)
876 switch (eClickAction)
878 case presentation::ClickAction_STOPPRESENTATION:
879 sPPAction =
"ppaction://hlinkshowjump?jump=endshow";
881 case presentation::ClickAction_NEXTPAGE:
882 sPPAction =
"ppaction://hlinkshowjump?jump=nextslide";
884 case presentation::ClickAction_LASTPAGE:
885 sPPAction =
"ppaction://hlinkshowjump?jump=lastslide";
887 case presentation::ClickAction_PREVPAGE:
888 sPPAction =
"ppaction://hlinkshowjump?jump=previousslide";
890 case presentation::ClickAction_FIRSTPAGE:
891 sPPAction =
"ppaction://hlinkshowjump?jump=firstslide";
893 case presentation::ClickAction_BOOKMARK:
894 sBookmark =
"#" + sBookmark;
900 if (!sPPAction.isEmpty())
901 pFS->singleElementNS(XML_a, XML_hlinkClick,
FSNS(XML_r, XML_id),
"", XML_action,
904 if (!sBookmark.isEmpty())
915 mpFS->singleElementNS(XML_a, XML_hlinkClick,
FSNS(XML_r, XML_id), sRelId);
917 mpFS->singleElementNS(XML_a, XML_hlinkClick,
FSNS(XML_r, XML_id), sRelId,
918 XML_action,
"ppaction://hlinksldjump");
947 mpFS->singleElementNS(XML_a, XML_hlinkClick,
FSNS(XML_r, XML_id), sRelId);
964 bool bCustGeom =
true;
965 bool bOnDenylist =
false;
966 if( sShapeType ==
"ooxml-non-primitive" )
968 else if( sShapeType.startsWith(
"ooxml") )
978 bool bPresetWriteSuccessful =
false;
981 if (!sShapeType.startsWith(
"ooxml") && sShapeType !=
"non-primitive" && !
mbUserShapes
982 && xShape->getShapeType() ==
"com.sun.star.drawing.CustomShape"
986 bPresetWriteSuccessful = aCustomShapeConverter.
WriteShape();
989 if (bPresetWriteSuccessful)
1002 else if (bOnDenylist && bHasHandles && nAdjustmentValuesIndex !=-1 && !sShapeType.startsWith(
"mso-spt"))
1006 std::vector< std::pair< sal_Int32, sal_Int32> > aHandlePositionList;
1007 std::vector< std::pair< sal_Int32, sal_Int32> > aAvList;
1008 aGeometrySeq[ nAdjustmentValuesIndex ].Value >>= aAdjustmentSeq ;
1012 sal_Int32 nXPosition = 0;
1013 sal_Int32 nYPosition = 0;
1014 if ( !aHandlePositionList.empty() )
1016 nXPosition = aHandlePositionList[0].first ;
1017 nYPosition = aHandlePositionList[0].second ;
1019 switch( eShapeType )
1023 sal_Int32 adj3 = double(nYPosition)/aViewBox.Height *100000;
1024 sal_Int32 adj4 = double(nXPosition)/aViewBox.Width *100000;
1033 sal_Int32 adj5 = double(nYPosition)/aViewBox.Height *100000;
1034 sal_Int32 adj6 = double(nXPosition)/aViewBox.Width *100000;
1035 sal_Int32 adj3 = 18750;
1036 sal_Int32 adj4 = -16667;
1039 if ( aHandlePositionList.size() > 1 )
1041 nXPosition = aHandlePositionList[1].first ;
1042 nYPosition = aHandlePositionList[1].second ;
1043 adj3 = double(nYPosition)/aViewBox.Height *100000;
1044 adj4 = double(nXPosition)/aViewBox.Width *100000;
1057 sal_Int32 adj1 = (double(nXPosition)/aViewBox.Width -0.5) *100000;
1058 sal_Int32 adj2 = (double(nYPosition)/aViewBox.Height -0.5) *100000;
1070 sal_Int32 adj = double( aViewBox.Width - nXPosition) / std::min( aViewBox.Width,aViewBox.Height ) * 100000;
1082 sal_Int32 adj = double( nXPosition )/aViewBox.Width*100000 ;
1091 sal_Int32 adj = double( nYPosition )/aViewBox.Height *100000 ;
1097 sal_Int32 adj = double( nYPosition )/aViewBox.Height *100000 - 76458.0;
1103 sal_Int32 nRadius = 50000 * ( 1 - double(nXPosition) / 10800);
1116 if ( sPresetShape ==
"frame" )
1118 sal_Int32 adj1 = double( nYPosition )/aViewBox.Height *100000 ;
1129 if( nAdjustmentValuesIndex != -1 )
1132 aGeometrySeq[ nAdjustmentValuesIndex ] );
1137 if( rXPropSet.is() )
1139 WriteFill(rXPropSet, xShape->getSize());
1143 bool bHas3DEffectinShape =
false;
1144 uno::Sequence<beans::PropertyValue> grabBag;
1145 rXPropSet->getPropertyValue(
"InteropGrabBag") >>= grabBag;
1147 for (
auto const& it : std::as_const(grabBag))
1148 if (it.Name ==
"3DEffectProperties")
1149 bHas3DEffectinShape =
true;
1151 if( bHas3DEffectinShape)
1171 SAL_INFO(
"oox.shape",
"write ellipse shape");
1196 CircleKind eCircleKind(CircleKind_FULL);
1198 xProps->getPropertyValue(
"CircleKind" ) >>= eCircleKind;
1204 if (CircleKind_FULL == eCircleKind)
1208 sal_Int32 nStartAngleIntern(9000);
1209 sal_Int32 nEndAngleIntern(0);
1212 xProps->getPropertyValue(
"CircleStartAngle" ) >>= nStartAngleIntern;
1213 xProps->getPropertyValue(
"CircleEndAngle") >>= nEndAngleIntern;
1215 std::vector< std::pair<sal_Int32,sal_Int32>> aAvList;
1216 awt::Size aSize = xShape->getSize();
1217 if (aSize.Width != 0 || aSize.Height != 0)
1226 switch (eCircleKind)
1228 case CircleKind_ARC :
1231 case CircleKind_SECTION :
1234 case CircleKind_CUT :
1243 if (CircleKind_ARC == eCircleKind)
1250 aNewValue <<= eFillStyle;
1251 xProps->setPropertyValue(
"FillStyle", aNewValue);
1275 SAL_INFO(
"oox.shape",
"write graphic object shape");
1279 SAL_INFO(
"oox.shape",
"graphicObject: wrote only text");
1286 SAL_INFO(
"oox.shape",
"graphicObject without text");
1288 uno::Reference<graphic::XGraphic> xGraphic;
1297 else if (xShapeProps.is() && xShapeProps->getPropertySetInfo()->hasPropertyByName(
"Graphic"))
1299 xShapeProps->getPropertyValue(
"Graphic") >>= xGraphic;
1304 && xShapeProps->getPropertySetInfo()->hasPropertyByName(
"MediaURL")
1305 && (xShapeProps->getPropertyValue(
"MediaURL") >>= sMediaURL);
1307 if (!xGraphic.is() && !bHasMediaURL)
1309 SAL_INFO(
"oox.shape",
"no graphic or media URL found");
1324 presentation::ClickAction eClickAction = presentation::ClickAction_NONE;
1325 OUString sDescr, sURL, sBookmark, sPPAction;
1328 if ( ( bHaveDesc =
GetProperty( xShapeProps,
"Description" ) ) )
1335 mAny >>= eClickAction;
1342 if (eClickAction != presentation::ClickAction_NONE)
1344 switch (eClickAction)
1346 case presentation::ClickAction_STOPPRESENTATION:
1347 sPPAction =
"ppaction://hlinkshowjump?jump=endshow";
1349 case presentation::ClickAction_NEXTPAGE:
1350 sPPAction =
"ppaction://hlinkshowjump?jump=nextslide";
1352 case presentation::ClickAction_LASTPAGE:
1353 sPPAction =
"ppaction://hlinkshowjump?jump=lastslide";
1355 case presentation::ClickAction_PREVPAGE:
1356 sPPAction =
"ppaction://hlinkshowjump?jump=previousslide";
1358 case presentation::ClickAction_FIRSTPAGE:
1359 sPPAction =
"ppaction://hlinkshowjump?jump=firstslide";
1361 case presentation::ClickAction_BOOKMARK:
1362 sBookmark =
"#" + sBookmark;
1370 if (bHasMediaURL || !sPPAction.isEmpty())
1371 pFS->singleElementNS(XML_a, XML_hlinkClick,
FSNS(XML_r, XML_id),
"", XML_action,
1372 bHasMediaURL ?
"ppaction://media" : sPPAction);
1373 if( !sURL.isEmpty() )
1380 mpFS->singleElementNS(XML_a, XML_hlinkClick,
FSNS(XML_r, XML_id), sRelId);
1383 if (!sBookmark.isEmpty())
1391 sBookmark, bExtURL);
1394 mpFS->singleElementNS(XML_a, XML_hlinkClick,
FSNS(XML_r, XML_id), sRelId);
1396 mpFS->singleElementNS(XML_a, XML_hlinkClick,
FSNS(XML_r, XML_id), sRelId, XML_action,
1397 "ppaction://hlinksldjump");
1418 else if (bHasMediaURL)
1421 if (xShapeProps->getPropertySetInfo()->hasPropertyByName(
"FallbackGraphic"))
1422 xShapeProps->getPropertyValue(
"FallbackGraphic") >>= xFallbackGraphic;
1434 bool bStretch =
false;
1435 if( !pGraphic &&
GetProperty( xShapeProps,
"FillBitmapStretch" ) )
1438 if ( pGraphic || bStretch )
1439 pFS->singleElementNS(XML_a, XML_stretch);
1444 pFS->startElementNS(XML_a, XML_stretch);
1445 pFS->singleElementNS(XML_a, XML_fillRect);
1446 pFS->endElementNS(XML_a, XML_stretch);
1453 bool bFlipH =
false;
1454 if( xShapeProps->getPropertySetInfo()->hasPropertyByName(
"IsMirrored") )
1456 xShapeProps->getPropertyValue(
"IsMirrored") >>= bFlipH;
1473 sal_Int16 nCos, nSin;
1499 Point aStart = aPoly[0];
1502 if (aStart.
X() > aEnd.
X() && aStart.
Y() > aEnd.
Y())
1518 if (aStart.
X() < aEnd.
X() && aStart.
Y() < aEnd.
Y())
1532 if (aStart.
Y() < aEnd.
Y() && aStart.
X() > aEnd.
X())
1550 if (aStart.
Y() > aEnd.
Y() && aStart.
X() < aEnd.
X())
1570 Point aStartPoint = aPoly[0];
1572 if (aStartPoint.
X() == aPoly[1].X())
1574 if ((aStartPoint.
X() < aEndPoint.
X() && aStartPoint.
Y() > aEndPoint.
Y())
1575 || (aStartPoint.
X() > aEndPoint.
X() && aStartPoint.
Y() < aEndPoint.
Y()))
1584 if (aStartPoint.
X() > aPoly[1].X())
1595 ConnectorType eConnectorType,
1596 std::vector<std::pair<sal_Int32, sal_Int32>>& rAvList)
1598 sal_Int32 nAdjCount = 0;
1599 if (eConnectorType == ConnectorType_CURVE)
1603 if ((aPoly[0].
X() == aPoly[1].
X() && aPoly[2].
X() == aPoly[3].
X())
1604 || (aPoly[0].
Y() == aPoly[1].
Y() && aPoly[2].
Y() == aPoly[3].
Y()))
1613 if ((aPoly[2].
X() == aPoly[3].
X() && aPoly[3].
X() == aPoly[4].
X())
1614 || (aPoly[2].
Y() == aPoly[3].
Y() && aPoly[3].
Y() == aPoly[4].
Y()))
1643 sal_Int32 nAdjustValue;
1644 Point aStart = aPoly[0];
1647 for (sal_Int32
i = 1;
i <= nAdjCount; ++
i)
1651 if (aEnd.
Y() == aStart.
Y())
1652 aEnd.
setY(aStart.
Y() + 1);
1653 if (aEnd.
X() == aStart.
X())
1654 aEnd.
setX(aStart.
X() + 1);
1656 bool bVertical = aPoly[1].X() - aStart.
X() != 0 ? true :
false;
1659 bVertical = !bVertical;
1661 if (eConnectorType == ConnectorType_CURVE)
1663 awt::Size aSize = xShape->getSize();
1664 awt::Point aShapePosition = xShape->getPosition();
1670 aPt.
setY(aPoly[
i + 1].
Y());
1671 else if (aStart.
Y() > aPt.
Y())
1672 aPt.
setY(aShapePosition.Y);
1674 aPt.
setY(aShapePosition.Y + aSize.Height);
1679 aPt.
setX(aPoly[
i + 1].
X());
1680 else if (aStart.
X() > aPt.
X())
1681 aPt.
setX(aShapePosition.X);
1683 aPt.
setX(aShapePosition.X + aSize.Width);
1688 nAdjustValue = ((aPt.
Y() - aStart.
Y()) * 100000) / (aEnd.
Y() - aStart.
Y());
1690 nAdjustValue = ((aPt.
X() - aStart.
X()) * 100000) / (aEnd.
X() - aStart.
X());
1692 rAvList.emplace_back(
i, nAdjustValue);
1699 if (nGluePointId > 3)
1700 return nGluePointId - 4;
1703 bool bFlipH =
false;
1704 bool bFlipV =
false;
1706 if (xShapeProps.is() && xShapeProps->getPropertySetInfo()
1707 && xShapeProps->getPropertySetInfo()->hasPropertyByName(
"CustomShapeGeometry"))
1710 xShapeProps->getPropertyValue(
"CustomShapeGeometry") >>= aGeometrySeq;
1711 for (
int i = 0;
i < aGeometrySeq.getLength();
i++)
1713 const PropertyValue& rProp = aGeometrySeq[
i];
1714 if (rProp.Name ==
"MirroredX")
1715 rProp.Value >>= bFlipH;
1717 if (rProp.Name ==
"MirroredY")
1718 rProp.Value >>= bFlipV;
1722 if ((!bFlipH && !bFlipV) || (bFlipH && bFlipV))
1725 if (nGluePointId == 1)
1727 else if (nGluePointId == 3)
1732 return nGluePointId;
1737 bool bFlipH =
false;
1738 bool bFlipV =
false;
1739 sal_Int32 nAngle = 0;
1740 sal_Int32 nStartGlueId = 0;
1741 sal_Int32 nEndGlueId = 0;
1743 SAL_INFO(
"oox.shape",
"write connector shape");
1748 std::vector<std::pair<sal_Int32, sal_Int32>> aAdjustValueList;
1751 awt::Point aStartPoint, aEndPoint;
1754 PropertyState eState;
1755 ConnectorType eConnectorType = ConnectorType_STANDARD;
1757 mAny >>= eConnectorType;
1759 switch( eConnectorType ) {
1760 case ConnectorType_CURVE:
1761 sGeometry =
"curvedConnector";
1763 case ConnectorType_LINES:
1764 case ConnectorType_STANDARD:
1765 sGeometry =
"bentConnector";
1768 case ConnectorType_LINE:
1769 sGeometry =
"straightConnector1";
1773 if (
GetPropertyAndState( rXPropSet, rXPropState,
"EdgeStartPoint", eState ) && eState == beans::PropertyState_DIRECT_VALUE )
1775 mAny >>= aStartPoint;
1776 if (
GetPropertyAndState( rXPropSet, rXPropState,
"EdgeEndPoint", eState ) && eState == beans::PropertyState_DIRECT_VALUE )
1779 if (
GetProperty(rXPropSet,
"EdgeStartConnection"))
1784 if (
GetProperty(rXPropSet,
"StartGluePointIndex"))
1785 mAny >>= nStartGlueId;
1786 if (nStartGlueId != -1)
1790 mAny >>= nEndGlueId;
1791 if (nEndGlueId != -1)
1797 awt::Point aParentPos =
m_xParent->getPosition();
1798 aStartPoint.X -= aParentPos.X;
1799 aStartPoint.Y -= aParentPos.Y;
1800 aEndPoint.X -= aParentPos.X;
1801 aEndPoint.Y -= aParentPos.Y;
1805 if (eConnectorType != ConnectorType_LINE)
1808 if (aPolyPolygon.
Count() > 0)
1816 Point center((aEndPoint.X + aStartPoint.X) / 2, (aEndPoint.Y + aStartPoint.Y) / 2);
1821 sGeometry = sGeometry + OUString::number(aAdjustValueList.size() + 2);
1828 aRect.
setWidth( aStartPoint.X - aEndPoint.X );
1829 if (eConnectorType == ConnectorType_LINE)
1834 aRect.
SetTop(aEndPoint.Y);
1835 aRect.
setHeight( aStartPoint.Y - aEndPoint.Y );
1836 if (eConnectorType == ConnectorType_LINE)
1841 const auto nShapeNode = (
mnXmlNamespace == XML_wps ? XML_wsp : XML_cxnSp);
1878 if( xShapeProps.is() )
1883 if( nShapeNode != XML_cxnSp )
1896 bool bFlipH =
false;
1897 bool bFlipV =
false;
1899 SAL_INFO(
"oox.shape",
"write line shape");
1906 if( aPolyPolygon.
Count() == 1 && aPolyPolygon[ 0 ].GetSize() == 2)
1910 bFlipH = ( rPoly[ 0 ].X() > rPoly[ 1 ].X() );
1911 bFlipV = ( rPoly[ 0 ].Y() > rPoly[ 1 ].Y() );
1936 if( xShapeProps.is() )
1975 SAL_INFO(
"oox.shape",
"write rectangle shape");
1981 sal_Int32 nRadius = 0;
1984 if( xShapeProps.is() )
1986 xShapeProps->getPropertyValue(
"CornerRadius" ) >>= nRadius;
1991 nRadius =
MapSize( awt::Size( nRadius, 0 ) ).Width;
2072 return shape_converters;
2078 throw lang::IllegalArgumentException();
2080 OUString sShapeType = xShape->getShapeType();
2081 SAL_INFO(
"oox.shape",
"write shape: " << sShapeType);
2082 NameToConvertMapType::const_iterator aConverter
2086 SAL_INFO(
"oox.shape",
"unknown shape");
2093 if (xShapeProperties && xShapeProperties->getPropertySetInfo()
2094 && xShapeProperties->getPropertySetInfo()->hasPropertyByName(
"IsPresentationObject")
2095 && xShapeProperties->getPropertyValue(
"IsPresentationObject").hasValue())
2096 mbPlaceholder = xShapeProperties->getPropertyValue(
"IsPresentationObject").get<
bool>();
2099 (this->*(aConverter->second))( xShape );
2106 uno::Reference<beans::XPropertySet> xPropertySet(xIface, uno::UNO_QUERY);
2107 if (!xPropertySet.is())
2109 uno::Reference<beans::XPropertySetInfo> xPropertySetInfo = xPropertySet->getPropertySetInfo();
2110 if (!xPropertySetInfo->hasPropertyByName(
"TextBox"))
2112 css::uno::Any aTextBox(xPropertySet->getPropertyValue(
"TextBox"));
2113 if (!aTextBox.hasValue())
2115 return aTextBox.get<
bool>();
2126 WriteText( xIface,
true,
false, nXmlNamespace );
2137 pFS->startElementNS(nXmlNamespace,
2140 0, bWritePropertiesAsLstStyles);
2143 WriteText( xIface,
true,
false, nXmlNamespace );
2146 mpFS->singleElementNS(nXmlNamespace, XML_bodyPr);
2156 mpFS->startElementNS(XML_a, XML_graphic);
2157 mpFS->startElementNS(XML_a, XML_graphicData,
2158 XML_uri,
"http://schemas.openxmlformats.org/drawingml/2006/table");
2160 if ( xPropSet.is() && ( xPropSet->getPropertyValue(
"Model" ) >>= xTable ) )
2162 mpFS->startElementNS(XML_a, XML_tbl);
2163 mpFS->startElementNS(XML_a, XML_tblPr);
2165 mpFS->endElementNS(XML_a, XML_tblPr);
2169 sal_uInt16 nRowCount =
static_cast< sal_uInt16
>( xRows->getCount() );
2170 sal_uInt16 nColumnCount =
static_cast< sal_uInt16
>( xColumns->getCount() );
2172 mpFS->startElementNS(XML_a, XML_tblGrid);
2174 for ( sal_Int32
x = 0;
x < nColumnCount;
x++ )
2177 sal_Int32 nWidth(0);
2178 xColPropSet->getPropertyValue(
"Width" ) >>= nWidth;
2180 mpFS->singleElementNS(XML_a, XML_gridCol,
2184 mpFS->endElementNS( XML_a, XML_tblGrid );
2187 typedef std::unordered_map<sal_Int32, std::pair<sal_Int32, Reference< XMergeableCell> > > transposeTableMap;
2188 transposeTableMap mergedCellMap;
2190 for( sal_Int32 nRow = 0; nRow < nRowCount; nRow++ )
2193 sal_Int32 nRowHeight(0);
2195 xRowPropSet->getPropertyValue(
"Height" ) >>= nRowHeight;
2197 mpFS->startElementNS(XML_a, XML_tr,
2199 for( sal_Int32 nColumn = 0; nColumn < nColumnCount; nColumn++ )
2203 sal_Int32 transposedIndexofCell = (nRow * nColumnCount) + nColumn;
2206 bool bCellOpened =
true;
2208 if(xCell->getColumnSpan() > 1 && xCell->getRowSpan() > 1)
2211 mpFS->startElementNS(XML_a, XML_tc,
2212 XML_gridSpan, OString::number(xCell->getColumnSpan()),
2213 XML_rowSpan, OString::number(xCell->getRowSpan()));
2218 for(sal_Int32 columnIndex = nColumn; columnIndex < nColumn+xCell->getColumnSpan(); ++columnIndex)
2220 for(sal_Int32 rowIndex = nRow; rowIndex < nRow+xCell->getRowSpan(); ++rowIndex)
2222 sal_Int32 transposeIndexForMergeCell =
2223 (rowIndex * nColumnCount) + columnIndex;
2224 mergedCellMap[transposeIndexForMergeCell] =
2225 std::make_pair(transposedIndexofCell, xCell);
2230 else if(xCell->getColumnSpan() > 1)
2233 mpFS->startElementNS(XML_a, XML_tc,
2234 XML_gridSpan, OString::number(xCell->getColumnSpan()));
2235 for(sal_Int32 columnIndex = nColumn; columnIndex < nColumn + xCell->getColumnSpan(); ++columnIndex) {
2236 sal_Int32 transposeIndexForMergeCell = (nRow*nColumnCount) + columnIndex;
2237 mergedCellMap[transposeIndexForMergeCell] =
2238 std::make_pair(transposedIndexofCell, xCell);
2241 else if(xCell->getRowSpan() > 1)
2244 mpFS->startElementNS(XML_a, XML_tc,
2245 XML_rowSpan, OString::number(xCell->getRowSpan()));
2247 for(sal_Int32 rowIndex = nRow; rowIndex < nRow + xCell->getRowSpan(); ++rowIndex) {
2248 sal_Int32 transposeIndexForMergeCell = (rowIndex*nColumnCount) + nColumn;
2249 mergedCellMap[transposeIndexForMergeCell] =
2250 std::make_pair(transposedIndexofCell, xCell);
2257 if(!xCell->isMerged())
2260 mpFS->startElementNS(XML_a, XML_tc);
2266 transposeTableMap::iterator it = mergedCellMap.find(transposedIndexofCell);
2267 if(it != mergedCellMap.end())
2269 sal_Int32 transposeIndexOfParent = it->second.first;
2272 sal_Int32 parentColumnIndex = transposeIndexOfParent % nColumnCount;
2273 sal_Int32 parentRowIndex = transposeIndexOfParent / nColumnCount;
2274 if(nColumn == parentColumnIndex)
2277 if(parentCell->getColumnSpan() > 1)
2280 mpFS->startElementNS(XML_a, XML_tc,
2281 XML_vMerge, OString::number(1),
2282 XML_gridSpan, OString::number(xCell->getColumnSpan()));
2287 mpFS->startElementNS(XML_a, XML_tc,
2288 XML_vMerge, OString::number(1));
2291 else if(nRow == parentRowIndex)
2294 if(parentCell->getRowSpan() > 1)
2297 mpFS->startElementNS(XML_a, XML_tc,
2298 XML_hMerge, OString::number(1),
2299 XML_rowSpan, OString::number(xCell->getRowSpan()));
2304 mpFS->startElementNS(XML_a, XML_tc,
2305 XML_hMerge, OString::number(1));
2311 mpFS->startElementNS(XML_a, XML_tc,
2312 XML_vMerge, OString::number(1),
2313 XML_hMerge, OString::number(1));
2317 bCellOpened =
false;
2328 mpFS->endElementNS( XML_a, XML_tc );
2332 mpFS->endElementNS( XML_a, XML_tr );
2335 mpFS->endElementNS( XML_a, XML_tbl );
2338 mpFS->endElementNS( XML_a, XML_graphicData );
2339 mpFS->endElementNS( XML_a, XML_graphic );
2345 TextVerticalAdjust eVerticalAlignment;
2346 const char* sVerticalAlignment;
2348 Any aLeftMargin = xCellPropSet->getPropertyValue(
"TextLeftDistance");
2351 Any aRightMargin = xCellPropSet->getPropertyValue(
"TextRightDistance");
2354 Any aVerticalAlignment = xCellPropSet->getPropertyValue(
"TextVerticalAdjust");
2355 aVerticalAlignment >>= eVerticalAlignment;
2358 sal_Int32 nRotateAngle = 0;
2359 Any aRotateAngle = xCellPropSet->getPropertyValue(
"RotateAngle");
2360 aRotateAngle >>= nRotateAngle;
2364 if( !aTextVerticalValue &&
2365 (xCellPropSet->getPropertyValue(
"CellInteropGrabBag") >>= aGrabBag) )
2367 for (
auto const& rIt : std::as_const(aGrabBag))
2369 if (rIt.Name ==
"mso-tcPr-vert-value")
2371 aTextVerticalValue = rIt.Value.get<OUString>().toUtf8();
2377 mpFS->startElementNS(XML_a, XML_tcPr, XML_anchor, sVerticalAlignment,
2378 XML_vert, aTextVerticalValue,
2387 mpFS->endElementNS( XML_a, XML_tcPr );
2400 mpFS->startElementNS(XML_a, XML_line, XML_w, OString::number(
nBorderWidth));
2401 if ( rBorderLine.Color == sal_Int32(
COL_AUTO ) )
2402 mpFS->singleElementNS(XML_a, XML_noFill);
2406 OUString sBorderStyle;
2407 sal_Int16 nStyle = rBorderLine.LineStyle;
2409 switch (*o3tl::doAccess<sal_Int16>(
mAny))
2411 case ::table::BorderLineStyle::SOLID:
2412 sBorderStyle =
"solid";
2414 case ::table::BorderLineStyle::DOTTED:
2415 sBorderStyle =
"dot";
2417 case ::table::BorderLineStyle::DASHED:
2418 sBorderStyle =
"dash";
2420 case ::table::BorderLineStyle::DASH_DOT:
2421 sBorderStyle =
"dashDot";
2423 case ::table::BorderLineStyle::DASH_DOT_DOT:
2424 sBorderStyle =
"sysDashDotDot";
2427 mpFS->singleElementNS(XML_a, XML_prstDash, XML_val, sBorderStyle);
2428 mpFS->endElementNS(XML_a, XML_line);
2432 mpFS->startElementNS(XML_a, XML_line);
2433 mpFS->singleElementNS(XML_a, XML_noFill);
2434 mpFS->endElementNS( XML_a, XML_line );
2440 BorderLine2 aBorderLine;
2443 xCellPropSet->getPropertyValue(
"LeftBorder") >>= aBorderLine;
2447 xCellPropSet->getPropertyValue(
"RightBorder") >>= aBorderLine;
2451 xCellPropSet->getPropertyValue(
"TopBorder") >>= aBorderLine;
2455 xCellPropSet->getPropertyValue(
"BottomBorder") >>= aBorderLine;
2506 if (!sURL.isEmpty())
2513 mpFS->singleElementNS(XML_a, XML_hlinkClick,
FSNS(XML_r, XML_id), sRelId);
2518 pFS->singleElementNS(
mnXmlNamespace, XML_cNvSpPr, XML_txBox,
"1");
2529 uno::Reference<beans::XPropertySet> xPropertySet(xShape, UNO_QUERY);
2548 assert(xPropSet.is());
2550 xPropSet->getPropertyValue(
"Model") >>= xMathModel;
2551 assert(xMathModel.is());
2557 mpFS->startElementNS(XML_mc, XML_AlternateContent);
2558 mpFS->startElementNS(XML_mc, XML_Choice,
2560 XML_Requires,
"a14");
2576 mpFS->startElementNS(XML_a, XML_bodyPr);
2577 mpFS->endElementNS(XML_a, XML_bodyPr);
2578 mpFS->startElementNS(XML_a, XML_p);
2579 mpFS->startElementNS(XML_a14, XML_m);
2581 oox::FormulaImExportBase *
const pMagic(
2582 dynamic_cast<oox::FormulaImExportBase*
>(xMathModel.get()));
2585 FormulaImExportBase::eFormulaAlign::INLINE);
2587 mpFS->endElementNS(XML_a14, XML_m);
2588 mpFS->endElementNS(XML_a, XML_p);
2591 mpFS->endElementNS(XML_mc, XML_Choice);
2592 mpFS->startElementNS(XML_mc, XML_Fallback);
2594 mpFS->endElementNS(XML_mc, XML_Fallback);
2595 mpFS->endElementNS(XML_mc, XML_AlternateContent);
2606 xPropSet->getPropertyValue(
"CLSID") >>= clsid;
2607 if (!clsid.isEmpty())
2610 bool const isValid =
aClassID.MakeId(clsid);
2611 assert(isValid); (void)isValid;
2621 xPropSet->getPropertyValue(
"Model") >>= xChartDoc;
2622 assert(xChartDoc.is());
2624#if !ENABLE_WASM_STRIP_CHART
2640 uno::Reference<embed::XEmbeddedObject>
const xObj(
2641 xPropSet->getPropertyValue(
"EmbeddedObject"), uno::UNO_QUERY);
2645 SAL_WARN(
"oox.shape",
"ShapeExport::WriteOLE2Shape: no object");
2649 if (
auto pOle2Obj =
dynamic_cast<SdrOle2Obj*
>(pSdrOLE2))
2651 const Graphic* pGraphic = pOle2Obj->GetGraphic();
2659 uno::Sequence<beans::PropertyValue> grabBag;
2663 uno::Reference<beans::XPropertySet>
const xParent(
2664 uno::Reference<container::XChild>(xObj, uno::UNO_QUERY_THROW)->getParent(),
2665 uno::UNO_QUERY_THROW);
2667 xParent->getPropertyValue(
"InteropGrabBag") >>= grabBag;
2669 entryName = uno::Reference<embed::XEmbedPersist>(xObj, uno::UNO_QUERY_THROW)->getEntryName();
2671 catch (uno::Exception
const&)
2679 for (
auto const& it : std::as_const(grabBag))
2681 if (it.Name ==
"EmbeddedObjects")
2683 uno::Sequence<beans::PropertyValue> objects;
2684 it.Value >>= objects;
2685 for (
auto const&
object : std::as_const(objects))
2687 if (
object.
Name == entryName)
2689 uno::Sequence<beans::PropertyValue>
props;
2690 object.Value >>=
props;
2691 for (
auto const& prop : std::as_const(
props))
2693 if (prop.Name ==
"ProgID")
2695 prop.Value >>= progID;
2707 OUString sRelationType;
2709 const char * pProgID(
nullptr);
2710 OString anotherProgID;
2712 uno::Reference<io::XInputStream>
const xInStream =
2719 if (!xInStream.is())
2721 xPropSet->getPropertyValue(
"LinkURL") >>= sURL;
2730 if (!pProgID && !progID.isEmpty())
2733 pProgID = anotherProgID.getStr();
2737 assert(!sRelationType.isEmpty());
2744 assert(xOutStream.is());
2750 catch (uno::Exception
const&)
2756 mpFS->getOutputStream(), sRelationType,
2761 bool bShowAsIcon = (xPropSet->getPropertyValue(
"Aspect") >>= nAspect)
2762 && nAspect == embed::Aspects::MSOLE_ICON;
2782 mpFS->startElementNS(XML_a, XML_graphic);
2783 mpFS->startElementNS(XML_a, XML_graphicData,
2784 XML_uri,
"http://schemas.openxmlformats.org/presentationml/2006/ole");
2789 XML_progId, pProgID,
2790 FSNS(XML_r, XML_id), sRelId,
2798 FSNS(XML_r, XML_id), sRelId,
2813 if (
auto pOle2Obj =
dynamic_cast<SdrOle2Obj*
>(pSdrOLE2))
2815 const Graphic* pGraphic = pOle2Obj->GetGraphic();
2822 mpFS->endElementNS( XML_a, XML_graphicData );
2823 mpFS->endElementNS( XML_a, XML_graphic );
2846 sal_Int32 nID = pFB->GetUniqueId();
2848 (*mpShapeMap)[ rXShape ] = nID;
2863 ShapeHashMap::const_iterator aIter = pShapeMap->find( rXShape );
2865 if( aIter == pShapeMap->end() )
2868 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
constexpr tools::Long Y() const
void setX(tools::Long nX)
void setY(tools::Long nY)
constexpr tools::Long X() 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 void AddExtLst(FSHelperPtr const &pFS, Reference< XPropertySet > const &xShape)
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