
    ~Zi4                    f   S r SSKJr  SSKrSSKrSSKJrJrJrJ	r	J
r
Jr  SSKJrJr  SSKJrJr  SSKJr  SSKJr  SS	KJr  SS
KJr  SSKJr  SSKJr  SSKJ r J!r!  SSK"J#r#  SSK$J%r%  SSK&J'r'  SSK(J)r)  SSK*J+r+  SSK,J-r-J.r.  SSK/J0r0J1r1J2r2J3r3J4r4J5r5J6r6J7r7J8r8  SSK9J:r:  SSK;J<r<J=r=  \(       aL  SSK>J?r?  SSK@JArA  SSKBJCrC  SSKJDrDJErE  SSKFJGrG  SSKHJIrI  SSKJJKrK  SSKLJMrM  SSKNJOrO  SS KPJQrQJRrR  SS!KSJTrT  SS"K;JUrU   " S# S$\:5      rV " S% S&\V5      rW " S' S(\W5      rX " S) S*\W5      rY " S+ S,\V5      rZ " S- S.\V5      r[ " S/ S0\V5      r\ " S1 S2\V5      r] " S3 S4\]5      r^ " S5 S6\]5      r_ " S7 S8\_5      r` " S9 S:\:5      raSES; jrbSES< jrcSES= jrdSES> jreSFS? jrfSES@ jrg " SA SB\h5      ri " SC SD\h5      rjg)Gz:The shape tree, the structure that holds a slide's shapes.    )annotationsN)IOTYPE_CHECKINGCallableIterableIteratorcast)PP_PLACEHOLDERPROG_ID)SPEAKER_IMAGE_BYTESVideo)CONTENT_TYPE)qn)CT_Shape)CT_GraphicalObjectFrame)
CT_Picture)ST_Direction)AutoShapeTypeShape)	BaseShape)	Connector)FreeformBuilder)GraphicFrame)
GroupShape)MoviePicture)	ChartPlaceholderLayoutPlaceholderMasterPlaceholderNotesSlidePlaceholderPicturePlaceholderPlaceholderGraphicFramePlaceholderPictureSlidePlaceholderTablePlaceholder)ParentedElementProxy)Emulazyproperty)Chart)	ChartData)XL_CHART_TYPE)MSO_CONNECTOR_TYPE	MSO_SHAPE)ShapeElement)CT_Connector)CT_GroupShape)	ImagePart)	SlidePart)SlideSlideLayout)ProvidesPart)Lengthc                     ^  \ rS rSrSrSU 4S jjrSS jrSS jrSS jrSS jr	SS jr
\SS	 j5       r\R                  SS
 j5       r\SS j5       rSS jrSS jr\SS j5       rSS jrSrU =r$ )_BaseShapesM   zBase class for a shape collection appearing in a slide-type object.

