o
    jj                     @  s   d Z ddlmZ ddlmZ ddlmZ ddlmZm	Z	m
Z
mZmZ ddlmZmZmZmZ G dd deZG d	d
 d
eZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZdS )zShared oxml objects for charts.    )annotations)	parse_xml)nsdecls)ST_LayoutMode
XsdBoolean	XsdDouble	XsdStringXsdUnsignedInt)BaseOxmlElementOptionalAttributeRequiredAttribute	ZeroOrOnec                   @  s   e Zd ZdZededdZdS )
CT_BooleanzJ
    Common complex type used for elements having a True/False value.
    valTdefaultN)__name__
__module____qualname____doc__r   r   r    r   r   V/home/air/Certificate/back/venv/lib/python3.10/site-packages/pptx/oxml/chart/shared.pyr      s    r   c                   @  s8   e Zd ZdZededdZedd Zej	dd ZdS )	CT_Boolean_Explicita  Always spells out the `val` attribute, e.g. `val=1`.

    At least one boolean element is improperly interpreted by one or more
    versions of PowerPoint. The `c:overlay` element is interpreted as |False|
    when no `val` attribute is present, contrary to the behavior described in
    the schema. A remedy for this is to interpret a missing `val` attribute
    as |True| (consistent with the spec), but always write the attribute
    whenever there is occasion for changing the element.
    r   Tr   c                 C  s   | j S )N)_valselfr   r   r   r   +   s   zCT_Boolean_Explicit.valc                 C  s$   t |du rdnd}| d| d S )NT10r   )boolset)r   valueval_strr   r   r   r   /   s   N)
r   r   r   r   r   r   r   propertyr   setterr   r   r   r   r      s    

r   c                   @     e Zd ZdZedeZdS )	CT_Doublez)
    Used for floating point values.
    r   N)r   r   r   r   r   r   r   r   r   r   r   r%   5       r%   c                   @  s6   e Zd ZdZedddZedd Zejdd ZdS )		CT_Layoutz-
    ``<c:layout>`` custom element class
    zc:manualLayout)c:extLst
successorsc                 C  s   | j }|du r	dS |jS )z
        The float value in ./c:manualLayout/c:x when
        c:layout/c:manualLayout/c:xMode@val == "factor". 0.0 if that XPath
        expression finds no match.
        N        )manualLayouthorz_offset)r   r,   r   r   r   r-   D   s   zCT_Layout.horz_offsetc                 C  s&   |dkr
|    dS |  }||_dS )z
        Set the value of ./c:manualLayout/c:x@val to *offset* and
        ./c:manualLayout/c:xMode@val to "factor". Remove ./c:manualLayout if
        *offset* == 0.
        r+   N)_remove_manualLayoutget_or_add_manualLayoutr-   )r   offsetr,   r   r   r   r-   P   s
   
N)	r   r   r   r   r   r,   r"   r-   r#   r   r   r   r   r'   =   s    
r'   c                   @  s    e Zd ZdZedeejdZdS )CT_LayoutModezx
    Used for ``<c:xMode>``, ``<c:yMode>``, ``<c:wMode>``, and ``<c:hMode>``
    child elements of CT_ManualLayout.
    r   r   N)r   r   r   r   r   r   FACTORr   r   r   r   r   r1   ^   s    r1   c                   @  sX   e Zd ZdZdZededd dZededd dZ[ed	d
 Z	e	j
dd
 Z	dS )CT_ManualLayoutz3
    ``<c:manualLayout>`` custom element class
    )
zc:layoutTargetc:xModezc:yModezc:wModezc:hModec:xzc:yzc:wzc:hr(   r4      Nr)   r5      c                 C  s4   | j | j}}|du s|du s|jtjkrdS |jS )z
        The float value in ./c:x@val when ./c:xMode@val == "factor". 0.0 when
        ./c:x is not present or ./c:xMode@val != "factor".
        Nr+   )xxModer   r   r2   )r   r8   r9   r   r   r   r-   |   s   zCT_ManualLayout.horz_offsetc                 C  s   t j|  _||  _dS )zW
        Set the value of ./c:x@val to *offset* and ./c:xMode@val to "factor".
        N)r   r2   get_or_add_xModer   get_or_add_x)r   r0   r   r   r   r-      s   )r   r   r   r   _tag_seqr   r9   r8   r"   r-   r#   r   r   r   r   r3   g   s    

r3   c                   @  s$   e Zd ZdZedeZedeZ	dS )	CT_NumFmtzn
    ``<c:numFmt>`` element specifying the formatting for number labels on a
    tick mark or data point.
    
formatCodesourceLinkedN)
r   r   r   r   r   r   r>   r   r   r?   r   r   r   r   r=      s    
r=   c                   @  s^   e Zd ZdZdZededd dZededd dZ[d	d
 Ze	dd Z
edd ZdS )CT_Titlez`c:title` custom element class.)c:txzc:layoutz	c:overlayc:spPrzc:txPrr(   rA      Nr)   rB      c                 C  s   |   }|  | S )aq  Return `c:tx/c:rich`, newly created if not present.

        Return the `c:rich` grandchild at `c:tx/c:rich`. Both the `c:tx` and
        `c:rich` elements are created if not already present. Any
        `c:tx/c:strRef` element is removed. (Such an element would contain
        a cell reference for the axis title text in the chart's Excel
        worksheet.)
        )get_or_add_tx_remove_strRefget_or_add_rich)r   txr   r   r   get_or_add_tx_rich   s   	zCT_Title.get_or_add_tx_richc                 C  s   |  d}|s	dS |d S )z.Return `c:tx/c:rich` or |None| if not present.zc:tx/c:richNr   )xpath)r   richsr   r   r   tx_rich   s   
zCT_Title.tx_richc                   C  s   t dtd S )z=Return "loose" `c:title` element containing default children.z9<c:title %s>  <c:layout/>  <c:overlay val="0"/></c:title>cr   r   r   r   r   r   	new_title   s   
zCT_Title.new_title)r   r   r   r   r<   r   rH   spPrrI   r"   rL   staticmethodrO   r   r   r   r   r@      s    
r@   c                   @  s(   e Zd ZdZedZedZdd ZdS )CT_Txze
    ``<c:tx>`` element containing the text for a label on a data point or
    other chart item.
    zc:strRefzc:richc                 C  s   t dtdd S )Nzg<c:rich %s>  <a:bodyPr/>  <a:lstStyle/>  <a:p>    <a:pPr>      <a:defRPr/>    </a:pPr>  </a:p></c:rich>rM   arN   r   r   r   r   	_new_rich   s
   zCT_Tx._new_richN)r   r   r   r   r   strRefrichrT   r   r   r   r   rR      s
    rR   c                   @  r$   )CT_UnsignedIntz)
    ``<c:idx>`` element and others.
    r   N)r   r   r   r   r   r	   r   r   r   r   r   rW      r&   rW   N)r   
__future__r   	pptx.oxmlr   pptx.oxml.nsr   pptx.oxml.simpletypesr   r   r   r   r	   pptx.oxml.xmlchemyr
   r   r   r   r   r   r%   r'   r1   r3   r=   r@   rR   rW   r   r   r   r   <module>   s     !	)
%