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 erPd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 ddlmZ G dd„ deƒZG dd„ deƒZdS )z-Base shape-related objects such as BaseShape.é    )Úannotations)ÚTYPE_CHECKINGÚcast)ÚActionSetting)ÚShadowFormat)ÚElementProxy)Úlazyproperty)ÚMSO_SHAPE_TYPEÚPP_PLACEHOLDER)ÚShapeElement)ÚCT_Placeholder)ÚBaseSlidePart)ÚProvidesPart)ÚLengthc                      s„  e Zd ZdZdB‡ fdd„ZdCdd„ZdCdd„ZedDdd„ƒZe	dEdd„ƒZ
e	dFdd„ƒZe	dFdd„ƒZe	dFdd„ƒZe	dGdd„ƒZejdHdd„ƒZe	dFd d!„ƒZe	dGd"d#„ƒZejdHd$d#„ƒZe	dId&d'„ƒZejdJd(d'„ƒZe	dKd*d+„ƒZe	dLd-d.„ƒZe	dMd0d1„ƒZejdNd2d1„ƒZedOd4d5„ƒZe	dPd7d8„ƒZe	dQd:d;„ƒZe	dGd<d=„ƒZejdHd>d=„ƒZe	dGd?d@„ƒZejdHdAd@„ƒZ‡  ZS )RÚ	BaseShapezbBase class for shape objects.

    Subclasses include |Shape|, |Picture|, and |GraphicFrame|.
    Ú	shape_elmr   Úparentr   c                   s   t ƒ  ¡  || _|| _d S ©N)ÚsuperÚ__init__Ú_elementÚ_parent)Úselfr   r   ©Ú	__class__© úX/var/www/html/figdemos/bartoux_crm/venv/lib/python3.10/site-packages/pptx/shapes/base.pyr      s   

zBaseShape.__init__ÚotherÚobjectÚreturnÚboolc                 C  s   t |tƒsdS | j|ju S )zÞ|True| if this shape object proxies the same element as *other*.

        Equality for proxy objects is defined as referring to the same XML element, whether or not
        they are the same proxy object instance.
        F©Ú
isinstancer   r   ©r   r   r   r   r   Ú__eq__    s   
zBaseShape.__eq__c                 C  s   t |tƒsdS | j|juS )NTr!   r#   r   r   r   Ú__ne__*   s   
zBaseShape.__ne__r   c                 C  s   | j jj}t|| ƒS )a§  |ActionSetting| instance providing access to click behaviors.

        Click behaviors are hyperlink-like behaviors including jumping to a hyperlink (web page)
        or to another slide in the presentation. The click action is that defined on the overall
        shape, not a run of text within the shape. An |ActionSetting| object is always returned,
        even when no click behavior is defined on the shape.
        )r   Ú_nvXxPrÚcNvPrr   )r   r'   r   r   r   Úclick_action/   s   
	
