o
    7 h                     @  s   d Z ddlmZ ddlmZ ddlmZ ddlmZ	 ddl
mZ er(ddlmZ G dd	 d	eZG d
d deZG dd deZG dd deZdS )zxEmbedded Package part objects.

"Package" in this context means another OPC package, i.e. a DOCX, PPTX, or XLSX "file".
    )annotations)TYPE_CHECKING)PROG_ID)CONTENT_TYPE)Part)Packagec                   @  s,   e Zd ZdZeddd	ZedddZdS )EmbeddedPackagePartzA distinct OPC package, e.g. an Excel file, embedded in this PPTX package.

    Has a partname like: `ppt/embeddings/Microsoft_Excel_Sheet1.xlsx`.
    prog_idPROG_ID | strobject_blobbytespackager   c                 C  sF   t |ts| |dtj||S tjttjttj	t
i| }|||S )aU  Return a new |EmbeddedPackagePart| subclass instance added to *package*.

        The subclass is determined by `prog_id` which corresponds to the "application"
        used to open the "file-type" of `object_blob`. The returned part contains the
        bytes of `object_blob` and has the content-type also determined by `prog_id`.
        z/ppt/embeddings/oleObject%d.bin)
isinstancer   next_partnameCTOFC_OLE_OBJECTDOCXEmbeddedDocxPartPPTXEmbeddedPptxPartXLSXEmbeddedXlsxPartnew)clsr	   r   r   ZEmbeddedPartCls r   b/var/www/html/figdemos/bartoux_crm/venv/lib/python3.10/site-packages/pptx/parts/embeddedpackage.pyfactory   s   
		zEmbeddedPackagePart.factoryblobc                 C  s   | | | j| j||S )zReturn new |EmbeddedPackagePart| subclass object.

        The returned part object contains `blob` and is added to `package`.
        )r   partname_templatecontent_type)r   r   r   r   r   r   r   2   s   
zEmbeddedPackagePart.newN)r	   r
   r   r   r   r   )r   r   r   r   )__name__
__module____qualname____doc__classmethodr   r   r   r   r   r   r      s    r   c                   @     e Zd ZdZdZejZdS )r   zA Word .docx file stored in a part.

    This part-type arises when a Word document appears as an embedded OLE-object shape.
    z./ppt/embeddings/Microsoft_Word_Document%d.docxN)r    r!   r"   r#   r   r   WML_DOCUMENTr   r   r   r   r   r   @   s    
r   c                   @  r%   )r   zA PowerPoint file stored in a part.

    This part-type arises when a PowerPoint presentation (.pptx file) appears as an
    embedded OLE-object shape.
    z8/ppt/embeddings/Microsoft_PowerPoint_Presentation%d.pptxN)r    r!   r"   r#   r   r   PML_PRESENTATIONr   r   r   r   r   r   J       
r   c                   @  r%   )r   zAn Excel file stored in a part.

    This part-type arises as the data source for a chart, but may also be the OLE-object
    for an embedded object shape.
    z,/ppt/embeddings/Microsoft_Excel_Sheet%d.xlsxN)r    r!   r"   r#   r   r   	SML_SHEETr   r   r   r   r   r   U   r(   r   N)r#   
__future__r   typingr   pptx.enum.shapesr   pptx.opc.constantsr   r   pptx.opc.packager   pptx.packager   r   r   r   r   r   r   r   r   <module>   s    .
