
    ~Zi8O                    $   S r SSKJr  SSKrSSKJrJrJr  SSKJ	r	  SSK
JrJr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JrJrJrJrJrJrJrJ r   SSK!J"r"J#r#J$r$J%r%J&r&J'r'J(r(J)r)J*r*  SSK+J,r,J-r-  \(       a  SSK.J/r/   " S S\"5      r0 " S S\"5      r1 " S S\"5      r2 " S S\"5      r3 " S S\"5      r4 " S S\"5      r5 " S S\"5      r6 " S S\"5      r7 " S S \"5      r8 " S! S"\"5      r9 " S# S$\"5      r: " S% S&\"5      r; " S' S(\"5      r<g))z4Custom element classes for text-related XML elements    )annotationsN)TYPE_CHECKINGCallablecast)MSO_LANGUAGE_ID)MSO_AUTO_SIZEMSO_TEXT_UNDERLINE_TYPEMSO_VERTICAL_ANCHORPP_PARAGRAPH_ALIGNMENT)InvalidXmlError)	parse_xml)CT_GradientFillPropertiesnsdecls)	ST_Coordinate32&ST_TextFontScalePercentOrPercentStringST_TextFontSizeST_TextIndentLevelType$ST_TextSpacingPercentOrPercentStringST_TextSpacingPointST_TextTypefaceST_TextWrappingType
XsdBoolean)	BaseOxmlElementChoiceOneAndOnlyOne	OneOrMoreOptionalAttributeRequiredAttribute
ZeroOrMore	ZeroOrOneZeroOrOneChoice)EmuLength)CT_Hyperlinkc                      \ rS rSr% SrS\S'   \" SSS9rS\S	'   \" S
5      r	S\S'   \
SS j5       r\R                  SS j5       r\SS j5       rSrg)CT_RegularTextRun/   z`a:r` custom element class(Callable[[], CT_TextCharacterProperties]get_or_add_rPra:rPr)a:t
successors!CT_TextCharacterProperties | NonerPrr,   r   tc                D    U R                   R                  nU=(       d    S$ )z#All text of (required) `a:t` child. r1   text)selfr5   s     h/var/www/eduai.edurigo.com/question_generate/ques_gen_env/lib/python3.13/site-packages/pptx/oxml/text.pyr5   CT_RegularTextRun.text9   s     vv{{zr    c                D    U R                  U5      U R                  l        g N)_escape_ctrl_charsr1   r5   r6   values     r7   r5   r8   @   s    --e4r9   c                4    [         R                  " SS U 5      $ )zReturn str after replacing each control character with a plain-text escape.

