o
    7 ¾hÛ  ã                   @  sä   d Z ddlmZ ddlmZmZ ddlmZ ddlm	Z	 ddl
mZ ddlmZmZmZ ddlmZ dd	lmZ er`dd
lmZ ddlmZ ddlmZmZ ddlmZ ddlmZ ddlm Z  G dd„ de	ƒZ!G dd„ deƒZ"dS )z€Graphic Frame shape and related objects.

A graphic frame is a common container for table, chart, smart art, and media
objects.
é    )Úannotations)ÚTYPE_CHECKINGÚcast)ÚMSO_SHAPE_TYPE)Ú	BaseShape)ÚParentedElementProxy)ÚGRAPHIC_DATA_URI_CHARTÚGRAPHIC_DATA_URI_OLEOBJÚGRAPHIC_DATA_URI_TABLE)ÚTable)Úlazyproperty)ÚChart)ÚShadowFormat)ÚCT_GraphicalObjectDataÚCT_GraphicalObjectFrame)Ú	ChartPart)ÚBaseSlidePart)ÚProvidesPartc                      s’   e Zd ZdZd ‡ fdd„Zed!d
d„ƒZed"dd„ƒZed#dd„ƒZed#dd„ƒZ	ed$dd„ƒZ
ed%dd„ƒZed&dd„ƒZed'dd„ƒZ‡  ZS )(ÚGraphicFramez†Container shape for table, chart, smart art, and media objects.

    Corresponds to a `p:graphicFrame` element in the shape tree.
    ÚgraphicFramer   Úparentr   c                   ó   t ƒ  ||¡ || _d S ©N)ÚsuperÚ__init__Ú_graphicFrame)Úselfr   r   ©Ú	__class__© ú\/var/www/html/figdemos/bartoux_crm/venv/lib/python3.10/site-packages/pptx/shapes/graphfrm.pyr   %   ó   
zGraphicFrame.__init__Úreturnr   c                 C  s   | j stdƒ‚| jjS )z”The |Chart| object containing the chart in this graphic frame.

        Raises |ValueError| if this graphic frame does not contain a chart.
        zshape does not contain a chart)Ú	has_chartÚ
ValueErrorÚ
chart_partÚchart©r   r   r   r    r&   )   s   zGraphicFrame.chartr   c                 C  s*   | j j}|du rtdƒ‚td| j |¡ƒS )zBThe |ChartPart| object containing the chart in this graphic frame.Nz+this graphic frame does not contain a chartr   )r   Ú	chart_rIdr$   r   ÚpartÚrelated_part)r   r(   r   r   r    r%   3   s   zGraphicFrame.chart_partÚboolc                 C  ó   | j jtkS )z¥|True| if this graphic frame contains a chart object. |False| otherwise.

        When |True|, the chart object can be accessed using the `.chart` property.
        )r   ÚgraphicData_urir   r'   r   r   r    r#   ;   ó   zGraphicFrame.has_chartc                 C  r,   )z¥|True| if this graphic frame contains a table object, |False| otherwise.

        When |True|, the table object can be accessed using the `.table` property.
        )r   r-   r
   r'   r   r   r    Ú	has_tableC   r.   zGraphicFrame.has_tableÚ
_OleFormatc                 C  s    | j jstdƒ‚t| j j| jƒS )a  _OleFormat object for this graphic-frame shape.

        Raises `ValueError` on a GraphicFrame instance that does not contain an OLE object.

        An shape that contains an OLE object will have `.shape_type` of either
        `EMBEDDED_OLE_OBJECT` or `LINKED_OLE_OBJECT`.
        znot an OLE-object shape)r   Ú
has_oleobjr$   r0   ÚgraphicDataÚ_parentr'   r   r   r    Ú
ole_formatK   s   	zGraphicFrame.ole_formatr   c                 C  s   t dƒ‚)zÝUnconditionally raises |NotImplementedError|.

        Access to the shadow effect for graphic-frame objects is content-specific (i.e. different
        for charts, tables, etc.) and has not yet been implemented.
        z1shadow property on GraphicFrame not yet supported)ÚNotImplementedErrorr'   r   r   r    ÚshadowX   s   zGraphicFrame.shadowr   c                 C  sD   | j j}|tkrtjS |tkrtjS |tkr | j jrtj	S tj
S dS )ah  Optional member of `MSO_SHAPE_TYPE` identifying the type of this shape.

        Possible values are `MSO_SHAPE_TYPE.CHART`, `MSO_SHAPE_TYPE.TABLE`,
        `MSO_SHAPE_TYPE.EMBEDDED_OLE_OBJECT`, `MSO_SHAPE_TYPE.LINKED_OLE_OBJECT`.

        This value is `None` when none of these four types apply, for example when the shape
        contains SmartArt.
        N)r   r-   r   r   ÚCHARTr
   ÚTABLEr	   Úis_embedded_ole_objÚEMBEDDED_OLE_OBJECTÚLINKED_OLE_OBJECT)r   r-   r   r   r    Ú
shape_typea   s   
ÿÿýzGraphicFrame.shape_typer   c                 C  s$   | j stdƒ‚| jjjj}t|| ƒS )z‰The |Table| object contained in this graphic frame.

        Raises |ValueError| if this graphic frame does not contain a table.
        zshape does not contain a table)r/   r$   r   Úgraphicr2   Útblr   )r   r>   r   r   r    Útabley   s   
zGraphicFrame.table)r   r   r   r   )r"   r   )r"   r   )r"   r+   )r"   r0   )r"   r   )r"   r   )r"   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Úpropertyr&   r%   r#   r/   r4   r   r6   r<   r?   Ú__classcell__r   r   r   r    r      s&    	r   c                      sV   e Zd ZU dZded< d‡ fdd	„Zeddd„ƒZeddd„ƒZeddd„ƒZ	‡  Z
S )r0   z.Provides attributes on an embedded OLE object.r   r)   r2   r   r   r   c                   r   r   )r   r   Ú_graphicData)r   r2   r   r   r   r    r   Š   r!   z_OleFormat.__init__r"   úbytes | Nonec                 C  s"   | j j}|du r
dS | j |¡jS )z¢Optional bytes of OLE object, suitable for loading or saving as a file.

        This value is `None` if the embedded object does not represent a "file".
        N)rF   Úblob_rIdr)   r*   Úblob)r   rH   r   r   r    rI   Ž   s   z_OleFormat.blobú
str | Nonec                 C  ó   | j jS )a"  str "progId" attribute of this embedded OLE object.

        The progId is a str like "Excel.Sheet.12" that identifies the "file-type" of the embedded
        object, or perhaps more precisely, the application (aka. "server" in OLE parlance) to be
        used to open this object.
        )rF   ÚprogIdr'   r   r   r    Úprog_id™   s   z_OleFormat.prog_idúbool | Nonec                 C  rK   )zDTrue when OLE object should appear as an icon (rather than preview).)rF   Ú
showAsIconr'   r   r   r    Úshow_as_icon£   s   z_OleFormat.show_as_icon)r2   r   r   r   )r"   rG   )r"   rJ   )r"   rN   )r@   rA   rB   rC   Ú__annotations__r   rD   rI   rM   rP   rE   r   r   r   r    r0   …   s   
 
	r0   N)#rC   Ú
__future__r   Útypingr   r   Úpptx.enum.shapesr   Úpptx.shapes.baser   Úpptx.sharedr   Ú	pptx.specr   r	   r
   Z
pptx.tabler   Ú	pptx.utilr   Úpptx.chart.chartr   Úpptx.dml.effectr   Úpptx.oxml.shapes.graphfrmr   r   Úpptx.parts.chartr   Úpptx.parts.slider   Ú
pptx.typesr   r   r0   r   r   r   r    Ú<module>   s$    f