
    KwgOC                     \   d Z dZdZddlmZ ddlmZmZmZm	Z	 ddl
mZ ddlmZmZmZmZmZmZmZmZmZmZ m!Z"m#Z$m%Z&  eedd      Z' eedd      Z( eedd      Z) G d	 d
      Z* G d de*      Z+ e,eeeee	      fdZ- G d de*      Z. G d de*      Z/ e0       Z1 G d d      Z2d Z3d Z4y)z3.3.0a  Classes for ParagraphStyle and similar things.

A style is a collection of attributes, but with some extra features
to allow 'inheritance' from a parent, and to ensure nobody makes
changes after construction.

ParagraphStyle shows all the attributes available for formatting
paragraphs.

getSampleStyleSheet()  returns a stylesheet you can use for initial
development, with a few basic heading and text styles.
)PropertySetParagraphStylestr2alignment	LineStyle	ListStyleStyleSheet1getSampleStyleSheet    )black)TA_LEFT	TA_CENTERTA_RIGHT
TA_JUSTIFY)tt2ps)canvas_basefontnameunderlineWidthunderlineOffsetunderlineGapstrikeWidthstrikeOffset	strikeGapspaceShrinkageplatypus_link_underlinehyphenationLanghyphenationMinWordLengthuriWasteReduceembeddedHyphenation   c                   :    e Zd Zi ZddZd Zd Zd Zd	dZddZ	y)
r   Nc                    d| j                   vsJ d       d| j                   vsJ d       |rN|j                  | j                  k(  s5J d|j                  j                  d| j                  j                         || _        || _        | j
                  j                  | j                          | j                           | j                  di | y)	zWhen initialized, it copies the class defaults;
        then takes a copy of the attributes of the parent
        if any.  All the work is done in init - styles
        should cost little to use at runtime.namez1Class Defaults may not contain a 'name' attributeparentz3Class Defaults may not contain a 'parent' attributezParent style z# must have same class as new style N )	defaults	__class____name__r    r!   __dict__updaterefresh_setKwds)selfr    r!   kws       K/var/www/horilla/myenv/lib/python3.12/site-packages/reportlab/lib/styles.py__init__zPropertySet.__init__6   s     T]]*_,__*t}},c.cc,##t~~5  dqw  rB  rB  rK  rK  LP  LZ  LZ  Lc  Lc  8d  d5 	T]]+
 	    c                 R    |j                         D ]  \  }}|| j                  |<    y N)itemsr&   )r*   r+   keyvalues       r,   r)   zPropertySet._setKwdsL   s)    ((* 	(JC"'T]]3	(r.   c                 P    d| j                   j                  d| j                  dS )N<z 'z'>)r$   r%   r    r*   s    r,   __repr__zPropertySet.__repr__Q   s    "nn55tyyAAr.   c                     | j                   rA| j                   j                  j                         D ]  \  }}|dvs|| j                  |<    yy)zre-fetches attributes from the parent on demand;
        use if you have been hacking the styles.  This is
        used by __init__)r    r!   N)r!   r&   r1   )r*   r2   r3   s      r,   r(   zPropertySet.refreshT   sM     ;;"kk2288: /
U00).DMM#&/ r.   c                 ~   t        |dz   | j                         t        |dz   | j                         t        | j                  j                               }|j                          |j                  d       |j                  d       |D ]1  }| j                  j                  |d       }t        ||d|z          3 y )Nzname =zparent =r    r!   z = )	printr    r!   listr&   keyssortremoveget)r*   indentkeylistr2   r3   s        r,   	listAttrszPropertySet.listAttrs]   s    fx+fz!4;;/t}}))+,vx  	5CMM%%c40E&U334	5r.   c                     | j                  ||      }| j                  j                         |_        ||_        |d u xr | xs ||_         |j
                  di | |S )Nr"   )r$   r&   copyr    r!   r)   )r*   r    r!   kwdsrs        r,   clonezPropertySet.cloneh   sX    NN4']]'')
T>*d4f

Tr.   r0   ) )
r%   
__module____qualname__r#   r-   r)   r7   r(   rB   rG   r"   r.   r,   r   r   3   s&    H,(
B/	5r.   r   c                       e Zd Zi deddddddddd	dd
edddddedddddeddddddddi dddddddddddddddedd d!dd"dd#ed$ed%e	d&e
d'ed(eeddeeed)Zy)*r   fontNamefontSize
   leading   
