
    li%,                       d Z ddlmZ ddlmZmZ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mZmZmZmZmZ erdd	lmZ  G d
 de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z  G d de      Z! G d de      Z" G d de      Z# G d de      Z$ G d de      Z% G d  d!e      Z& G d" d#e      Z' G d$ d%e      Z(y&)'zBSlide-related custom element classes, including those for masters.    )annotations)TYPE_CHECKINGCallablecast)parse_from_template	parse_xml)CT_GradientFillPropertiesnsdecls)	XsdString)BaseOxmlElementChoiceOneAndOnlyOneOptionalAttributeRequiredAttribute
ZeroOrMore	ZeroOrOneZeroOrOneChoice)CT_GroupShapec                  .    e Zd ZU dZded<   edd       Zy)_BaseSlideElementz=Base class for the six slide types, providing common methods.CT_CommonSlideDatacSldc                .    | j                   j                  S )z-Return required `p:cSld/p:spTree` grandchild.)r   spTreeselfs    M/var/www/html/eduruby.in/venv/lib/python3.12/site-packages/pptx/oxml/slide.pyr   z_BaseSlideElement.spTree   s     yy    N)returnr   )__name__
__module____qualname____doc____annotations__propertyr    r   r   r   r      s    G
   r   r   c                  Z    e Zd ZU dZded<   dZ edd      Zded	<    ed
d      Z[d Z	y)CT_Backgroundz`p:bg` element.z)Callable[[CT_BackgroundProperties], None]_insert_bgPr)p:bgPrp:bgRefr+   r'   
successorszCT_BackgroundProperties | NonebgPrr,   c                x    dt        dd      z  }t        t        t        |            }| j	                  |       |S )z5Return a new `p:bgPr` element with noFill properties.z4<p:bgPr %s>
  <a:noFill/>
  <a:effectLst/>