For example, a BEL character (x07) would appear as "_x0007_". Horizontal-tab
(x09) and line-feed (x0A) are not escaped. All other characters in the range
x00-x1F are escaped.
z([\x00-\x08\x0B-\x1F])c                <    S[        U R                  S5      5      -  $ )Nz_x%04X_   )ordgroup)matchs    r7   <lambda>6CT_RegularTextRun._escape_ctrl_chars.<locals>.<lambda>L   s    y3u{{[\~K^?^r9   )resub)ss    r7   r<   $CT_RegularTextRun._escape_ctrl_charsD   s     vv/1^`abbr9    Nreturnstr)r>   rN   )rI   rN   rM   rN   )__name__
__module____qualname____firstlineno____doc____annotations__r!   r0   r   r1   propertyr5   setterstaticmethodr<   __static_attributes__rK   r9   r7   r'   r'   /   ss    $<<-6H.C	*  'u-A-  
[[5 5 c cr9   r'   c                  
   \ rS rSr% SrS\S'   S\S'   \" S5      rS\S	'   \" S
5      r	S\S'   S r
\SS j5       r\SS j5       r\S 5       r\SS j5       r\S 5       r\S 5       rS r\S 5       r\S 5       r\S 5       rSrg)CT_TextBodyO   z_`p:txBody` custom element class.

Also used for `c:txPr` in charts and perhaps other elements.
zCallable[[], CT_TextParagraph]add_pzlist[CT_TextParagraph]p_lstza:bodyPrCT_TextBodyPropertiesbodyPrza:pCT_TextParagraphpc                L    U R                    H  nU R                  U5        M     g)zqRemove all `a:p` children, but leave any others.

cf. lxml `_Element.clear()` method which removes all children.
N)r]   remove)r6   ra   s     r7   clear_contentCT_TextBody.clear_content]   s    
 AKKN r9   c                d    U R                   S   nUR                  5       nUR                  5       nU$ )z`a:defRPr` element of required first `p` child, added with its ancestors if not present.

Used when element is a ``c:txPr`` in a chart and the `p` element is used only to specify
formatting, not content.
r   )r]   get_or_add_pPrget_or_add_defRPr)r6   ra   pPrdefRPrs       r7   rj   CT_TextBody.defRPre   s2     JJqM &&(r9   c                    U R                   n[        U5      S:  a  gU(       d  [        S5      eUS   R                  S:w  a  gg)z5True if only a single empty `a:p` element is present.rA   Fz#p:txBody must have at least one a:pr   r3   T)r]   lenr   r5   )r6   pss     r7   is_emptyCT_TextBody.is_emptyq   s@     ZZr7Q;!"GHHa5::r9   c                <    U R                  5       n[        U5      nU$ )z%Return a new `p:txBody` element tree.)_txBody_tmplr   clsxmltxBodys      r7   newCT_TextBody.new   s       3r9   c                X    U R                  5       n[        [        [        U5      5      nU$ )zgReturn a new `a:txBody` element tree.

Suitable for use in a table cell and possibly other situations.
)_a_txBody_tmplr   rZ   r   rs   s      r7   new_a_txBodyCT_TextBody.new_a_txBody   s'       "k9S>2r9   c                8    U R                  5       n[        U5      $ )zLReturn a new `p:txBody` element tree, suitable for use in an `p:sp` element.)_p_txBody_tmplr   )rt   ru   s     r7   new_p_txBodyCT_TextBody.new_p_txBody   s       "~r9   c                :    S[        SS5      -  n[        U5      nU$ )zeReturn a `c:txPr` element tree.

Suitable for use in a chart object like data labels or tick labels.
zp<c:txPr %s>
  <a:bodyPr/>
  <a:lstStyle/>
  <a:p>
    <a:pPr>
      <a:defRPr/>
    </a:pPr>
  </a:p>
</c:txPr>
car   r   )rt   ru   txPrs      r7   new_txPrCT_TextBody.new_txPr   s*     C
 ~r9   c                X    [        U R                  5      S:  a  gU R                  5         g)zEnsure p:txBody has at least one a:p child.

Intuitively, reverse a ".clear_content()" operation to minimum conformance with spec
(single empty paragraph).
r   N)rm   r]   r\   r6   s    r7   unclear_contentCT_TextBody.unclear_content   s      tzz?Q

r9   c                    S[        S5      -  $ )Nz1<a:txBody %s>
  <a:bodyPr/>
  <a:p/>
</a:txBody>
r   r   rt   s    r7   rz   CT_TextBody._a_txBody_tmpl   s    OSZ[^S_``r9   c                     S[        SS5      -  $ )Nz1<p:txBody %s>
  <a:bodyPr/>
  <a:p/>
</p:txBody>
ra   r   r   r   s    r7   r~   CT_TextBody._p_txBody_tmpl   s     MPWX[]`Pab	
r9   c                     S[        SS5      -  $ )NzA<p:txBody %s>
  <a:bodyPr/>
  <a:lstStyle/>
  <a:p/>
</p:txBody>
r   ra   r   r   s    r7   rr   CT_TextBody._txBody_tmpl   s      'sC0	2	
r9   rK   N)rM   CT_TextCharacterProperties)rM   bool)rM   rZ   )rO   rP   rQ   rR   rS   rT   r   r_   r   ra   rd   rU   rj   ro   classmethodrw   r{   r   r   r   rz   r~   rr   rX   rK   r9   r7   rZ   rZ   O   s    
 *)!!$1%F!  $E*A* 	 	        
  & a a 
 

 
 
