
     hA                     l   d Z dZd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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) G d de(          Z* G d de(          Z+ e,            Z- G d d          Z.d Z/d Z0dS )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	LineStyle	ListStyleStyleSheet1getSampleStyleSheet    )black)TA_LEFT	TA_CENTER)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	dS )r   Nc                 Z   d| j         vs
J d            d| j         vs
J d            |r4|j        | j        k    s$J d|j        j        d| j        j                    || _        || _        | j                            | j                    |                                   | j        di | dS )	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       P/var/www/html/Sam_Eipo/venv/lib/python3.11/site-packages/reportlab/lib/styles.py__init__zPropertySet.__init__5   s     T]***,_***t},,,.c,,, 	d#t~5555qw  rB  rK  rK  rK  LP  LZ  Lc  Lc  8d555 	T]+++
 	    c                 N    |                                 D ]\  }}|| j        |<   d S N)itemsr#   )r'   r(   keyvalues       r)   r&   zPropertySet._setKwdsK   s6    ((** 	( 	(JC"'T]3	( 	(r+   c                 2    d| j         j        d| j        dS )N<z 'z'>)r!   r"   r   r'   s    r)   __repr__zPropertySet.__repr__P   s      "n555tyyyAAr+   c                 |    | j         r2| j         j                                        D ]\  }}|dvr
|| j        |<   dS dS )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#   r.   )r'   r/   r0   s      r)   r%   zPropertySet.refreshS   s_     ; 	/"k288:: / /
U000).DM#&	/ 	// /r+    c                    t          |dz   | j                   t          |dz   | j                   t          | j                                                  }|                                 |                    d           |                    d           |D ]4}| j                            |d           }t          ||d|z              5d S )Nzname =zparent =r   r   z = )	printr   r   listr#   keyssortremoveget)r'   indentkeylistr/   r0   s        r)   	listAttrszPropertySet.listAttrs\   s    fx+++fz!4;///t}))++,,vx    	5 	5CM%%c400E&UU334444	5 	5r+   c                     |                      ||          }| j                                        |_        ||_        |d u r| p||_         |j        di | |S )Nr   )r!   r#   copyr   r   r&   )r'   r   r   kwdsrs        r)   clonezPropertySet.cloneg   sc    NN4'']''))
T>*d4f
Tr+   r-   )r6   )
r"   
__module____qualname__r    r*   r&   r4   r%   r@   rE   r   r+   r)   r   r   2   s        H   ,( ( (
B B B/ / /	5 	5 	5 	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dS )*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"   rF   rG   _baseFontNamer
   r	   _baseUnderlineWidth_spaceShrinkage_baseStrikeWidth_baseUnderlineOffset_baseUnderlineGap_baseStrikeOffset_baseStrikeGap_platypus_link_underline_hyphenationLang_embeddedHyphenation_uriWasteReducer    r   r+   r)   r   r   o   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
 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
 0
R 2 +3)_0
 0
 0
HHHr+   r   c                       e Zd ZdedZd ZdS )r   r   )widthcolorc                 0    |                     d           dS )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"   rF   rG   r	   r    r|   r   r+   r)   r   r      s5        
 
H    r+   r   c                   <    e Zd Z eddddedddddd	d	
          Zd	S )r      r   left1	HelveticarM   autoltrN)rN   rO   bulletAlign
bulletTypebulletColorrT   rU   bulletOffsetYbulletDedent	bulletDirbulletFormatrd   )r"   rF   rG   dictr	   r    r   r+   r)   r   r      sH        t"!*!#!  HHHr+   r   c                   B    e Zd ZdZd Zd ZefdZd Zd Z	d
dZ
d	 ZdS )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 | _        d S r-   )byNamebyAliasr3   s    r)   r*   zStyleSheet1.__init__   s    r+   c                     	 | j         |         S # t          $ r1 	 | 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'   r/   s     r)   __getitem__zStyleSheet1.__getitem__   s    	K<$$ 	K 	K 	KK{3'''' K K KCcIJJJK	Ks    
A
)A
AA
c                 P    	 | |         S # t           $ r |t          k    r|cY S  w xY wr-   )r   _stylesheet1_undefined)r'   r/   defaults      r)   r=   zStyleSheet1.get   sC    	9 	 	 	...w	s   
 %%c                 &    || j         v p|| j        v S r-   )r   r   r   s     r)   __contains__zStyleSheet1.__contains__   s    dl"8cT[&88r+   c                 
    || v S r-   r   r   s     r)   has_keyzStyleSheet1.has_key   s    d{r+   Nc                     |j         }|| j        v rt          d|z            || j        v rt          d|z            |r6|| j        v rt          d|z            || j        v rt          d|z            || j        |<   |r|| j        |<   d S d S )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aliasr/   s       r)   addzStyleSheet1.add   s    j$+EKLLL$,NQTTUUU 	\##IEQRRR$$RUZZ[[[ C 	("'DL	( 	(r+   c                    t          | j                                                  }|                                 i }t          | j                                                  D ]