leftIndentr	   rightIndentfirstLineIndent	alignmentspaceBefore
spaceAfterbulletFontNamebulletFontSizebulletIndent	textColor	backColorNwordWrapborderWidthborderPaddingborderColorborderRadiusallowWidowsr   allowOrphanstextTransformendDotssplitLongWordsr   bulletAnchorstartjustifyLastLinejustifyBreaksr   r   r   r   r   r   )linkUnderlineunderlineColorstrikeColorr   r   r   )r%   rI   rJ   _baseFontNamer   r
   _baseUnderlineWidth_spaceShrinkage_baseStrikeWidth_baseUnderlineOffset_baseUnderlineGap_baseStrikeOffset_baseStrikeGap_platypus_link_underline_hyphenationLang_embeddedHyphenation_uriWasteReducer#   r"   r.   r,   r   r   p   s   0
=0
20
 	"0
 	Q	0

 	a0
 	!0
 	G0
 	a0
 	Q0
 	0
 	0
 	q0
 	U0
 	D0
  	4!0
( 	q)0
* 	+0
, 	t-0
. 	/0
0 	q10
2 	30
4 	50
6 	$70
< 	=0
> 	-?0
@ 	A0
B 	1C0
D 	E0
F 	/G0
H 	'I0
J 	/K0
L 	)M0
N 	)O0
P 	^Q0
R 2 +3)_0
Hr.   r   )centrecenterleftrightjustifyc                 f    |j                  | j                         d       }||S t        | d      )Nz is illegal value for alignment)r?   lower
ValueError)v__map___s      r,   r   r      s7    
 AGGId+A} A5(G!HIIr.   c                       e Zd ZdedZd Zy)r   r   )widthcolorc                 &    |j                  d       y)zKYou can ask a LineStyle to set up the canvas for drawing
        the lines.r   N)setLineWidth)r*   canvass     r,   prepareCanvaszLineStyle.prepareCanvas   s     	Ar.   N)r%   rI   rJ   r
   r#   r   r"   r.   r,   r   r      s    
Hr.   r   c                   4    e Zd Z eddddedddddd	d	
      Zy	)r      r	   r{   1	HelveticarP   autoltrN)rQ   rR   bulletAlign
bulletTypebulletColorrW   rX   bulletOffsetYbulletDedent	bulletDirbulletFormatrg   )r%   rI   rJ   dictr
   r#   r"   r.   r,   r   r      s0    "!*!#!Hr.   r   c                   @    e Zd ZdZd Zd ZefdZd Zd Z	d
