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&)
324#define GETA(propName) \
325 GetProperty( rXPropSet, #propName)
327#define GETAD(propName) \
328 ( GetPropertyAndState( rXPropSet, rXPropState, #propName, eState ) && eState == beans::PropertyState_DIRECT_VALUE )
330#define GET(variable, propName) \
331 if ( GETA(propName) ) \
335 :
DrawingML(
std::move(pFS), pFB, eDocumentType, pTextExport )
336 , m_nEmbeddedObjects(0)
338 , mbUserShapes( bUserShapes )
339 , mnXmlNamespace( nXmlNamespace )
342 , mpShapeMap( pShapeMap ? pShapeMap : &maShapeMap )
356 if ( !aRetSize.
Width() )
360 return awt::Size( aRetSize.
Width(), aRetSize.
Height() );
366 return xText->getString().getLength();
378 if ( xPropSetInfo.is() )
380 if ( xPropSetInfo->hasPropertyByName(
"IsEmptyPresentationObject" ) )
382 bool bIsEmptyPresObj =
false;
383 if ( xPropSet->getPropertyValue(
"IsEmptyPresentationObject" ) >>= bIsEmptyPresObj )
385 SAL_INFO(
"oox.shape",
"empty presentation object " << bIsEmptyPresObj <<
" , props:");
386 if( bIsEmptyPresObj )
391 if ( xPropSetInfo->hasPropertyByName(
"IsPresentationObject" ) )
393 bool bIsPresObj =
false;
394 if ( xPropSet->getPropertyValue(
"IsPresentationObject" ) >>= bIsPresObj )
396 SAL_INFO(
"oox.shape",
"presentation object " << bIsPresObj <<
", props:");
409 SAL_INFO(
"oox.shape",
"write polypolygon shape");
414 awt::Point aPos = xShape->getPosition();
418 awt::Point aParentPos =
m_xParent->getPosition();
419 aPos.X -= aParentPos.X;
420 aPos.Y -= aParentPos.Y;
422 awt::Size aSize = xShape->getSize();
425#if OSL_DEBUG_LEVEL > 0
428 SAL_INFO(
"oox.shape",
"poly count " << aPolyPolygon.
Count());
482 sal_Int32 nGroupShapeToken = XML_grpSp;
486 nGroupShapeToken = XML_wgp;
512 uno::Reference<drawing::XShapes> xGroupShape(xShape, uno::UNO_QUERY_THROW);
513 uno::Reference<drawing::XShape> xParent =
m_xParent;
515 for (sal_Int32
i = 0;
i < xGroupShape->getCount(); ++
i)
517 uno::Reference<drawing::XShape> xChild(xGroupShape->getByIndex(
i), uno::UNO_QUERY_THROW);
520 uno::Reference<lang::XServiceInfo> xServiceInfo(xChild, uno::UNO_QUERY_THROW);
526 if (xServiceInfo->supportsService(
"com.sun.star.drawing.GraphicObjectShape")
544 static const std::initializer_list<std::u16string_view> vDenylist = {
560 u"round-rectangular-callout",
561 u"rectangular-callout",
569 u"horizontal-scroll",
574 u"flowchart-process",
575 u"flowchart-alternate-process",
576 u"flowchart-decision",
578 u"flowchart-predefined-process",
579 u"flowchart-internal-storage",
580 u"flowchart-document",
581 u"flowchart-multidocument",
582 u"flowchart-terminator",
583 u"flowchart-preparation",
584 u"flowchart-manual-input",
585 u"flowchart-manual-operation",
586 u"flowchart-connector",
587 u"flowchart-off-page-connector",
589 u"flowchart-punched-tape",
590 u"flowchart-summing-junction",
592 u"flowchart-collate",
594 u"flowchart-extract",
596 u"flowchart-stored-data",
598 u"flowchart-sequential-access",
599 u"flowchart-magnetic-disk",
600 u"flowchart-direct-access-storage",
604 return std::find(vDenylist.begin(), vDenylist.end(), rShapeType) != vDenylist.end();
609 static const std::initializer_list<std::u16string_view> vAllowlist = {
616 return std::find(vAllowlist.begin(), vAllowlist.end(), rShapeType) != vAllowlist.end();
622 if ( rParam.Value.getValueTypeClass() == TypeClass_DOUBLE )
625 if ( rParam.Value >>= fValue )
626 nValue =
static_cast<sal_Int32
>(fValue);
631 if ( rParam.Type == EnhancedCustomShapeParameterType::ADJUSTMENT)
635 if ( nIdx < rSeq.getLength() )
637 if ( rSeq[ nIdx ] .
Value.getValueTypeClass() == TypeClass_DOUBLE )
640 rSeq[ nIdx ].Value >>= fValue;
646 rSeq[ nIdx ].Value >>=
nValue;
654 std::vector< std::pair< sal_Int32, sal_Int32> > &rHandlePositionList,
659 static const OUStringLiteral sPosition(
u"Position" );
660 bool bPosition =
false;
661 EnhancedCustomShapeParameterPair aPosition;
662 for (
const PropertyValue& rPropVal: rPropSeq )
664 if ( rPropVal.Name == sPosition )
666 if ( rPropVal.Value >>= aPosition )
672 sal_Int32 nXPosition = 0;
673 sal_Int32 nYPosition = 0;
677 rHandlePositionList.emplace_back( nXPosition, nYPosition );
684 rAvList.emplace_back( nAdjIdx ,
nValue );
689 nAngle = nAngle % 360;
690 return nAngle < 0 ? ( nAngle + 360 ) : nAngle ;
695 if (nWidth != 0 || nHeight != 0)
697 double fAngle = basegfx::deg2rad<100>(nInternAngle);
698 fAngle = atan2(nHeight * sin(fAngle), nWidth * cos(fAngle));
699 fAngle = basegfx::rad2deg<60000>(fAngle);
701 nAngle = nAngle % 21600000;
702 return nAngle < 0 ? (nAngle + 21600000) : nAngle;
708static OUString
lcl_GetTarget(
const css::uno::Reference<css::frame::XModel>& xModel,
709 std::u16string_view rURL)
713 sal_uInt32 nPageCount = xDrawPages->getCount();
716 for (sal_uInt32
i = 0;
i < nPageCount; ++
i)
719 xDrawPages->getByIndex(
i) >>= xDrawPage;
723 OUString sSlideName =
"#" + xNamed->getName();
724 if (rURL == sSlideName)
726 sTarget =
"slide" + OUString::number(
i + 1) +
".xml";
736 SAL_INFO(
"oox.shape",
"write custom shape");
746 bool bHasGeometrySeq(
false);
748 OUString sShapeType(
"non-primitive");
749 if (
GETA(CustomShapeGeometry))
751 SAL_INFO(
"oox.shape",
"got custom shape geometry");
752 if (
mAny >>= aGeometrySeq)
754 bHasGeometrySeq =
true;
755 SAL_INFO(
"oox.shape",
"got custom shape geometry sequence");
756 for (
const PropertyValue& rProp : std::as_const(aGeometrySeq))
758 SAL_INFO(
"oox.shape",
"geometry property: " << rProp.Name);
759 if (rProp.Name ==
"Type")
760 rProp.Value >>= sShapeType;
765 bool bPredefinedHandlesUsed =
true;
766 bool bHasHandles =
false;
768 ShapeFlag nMirrorFlags = ShapeFlag::NONE;
772 const bool bIsDefaultObject(
777 SAL_INFO(
"oox.shape",
"custom shape type: " << sShapeType <<
" ==> " << sPresetShape);
779 sal_Int32 nAdjustmentValuesIndex = -1;
780 awt::Rectangle aViewBox;
781 uno::Sequence<beans::PropertyValues> aHandles;
788 for (
int i = 0;
i < aGeometrySeq.getLength();
i++)
790 const PropertyValue& rProp = aGeometrySeq[
i ];
791 SAL_INFO(
"oox.shape",
"geometry property: " << rProp.Name);
793 if ( rProp.Name ==
"MirroredX" )
794 rProp.Value >>= bFlipH;
796 if ( rProp.Name ==
"MirroredY" )
797 rProp.Value >>= bFlipV;
798 if ( rProp.Name ==
"AdjustmentValues" )
799 nAdjustmentValuesIndex =
i;
800 else if ( rProp.Name ==
"Handles" )
802 rProp.Value >>= aHandles;
803 if ( aHandles.hasElements() )
805 if( !bIsDefaultObject )
806 bPredefinedHandlesUsed =
false;
809 else if ( rProp.Name ==
"ViewBox" )
810 rProp.Value >>= aViewBox;
818 bool bUseBackground =
false;
820 mAny >>= bUseBackground;
826 bool isVisible = true ;
841 if( !sURL.isEmpty() )
848 mpFS->singleElementNS(XML_a, XML_hlinkClick,
FSNS(XML_r, XML_id), sRelId);
859 presentation::ClickAction eClickAction = presentation::ClickAction_NONE;
860 mAny >>= eClickAction;
861 if (eClickAction != presentation::ClickAction_NONE)
863 switch (eClickAction)
865 case presentation::ClickAction_STOPPRESENTATION:
866 sPPAction =
"ppaction://hlinkshowjump?jump=endshow";
868 case presentation::ClickAction_NEXTPAGE:
869 sPPAction =
"ppaction://hlinkshowjump?jump=nextslide";
871 case presentation::ClickAction_LASTPAGE:
872 sPPAction =
"ppaction://hlinkshowjump?jump=lastslide";
874 case presentation::ClickAction_PREVPAGE:
875 sPPAction =
"ppaction://hlinkshowjump?jump=previousslide";
877 case presentation::ClickAction_FIRSTPAGE:
878 sPPAction =
"ppaction://hlinkshowjump?jump=firstslide";
880 case presentation::ClickAction_BOOKMARK:
881 sBookmark =
"#" + sBookmark;
887 if (!sPPAction.isEmpty())
888 pFS->singleElementNS(XML_a, XML_hlinkClick,
FSNS(XML_r, XML_id),
"", XML_action,
891 if (!sBookmark.isEmpty())
902 mpFS->singleElementNS(XML_a, XML_hlinkClick,
FSNS(XML_r, XML_id), sRelId);
904 mpFS->singleElementNS(XML_a, XML_hlinkClick,
FSNS(XML_r, XML_id), sRelId,
905 XML_action,
"ppaction://hlinksldjump");
926 bool bCustGeom =
true;
927 bool bOnDenylist =
false;
928 if( sShapeType ==
"ooxml-non-primitive" )
930 else if( sShapeType.startsWith(
"ooxml") )
940 bool bPresetWriteSuccessful =
false;
943 if (!sShapeType.startsWith(
"ooxml") && sShapeType !=
"non-primitive" && !
mbUserShapes
944 && xShape->getShapeType() ==
"com.sun.star.drawing.CustomShape"
948 bPresetWriteSuccessful = aCustomShapeConverter.
WriteShape();
951 if (bPresetWriteSuccessful)
964 else if (bOnDenylist && bHasHandles && nAdjustmentValuesIndex !=-1 && !sShapeType.startsWith(
"mso-spt"))
968 std::vector< std::pair< sal_Int32, sal_Int32> > aHandlePositionList;
969 std::vector< std::pair< sal_Int32, sal_Int32> > aAvList;
970 aGeometrySeq[ nAdjustmentValuesIndex ].Value >>= aAdjustmentSeq ;
974 sal_Int32 nXPosition = 0;
975 sal_Int32 nYPosition = 0;
976 if ( !aHandlePositionList.empty() )
978 nXPosition = aHandlePositionList[0].first ;
979 nYPosition = aHandlePositionList[0].second ;
985 sal_Int32 adj3 = double(nYPosition)/aViewBox.Height *100000;
986 sal_Int32 adj4 = double(nXPosition)/aViewBox.Width *100000;
995 sal_Int32 adj5 = double(nYPosition)/aViewBox.Height *100000;
996 sal_Int32 adj6 = double(nXPosition)/aViewBox.Width *100000;
997 sal_Int32 adj3 = 18750;
998 sal_Int32 adj4 = -16667;
1001 if ( aHandlePositionList.size() > 1 )
1003 nXPosition = aHandlePositionList[1].first ;
1004 nYPosition = aHandlePositionList[1].second ;
1005 adj3 = double(nYPosition)/aViewBox.Height *100000;
1006 adj4 = double(nXPosition)/aViewBox.Width *100000;
1019 sal_Int32 adj1 = (double(nXPosition)/aViewBox.Width -0.5) *100000;
1020 sal_Int32 adj2 = (double(nYPosition)/aViewBox.Height -0.5) *100000;
1032 sal_Int32 adj = double( aViewBox.Width - nXPosition) / std::min( aViewBox.Width,aViewBox.Height ) * 100000;
1044 sal_Int32 adj = double( nXPosition )/aViewBox.Width*100000 ;
1053 sal_Int32 adj = double( nYPosition )/aViewBox.Height *100000 ;
1059 sal_Int32 adj = double( nYPosition )/aViewBox.Height *100000 - 76458.0;
1065 sal_Int32 nRadius = 50000 * ( 1 - double(nXPosition) / 10800);
1078 if ( sPresetShape ==
"frame" )
1080 sal_Int32 adj1 = double( nYPosition )/aViewBox.Height *100000 ;
1091 if( nAdjustmentValuesIndex != -1 )
1094 aGeometrySeq[ nAdjustmentValuesIndex ] );
1099 if( rXPropSet.is() )
1105 bool bHas3DEffectinShape =
false;
1106 uno::Sequence<beans::PropertyValue> grabBag;
1107 rXPropSet->getPropertyValue(
"InteropGrabBag") >>= grabBag;
1109 for (
auto const& it : std::as_const(grabBag))
1110 if (it.Name ==
"3DEffectProperties")
1111 bHas3DEffectinShape =
true;
1113 if( bHas3DEffectinShape)
1133 SAL_INFO(
"oox.shape",
"write ellipse shape");
1156 CircleKind eCircleKind(CircleKind_FULL);
1158 xProps->getPropertyValue(
"CircleKind" ) >>= eCircleKind;
1164 if (CircleKind_FULL == eCircleKind)
1168 sal_Int32 nStartAngleIntern(9000);
1169 sal_Int32 nEndAngleIntern(0);
1172 xProps->getPropertyValue(
"CircleStartAngle" ) >>= nStartAngleIntern;
1173 xProps->getPropertyValue(
"CircleEndAngle") >>= nEndAngleIntern;
1175 std::vector< std::pair<sal_Int32,sal_Int32>> aAvList;
1176 awt::Size aSize = xShape->getSize();
1177 if (aSize.Width != 0 || aSize.Height != 0)
1186 switch (eCircleKind)
1188 case CircleKind_ARC :
1191 case CircleKind_SECTION :
1194 case CircleKind_CUT :
1203 if (CircleKind_ARC == eCircleKind)
1210 aNewValue <<= eFillStyle;
1211 xProps->setPropertyValue(
"FillStyle", aNewValue);
1235 SAL_INFO(
"oox.shape",
"write graphic object shape");
1239 SAL_INFO(
"oox.shape",
"graphicObject: wrote only text");
1246 SAL_INFO(
"oox.shape",
"graphicObject without text");
1248 uno::Reference<graphic::XGraphic> xGraphic;
1257 else if (xShapeProps.is() && xShapeProps->getPropertySetInfo()->hasPropertyByName(
"Graphic"))
1259 xShapeProps->getPropertyValue(
"Graphic") >>= xGraphic;
1262 bool bHasMediaURL = xShapeProps.is() && xShapeProps->getPropertySetInfo()->hasPropertyByName(
"MediaURL") && (xShapeProps->getPropertyValue(
"MediaURL") >>= sMediaURL);
1264 if (!xGraphic.is() && !bHasMediaURL)
1266 SAL_INFO(
"oox.shape",
"no graphic or media URL found");
1281 presentation::ClickAction eClickAction = presentation::ClickAction_NONE;
1282 OUString sDescr, sURL, sBookmark, sPPAction;
1285 if ( ( bHaveDesc =
GetProperty( xShapeProps,
"Description" ) ) )
1292 mAny >>= eClickAction;
1299 if (eClickAction != presentation::ClickAction_NONE)
1301 switch (eClickAction)
1303 case presentation::ClickAction_STOPPRESENTATION:
1304 sPPAction =
"ppaction://hlinkshowjump?jump=endshow";
1306 case presentation::ClickAction_NEXTPAGE:
1307 sPPAction =
"ppaction://hlinkshowjump?jump=nextslide";
1309 case presentation::ClickAction_LASTPAGE:
1310 sPPAction =
"ppaction://hlinkshowjump?jump=lastslide";
1312 case presentation::ClickAction_PREVPAGE:
1313 sPPAction =
"ppaction://hlinkshowjump?jump=previousslide";
1315 case presentation::ClickAction_FIRSTPAGE:
1316 sPPAction =
"ppaction://hlinkshowjump?jump=firstslide";
1318 case presentation::ClickAction_BOOKMARK:
1319 sBookmark =
"#" + sBookmark;
1327 if (bHasMediaURL || !sPPAction.isEmpty())
1328 pFS->singleElementNS(XML_a, XML_hlinkClick,
FSNS(XML_r, XML_id),
"", XML_action,
1329 bHasMediaURL ?
"ppaction://media" : sPPAction);
1330 if( !sURL.isEmpty() )
1337 mpFS->singleElementNS(XML_a, XML_hlinkClick,
FSNS(XML_r, XML_id), sRelId);
1340 if (!sBookmark.isEmpty())
1348 sBookmark, bExtURL);
1351 mpFS->singleElementNS(XML_a, XML_hlinkClick,
FSNS(XML_r, XML_id), sRelId);
1353 mpFS->singleElementNS(XML_a, XML_hlinkClick,
FSNS(XML_r, XML_id), sRelId, XML_action,
1354 "ppaction://hlinksldjump");
1374 else if (bHasMediaURL)
1377 if (xShapeProps->getPropertySetInfo()->hasPropertyByName(
"FallbackGraphic"))
1378 xShapeProps->getPropertyValue(
"FallbackGraphic") >>= xFallbackGraphic;
1390 bool bStretch =
false;
1391 if( !pGraphic &&
GetProperty( xShapeProps,
"FillBitmapStretch" ) )
1394 if ( pGraphic || bStretch )
1395 pFS->singleElementNS(XML_a, XML_stretch);
1400 pFS->startElementNS(XML_a, XML_stretch);
1401 pFS->singleElementNS(XML_a, XML_fillRect);
1402 pFS->endElementNS(XML_a, XML_stretch);
1409 bool bFlipH =
false;
1410 if( xShapeProps->getPropertySetInfo()->hasPropertyByName(
"IsMirrored") )
1412 xShapeProps->getPropertyValue(
"IsMirrored") >>= bFlipH;
1427static void lcl_Rotate(sal_Int32 nAngle, Point center, awt::Point& pt)
1429 sal_Int16 nCos, nSin;
1455 Point aStart = aPoly[0];
1458 if (aStart.X() > aEnd.X() && aStart.Y() > aEnd.Y())
1474 if (aStart.X() < aEnd.X() && aStart.Y() < aEnd.Y())
1488 if (aStart.Y() < aEnd.Y() && aStart.X() > aEnd.X())
1506 if (aStart.Y() > aEnd.Y() && aStart.X() < aEnd.X())
1526 Point aStartPoint = aPoly[0];
1528 if (aStartPoint.X() == aPoly[1].X())
1530 if ((aStartPoint.X() < aEndPoint.X() && aStartPoint.Y() > aEndPoint.Y())
1531 || (aStartPoint.X() > aEndPoint.X() && aStartPoint.Y() < aEndPoint.Y()))
1540 if (aStartPoint.X() > aPoly[1].X())
1551 ConnectorType eConnectorType,
1552 std::vector<std::pair<sal_Int32, sal_Int32>>& rAvList)
1554 sal_Int32 nAdjCount = 0;
1555 if (eConnectorType == ConnectorType_CURVE)
1559 if ((aPoly[0].
X() == aPoly[1].
X() && aPoly[2].
X() == aPoly[3].
X())
1560 || (aPoly[0].
Y() == aPoly[1].
Y() && aPoly[2].
Y() == aPoly[3].
Y()))
1569 if ((aPoly[2].
X() == aPoly[3].
X() && aPoly[3].
X() == aPoly[4].
X())
1570 || (aPoly[2].
Y() == aPoly[3].
Y() && aPoly[3].
Y() == aPoly[4].
Y()))
1599 sal_Int32 nAdjustValue;
1600 Point aStart = aPoly[0];
1603 for (sal_Int32
i = 1;
i <= nAdjCount; ++
i)
1607 if (aEnd.Y() == aStart.Y())
1608 aEnd.setY(aStart.Y() + 1);
1609 if (aEnd.X() == aStart.X())
1610 aEnd.setX(aStart.X() + 1);
1612 bool bVertical = aPoly[1].X() - aStart.X() != 0 ? true :
false;
1615 bVertical = !bVertical;
1617 if (eConnectorType == ConnectorType_CURVE)
1619 awt::Size aSize = xShape->getSize();
1620 awt::Point aShapePosition = xShape->getPosition();
1626 aPt.setY(aPoly[
i + 1].
Y());
1627 else if (aStart.Y() > aPt.Y())
1628 aPt.setY(aShapePosition.Y);
1630 aPt.setY(aShapePosition.Y + aSize.Height);
1635 aPt.setX(aPoly[
i + 1].
X());
1636 else if (aStart.X() > aPt.X())
1637 aPt.setX(aShapePosition.X);
1639 aPt.setX(aShapePosition.X + aSize.Width);
1644 nAdjustValue = ((aPt.Y() - aStart.Y()) * 100000) / (aEnd.Y() - aStart.Y());
1646 nAdjustValue = ((aPt.X() - aStart.X()) * 100000) / (aEnd.X() - aStart.X());
1648 rAvList.emplace_back(
i, nAdjustValue);
1655 uno::Reference<drawing::XGluePointsSupplier> xSupplier(xShape, uno::UNO_QUERY);
1656 uno::Reference<container::XIdentifierAccess> xGluePoints(xSupplier->getGluePoints(),
1658 if (nGluePointId > 3)
1663 if (nGluePointId == 1)
1665 else if (nGluePointId == 3)
1669 return nGluePointId;
1674 bool bFlipH =
false;
1675 bool bFlipV =
false;
1676 sal_Int32 nAngle = 0;
1677 sal_Int32 nStartGlueId = 0;
1678 sal_Int32 nEndGlueId = 0;
1680 SAL_INFO(
"oox.shape",
"write connector shape");
1685 std::vector<std::pair<sal_Int32, sal_Int32>> aAdjustValueList;
1688 awt::Point aStartPoint, aEndPoint;
1691 PropertyState eState;
1692 ConnectorType eConnectorType = ConnectorType_STANDARD;
1693 GET(eConnectorType, EdgeKind);
1695 switch( eConnectorType ) {
1696 case ConnectorType_CURVE:
1697 sGeometry =
"curvedConnector";
1699 case ConnectorType_LINES:
1700 case ConnectorType_STANDARD:
1701 sGeometry =
"bentConnector";
1704 case ConnectorType_LINE:
1705 sGeometry =
"straightConnector1";
1709 if(
GETAD( EdgeStartPoint ) ) {
1710 mAny >>= aStartPoint;
1711 if(
GETAD( EdgeEndPoint ) ) {
1715 GET( rXShapeA, EdgeStartConnection );
1716 GET( rXShapeB, EdgeEndConnection );
1718 GET(nStartGlueId, StartGluePointIndex);
1719 if (nStartGlueId != -1)
1721 GET(nEndGlueId, EndGluePointIndex);
1722 if (nEndGlueId != -1)
1728 awt::Point aParentPos =
m_xParent->getPosition();
1729 aStartPoint.X -= aParentPos.X;
1730 aStartPoint.Y -= aParentPos.Y;
1731 aEndPoint.X -= aParentPos.X;
1732 aEndPoint.Y -= aParentPos.Y;
1736 if (eConnectorType != ConnectorType_LINE)
1739 if (aPolyPolygon.
Count() > 0)
1747 Point center((aEndPoint.X + aStartPoint.X) / 2, (aEndPoint.Y + aStartPoint.Y) / 2);
1752 sGeometry = sGeometry + OUString::number(aAdjustValueList.size() + 2);
1759 aRect.
setWidth( aStartPoint.X - aEndPoint.X );
1760 if (eConnectorType == ConnectorType_LINE)
1765 aRect.
SetTop(aEndPoint.Y);
1766 aRect.
setHeight( aStartPoint.Y - aEndPoint.Y );
1767 if (eConnectorType == ConnectorType_LINE)
1772 const auto nShapeNode = (
mnXmlNamespace == XML_wps ? XML_wsp : XML_cxnSp);
1807 if( xShapeProps.is() )
1812 if( nShapeNode != XML_cxnSp )
1825 bool bFlipH =
false;
1826 bool bFlipV =
false;
1828 SAL_INFO(
"oox.shape",
"write line shape");
1835 if( aPolyPolygon.
Count() == 1 && aPolyPolygon[ 0 ].GetSize() == 2)
1839 bFlipH = ( rPoly[ 0 ].X() > rPoly[ 1 ].X() );
1840 bFlipV = ( rPoly[ 0 ].Y() > rPoly[ 1 ].Y() );
1863 if( xShapeProps.is() )
1897 SAL_INFO(
"oox.shape",
"write rectangle shape");
1903 sal_Int32 nRadius = 0;
1906 if( xShapeProps.is() )
1908 xShapeProps->getPropertyValue(
"CornerRadius" ) >>= nRadius;
1913 nRadius =
MapSize( awt::Size( nRadius, 0 ) ).Width;
1992 return shape_converters;
1998 throw lang::IllegalArgumentException();
2000 OUString sShapeType = xShape->getShapeType();
2001 SAL_INFO(
"oox.shape",
"write shape: " << sShapeType);
2002 NameToConvertMapType::const_iterator aConverter
2006 SAL_INFO(
"oox.shape",
"unknown shape");
2013 if (xShapeProperties && xShapeProperties->getPropertySetInfo()
2014 && xShapeProperties->getPropertySetInfo()->hasPropertyByName(
"IsPresentationObject")
2015 && xShapeProperties->getPropertyValue(
"IsPresentationObject").hasValue())
2016 mbPlaceholder = xShapeProperties->getPropertyValue(
"IsPresentationObject").get<
bool>();
2019 (this->*(aConverter->second))( xShape );
2026 uno::Reference<beans::XPropertySet> xPropertySet(xIface, uno::UNO_QUERY);
2027 if (!xPropertySet.is())
2029 uno::Reference<beans::XPropertySetInfo> xPropertySetInfo = xPropertySet->getPropertySetInfo();
2030 if (!xPropertySetInfo->hasPropertyByName(
"TextBox"))
2032 css::uno::Any aTextBox(xPropertySet->getPropertyValue(
"TextBox"));
2033 if (!aTextBox.hasValue())
2035 return aTextBox.get<
bool>();
2046 WriteText( xIface,
true,
false, nXmlNamespace );
2057 pFS->startElementNS(nXmlNamespace,
2060 0, bWritePropertiesAsLstStyles);
2063 WriteText( xIface,
true,
false, nXmlNamespace );
2066 mpFS->singleElementNS(nXmlNamespace, XML_bodyPr);
2076 mpFS->startElementNS(XML_a, XML_graphic);
2077 mpFS->startElementNS(XML_a, XML_graphicData,
2078 XML_uri,
"http://schemas.openxmlformats.org/drawingml/2006/table");
2080 if ( xPropSet.is() && ( xPropSet->getPropertyValue(
"Model" ) >>= xTable ) )
2082 mpFS->startElementNS(XML_a, XML_tbl);
2083 mpFS->startElementNS(XML_a, XML_tblPr);
2085 mpFS->endElementNS(XML_a, XML_tblPr);
2089 sal_uInt16 nRowCount =
static_cast< sal_uInt16
>( xRows->getCount() );
2090 sal_uInt16 nColumnCount =
static_cast< sal_uInt16
>( xColumns->getCount() );
2092 mpFS->startElementNS(XML_a, XML_tblGrid);
2094 for ( sal_Int32
x = 0;
x < nColumnCount;
x++ )
2097 sal_Int32 nWidth(0);
2098 xColPropSet->getPropertyValue(
"Width" ) >>= nWidth;
2100 mpFS->singleElementNS(XML_a, XML_gridCol,
2104 mpFS->endElementNS( XML_a, XML_tblGrid );
2107 typedef std::unordered_map<sal_Int32, std::pair<sal_Int32, Reference< XMergeableCell> > > transposeTableMap;
2108 transposeTableMap mergedCellMap;
2110 for( sal_Int32 nRow = 0; nRow < nRowCount; nRow++ )
2113 sal_Int32 nRowHeight(0);
2115 xRowPropSet->getPropertyValue(
"Height" ) >>= nRowHeight;
2117 mpFS->startElementNS(XML_a, XML_tr,
2119 for( sal_Int32 nColumn = 0; nColumn < nColumnCount; nColumn++ )
2123 sal_Int32 transposedIndexofCell = (nRow * nColumnCount) + nColumn;
2126 bool bCellOpened =
true;
2128 if(xCell->getColumnSpan() > 1 && xCell->getRowSpan() > 1)
2131 mpFS->startElementNS(XML_a, XML_tc,
2132 XML_gridSpan, OString::number(xCell->getColumnSpan()),
2133 XML_rowSpan, OString::number(xCell->getRowSpan()));
2138 for(sal_Int32 columnIndex = nColumn; columnIndex < nColumn+xCell->getColumnSpan(); ++columnIndex)
2140 for(sal_Int32 rowIndex = nRow; rowIndex < nRow+xCell->getRowSpan(); ++rowIndex)
2142 sal_Int32 transposeIndexForMergeCell =
2143 (rowIndex * nColumnCount) + columnIndex;
2144 mergedCellMap[transposeIndexForMergeCell] =
2145 std::make_pair(transposedIndexofCell, xCell);
2150 else if(xCell->getColumnSpan() > 1)
2153 mpFS->startElementNS(XML_a, XML_tc,
2154 XML_gridSpan, OString::number(xCell->getColumnSpan()));
2155 for(sal_Int32 columnIndex = nColumn; columnIndex < nColumn + xCell->getColumnSpan(); ++columnIndex) {
2156 sal_Int32 transposeIndexForMergeCell = (nRow*nColumnCount) + columnIndex;
2157 mergedCellMap[transposeIndexForMergeCell] =
2158 std::make_pair(transposedIndexofCell, xCell);
2161 else if(xCell->getRowSpan() > 1)
2164 mpFS->startElementNS(XML_a, XML_tc,
2165 XML_rowSpan, OString::number(xCell->getRowSpan()));
2167 for(sal_Int32 rowIndex = nRow; rowIndex < nRow + xCell->getRowSpan(); ++rowIndex) {
2168 sal_Int32 transposeIndexForMergeCell = (rowIndex*nColumnCount) + nColumn;
2169 mergedCellMap[transposeIndexForMergeCell] =
2170 std::make_pair(transposedIndexofCell, xCell);
2177 if(!xCell->isMerged())
2180 mpFS->startElementNS(XML_a, XML_tc);
2186 transposeTableMap::iterator it = mergedCellMap.find(transposedIndexofCell);
2187 if(it != mergedCellMap.end())
2189 sal_Int32 transposeIndexOfParent = it->second.first;
2192 sal_Int32 parentColumnIndex = transposeIndexOfParent % nColumnCount;
2193 sal_Int32 parentRowIndex = transposeIndexOfParent / nColumnCount;
2194 if(nColumn == parentColumnIndex)
2197 if(parentCell->getColumnSpan() > 1)
2200 mpFS->startElementNS(XML_a, XML_tc,
2201 XML_vMerge, OString::number(1),
2202 XML_gridSpan, OString::number(xCell->getColumnSpan()));
2207 mpFS->startElementNS(XML_a, XML_tc,
2208 XML_vMerge, OString::number(1));
2211 else if(nRow == parentRowIndex)
2214 if(parentCell->getRowSpan() > 1)
2217 mpFS->startElementNS(XML_a, XML_tc,
2218 XML_hMerge, OString::number(1),
2219 XML_rowSpan, OString::number(xCell->getRowSpan()));
2224 mpFS->startElementNS(XML_a, XML_tc,
2225 XML_hMerge, OString::number(1));
2231 mpFS->startElementNS(XML_a, XML_tc,
2232 XML_vMerge, OString::number(1),
2233 XML_hMerge, OString::number(1));
2237 bCellOpened =
false;
2248 mpFS->endElementNS( XML_a, XML_tc );
2252 mpFS->endElementNS( XML_a, XML_tr );
2255 mpFS->endElementNS( XML_a, XML_tbl );
2258 mpFS->endElementNS( XML_a, XML_graphicData );
2259 mpFS->endElementNS( XML_a, XML_graphic );
2265 TextVerticalAdjust eVerticalAlignment;
2266 const char* sVerticalAlignment;
2268 Any aLeftMargin = xCellPropSet->getPropertyValue(
"TextLeftDistance");
2271 Any aRightMargin = xCellPropSet->getPropertyValue(
"TextRightDistance");
2274 Any aVerticalAlignment = xCellPropSet->getPropertyValue(
"TextVerticalAdjust");
2275 aVerticalAlignment >>= eVerticalAlignment;
2278 mpFS->startElementNS(XML_a, XML_tcPr, XML_anchor, sVerticalAlignment,
2287 mpFS->endElementNS( XML_a, XML_tcPr );
2300 mpFS->startElementNS(XML_a, XML_line, XML_w, OString::number(
nBorderWidth));
2301 if ( rBorderLine.Color == sal_Int32(
COL_AUTO ) )
2302 mpFS->singleElementNS(XML_a, XML_noFill);
2306 OUString sBorderStyle;
2307 sal_Int16 nStyle = rBorderLine.LineStyle;
2309 switch (*o3tl::doAccess<sal_Int16>(
mAny))
2311 case ::table::BorderLineStyle::SOLID:
2312 sBorderStyle =
"solid";
2314 case ::table::BorderLineStyle::DOTTED:
2315 sBorderStyle =
"dot";
2317 case ::table::BorderLineStyle::DASHED:
2318 sBorderStyle =
"dash";
2320 case ::table::BorderLineStyle::DASH_DOT:
2321 sBorderStyle =
"dashDot";
2323 case ::table::BorderLineStyle::DASH_DOT_DOT:
2324 sBorderStyle =
"sysDashDotDot";
2327 mpFS->singleElementNS(XML_a, XML_prstDash, XML_val, sBorderStyle);
2328 mpFS->endElementNS(XML_a, XML_line);
2332 mpFS->startElementNS(XML_a, XML_line);
2333 mpFS->singleElementNS(XML_a, XML_noFill);
2334 mpFS->endElementNS( XML_a, XML_line );
2340 BorderLine2 aBorderLine;
2343 xCellPropSet->getPropertyValue(
"LeftBorder") >>= aBorderLine;
2347 xCellPropSet->getPropertyValue(
"RightBorder") >>= aBorderLine;
2351 xCellPropSet->getPropertyValue(
"TopBorder") >>= aBorderLine;
2355 xCellPropSet->getPropertyValue(
"BottomBorder") >>= aBorderLine;
2403 if (!sURL.isEmpty())
2410 mpFS->singleElementNS(XML_a, XML_hlinkClick,
FSNS(XML_r, XML_id), sRelId);
2414 pFS->singleElementNS(
mnXmlNamespace, XML_cNvSpPr, XML_txBox,
"1");
2425 uno::Reference<beans::XPropertySet> xPropertySet(xShape, UNO_QUERY);
2444 assert(xPropSet.is());
2446 xPropSet->getPropertyValue(
"Model") >>= xMathModel;
2447 assert(xMathModel.is());
2453 mpFS->startElementNS(XML_mc, XML_AlternateContent);
2454 mpFS->startElementNS(XML_mc, XML_Choice,
2456 XML_Requires,
"a14");
2470 mpFS->startElementNS(XML_a, XML_bodyPr);
2471 mpFS->endElementNS(XML_a, XML_bodyPr);
2472 mpFS->startElementNS(XML_a, XML_p);
2473 mpFS->startElementNS(XML_a14, XML_m);
2475 oox::FormulaImExportBase *
const pMagic(
2476 dynamic_cast<oox::FormulaImExportBase*
>(xMathModel.get()));
2479 FormulaImExportBase::eFormulaAlign::INLINE);
2481 mpFS->endElementNS(XML_a14, XML_m);
2482 mpFS->endElementNS(XML_a, XML_p);
2485 mpFS->endElementNS(XML_mc, XML_Choice);
2486 mpFS->startElementNS(XML_mc, XML_Fallback);
2488 mpFS->endElementNS(XML_mc, XML_Fallback);
2489 mpFS->endElementNS(XML_mc, XML_AlternateContent);
2500 xPropSet->getPropertyValue(
"CLSID") >>= clsid;
2501 if (!clsid.isEmpty())
2504 bool const isValid =
aClassID.MakeId(clsid);
2505 assert(isValid); (void)isValid;
2515 xPropSet->getPropertyValue(
"Model") >>= xChartDoc;
2516 assert(xChartDoc.is());
2518#if !ENABLE_WASM_STRIP_CHART
2523 static sal_Int32 nChartCount = 0;
2535 uno::Reference<embed::XEmbeddedObject>
const xObj(
2536 xPropSet->getPropertyValue(
"EmbeddedObject"), uno::UNO_QUERY);
2540 SAL_WARN(
"oox.shape",
"ShapeExport::WriteOLE2Shape: no object");
2544 if (
auto pOle2Obj =
dynamic_cast<SdrOle2Obj*
>(pSdrOLE2))
2546 const Graphic* pGraphic = pOle2Obj->GetGraphic();
2554 uno::Sequence<beans::PropertyValue> grabBag;
2558 uno::Reference<beans::XPropertySet>
const xParent(
2559 uno::Reference<container::XChild>(xObj, uno::UNO_QUERY_THROW)->getParent(),
2560 uno::UNO_QUERY_THROW);
2562 xParent->getPropertyValue(
"InteropGrabBag") >>= grabBag;
2564 entryName = uno::Reference<embed::XEmbedPersist>(xObj, uno::UNO_QUERY_THROW)->getEntryName();
2566 catch (uno::Exception
const&)
2574 for (
auto const& it : std::as_const(grabBag))
2576 if (it.Name ==
"EmbeddedObjects")
2578 uno::Sequence<beans::PropertyValue> objects;
2579 it.Value >>= objects;
2580 for (
auto const&
object : std::as_const(objects))
2582 if (
object.
Name == entryName)
2584 uno::Sequence<beans::PropertyValue>
props;
2585 object.Value >>=
props;
2586 for (
auto const& prop : std::as_const(
props))
2588 if (prop.Name ==
"ProgID")
2590 prop.Value >>= progID;
2602 OUString sRelationType;
2604 const char * pProgID(
nullptr);
2606 uno::Reference<io::XInputStream>
const xInStream =
2611 if (!xInStream.is())
2616 OString anotherProgID;
2617 if (!pProgID && !progID.isEmpty())
2620 pProgID = anotherProgID.getStr();
2624 assert(!sRelationType.isEmpty());
2628 uno::Reference<io::XOutputStream>
const xOutStream(
2632 assert(xOutStream.is());
2636 }
catch (uno::Exception
const&) {
2641 bool bShowAsIcon = (xPropSet->getPropertyValue(
"Aspect") >>= nAspect)
2642 && nAspect == embed::Aspects::MSOLE_ICON;
2645 mpFS->getOutputStream(), sRelationType,
2664 mpFS->startElementNS(XML_a, XML_graphic);
2665 mpFS->startElementNS(XML_a, XML_graphicData,
2666 XML_uri,
"http://schemas.openxmlformats.org/presentationml/2006/ole");
2671 XML_progId, pProgID,
2672 FSNS(XML_r, XML_id), sRelId,
2680 FSNS(XML_r, XML_id), sRelId,
2692 if (
auto pOle2Obj =
dynamic_cast<SdrOle2Obj*
>(pSdrOLE2))
2694 const Graphic* pGraphic = pOle2Obj->GetGraphic();
2701 mpFS->endElementNS( XML_a, XML_graphicData );
2702 mpFS->endElementNS( XML_a, XML_graphic );
2725 sal_Int32 nID = pFB->GetUniqueId();
2727 (*mpShapeMap)[ rXShape ] = nID;
2742 ShapeHashMap::const_iterator aIter = pShapeMap->find( rXShape );
2744 if( aIter == pShapeMap->end() )
2747 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)
void WriteEmptyCustomGeometry()
DMLTextExport * GetTextExport()
The application-specific text exporter callback, if there is one.
void WriteFill(const css::uno::Reference< css::beans::XPropertySet > &xPropSet)
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)
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()
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)
void WriteBlipOrNormalFill(const css::uno::Reference< css::beans::XPropertySet > &rXPropSet, const OUString &rURLPropName)
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
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)
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
#define GET(variable, propName)
const char *const aClassID
Reference< XModel > xModel