\  }}|||<   |D ]N\  }}|                    |d           }t          ||           |                    d           t                       Od S )Nz    )r9   r   r.   r;   r   r=   r8   r@   )r'   stylesaliir   r   r   s         r)   r9   zStyleSheet1.list   s    dk''))**"4<#5#5#7#788 	  	 NUEDKK# 	 	MT5HHUD))E$OOF###GGGG		 	r+   r-   )r"   rF   rG   __doc__r*   r   r   r=   r   r   r   r9   r   r+   r)   r   r      s         *  K K K 4    9 9 9  ( ( ( ("
 
 
 
 
r+   r   c                      t          dd           } t          | _        d| _        d| _        |                                  t                       t          d|           }d|_        |                                 | |fS )NNormalrM   g,@LiteralCourier)r   rj   rI   rJ   rL   r@   r8   )pNormalpPres     r)   
testStylesr     ss    Xd++G$GGGO	GGG)W--DDMNND=r+   c                  .   t                      } |                     t          dt          dd                     |                     t          d| d         d                     |                     t          d| d         t          	                     |                     t          d
| d         t
          ddd          d           |                     t          d| d         t
          ddt          d          d           |                     t          d| d         t
          dddd          d           |                     t          d| d         t          dddd          d           |                     t          d| d         t          dddd          d           |                     t          d| d         t
          dddd          d            |                     t          d!| d         t
          d"d#dd$          d%           |                     t          d&| d         d'd()          d*           |                     t          d+| d         d'd,d'dt          -          d.           |                     t          d/| d         d0dd1d'd,d23                     |                     t          d4d5dd'd6d7t          d8dd'd9d:d5d5;          d<           |                     t          d=d5dd'd6d7t          d8dd'd9d:d5d5;          d>           | S )?zReturns a stylesheet objectr   rK   rM   )r   rI   rJ   rL   BodyText   )r   r   rR   Italic)r   r   rI   Heading1r~      )r   r   rI   rJ   rL   rS   h1)r   Title)r   r   rI   rJ   rL   rQ   rS   titleHeading2   )r   r   rI   rJ   rL   rR   rS   h2Heading3h3Heading4   h4Heading5	   g%@   h5Heading6   g @   h6Bulletr      )r   r   rP   rR   bu
Definition$   )r   r   rP   rN   rV   rR   rT   dfCoder   g!@r6   )r   r   rI   rJ   rL   rP   rN   r   UnorderedListNr   r   r   r   r   )r   r   rN   rO   r   r   r   rT   rU   r   r   r   r   rd   ulOrderedListol)
r   r   r   rj   _baseFontNameI_baseFontNameBr   _baseFontNameBIr   r	   )
stylesheets    r)   r   r     sQ   JNN>x+8+-*,. . .    NN>z)3H)=./1 1 1    NN>x)3J)?-;= = =   
 NN>z)3H)=-;+-*,-.0 0 0      NN>w)3H)=-;+-*,,5-.0 0 0 !  " " " NN>z)3H)=-;+-*,.0-.0 0 0      NN>z)3H)=-<+-*,.0-.0 0 0      NN>z)3H)=-<+-*,.0-.0 0 0      NN>z)3H)=-;+,*../-.0 0 0      NN>z)3H)=-;+,*-./-.0 0 0      NN>x)3H)=23./1 1 1 	     NN>|)3H)=23-//0./1@B B B      NN>v)3H)=+4+,*-23-/246 6 6 7 7 7 NN9/'++-,-,2+.,1/:/1./-3*/-1&*    !    $ NN9-'++-,-,2+.,1/:/1./-3*/-1&*    !    " r+   N)1__version__r   __all__reportlab.lib.colorsr	   reportlab.lib.enumsr
   r   reportlab.lib.fontsr   reportlab.rl_configr   rj   r   rk   r   rn   r   ro   r   rm   r   rp   r   rq   r   rl   r   rr   r   rs   r   _hyphenationMinWordLengthr   ru   r   rt   r   r   r   r   r   r   r   objectr   r   r   r   r   r+   r)   <module>r      s[   		
 ' & & & & & 2 2 2 2 2 2 2 2 % % % % % %L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L }Qq))}Qq))%a**; ; ; ; ; ; ; ;z1
 1
 1
 1
 1
[ 1
 1
 1
f                  K K K K K K K KZ  L L L L Lr+   