r9   rZ   c                     \ rS rSr% SrS\S'   S\S'   S\S'   S\S	'   S
\S'   S\S'   S
\S'   \" \" S5      \" S5      \" S5      4SS9r\	" S\
\" S5      S9rS\S'   \	" S\
\" S5      S9rS\S'   \	" S\
\" S5      S9rS\S'   \	" S\
\" S5      S9rS\S'   \	" S\5      rS\S'   \	" S\5      rS\S'   \S  5       r\R,                  S$S! j5       rS"rg#)%r^      z `a:bodyPr` custom element class.zCallable[[], BaseOxmlElement]_add_noAutofitz"Callable[[], CT_TextNormalAutofit]_add_normAutofit_add_spAutoFitCallable[[], None]_remove_eg_textAutoFitBaseOxmlElement | None	noAutofitzCT_TextNormalAutofit | NonenormAutofit	spAutoFitza:noAutofitza:normAutofitza:spAutoFit)z	a:scene3dza:sp3dza:flatTxa:extLstr-   lInsi0e defaultr$   tInsi  rInsbInsanchorzMSO_VERTICAL_ANCHOR | Nonewrap
str | Nonec                    U R                   b  [        R                  $ U R                  b  [        R                  $ U R
                  b  [        R                  $ g)zTThe autofit setting for the text frame, a member of the `MSO_AUTO_SIZE` enumeration.N)r   r   NONEr   TEXT_TO_FIT_SHAPEr   SHAPE_TO_FIT_TEXTr   s    r7   autofitCT_TextBodyProperties.autofit   sK     >>% %%%' 222>>% 222r9   c                8   Ub  U[         ;  a  [        SU 35      eU R                  5         U[         R                  :X  a  U R	                  5         g U[         R
                  :X  a  U R                  5         g U[         R                  :X  a  U R                  5         g g )Nzmonly None or a member of the MSO_AUTO_SIZE enumeration can be assigned to CT_TextBodyProperties.autofit, got )	r   
ValueErrorr   r   r   r   r   r   r   r=   s     r7   r   r      s    m!;77<g?  	##%M&&&!m555!!#m555! 6r9   rK   N)r>   zMSO_AUTO_SIZE | None)rO   rP   rQ   rR   rS   rT   r"   r   eg_textAutoFitr   r   r#   r   r   r   r   r
   r   r   r   rU   r   rV   rX   rK   r9   r7   r^   r^      s,   *118811..%%,,%%$		 79NOBN %UD&  %UD&  %UD&  %UD&  *;%*F&  )#D*    ^^" "r9   r^   c            
      p   \ rS rSr% SrS\S'   S\S'   S\S'   S\S	'   \" \" S
5      \" S5      \" S5      \" S5      \" S5      \" S5      4SS9r\	" SSS9r
S\S'   \	" SSS9rS\S'   \" S\5      rS\S'   \" S\5      rS\S'   \" S\5      rS\S'   \" S \5      rS\S '   \" S!\5      rS"\S!'   S# rS'S$ jrS%rg&)(r   i  zCustom element class for `a:rPr`, `a:defRPr`, and `a:endParaRPr`.

'rPr' is short for 'run properties', and it corresponds to the |Font| proxy class.
zCallable[[], CT_Hyperlink]get_or_add_hlinkClickzCallable[[], CT_TextFont]get_or_add_latinr   _remove_latin_remove_hlinkClickza:noFillza:solidFillz
a:gradFillz
a:blipFillz
a:pattFillz	a:grpFill)za:effectLstza:effectDagza:highlightza:uLnTxza:uLnz	a:uFillTxza:uFilla:latina:eaa:csa:syma:hlinkClicka:hlinkMouseOvera:rtlr   r-   r   )r   r   r   r   r   r   r   zCT_TextFont | Nonelatinr   )r   r   r   zCT_Hyperlink | None
hlinkClicklangzMSO_LANGUAGE_ID | Noneszz
int | Nonebzbool | NoneiuzMSO_TEXT_UNDERLINE_TYPE | Nonec                ,    [         R                  " 5       $ r;   )r   new_gradFillr   s    r7   _new_gradFill(CT_TextCharacterProperties._new_gradFillI  s    (5577r9   c                2    U R                  5       nXl        U$ )zEAdd an `a:hlinkClick` child element with r:id attribute set to `rId`.)r   rId)r6   r   r   s      r7   add_hlinkClick)CT_TextCharacterProperties.add_hlinkClickL  s    //1
r9   rK   N)r   rN   rM   r%   )rO   rP   rQ   rR   rS   rT   r"   r   eg_fillPropertiesr!   r   r   r   r   r   r   r   r   r   r   r	   r   r   r   rX   rK   r9   r7   r   r     s   
 65//%%**':=!< < < ;	

