
    li3                    &   d Z ddl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 ddlmZmZ dd	lmZ dd
lmZmZmZmZmZ ddlmZmZmZ er
ddl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$y)zBlxml custom element class for CT_GraphicalObjectFrame XML element.    )annotations)TYPE_CHECKINGcast)	parse_xml)CT_Chart)nsdecls)BaseShapeElement)
XsdBoolean	XsdString)CT_Table)BaseOxmlElementOneAndOnlyOneOptionalAttributeRequiredAttribute	ZeroOrOne)GRAPHIC_DATA_URI_CHARTGRAPHIC_DATA_URI_OLEOBJGRAPHIC_DATA_URI_TABLE)#CT_ApplicationNonVisualDrawingPropsCT_NonVisualDrawingPropsCT_Transform2Dc                  >    e Zd ZU dZ ed      Zded<   edd       Zy)CT_GraphicalObjectz`a:graphic` element.

    The container for the reference to or definition of the framed graphical object (table, chart,
    etc.).
    za:graphicDataCT_GraphicalObjectDatagraphicDatac                .    | j                   j                  S )z;The `c:chart` grandchild element, or |None| if not present.)r   chartselfs    W/var/www/html/eduruby.in/venv/lib/python3.12/site-packages/pptx/oxml/shapes/graphfrm.pyr   zCT_GraphicalObject.chart-   s     %%%    NreturnCT_Chart | None)	__name__
__module____qualname____doc__r   r   __annotations__propertyr    r!   r    r   r   "   s2     +8+K'  & &r!   r   c                      e Zd ZU dZ ed      Zded<    ed      Zded<    ede	      Z
d	ed<   edd
       Zedd       Zedd       Zedd       Zedd       Zy)r   zj`p:graphicData` element.

    The direct container for a table, a chart, or another graphical object.
    zc:chartr$   r   za:tblzCT_Table | Nonetbluristrc                J    | j                   dS | j                   j                  S )a  Optional `r:id` attribute value of `p:oleObj` descendent element.

        This value is `None` when this `p:graphicData` element does not enclose an OLE object.
        This value could also be `None` if an enclosed OLE object does not specify this attribute
        (it is specified optional in the schema) but so far, all OLE objects we've encountered
        specify this value.
        N)_oleObjrIdr   s    r    blob_rIdzCT_GraphicalObjectData.blob_rId=   s"     ||+tA1A1AAr!   c                J    | j                   dS | j                   j                  S )zOptional boolean indicating an embedded OLE object.

        Returns `None` when this `p:graphicData` element does not enclose an OLE object. `True`
        indicates an embedded OLE object and `False` indicates a linked OLE object.
        N)r1   is_embeddedr   s    r    is_embedded_ole_objz*CT_GraphicalObjectData.is_embedded_ole_objH   s"     ||+tI1I1IIr!   c                J    | j                   dS | j                   j                  S )a  Optional str value of "progId" attribute of `p:oleObj` descendent.

        This value identifies the "type" of the embedded object in terms of the application used
        to open it.

        This value is `None` when this `p:graphicData` element does not enclose an OLE object.
        This could also be `None` if an enclosed OLE object does not specify this attribute (it is
        specified optional in the schema) but so far, all OLE objects we've encountered specify
        this value.
        N)r1   progIdr   s    r    r8   zCT_GraphicalObjectData.progIdQ   s"     ||+tD1D1DDr!   c                J    | j                   dS | j                   j                  S )a  Optional value of "showAsIcon" attribute value of `p:oleObj` descendent.

        This value is `None` when this `p:graphicData` element does not enclose an OLE object. It
        is False when the `showAsIcon` attribute is omitted on the `p:oleObj` element.
        N)r1   
showAsIconr   s    r    r:   z!CT_GraphicalObjectData.showAsIcon_   s"     ||+tH1H1HHr!   c                J    t        d| j                  d            }|r|d   S dS )a?  Optional `p:oleObj` element contained in this `p:graphicData' element.

        Returns `None` when this graphic-data element does not enclose an OLE object. Note that
        this returns the last `p:oleObj` element found. There can be more than one `p:oleObj`
        element because an `mc.AlternateContent` element may appear as the child of
        `p:graphicData` and that alternate-content subtree can contain multiple compatibility
        choices. The last one should suit best for reading purposes because it contains the lowest
        common denominator.
        zlist[CT_OleObject]z.//p:oleObjN)r   xpath)r   oleObjss     r    r1   zCT_GraphicalObjectData._oleObjh   s+     +TZZ-FG%wr{/4/r!   Nr#   
str | Noner#   zbool | None)r#   zCT_OleObject | None)r%   r&   r'   r(   r   r   r)   r-   r   r   r.   r*   r3   r6   r8   r:   r1   r+   r!   r    r   r   3   s    
 'y1E?1$W-C- 	2C2B B J J E E I I 0 0r!   r   c                     e Zd ZU dZ ed      Zded<    ed      Zded<    ed      Zd	ed