dZ
d	 Zy)r   aG  
    This may or may not be used.  The idea is to:
    
    1. slightly simplify construction of stylesheets;
    
    2. enforce rules to validate styles when added
       (e.g. we may choose to disallow having both
       'heading1' and 'Heading1' - actual rules are
       open to discussion);
       
    3. allow aliases and alternate style lookup
       mechanisms
       
    4. Have a place to hang style-manipulation
       methods (save, load, maybe support a GUI
       editor)
   
    Access is via getitem, so they can be
    compatible with plain old dictionaries.
    c                      i | _         i | _        y r0   )byNamebyAliasr6   s    r,   r-   zStyleSheet1.__init__   s    r.   c                     	 | j                   |   S # t        $ r. 	 | j                  |   cY S # t        $ r t        d|z        w xY ww xY w)Nz"Style '%s' not found in stylesheet)r   KeyErrorr   r*   r2   s     r,   __getitem__zStyleSheet1.__getitem__   s_    	K<<$$ 	KK{{3'' KCcIJJK	Ks    	A,AAAc                 D    	 | |   S # t         $ r |t        k7  r|cY S  w xY wr0   )r   _stylesheet1_undefined)r*   r2   defaults      r,   r?   zStyleSheet1.get   s0    	9 	..w	s    c                 >    || j                   v xs || j                  v S r0   )r   r   r   s     r,   __contains__zStyleSheet1.__contains__   s    dll"8cT[[&88r.   c                 
    || v S r0   r"   r   s     r,   has_keyzStyleSheet1.has_key   s    d{r.   Nc                 B   |j                   }|| j                  v rt        d|z        || j                  v rt        d|z        |r8|| j                  v rt        d|z        || j                  v rt        d|z        || j                  |<   |r|| j                  |<   y y )Nz(Style '%s' already defined in stylesheetz1Style name '%s' is already an alias in stylesheetz1Alias name '%s' is already an alias in stylesheet)r    r   r   r   )r*   stylealiasr2   s       r,   addzStyleSheet1.add   s    jj$++EKLL$,,NQTTUU#IEQRR$RUZZ[[ C"'DLL r.   c                 T   t        | j                  j                               }|j                          i }t        | j                  j                               D ]
  \  }}|||<    |D ]>  \  }}|j                  |d       }t        ||       |j                  d       t                @ y )Nz    )r;   r   r1   r=   r   r?   r:   rB   )r*   stylesaliir   r   r    s         r,   r;   zStyleSheet1.list  s    dkk'')*"4<<#5#5#78 	 NUEDK	 # 	MT5HHUD)E$OOF#G		r.   r0   )r%   rI   rJ   __doc__r-   r   r   r?   r   r   r   r;   r"   r.   r,   r   r      s0    *K 4 9("
r.   r   c                      t        dd       } t        | _        d| _        d| _        | j                          t                t        d|       }d|_        |j                          | |fS )NNormalrP   g,@LiteralCourier)r   rm   rL   rM   rO   rB   r:   )pNormalpPres     r,   
testStylesr     s]    Xd+G$GGGO	G)W-DDMNND=r.   c                     t               } | j                  t        dt        dd             | j                  t        d| d   d             | j                  t        d| d   t        	             | j                  t        d
| d   t
        ddd      d       | j                  t        d| d   t
        ddt        d      d       | j                  t        d| d   t
        dddd      d       | j                  t        d| d   t        dddd      d       | j                  t        d| d   t        dddd      d       | j                  t        d| d   t
        dddd      d        | j                  t        d!| d   t
        d"d#dd$      d%       | j                  t        d&| d   d'd()      d*       | j                  t        d+| d   d'd,d'dt        -      d.       | j                  t        d/| d   d0dd1d'd,d23             | j                  t        d4d5dd'd6d7t        d8dd'd9d:d5d5;      d<       | j                  t        d=d5dd'd6d7t        d8dd'd9d:d5d5;      d>       | S )?zReturns a stylesheet objectr   rN   rP   )r    rL   rM   rO   BodyText   )r    r!   rU   Italic)r    r!   rL   Heading1r      )r    r!   rL   rM   rO   rV   h1)r   Title)r    r!   rL   rM   rO   rT   rV   titleHeading2   )r    r!   rL   rM   rO   rU   rV   h2Heading3h3Heading4   h4Heading5	   g%@   h5Heading6   g @   h6Bulletr	      )r    r!   rS   rU   bu
Definition$   )r    r!   rS   rQ   rY   rU   rW   dfCoder   g!@rH   )r    r!   rL   rM   rO   rS   rQ   r   UnorderedListNr{   r   r   r   r   )r    r!   rQ   rR   r   r   r   rW   rX   r   r   r   r   rg   ulOrderedListol)
r   r   r   rm   _baseFontNameI_baseFontNameBr   _baseFontNameBIr   r
   )
stylesheets    r,   r   r   %  s!   JNN>x+8+-*,.  NN>z)3H)=./1  NN>x)3J)?-;= 
 NN>z)3H)=-;+-*,-.0    NN>w)3H)=-;+-*,,5-.0 !  " NN>z)3H)=-;+-*,.0-.0    NN>z)3H)=-<+-*,.0-.0    NN>z)3H)=-<+-*,.0-.0    NN>z)3H)=-;+,*../-.0    NN>z)3H)=-;+,*-./-.0    NN>x)3H)=23./1 	   NN>|)3H)=23-//0./1@B    NN>v)3H)=+4+,*-23-/246 7 NN9/'++-,-,2+.,1/:/1./-3*/-1&*  !  $ NN9-'++-,-,2+.,1/:/1./-3*/-1&*  !  " r.   N)5__version__r   __all__reportlab.lib.colorsr
   reportlab.lib.enumsr   r   r   r   reportlab.lib.fontsr   reportlab.rl_configr   rm   r   rn   r   rq   r   rr   r   rp   r   rs   r   rt   r   ro   r   ru   r   rv   r   _hyphenationMinWordLengthr   rx   r   rw   r   r   r   r   r   r   r   r   r   objectr   r   r   r   r"   r.   r,   <module>r      s    		
 ' H H %L L L L }Qq)}Qq)a*; ;z1
[ 1
f !&&"(	* 	J      K KZLr.   