
    ,hE                     Z   d 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 ddlmZmZmZ 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y)z=Slide-related objects, including masters, layouts, and notes.    )
FillFormat)PP_PLACEHOLDER)LayoutPlaceholdersLayoutShapesMasterPlaceholdersMasterShapesNotesSlidePlaceholdersNotesSlideShapesSlidePlaceholdersSlideShapes)ElementProxyParentedElementProxyPartElementProxy)lazypropertyc                   T    e Zd ZdZed        Zed        Zej                  d        Zy)
_BaseSlidezCBase class for slide objects, including masters, layouts and notes.c                 @    t        | j                  j                        S )a8  |_Background| object providing slide background properties.

        This property returns a |_Background| object whether or not the
        slide, master, or layout has an explicitly defined background.

        The same |_Background| object is returned on every call for the same
        slide object.
        )_Background_elementcSldselfs    L/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/pptx/slide.py
backgroundz_BaseSlide.background   s     4==--..    c                 B    | j                   j                  j                  S )z
        String representing the internal name of this slide. Returns an empty
        string (`''`) if no name is assigned. Assigning an empty string or
        |None| to this property causes any name to be removed.
        r   r   namer   s    r   r   z_BaseSlide.name$   s     }}!!&&&r   c                 F    |dn|}|| j                   j                  _        y )N r   )r   value	new_values      r   r   z_BaseSlide.name-   s    -BU	"+r   N)	__name__
__module____qualname____doc__r   r   propertyr   setter r   r   r   r      sC    M	/ 	/ ' ' 
[[, ,r   r   c                   0    e Zd ZdZed        Zed        Zy)_BaseMasterz
    Base class for master objects such as |SlideMaster| and |NotesMaster|.
    Provides access to placeholders and regular shapes.
    c                 B    t        | j                  j                  |       S )z
        Instance of |MasterPlaceholders| containing sequence of placeholder
        shapes in this master, sorted in *idx* order.
        )r   r   spTreer   s    r   placeholdersz_BaseMaster.placeholders9        "$--"6"6==r   c                 B    t        | j                  j                  |       S )zr
        Instance of |MasterShapes| containing sequence of shape objects
        appearing on this slide.
        )r   r   r-   r   s    r   shapesz_BaseMaster.shapesA        DMM00$77r   N)r#   r$   r%   r&   r   r.   r1   r)   r   r   r+   r+   3   s/    
 > > 8 8r   r+   c                       e Zd ZdZy)NotesMasterz
    Proxy for the notes master XML document. Provides access to shapes, the
    most commonly used of which are placeholders.
    N)r#   r$   r%   r&   r)   r   r   r4   r4   J   s    r   r4   c                   V    e Zd ZdZd Zed        Zed        Zed        Z	ed        Z