<   e	dd       Z
e	dd       ZddZe	dd       Ze	dd       Ze	dd       Ze	dd       Ze	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd       Ze	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd       Ze	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d d       Ze	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d!d       Zy)"CT_GraphicalObjectFramezb`p:graphicFrame` element.

    A container for a table, a chart, or another graphical object.
    zp:nvGraphicFramePr CT_GraphicalObjectFrameNonVisualnvGraphicFramePrzp:xfrmr   xfrmz	a:graphicr   graphicc                .    | j                   j                  S )zAThe `c:chart` great-grandchild element, or |None| if not present.)rG   r   r   s    r    r   zCT_GraphicalObjectFrame.chart   s     ||!!!r!   c                8    | j                   }|y|j                  S )zgThe `rId` attribute of the `c:chart` great-grandchild element.

        |None| if not present.
        N)r   r2   )r   r   s     r    	chart_rIdz!CT_GraphicalObjectFrame.chart_rId   s     

=yyr!   c                    | j                   S )zdReturn the required `p:xfrm` child element.

        Overrides version on BaseShapeElement.
        )rF   r   s    r    get_or_add_xfrmz'CT_GraphicalObjectFrame.get_or_add_xfrm   s    
 yyr!   c                .    | j                   j                  S )z9`a:graphicData` grandchild of this graphic-frame element.)rG   r   r   s    r    r   z#CT_GraphicalObjectFrame.graphicData   s     ||'''r!   c                B    | j                   j                  j                  S )z;str value of `uri` attribute of `a:graphicData` grandchild.)rG   r   r.   r   s    r    graphicData_uriz'CT_GraphicalObjectFrame.graphicData_uri   s     ||''+++r!   c                <    | j                   j                  t        k(  S )zD`True` for graphicFrame containing an OLE object, `False` otherwise.)r   r.   r   r   s    r    
has_oleobjz"CT_GraphicalObjectFrame.has_oleobj   s     ##'>>>r!   c                .    | j                   j                  S )zOptional boolean indicating an embedded OLE object.

        Returns `None` when this `p:graphicFrame` element does not enclose an OLE object. `True`
        indicates an embedded OLE object and `False` indicates a linked OLE object.
        )r   r6   r   s    r    r6   z+CT_GraphicalObjectFrame.is_embedded_ole_obj   s     333r!   c                    t         j                  ||||||      }|j                  j                  }	t        |	_        |	j                  t        j                  |             |S )zFReturn a `p:graphicFrame` element tree populated with a chart element.)	rC   new_graphicFramerG   r   r   r.   appendr   	new_chart)
clsid_namer2   xycxcygraphicFramer   s
             r    new_chart_graphicFramez.CT_GraphicalObjectFrame.new_chart_graphicFrame   sW    
 /??T1aQSUWX"**6608--c23r!   c                t    t        t        t        dt        dd       d| d| d| d| d| d	| d
            S )zReturn a new `p:graphicFrame` element tree suitable for containing a table or chart.

        Note that a graphicFrame element is not a valid shape until it contains a graphical object
        such as a table.
        <p:graphicFrame ap*>
  <p:nvGraphicFramePr>
    <p:cNvPr id="" name=""/>
    <p:cNvGraphicFramePr>
      <a:graphicFrameLocks noGrp="1"/>
    </p:cNvGraphicFramePr>
    <p:nvPr/>
  </p:nvGraphicFramePr>
  <p:xfrm>
    <a:off x="" y=""/>
    <a:ext cx="" cy="zS"/>
  </p:xfrm>
  <a:graphic>
    <a:graphicData/>
  </a:graphic>
</p:graphicFrame>)r   rC   r   r   )rW   rX   rY   rZ   r[   r\   r]   s          r    rT   z(CT_GraphicalObjectFrame.new_graphicFrame   sg     #"73#4"5 6$$'5 7! "#5 ,""$VB4 0$%
 	
r!   c                   t        t        t        dj                  g dt	        ddd       d| d| d| d	| d
| d|	 d| d|
 d| d| d| d| d	| d| d|	 d                  S )a  Return newly-created `p:graphicFrame` for embedded OLE-object.

        `ole_object_rId` identifies the relationship to the OLE-object part.

        `progId` is a str identifying the object-type in terms of the application (program) used
        to open it. This becomes an attribute of the same name in the `p:oleObj` element.

        `icon_rId` identifies the relationship to an image part used to display the OLE-object as
        an icon (vs. a preview).
         ra   rb   rc   rrd   re   rf   rg   rh   ri   z"/>
  </p:xfrm>
  <a:graphic>
    <a:graphicData        uri="http://schemas.openxmlformats.org/presentationml/2006/ole">
      <p:oleObj showAsIcon="1"                r:id="z"                imgW="z"                imgH="z"                progId="z">
        <p:embed/>
        <p:pic>
          <p:nvPicPr>
            <p:cNvPr id="0" name=""/>
            <p:cNvPicPr/>
            <p:nvPr/>
          </p:nvPicPr>
          <p:blipFill>
            <a:blip r:embed="z"/>
            <a:stretch>
              <a:fillRect/>
            </a:stretch>
          </p:blipFill>
          <p:spPr>
            <a:xfrm>
              <a:off x="z"/>
              <a:ext cx="z"/>
            </a:xfrm>
            <a:prstGeom prst="rect">
              <a:avLst/>
            </a:prstGeom>
          </p:spPr>
        </p:pic>
      </p:oleObj>
    </a:graphicData>
  </a:graphic>