zBaseShape.click_actionc                 C  ó   | j S )zþ`lxml` element for this shape, e.g. a CT_Shape instance.

        Note that manipulating this element improperly can produce an invalid presentation file.
        Make sure you know what you're doing if you use this to change the underlying XML.
        )r   ©r   r   r   r   Úelement;   s   zBaseShape.elementc                 C  ó   dS )z¼|True| if this shape is a graphic frame containing a chart object.

        |False| otherwise. When |True|, the chart object can be accessed using the ``.chart``
        property.
        Fr   r*   r   r   r   Ú	has_chartD   ó   	zBaseShape.has_chartc                 C  r,   )z¼|True| if this shape is a graphic frame containing a table object.

        |False| otherwise. When |True|, the table object can be accessed using the ``.table``
        property.
        Fr   r*   r   r   r   Ú	has_tableO   r.   zBaseShape.has_tablec                 C  r,   )z&|True| if this shape can contain text.Fr   r*   r   r   r   Úhas_text_frameZ   s   zBaseShape.has_text_framer   c                 C  ó   | j jS )zMRead/write. Integer distance between top and bottom extents of shape in EMUs.©r   Úcyr*   r   r   r   Úheight`   ó   zBaseShape.heightÚvaluec                 C  ó   || j _d S r   r2   ©r   r6   r   r   r   r4   e   ó   c                 C  r1   )zkTrue if this shape is a placeholder.

        A shape is a placeholder if it has a <p:ph> element.
        )r   Ú
has_ph_elmr*   r   r   r   Úis_placeholderi   ó   zBaseShape.is_placeholderc                 C  r1   )z–Integer distance of the left edge of this shape from the left edge of the slide.

        Read/write. Expressed in English Metric Units (EMU)
        ©r   Úxr*   r   r   r   Úleftq   r<   zBaseShape.leftc                 C  r7   r   r=   r8   r   r   r   r?   y   r9   Ústrc                 C  r1   )z%Name of this shape, e.g. 'Picture 7'.)r   Ú
shape_namer*   r   r   r   Úname}   r5   zBaseShape.namec                 C  s   || j jj_d S r   )r   r&   r'   rB   r8   r   r   r   rB   ‚   s   r   c                 C  s   t d| jjƒS )zÐThe package part containing this shape.

        A |BaseSlidePart| subclass in this case. Access to a slide part should only be required if
        you are extending the behavior of |pp| API objects.
        r   )r   r   Úpartr*   r   r   r   rC   †   s   zBaseShape.partÚ_PlaceholderFormatc                 C  s    | j j}|du rtdƒ‚t|ƒS )zŸProvides access to placeholder-specific properties such as placeholder type.

        Raises |ValueError| on access if the shape is not a placeholder.
        Nzshape is not a placeholder)r   ÚphÚ
ValueErrorrD   )r   rE   r   r   r   Úplaceholder_format   s   zBaseShape.placeholder_formatÚfloatc                 C  r1   )zÅDegrees of clockwise rotation.

        Read/write float. Negative values can be assigned to indicate counter-clockwise rotation,
        e.g. assigning -45.0 will change setting to 315.0.
        ©r   Úrotr*   r   r   r   Úrotationš   s   zBaseShape.rotationc                 C  r7   r   rI   r8   r   r   r   rK   £   r9   r   c                 C  s   t | jjƒS )zî|ShadowFormat| object providing access to shadow for this shape.

        A |ShadowFormat| object is always returned, even when no shadow is
        explicitly defined on this shape (i.e. it inherits its shadow
        behavior).
        )r   r   ÚspPrr*   r   r   r   Úshadow§   s   zBaseShape.shadowÚintc                 C  r1   )z}Read-only positive integer identifying this shape.

        The id of a shape is unique among all shapes on a slide.
        )r   Úshape_idr*   r   r   r   rO   ±   r<   zBaseShape.shape_idr	   c                 C  s   t t| ƒj› dƒ‚)zŽA member of MSO_SHAPE_TYPE classifying this shape by type.

        Like ``MSO_SHAPE_TYPE.CHART``. Must be implemented by subclasses.
        z! does not implement `.shape_type`)ÚNotImplementedErrorÚtypeÚ__name__r*   r   r   r   Ú
shape_type¹   s   zBaseShape.shape_typec                 C  r1   )zŒDistance from the top edge of the slide to the top edge of this shape.

        Read/write. Expressed in English Metric Units (EMU)
        ©r   Úyr*   r   r   r   ÚtopÁ   r<   zBaseShape.topc                 C  r7   r   rT   r8   r   r   r   rV   É   r9   c                 C  r1   )z}Distance between left and right extents of this shape.

        Read/write. Expressed in English Metric Units (EMU).
        ©r   Úcxr*   r   r   r   ÚwidthÍ   r<   zBaseShape.widthc                 C  r7   r   rW   r8   r   r   r   rY   Õ   r9   )r   r   r   r   )r   r   r   r    )r   r   )r   r   )r   r    )r   r   )r6   r   )r   r@   )r6   r@   )r   r   )r   rD   )r   rH   )r6   rH   )r   r   ©r   rN   )r   r	   )rR   Ú
__module__Ú__qualname__Ú__doc__r   r$   r%   r   r(   Úpropertyr+   r-   r/   r0   r4   Úsetterr;   r?   rB   rC   rG   rK   rM   rO   rS   rV   rY   Ú__classcell__r   r   r   r   r      sf    





	r   c                      sL   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‡  Z	S )rD   z®Provides properties specific to placeholders, such as the placeholder type.

    Accessed via the :attr:`~.BaseShape.placeholder_format` property of a placeholder shape,
    r+   r   c                   s   t ƒ  |¡ || _d S r   )r   r   Ú_ph)r   r+   r   r   r   r   à   s   
z_PlaceholderFormat.__init__r   c                 C  r)   )z*The `p:ph` element proxied by this object.)ra   r*   r   r   r   r+   ä   s   z_PlaceholderFormat.elementrN   c                 C  r1   )z$Integer placeholder 'idx' attribute.)ra   Úidxr*   r   r   r   rb   é   r5   z_PlaceholderFormat.idxr
   c                 C  r1   )zsPlaceholder type.

        A member of the :ref:`PpPlaceholderType` enumeration, e.g. PP_PLACEHOLDER.CHART
        )ra   rQ   r*   r   r   r   rQ   î   r<   z_PlaceholderFormat.type)r+   r   )r   r   rZ   )r   r
   )
rR   r[   r\   r]   r   r^   r+   rb   rQ   r`   r   r   r   r   rD   Ú   s    rD   N)r]   Ú
__future__r   Útypingr   r   Zpptx.actionr   Zpptx.dml.effectr   Úpptx.sharedr   Ú	pptx.utilr   Úpptx.enum.shapesr	   r
   Úpptx.oxml.shapesr   Úpptx.oxml.shapes.sharedr   Úpptx.parts.slider   Ú
pptx.typesr   r   r   r   rD   r   r   r   r   Ú<module>   s"     F