Subclasses include Slide, SlideLayout, and SlideMaster. Provides common methods.
c                F   > [         [        U ]  X5        Xl        S U l        g N)superr8   __init___spTree_cached_max_shape_id)selfspTreeparent	__class__s      o/var/www/eduai.edurigo.com/question_generate/ques_gen_env/lib/python3.13/site-packages/pptx/shapes/shapetree.pyr=   _BaseShapes.__init__S   s    k4)&9$(!    c                    [        U R                  5       5      n X!   nU R                  U5      $ ! [         a    [        S5      ef = f)z4Return shape at `idx` in sequence, e.g. `shapes[2]`.zshape index out of range)list_iter_member_elms
IndexError_shape_factory)r@   idx
shape_elms	shape_elms       rD   __getitem___BaseShapes.__getitem__X   sQ    $0023
	9"I ""9--  	9788	9s	   0 Ac              #  `   #    U R                  5        H  nU R                  U5      v   M     g7f)zBGenerate a reference to each shape in the collection, in sequence.N)rI   rK   r@   rN   s     rD   __iter___BaseShapes.__iter__a   s)     //1I%%i00 2s   ,.c                J    [        U R                  5       5      n[        U5      $ )zReturn count of shapes in this shape tree.

A group shape contributes 1 to the total, without regard to the number of shapes contained
in the group.
)rH   rI   len)r@   rM   s     rD   __len___BaseShapes.__len__f   s!     $0023
:rF   c                    UR                   nUR                  UR                  UR                  UR                  4u  p4pVU R
                  nU R                  X7U5      nU R                  R                  XxX4XV5        g)z3Add a new placeholder shape based on `placeholder`.N)	elementph_type	ph_orientph_szph_idx_next_shape_id_next_ph_namer>   add_placeholder)	r@   placeholderspr[   orientszrL   id_names	            rD   clone_placeholder_BaseShapes.clone_placeholdero   sc      $&JJbhh		#R !!!!'7$$SIrF   c                   [         R                  S[         R                  S[         R                  S[         R                  S[         R
                  S[         R                  S[         R                  S[         R                  S[         R                  S	[         R                  S
[         R                  S[         R                  S[         R                  S[         R                  S[         R                  S0U   $ )zReturn the base name for a placeholder of `ph_type` in this shape collection.

There is some variance between slide types, for example a notes slide uses a different
name for the body placeholder, so this method can be overriden by subclasses.
zClipArt PlaceholderzText PlaceholderTitlezChart PlaceholderDate PlaceholderFooter PlaceholderHeader PlaceholderzMedia PlaceholderzContent PlaceholderzSmartArt PlaceholderzPicture PlaceholderSlide Number PlaceholderSubtitlezTable Placeholder)r
   BITMAPBODYCENTER_TITLECHARTDATEFOOTERHEADER
MEDIA_CLIPOBJECT	ORG_CHARTPICTURESLIDE_NUMBERSUBTITLETABLETITLEr@   r[   s     rD   ph_basename_BaseShapes.ph_basenamew   s     !!#8!3''  "5!3!!#7!!#7%%':!!#8$$&<""$9'')C##Z  "5  '
  ! 	rF   c                    U R                   SL$ )a  True if "turbo-add" mode is enabled. Read/Write.

EXPERIMENTAL: This feature can radically improve performance when adding large numbers
(hundreds of shapes) to a slide. It works by caching the last shape ID used and
incrementing that value to assign the next shape id. This avoids repeatedly searching all
shape ids in the slide each time a new ID is required.

Performance is not noticeably improved for a slide with a relatively small number of
shapes, but because the search time rises with the square of the shape count, this option
can be useful for optimizing generation of a slide composed of many shapes.

Shape-id collisions can occur (causing a repair error on load) if more than one |Slide|
object is used to interact with the same slide in the presentation. Note that the |Slides|
collection creates a new |Slide| object each time a slide is accessed (e.g. `slide =
prs.slides[0]`, so you must be careful to limit use to a single |Slide| object.
N)r?   r@   s    rD   turbo_add_enabled_BaseShapes.turbo_add_enabled   s    $ ((44rF   c                n    [        U5      nU(       a  U R                  R                  U l        g S U l        g r;   )boolr>   max_shape_idr?   )r@   valueenables      rD   r   r      s&    eAGDLL$=$=!T!rF   c                    g)zSReturn true if `shape_elm` represents a member of this collection, False otherwise.T rN   s    rD   _is_member_elm_BaseShapes._is_member_elm   s     rF   c              #     #    U R                   R                  5        H  nU R                  U5      (       d  M  Uv   M!     g7f)zpGenerate each child of the `p:spTree` element that corresponds to a shape.

Items appear in XML document order.
N)r>   iter_shape_elmsr   rR   s     rD   rI   _BaseShapes._iter_member_elms   s4     
 557I""9-- 8s
   2A	Ac                    U R                  U5      nU[        R                  :X  a  SU-  nUS-
  nU R                  R	                  S5      n SXE4-  nXv;  a   U$ US-  nM  )a  Next unique placeholder name for placeholder shape of type `ph_type`.

Usually will be standard placeholder root name suffixed with id-1, e.g.
_next_ph_name(ST_PlaceholderType.TBL, 4, 'horz') ==> 'Table Placeholder 3'. The number is
incremented as necessary to make the name unique within the collection. If `orient` is
`'vert'`, the placeholder name is prefixed with `'Vertical '`.
zVertical %s   z//p:cNvPr/@name%s %d)r   r   VERTr>   xpath)r@   r[   idrd   basenamenumpartnamesrg   s           rD   r`   _BaseShapes._next_ph_name   s~     ##G, \&&&$x/H q&""#45h00D   qLG	 rF   c                    U R                   b!  U =R                   S-  sl         U R                   $ U R                  R                  S-   $ )zReturn a unique shape id suitable for use with a new shape.

The returned id is 1 greater than the maximum shape id used so far. In practice, the
minimum id is 2 because the spTree element is always assigned id="1".
r   )r?   r>   r   r   s    rD   r_   _BaseShapes._next_shape_id   sB     $$0%%*%,,,||((1,,rF   c                    [        X5      $ HReturn an instance of the appropriate shape proxy class for `shape_elm`.)BaseShapeFactoryrR   s     rD   rK   _BaseShapes._shape_factory   s    	00rF   )r?   r>   )rA   r0   rB   r5   )rL   intreturnr   )r   zIterator[BaseShape]r   r   )rb   r   r   Noner[   r
   r   str)r   r   )r   r   rN   r.   r   r   )r   zIterator[ShapeElement])r[   r
   r   r   rd   r   r   r   rN   r.   r   r   )__name__
__module____qualname____firstlineno____doc__r=   rO   rS   rW   rh   r   propertyr   setterstaticmethodr   rI   r`   r_   rK   __static_attributes____classcell__rC   s   @rD   r8   r8   M   s    
)
.1
J0 5 5& R R   2 - -1 1rF   r8   c                    ^  \ rS rSr% SrS\S'   S\S'   SU 4S jjr              SS jr            SS	 jrSSS
 jjr	     S                   SS jjr
  S           S S jjr            S!S jrS"S jr S#       S$S jjrS%S jr            S&S jr            S'S jr              S(S jr            S)S jrS*S jrS+S jrSrU =r$ ),_BaseGroupShapes   z/Base class for shape-trees that can add shapes.r2   partr0   _elementc                8   > [         [        U ]  X5        Xl        g r;   )r<   r   r=   _grpSp)r@   grpSprB   rC   s      rD   r=   _BaseGroupShapes.__init__   s    .u=rF   c                    U R                   R                  X5      nU R                  XrX4U5      nU R                  5         [	        SU R                  U5      5      $ )a
  Add a new chart of `chart_type` to the slide.

The chart is positioned at (`x`, `y`), has size (`cx`, `cy`), and depicts `chart_data`.
`chart_type` is one of the :ref:`XlChartType` enumeration values. `chart_data` is a
|ChartData| object populated with the categories and series values for the chart.

Note that a |GraphicFrame| shape object is returned, not the |Chart| object contained in
that graphic frame shape. The chart object may be accessed using the :attr:`chart`
property of the returned |GraphicFrame| object.
r)   )r   add_chart_part_add_chart_graphicFrame_recalculate_extentsr	   rK   )	r@   
chart_typexycxcy
chart_datarIdgraphicFrames	            rD   	add_chart_BaseGroupShapes.add_chart   sP    & ii&&z>33CA2F!!#GT00>??rF   c                    U R                  XX4U5      nU R                  5         [        [        U R	                  U5      5      $ )a   Add a newly created connector shape to the end of this shape tree.

`connector_type` is a member of the :ref:`MsoConnectorType` enumeration and the end-point
values are specified as EMU values. The returned connector is of type `connector_type` and
has begin and end points as specified.
)
_add_cxnSpr   r	   r   rK   )r@   connector_typebegin_xbegin_yend_xend_ycxnSps          rD   add_connector_BaseGroupShapes.add_connector  s:     O!!#It2259::rF   c                   [        U5      nU R                  R                  5       nU H  nUR                  UR                  S5        M!     U(       a  UR	                  5         [        [        U R                  U5      5      $ )ad  Return a |GroupShape| object newly appended to this shape tree.

The group shape is empty and must be populated with shapes using methods on its shape
tree, available on its `.shapes` property. The position and extents of the group shape are
determined by the shapes it contains; its position and extents are recalculated each time
a shape is added to it.
zp:extLst)tupler   	add_grpSpinsert_element_beforerecalculate_extentsr	   r   rK   )r@   shapesr   shapes       rD   add_group_shape _BaseGroupShapes.add_group_shape  si     v'')E''
  %%'J 3 3E :;;rF   c
                    [         R                  U U R                  UUUUUUUUU	5      n
U R                  R	                  U
5        U R                  5         [        [        U R                  U
5      5      $ )a  Return newly-created GraphicFrame shape embedding `object_file`.

The returned graphic-frame shape contains `object_file` as an embedded OLE object. It is
displayed as an icon at `left`, `top` with size `width`, `height`. `width` and `height`
may be omitted when `prog_id` is a member of `PROG_ID`, in which case the default icon
size is used. This is advised for best appearance where applicable because it avoids an
icon with a "stretched" appearance.

`object_file` may either be a str path to a file or file-like object (such as
`io.BytesIO`) containing the bytes of the object to be embedded (such as an Excel file).

`prog_id` can be either a member of `pptx.enum.shapes.PROG_ID` or a str value like
`"Adobe.Exchange.7"` determined by inspecting the XML generated by PowerPoint for an
object of the desired type.

`icon_file` may either be a str path to an image file or a file-like object containing the
image. The image provided will be displayed in lieu of the OLE object; double-clicking on
the image opens the object (subject to operating-system limitations). The image file can
be any supported image file. Those produced by PowerPoint itself are generally EMF and can
be harvested from a PPTX package that embeds such an object. PNG and JPG also work fine.

`icon_width` and `icon_height` are `Length` values (e.g. Emu() or Inches()) that describe
the size of the icon image within the shape. These should be omitted unless a custom
`icon_file` is provided. The dimensions must be discovered by inspecting the XML.
Automatic resizing of the OLE-object shape can occur when the icon is double-clicked if
these values are not as set by PowerPoint. This behavior may only manifest in the Windows
version of PowerPoint.
)	_OleObjectElementCreatorr   r_   r>   appendr   r	   r   rK   )r@   object_fileprog_idlefttopwidthheight	icon_file
icon_widthicon_heightr   s              rD   add_ole_object_BaseGroupShapes.add_ole_object(  st    P 0<<
 	L)!!#L$"5"5l"CDDrF   c                    U R                   R                  U5      u  pgU R                  XgX#XE5      nU R                  5         [	        [
        U R                  U5      5      $ )a  Add picture shape displaying image in `image_file`.

`image_file` can be either a path to a file (a string) or a file-like object. The picture
is positioned with its top-left corner at (`top`, `left`). If `width` and `height` are
both |None|, the native size of the image is used. If only one of `width` or `height` is
used, the unspecified dimension is calculated to preserve the aspect ratio of the image.
If both are specified, the picture is stretched to fit, without regard to its native
aspect ratio.
)r   get_or_add_image_part_add_pic_from_image_partr   r	   r   rK   )	r@   
image_filer   r   r   r   
image_partr   pics	            rD   add_picture_BaseGroupShapes.add_picturea  sR    " ))99*E
++JTV!!#GT00566rF   c                    [        U5      nU R                  XbX4U5      nU R                  5         [        [        U R                  U5      5      $ )zReturn new |Shape| object appended to this shape tree.

`autoshape_type_id` is a member of :ref:`MsoAutoShapeType` e.g. `MSO_SHAPE.RECTANGLE`
specifying the type of shape to be added. The remaining arguments specify the new shape's
position and size.
)r   _add_spr   r	   r   rK   )r@   autoshape_type_idr   r   r   r   autoshape_typerc   s           rD   	add_shape_BaseGroupShapes.add_shapew  sE     ''89\\.FC!!#E4..r233rF   c                    U R                  XX45      nU R                  5         [        [        U R	                  U5      5      $ )zReturn newly added text box shape appended to this shape tree.

The text box is of the specified size, located at the specified position on the slide.
)_add_textbox_spr   r	   r   rK   )r@   r   r   r   r   rc   s         rD   add_textbox_BaseGroupShapes.add_textbox  s:    
 !!$U;!!#E4..r233rF   c                j    [        U[        5      (       a  UOX34u  pE[        R                  " XX$U5      $ )aV  Return |FreeformBuilder| object to specify a freeform shape.

The optional `start_x` and `start_y` arguments specify the starting pen position in local
coordinates. They will be rounded to the nearest integer before use and each default to
zero.

The optional `scale` argument specifies the size of local coordinates proportional to
slide coordinates (EMU). If the vertical scale is different than the horizontal scale
(local coordinate units are "rectangular"), a pair of numeric values can be provided as
the `scale` argument, e.g. `scale=(1.0, 2.0)`. In this case the first number is
interpreted as the horizontal (X) scale and the second as the vertical (Y) scale.

A convenient method for calculating scale is to divide a |Length| object by an equivalent
count of local coordinate units, e.g. `scale = Inches(1)/1000` for 1000 local units per
inch.
)
isinstancer   r   new)r@   start_xstart_yscalex_scaley_scales         rD   build_freeform_BaseGroupShapes.build_freeform  s1    & %/ue$<$<55.""4'GLLrF   c                ~    [        U R                  R                  5       5      nUR                  UR                  5      $ )zhReturn the index of `shape` in this sequence.

Raises |ValueError| if `shape` is not in the collection.
)rH   r   r   indexrZ   )r@   r   rM   s      rD   r  _BaseGroupShapes.index  s0    
 $--779:
..rF   c           	         U R                   nSUS-
  -  n[        R                  " XgXX4U5      nU R                  R	                  U5        U$ )zReturn new `p:graphicFrame` element appended to this shape tree.

The `p:graphicFrame` element has the specified position and size and refers to the chart
part identified by `rId`.
zChart %dr   )r_   r   new_chart_graphicFramer>   r   )	r@   r   r   r   r   r   shape_idrg   r   s	            rD   r   (_BaseGroupShapes._add_chart_graphicFrame  sP     &&X\*.EECA2
 	L)rF   c                    U R                   nSUS-
  -  nX$:  X5:  p[        X$5      [        X55      p[        XB-
  5      [        XS-
  5      pU R                  R	                  XgXXXU	5	      $ )zReturn a newly-added `p:cxnSp` element as specified.

The `p:cxnSp` element is for a connector of `connector_type` beginning at (`begin_x`,
`begin_y`) and extending to (`end_x`, `end_y`).
zConnector %dr   )r_   minabsr   	add_cxnSp)r@   r   r   r   r   r   rf   rg   flipHflipVr   r   r   r   s                 rD   r   _BaseGroupShapes._add_cxnSp  sl     !!q)u7"C$71U_%s5?';B}}&&s.QBW\]]rF   c           
         U R                   nUR                  XV5      u  pSUS-
  -  n
UR                  nU R                  R	                  XzXX4X5      nU$ )a  Return a newly appended `p:pic` element as specified.

The `p:pic` element displays the image in `image_part` with size and position specified by
`x`, `y`, `cx`, and `cy`. The element is appended to the shape tree, causing it to be
displayed first in z-order on the slide.
z
Picture %dr   )r_   r  descr   add_pic)r@   r   r   r   r   r   r   rf   	scaled_cx	scaled_cyrg   r  r   s                rD   r   )_BaseGroupShapes._add_pic_from_image_part  sX     !!)//7	sQw'kk!!#TiS
rF   c           	         U R                   nSUR                  US-
  4-  nU R                  R                  XgUR                  X#XE5      nU$ )zReturn newly-added `p:sp` element as specified.

`p:sp` element is of `autoshape_type` at position (`x`, `y`) and of size (`cx`, `cy`).
r   r   )r_   r   r   add_autoshapeprst)	r@   r   r   r   r   r   rf   rg   rc   s	            rD   r   _BaseGroupShapes._add_sp  sM     !!.1137;;[[&&s.2E2EqRT	rF   c                h    U R                   nSUS-
  -  nU R                  R                  XVXX45      nU$ )zfReturn newly-appended textbox `p:sp` element.

Element has position (`x`, `y`) and size (`cx`, `cy`).
z
TextBox %dr   )r_   r>   r   )r@   r   r   r   r   rf   rg   rc   s           rD   r    _BaseGroupShapes._add_textbox_sp  s:    
 !!sQw'\\%%cr>	rF   c                    gzAdjust position and size to incorporate all contained shapes.

This would typically be called when a contained shape is added, removed, or its position
or size updated.
Nr   r   s    rD   r   %_BaseGroupShapes._recalculate_extents  s     	rF   )r   )r   r0   rB   r5   )r   r+   r   r6   r   r6   r   r6   r   r6   r   r*   r   r)   )r   r,   r   r6   r   r6   r   r6   r   r6   r   r   )r   )r   zIterable[BaseShape]r   r   )NNNNN)r   str | IO[bytes]r   r   r   r6   r   r6   r   Length | Noner   r*  r   str | IO[bytes] | Noner   r*  r   r*  r   r   )NN)r   r)  r   r6   r   r6   r   r*  r   r*  r   r   )r   r-   r   r6   r   r6   r   r6   r   r6   r   r   )
r   r6   r   r6   r   r6   r   r6   r   r   )r   r   g      ?)r  floatr  r,  r  ztuple[float, float] | floatr   r   )r   r   r   r   )r   r   r   r6   r   r6   r   r6   r   r6   r   r   )r   r,   r   r6   r   r6   r   r6   r   r6   r   r/   )r   r1   r   r   r   r6   r   r6   r   r*  r   r*  r   r   )r   r   r   r6   r   r6   r   r6   r   r6   r   r   )
r   r6   r   r6   r   r6   r   r6   r   r   r   r   )r   r   r   r   r   __annotations__r=   r   r   r   r   r   r   r   r
  r  r   r   r   r   r   r   r   r   r   s   @rD   r   r      s   9
O@!@ @ 	@
 @ @ @ 
@0;*; ; 	;
 ; ; 
;$<0  $ $,0$(%)7E$7E 7E 	7E
 7E 7E 7E *7E "7E #7E 
7E|  $ $7#7 7 	7
 7 7 
7,4!*4284?E4NT4^d4	44 \_MM+0M=XM	M./!&,28>D	  ^*^ ^ 	^
 ^ ^ 
^,  	
    
,
+
06
;A
GM
SY
	
 rF   r   c                  "    \ rS rSrSrSS jrSrg)GroupShapesi
  zThe sequence of child shapes belonging to a group shape.

Note that this collection can itself contain a group shape, making this part of a recursive,
tree data structure (acyclic graph).
c                8    U R                   R                  5         gr'  )r   r   r   s    rD   r    GroupShapes._recalculate_extents  s     	'')rF   r   Nr-  )r   r   r   r   r   r   r   r   rF   rD   r0  r0  
  s    *rF   r0  c                      \ rS rSr% SrS\S'   S\R                  4               SS jjr              SS jr	SS jr
\SS	 j5       r\SS
 j5       r              SS jrSS jrSS jrSrg)SlideShapesi  zSequence of shapes appearing on a slide.

The first shape in the sequence is the backmost in z-order and the last shape is topmost.
Supports indexed access, len(), index(), and iteration.
r3   rB   Nc                    [         R                  U U R                  UUUUUUU5	      nU R                  R	                  U5        U R                  U5        [        [        U R                  U5      5      $ )at  Return newly added movie shape displaying video in `movie_file`.

**EXPERIMENTAL.** This method has important limitations:

* The size must be specified; no auto-scaling such as that provided by :meth:`add_picture`
  is performed.
* The MIME type of the video file should be specified, e.g. 'video/mp4'. The provided
  video file is not interrogated for its type. The MIME type `video/unknown` is used by
  default (and works fine in tests as of this writing).
* A poster frame image must be provided, it cannot be automatically extracted from the
  video file. If no poster frame is provided, the default "media loudspeaker" image will
  be used.

Return a newly added movie shape to the slide, positioned at (`left`, `top`), having size
(`width`, `height`), and containing `movie_file`. Before the video is started,
`poster_frame_image` is displayed as a placeholder for the video.
)	_MoviePicElementCreatornew_movie_picr_   r>   r   _add_video_timingr	   r   rK   )	r@   
movie_filer   r   r   r   poster_frame_image	mime_type	movie_pics	            rD   	add_movieSlideShapes.add_movie#  so    6 ,99

	 	I&y)L$"5"5i"@AArF   c                f    U R                  XX4XV5      n[        [        U R                  U5      5      $ )a  Add a |GraphicFrame| object containing a table.

The table has the specified number of `rows` and `cols` and the specified position and
size. `width` is evenly distributed between the columns of the new table. Likewise,
`height` is evenly distributed between the rows. Note that the `.table` property on the
returned |GraphicFrame| shape must be used to access the enclosed |Table| object.
)"_add_graphicFrame_containing_tabler	   r   rK   )r@   rowscolsr   r   r   r   r   s           rD   	add_tableSlideShapes.add_tableM  s1     >>t4V[dL$"5"5l"CDDrF   c                T    UR                  5        H  nU R                  U5        M     g)zAdd placeholder shapes based on those in `slide_layout`.

Z-order of placeholders is preserved. Latent placeholders (date, slide number, and footer)
are not cloned.
N)iter_cloneable_placeholdersrh   )r@   slide_layoutrb   s      rD   clone_layout_placeholders%SlideShapes.clone_layout_placeholdersZ  s&     (CCEK"";/ FrF   c                .    U R                   R                  $ )z-Sequence of placeholder shapes in this slide.)rB   placeholdersr   s    rD   rK  SlideShapes.placeholdersc  s     {{'''rF   c                    U R                   R                  5        H4  nUR                  S:X  d  M  [        [        U R                  U5      5      s  $    g)zYThe title placeholder shape on the slide.

|None| if the slide has no title placeholder.
r   N)r>   iter_ph_elmsr^   r	   r   rK   )r@   elms     rD   titleSlideShapes.titleh  sC     <<,,.CzzQE4#6#6s#;<< / rF   c           
     j    U R                   nSUS-
  -  nU R                  R                  XxXX4XV5      n	U	$ )zNReturn a newly added `p:graphicFrame` element containing a table as specified.zTable %dr   )r_   r>   rC  )
r@   rA  rB  r   r   r   r   _idrg   r   s
             rD   r@  .SlideShapes._add_graphicFrame_containing_tables  s=     !!S1W%||--cQ2RrF   c                    U R                   R                  S5      S   nUR                  5       nUR                  UR                  5        g)zAdd a `p:video` element under `p:sld/p:timing`.

The element will refer to the specified `pic` element by its shape id, and cause the video
play controls to appear for that video.
z/p:sldr   N)r>   r   get_or_add_childTnLst	add_videor  )r@   r   sld
childTnLsts       rD   r8  SlideShapes._add_video_timing|  s=     ll  *1-..0
S\\*rF   c                    [        X5      $ r   SlideShapeFactoryrR   s     rD   rK   SlideShapes._shape_factory  s     11rF   r   )r9  r)  r   r6   r   r6   r   r6   r   r6   r:  r+  r;  r   r   r   )rA  r   rB  r   r   r6   r   r6   r   r6   r   r6   r   r   )rG  r4   r   r   )r   SlidePlaceholders)r   zShape | None)rA  r   rB  r   r   r6   r   r6   r   r6   r   r6   r   r   )r   r   r   r   r   )r   r   r   r   r   r.  CTVIDEOr=  rC  rH  r   rK  rP  r@  r8  rK   r   r   rF   rD   r4  r4    s0    M 6:(B#(B (B 	(B
 (B (B 3(B (B 
(BTEE"E*0E7=EFLEV\E	E0 ( (  "'-28>DJP	 +2rF   r4  c                  "    \ rS rSrSrSS jrSrg)LayoutShapesi  zSequence of shapes appearing on a slide layout.

The first shape in the sequence is the backmost in z-order and the last shape is topmost.
Supports indexed access, len(), index(), and iteration.
c                    [        X5      $ r   _LayoutShapeFactoryrR   s     rD   rK   LayoutShapes._shape_factory      "933rF   r   Nr   r   r   r   r   r   rK   r   r   rF   rD   rc  rc        4rF   rc  c                  "    \ rS rSrSrSS jrSrg)MasterShapesi  zSequence of shapes appearing on a slide master.

The first shape in the sequence is the backmost in z-order and the last shape is topmost.
Supports indexed access, len(), and iteration.
c                    [        X5      $ r   )_MasterShapeFactoryrR   s     rD   rK   MasterShapes._shape_factory  rh  rF   r   Nr   ri  r   rF   rD   rl  rl    rj  rF   rl  c                  ,    \ rS rSrSrSS jrSS jrSrg)	NotesSlideShapesi  zSequence of shapes appearing on a notes slide.

The first shape in the sequence is the backmost in z-order and the last shape is topmost.
Supports indexed access, len(), index(), and iteration.
c                    [         R                  S[         R                  S[         R                  S[         R                  S[         R
                  S[         R                  S0U   $ )zReturn the base name for a placeholder of `ph_type` in this shape collection.

A notes slide uses a different name for the body placeholder and has some unique
placeholder types, so this method overrides the default in the base class.
zNotes Placeholderrl   rm   rn   zSlide Image Placeholderro   )r
   rr   ru   rv   rw   SLIDE_IMAGEr|   r   s     rD   r   NotesSlideShapes.ph_basename  s`     !4!3!!#7!!#7&&(A'')C
  	rF   c                    [        X5      $ )zKReturn appropriate shape object for `shape_elm` appearing on a notes slide.)_NotesSlideShapeFactoryrR   s     rD   rK   NotesSlideShapes._shape_factory  s    &y77rF   r   Nr   r   )r   r   r   r   r   r   rK   r   r   rF   rD   rq  rq    s    8rF   rq  c                  ,    \ rS rSrSr\SS j5       rSrg)BasePlaceholdersi  a  Base class for placeholder collections.