</p:graphicFrame>)r   rC   r   joinr   )rW   rX   rY   ole_object_rIdr8   icon_rIdrZ   r[   r\   r]   imgWimgHs               r    new_ole_object_graphicFramez3CT_GraphicalObjectFrame.new_ole_object_graphicFrame   s   2 #.% .%" .%73S#9": .% ;$ .%$'5.%(0.%15.%7!.% "#.% $).% *+.%,".% #%.% &,.% -/4.%0).%  *8(8!.% 9)!.%" *.#.%"/)#.%$ *.%.%$/+%.%& ,2('.%&	30'.%8 19z9.%8:+9.%F ,-#G.%F .3G.%F 45#G.%F6,G.%H -/4I.%H 06I.%H 79TI.%H
:$I.%03
 3	
r!   c	                    | j                  ||||||      }	t        |	j                  j                  _        |	j                  j                  j                  t        j                  ||||             |	S )zFReturn a `p:graphicFrame` element tree populated with a table element.)rT   r   rG   r   r.   rU   r   new_tbl)
rW   rX   rY   rowscolsrZ   r[   r\   r]   r^   s
             r    new_table_graphicFramez.CT_GraphicalObjectFrame.new_table_graphicFrame,  sd    
 ++Cq!RD/E((,((//0@0@tRQS0TUr!   Nr"   r?   )r#   r   )r#   r   )r#   r/   r#   boolrA   )rX   intrY   r/   r2   r/   rZ   rz   r[   rz   r\   rz   r]   rz   r#   rC   )rX   rz   rY   r/   rZ   rz   r[   rz   r\   rz   r]   rz   r#   rC   )rX   rz   rY   r/   rn   r/   r8   r/   ro   r/   rZ   rz   r[   rz   r\   rz   r]   rz   rp   rz   rq   rz   r#   rC   )rX   rz   rY   r/   ru   rz   rv   rz   rZ   rz   r[   rz   r\   rz   r]   rz   r#   rC   )r%   r&   r'   r(   r   rE   r)   rF   rG   r*   r   rJ   rL   r   rO   rQ   r6   classmethodr_   rT   rr   rw   r+   r!   r    rC   rC   w   sW    	*+ 6  )2D.2"/#G  " "   ( ( , , ? ? 4 4  '*/27:@CIL	   

 
%(
-0
69
?B
	 
 
< K
K
 K
 	K

 K
 K
 K
 K
 K
 K
 K
 K
 
!K
 K
Z  (+36;>CFLOUX	  r!   rC   c                  F    e Zd ZU dZ ed      Zded<    ed      Zded<   y)	rD   zz`p:nvGraphicFramePr` element.

    This contains the non-visual properties of a graphic frame, such as name, id, etc.
    zp:cNvPrr   cNvPrzp:nvPrr   nvPrN)r%   r&   r'   r(   r   r}   r)   r~   r+   r!   r    rD   rD   7  s5    
 '4'E#  	h 	
- r!   rD   c                  |    e Zd ZU dZ ede      Zded<    ede      Zded<    ede	d      Z
d	ed<   edd
       Zy)CT_OleObjectz`p:oleObj` element, container for an OLE object (e.g. Excel file).

    An OLE object can be either linked or embedded (hence the name).
    r8   r@   zr:idr2   r:   F)defaultry   c                <    t        | j                  d            dkD  S )z?True when this OLE object is embedded, False when it is linked.z	./p:embedr   )lenr=   r   s    r    r5   zCT_OleObject.is_embeddedS  s     4::k*+a//r!   Nrx   )r%   r&   r'   r(   r   r   r8   r)   r2   r
   r:   r*   r5   r+   r!   r    r   r   E  s^    
 +)FJ  (	:C:(j%J  0 0r!   r   N)%r(   
__future__r   typingr   r   	pptx.oxmlr   pptx.oxml.chart.chartr   pptx.oxml.nsr   pptx.oxml.shapes.sharedr	   pptx.oxml.simpletypesr
   r   pptx.oxml.tabler   pptx.oxml.xmlchemyr   r   r   r   r   	pptx.specr   r   r   r   r   r   r   r   rC   rD   r   r+   r!   r    <module>r      s    H " &  *   4 7 $    & &"A0- A0H}. }@ 0? 0r!   