
    ,hg/                         d 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  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.    )	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_TABLEc                   0    e Zd ZdZ ed      Zed        Zy)CT_GraphicalObjectz
    ``<a:graphic>`` element, which is the container for the reference to or
    definition of the framed graphical object (table, chart, etc.).
    za:graphicDatac                 .    | j                   j                  S )zQ
        The ``<c:chart>`` grandchild element, or |None| if not present.
        )graphicDatachartselfs    [/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/pptx/oxml/shapes/graphfrm.pyr   zCT_GraphicalObject.chart!   s    
 %%%    N)__name__
__module____qualname____doc__r   r   propertyr    r   r   r   r      s%    
  0K& &r   r   c                       e Zd ZdZ ed      Z ed      Z ede      Z	e
d        Ze
d        Ze
d        Ze
d        Ze
d	        Zy
)CT_GraphicalObjectDatazr
    ``<p:graphicData>`` element, the direct container for a table, a chart,
    or another graphical object.
    zc:chartza:tbluric                 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_rId3   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)r&   is_embeddedr   s    r   is_embedded_ole_objz*CT_GraphicalObjectData.is_embedded_ole_obj>   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)r&   progIdr   s    r   r-   zCT_GraphicalObjectData.progIdH   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)r&   
showAsIconr   s    r   r/   z!CT_GraphicalObjectData.showAsIconV   s"     ||+tH1H1HHr   c                 6    | j                  d      }|r|d   S dS )aC  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.//p:oleObjN)xpath)r   oleObjss     r   r&   zCT_GraphicalObjectData._oleObj`   s#     **]+%wr{/4/r   N)r   r   r   r   r   r   tblr   r	   r$   r    r(   r+   r-   r/   r&   r!   r   r   r#   r#   )   s    
 i E
G
C
E9
-CB B J J E E I I 0 0r   r#   c                      e Zd ZdZ ed      Z ed      Z ed      Zed        Z	ed        Z
d Zed        Zed	        Zed
        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zy)CT_GraphicalObjectFramezs
    ``<p:graphicFrame>`` element, which is a container for a table, a chart,
    or another graphical object.
    zp:nvGraphicFramePrzp:xfrmz	a:graphicc                 .    | j                   j                  S )zW
        The ``<c:chart>`` great-grandchild element, or |None| if not present.
        )graphicr   r   s    r   r   zCT_GraphicalObjectFrame.charty   s    
 ||!!!r   c                 8    | j                   }|y|j                  S )zx
        The ``rId`` attribute of the ``<c:chart>`` great-grandchild element,
        or |None| if not present.
        N)r   r'   )r   r   s     r   	chart_rIdz!CT_GraphicalObjectFrame.chart_rId   s     