</p:bgPr>ap)r   r   CT_BackgroundPropertiesr   r*   )r   xmlr/   s      r   add_noFill_bgPrzCT_Background.add_noFill_bgPr3   s:    PSZ[^`cSdd+Ys^<$r   N)
r!   r"   r#   r$   r%   _tag_seqr   r/   bgRefr5   r'   r   r   r)   r)   %   s?    ;; %H+4R,D
(  iB/Er   r)   c            
          e Zd ZdZdZ e ed       ed       ed       ed       ed       ed      fed	d
       Z[d Zy
)r3   z`p:bgPr` element.)	a:noFilla:solidFill
a:gradFill
a:blipFill
a:pattFill	a:grpFillza:effectLstza:effectDagza:extLstr9   r:   r;   r<   r=   r>      Nr-   c                *    t        j                         S )z1Override default to add default gradient subtree.)r	   new_gradFillr   s    r   _new_gradFillz%CT_BackgroundProperties._new_gradFillV   s    (5577r   )	r!   r"   r#   r$   r6   r   r   eg_fillPropertiesrB   r'   r   r   r3   r3   ;   sc    
H (:=!< < < ;	
 AB<
 	8r   r3   c                      e Zd ZU dZded<   ded<   dZ ededd	 
      Zded<    ed      Z	ded<   [ e
ded      Zded<   ddZddZy	)r   z`p:cSld` element.zCallable[[], None]
_remove_bgzCallable[[], CT_Background]get_or_add_bg)p:bgp:spTreezp:custDataLstz
p:controlsp:extLstrG      Nr-   zCT_Background | NonebgrH   r   r   name )defaultstrc                    | j                   }||j                  | j                         }t        t        |j                        S )zReturn `p:bg/p:bgPr` grandchild.

        If no such grandchild is present, any existing `p:bg` child is first removed and a new
        default `p:bg` with noFill settings is added.
        )rK   r/   _change_to_noFill_bgr   r3   r   rK   s     r   get_or_add_bgPrz"CT_CommonSlideData.get_or_add_bgPrk   s:     WW:**,B+RWW55r   c                f    | j                          | j                         }|j                          |S )zmEstablish a `p:bg` child with no-fill settings.

        Any existing `p:bg` child is first removed.
        )rE   rF   r5   rR   s     r   rQ   z'CT_CommonSlideData._change_to_noFill_bgv   s-    
 	!
	r   )r    r3   )r    r)   )r!   r"   r#   r$   r%   r6   r   rK   r   r   r   r   rL   rS   rQ   r'   r   r   r   r   [   si    ""..NH(8AB< B  **5FM5!	2D# 	6r   r   c                  D    e Zd ZU dZdZ ed      Zded<   [edd       Z	y)	CT_NotesMasterz5`p:notesMaster` element, root of a notes master part.)p:cSldp:clrMapp:hfzp:notesStylerI   rW   r   r   c                4    t        t        t        d            S )zLReturn a new `p:notesMaster` element based on the built-in default template.notesMaster)r   rV   r   clss    r   new_defaultzCT_NotesMaster.new_default   s     N$7$FGGr   N)r    rV   )
r!   r"   r#   r$   r6   r   r   r%   classmethodr^   r'   r   r   rV   rV      s1    ?IH,X6D
6H Hr   rV   c                  D    e Zd ZU dZdZ ed      Zded<   [edd       Z	y)	CT_NotesSlidez.`p:notes` element, root of a notes slide part.)rW   p:clrMapOvrrI   rW   r   r   c                4    t        t        t        d            S )zReturn a new ``<p:notes>`` element based on the default template.

        Note that the template does not include placeholders, which must be subsequently cloned
        from the notes master.
        notes)r   ra   r   r\   s    r   newzCT_NotesSlide.new   s     M#6w#?@@r   N)r    ra   )
r!   r"   r#   r$   r6   r   r   r%   r_   re   r'   r   r   ra   ra      s1    84H,X6D
6A Ar   ra   c                      e Zd ZU dZdZ ed      Zded<    ededd 	      Z	 ed
edd 	      Z
[edd       Zed        Zd Zd Zed        Zed        Zed        Zy)CT_Slidez=`p:sld` element, root element of a slide part (XML document).)rW   rb   p:transitionp:timingrI   rW   r   r   rb      Nr-   ri      c                P    t        t        t        | j                                     S )z:Return new `p:sld` element configured as base slide shape.)r   rg   r   _sld_xmlr\   s    r   re   zCT_Slide.new   s     Hi788r   c                .    | j                   j                  S )z0Return `p:bg` grandchild or None if not present.)r   rK   r   s    r   rK   zCT_Slide.bg   s     yy||r   c                B    | j                   }|| j                         }|S )a  Return parent element for a new `p:video` child element.

        The `p:video` element causes play controls to appear under a video
        shape (pic shape containing video). There can be more than one video
        shape on a slide, which causes the precondition to vary. It needs to
        handle the case when there is no `p:sld/p:timing` element and when
        that element already exists. If the case isn't simple, it just nukes
        what's there and adds a fresh one. This could theoretically remove
        desired existing timing information, but there isn't any evidence
        available to me one way or the other, so I've taken the simple
        approach.
        )_childTnLst_add_childTnLst)r   
childTnLsts     r   get_or_add_childTnLstzCT_Slide.get_or_add_childTnLst   s)     %%
--/Jr   c                    | j                  | j                                t        | j                               }| j	                  |       |j                  d      d   S )zAdd `./p:timing/p:tnLst/p:par/p:cTn/p:childTnLst` descendant.

        Any existing `p:timing` child element is ruthlessly removed and
        replaced.
        z"./p:tnLst/p:par/p:cTn/p:childTnLstr   )removeget_or_add_timingr   _childTnLst_timing_xml_insert_timingxpath)r   timings     r   rq   zCT_Slide._add_childTnLst   sO     	D**,-46689F#||@A!DDr   c                4    | j                  d      }|sy|d   S )z~Return `./p:timing/p:tnLst/p:par/p:cTn/p:childTnLst` descendant.

        Return None if that element is not present.
        z+./p:timing/p:tnLst/p:par/p:cTn/p:childTnLstNr   )ry   )r   childTnLstss     r   rp   zCT_Slide._childTnLst   s#     jj!NO1~r   c                     dt        d      z  S )Nz<p:timing %s>
  <p:tnLst>
    <p:par>
      <p:cTn id="1" dur="indefinite" restart="never" nodeType="tmRoot">
        <p:childTnLst/>
      </p:cTn>
    </p:par>
  </p:tnLst>
</p:timing>r2   r
   r'   r   r   rw   zCT_Slide._childTnLst_timing_xml   s    	 $CL	)	
r   c                 "    dt        ddd      z  S )Na  <p:sld %s>
  <p:cSld>
    <p:spTree>
      <p:nvGrpSpPr>
        <p:cNvPr id="1" name=""/>
        <p:cNvGrpSpPr/>
        <p:nvPr/>
      </p:nvGrpSpPr>
      <p:grpSpPr/>
    </p:spTree>
  </p:cSld>
  <p:clrMapOvr>
    <a:masterClrMapping/>
  </p:clrMapOvr>
</p:sld>r1   r2   rr
   r'   r   r   rm   zCT_Slide._sld_xml   s     !c3/0	
r   )r    rg   )r!   r"   r#   r$   r6   r   r   r%   r   	clrMapOvrrz   r_   re   r&   rK   rs   rq   rp   staticmethodrw   rm   r'   r   r   rg   rg      s    GPH,X6D
6-HQRLAIzhqrl;F9 9  $	E   
 
 
 
r   rg   c                  2    e Zd ZU dZdZ ed      Zded<   [y)CT_SlideLayoutz3`p:sldLayout` element, root of a slide layout part.)rW   rb   rh   ri   rY   rI   rW   r   r   N)r!   r"   r#   r$   r6   r   r   r%   r'   r   r   r   r      s    =XH,X6D
6r   r   c                  ,    e Zd ZU dZded<    ed      Zy)CT_SlideLayoutIdListz`p:sldLayoutIdLst` element, child of `p:sldMaster`.

    Contains references to the slide layouts that inherit from the slide master.
    zlist[CT_SlideLayoutIdListEntry]sldLayoutId_lstzp:sldLayoutIdN)r!   r"   r#   r$   r%   r   sldLayoutIdr'   r   r   r   r     s    
 54_-Kr   r   c                  .    e Zd ZU dZ ede      Zded<   y)CT_SlideLayoutIdListEntryzg`p:sldLayoutId` element, child of `p:sldLayoutIdLst`.

    Contains a reference to a slide layout.
    zr:idrO   rIdN)r!   r"   r#   r$   r   r   r   r%   r'   r   r   r   r     s    
 !3C3r   r   c                  `    e Zd ZU dZded<   dZ ed      Zded<    eded	d
       Z	ded<   [y
)CT_SlideMasterz3`p:sldMaster` element, root of a slide master part.z"Callable[[], CT_SlideLayoutIdList]get_or_add_sldLayoutIdLst)rW   rX   p:sldLayoutIdLstrh   ri   rY   z
p:txStylesrI   rW   r   r   r      Nr-   r   sldLayoutIdLst)
r!   r"   r#   r$   r%   r6   r   r   r   r   r'   r   r   r   r     sF    =AA	H  -X6D
6+4x|,N(  	r   r   c                  0    e Zd ZdZdZ ededd       Z[y)CT_SlideTimingz>`p:timing` element, specifying animations and timed behaviors.)p:tnLstzp:bldLstrI   r   rJ   Nr-   )r!   r"   r#   r$   r6   r   tnLstr'   r   r   r   r   0  s    H2HiHQRL9Er   r   c                  &    e Zd ZdZd Zed        Zy)CT_TimeNodeListz%`p:tnLst` or `p:childTnList` element.c                r    dt        d      | j                  |fz  }t        |      }| j                  |       y)z>Add a new `p:video` child element for movie having *shape_id*.a  <p:video %s>
  <p:cMediaNode vol="80000">
    <p:cTn id="%d" fill="hold" display="0">
      <p:stCondLst>
        <p:cond delay="indefinite"/>
      </p:stCondLst>
    </p:cTn>
    <p:tgtEl>
      <p:spTgt spid="%d"/>
    </p:tgtEl>
  </p:cMediaNode>
