Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
3 Neb©uã @spdZdZddlZddlmZmZddlmZmZddlm Z ddl m Z m Z m Z ddlmZdd lmZmZdd lmZdd lmZdd lmZdd lmZmZmZmZdjƒZGdd„dƒZ Gdd„dƒZ!Gdd„de!ƒZ"dd„Z#d›dd„Z$dZ%dd„Z&dd„Z'Gdd„de!ƒZ(Gd d!„d!e!ƒZ)Gd"d#„d#e!ƒZ*Gd$d%„d%e*ƒZ+Gd&d'„d'e*ƒZ,Gd(d)„d)e,ƒZ-Gd*d+„d+e-ƒZ.Gd,d-„d-e-ƒZ/Gd.d/„d/e+ƒZ0dœd1d2„Z1d3d4„Z2Gd5d6„d6ƒZ3Gd7d8„d8e3e!ƒZ4Gd9d:„d:e4ƒZ5Gd;d<„d„Z7Gd?d@„d@e!ƒZ8GdAdB„dBe!ƒZ9GdCdD„dDe*ƒZ:GdEdF„dFe!ƒZ;GdGdH„dHe!ƒZGdMdN„dNe3ƒZ?GdOdP„dPe?e!ƒZ@dQdR„ZAdSdT„ZBGdUdV„dVe?e!ƒZCGdWdX„dXƒZDGdYdZ„dZe?eDe!ƒZEGd[d\„d\e*ƒZFGd]d^„d^e*ƒZGGd_d`„d`e*ƒZHGdadb„dbeDe*ƒZIGdcdd„dde+ƒZJGdedf„dfeƒZKGdgdh„dheJƒZLGdidj„dje*ƒZMddklNmOZOePdldmdndodpdqdrdsdtdudv� ZQd�dxdy„ZRGdzd{„d{ƒZSd|d}„ZTGd~d„de!ƒZUGd€d�„d�eUƒZVdd‚lmWZWGdƒd„„d„ƒZXGd…d†„d†ƒZYGd‡dˆ„dˆe?e!ƒZZGd‰dŠ„dŠe!ƒZ[Gd‹dŒ„dŒe*ƒZ\Gd�dŽ„dŽe\ƒZ]Gd�d�„d�e\ƒZ^Gd‘d’„d’e^ƒZ_Gd“d”„d”e^ƒZ`Gd•d–„d–e`ƒZaGd—d˜„d˜e*ƒZbGd™dš„dše*ƒZcdS)žz3.3.0aä A flowable is a "floating element" in a document whose exact position is determined by the other elements that precede it, such as a paragraph, a diagram interspersed between paragraphs, a section header, etcetera. Examples of non-flowables include page numbering annotations, headers, footers, fixed diagrams or logos, among others. Flowables are defined here as objects which know how to determine their size and which can draw themselves onto a page with respect to a relative "origin" position determined at a higher level. The object's draw() method should assume that (0,0) corresponds to the bottom left corner of the enclosing rectangle that will contain the object. The attributes vAlign and hAlign may be used by 'packers' as hints as to how the object should be placed. Some Flowables also know how to "split themselves". For example a long paragraph might split itself between one page and the next. Packers should set the canv attribute during wrap, split & draw operations to allow the flowable to work out sizes etc in the proper context. The "text" of a document usually consists mainly of a sequence of flowables which flow into a document from top to bottom (with column and page breaks controlled by higher level components). éN)ÚdeepcopyÚcopy)ÚgrayÚ lightgrey)Úfp_str)ÚTA_LEFTÚ TA_CENTERÚTA_RIGHT)Ú _baseFontName)ÚstrTypesÚ rl_safe_exec)ÚABag)Úpdfutils)Ú stringWidth)Ú_FUZZÚoverlapAttachedSpaceÚignoreContainerActionsÚlistWrapOnFakeWidthaAnchorFlowable BalancedColumns BulletDrawer CallerMacro CondPageBreak DDIndenter DocAssert DocAssign DocExec DocIf DocPara DocWhile FailOnDraw FailOnWrap Flowable FrameBG FrameSplitter HRFlowable Image ImageAndFlowables KeepInFrame KeepTogether LIIndenter ListFlowable ListItem Macro NullDraw PTOContainer PageBreak PageBreakIfNotEmpty ParagraphAndImage Preformatted SetPageTopFlowables SetTopFlowables SlowPageBreak Spacer TopPadder TraceInfo UseUpSpace XBox splitLine splitLinesc@seZdZdZdd„ZdS)Ú TraceInfoz0Holder for info about where an object originatedcCs"d|_d|_d|_d|_d|_dS)Nz (unknown)ééÿÿÿÿrrr)ZsrcFileZ startLineNoZ startLinePosZ endLineNoZ endLinePos)Úself©rú=/tmp/tmp4i9tl1d3/lib64/python/reportlab/platypus/flowables.pyÚ__init__0s zTraceInfo.__init__N)Ú__name__Ú __module__Ú __qualname__Ú__doc__rrrrrr.src@sªeZdZdZdZdZdd„Zdd„Zd&dd„Zd'd d „Z d d „Z d d„Z dd„Z dd„Z dd„Zdd„Zdd„Zdd„Zdd„Zd(dd„Zed d!„ƒZd"d#„Zd$d%„ZdS))ÚFlowablezÍAbstract base class for things to be drawn. Key concepts: 1. It knows its size 2. It draws in its own coordinate system (this requires the base API to provide a translate() function. rcCs4d|_d|_d|_d|_d|_d|_d|_d|_dS)NrÚLEFTÚBOTTOM)ÚwidthÚheightÚwrappedÚhAlignÚvAlignZ _traceInfoÚ _showBoundaryÚencoding)rrrrrHszFlowable.__init__cCs||_|jƒ|`dS)z#ensure canv is set on and then drawN)ÚcanvÚdraw)rr)rrrÚ_drawOnZszFlowable._drawOncCsf|rbt|dƒrb|j}|ddtfkr0|d|7}n2|dtfkrF||7}n|dtfkrbtdt|ƒƒ‚|S)Nr%ÚCENTERZCENTREgà?ÚRIGHTr zBad hAlign value )Úhasattrr%rr rÚ ValueErrorÚstr)rÚxZsWÚarrrÚ _hAlignAdjust`s   zFlowable._hAlignAdjustcCsd|j||ƒ}|jƒ|j||ƒ|j|ƒt|dƒrX|jrX|jtƒ|jdd|j |j ƒ|j ƒdS)z6Tell it to draw itself on the canvas. Do not overrider'rN) r3Ú saveStateÚ translater+r.r'ÚsetStrokeColorrÚrectr"r#Ú restoreState)rÚcanvasr1ÚyÚ_sWrrrÚdrawOnks    zFlowable.drawOncCs"||_|j||ƒ\}}|`||fS)zWintended for use by packers allows setting the canvas on during the actual wrap)r)Úwrap)rr)ÚaWÚaHÚwÚhrrrÚwrapOnwszFlowable.wrapOncCs |j|jfS)z–This will be called by the enclosing frame before objects are asked their size, drawn or whatever. It returns the size actually used.)r"r#)rÚ availWidthÚ availHeightrrrr=sz Flowable.wrapcCst|d|jƒS)z-This should return the minimum required widthZ _minWidth)Úgetattrr")rrrrÚminWidth…szFlowable.minWidthcCs||_|j||ƒ}|`|S)zXintended for use by packers allows setting the canvas on during the actual split)r)Úsplit)rr)r>r?ÚSrrrÚsplitOn‰s zFlowable.splitOncCsgS)aoThis will be called by more sophisticated frames when wrap fails. Stupid flowables should return []. Clever flowables should split themselves and return a list of flowables. If they decide that nothing useful can be fitted in the available space (e.g. if you have a table and not enough space for the first row), also return []r)rrCZ availheightrrrrG‘szFlowable.splitcCs6t|dƒr|jSt|dƒr.t|jdƒr.|jjSdSdS)zOreturns boolean determining whether the next flowable should stay with this oneÚ keepWithNextÚstylerN)r.rJrK)rrrrÚgetKeepWithNextšs  zFlowable.getKeepWithNextcCs6t|dƒr|jSt|dƒr.t|jdƒr.|jjSdSdS)zXreturns how much space should follow this item if another item follows on the same page.Ú spaceAfterrKrN)r.rMrK)rrrrÚ getSpaceAfter s  zFlowable.getSpaceAftercCs6t|dƒr|jSt|dƒr.t|jdƒr.|jjSdSdS)z[returns how much space should precede this item if another item precedess on the same page.Ú spaceBeforerKrN)r.rOrK)rrrrÚgetSpaceBefore¦s  zFlowable.getSpaceBeforecCsdS)z?Hook for IndexingFlowables - things which have cross referencesrr)rrrrÚ isIndexing¬szFlowable.isIndexingNcCsft|dƒr|jdd�}nt|dƒr.t|jƒ}nd}|rF|rF|d|…}d|jjtt|ƒƒ|jƒ|fS)zÍ This method should attempt to return a string that can be used to identify a particular flowable uniquely. The result can then be used for debugging and or error printouts Ú getPlainTextr)ZidentifyÚtextz...Nz<%s at %s%s>%s) r.rRr0rSÚ __class__rÚhexÚidÚ _frameName)rÚmaxLenÚrrrrÚidentity°s    zFlowable.identitycCstt|ddƒddƒS)Nr)Ú _doctemplate)rE)rrrrr[ÀszFlowable._doctemplatecCst|j|dƒS)N)rEr[)rr2rrrÚ_doctemplateAttrÄszFlowable._doctemplateAttrcCs2t|ddƒ}|s|jdƒ}|r.|jr.d|jSdS)NÚ_frameÚframez frame=%sÚ)rEr\rV)rÚfrrrrWÇs    zFlowable._frameName)r)r)N)rrrrÚ _fixedWidthÚ _fixedHeightrr+r3r<rBr=rFrIrGrLrNrPrQrZÚpropertyr[r\rWrrrrr=s(    rc@s*eZdZdZd dd„Zdd„Zdd„Zd S) ÚXBoxz~Example flowable - a box with an x through it and a caption. This has a known size, so does not need to respond to wrap().úA BoxcCs tj|ƒ||_||_||_dS)N)rrr"r#rS)rr"r#rSrrrrÐs z XBox.__init__cCsd|j|j|jfS)NzXBox(w=%s, h=%s, t=%s))r"r#rS)rrrrÚ__repr__Ösz XBox.__repr__cCsr|jjdd|j|jƒ|jjdd|j|jƒ|jjd|j|jdƒ|jjtdƒ|jjd|jd|j|jƒdS)Nré gà?) r)r7r"r#ÚlineÚsetFontr ÚdrawCentredStringrS)rrrrr*Ùs z XBox.drawN)re)rrrrrrfr*rrrrrdÍs rdcCsXx(t|ƒr(|djƒdkr(|dd…}qWx(t|ƒrR|djƒdkrR|dd…}q,W|S)Nrr_rrr)ÚlenÚstrip)ÚlinesrrrÚ_trimEmptyLinesâs rncCsT|jdƒ}|dkrHt|ƒ}g}x0|D]}||d…jƒ}|j|ƒq$Wnt|ƒ}|S)zë tidy up text - carefully, it is probably code. If people want to indent code within a source script, you can supply an arg to dedent and it will chop off that many character, otherwise it leaves left edge intact. Ú rN)rGrnÚrstripÚappend)rSÚdedentrmZ templinesrhrrrÚ _dedenterês  rsz [{( ,.;:/\-cCsV|dkr t}|dkrd}g}x4|D],}t|ƒ|krDt|||||ƒq"|j|ƒq"W|S)Nr_)Ú SPLIT_CHARSrkÚ splitLinerq)rmÚmaximum_lengthÚsplit_charactersÚnew_line_charactersÚlines_splittedrhrrrÚ splitLiness   rzcCs¸d}x®|r²t|ƒdkr²d}t|ƒ|kr0t|ƒ}n&x$t|ƒD]}|||kr:|d}q:W|dkrf|d}|rŽ|j|d|…ƒd}|t|ƒ8}n|j||d|…ƒ||d…}qWdS)NTrrF)rkÚrangerq)Z line_to_splitryrvrwrxÚ first_lineZ split_indexZ line_indexrrrrus"    ruc@sBeZdZdZddd„Zdd„Zd d „Zd d „Zd d„Zdd„Z dS)Ú Preformatteda‰This is like the HTML
 tag.
    It attempts to display text exactly as you typed it in a fixed width "typewriter" font.
    By default the line breaks are exactly where you put them, and it will not be wrapped.
    You can optionally define a maximum line length and the code will be wrapped; and
    extra characters to be inserted at the beginning of each wrapped line (e.g. '> ').
    Nrr_cCs6||_||_t||ƒ|_|r2|r2t|j|||ƒ|_dS)zötext is the text to display. If dedent is set then common leading space
        will be chopped off the front (for example if the entire text is indented
        6 spaces or more then each line will have 6 spaces removed from the front).
        N)rKÚ