6 !*
!E  '0#L'J#  $5$D
   'oB
  'sJ7A{7&sJ7A{7(9$)A% 8r9   r   c                  h    \ rS rSr% SrS\S'   \" SSS9rS\S	'   \" S
SS9rS\S'   \	SS j5       r
Srg)CT_TextFieldiS  z?`a:fld` field element, for either a slide number or date field.r)   r*   r+   )a:pPrr,   r-   r/   r0   r,   rK   r   r1   c                L    U R                   nUc  gUR                  =(       d    S$ )z$The text of the `a:t` child element.r3   r4   )r6   r1   s     r7   r5   CT_TextField.text_  s#     FF9vv|r9   NrL   )rO   rP   rQ   rR   rS   rT   r!   r0   r1   rU   r5   rX   rK   r9   r7   r   r   S  sP    I<<-6,.C	*  !*"!A   r9   r   c                  6    \ rS rSr% Sr\" S\5      rS\S'   Sr	g)CT_TextFontih  zCustom element class for `a:latin`, `a:ea`, `a:cs`, and `a:sym`.

These occur as child elements of CT_TextCharacterProperties, e.g. `a:rPr`.
typefacerN   rK   N)
rO   rP   rQ   rR   rS   r   r   r   rT   rX   rK   r9   r7   r   r   h  s    
 &OHc r9   r   c                  B    \ rS rSr% SrS\S'   \" SSS9r\S 5       r	Sr
g	)
CT_TextLineBreakis  z`a:br` line break elementr)   r*   r+   rK   r-   c                    g)zUnconditionally a single vertical-tab character.

A line break element can contain no text other than the implicit line feed it
represents.
rK   r   s    r7   r5   CT_TextLineBreak.textz  s     r9   N)rO   rP   rQ   rR   rS   rT   r!   r0   rU   r5   rX   rK   r9   r7   r   r   s  s)    #<<
G
+C r9   r   c                  (    \ rS rSrSr\" S\SS9rSrg)CT_TextNormalAutofiti  zI`a:normAutofit` element specifying fit text to shape font reduction, etc.	fontScaleg      Y@r   rK   N)	rO   rP   rQ   rR   rS   r   r   r   rX   rK   r9   r7   r   r     s    S!;UIr9   r   c                      \ rS rSr% SrS\S'   S\S'   S\S'   S	\S
'   S\S'   \" SSS9rS\S'   \" SSS9r	\" SSS9r
\" SSS9rS\S'   S S jrS!S"S jjrS#S jr\S$S j5       r\S%S j5       rS rSrg)&r`   i  z`a:p` custom element classr)   get_or_add_endParaRPrz(Callable[[], CT_TextParagraphProperties]rg   zlist[CT_RegularTextRun]r_lstzCallable[[], CT_TextLineBreak]_add_brzCallable[[], CT_RegularTextRun]_add_rr   )a:ra:brza:flda:endParaRPrr-   z!CT_TextParagraphProperties | Noneri   r   )r   r   r   rK   r/   
endParaRPrc                "    U R                  5       $ )z'Return a newly appended `a:br` element.)r   r   s    r7   add_brCT_TextParagraph.add_br  s    ||~r9   Nc                @    U R                  5       nU(       a  Xl        U$ )z&Return a newly appended `a:r` element.)r   r5   )r6   r5   rs      r7   add_rCT_TextParagraph.add_r  s    KKMFr9   c                    [        [        R                  " SU5      5       H5  u  p#US:  a  U R                  5         U(       d  M$  U R	                  U5        M7     g)ao  Append `a:r` and `a:br` elements to `p` based on `text`.

        Any `
` or `` (vertical-tab) characters in `text` delimit `a:r` (run) elements and
        themselves are translated to `a:br` (line-break) elements. The vertical-tab character
        appears in clipboard text from PowerPoint at "soft" line-breaks (new-line, but not new
        paragraph).
        z
|r   N)	enumeraterG   splitr   r   )r6   r5   idxr_strs       r7   append_textCT_TextParagraph.append_text  sA     $BHHWd$;<JCQwu

