
    ,h'                        d Z ddlmZ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  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.    )absolute_importdivisionprint_functionunicode_literals)parse_from_template	parse_xml)CT_GradientFillPropertiesnsdecls)	XsdString)BaseOxmlElementChoiceOneAndOnlyOneOptionalAttributeRequiredAttribute
ZeroOrMore	ZeroOrOneZeroOrOneChoicec                        e Zd ZdZed        Zy)_BaseSlideElementzG
    Base class for the six slide types, providing common methods.
    c                 .    | j                   j                  S )z?
        Return required `p:cSld/p:spTree` grandchild.
        )cSldspTreeselfs    Q/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/pptx/oxml/slide.pyr   z_BaseSlideElement.spTree   s    
 yy    N)__name__
__module____qualname____doc__propertyr    r   r   r   r      s        r   r   c                   D    e Zd ZdZdZ edd      Z edd      Z[d Zy)	CT_Backgroundz`p:bg` element.)p:bgPrp:bgRefr&   r#   
successorsr'   c                 \    dt        dd      z  }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   _insert_bgPr)r   xmlbgPrs      r   add_noFill_bgPrzCT_Background.add_noFill_bgPr.   s;     "#s+, 	 ~$r   N)	r   r   r    r!   _tag_seqr   r/   bgRefr0   r#   r   r   r%   r%   $   s,     %HX"-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
)CT_BackgroundPropertiesz`p:bgPr` element.)	a:noFilla:solidFill
a:gradFill
a:blipFill
a:pattFill	a:grpFillza:effectLstza:effectDagza:extLstr5   r6   r7   r8   r9   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!   r1   r   r   eg_fillPropertiesr>   r#   r   r   r4   r4   ;   sc    
H (:=!< < < ;	
 AB<
 	8r   r4   c                   b    e Zd ZdZdZ ededd       Z ed      Z[ e	de
d	
      Zd Zd Zy)CT_CommonSlideDataz`p:cSld` element.)p:bgp:spTreezp:custDataLstz
p:controlsp:extLstrB      Nr(   rC   name )defaultc                     | j                   }||j                  | j                          | j                   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.
        )bgr/   _change_to_noFill_bgr   rJ   s     r   get_or_add_bgPrz"CT_CommonSlideData.get_or_add_bgPrd   s4     WW:%%'ww||r   c                 f    | j                          | j                         }|j                          |S )zmEstablish a `p:bg` child with no-fill settings.

        Any existing `p:bg` child is first removed.
        )
_remove_bgget_or_add_bgr0   rL   s     r   rK   z'CT_CommonSlideData._change_to_noFill_bgo   s-    
 	!
	r   )r   r   r    r!   r1   r   rJ   r   r   r   r   rF   rM   rK   r#   r   r   rA   rA   [   sA    NH	6hqrl	3B:&FVY;D	r   rA   c                   6    e Zd ZdZdZ ed      Z[ed        Zy)CT_NotesMasterzB
    ``<p:notesMaster>`` element, root of a notes master part
    )p:cSldp:clrMapp:hfzp:notesStylerD   rS   c                     t        d      S )zj
        Return a new ``<p:notesMaster>`` element based on the built-in
        default template.
        notesMasterr   clss    r   new_defaultzCT_NotesMaster.new_default   s     #=11r   N)	r   r   r    r!   r1   r   r   classmethodr[   r#   r   r   rR   rR   z   s.     JH"D2 2r   rR   c                   6    e Zd ZdZdZ ed      Z[ed        Zy)CT_NotesSlidez;
    ``<p:notes>`` element, root of a notes slide part
    )rS   p:clrMapOvrrD   rS   c                     t        d      S )z
        Return 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.
        notesrX   rY   s    r   newzCT_NotesSlide.new   s     #7++r   N)	r   r   r    r!   r1   r   r   r\   rb   r#   r   r   r^   r^      s-     5H"D, ,r   r^   c                       e Zd ZdZdZ ed      Z ededd       Z eded	d       Z	[e
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).)rS   r_   p:transitionp:timingrD   rS   r_      Nr(   rf      c                 4    t        | j                               S )z:Return new `p:sld` element configured as base slide shape.)r   _sld_xmlrY   s    r   rb   zCT_Slide.new   s     ((r   c                 .    | j                   j                  S )z0Return `p:bg` grandchild or None if not present.)r   rJ   r   s    r   rJ   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   rn   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   )rv   )r   childTnLstss     r   rm   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>r,   r
   r#   r   r   rt   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>r+   r,   rr
   r#   r   r   rj   zCT_Slide._sld_xml   s     !c3/0	
r   )r   r   r    r!   r1   r   r   r   	clrMapOvrrw   r\   rb   r"   rJ   rp   rn   rm   staticmethodrt   rj   r#   r   r   rd   rd      s    GPH"D-HQRLAIzhqrl;F) )  $	E   
 
 
 
r   rd   c                   &    e Zd ZdZdZ ed      Z[y)CT_SlideLayoutz@
    ``<p:sldLayout>`` element, root of a slide layout part
    )rS   r_   re   rf   rU   rD   rS   N)r   r   r    r!   r1   r   r   r#   r   r   r   r      s     YH"Dr   r   c                        e Zd ZdZ ed      Zy)CT_SlideLayoutIdListz
    ``<p:sldLayoutIdLst>`` element, child of ``<p:sldMaster>`` containing
    references to the slide layouts that inherit from the slide master.
    zp:sldLayoutIdN)r   r   r    r!   r   sldLayoutIdr#   r   r   r   r     s    
 _-Kr   r   c                   "    e Zd ZdZ ede      Zy)CT_SlideLayoutIdListEntryzt
    ``<p:sldLayoutId>`` element, child of ``<p:sldLayoutIdLst>`` containing
    a reference to a slide layout.
    zr:idN)r   r   r    r!   r   r   rIdr#   r   r   r   r     s    
 FI
.Cr   r   c                   @    e Zd ZdZdZ ed      Z ededd       Z[y)CT_SlideMasterz@
    ``<p:sldMaster>`` element, root of a slide master part
    )rS   rT   p:sldLayoutIdLstre   rf   rU   z
p:txStylesrD   rS   r      Nr(   )	r   r   r    r!   r1   r   r   r   sldLayoutIdLstr#   r   r   r   r     s0    	H "D1hqrlKN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:bldLstrD   r   rE   Nr(   )r   r   r    r!   r1   r   tnLstr#   r   r   r   r   .  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>
r,   N)r   _next_cTn_idr   append)r   shape_id	video_xmlvideos       r   	add_videozCT_TimeNodeList.add_video9  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/@idrE   )rv   intmax)r   cTn_id_strsid_stridss       r   r   zCT_TimeNodeList._next_cTn_idL  s=     jj!=>)45vs6{553x!| 6s   8N)r   r   r    r!   r   r"   r   r#   r   r   r   r   6  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!   r1   r   
cMediaNoder#   r   r   r   r   T  s    < H~.Jr   r   N)&r!   
__future__r   r   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   r   r%   r4   rA   rR   r^   rd   r   r   r   r   r   r   r   r#   r   r   <module>r      s    I R R 4 8   +	 	 	
  
 O .8o 8@ >2& 2$,% ,&\
  \
~& .? ./ /& (_ o </ r   