bulletTextrsrmrz)rrSrKr~rrZ
maxLineLengthZ
splitCharsZnewLineCharsrrrr>szPreformatted.__init__cCs2|j}d}|dk	rdt|ƒ}d|dj|jƒfS)Nz
Preformatted(zPreformatted(bulletText=%s,z%s'''\ 
%s''')ro)r~ÚreprÚjoinrm)rZbTÚHrrrrfNs
zPreformatted.__repr__cCs&||_|jjt|jƒ|_|j|jfS)N)r"rKÚleadingrkrmr#)rrCrDrrrr=UszPreformatted.wrapcs,|j}|j‰|j‰t‡‡fdd„|jDƒƒS)Ncsg|]}t|ˆˆƒ‘qSr)r)Ú.0rh)ÚfontNameÚfontSizerrú
^sz)Preformatted.minWidth..)rKr…r„Úmaxrm)rrKr)r„r…rrFZszPreformatted.minWidthcCs€||jjkrgSt|d|jjƒ}dj|jd|…ƒ}dj|j|d…ƒ}|j}|jdkrjt|ƒ}d|_t||jƒt||ƒgS)Ngð?ror)rKr‚Úintr€rmÚfirstLineIndentrr})rrCrDZlinesThatFitZtext1Ztext2rKrrrrG`s
zPreformatted.splitcCsŒ|jj}|j|jj}|jjdƒ|jjr:|jj|jjƒ|jj||ƒ}|j	|jj
|jj|jjƒx|jD]}|j
|ƒqjW|jj|ƒdS)Nz%PreformattedPara)rKÚ
leftIndentr#r…r)Z
addLiteralZ	textColorÚsetFillColorZ	beginTextrir„r‚rmZtextLineZdrawText)rZcur_xZcur_yZtxrSrrrr*qs

zPreformatted.draw)NrNNr_)
rrrrrrfr=rFrGr*rrrrr}7s
r}c@sleZdZdZdZdZddd	„Zd
d„Zdd
„Zdd„Z	dd„Z
dd„Zdd„Zdd„Z
dd„Zddd„ZdS)ÚImageaan image (digital picture).  Formats supported by PIL/Java 1.4 (the Python/Java Imaging Library
       are supported. Images as flowables may be aligned horizontally in the
       frame with the hAlign parameter - accepted values are 'CENTER',
       'LEFT' or 'RIGHT' with 'CENTER' being the default.
       We allow for two kinds of lazyness to allow for many images in a document
       which could lead to file handle starvation.
       lazy=1 don't open image until required.
       lazy=2 open image when required then shut it.
    rNÚdirectÚautor,Fc	
CsD||_||_t|dƒ}	d|_|	r2||_t|ƒ|_n8t|dƒr^||_t|ƒ|_d|_d|_d}	n||_|_||_|	oˆt	j
j|ƒddk�rd
dlm
}
|
|dƒ}z.ytj|ƒ}Wn|j||||ƒdSWd|jƒX|d
|_|d|_|�r|d
|_d|_|j|||d
ƒn(|	�r0|j|||d
ƒn|j||||ƒdS)z8If size to draw at not specified, get it from the image.ÚreadNZ	_renderPyTrú.jpgú.JPGú.jpegú.JPEGr)Ú
open_for_readÚbé)r�r‘r’r“)r%Ú_maskr.Ú_drawingÚ_filerÚfilenameÚ_imgÚ_dpiÚosÚpathÚsplitextÚreportlab.lib.utilsr”rZreadJPEGInfoÚ_setupÚcloseÚ
imageWidthÚimageHeight)
rršr"r#ÚkindÚmaskÚlazyr%ZuseDPIÚfpr”r`Úinforrrr‘sD







zImage.__init__cCsR|j}|rN|ddkr,|jd|d9_|ddkrN|jd|d9_dS)NréHgR@r)rœr£r¤)rÚdpirrrÚ
_dpiAdjust½szImage._dpiAdjustcCs,||_||_||_||_|dkr(|jƒdS)Nr)Ú_lazyÚ_widthÚ_heightÚ_kindÚ_setup_inner)rr"r#r¥r§rrrr¡ÃszImage._setupcCs|j}|j}|j}|j}|rP|jƒ\|_|_|jrrt|dƒrr|j	j
jdd
ƒ|_n"|jrr|jj
|jj|_|_d|_|jƒ|jdkrˆ|`|dkrª|p˜|j|_|p¤|j|_nj|dkrÔ|j|d
|_|j|d
|_n@|dk�rtt|ƒ|jt|ƒ|jƒ}|j||_|j||_dS)NÚ_imager«rªFér�ÚabsoluteÚ
percentageú%g{®Gáz„?ÚboundÚproportional)rªrª)r�r´)rµr¶)r·r¸)r®r¯r°r›ZgetSizer£r¤rœr.r²r©Úgetr˜r"r#r¬r­Ú	drawWidthÚ
drawHeightÚminÚfloat)rr"r#r¥ZimgÚfactorrrrr±Ês0

zImage._setup_innercCsp|j|tks|j|tkrd|j|jf|_tt|ƒ|jt|ƒ|jƒ}|j|9_|j|9_|j|jfS)N)rºrr»Ú_oldDrawSizer¼r½)rr>r?r¾rrrÚ
_restrictSizeãszImage._restrictSizecCs t|ddƒ}|r|\|_|_dS)Nr¿)rErºr»)rZdwhrrrÚ_unRestrictSizeëszImage._unRestrictSizecCsz|dkrHddlm}||jƒ|_t|jtƒsBd|_|jdkrBd|_|jS|dkrb|jƒ|j|St	d
t
|ƒ|fƒ‚dS)Nr›r)ÚImageReaderr³rrºr»r£r¤z.%s)rºr»r£r¤)r rÂr™r›Ú
isinstancerr­r±Ú__dict__ÚAttributeErrorrV)rr2rÂrrrÚ__getattr__ðs

zImage.__getattr__cCs|j|jfS)N)rºr»)rrCrDrrrr=ýsz
Image.wrapcCsÌt|ddƒ}t|ddƒ}|j}|rt|jt|jƒ}|jt|jƒ}|j}z |j||ƒ|j	|j
||ƒWd||_XnT|j}|dkrˆd|_|j
j|j
p˜|j|||j|j|jd�|dkrÈd|_
|_||_dS)NZ_offs_xrZ_offs_yr³r)r¦)rEr˜rºr½r£r»r¤Ú	transformÚscaler<r)r­Z	drawImager›ršr—r™)rÚdxZdyÚdZsxZsyZotransr§rrrr*s.

z
Image.drawcCsBtj||ƒ}|dd…dkr>t|jtƒr>d|dd…|jf}|S)Néz>...z%s filename=%s>éüÿÿÿrÌ)rrZrÃršr0)rrXrYrrrrZszImage.identity)NNr�rŽrr,F)N)rrrrrarbrr¬r¡r±rÀrÁrÆr=r*rZrrrrrŒ…s	
+
rŒc@seZdZdd„ZdS)ÚNullDrawcCsdS)Nr)rrrrr*#sz
NullDraw.drawN)rrrr*rrrrrÍ"srÍc@s*eZdZdZdZdZd	dd„Zdd„ZdS)
ÚSpacerzdA spacer just takes up space and doesn't draw anything - it guarantees
       a gap between objects.rFcCs ||_|rd|_||_||_dS)Ng-Cëâ6?)r"r#Zspacebefore)rr"r#ZisGluerrrr+s
zSpacer.__init__cCsd|jj|j|jfS)Nz
%s(%s, %s))rTrr"r#)rrrrrf2szSpacer.__repr__N)F)rrrrrarbrrfrrrrrÎ&s

rÎc@s$eZdZdd„Zdd„Zdd„ZdS)Ú
UseUpSpacecCsdS)Nr)rrrrr6szUseUpSpace.__init__cCsd|jjS)Nz%s())rTr)rrrrrf9szUseUpSpace.__repr__cCs||_||_||dfS)Ng:Œ0âŽyE>)r"r#)rrCrDrrrr=<szUseUpSpace.wrapN)rrrrrfr=rrrrrÏ5srÏc@s"eZdZdZddd„Zdd„ZdS)Ú	PageBreakrNcCs
||_dS)N)ÚnextTemplate)rrÑrrrrEszPageBreak.__init__cCs d|jj|jrt|jƒndfS)Nz%s(%s)r_)rTrrÑr)rrrrrfHszPageBreak.__repr__)N)rrrÚ
locChangerrrfrrrrrÐAs
rÐc@seZdZdS)Ú
SlowPageBreakN)rrrrrrrrÓKsrÓc@seZdZdS)ÚPageBreakIfNotEmptyN)rrrrrrrrÔNsrÔc@s2eZdZdZdd„Zdd„Zdd„Zdd	d
„ZdS)Ú
CondPageBreakrcCs
||_dS)N)r#)rr#rrrrTszCondPageBreak.__init__cCsd|jfS)NzCondPageBreak(%s))r#)rrrrrfWszCondPageBreak.__repr__cCs:||jkr6|jdƒ}|s ||fSddlm}|j|ƒdS)Nr^r)Ú
FrameBreak)rr)r#r\Úreportlab.platypus.doctemplaterÖÚadd_generated_content)rrCrDr`rÖrrrr=Zs