5! =r9   c                &    [        S U  5       5      $ )ztSequence containing text-container child elements of this `a:p` element.

These include `a:r`, `a:br`, and `a:fld`.
c              3  j   #    U  H)  n[        U[        [        [        45      (       d  M%  Uv   M+     g 7fr;   )
isinstancer'   r   r   ).0es     r7   	<genexpr>4CT_TextParagraph.content_children.<locals>.<genexpr>  s(      
!z!.?AQS_-`aAAts   $3	3)tupler   s    r7   content_children!CT_TextParagraph.content_children  s      

 
 	
r9   c                v    SR                  U R                   Vs/ s H  oR                  PM     sn5      $ s  snf )z%str text contained in this paragraph.r3   )joinr   r5   )r6   childs     r7   r5   CT_TextParagraph.text  s/     ww0E0EF0Eu

0EFGGFs   6c                4    S[        S5      -  n[        U5      $ )Nz<a:r %s><a:t/></a:r>r   r   )r6   r_xmls     r7   _new_rCT_TextParagraph._new_r  s    &5r9   )rM   r   r;   )r5   r   rM   r'   )r5   rN   )rM   z?tuple[CT_RegularTextRun | CT_TextLineBreak | CT_TextField, ...]rL   )rO   rP   rQ   rR   rS   rT   r!   ri   r    r   brr   r   r   r   rU   r   r5   r  rX   rK   r9   r7   r`   r`     s    $CC<<""++++-6D.C	*  	5%67A	F'8	9B4=25J1 "  
 
 H H
 r9   r`   c                     \ rS rSr% SrS\S'   S\S'   S\S'   S\S'   S	\S
'   S	\S'   S	\S'   Sr\" S\SS S9rS\S'   \" S\SS S9r	S\S'   \" S\SS S9r
S\S'   \" S\SS S9rS\S'   \" S\SS 9rS!\S'   \" S"\5      rS#\S"'   C\S+S$ j5       r\R&                  S,S% j5       r\S-S& j5       r\R&                  S.S' j5       r\S( 5       r\R&                  S.S) j5       rS*rg)/CT_TextParagraphPropertiesi  z`a:pPr` custom element class.r)   rh   zCallable[[], CT_TextSpacing]
_add_lnSpc_add_spcAft_add_spcBefr   _remove_lnSpc_remove_spcAft_remove_spcBef)a:lnSpca:spcBefa:spcAftz	a:buClrTxza:buClrza:buSzTxz	a:buSzPctz	a:buSzPtsz
a:buFontTxza:buFontza:buNoneza:buAutoNumza:buCharza:buBlipza:tabLsta:defRPrr   r  rA   Nr-   zCT_TextSpacing | NonelnSpcr     spcBefr     spcAftr     r/   rj   lvlr   r   intalgnzPP_PARAGRAPH_ALIGNMENT | Nonec                    U R                   nUc  gUR                  b  UR                  R                  $ [        [        UR
                  5      R                  $ )a  The spacing between baselines of successive lines in this paragraph.

A float value indicates a number of lines. A |Length| value indicates a fixed spacing.
Value is contained in `./a:lnSpc/a:spcPts/@val` or `./a:lnSpc/a:spcPct/@val`. Value is
|None| if no element is present.
N)r  spcPtsvalr   CT_TextSpacingPercentspcPct)r6   r  s     r7   line_spacing'CT_TextParagraphProperties.line_spacing   sG     