y)
NotesSlidezxNotes slide object.

    Provides access to slide notes placeholder and other shapes on the notes handout
    page.
    c                 ^    d }| j                   } ||      D ]  }|j                  |        y)a3  Selectively add placeholder shape elements from *notes_master*.

        Selected placeholder shape elements from *notes_master* are added to the shapes
        collection of this notes slide. Z-order of placeholders is preserved. Certain
        placeholders (header, date, footer) are not cloned.
        c              3      K   t         j                  t         j                  t         j                  f}| j                  D ]  }|j
                  j                  |v s| ! yw)z
            Generate a reference to each placeholder in *notes_master* that
            should be cloned to a notes slide when the a new notes slide is
            created.
            N)r   SLIDE_IMAGEBODYSLIDE_NUMBERr.   elementph_type)notes_master	cloneableplaceholders      r   iter_cloneable_placeholderszINotesSlide.clone_master_placeholders.<locals>.iter_cloneable_placeholders`   s[      **##++I
  ,88 &&&..);%%&   AA!A!N)r1   clone_placeholder)r   r>   rA   r1   r@   s        r   clone_master_placeholdersz$NotesSlide.clone_master_placeholdersX   s4    	& 6|D 	2K$$[1	2r   c                 |    | j                   D ]-  }|j                  j                  t        j                  k(  s+|c S  y)al  
        Return the notes placeholder on this notes slide, the shape that
        contains the actual notes text. Return |None| if no notes placeholder
        is present; while this is probably uncommon, it can happen if the
        notes master does not have a body placeholder, or if the notes
        placeholder has been deleted from the notes slide.
        N)r.   placeholder_formattyper   r:   )r   r@   s     r   notes_placeholderzNotesSlide.notes_placeholders   s>      ,, 	#K--22n6I6II""	# r   c                 8    | j                   }|y|j                  S )z
        Return the text frame of the notes placeholder on this notes slide,
        or |None| if there is no notes placeholder. This is a shortcut to
        accommodate the common case of simply adding "notes" text to the
        notes "page".
        N)rH   
text_frame)r   rH   s     r   notes_text_framezNotesSlide.notes_text_frame   s%     !22$ +++r   c                 B    t        | j                  j                  |       S )z
        An instance of |NotesSlidePlaceholders| containing the sequence of
        placeholder shapes in this notes slide.
        )r	   r<   r-   r   s    r   r.   zNotesSlide.placeholders   s     &dll&9&94@@r   c                 B    t        | j                  j                  |       S )z
        An instance of |NotesSlideShapes| containing the sequence of shape
        objects appearing on this notes slide.
        )r
   r   r-   r   s    r   r1   zNotesSlide.shapes   s       4 4d;;r   N)r#   r$   r%   r&   rD   r'   rH   rK   r   r.   r1   r)   r   r   r6   r6   Q   s^    26   
, 
, A A < <r   r6   c                        e Zd ZdZe fd       Zed        Zed        Zed        Ze	d        Z
e	d        Zed        Zed	        Z xZS )
SlidezCSlide object. Provides access to shapes and slide-level properties.c                      t         t        | 
  S )a  |_Background| object providing slide background properties.

        This property returns a |_Background| object whether or not the slide
        overrides the default background or inherits it. Determining which of
        those conditions applies for this slide is accomplished using the
        :attr:`follow_master_background` property.

        The same |_Background| object is returned on every call for the same
        slide object.
        )superrO   r   )r   	__class__s    r   r   zSlide.background   s     UD,,r   c                 2    | j                   j                  du S )a  |True| if this slide inherits the slide master background.

        Assigning |False| causes background inheritance from the master to be
        interrupted; if there is no custom background for this slide,
        a default background is added. If a custom background already exists
        for this slide, assigning |False| has no effect.

        Assigning |True| causes any custom background for this slide to be
        deleted and inheritance from the master restored.
        N)r   bgr   s    r   follow_master_backgroundzSlide.follow_master_background   s     }}4''r   c                 .    | j                   j                  S )a  
        Return True if this slide has a notes slide, False otherwise. A notes
        slide is created by :attr:`.notes_slide` when one doesn't exist; use
        this property to test for a notes slide without the possible side
        effect of creating one.
        )parthas_notes_slider   s    r   rX   zSlide.has_notes_slide   s     yy(((r   c                 .    | j                   j                  S )z
        Return the |NotesSlide| instance for this slide. If the slide does
        not have a notes slide, one is created. The same single instance is
        returned on each call.
        )rW   notes_slider   s    r   rZ   zSlide.notes_slide   s     yy$$$r   c                 B    t        | j                  j                  |       S )zr
        Instance of |SlidePlaceholders| containing sequence of placeholder
        shapes in this slide.
        )r   r   r-   r   s    r   r.   zSlide.placeholders   s     !!5!5t<<r   c                 B    t        | j                  j                  |       S )zq
        Instance of |SlideShapes| containing sequence of shape objects
        appearing on this slide.
        )r   r   r-   r   s    r   r1   zSlide.shapes   s     4==//66r   c                 .    | j                   j                  S )a  
        The integer value that uniquely identifies this slide within this
        presentation. The slide id does not change if the position of this
        slide in the slide sequence is changed by adding, rearranging, or
        deleting slides.
        )rW   slide_idr   s    r   r^   zSlide.slide_id   s     yy!!!r   c                 .    | j                   j                  S )zK
        |SlideLayout| object this slide inherits appearance from.
        )rW   slide_layoutr   s    r   r`   zSlide.slide_layout       
 yy%%%r   )r#   r$   r%   r&   r'   r   rU   rX   rZ   r   r.   r1   r^   r`   __classcell__rR   s   @r   rO   rO      s    M- - ( ( ) ) % % = = 7 7 " " & &r   rO   c                   H     e Zd ZdZ fdZd Zd Zd Zd Zd	dZ	d Z
 xZS )