zCondPageBreak.wrapNcCst|ƒjdd|jƒƒS)Nú)z
,frame=%s))rÚreplacerW)rrXrrrrZbszCondPageBreak.identity)N)rrrrÒrrfr=rZrrrrrÕQs
rÕrcCsØt|ddƒ}t|ddƒ}|dkr$t}|rTddlm}	m}
|}t|ƒ}|_d|_|`�znd}d}
d}d}|dd…}�x2|�r¨|jdƒ}t	|dƒrºddlm}
t
||
ƒrx||j|j8}qx|j
||d	ƒ\}}|dk	râ|j||fƒ|rð|	||ƒ|tkrüd
sx|tk�rqxt||�rt||ƒn|ƒ}|
|7}
|�sh|jƒ}|�r^t|dd
ƒ�rP|}t||dƒ}|
|7}
n|dk	�r||jƒ|_d}|jƒ}t|dd
ƒ�rš|}|}|
|7}
qxW|dk	�rº||_||
|fS|�rÒ||_XdS)z;return max width, required height for a list of flowables Fr[Nr^r)Ú_addGeneratedContentÚIndenterrÚframeAction)rÜiÿÿÿFÚ_SPACETRANSFER)rErr×rÛrÜrr^Ú_generated_contentÚpopr.rÃÚleftÚrightrBrqrr‡r¼rPÚ_spaceBeforerNÚ_spaceAfter)ÚFrCr)Ú
mergeSpaceÚobjÚdimsÚ	fakeWidthZdoctZcframerÛrÜZ
doct_frameÚWr�ÚpSÚatTopr`r@rAÚsrrrÚ_listWrapOnesh








rîcsLt|ttfƒs |dk	r|gpg}ddlm‰‡fdd„|DƒsHtdƒ‚|S)z.if it isn't a list or tuple, wrap it in a listNr)ÚLCActionFlowablecsg|]}t|ˆƒr|‘qSr)rÃ)rƒr1)rïrrr†žsz$_flowableSublist..z)LCActionFlowables not allowed in sublists)rÃÚlistÚtupler×rïÚAssertionError)ÚVr)rïrÚ_flowableSublistšs
rôc@s eZdZddd„Zddd„ZdS)Ú_ContainerSpaceNcCs2x,|dkr|jn|D]}t|dƒs|jƒSqWdS)NrÝr)Ú_contentr.rP)rÚcontentÚcrrrrP¢s
z_ContainerSpace.getSpaceBeforecCs6x0t|dkr|jn|ƒD]}t|dƒs|jƒSqWdS)NrÝr)Úreversedrör.rN)rr÷rørrrrN¨s
z_ContainerSpace.getSpaceAfter)N)N)rrrrPrNrrrrrõ¡s
rõc@s<eZdZdZd
dd„Zdd„Zdd„Zd	d
„Zddd„ZdS)ÚKeepTogetherFNcCsbttdƒs@ddlm}ddlm}ddlm}|t_|t_|t_|sN|jƒg}t|ƒ|_||_	dS)NÚNullActionFlowabler)rû)rÖ)ÚannotateException)
r.rúr×rûrÖr rürôröÚ
_maxHeight)rÚ	flowablesÚ	maxHeightrûrÖrürrrr±s


zKeepTogether.__init__cCsB|j}ttt|ƒƒ}ddj|ƒ}|jddƒ}d|jj||jfS)Nroz
  z%s(%s,maxHeight=%s))	rörðÚmaprr€rÚrTrrý)rr`ÚLrrrrfÀs
zKeepTogether.__repr__cCs|g}yt|j||j|d�\}}Wn,|jd|jj|jjt|ƒfƒYnX||_|rd|ddpfd|_	||f|_
|dfS)N)rèz%
raised by class %s(%s)@0x%8.8x wrap
rriÿÿÿ)rîrör)rürTrrrVÚ_HÚ_H0Ú	_wrapInfo)rr>r?rèrêr�rrrr=Çs&
zKeepTogether.wrapcCs,t|ddƒ||fkr |j||ƒ|jdd…}t|ddƒ}}|rZt|ddƒ}|j}|j}|j|kot|jpt||jk}|j|kp†|o†|}	|s’|	�r(d}
|jdƒ}|rº|rº|ƒ}|j}
|j}|rê|j	oÆ|rê|oä|oä|oä||
koä||k}
n"|�r|
|jk�r||jk�rd}
|j
d|
�r|jn|jƒƒ|S)Nrr]Z_atTopFZ_peekNextFrameTr)
rEr=rör®r¯rrýrr\Ú
splitAtTopÚinsertrÖrû)rr>r?rHZcfrìZcAWZcAHZC0ÚC1ZfbZpanfÚnfZnAWZnAHrrrrGÒs.

 zKeepTogether.splitcCsJd|jjtt|ƒƒ|jƒdjdd„|jDƒƒf}|rB|d|…S|SdS)Nz<%s at %s%s> containing :%srocSsg|]}|jƒ‘qSr)rZ)rƒr`rrrr†ìsz)KeepTogether.identity..r)rTrrUrVrWr€rö)rrXÚmsgrrrrZës2zKeepTogether.identity)N)N)	rrrrrrfr=rGrZrrrrrú®s
rúc@seZdZdZdZdS)ÚKeepTogetherSplitAtTopzq
    Same as KeepTogether, but it will split content immediately if it cannot
    fit at the top of a frame.
    TN)rrrrrrrrrr
òsr
c@s0eZdZdZdd„Zdd„Zdd„Zdd	„Zd
S)ÚMacroz¬This is not actually drawn (i.e. it has zero height)
    but is executed when it would fit in the frame.  Allows direct
    access to the canvas through the object 'canvas'cCs
||_dS)N)Úcommand)rrrrrrýszMacro.__init__cCsdt|jƒS)Nz	Macro(%s))rr)rrrrrfÿszMacro.__repr__cCsdS)Nr)rrr)rrCrDrrrr=sz
Macro.wrapcCst|jdd|jid�dS)Nr9)ÚgÚl)rrr))rrrrr*sz
Macro.drawN)rrrrrrfr=r*rrrrrùs
rcOsdS)Nr)ÚargsÚkwdsrrrÚ
_nullCallablesrc@s2eZdZdZddd„Zdd„Zdd„Zd	d
„ZdS)ÚCallerMacrozf
    like Macro, but with callable command(s)
    drawCallable(self)
    wrapCallable(self,aW,aH)
    NcCs|pt|_|pt|_dS)N)rÚ
_drawCallableÚ
_wrapCallable)rZdrawCallableZwrapCallablerrrrs
zCallerMacro.__init__cCsd|j|jfS)NzCallerMacro(%r,%r))rr)rrrrrfszCallerMacro.__repr__cCs|j|||ƒdS)Nr)rr)r)rr>r?rrrr=szCallerMacro.wrapcCs|j|ƒdS)N)r)rrrrr*szCallerMacro.draw)NN)rrrrrrfr=r*rrrrr	s

rc@sBeZdZdZddd„Zdd„Zdd	„Zd
d„Zdd
„Zdd„Z	dS)ÚParagraphAndImagez combine a Paragraph and an Imager–râcCs"||_||_||_||_||_dS)N)ÚPÚIÚxpadÚypadÚ_side)rrrrrZsiderrrrs
zParagraphAndImage.__init__cCst|jjƒ|jjƒƒS)N)r‡rrPr)rrrrrP#sz ParagraphAndImage.getSpaceBeforecCst|jjƒ|jjƒƒS)N)r‡rrNr)rrrrrN&szParagraphAndImage.getSpaceAftercCsô|jj||ƒ\}}||_||_||_|j}|j}|j}|j}|j	}	|j
}
||
|j}|||}||j}
d|_t
|||	dƒ}|j|
g||g|gƒ|_|jdkrÈ||gd|dg|_t|jjƒ|	|_t||jƒ|_|j|jfS)Nrgð?rár)rr=ÚwIÚhIr"rrKrrr‚rŠÚrightIndentr‰rˆZ
breakLinesÚblPararÚ_offsetsrkrmr#r‡)rrCrDrrrrKrrr‚rŠZlater_widthsZintermediate_widthsZfirst_line_widthZnIWrrrr=)s*

