26#include <osl/diagnose.h>
40#include <oox/token/namespaces.hxx>
41#include <oox/token/tokens.hxx>
51static uno::Reference<io::XInputStream>
54 if (rStream.isEmpty())
57 Reference< XInputStream > xInStrm( rFilter.
openInputStream(rStream), UNO_SET_THROW );
63 return rStream.empty() ? OUString() : OUString::Concat(
"vnd.sun.star.Package:") + rStream;
77 switch( getBaseToken( aElementToken ) )
84 case XML_wavAudioFile:
88 if (xMediaStream.is())
90 mpShapePtr->getGraphicProperties().m_xMediaStream = xMediaStream;
100 if (!rPath.isEmpty())
103 if (xMediaStream.is())
105 mpShapePtr->getGraphicProperties().m_xMediaStream = xMediaStream;
106 mpShapePtr->getGraphicProperties().m_sMediaPackageURL
114 if (!rPath.isEmpty())
115 mpShapePtr->getGraphicProperties().m_sMediaPackageURL
122 if ((getNamespace( aElementToken ) == NMSP_vml) &&
mpShapePtr)
124 mpShapePtr->setServiceName(
"com.sun.star.drawing.CustomShape");
128 pCstmShpProps->setShapePresetType( getBaseToken( aElementToken ) );
138 mbEmbedShapesInChart( bEmbedShapesInChart ),
145 switch( getBaseToken( aElementToken ) )
148 case XML_nvGraphicFramePr:
155 case XML_graphicData :
158 if ( sUri ==
"http://schemas.openxmlformats.org/presentationml/2006/ole" ||
159 sUri ==
"http://purl.oclc.org/ooxml/presentationml/ole" )
161 else if ( sUri ==
"http://schemas.openxmlformats.org/drawingml/2006/diagram" ||
162 sUri ==
"http://purl.oclc.org/ooxml/drawingml/diagram" )
164 else if ( sUri ==
"http://schemas.openxmlformats.org/drawingml/2006/chart" ||
165 sUri ==
"http://purl.oclc.org/ooxml/drawingml/chart" )
167 else if ( sUri ==
"http://schemas.openxmlformats.org/drawingml/2006/table" ||
168 sUri ==
"http://purl.oclc.org/ooxml/drawingml/table" )
172 SAL_WARN(
"oox.drawingml",
"OOX: Ignore graphicsData of :" << sUri );
184 if( getCurrentElement() == PPT_TOKEN( graphicFrame ) &&
mpParent )
194 mrOleObjectInfo( xShape->setOleObjectType() )
211 case PPT_TOKEN( oleObj ):
215 OSL_ENSURE( pRelation,
"OleObjectGraphicDataContext::createFastChildContext - missing relation for OLE object" );
226 if( !aFragmentPath.isEmpty() )
238 case PPT_TOKEN( embed ):
239 OSL_ENSURE( !
mrOleObjectInfo.
mbLinked,
"OleObjectGraphicDataContext::createFastChildContext - unexpected child element" );
242 case PPT_TOKEN( link ):
243 OSL_ENSURE(
mrOleObjectInfo.
mbLinked,
"OleObjectGraphicDataContext::createFastChildContext - unexpected child element" );
246 case PPT_TOKEN( pic ):
250 SAL_WARN(
"oox",
"OleObjectGraphicDataContext::onCreateContext: unhandled element: "
251 << getBaseToken(nElement));
257 if( getCurrentElement() == PPT_TOKEN( oleObj ) && !isMCEStateEmpty() )
261 setMCEState( MCE_STATE::Started );
268 pShapePtr->setDiagramType();
277 switch( aElementToken )
279 case DGM_TOKEN( relIds ):
292 SAL_INFO(
"oox.drawingml",
"DiagramGraphicDataContext::onCreateContext: added shape " <<
mpShapePtr->getName()
293 <<
" of type " <<
mpShapePtr->getServiceName()
294 <<
", position: " <<
mpShapePtr->getPosition().X
304 for (
const auto& rRelId :
mpShapePtr->getExtDrawings())
326 mrChartShapeInfo( rxShape->setChartType( bEmbedShapes ) )
332 if( nElement == C_TOKEN(
chart ) )
Provides access to attribute values of an element.
OUString getStringDefaulted(sal_Int32 nAttrToken) const
Returns the string value of the specified attribute, returns an empty string if attribute not present...
std::optional< OUString > getXString(sal_Int32 nAttrToken) const
Returns the string value of the specified attribute.
std::optional< bool > getBool(sal_Int32 nAttrToken) const
Returns the boolean value of the specified attribute.
XmlFilterBase & getFilter() const
Returns the filter instance.
OUString getFragmentPathFromRelation(const Relation &rRelation) const
Returns the full fragment path for the target of the passed relation.
OUString getFragmentPathFromRelId(const OUString &rRelId) const
Returns the full fragment path for the passed relation identifier.
const Relations & getRelations() const
Returns the relations of the current fragment.
bool importBinaryData(StreamDataSequence &orDataSeq, const OUString &rStreamName)
Imports the raw binary data from the specified stream.
OUString getAbsoluteUrl(const OUString &rUrl) const
Returns an absolute URL for the passed relative or absolute URL.
css::uno::Reference< css::io::XInputStream > openInputStream(const OUString &rStreamName) const
Opens and returns the specified input stream from the base storage.
OUString getFragmentPathFromRelId(const OUString &rRelId) const
Returns the full fragment path for the passed relation identifier.
OUString getExternalTargetFromRelId(const OUString &rRelId) const
Returns the external target of the relation with the passed relation identifier.
const Relation * getRelationFromRelId(const OUString &rId) const
Returns the relation with the passed relation identifier.
void setMissingExtDrawing()
Signal that an MSO 2007-created SmartArt was found, need to warn the user about it.
Context handler that imports the a:blipFill element.
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const ::oox::AttributeList &rAttribs) override
ChartShapeInfo & mrChartShapeInfo
ChartGraphicDataContext(::oox::core::ContextHandler2Helper const &rParent, const ShapePtr &rxShape, bool bEmbedShapes)
DiagramGraphicDataContext(::oox::core::ContextHandler2Helper const &rParent, const ShapePtr &pShapePtr)
virtual ~DiagramGraphicDataContext() override
virtual ::oox::core::ContextHandlerRef onCreateContext(::sal_Int32 Element, const ::oox::AttributeList &rAttribs) override
GraphicShapeContext(::oox::core::ContextHandler2Helper const &rParent, const ShapePtr &pMasterShapePtr, const ShapePtr &pShapePtr)
virtual ::oox::core::ContextHandlerRef onCreateContext(::sal_Int32 Element, const ::oox::AttributeList &rAttribs) override
bool mbEmbedShapesInChart
::oox::core::ContextHandler2Helper * mpParent
virtual void onEndElement() override
virtual ::oox::core::ContextHandlerRef onCreateContext(::sal_Int32 Element, const ::oox::AttributeList &rAttribs) override
GraphicalObjectFrameContext(::oox::core::ContextHandler2Helper &rParent, const ShapePtr &pMasterShapePtr, const ShapePtr &pShapePtr, bool bEmbedShapesInChart)
virtual void onEndElement() override
virtual ::oox::core::ContextHandlerRef onCreateContext(::sal_Int32 Element, const ::oox::AttributeList &rAttribs) override
virtual ~OleObjectGraphicDataContext() override
::oox::vml::OleObjectInfo & mrOleObjectInfo
OleObjectGraphicDataContext(::oox::core::ContextHandler2Helper const &rParent, const ShapePtr &pShapePtr)
virtual ::oox::core::ContextHandlerRef onCreateContext(::sal_Int32 Element, const ::oox::AttributeList &rAttribs) override
ShapePtr mpMasterShapePtr
context to import a CT_Transform2D
Represents the collection of VML shapes for a complete draw page.
RegionData_Impl * mpParent
static uno::Reference< io::XInputStream > lcl_GetMediaStream(const OUString &rStream, const oox::core::XmlFilterBase &rFilter)
static OUString lcl_GetMediaReference(std::u16string_view rStream)
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
OUString getEmbeddedWAVAudioFile(const core::Relations &rRelations, const AttributeList &rAttribs)
std::shared_ptr< Shape > ShapePtr
std::shared_ptr< CustomShapeProperties > CustomShapePropertiesPtr
void loadDiagram(ShapePtr const &pShape, core::XmlFilterBase &rFilter, const OUString &rDataModelPath, const OUString &rLayoutPath, const OUString &rQStylePath, const OUString &rColorStylePath, const oox::core::Relations &rRelations)
load diagram data, and put resulting graphic into shape
OUString maFragmentPath
Path to related XML stream, e.g. for charts.
StreamDataSequence maEmbeddedData
Data of an embedded OLE object.
OUString maTargetLink
Path to external data for linked OLE object.
bool mbShowAsIcon
True = show as icon, false = show contents.
bool mbLinked
True = linked OLE object, false = embedded OLE object.
bool mbHasPicture
Ole object requires a picture element according to spec.>
OUString maName
Programmatical name of the OLE object.
OUString maShapeId
Shape identifier for shape lookup.