</p:video>
r2   N)r   _next_cTn_idr   append)r   shape_id	video_xmlvideos       r   	add_videozCT_TimeNodeList.add_video;  s@     &clD,=,=xHI 	 )$Er   c                z    | j                  d      }|D cg c]  }t        |       }}t        |      dz   S c c}w )z<Return the next available unique ID (int) for p:cTn element.z/p:sld/p:timing//p:cTn/@idrJ   )ry   intmax)r   cTn_id_strsid_stridss       r   r   zCT_TimeNodeList._next_cTn_idN  s=     jj!=>)45vs6{553x!| 6s   8N)r!   r"   r#   r$   r   r&   r   r'   r   r   r   r   8  s    /&  r   r   c                  &    e Zd ZdZdZ ed      Z[y)CT_TLMediaNodeVideoz2`p:video` element, specifying video media details.)p:cMediaNoder   N)r!   r"   r#   r$   r6   r   
cMediaNoder'   r   r   r   r   V  s    < H~.Jr   r   N))r$   
__future__r   typingr   r   r   	pptx.oxmlr   r   pptx.oxml.dml.fillr	   pptx.oxml.nsr   pptx.oxml.simpletypesr   pptx.oxml.xmlchemyr   r   r   r   r   r   r   r   pptx.oxml.shapes.groupshaper   r   r)   r3   r   rV   ra   rg   r   r   r   r   r   r   r   r'   r   r   <module>r      s    H " 0 0 4 8   +	 	 	 9   O ,8o 8@# #L
H& 
HA% A"\
  \
~& .? .4 4& ,_ o </ r   