zParagraphAndImage.wrapc	Cs–|j|j|j|jf\}}}}|||ks6t|jƒdkr:gS|j||ƒ}|sN|S|d}|_|d=|j}t|jjj	ƒ|j
|_t||jƒ|_|g|S)Nr)
rrrrrkZfragsrGrKrrmr‚r#r‡)	rrCrDrrrrrHrKrrrrGAszParagraphAndImage.splitc
Cs˜|j}|jdkrX|jj|d|j|j|jƒ|j|j_z|jj|ddƒWd|j`Xn<|jj||j	|j
|j|j|j|jƒ|jj|ddƒdS)Nrár)r)rrr<r#rrrrr"rr)rr)rrrr*Ms


,zParagraphAndImage.drawN)r–r–râ)
rrrrrrPrNr=rGr*rrrrrs
rc@seZdZdd„ZdS)Ú
FailOnWrapcCstdƒ‚dS)Nz3FailOnWrap flowable wrapped and failing as ordered!)r/)rrCrDrrrr=[szFailOnWrap.wrapN)rrrr=rrrrr Zsr c@seZdZdd„Zdd„ZdS)Ú
FailOnDrawcCsdS)Nr)rrr)rrCrDrrrr=_szFailOnDraw.wrapcCstdƒ‚dS)Nz2FailOnDraw flowable drawn, and failing as ordered!)r/)rrrrr*bszFailOnDraw.drawN)rrrr=r*rrrrr!^sr!c	@sDeZdZdZdddedddddf	dd	„Zd
d„Zdd
„Zdd„ZdS)Ú
HRFlowablezLike the hr tagz80%rÚroundr,r!Nc

CsDtj|ƒ||_||_||_||_||_||_||_||_	|	|_
dS)N)rrr"Ú	lineWidthÚlineCaprOrMÚcolorr%r&Údash)
rr"Z	thicknessr%r&rOrMr%r&r'rrrrgs
zHRFlowable.__init__cCsd|j|jfS)NzHRFlowable(width=%s, height=%s))r"r#)rrrrrfzszHRFlowable.__repr__cCs^|j}t|tƒrD|jƒ}|jdƒr<|t|dd…ƒd}nt|ƒ}t||ƒ}||_||jfS)Nr¶rg{®Gáz„?r)	r"rÃrrlÚendswithr½r¼r®r$)rrCrDr@rrrr=}s


zHRFlowable.wrapcCst|j}|jƒ|j|jƒ|jddddœ|jjƒƒ|j|jƒ|j	rT|j
|j	ƒ|jdd|j|j
ƒ|jƒdS)Nrrr³)Zbuttr#Úsquare)r)r4ÚsetLineWidthr$Z
setLineCapr%Úlowerr6r&r'ÚsetDashrhr®r#r8)rr)rrrr*‡szHRFlowable.draw)	rrrrrrrfr=r*rrrrr"es
r"c@seZdZdd„ZdS)Ú_PTOInfocCst|ƒ|_t|ƒ|_dS)N)rôÚtrailerÚheader)rr.r/rrrr’s
z_PTOInfo.__init__N)rrrrrrrrr-‘sr-cCst|dƒr|jƒSt|ƒSdS)Nr)r.r)rçrrrÚ	cdeepcopy–s
r0c@s eZdZddd„Zd	dd„ZdS)
Ú
_Containerrçð?NcCs0ddlm}m}	|}
|}d}|dkr*|j}||9}|dkr@|j}|j|||ƒ}||j|7}|}
t|ddƒ}�xº|D�]°}tršt	||ƒrš|j
|jƒqvt	||	ƒrÈ||j|7}||j|j
|8}qv|j||dƒ\}}|tkròt|ddƒròqv|
|k�r$|jƒ}t|ddƒ�s$|t||dƒ7}||8}|jƒ}t|ddƒ�rF|}|}t|d	dƒ}|�râ|dj�râ|d
}|j}|j
}|j}||j||}|
|||j}|||}t|||ƒ}td||ƒ}|j||||||ƒ||_|j|||||d�||dk	�r$t|ddƒ�r$||8}|`qvWdS)z"we simulate being added to a framer)ÚActionFlowablerÜNr]iÿÿÿÚ	_ZEROSIZErÞFÚ	_frameBGsr)r;rrr)r×r3rÜr"rör3r#rErrÃÚapplyr[rárârBrrPr‡rNÚactiveÚstartr®Ú_leftPaddingÚrenderr]r<)rr)r1r:r;rÈr÷r>r3rÜZx0Zy0rëZytr^rør@rAríZfbgÚbgÚfbglZfbgrZbgmÚfbwÚfbxÚfbhÚfbyrrrr<�sd

z_Container.drawOncCs2gj}x|p|jD]}|t|ƒƒqW|j|_dS)N)rqrör0Ú__self__)rr÷ÚCrørrrÚcopyContentÐsz_Container.copyContent)rr2NN)N)rrrr<rCrrrrr1œs
3r1c@s*eZdZdZd	dd„Zdd„Zdd„ZdS)
ÚPTOContaineraMPTOContainer(contentList,trailerList,headerList)

    A container for flowables decorated with trailer & header lists.
    If the split operation would be called then the trailer and header
    lists are injected before and after the split. This allows specialist
    "please turn over" and "continued from previous" like behaviours.NcCs\t||ƒ}g|_}xBt|ƒD]6}t|tƒr:|j|jƒq|j|ƒt|dƒs||_qWdS)NÚ_ptoinfo)	r-rörôrÃrDÚextendrqr.rE)rr÷r.r/rrBÚ_rrrrÝs




zPTOContainer.__init__cCs$t|j||jƒ\|_|_|j|jfS)N)rîrör)r"r#)rrCrDrrrr=çszPTOContainer.wrapc"Cs,ddlm}|dkrgS|j}|j}d}}}}	}
t|ƒ}i}d}
}�x4t|ƒD�]&}||}|j}||jƒkrÂ|j}|j	}t
|||jƒ\}}t|ƒr¬|djƒ}nd}||||f||<n||\}}}}|j||dƒ\}}t
||ƒ�r"|j|j}|
|j7}
||j7}||8}d}	d}
n(|�rBt|jƒ|	dƒ}
||
7}|jƒ}	|||	7}|t||	ƒ}|||tk�rxP|d7}qXW|||	8}||||
d}|d|k�rÂ|j|||ƒ}ng}t|
ƒt|ƒdk�rú||
|ƒg}||
|ƒg}ng}}|�sh|}x4|dk�r@||djƒ�r@|d8}d||_�qW|dk�rh|djƒ�rh|}d|d_tƒg}t|ƒdk�rÈ|d|…|dd…|||} |||dd…||dd…}!n6|�sÒgS|d|…|||} ||||d…}!| t|!dd	„|jDƒdd	„|j	Dƒƒg}|S)
Nr)rÜiÿÿÿrgwJëÿï?gš™™™™™©?g:Œ0âŽyE>cSsg|]}t|ƒ‘qSr)r)rƒr1rrrr†9sz&PTOContainer.split..)r×rÜr)rörkr{rEÚkeysr.r/rîrPrBrÃrárâr‡rNrrIÚabsrLrJrÏrD)"rrCrDrÜr)rBr1Úir�rëÚhxÚnZI2WZdLeftZdRightrørÚTZHdrZtWZtHZtSBrGrAZdwZtHSr?ZSSZR1IZR2IÚjråZR1ZR2rrrrGës‚


$&*zPTOContainer.split)NN)rrrrrr=rGrrrrrDÖs

rDcCs„d|d}d|}d|d}d|}||||}||}	||}
||}||}|	||
|}
||||}|
|fS)Ngð?r³r)Ús0Ús1Zh0Zh1Za11Za12Za21Za22ZdetZb11Zb12Zb21Zb22r2r•rrrÚ_hmodel=s

rQc
Cs–|\}}t|ƒtkr||Sd||}ddlm}||}|||}|dkrVdS||ƒ}|dkrr||}n
||}||}	td|d|	ƒS)z=solve the model v = a/s**2 + b/s for an s which gives us v==hgà?r)ÚsqrtNgð?)rIrÚmathrRr‡)
rAÚabr2r•ÚtrRr`rYrPÚs2rrrÚ_qsolveMs

rWc@sHeZdZgddddddfdd„Zd	d
„Zddd„Zd
d„Zddd„ZdS)ÚKeepInFramerÚshrinkr_r r!Nc

Cs‚||_||_||_||_|d	ks4td|jƒ|fƒ‚|dksPtd|jƒ|fƒ‚|dkr\t}||_|phg|_||_	||_
|	|_dS)
abmode describes the action to take when overflowing
            error       raise an error in the normal way
            continue    ignore ie just draw it and report maxWidth, maxHeight
            shrink      shrinkToFit
            truncate    fit as much as possible
            set fakeWidth to False to make _listWrapOn do the 'right' thing
        ÚerrorÚoverflowrYÚtruncatez%s invalid mode value %srz%s invalid maxHeight value %sN)rZr[rYr\)ÚnameÚmaxWidthrÿÚmoderòrZrZ
mergespacerör&r%ré)
rr^rÿr÷rær_r]r%r&rérrrr`s
zKeepInFrame.__init__cCs|j|j|jS)N)r^Ú_leftExtraIndentÚ_rightExtraIndent)rrrrÚ_getAvailableWidthuszKeepInFrame._getAvailableWidthcCs~d|jjtt|ƒƒ|jƒt|ddƒr4dt|ddƒp6dt|ddƒrVdtt|ddƒƒpXdt|ddƒrvd	tt|dƒƒpxdfS)
Nz<%s at %s%s%s> size=%sx%sr]r_z
 name="%s"r^z maxWidth=%srrÿz
 maxHeight=%s)rTrrUrVrWrEr)rrXrrrrZxs"zKeepInFrame.identitycsBddlm}ˆj}ttˆjp||ƒƒ‰ttˆjp2||ƒƒ}ˆj‰tˆj	ˆˆj