=yyr   c                     | j                   S )zp
        Return the required ``<p:xfrm>`` child element. Overrides version on
        BaseShapeElement.
        )xfrmr   s    r   get_or_add_xfrmz'CT_GraphicalObjectFrame.get_or_add_xfrm   s    
 yyr   c                 .    | j                   j                  S )z:`<a:graphicData> grandchild of this graphic-frame element.)r8   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.)r8   r   r$   r   s    r   graphicData_uriz'CT_GraphicalObjectFrame.graphicData_uri   s     ||''+++r   c                 <    | j                   j                  t        k(  S )z@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   r+   r   s    r   r+   z+CT_GraphicalObjectFrame.is_embedded_ole_obj   s     333r   c                     t         j                  ||||||      }|j                  j                  }	t        |	_        |	j                  t        j                  |             |S )zd
        Return a ``<p:graphicFrame>`` element tree populated with a chart
        element.
        )	r6   new_graphicFramer8   r   r   r$   appendr   	new_chart)
clsid_namer'   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                 N    | j                         ||||||fz  }t        |      }|S )z
        Return 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.
        )_graphicFrame_tmplr   )	rH   rI   rJ   rK   rL   rM   rN   xmlrO   s	            r   rE   z(CT_GraphicalObjectFrame.new_graphicFrame   s3     $$&#tQ2r)BB ~r   c                 J    t        | j                  ||||||	||||
|            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).
        )r    _graphicFrame_xml_for_ole_object)rH   rI   rJ   ole_object_rIdr-   icon_rIdrK   rL   rM   rN   imgWimgHs               r   new_ole_object_graphicFramez3CT_GraphicalObjectFrame.new_ole_object_graphicFrame   s7     00T1aR4QU
 	
r   c	                     | j                  ||||||      }	t        |	j                  j                  _        |	j                  j                  j                  t        j                  ||||             |	S )zd
        Return a ``<p:graphicFrame>`` element tree populated with a table
        element.
        )rE   r   r8   r   r$   rF   r
   new_tbl)
rH   rI   rJ   rowscolsrK   rL   rM   rN   rO   s
             r   new_table_graphicFramez.CT_GraphicalObjectFrame.new_table_graphicFrame   sd     ++Cq!RD/E((,((//0@0@tRQS0TUr   c                 F    dt        dd      ddddddd	dd
ddddS )Nz<p:graphicFrame apz*>
  <p:nvGraphicFramePr>
    <p:cNvPr id="z%dz" name="z%sz"/>
    <p:cNvGraphicFramePr>
      <a:graphicFrameLocks noGrp="1"/>
    </p:cNvGraphicFramePr>
    <p:nvPr/>
  </p:nvGraphicFramePr>
  <p:xfrm>
    <a:off x="z" y="z"/>
    <a:ext cx="z" cy="zS"/>
  </p:xfrm>
  <a:graphic>
    <a:graphicData/>
  </a:graphic>
</p:graphicFrame>r   )rH   s    r   rR   z*CT_GraphicalObjectFrame._graphicFrame_tmpl   s%    & sC $dD$!F	
r   c                 R    dj                  t        ddd      |||||||||	|
|      S )z@str XML for <a:graphic> element of an embedded OLE-object shape.a  <p:graphicFrame {nsdecls}>
  <p:nvGraphicFramePr>
    <p:cNvPr id="{id_}" name="{name}"/>
    <p:cNvGraphicFramePr>
      <a:graphicFrameLocks noGrp="1"/>
    </p:cNvGraphicFramePr>
    <p:nvPr/>
  </p:nvGraphicFramePr>
  <p:xfrm>
    <a:off x="{x}" y="{y}"/>
    <a:ext cx="{cx}" cy="{cy}"/>
  </p:xfrm>
  <a:graphic>
    <a:graphicData        uri="http://schemas.openxmlformats.org/presentationml/2006/ole">
      <p:oleObj showAsIcon="1"                r:id="{ole_object_rId}"                imgW="{imgW}"                imgH="{imgH}"                progId="{progId}">
        <p:embed/>
        <p:pic>
          <p:nvPicPr>
            <p:cNvPr id="0" name=""/>
            <p:cNvPicPr/>
            <p:nvPr/>
          </p:nvPicPr>
          <p:blipFill>
            <a:blip r:embed="{icon_rId}"/>
            <a:stretch>
              <a:fillRect/>
            </a:stretch>
          </p:blipFill>
          <p:spPr>
            <a:xfrm>
              <a:off x="{x}" y="{y}"/>
              <a:ext cx="{cx}" cy="{cy}"/>
            </a:xfrm>
            <a:prstGeom prst="rect">
              <a:avLst/>
            </a:prstGeom>
          </p:spPr>
        </p:pic>
      </p:oleObj>
    </a:graphicData>
  </a:graphic>
</p:graphicFrame>ra   rb   r)r   rI   rJ   rK   rL   rM   rN   rV   r-   rW   rX   rY   )formatr   )rH   rI   rJ   rK   rL   rM   rN   rV   r-   rW   rX   rY   s               r   rU   z8CT_GraphicalObjectFrame._graphicFrame_xml_for_ole_object   sL    . ^ &Cc*)  
a=	
r   N)r   r   r   r   r   nvGraphicFramePrr<   r8   r    r   r:   r=   r   r@   rB   r+   classmethodrP   rE   rZ   r_   rR   rU   r!   r   r   r6   r6   o   s   
 %%9:"DK(G" "   ( ( , , ? ? 4 4 	 	   
 
(   
 
* A
 A
r   r6   c                   0    e Zd ZdZ ed      Z ed      Zy) CT_GraphicalObjectFrameNonVisualz|`<p:nvGraphicFramePr>` element.

    This contains the non-visual properties of a graphic frame, such as name, id, etc.
    zp:cNvPrzp:nvPrN)r   r   r   r   r   cNvPrnvPrr!   r   r   ri   ri   =  s    
 )$E"Dr   ri   c                   Z    e Zd ZdZ ede      Z ede      Z eded      Z	e
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).
    r-   zr:idr/   F)defaultc                 D    t        | j                  d            dkD  rdS dS )z?True when this OLE object is embedded, False when it is linked.z	./p:embedr   TF)lenr2   r   s    r   r*   zCT_OleObject.is_embeddedQ  s$     4::k23a7tBUBr   N)r   r   r   r   r   r	   r-   r'   r   r/   r    r*   r!   r   r   rm   rm   G  sC    
 x3F
FI
.C"<UKJC Cr   rm   N)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#   r6   ri   rm   r!   r   r   <module>ry      sw    I  *   4 7 $  & & C0- C0LK
. K
\# #C? Cr   