Slidesz
    Sequence of slides belonging to an instance of |Presentation|, having
    list semantics for access to individual slides. Supports indexed access,
    len(), and iteration.
    c                 <    t         t        |   ||       || _        y N)rQ   re   __init__	_sldIdLst)r   sldIdLstprsrR   s      r   rh   zSlides.__init__   s    fd$Xs3!r   c                     	 | j                   |   }| j                  j                  |j                        S # t        $ r t        d      w xY w)z=
        Provide indexed access, (e.g. 'slides[0]').
        zslide index out of range)ri   
IndexErrorrW   related_sliderId)r   idxsldIds      r   __getitem__zSlides.__getitem__   sM    	9NN3'E yy&&uyy11  	9788	9	   6 Ac              #   |   K   | j                   D ])  }| j                  j                  |j                         + yw)zB
        Support iteration (e.g. 'for slide in slides:').
        N)ri   rW   rn   ro   )r   rq   s     r   __iter__zSlides.__iter__  s4      ^^ 	5E))))%))44	5   :<c                 ,    t        | j                        S zL
        Support len() built-in function (e.g. 'len(slides) == 4').
        )lenri   r   s    r   __len__zSlides.__len__  s     4>>""r   c                     | j                   j                  |      \  }}|j                  j                  |       | j                  j                  |       |S )zV
        Return a newly added slide that inherits layout from *slide_layout*.
        )rW   	add_slider1   clone_layout_placeholdersri   	add_sldId)r   r`   ro   slides       r   r|   zSlides.add_slide  sE     YY((6
U..|<  %r   c                 D    | j                   j                  |      }||S |S )z|
        Return the slide identified by integer *slide_id* in this
        presentation, or *default* if not found.
        )rW   	get_slide)r   r^   defaultr   s       r   getz
Slides.get  s'    
 		##H-=Nr   c                 V    t        |       D ]  \  }}||k(  s|c S  t        d|z        )z
        Map *slide* to an integer representing its zero-based position in
        this slide collection. Raises |ValueError| on *slide* not present.
        z%s is not in slide collection	enumerate
ValueError)r   r   rp   
this_slides       r   indexzSlides.index(  s;    
  ) 	OCU"
	 85@AAr   rg   )r#   r$   r%   r&   rh   rr   ru   rz   r|   r   r   rb   rc   s   @r   re   re      s,    "25#Br   re   c                   V    e Zd ZdZd Zed        Zed        Zed        Z	ed        Z
y)SlideLayoutzv
    Slide layout object. Provides access to placeholders, regular shapes, and
    slide layout-level properties.
    c              #      K   t         j                  t         j                  t         j                  f}| j                  D ]  }|j
                  j                  |vs| ! yw)z
        Generate a reference to each layout placeholder on this slide layout
        that should be cloned to a slide when the layout is applied to that
        slide.
        N)r   DATEFOOTERr;   r.   r<   r=   )r   latent_ph_typesphs      r   rA   z'SlideLayout.iter_cloneable_placeholders9  sX      !!''

 ## 	Bzz!!8	rB   c                 B    t        | j                  j                  |       S )z
        Instance of |LayoutPlaceholders| containing sequence of placeholder
        shapes in this slide layout, sorted in *idx* order.
        )r   r   r-   r   s    r   r.   zSlideLayout.placeholdersH  r/   r   c                 B    t        | j                  j                  |       S )zv
        Instance of |LayoutShapes| containing the sequence of shapes
        appearing on this slide layout.
        )r   r   r-   r   s    r   r1   zSlideLayout.shapesP  r2   r   c                 .    | j                   j                  S )zP
        Slide master from which this slide layout inherits properties.
        )rW   slide_masterr   s    r   r   zSlideLayout.slide_masterX  ra   r   c                       j                   j                  j                  j                  j                  }t         fd|D              S )z2Tuple of slide objects based on this slide layout.c              3   B   K   | ]  }|j                   k(  s|  y wrg   )r`   ).0sr   s     r   	<genexpr>z-SlideLayout.used_by_slides.<locals>.<genexpr>d  s     A1!..D*@QAs   )rW   packagepresentation_partpresentationslidestuple)r   r   s   ` r   used_by_slideszSlideLayout.used_by_slides_  s7     ""44AAHHAAAAr   N)r#   r$   r%   r&   rA   r   r.   r1   r'   r   r   r)   r   r   r   r   3  s^    
 > > 8 8 & & B Br   r   c                   H     e Zd ZdZ fdZd Zd Zd Zd	dZd Z	d Z
 xZS )
SlideLayoutszSequence of slide layouts belonging to a slide-master.

    Supports indexed access, len(), iteration, index() and remove().
    c                 <    t         t        |   ||       || _        y rg   )rQ   r   rh   _sldLayoutIdLst)r   sldLayoutIdLstparentrR   s      r   rh   zSlideLayouts.__init__m      lD*>6B-r   c                     	 | j                   |   }| j                  j                  |j                        S # t        $ r t        d      w xY w)zF
        Provide indexed access, (e.g. ``slide_layouts[2]``).
        zslide layout index out of range)r   rm   rW   related_slide_layoutro   )r   rp   sldLayoutIds      r   rr   zSlideLayouts.__getitem__q  R    	@..s3K yy--koo>>  	@>??	@rs   c              #   |   K   | j                   D ])  }| j                  j                  |j                         + yw)zu
        Generate a reference to each of the |SlideLayout| instances in the
        collection, in sequence.
        N)r   rW   r   ro   )r   r   s     r   ru   zSlideLayouts.__iter__{  s8     
  // 	BK))00AA	Brv   c                 ,    t        | j                        S rx   )ry   r   r   s    r   rz   zSlideLayouts.__len__       4''((r   c                 :    | D ]  }|j                   |k(  s|c S  |S )zBReturn SlideLayout object having *name* or *default* if not found.)r   )r   r   r   r`   s       r   get_by_namezSlideLayouts.get_by_name  s,      	$L  D(##	$ r   c                 P    t        |       D ]  \  }}||k(  s|c S  t        d      )zReturn zero-based index of *slide_layout* in this collection.

        Raises ValueError if *slide_layout* is not present in this collection.
        z*layout not in this SlideLayouts collectionr   )r   r`   rp   this_layouts       r   r   zSlideLayouts.index  s7    
 !*$ 	C{*
	 EFFr   c                    |j                   rt        d      | j                  |      }| j                  j                  |   }| j                  j                  |       |j                  j                  j                  |j                         y)zRemove *slide_layout* from the collection.

        Raises ValueError when *slide_layout* is in use; a slide layout which is the
        basis for one or more slides cannot be removed.
        z7cannot remove slide-layout in use by one or more slidesN)
r   r   r   r   sldLayoutId_lstremover   rW   drop_relro   )r   r`   
target_idxtarget_sldLayoutIds       r   r   zSlideLayouts.remove  sz     &&VWW ZZ-
 "11AA*M##$67
 	!!&&//0B0F0FGr   rg   )r#   r$   r%   r&   rh   rr   ru   rz   r   r   r   rb   rc   s   @r   r   r   g  s.    
