o
    j                     @  s   d Z ddlmZ ddlmZmZmZ ddlmZm	Z	m
Z
 ddlmZmZmZmZ er0d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G dd deZG dd deZdS )z=Custom element classes for presentation-related XML elements.    )annotations)TYPE_CHECKINGCallablecast)
ST_SlideIdST_SlideSizeCoordinate	XsdString)BaseOxmlElementRequiredAttribute
ZeroOrMore	ZeroOrOne)Lengthc                   @  sf   e Zd ZU dZded< ded< ded< edd	d
Zded< eddd
Zded< eddd
Zded< dS )CT_PresentationzZ`p:presentation` element, root of the Presentation part stored as `/ppt/presentation.xml`.zCallable[[], CT_SlideSize]get_or_add_sldSzzCallable[[], CT_SlideIdList]get_or_add_sldIdLstz"Callable[[], CT_SlideMasterIdList]get_or_add_sldMasterIdLstzp:sldMasterIdLst)zp:notesMasterIdLstzp:handoutMasterIdLst
p:sldIdLstp:sldSz	p:notesSz)
successorszCT_SlideMasterIdList | NonesldMasterIdLstr   )r   r   zCT_SlideIdList | NonesldIdLstr   )r   zCT_SlideSize | NonesldSzN)	__name__
__module____qualname____doc____annotations__r   r   r   r    r   r   V/home/air/Certificate/back/venv/lib/python3.10/site-packages/pptx/oxml/presentation.pyr      s    
 
r   c                   @  s6   e Zd ZU dZedeZded< edeZ	ded< dS )
CT_SlideIdzz`p:sldId` element.

    Direct child of `p:sldIdLst` that contains an `rId` reference to a slide in the presentation.
    idintr:idstrrIdN)
r   r   r   r   r
   r   r!   r   r   r%   r   r   r   r   r    )   s   
 r    c                   @  sB   e Zd ZU dZded< ded< edZdddZedddZ	dS )CT_SlideIdListz}`p:sldIdLst` element.

    Direct child of <p:presentation> that contains a list of the slide parts in the presentation.
    zlist[CT_SlideId]	sldId_lstzCallable[..., CT_SlideId]
_add_sldIdzp:sldIdr%   r$   returnr    c                 C  s   | j | j|dS )zCreate and return a reference to a new `p:sldId` child element.

        The new `p:sldId` element has its r:id attribute set to `rId`.
        )r!   r%   )r(   _next_id)selfr%   r   r   r   	add_sldId>   s   zCT_SlideIdList.add_sldIdr"   c                   s~   dd dd t d| dD }td g| d }| kr"|S t fdd	|D }|r=td
d	 t|dD S dS )zThe next available slide ID as an `int`.

        Valid slide IDs start at 256. The next integer value greater than the max value in use is
        chosen, which minimizes that chance of reusing the id of a deleted slide.
           ic                 S  s   g | ]}t |qS r   )r"   ).0sr   r   r   
<listcomp>O   s    z+CT_SlideIdList._next_id.<locals>.<listcomp>z	list[str]z./p:sldId/@id   c                 3  s,    | ]}|  kr krn n|V  qd S Nr   )r.   r!   MAX_SLIDE_IDMIN_SLIDE_IDr   r   	<genexpr>U   s   * z*CT_SlideIdList._next_id.<locals>.<genexpr>c                 s  s     | ]\}}||kr|V  qd S r2   r   )r.   candidate_idused_idr   r   r   r6   W   s    )start)r   xpathmaxsortednext	enumerate)r+   used_idssimple_nextvalid_used_idsr   r3   r   r*   E   s   

zCT_SlideIdList._next_idN)r%   r$   r)   r    )r)   r"   )
r   r   r   r   r   r   sldIdr,   propertyr*   r   r   r   r   r&   3   s   
 
r&   c                   @  s"   e Zd ZU dZded< edZdS )CT_SlideMasterIdListz`p:sldMasterIdLst` element.

    Child of `p:presentation` containing references to the slide masters that belong to the
    presentation.
    zlist[CT_SlideMasterIdListEntry]sldMasterId_lstzp:sldMasterIdN)r   r   r   r   r   r   sldMasterIdr   r   r   r   rD   a   s   
 rD   c                   @  s$   e Zd ZU dZedeZded< dS )CT_SlideMasterIdListEntryzt
    ``<p:sldMasterId>`` element, child of ``<p:sldMasterIdLst>`` containing
    a reference to a slide master.
    r#   r$   r%   N)r   r   r   r   r
   r   r%   r   r   r   r   r   rG   m   s   
 rG   c                   @  s6   e Zd ZU dZedeZded< edeZded< dS )CT_SlideSizez`p:sldSz` element.

    Direct child of <p:presentation> that contains the width and height of slides in the
    presentation.
    cxr   cyN)	r   r   r   r   r
   r   rI   r   rJ   r   r   r   r   rH   v   s   
 rH   N)r   
__future__r   typingr   r   r   pptx.oxml.simpletypesr   r   r   pptx.oxml.xmlchemyr	   r
   r   r   	pptx.utilr   r   r    r&   rD   rG   rH   r   r   r   r   <module>   s    
.	