ˆd�\}}|dkr˜|ˆtksx||tkr˜d||ˆjdƒf}||ƒ‚�nž|ˆtkrÈ||tkrÈ|tˆ_
|tˆ_�nn|dkrôtˆ|ƒtˆ_
t||ƒtˆ_�nB‡‡‡fd	d
„}	|}
|}d}|ˆtk�rn|ˆ}
|	|
ƒ\}}||tk�rb|tˆ_
|tˆ_|
ˆ_||fS|
}|}|}
||}
|	|
ƒ\}}|tˆ_
|tˆ_|
ˆ_|td||d
ƒk�sÂ||tk�r6|}xndD]f}t|d|t||
||ƒƒ}|	|ƒ\}}||tk�rÌ|ˆtk�rÌ|tˆ_
|tˆ_|ˆ_P�qÌWˆj
ˆjfS)Nr)ÚLayoutError)rérZzcontent %sx%s too large for %sér[r\cs<t|ƒ}tˆj|ˆˆjˆd�\}}||}||}||fS)N)ré)r½rîrör))r1rêr�)rér^rrrÚfunc�s
zKeepInFrame.wrap..funcrgffffffî?é
ç{®Gáz„?çš™™™™™©?çš™™™™™¹?ç333333Ã?)r[r\)rrgrhrirj)r×rcr_r½r¼r^rÿrérîrör)rrZr"r#Ú_scalerWrQ)rrCrDrcr_rÿrêr�ÚidentreZW0ÚH0rOrPÚH1r`rír)rér^rrr=~s\ 




&


zKeepInFrame.wraprc	Cs¬t|ddƒ}|jdk}|dkp |}|r†|jƒ|r^|jƒ}|j|||j|jƒ|j|dd�n(|j||ƒd}}|j	d|d|ƒt
j||||||d�|r¨|jƒdS)Nrkgð?r\r)Ústroke)r;rÈ)
rEr_r4Z	beginPathr7r"r#ZclipPathr5rÈr1r<r8)	rr)r1r:r;rÈr\ÚssÚprrrr<ºs
zKeepInFrame.drawOn)N)r)rrrrrbrZr=r<rrrrrX_s

|j|j|jƒƒq|j|ƒqW|S)N)rörÃÚListFlowablerFrtrq)rr÷rårBr`rrrrtÿs

z_FindSplitterMixin._getContent)rNNT)N)rrrrxrtrrrrrrÌs
2rrc@sTeZdZdZddd„Zdd	„Zd
d„Zdd
„Zdd„Zdd„Z	dd„Z
ddd„ZdS)ÚImageAndFlowablesz(combine a list of flowables and an Imagerr–râNc		Cs8t|ƒ|_||_||_||_||_||_||_||_dS)N)	rôröÚ_IÚ_irpadÚ_ilpadÚ_ibpadÚ_itpadrÚ	imageHref)	rrråÚimageLeftPaddingÚimageRightPaddingÚimageTopPaddingÚimageBottomPaddingÚ	imageSider€rrrrs
zImageAndFlowables.__init__cCst|ƒ}|jƒ|jƒ|S)N)rÚ_resetrC)rrørrrrszImageAndFlowables.deepcopycCs6t|dƒr|j}nt|dƒr$|j}n|j}tj||ƒS)NÚ_C1Ú_C0)r.r‡rˆrör1rN)rrBrrrrNs

zImageAndFlowables.getSpaceAftercCst|jjƒtj|ƒƒS)N)r‡r{rPr1)rrrrrP%sz ImageAndFlowables.getSpaceBeforec
Cs.x(dD] }yt||ƒWqYqXqWdS)NÚ	_wrapArgsrˆr‡)r‰rˆr‡)Údelattr)rr2rrrr†(s

zImageAndFlowables._resetcCsR|j}|j}t|dƒrP|j||fkr@t|ddƒdkr@|j|jfS|jƒ|jƒ||f|_|j	||ƒ|j
||ƒ\}}||_||_|j
}|j}|j}	|j}
|||||_}|
||	}|tkrà|j|||ƒ\}
}|_|_n|}
d}|
|tk�rg|_|j|_t||ƒ}|_||_|j�s*||_nt|j||ƒ\}}|||_|j|jfS)Nr‰r¿r)r)r{r.r‰rEr"r#r†rÁr=rÀÚ_wIÚ_hIr}r|r~rÚ_iWrrxrˆr‡rör‡Ú_aHrî)rrCrDr)rrrZilpadZirpadZibpadZitpadZiWr?rêrmÚW1rnrrrr=/s@


zImageAndFlowables.wrapc	
Csàt|dƒr>|j}|j||fks.t|ddƒdk	r>|jƒ|jƒ|j||ƒ\}}|j|kr\gS|j}|rª|dj	|||jƒ}|s†g}q®|dg}|dd…|dd…}ng}t
|j|j||j|j
|j|j|j|jd�g|S)Nr‰r¿rr)r�r‚rƒr„r…r€)r.r{r‰rEr†rÁr=rŽr‡rGrzrˆr}r|rr~rr€)	rrCrDrrêr�rrHr‡rrrrGSs2


zImageAndFlowables.splitc	Csò|jdkr&||j}||j|j}n||j|j|j}|}|jj||||j|j|j	ƒ|j
r |j|j
|||j|j|j	||j||jfdd�|jrÀt
j|||||j|jd�|jrî|j\}}t
j|||||j|j|d�dS)Nrár)Zrelative)r÷r>)rr}r|r‹r"r{r<r#rrŒr€ZlinkURLrˆr1r�r‡r‰rŽ)	rr)r1r:r;ZIxZFxr>r?rrrr<os

"8
zImageAndFlowables.drawOn)rr–rr–râN)r)rrrrrrrNrPr†r=rGr<rrrrrz	s

	$rzc@s0eZdZdZdZddd„Zdd„Zdd	d
„ZdS)
Ú_AbsRectrTrNc		Cs4||_||_||_||_||_||_||_||_dS)N)Ú_xÚ_yr®r¯Ú_strokeColorÚ
_fillColorÚ_strokeWidthÚ_strokeDashArray)	rr1r:r"r#ÚstrokeWidthÚstrokeColorÚ	fillColorÚstrokeDashArrayrrrr„sz_AbsRect.__init__cCsdS)Nr)rrr)rrCrDrrrr=Žsz
_AbsRect.wrapcCsª|jtkr¦|jtkr¦|jo,|jdk	o,|jdk}|s8|jr¦|jƒ|r\|j|jƒ|j|jƒ|jrn|j	|jƒ|j
|j|j|j|j|rŠdnd|jr–dndd�|j
ƒdS)Nrr)roÚfill)r®rr¯r“r•r”r4r6r*r‹r7r‘r’r8)rr)r1r:r;Ústrrrr<‘s
0z_AbsRect.drawOn)rNNN)r)rrrr4rÞrr=r<rrrrr��s


r�c@s,eZdZdZdZdd„Zdd„Zdd„Zd	S)
Ú	_ExtendBGrTcCs||_||_||_dS)N)r’r¯Ú_bg)rr:r#r;r^rrrr¡sz_ExtendBG.__init__cCsdS)Nr)rrr)rrCrDrrrr=¦sz_ExtendBG.wrapc
CsX|j}|j}|j}|j}|j||j}|j|}|j}|jƒ}	|j	||||||ƒdS)N)
ržr’r¯rár®râÚ_x1r)Ú
getPageNumberr:)
rr^r;r@r?r<r=r>r)ÚpnrrrrÝ©s
z_ExtendBG.frameActionN)rrrr4rÞrr=rÝrrrrr�žs
r�c@s0eZdZdZdZddd„Zdd„Zdd	d
„ZdS)
Ú_AbsLinerTrNcCs.||_||_||_||_||_||_||_dS)N)r‘r’rŸÚ_y1r“r•r–)rr1r:Úx1Úy1r—r˜ršrrrr·sz_AbsLine.__init__cCsdS)Nr)rrr)rrCrDrrrr=Àsz
_AbsLine.wrapcCs^|jrZ|jdk	rZ|jdkrZ|jƒ|j|jƒ|j|jƒ|j|j|j|j|j	ƒ|j
ƒdS)Nr)r“r•r4r6r*rhr‘r’rŸr£r8)rr)r1r:r;rrrr<Ãsz_AbsLine.drawOn)rNN)r)rrrr4rÞrr=r<rrrrr¢´s

	r¢c@sDeZdZdZddd	„Zdd
d„Zdd
„Zdd„Zdd„Zdd„Z	dS)ÚBalancedColumnsz(combine a list of flowables and an Imager³rªrNr_çš™™™™™¹?cCs¦|pdt|ƒ|_|dkr.td||jƒfƒ‚t|ƒ|_||_||_||_||_	|	|_
|
|_||_||_
|t|_||_|
|_||_||_||_||_||_||_dS)NzBalancedColumns-%dr³z'nCols should be at least 2 not %r in %s)rVr]r/Z
identitityrôröÚ_nColsrMr9Ú
_innerPaddingÚ
_rightPaddingÚ_topPaddingÚ_bottomPaddingrOrÚ_neededÚshowBoundaryÚendSlackÚ_boxStrokeColorÚ_boxStrokeWidthÚ
_boxFillColorÚ
_boxMarginÚ_vLinesStrokeColorÚ_vLinesStrokeWidth)rråÚnColsÚneededrOrMr®ÚleftPaddingÚinnerPaddingÚrightPaddingÚ
topPaddingÚ
bottomPaddingr]r¯ÚboxStrokeColorÚboxStrokeWidthÚboxFillColorÚ	boxMarginÚvLinesStrokeColorÚvLinesStrokeWidthrrrrÍs*


zBalancedColumns.__init__c
Cs@d|jj|jtt|ƒƒ|jƒt|ddƒr8dt|ddƒp:dfS)Nz<%s nCols=%r at %s%s%s>r]r_z
 name="%s")rTrr¨rUrVrWrE)rrXrrrrZíszBalancedColumns.identitycCs|jS)N)rM)rrrrrNòszBalancedColumns.getSpaceAftercCs|jS)N)rO)rrrrrPõszBalancedColumns.getSpaceBeforec7s`g}ˆj‰ddlm}m}m}ddlm‰ddlm}ˆjdkrFˆjnˆj‰