.?B)GHr   r   c                        e Zd ZdZed        Zy)SlideMasterz
    Slide master object. Provides access to slide layouts. Access to
    placeholders, regular shapes, and slide master-level properties is
    inherited from |_BaseMaster|.
    c                 J    t        | j                  j                         |       S )zF|SlideLayouts| object providing access to this slide-master's layouts.)r   r   get_or_add_sldLayoutIdLstr   s    r   slide_layoutszSlideMaster.slide_layouts  s     DMMCCEtLLr   N)r#   r$   r%   r&   r   r   r)   r   r   r   r     s     M Mr   r   c                   4     e Zd ZdZ fdZd Zd Zd Z xZS )SlideMasterszSequence of |SlideMaster| objects belonging to a presentation.

    Has list access semantics, supporting indexed access, len(), and iteration.
    c                 <    t         t        |   ||       || _        y rg   )rQ   r   rh   _sldMasterIdLst)r   sldMasterIdLstr   rR   s      r   rh   zSlideMasters.__init__  r   r   c                     	 | j                   |   }| j                  j                  |j                        S # t        $ r t        d      w xY w)zF
        Provide indexed access, (e.g. ``slide_masters[2]``).
        zslide master index out of range)r   rm   rW   related_slide_masterro   )r   rp   sldMasterIds      r   rr   zSlideMasters.__getitem__  r   rs   c              #   |   K   | j                   D ])  }| j                  j                  |j                         + yw)zu
        Generate a reference to each of the |SlideMaster| instances in the
        collection, in sequence.
        N)r   rW   r   ro   )r   smis     r   ru   zSlideMasters.__iter__  s6     
 '' 	:C))0099	:rv   c                 ,    t        | j                        S )zS
        Support len() built-in function (e.g. 'len(slide_masters) == 4').
        )ry   r   r   s    r   rz   zSlideMasters.__len__  r   r   )	r#   r$   r%   r&   rh   rr   ru   rz   rb   rc   s   @r   r   r     s    