=<<#<<###)5<<8<<<r9   c                    U R                  5         Uc  g [        U[        5      (       a   U R                  5       R	                  U5        g U R                  5       R                  U5        g r;   )r  r   r$   r  
set_spcPts
set_spcPctr=   s     r7   r$  r%    sM    =eV$$OO((/OO((/r9   c                Z    U R                   nUc  gUR                  nUc  gUR                  $ )zJThe EMU equivalent of the centipoints value in `./a:spcAft/a:spcPts/@val`.N)r  r   r!  )r6   r  r   s      r7   space_after&CT_TextParagraphProperties.space_after  0     >>zzr9   c                j    U R                  5         Ub   U R                  5       R                  U5        g g r;   )r  r  r'  r=   s     r7   r*  r+  $  0    ))%0 r9   c                Z    U R                   nUc  gUR                  nUc  gUR                  $ )zJThe EMU equivalent of the centipoints value in `./a:spcBef/a:spcPts/@val`.N)r  r   r!  )r6   r  r   s      r7   space_before'CT_TextParagraphProperties.space_before*  r,  r9   c                j    U R                  5         Ub   U R                  5       R                  U5        g g r;   )r  r  r'  r=   s     r7   r0  r1  5  r.  r9   rK   )rM   float | Length | None)r>   r3  )rM   Length | None)r>   r4  )rO   rP   rQ   rR   rS   rT   _tag_seqr!   r  r  r  rj   r   r   r  r   r  rU   r$  rV   r*  r0  rX   rK   r9   r7   r  r    st   '??,,----%%&&&&H& $-hqrl$E   %.x|%F!  %.x|%F!  1:x}1F-  !%qC  +<&+D
'  	= = 0 0   1 1
   1 1r9   r  c                      \ rS rSr% SrS\S'   S\S'   S\S'   S\S	'   \" S
5      rS\S'   \" S5      rS\S'   SS jr	SS jr
Srg)CT_TextSpacingi<  z8Used for `a:lnSpc`, `a:spcBef`, and `a:spcAft` elements.z#Callable[[], CT_TextSpacingPercent]get_or_add_spcPctz!Callable[[], CT_TextSpacingPoint]get_or_add_spcPtsr   _remove_spcPct_remove_spcPtsza:spcPctzCT_TextSpacingPercent | Noner#  za:spcPtszCT_TextSpacingPoint | Noner   c                P    U R                  5         U R                  5       nXl        g)zZSet spacing to `value` lines, e.g. 1.75 lines.

A ./a:spcPts child is removed if present.
N)r;  r8  r!  )r6   r>   r#  s      r7   r(  CT_TextSpacing.set_spcPctM  s#    
 	'')
r9   c                P    U R                  5         U R                  5       nXl        g)zHSet spacing to `value` points. A ./a:spcPct child is removed if present.N)r:  r9  r!  )r6   r>   r   s      r7   r'  CT_TextSpacing.set_spcPtsV  s!    '')
r9   rK   N)r>   float)r>   r$   )rO   rP   rQ   rR   rS   rT   r!   r#  r   r(  r'  rX   rK   r9   r7   r7  r7  <  sU    B::88&&&& ,5,F(  *3*F& r9   r7  c                  6    \ rS rSr% Sr\" S\5      rS\S'   Sr	g)r"  i]  zZ`a:spcPct` element, specifying spacing in thousandths of a percent in its `val` attribute.r!  r@  rK   N)
rO   rP   rQ   rR   rS   r   r   r!  rT   rX   rK   r9   r7   r"  r"  ]  s    d"3C r9   r"  c                  6    \ rS rSr% Sr\" S\5      rS\S'   Sr	g)CT_TextSpacingPointie  zM`a:spcPts` element, specifying spacing in centipoints in its `val` attribute.r!  r$   rK   N)
rO   rP   rQ   rR   rS   r   r   r!  rT   rX   rK   r9   r7   rC  rC  e  s    W#"C r9   rC  )=rS   
__future__r   rG   typingr   r   r   pptx.enum.langr   pptx.enum.textr   r	   r
   r   pptx.excr   	pptx.oxmlr   pptx.oxml.dml.fillr   pptx.oxml.nsr   pptx.oxml.simpletypesr   r   r   r   r   r   r   r   r   pptx.oxml.xmlchemyr   r   r   r   r   r   r    r!   r"   	pptx.utilr#   r$   pptx.oxml.actionr%   r'   rZ   r^   r   r   r   r   r   r`   r  r7  r"  rC  rK   r9   r7   <module>rP     s   : " 	 0 0 *  %  8  
 
 

 
 
 "-c c@w
/ w
t;"O ;"|I IX? */  "? ?  ? Dk1 k1\_ BO / r9   