ˆj	dkr\ˆj	nˆj	‰
ˆj
dkrrˆj
nˆj
‰ˆjdkrˆˆjnˆj‰ˆj}ˆj
}	ˆjdkr®tˆ
ˆ
ƒnˆj}
|
d‰	ˆj‰ˆj‰||
ˆdˆ
ˆ
tˆƒ‰|}|ˆˆ8}ˆjˆˆˆ|dd�\}}
}}|�sHtd	ˆjƒ||ˆˆ|d
d„ˆjDƒfƒ‚i‰d%‡‡‡‡‡fdd
„	‰d}|�rt|}�nddl}‡‡fdd„}d|jdƒddf‡fdd„	}tt|
tˆƒˆjdƒ|ƒ}ˆ|ƒˆ|d�s||||ƒ}|�r|\}}
}}|
}d}n
|}ˆj}nT|
tˆƒ}ˆ|ƒˆ|d�sh||||ƒ}|�r^|\}}
}}|
}d}n
|}ˆj}|�sxtdƒ‚ˆ||ƒ\}}}}ˆjƒ|dgk�rÊ|dgk�rÊ|�rÊ||dg|d}}ˆj}ˆj }ˆj!}|ˆˆ|}|ˆˆ‰|ˆ‰|tˆƒ‰|�s|	�r2|||	ƒ}|||	ƒ}nd}}ˆj"dk	�rLˆj"nˆj"‰||ˆj‰‡‡‡‡‡‡	‡
‡‡‡
‡‡‡‡fdd„t#ˆƒDƒ}ˆj$dƒ‰ˆdk�r´|dˆjƒƒ‚t%ˆddƒ} | �rÎ| d&nd}!}"G‡‡fdd„d|ƒ}#|"�r
t&ˆˆ|"ˆƒ}!|j'|!ƒˆj(}$|j'|#g||dƒƒ|�r6|j'|ƒˆj)�rRˆj*�rRˆj*dk�pVˆj+}%ˆj,�opˆj-�opˆj-dk}&|%�s~|&�rˆj.}'|'�sŽd'}'t/|'ƒdk�r²|'d}(})}*}+n”t/|'ƒdk�rÚ|'d}(}+|'d})}*nlt/|'ƒdk�r|'d}(|'d})}*|'d}+n@t/|'ƒdk�r6|'d}(|'d}*|'d}+|'d})ntdt0|'ƒƒ‚ˆ|)},|d(j|d)j!|*}-ˆ|+}.ˆ|(|+}/|.|/}0|%�r¨t1|,|.|-|,|/ˆj+ˆj)ˆj*d�}1|&�rg}2xft#dˆƒD]N}3d||3j||3dj||3dj!}4|2j't2|4|.|4|0ˆj-ˆj,d �ƒ�q¾Wn|}0ˆ}.|%�r*|j'|1ƒ|&�r:|j3|2ƒˆj4ƒ}5x`t#ˆƒD]T}3||3}6|6�r†t5|||6d!d"�}6t|5|6j4ƒƒ}5|j'|6ƒ|3ˆdk�rL|j'|ƒ�qLW|j'|#| |$ˆƒƒ|!�rè|�rÆd}5tˆ|.ƒ|5|!_6t||0ƒ|!j6|!_7|�rø|j'|ƒ|�rX|j't8|ˆˆj9ˆj:ˆjˆj"ˆjˆjˆj	ˆj
ˆjˆj;d#ˆjˆj)ˆj*ˆj+ˆj.ˆj,ˆj-d$�ƒˆ|fS)*Nr)rcr3rÜ)ÚFrame)rÖgà?rF)rwzB%s cannot make initial split aW=%r aH=%r ie cw=%r ah=%r
content=%scSsg|]}|jj‘qSr)rTr)rƒr`rrrr†sz6BalancedColumns._generated_content..csþ|ˆkròg}d}d}d}|r$ˆdnd}xžtˆƒD]’}ˆjˆˆ||dd�\}}	}
}t||ƒ}t||	ƒ}|j|
ƒ||krÀˆjˆˆd||dd�\}}
}}|
d||krÀ|j|ƒ|d}g}P|}q2W|dt|gkƒ|gk||||ffˆ|<ˆ|dS)	Nrr³rF)r÷rwg�íµ ÷ư>i †r)r{rxr‡rqrˆ)Úahr¯rør@rAÚcnZicheckrJZwiÚhiÚc0Úc1ZwcZhcZcc0Zcc1)Ú_fresr)Úcwr¶rrrÚ	splitFuncs*


 
*z5BalancedColumns._generated_content..splitFunccsˆ|ƒˆ|dS)Nrr)rÄ)rÉrËrrre1sz0BalancedColumns._generated_content..funcér³csž||||}||||}xNt||ƒ|krn||ƒ||ƒkrH|}n|}||||}||||}q"Wdd„ˆjƒDƒ}|rš|jƒ|ddSdS)NcSs g|]\}}}|r|||f‘qSrr)rƒr1ZtfÚvrrrr†BszCBalancedColumns._generated_content..gss..rr³)rIÚvaluesÚsort)r`r2r•ZtolÚgrrørÊrå)rÉrrÚgss5sz/BalancedColumns._generated_content..gssgš™™™™™Ù?zunexpected non-empty C2csZg|]R}ˆˆ|ˆˆ
ˆˆ|s"ˆnˆˆ|ˆdkr6ˆ	nˆˆdˆ
j|fˆˆjˆjd�‘qS)rz%s-%d)r¸r¼rºr»rVr®rÚ_debug)r]Z_oASpacerÒ)rƒrJ)rÃÚbpadrÉÚfhr^ÚhgapÚlpadr¶ÚobxÚrpadrr®ÚtpadÚy2rrr†usÚpageTemplatez&%s used in non-doctemplate environmentr5cs0eZdZdZggdfdd„Z”f‡fdd„	ZdS)z3BalancedColumns._generated_content..TActionz?a special Action flowable that sets stuff on the doc template TNcSs tj|ƒ||_||_||_dS)N)rrÚbgsrår`)rrÜrår`rrrrˆs
z.TAction.__init__cs*|j|_|jˆ_|j|jjƒ|jˆ_dS)N)råÚframesrÜr5Zhandle_currentFramer`rV)rÚdocrM)r^rrr6Žsz9BalancedColumns._generated_content..TAction.apply)rrrrrr6r)rMr^rrÚTAction†srßr–rËzInvalid value %s for boxMargin)r™r˜r—)r—r˜rY)r_z-1)r¶r·rOrMr®r¸r¹rºr»r¼r]r¯r½r¾r¿rÀrÁrÂ)rr)rrrrrr)r?ÚGrcr3rÜrÖZleftExtraIndentZrightExtraIndentÚgapZaH0rêrmrˆZC2r¯r�rSrerÑrnr�rBrr¤r¥ÚfwZftopZ	indenter0Z	indenter1råZBGsZxbgr;rßÚ	oldFramesZdoBoxZdoVLinesZobmZobmtZobmlZobmrZobmbZobx1Zobx2Zoby2ZobhZoby1ZboxZvLinesrJZvlxÚsaZCir)rÃrMrÉrÓr)rÊrÉrÔr^rÕrÖr¶r×rØrr®rËrÙrÚrrßøsD   "$



"


*&



z"BalancedColumns._generated_contentcCsN||j|jtkr$tƒ|g}d}n|j||ƒ\}}|jj|Ždt||ƒfS)Nr)rOr­rrÐrßr]rØr¼)rr>r?rárnrrrr=ìs
zBalancedColumns.wrap)r³rªrrNNNNNNr_r§NrNNNN)N)
rrrrrrZrNrPrßr=rrrrr¦Ës 

ur¦c@s8eZdZdZdZdZdd„Zdd„Zdd	„Zd
d„Z	dS)
ÚAnchorFlowablezcreate a bookmark in the pdfrTcCstj|ddƒ||_dS)Nr)rÎrÚ_name)rr]rrrrüszAnchorFlowable.__init__cCsd|jj|jfS)Nz%s(%s))rTrrç)rrrrrfszAnchorFlowable.__repr__cCsdS)Nr)rrr)rr>r?rrrr=szAnchorFlowable.wrapcCs|jj|jddƒdS)Nr)r)ZbookmarkHorizontalrç)rrrrr*szAnchorFlowable.drawN)
rrrrr4rÞrrfr=r*rrrrræøsræc@s,eZdZdd„Zdd„Zdd„Zdd„Zd	S)
Ú_FBGBagcCsDt|ƒ}t|jtƒr||jks(||jkoBt|ƒ|jkoB|j|jƒkS)N)rVrÃÚfidrðÚcidr¡r )rr^r)rérrrÚmatches
s z_FBGBag.matchescCs&|j|jjƒ|_tt|jdd…ƒS)NrrÌ)Ú_codeÚcodePosrGÚ_instrr½)rr)rrrÚgetDimssz_FBGBag.getDimscCs2t||||ƒg|jdd…<dj|jƒ|j|j<dS)NrrÌú )rrîr€rìrí)rr)r1r:r@rArrrÚsetDimssz_FBGBag.setDimscCs:t|ƒtkot|ƒtk�r6|jƒ}|jt|ƒkrv|jt|ƒkrv|j|krv|j|ƒ\}}	}
}|j||||
||	|ƒnÀ|j	ƒ|j
}|r’|j|ƒ|j}
|
dks¨|
dkr¬dn|j
}|rÞ|j|ƒ|j|
ƒ|j}|rÞ|j|ƒt|ƒ|_t|ƒ|_||_t|jƒ|_|j|||||�rdnd|�r&dndd�|jƒdS)Nrr)ror›)rIrr rérVrêr¡rïrñr4r™r‹r—r˜r6r*ršr,rkrìrír7r8)rr)r^r>r@r=r?r¡ZoxZoyZowZohZfbgcÚswÚscÚdarrrr:s.&





*z_FBGBag.renderN)rrrrërïrñr:rrrrrè	srèc@s.eZdZdZdZddd„Zdd	„Zd
d„ZdS)
ÚFrameBGa$Start or stop coloring the frame background
    left & right are distances from the edge of the frame to start stop colouring.
    if start in ('frame','frame-permanent') then the background is filled from here to the bottom of the frame and immediately discarded
    for the frame case.
    rNrTc	CsTtj|ddƒ||_|rPddlm}||ƒ|_||ƒ|_||_||_||_	||_
dS)Nr)Ú_evalMeasurement)rÎrr8r×rörárâr&r—r˜rš)	rr&rárâr8r—r˜ršrörrrr8s

zFrameBG.__init__cs(dˆjjdj‡fdd„djƒDƒƒfS)Nz%s(%s)z, cs g|]}d|tˆ|dƒf‘qS)z%s=%rN)rE)rƒrJ)rrrr†Esz$FrameBG.__repr__..zstart color left right)rTrr€rG)rr)rrrfDszFrameBG.__repr__cCs”t|ddƒ}|dkrdS|jr€|j}|j}|dkr6dn|}|jjt|j|j|j	|jd	kr^|jnd|j|j|j
ddd
ddd�ƒn|jr�|jjƒdS)Nr]rr^úframe-permanentrT)rárâr™r8r˜r—ršrérêr¡rír7r)r^r÷r)rEr8r˜r—r5rqrèrárâr&ršrà)rr^róròrrrr*Gs,zFrameBG.draw)NrrTNNN)rrrrr4rrfr*rrrrrõ1s

rõc@s.eZdZdZdZgdddfdd„Zdd	„Zd
S)Ú
FrameSplittera@When encountered this flowable should either switch directly to nextTemplate
    if remaining space in the current frame is less than gap+required or it should
    temporarily modify the current template to have the frames from nextTemplate
    that are listed in nextFrames and switch to the first of those frames.
    rrfrªTcCs&||_|pg|_||_||_||_dS)N)rÑÚ
nextFramesrâÚrequiredÚadjustHeight)rrÑrùrârúrûrrrrfs

zFrameSplitter.__init__cs˜ˆj}ddlm}m}m}|ˆjƒg}|ˆjˆjtkrJ|j	t
ƒƒ�n@ˆjdƒ}|dkrl|dˆjƒƒ‚‡fdd„|Dƒ}	|	s˜|dˆjƒˆjfƒ‚|	d}	‡fdd„|	j
Dƒ}
d	d„|
Dƒ‰‡fd
d„ˆjDƒ‰ˆ�r|dˆjƒˆ|	j|	dd„|	j
Dƒfƒ‚ˆjd
ƒ}	|	|	j|	j
fdd„}||	_|ˆj}x.z%s.nextTemplate=%s not foundcsg|]}|jˆjkr|‘qSr)rVrù)rƒr`)rrrr†}scSsg|]
}|j‘qSr)rV)rƒr`rrrr†~scsg|]}|ˆkr|‘qSrr)rƒr`)ÚNrrr†sz;%s frames=%r not found in pageTemplate(%s)
%r has frames %rcSsg|]
}|j‘qSr)rV)rƒr`rrrr†�srÛcSs||_||_|||ƒdS)N)rÝÚonPage)r)rÞrMrÿrärrrÚunwrapƒsz"FrameSplitter.wrap..unwrap)rr)r]r×rürýrcrÑrârúrrqrÐr\rZrÝrùrVrÿrurrûr#r†rØ)rr>r?r^rürýrcráZ	templatesrMrårrArJr`r)rþrrr=ms>
(


zFrameSplitter.wrapN)rrrrr4rr=rrrrrø_srø)Ú_type2formatteru•uâ—�uâ– uâ—‹uâ—†uâ�–u➤uâ�‡uâ��u★)
Ú
bulletcharZcircler)ZdiscZdiamondZ	diamondwxZ
rarrowheadZsparkleZ	squarelrsZ	blackstarÚ1cCs`|dkrtj||ƒ}nt|t|ƒƒ}|r\t|tƒr>||}nt|ƒrP||ƒ}ntd|ƒ‚|S)NÚbulletz!unexpected BulletDrawer format %r)Ú_bulletNamesr¹rrˆrÃrÚcallabler/)ÚvalueÚtypeÚformatrírrrÚ
_bulletFormat¢s


r
c
@s eZdZdd
d„Zddd
„Zd	S)ÚBulletDrawerÚ0rárÚblackÚ	HelveticargrÚltrNcCs@||_||_||_||_||_||_||_||_|	|_|
|_	dS)N)
rÚ_bulletAlignÚ_bulletTypeÚ_bulletColorÚ_bulletFontNameÚ_bulletFontSizeÚ_bulletOffsetYÚ
_bulletDedentÚ
_bulletDirr
)rrÚbulletAlignÚ
bulletTypeÚbulletColorÚbulletFontNameÚbulletFontSizeÚ
bulletOffsetYÚbulletDedentÚ	bulletDirÚbulletFormatrrrr²szBulletDrawer.__init__c	Cs.|j}|sdS|jƒ|j||ƒ|j|j|j}|jdkrR|j|j|j	}n|j
|j	}|j|j|jƒ|j
|jƒ|j}t||j|jƒ}|dkr¨|j|||ƒnz|dkrÀ|j|||ƒnb|dkrØ|j|||ƒnJ|jdƒsî|jdƒ�r|dd…jƒ�pd	}|j||||ƒntd
|ƒ‚|jƒdS)NZrtlrárâÚcenterÚcentreÚnumericÚdecimaléÚ.zInvalid bulletAlign: %r)r!r")rr4r5r#rrrr"Ú_rightIndentrÚ_leftIndentrirr‹rrr
rZ
drawStringZdrawRightStringrjÚ
startswithrlZdrawAlignedStringr/r8)	rZindenterr)r1r:r;rrZpcrrrr<És0
zBulletDrawer.drawOn)
rrárr
rrgrrrN)r)rrrrr<rrrrr±s

rcCs t||j|jƒ}t||j|jƒS)N)r
rrrr)r•rrrrÚ_computeBulletWidthæsr*c@sZeZdZdjƒZddd„Zdd„Zddd„Zd	d
„Zdd„Zd
d„Z	dd„Z
ddd„ZdS)Ú
DDIndenterz/_flowable _leftIndent _rightIndent width heightrcCs"||_||_||_d|_d|_dS)N)Ú	_flowabler(r'r"r#)rÚflowablerŠrrrrrìs
zDDIndenter.__init__cs,ˆjj|ˆjˆj|ƒ}‡fdd„|DƒS)Ncsg|]}t|ˆjˆjd�‘qS))rŠr)r+r(r')rƒrí)rrrr†ösz$DDIndenter.split..)r,rGr(r')rr>r?rHr)rrrGós
zDDIndenter.splitcCs.|jj|||j|td||j|jƒƒdS)Nr)r,r<r(r‡r')rr)r1r:r;rrrr<üszDDIndenter.drawOncCs@|jj||j|j|ƒ\}}||j|j|_||_|j|fS)N)r,r=r(r'r"r#)rr>r?r@rArrrr=ÿszDDIndenter.wrapcCsN||jkrBy
|j|Stk
r@|dkr.)r,rGr(r')rr>r?r)rHrrrG+szLIIndenter.splitcCsH|jr|jj||||dƒ|jj|||j|td||j|jƒƒdS)Nr)r4r<r,r(r‡r')rr)r1r:r;rrrr<5szLIIndenter.drawOn)rrNNN)r)rrrrGr.rr<rrrrr3s

r3)Ú	ListStylec@seZdZddd„ZdS)ÚListItemNcKsÀt|ttfƒs|f}||_i}|_|rLt|tƒsFtd|jj|fƒ‚||_	xrrrrgsz_LIParams.__init__N)rrrrrrrrr=fsr=c@sZeZdZdZddd„Zedd„ƒZdd„Zd	d
„Zdd„Z	dd
d„Z
ddd„Zdd„ZdS)ryÚ1aAiINc
Ksl||_|r*t|tƒs$td|jjƒ‚||_x6tjjƒD](\}}t	|d||j
|t|||ƒƒƒq6Wx4dD],}|j
|t||dƒƒ}|dk	rht	|||ƒqhWd}|dkrÖt|ddƒ}|dkrÖ|jdkrÌd}d	}n
|j}d	}|jdk�r@|�rxV|D] }||j
krîtd
||jfƒ‚qîWn,x*|jD] }||j
k�rtd|jƒ‚�qW||_|�pXt|ttfƒ|_d|_d|_dS)
Nz!%s style argument not a ListStylerGrOrMFÚ_startrrTz!invalid start=%r or bullettype=%rzinvalid bullettype=%r)rOrM)r7rÃr5r/rTrrKr:Úitemsr0r¹rErÚ
_numberStylesr@rðrñÚ_autoÚ
_list_contentÚ_dims)rrþr8rKrr<rÍrŽrrrros@
$



zListFlowable.__init__cCs|jdkr|jƒ|_|`|jS)N)rDrtr7)rrrrrö©s

