
    hi8                     ^    d Z ddlmZmZ ddlmZ  G d de          Z G d de          ZdS )	zTabstop-related proxy types.    )WD_TAB_ALIGNMENTWD_TAB_LEADER)ElementProxyc                   `     e Zd ZdZ fdZd Zd Zd Zd Ze	j
        ej        fdZd Z xZS )	TabStopsa6  A sequence of |TabStop| objects providing access to the tab stops of a paragraph
    or paragraph style.

    Supports iteration, indexed access, del, and len(). It is accesed using the
    :attr:`~.ParagraphFormat.tab_stops` property of ParagraphFormat; it is not intended
    to be constructed directly.
    c                 h    t          t          |                               |d            || _        d S N)superr   __init___pPrselfelement	__class__s     j/var/www/development/aibuddy-work/election-extract/venv/lib/python3.11/site-packages/docx/text/tabstops.pyr   zTabStops.__init__   s.    h&&w555			    c                     | j         j        }	 |                    ||                    n$# t          t          f$ r t	          d          w xY wt          |          dk    r| j                             |           dS dS )z0Remove the tab at offset `idx` in this sequence.ztab index out of ranger   N)r   tabsremoveAttributeError
IndexErrorlen)r   idxr   s      r   __delitem__zTabStops.__delitem__   s    y~	7KKS	""""
+ 	7 	7 	75666	7 t99>>IT""""" >s	   * !Ac                 t    | j         j        }|t          d          |j        |         }t	          |          S )z#Enables list-style access by index.NzTabStops object is empty)r   r   r   tab_lstTabStop)r   r   r   tabs       r   __getitem__zTabStops.__getitem__   s7    y~<7888l3s||r   c              #   `   K   | j         j        }||j        D ]}t          |          V  dS dS )zXGenerate a TabStop object for each of the w:tab elements, in XML document
        order.N)r   r   r   r   )r   r   r   s      r   __iter__zTabStops.__iter__'   sO       y~| # #cll"""" # #r   c                 J    | j         j        }|dS t          |j                  S )Nr   )r   r   r   r   )r   r   s     r   __len__zTabStops.__len__/   s%    y~<14<   r   c                     | j                                         }|                    |||          }t          |          S )a  Add a new tab stop at `position`, a |Length| object specifying the location
        of the tab stop relative to the paragraph edge.

        A negative `position` value is valid and appears in hanging indentation. Tab
        alignment defaults to left, but may be specified by passing a member of the
        :ref:`WdTabAlignment` enumeration as `alignment`. An optional leader character
        can be specified by passing a member of the :ref:`WdTabLeader` enumeration as
        `leader`.
        )r   get_or_add_tabsinsert_tab_in_orderr   )r   position	alignmentleaderr   r   s         r   add_tab_stopzTabStops.add_tab_stop5   s:     y((**&&xFCCs||r   c                 8    | j                                          dS )zRemove all custom tab stops.N)r   _remove_tabsr   s    r   	clear_allzTabStops.clear_allC   s    	     r   )__name__
__module____qualname____doc__r   r   r   r!   r#   r   LEFTr   SPACESr*   r.   __classcell__r   s   @r   r   r      s             	# 	# 	#  # # #! ! ! 0@/D]Ma    ! ! ! ! ! ! !r   r   c                        e Zd ZdZ fdZed             Zej        d             Zed             Zej        d             Zed             Z	e	j        d             Z	 xZ
S )	r   zAn individual tab stop applying to a paragraph or style.

    Accessed using list semantics on its containing |TabStops| object.
    c                 h    t          t          |                               |d            || _        d S r	   )r
   r   r   _tabr   s     r   r   zTabStop.__init__N   s.    gt%%gt444			r   c                     | j         j        S )z{A member of :ref:`WdTabAlignment` specifying the alignment setting for this
        tab stop.

        Read/write.
        r9   valr-   s    r   r(   zTabStop.alignmentR        y}r   c                     || j         _        d S r	   r;   r   values     r   r(   zTabStop.alignment[   s    	r   c                     | j         j        S )zA member of :ref:`WdTabLeader` specifying a repeating character used as a
        "leader", filling in the space spanned by this tab.

        Assigning |None| produces the same result as assigning `WD_TAB_LEADER.SPACES`.
        Read/write.
        r9   r)   r-   s    r   r)   zTabStop.leader_   s     yr   c                     || j         _        d S r	   rB   r?   s     r   r)   zTabStop.leaderi   s     	r   c                     | j         j        S )zA |Length| object representing the distance of this tab stop from the inside
        edge of the paragraph.

        May be positive or negative. Read/write.
        )r9   posr-   s    r   r'   zTabStop.positionm   r=   r   c                     | j         }|                                }|                    ||j        |j                  | _         |                    |           d S r	   )r9   	getparentr&   r<   r)   r   )r   r@   r   r   s       r   r'   zTabStop.positionv   sK    i}},,UCGSZHH	Cr   )r/   r0   r1   r2   r   propertyr(   setterr)   r'   r5   r6   s   @r   r   r   H   s         
       X        X  ]! ! ]!   X _  _    r   r   N)r2   docx.enum.textr   r   docx.sharedr   r   r    r   r   <module>rM      s    " " : : : : : : : : $ $ $ $ $ $>! >! >! >! >!| >! >! >!B3 3 3 3 3l 3 3 3 3 3r   