
    li                        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e	      Z! G d de      Z"y)zGraphic 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                       e Zd ZdZd fdZedd       Zedd       Zedd       Zedd       Z	edd       Z
edd       Zedd	       Zedd
       Z xZS )GraphicFramezContainer shape for table, chart, smart art, and media objects.

    Corresponds to a `p:graphicFrame` element in the shape tree.
    c                4    t         |   ||       || _        y N)super__init___graphicFrame)selfgraphicFrameparent	__class__s      R/var/www/html/eduruby.in/venv/lib/python3.12/site-packages/pptx/shapes/graphfrm.pyr   zGraphicFrame.__init__%   s    v.)    c                \    | j                   st        d      | j                  j                  S )zThe |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   s    r    r&   zGraphicFrame.chart)   s'     ~~=>>$$$r!   c                    | j                   j                  }|t        d      t        d| j                  j                  |            S )zBThe |ChartPart| object containing the chart in this graphic frame.z+this graphic frame does not contain a chartr   )r   	chart_rIdr$   r   partrelated_part)r   r)   s     r    r%   zGraphicFrame.chart_part3   sC     &&00	JKKK!7!7	!BCCr!   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'   s    r    r#   zGraphicFrame.has_chart;        !!115KKKr!   c                <    | j                   j                  t        k(  S )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'   s    r    	has_tablezGraphicFrame.has_tableC   r.   r!   c                    | 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$   
_OleFormatgraphicData_parentr'   s    r    
ole_formatzGraphicFrame.ole_formatK   s<     !!,,677$,,88$,,GGr!   c                    t        d      )zUnconditionally 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'   s    r    shadowzGraphicFrame.shadowX   s     ""UVVr!   c                   | j                   j                  }|t        k(  rt        j                  S |t
        k(  rt        j                  S |t        k(  r6| j                   j                  rt        j                  S t        j                  S y)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-   s     r    
shape_typezGraphicFrame.shape_typea   s~     ,,<<44!''' 66!''' 77 %%99 22 $55 r!   c                    | j                   st        d      | j                  j                  j                  j
                  }t        ||       S )zThe |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)r0   r$   r   graphicr4   tblr   )r   rC   s     r    tablezGraphicFrame.tabley   sA     ~~=>>  ((4488S$r!   )r   r   r   r   )returnr   )rE   r   )rE   bool)rE   r3   )rE   r   )rE   r   )rE   r   )__name__
__module____qualname____doc__r   propertyr&   r%   r#   r0   r6   r   r9   r@   rD   __classcell__r   s   @r    r   r      s    
* % % D D L L L L 
H 
H W W  .    r!   r   c                  f     e Zd ZU dZded<   d fdZed	d       Zed
d       Zedd       Z	 xZ
S )r3   z.Provides attributes on an embedded OLE object.r   r*   c                4    t         |   ||       || _        y r   )r   r   _graphicData)r   r4   r   r   s      r    r   z_OleFormat.__init__   s    f-'r!   c                ~    | j                   j                  }|y| j                  j                  |      j                  S )zOptional 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)rP   blob_rIdr*   r+   blob)r   rR   s     r    rS   z_OleFormat.blob   s9     $$--yy%%h/444r!   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.
        )rP   progIdr'   s    r    prog_idz_OleFormat.prog_id   s       '''r!   c                .    | j                   j                  S )zDTrue when OLE object should appear as an icon (rather than preview).)rP   
showAsIconr'   s    r    show_as_iconz_OleFormat.show_as_icon   s       +++r!   )r4   r   r   r   )rE   zbytes | None)rE   z
str | None)rE   zbool | None)rG   rH   rI   rJ   __annotations__r   rK   rS   rV   rY   rL   rM   s   @r    r3   r3      sM    8
( 5 5 ( ( , ,r!   r3   N)#rJ   
__future__r   typingr   r   pptx.enum.shapesr   pptx.shapes.baser   pptx.sharedr   	pptx.specr	   r
   r   
pptx.tabler   	pptx.utilr   pptx.chart.chartr   pptx.dml.effectr   pptx.oxml.shapes.graphfrmr   r   pptx.parts.chartr   pptx.parts.slider   
pptx.typesr   r   r3    r!   r    <module>rj      s^    # & + & , 
  "&,Y*.'c 9 c L!,% !,r!   