zListFlowable._contentcCs4|j|kr(t|j||jƒ\|_|_||_|j|jfS)N)rErîrör)r"r#)rr>r?rrrr=°s
zListFlowable.wrapcCs|jS)N)rö)rr>r?rrrrG¶szListFlowable.splitc
	csr�xj|jD�]^}t|ttfƒrT|rRx.t|ƒD]"\}}|dkoFt|tƒ|fVq,Wq
t|tƒ�rX|j}|s¤xêt|jƒD](\}}t|tƒr�tdƒ‚|dk|fVqvWn²|j	ƒ}|j
ddƒ}|j
ddƒ}|j
ddƒ}t|jƒd}xŠt|jƒD]h\}}|j	ƒ}	|�r|dk	�r||	d<||k�r0|dk	�r0||	d<|�r:d}dt||	||dkƒfVqêWq
t|tƒ|fVq
WdS)Nrz"LIIndenter not allowed in ListItemrrOrMr)
r7rÃrðrñrur3r6r8r/rràrkr=)
rr`rJÚzr;rrOrMrLrrrrÚ_flowablesIter¹s6 
zListFlowable._flowablesItercCsb|rL|jd|jƒ}|jd|jƒ}|jddƒ}|jddƒ}t||||||d�St||j|j|ƒSdS)NrŠrrOrM)rOrM)r¹r(r'r3)rr-rr;rŠrrOrMrrrÚ_makeLIIndenterØszListFlowable._makeLIIndentercsrˆdkr‡fdd„}ntˆddƒ‰‡‡‡fdd„}t||dƒ|dƒ|dƒ|dƒ|d	ƒ|d
ƒ|dƒ|dƒ|d
ƒd�
S)Ncstˆd|ƒS)NrG)rE)r2)rrrÚgetpäsz&ListFlowable._makeBullet..getprKcs6|ˆkrˆ|Sˆr(|ˆjkr(tˆ|ƒStˆd|ƒS)NrG)rÄrE)r2)r;rrKrrrIès

rrrrrrZcalcBulletDedentrr )
rrrrrrrrrr )rEr)rrr;rIr)r;rrKrÚ_makeBulletâszListFlowable._makeBulletc
Cs|j}|j}t|ttfƒr(|}|d}n|g}|d}t|dkƒ}|rdyt|ƒ}Wnd}YnX|j}|dk�rš|j}|j}|dkrš|dkrš|j	}�n|dkrª|j
}nð|}	d}
x’|jƒD]†\}}|ræt|
t
||	ƒƒ}
|rä|	|7}	q¼t|tƒr¼|j}
|
�r&|
j|k�r6t|
t
|
|
jƒƒ}
t|
jƒ}	nt|
t
||	ƒƒ}
|r¼|	|7}	q¼W|dk�rv|dk�rf|j	|
}n|j	|
d}n$|dk�rŒ|j
|
}n|j
|
d}||_g}|j}d}�x|jƒD�]\}}t|tƒ�rD|j}t|ttfƒ�rî|d}||k�rD|j�r@|j|ƒd}||d…|d|…|_|jd}|�rD||_n|}i}|�st|d7}t|d	dƒ}|dk	�rt||d	<|�r¦||j||j|ƒ|d
�ƒ|�rÆ||7}�qºt|tƒ�r8|j}
|
�rè|
j|k�rÜtd|
j|fƒ‚t|
jƒ}n|j|t|ddƒd
�|_|�r t|jjd	dƒ|ƒ|jd	<||ƒ|�rÆ||7}nŽt|tƒ�r²|j|jƒ|j|j d|d
�}|j!�r¨|jdk	�rŠ|j}|�rŠt|ƒ}|j||jƒ|_|�r¨||7}||ƒn||j|d|d
�ƒ�qºWt|ddƒ}|dk	�r|d}t|jjddƒ|ƒ|jd<|S)Nrr?rrŽrrárâgà?rO)rr;z>Included LIIndenter bulletType=%s != OrderedList bulletType=%sr;)r;rMr)"rr@rÃrðrñrˆrrrr(r'rGr‡r*r3r4rrZ_calcBulletDedentrqryrCÚindexrErHrJr/rÄr¹r=Úupdater;r-r>)rZbtrrÎZautovÚincZbdZalignÚdirZtvalueZmaxWrÊr`r•rHZaSrJZfstartZfparamsrOrFrMrrrrtúsÊ