Subclasses differentiate behaviors for a master, layout, and slide. By default, placeholder
shapes are constructed using |BaseShapeFactory|. Subclasses should override
:method:`_shape_factory` to use custom placeholder classes.
c                    U R                   $ )z<True if `shape_elm` is a placeholder shape, False otherwise.)
has_ph_elmr   s    rD   r   BasePlaceholders._is_member_elm  s     ###rF   r   Nr   )r   r   r   r   r   r   r   r   r   rF   rD   ry  ry    s     $ $rF   ry  c                  <    \ rS rSr% SrS\S'   S	S
S jjrSS jrSrg)LayoutPlaceholdersi  zVSequence of |LayoutPlaceholder| instance for each placeholder shape on a slide layout.z)Callable[[], Iterator[LayoutPlaceholder]]rS   Nc                T    U  H!  nUR                   R                  U:X  d  M  Us  $    U$ )zQThe first placeholder shape with matching `idx` value, or `default` if not found.)rZ   r^   )r@   rL   defaultrb   s       rD   getLayoutPlaceholders.get  s-    K""))S0""   rF   c                    [        X5      $ r   re  rR   s     rD   rK   !LayoutPlaceholders._shape_factory  rh  rF   r   r;   )rL   r   r  LayoutPlaceholder | Noner   r  r   	r   r   r   r   r   r.  r  rK   r   r   rF   rD   r~  r~    s    ` 4rF   r~  c                  D    \ rS rSr% SrS\S'   S	S
S jjr    SS jrSrg)MasterPlaceholdersi  zTSequence of MasterPlaceholder representing the placeholder shapes on a slide master.z)Callable[[], Iterator[MasterPlaceholder]]rS   Nc                @    U  H  nUR                   U:X  d  M  Us  $    U$ )zReturn the first placeholder shape with type `ph_type` (e.g. 'body').

Returns `default` if no such placeholder shape is present in the collection.
)r[   )r@   r[   r  rb   s       rD   r  MasterPlaceholders.get  s)    
  K""g-""   rF   c                4    [        [        [        X5      5      $ r   )r	   r   rn  r@   placeholder_elms     rD   rK   !MasterPlaceholders._shape_factory  s     %':?'QRRrF   r   r;   )r[   r
   r  zMasterPlaceholder | None)r  r   r   r   r  r   rF   rD   r  r    s,    ^ S'S	SrF   r  c                  6    \ rS rSr% SrS\S'       SS jrSrg)	NotesSlidePlaceholdersi  z0Sequence of placeholder shapes on a notes slide.z-Callable[[], Iterator[NotesSlidePlaceholder]]rS   c                4    [        [        [        X5      5      $ )zTReturn an instance of the appropriate placeholder proxy class for `placeholder_elm`.)r	   r    rv  r  s     rD   rK   %NotesSlidePlaceholders._shape_factory  s     )+B?+YZZrF   r   N)r  r   r   r    )r   r   r   r   r   r.  rK   r   r   rF   rD   r  r    s'    : ['[	[rF   r  c                  >    \ rS rSr% SrS\S'   S
S jrS rSS jrSr	g	)r_  i  zCollection of placeholder shapes on a slide.

Supports iteration, :func:`len`, and dictionary-style lookup on the `idx` value of the
placeholders it contains.
r0   r   c                    U R                   R                  5        H   nUR                  U:X  d  M  [        X 5      s  $    [	        SU-  5      e)zAccess placeholder shape having `idx`.

Note that while this looks like list access, idx is actually a dictionary key and will
raise |KeyError| if no placeholder with that idx value is in the collection.
z+no placeholder on this slide with idx == %d)r   rN  r^   r]  KeyError)r@   rL   es      rD   rO   SlidePlaceholders.__getitem__  sD     ++-Axx3(11 . DsJKKrF   c                   ^  [        T R                  R                  5        Vs/ s H  oPM     snS S9nU 4S jU 5       $ s  snf )z+Generate placeholder shapes in `idx` order.c                    U R                   $ r;   )r^   )r  s    rD   <lambda>,SlidePlaceholders.__iter__.<locals>.<lambda>  s    RSRZRZrF   )keyc              3  <   >#    U  H  n[        UT5      v   M     g 7fr;   r\  ).0r  r@   s     rD   	<genexpr>-SlidePlaceholders.__iter__.<locals>.<genexpr>  s     <Gq!!T**Gs   )sortedr   rN  )r@   r  ph_elmss   `  rD   rS   SlidePlaceholders.__iter__  s?    T]]%?%?%AB%A!%ABHZ[<G<< Cs   Ac                Z    [        [        U R                  R                  5       5      5      $ )z#Return count of placeholder shapes.)rV   rH   r   rN  r   s    rD   rW   SlidePlaceholders.__len__  s    4224566rF   r   N)rL   r   r   )
r   r   r   r   r   r.  rO   rS   rW   r   r   rF   rD   r_  r_    s     	L=
7rF   r_  c           	     T   U R                   n[        U [        5      (       a.  U R                  S5      nU(       a  [	        X5      $ [        X5      $ [        S5      [        [        S5      [        [        S5      [        [        S5      [        0R                  U[        5      nU" X5      $ )r   z./p:nvPicPr/p:nvPr/a:videoFilezp:cxnSpzp:grpSpp:spp:graphicFrame)tagr  r   r   r   r   r   r   r   r   r   r  r   )rN   rB   r  
videoFiles	shape_clss        rD   r   r   #  s    
--C)Z((__%EF
++y)) 	9y
9z
6
E
l	
 
c#y  Y''rF   c                z    [        U [        5      (       a  U R                  (       a  [        X5      $ [	        X5      $ )zBReturn appropriate shape object for `shape_elm` on a slide layout.)r  r   r{  r   r   rN   rB   s     rD   rf  rf  7  -    )X&&9+?+? 33I..rF   c                z    [        U [        5      (       a  U R                  (       a  [        X5      $ [	        X5      $ )zBReturn appropriate shape object for `shape_elm` on a slide master.)r  r   r{  r   r   r  s     rD   rn  rn  >  r  rF   c                z    [        U [        5      (       a  U R                  (       a  [        X5      $ [	        X5      $ )zAReturn appropriate shape object for `shape_elm` on a notes slide.)r  r   r{  r    r   r  s     rD   rv  rv  E  s-    )X&&9+?+?$Y77I..rF   c                   U R                   nU[        S5      :X  aq  [        R                  [        [        R
                  [        [        R                  [        [        R                  [        0R                  U R                  [        5      nO2U[        S5      :X  a  [        nOU[        S5      :X  a  [        nO[        nU" X5      $ )zCReturn a placeholder shape of the appropriate type for `shape_elm`.r  r  zp:pic)r  r   r
   rq   r!   rt   r   r{   r~   r%   r  r[   r$   r"   r#   r   )rN   rB   r  Constructors       rD   _SlidePlaceholderFactoryr  L  s    
--C
bj!!#5  "2""$6  "2	

 #i!1
2 	 
#$	$-	7	(&y))rF   c                P    U R                   (       a  [        X5      $ [        X5      $ )z;Return appropriate shape object for `shape_elm` on a slide.)r{  r  r   r  s     rD   r]  r]  _  s!    '	::I..rF   c                  D  ^  \ rS rSrSr                  SU 4S jjr\                    SS j5       r\SS j5       r	\
SS j5       r\
SS j5       r\
SS j5       r\SS	 j5       r\SS
 j5       r\
SS j5       r\
SS j5       r\SS j5       rSrU =r$ )r6  if  a  Functional service object for creating a new movie p:pic element.

It's entire external interface is its :meth:`new_movie_pic` class method that returns a new
`p:pic` element containing the specified video. This class is not intended to be constructed
or an instance of it retained by the caller; it is a "one-shot" object, really a function
wrapped in a object such that its helper methods can be organized here.
c
                   > [         [        U ]  5         Xl        X l        X0l        XEXg4u  U l        U l        U l        U l	        Xl
        Xl        g r;   )r<   r6  r=   _shapes	_shape_id_movie_file_x_y_cx_cy_poster_frame_file
_mime_type)r@   r   r  r9  r   r   r   r   poster_frame_filer;  rC   s             rD   r=    _MoviePicElementCreator.__init__o  sH     	%t57!%/0R|,$(DH"3#rF   c
                .    U " XX4XVXxU	5	      R                   $ )zReturn a new `p:pic` element containing video in `movie_file`.

If `mime_type` is None, 'video/unknown' is used. If `poster_frame_file` is None, the
default "media loudspeaker" image is used.
)_pic)
clsr   r  r9  r   r   r   r   r:  r;  s
             rD   r7  %_MoviePicElementCreator.new_movie_pic  s    $ 6ZA2S\]bbbrF   c                     U R                   S   $ )zReturn the rId of RT.MEDIA relationship to video part.

For historical reasons, there are two relationships to the same part; one is the video rId
and the other is the media rId.
r   _video_part_rIdsr   s    rD   
_media_rId"_MoviePicElementCreator._media_rId       $$Q''rF   c                    [         R                  " U R                  U R                  U R                  U R
                  U R                  U R                  U R                  U R                  U R                  5	      $ )z5Return the new `p:pic` element referencing the video.)r   new_video_picr  _shape_name
_video_rIdr  _poster_frame_rIdr  r  r  r  r   s    rD   r  _MoviePicElementCreator._pic  sZ     ''NNOOOO""GGGGHHHH

 
	
rF   c                X    U R                   nUc  [        R                  " [        5      $ U$ )zReturn the image file for video placeholder image.

If no poster frame file is provided, the default "media loudspeaker" image is used.
)r  ioBytesIOr   )r@   r  s     rD   _poster_frame_image_file0_MoviePicElementCreator._poster_frame_image_file  s,     !33$::122  rF   c                T    U R                   R                  U R                  5      u  pU$ )zReturn the rId of relationship to poster frame image.

The poster frame is the image used to represent the video before it's played.
)_slide_partr   r  )r@   _poster_frame_rIds      rD   r  )_MoviePicElementCreator._poster_frame_rId  s)     #..DDTEbEbcrF   c                .    U R                   R                  $ )ztReturn the appropriate shape name for the p:pic shape.

A movie shape is named with the base filename of the video.
)_videofilenamer   s    rD   r  #_MoviePicElementCreator._shape_name  s     {{###rF   c                .    U R                   R                  $ )z8Return SlidePart object for slide containing this movie.r  r   r   s    rD   r  #_MoviePicElementCreator._slide_part       ||   rF   c                X    [         R                  " U R                  U R                  5      $ )z2Return a |Video| object containing the movie file.)r   from_path_or_file_liker  r  r   s    rD   r  _MoviePicElementCreator._video  s!     ++D,<,<dooNNrF   c                V    U R                   R                  U R                  5      u  pX4$ )zReturn the rIds for relationships to media part for video.

This is where the media part and its relationships to the slide are actually created.
)r  get_or_add_video_media_partr  )r@   	media_rId	video_rIds      rD   r  (_MoviePicElementCreator._video_part_rIds  s*      $//KKDKKX	##rF   c                     U R                   S   $ )zReturn the rId of RT.VIDEO relationship to video part.

For historical reasons, there are two relationships to the same part; one is the video rId
and the other is the media rId.
r   r  r   s    rD   r  "_MoviePicElementCreator._video_rId  r  rF   )	r  r  r  r  r  r  r  r  r  )r   r4  r  r   r9  r)  r   r6   r   r6   r   r6   r   r6   r  r+  r;  
str | None)r   r4  r  r   r9  r)  r   r6   r   r6   r   r6   r   r6   r:  r+  r;  r  r   r   r   r   )r   r   r   r)  r   r2   )r   r   )r   ztuple[str, str])r   r   r   r   r   r=   classmethodr7  r   r  r(   r  r  r  r  r  r  r  r  r   r   r   s   @rD   r6  r6  f  s   $$ $ $	$
 $ $ $ $ 2$ $( cc c $	c
 c c c c 3c c 
c c& ( ( 
 
 ! !     $ $ ! ! O O $ $ ( (rF   r6  c                  n   \ rS rSrSr                      SS jr\                        SS j5       r\SS j5       r	\SS j5       r
\SS j5       r\SS j5       r\SS	 j5       r\SS
 j5       r\SS j5       r\SS j5       r\SS j5       r\SS j5       r\SS j5       rSrg)r   i  a  Functional service object for creating a new OLE-object p:graphicFrame element.

It's entire external interface is its :meth:`graphicFrame` class method that returns a new
`p:graphicFrame` element containing the specified embedded OLE-object shape. This class is not
intended to be constructed or an instance of it retained by the caller; it is a "one-shot"
object, really a function wrapped in a object such that its helper methods can be organized
here.
c                    Xl         X l        X0l        X@l        XPl        X`l        Xpl        Xl        Xl        Xl	        Xl
        g r;   )r  r  _ole_object_file_prog_id_argr  r  _cx_arg_cy_arg_icon_file_arg_icon_width_arg_icon_height_arg)r@   r   r  ole_object_filer   r   r   r   r   r   r   r   s               rD   r=   !_OleObjectElementCreator.__init__  s@     ! /#') +rF   c                :    U " UUUUUUUUU	U
U5      R                   $ )zJReturn new `p:graphicFrame` element containing embedded `ole_object_file`.)_graphicFrame)r  r   r  r  r   r   r   r   r   r   r   r   s               rD   r   %_OleObjectElementCreator.graphicFrame  s9      
 -	rF   c                   [         R                  " U R                  U R                  U R                  U R
                  U R                  U R                  U R                  U R                  U R                  U R                  U R                  5      $ )zGNewly-created `p:graphicFrame` element referencing embedded OLE-object.)r   new_ole_object_graphicFramer  r  _ole_object_rId_progId	_icon_rIdr  r  r  r  _icon_width_icon_heightr   s    rD   r  &_OleObjectElementCreator._graphicFrame*  sl     'BBNN  LLNNGGGGHHHH
 	
rF   c                    U R                   b  U R                   $ [        U R                  [        5      (       a  [	        U R                  R
                  5      $ [	        S5      $ )zBEmu object specifying width of "show-as-icon" image for OLE shape.P )r  r  r  r   r'   r   r   s    rD   r  _OleObjectElementCreator._cx;  sS     <<#<<
 -7t7H7H',R,RC!!''(	
X[\bXc	
rF   c                    U R                   b  U R                   $ [        U R                  [        5      (       a  [	        U R                  R
                  5      $ [	        S5      $ )zCEmu object specifying height of "show-as-icon" image for OLE shape.@M	 )r  r  r  r   r'   r   r   s    rD   r  _OleObjectElementCreator._cyH  sS     <<#<<
 .88I8I7-S-SC!!(()	
Y\]cYd	
rF   c                J    U R                   b  U R                   $ [        S5      $ )a  Vertical size of enclosed EMF icon within the OLE graphic-frame.

This must be specified when a custom icon is used, to avoid stretching of the image and
possible undesired resizing by PowerPoint when the OLE shape is double-clicked to open it.

The correct size can be determined by creating an example PPTX using PowerPoint and then
inspecting the XML of the OLE graphics-frame (p:oleObj.imgH).
r  )r  r'   r   s    rD   r  %_OleObjectElementCreator._icon_heightU  s%     )-(=(=(It$$ZsSY{ZrF   c                l   U R                   b  U R                   $ [        U R                  [        5      (       a  U R                  R                  OSn[
        R                  R                  [        5      S   n[
        R                  R                  [
        R                  R                  USSU5      5      $ )zReference to image file containing icon to show in lieu of this object.

This can be either a str path or a file-like object (io.BytesIO typically).
zgeneric-icon.emfr   z..	templates)r  r  r  r   icon_filenameospathsplit__file__abspathjoin)r@   r  _thisdirs      rD   _icon_image_file)_OleObjectElementCreator._icon_image_filea  s     *&&& $++W55 ++# 	 77==*1-wwrww||HdKWXXrF   c                T    U R                   R                  U R                  5      u  pU$ )zHstr rId like "rId7" of rel to icon (image) representing OLE-object part.)r  r   r  )r@   r  r   s      rD   r  "_OleObjectElementCreator._icon_rIdv  s'     !!778M8MN
rF   c                J    U R                   b  U R                   $ [        S5      $ )zWidth of enclosed EMF icon within the OLE graphic-frame.

This must be specified when a custom icon is used, to avoid stretching of the image and
possible undesired resizing by PowerPoint when the OLE shape is double-clicked to open it.
r
  )r  r'   r   s    rD   r  $_OleObjectElementCreator._icon_width|  s%     (,';';'Gt##XSQW[XrF   c                b    U R                   R                  U R                  U R                  5      $ )zstr rId like "rId6" of relationship to embedded ole_object part.

This is where the ole_object part and its relationship to the slide are actually created.
)r  add_embedded_ole_object_partr  r  r   s    rD   r  (_OleObjectElementCreator._ole_object_rId  s.     <<t44
 	
rF   c                `    U R                   n[        U[        5      (       a  UR                  $ U$ )zstr like "Excel.Sheet.12" identifying program used to open object.

This value appears in the `progId` attribute of the `p:oleObj` element for the object.
)r  r  r   progId)r@   prog_id_args     rD   r   _OleObjectElementCreator._progId  s.     '' &0W%E%E{!!V;VrF   c                &    SU R                   S-
  -  $ )zstr name like "Object 1" for the embedded ole_object shape.

The name is formed from the prefix "Object " and the shape-id decremented by 1.
z	Object %dr   )r  r   s    rD   r  $_OleObjectElementCreator._shape_name  s     dnnq011rF   c                .    U R                   R                  $ )z SlidePart object for this slide.r  r   s    rD   r  $_OleObjectElementCreator._slide_part  r  rF   )r  r  r  r  r  r  r  r  r  r  r  N)r   r   r  r   r  r)  r   PROG_ID | strr   r6   r   r6   r   r*  r   r*  r   r+  r   r*  r   r*  )r   r   r  r   r  r)  r   r,  r   r6   r   r6   r   r*  r   r*  r   r+  r   r*  r   r*  r   r   )r   r   )r   r6   r  r  r  )r   r   r   r   r   r=   r  r   r(   r  r  r  r  r  r  r  r  r  r  r  r   r   rF   rD   r   r     s   , , , )	,
 , , , , , *, ", #,4    )	
      * " # 
! : 
 
  

 

 

 

 	[ 	[ Y Y(  
 Y Y 
 
 	W 	W 2 2 ! !rF   r   )rN   r.   rB   r5   r   r   )rN   r.   rB   r5   )kr   
__future__r   r  r  typingr   r   r   r   r   r	   pptx.enum.shapesr
   r   
pptx.mediar   r   pptx.opc.constantsr   r`  pptx.oxml.nsr   pptx.oxml.shapes.autoshaper   pptx.oxml.shapes.graphfrmr   pptx.oxml.shapes.picturer   pptx.oxml.simpletypesr   pptx.shapes.autoshaper   r   pptx.shapes.baser   pptx.shapes.connectorr   pptx.shapes.freeformr   pptx.shapes.graphfrmr   pptx.shapes.groupr   pptx.shapes.picturer   r   pptx.shapes.placeholderr   r   r   r    r!   r"   r#   r$   r%   pptx.sharedr&   	pptx.utilr'   r(   pptx.chart.chartr)   pptx.chart.datar*   pptx.enum.chartr+   r,   r-   pptx.oxml.shapesr.   pptx.oxml.shapes.connectorr/   pptx.oxml.shapes.groupshaper0   pptx.parts.imager1   pptx.parts.slider2   
pptx.slider3   r4   
pptx.typesr5   r6   r8   r   r0  r4  rc  rl  rq  ry  r~  r  r  r_  r   rf  rn  rv  r  r]  objectr6  r   r   rF   rD   <module>rL     sa   @ " 	 	 H H 4 1 1  / = / . 6 & + 0 - ( .
 
 
 - '&)->-79**-' 6R1& R1je{ eP	*" * n2" n2b	4; 	4	4; 	48{ 86${ $4) 4&S) S0[/ [7, 7<((///*&/(f (D~!v ~!rF   