.?:)r   r   c                   2     e Zd ZdZ fdZed        Z xZS )r   zProvides access to slide background properties.

    Note that the presence of this object does not by itself imply an
    explicitly-defined background; a slide with an inherited background still
    has a |_Background| object.
    c                 :    t         t        |   |       || _        y rg   )rQ   r   rh   _cSld)r   r   rR   s     r   rh   z_Background.__init__  s    k4)$/
r   c                 `    | j                   j                         }t        j                  |      S )a  |FillFormat| instance for this background.

        This |FillFormat| object is used to interrogate or specify the fill
        of the slide background.

        Note that accessing this property is potentially destructive. A slide
        background can also be specified by a background style reference and
        accessing this property will remove that reference, if present, and
        replace it with NoFill. This is frequently the case for a slide
        master background.

        This is also the case when there is no explicitly defined background
        (background is inherited); merely accessing this property will cause
        the background to be set to NoFill and the inheritance link will be
        interrupted. This is frequently the case for a slide background.

        Of course, if you are accessing this property in order to set the
        fill, then these changes are of no consequence, but the existing
        background cannot be reliably interrogated using this property unless
        you have already established it is an explicit fill.

        If the background is already a fill, then accessing this property
        makes no changes to the current background.
        )r   get_or_add_bgPrr   from_fill_parent)r   bgPrs     r   fillz_Background.fill  s'    4 zz))+**400r   )r#   r$   r%   r&   rh   r   r   rb   rc   s   @r   r   r     s!     1 1r   r   N)r&   pptx.dml.fillr   pptx.enum.shapesr   pptx.shapes.shapetreer   r   r   r   r	   r
   r   r   pptx.sharedr   r   r   	pptx.utilr   r   r+   r4   r6   rO   re   r   r   r   r   r   r)   r   r   <module>r      s    D $ +	 	 	 M L ",! ,<8* 8.+ K< K<\Q&J Q&h=B! =B@1B* 1BhHH' HHV
M+ 
M )'  )F'1, '1r   