zListFlowable._getContent)NN)N)N)
rrrrBrrcrör=rGrGrHrJrtrrrrryms
7


ryc@sJeZdZdZdd„Zdd„Zdd„Zdd	d
„Zdd„Zd
d„Z	dd„Z
dS)Ú	TopPadderz‡wrap a single flowable so that its first bit will be
    padded to fill out the space so that it appears at the
    bottom of its framecCs||jd<dS)NÚ
_TopPadder__f)rÄ)rr`rrrrl	szTopPadder.__init__cCs(|jj||ƒ\}}|||jd<||fS)NÚ_TopPadder__dh)rPr=rÄ)rr>r?r@rArrrr=o	szTopPadder.wrapcCs.|jj||ƒ}t|ƒdkr*t|dƒ|d<|S)Nrr)rPrGrkrO)rr>r?rHrrrrGt	szTopPadder.splitrcCs&|jj|||td|jdƒ|ƒdS)Nrg:Œ0âŽyE>)rPr<r‡rQ)rr9r1r:r;rrrr<z	szTopPadder.drawOncCst|j||ƒdS)N)r0rP)rr2rÍrrrr1}	szTopPadder.__setattr__cCst|j|ƒS)N)rErP)rr2rrrrÆ€	szTopPadder.__getattr__cCst|j|ƒdS)N)rŠrP)rr2rrrr2ƒ	szTopPadder.__delattr__N)r)rrrrrr=rGr<r1rÆr2rrrrrOh	s
rOc@s6eZdZdZdZd
dd„Zdd„Zdd	„Zd
d„ZdS)Ú	DocAssignzJAt wrap time this flowable evaluates var=expr in the doctemplate namespacerÚforevercCstj|ƒ|||f|_dS)N)rrr)rÚvarÚexprZliferrrr‰	s
zDocAssign.__init__cCsR|jdƒ}|jt||d�ƒz|jƒSx$dD]}y
||=Wq,Yq,Xq,WXdS)NÚ
_nameSpace)ÚavailableWidthÚavailableHeightrWrX)rWrX)r\rLÚdictre)rr>r?ÚNSr<rrrÚfuncWrap�	s


zDocAssign.funcWrapcCs |jd|jjdd…ƒ|jŽS)NrÊr)r\rTrr)rrrrre™	szDocAssign.funccCs|j||ƒdS)Nr)rr)r[)rr>r?rrrr=œ	szDocAssign.wrapN)rS)	rrrrr4rr[rer=rrrrrR†	s
rRc@seZdZdZddd„ZdS)ÚDocExecz(at wrap time exec stmt in doc._nameSpacerScCstj|ƒ||f|_dS)N)rrr)rÚstmtZlifetimerrrr¢	s
zDocExec.__init__N)rS)rrrrrrrrrr\ 	sr\c@s:eZdZdZddd„Zdd„Zdd	„Zd
d„Zdd
„ZdS)ÚDocParaaHat wrap time create a paragraph with the value of expr as text
    if format is specified it should use %(__expr__)s for string interpolation
    of the expression expr (if any). It may also use %(name)s interpolations
    for other variables in the namespace.
    suitable defaults will be used if style and klass are None
    NTcCs,tj|ƒ||_||_||_||_||_dS)N)rrrUr	rKÚklassÚescape)rrUr	rKr_r`rrrr­	s
zDocPara.__init__cCs.|j}|r*t|tƒst|ƒ}|jdƒ|ƒSdS)NZdocEval)rUrÃr0r\)rrUrrrreµ	s

zDocPara.funccGs|jdƒj|ŽdS)Nr^)r\rØ)rrrrrÚadd_content»	szDocPara.add_contentcCsR|j||ƒ}|jrF|jdƒjƒ}|jt||d�ƒ||d<|j|}nt|ƒ}|S)NrV)rWrXZ__expr__)r[r	r\rrLrYr0)rr>r?rrZrrrÚ	get_value¾	szDocPara.get_valuecCsr|j||ƒ}|j}|s"ddlm}|j}|sBddlm}|ƒd}|jr\ddlm}||ƒ}|j	|||d�ƒdS)Nr)rs)ÚgetSampleStyleSheetZCode)r`)rK)rr)
rbr_rvrsrKÚreportlab.lib.stylesrcr`Zxml.sax.saxutilsra)rr>r?rrrKrcr`rrrr=É	s
zDocPara.wrap)NNNT)	rrrrrrerarbr=rrrrr^¦	s
r^c@s&eZdZddd„Zdd„Zdd„ZdS)	Ú	DocAssertNcCstj|ƒ||_||_dS)N)rrrUr	)rÚcondr	rrrrÙ	s
zDocAssert.__init__cCstj|||ƒ|_|jS)N)r^r[Ú_cond)rr>r?rrrr[Þ	szDocAssert.funcWrapcCs"|j||ƒ}t|jƒst|ƒ‚dS)Nr)rr)rbÚboolrgrò)rr>r?rrrrr=â	s
zDocAssert.wrap)N)rrrrr[r=rrrrreØ	s
rec@s(eZdZgfdd„Zdd„Zdd„ZdS)ÚDocIfcCs"tj|ƒ||_|pg|f|_dS)N)rrrUÚblocks)rrfZ	thenBlockZ	elseBlockrrrré	s
zDocIf.__init__cCst|ttfƒs|f}|S)N)rÃrðrñ)rÚblockrrrÚ
checkBlockî	szDocIf.checkBlockcCs*|j|j|jtt|j||ƒƒƒƒŽdS)Nr)rr)rarlrjrˆrhr[)rr>r?rrrr=ó	s&z
DocIf.wrapN)rrrrrlr=rrrrriè	sric@seZdZdd„Zdd„ZdS)ÚDocWhilecCs tj|ƒ||_|j|ƒ|_dS)N)rrrUrlrk)rrfZ
whileBlockrrrrø	s
zDocWhile.__init__cCs*t|j||ƒƒr&|jt|jƒ|gŽdS)Nr)rr)rhr[rarðrk)rr>r?rrrr=ý	sz
DocWhile.wrapN)rrrrr=rrrrrm÷	srmc@s"eZdZdZddd„Zdd„ZdS)	ÚSetTopFlowablesrFcCs||_||_dS)N)Ú_FÚ_show)rråÚshowrrrr
szSetTopFlowables.__init__cCs:tt|ddƒddƒ}|r6|j|_|jr6|jr6|j|j_dS)Nr)r[r)rr)rEroZ
_topFlowablesrpr^rß)rr>r?rÞrrrr=
s
zSetTopFlowables.wrapN)F)rrrÚ
_ZEROZSIZErr=rrrrrn
s
rnc@s"eZdZdZddd„Zdd„ZdS)	ÚSetPageTopFlowablesrFcCs||_||_dS)N)rorp)rrårqrrrr
szSetPageTopFlowables.__init__cCs:tt|ddƒddƒ}|r6|j|_|jr6|jr6|j|j_dS)Nr)r[r)rr)rEroZ_pageTopFlowablesrpr^rß)rr>r?rÞrrrr=
s
zSetPageTopFlowables.wrapN)F)rrrrrrr=rrrrrs
s
rs)r)rNNN)rN)dÚ__version__rr�rrZreportlab.lib.colorsrrZreportlab.lib.rl_accelrZreportlab.lib.enumsrrr	rdr
r rrZreportlab.lib.abagr
Zreportlab.pdfbaserZreportlab.pdfbase.pdfmetricsrZreportlab.rl_configrrrrrGÚ__all__rrrdrnrsrtrzrur}rŒrÍrÎrÏrÐrÓrÔrÕrîrôrõrúr
rrrrr r!r"r-r0r1rDrQrWrXrrrzr�r�r¢r¦rærèrõrøZreportlab.lib.sequencerrrYrr
rr*r+r3r5r6r=ryrOrRr\r^rerirmrnrsrrrrÚs¼
(N

5
D
@,:gm=x/(.5
53*|2