)Ej#8dZddlmZddlmZmZmZmZmZddl m Z m Z m Z ddl mZddlmZddlmZmZmZdd lmZerdd lmZeGd d ZGd deZGddeZdeedeeezfdZGddZdS)u4 Quoting section 8.2.2 "Document Outline" of the 2006 PDF spec 1.7: > The document outline consists of a tree-structured hierarchy of outline items (sometimes called bookmarks), > which serve as a visual table of contents to display the document’s structure to the user. The contents of this module are internal to fpdf2, and not part of the public API. They may change at any time without prior warning or any deprecation period, in non-backward-compatible ways. Usage documentation at: ) dataclass) TYPE_CHECKINGAnyIteratorOptionalSequence)AlignXPosYPos) TextStyle) StructElem)DestinationXYZ PDFObject PDFString)FloatTolerance)FPDFc eZdZUdZeed<eed<eed<eed<ee ed< d dededededee ddf d Z dS) OutlineSectionnamelevel page_numberdest struct_elemrrrrrNreturncL||_||_||_||_||_dSNr)selfrrrrrs >C:\PYTHON\MyICR_Suite\python\Lib\site-packages\fpdf/outline.py__init__zOutlineSection.__init__$s/  & &r) __name__ __module__ __qualname__ __slots__str__annotations__intrrrr!r"r rrsHI III JJJ *%%%%-1 ' ' ' ' '  ' j) '  ' ' ' ' ' 'r"rc ^eZdZdZ d dedeedeeddffd ZdefdZ xZ S) OutlineItemDictionary) _idtitleparentprevnextfirstlastcountrrNr.rrrctt|d|_d|_d|_d|_d|_d|_d|_ ||_ ||_ dS)NT)encryptr) superr!rr.r/r0r1r2r3r4rr)rr.rr __class__s r r!zOutlineItemDictionary.__init__Asn ud333 KO 59 59 6: 59  .2 1<r"c(d|jd|jdS)NzOutlineItemDictionary(title=z, dest=))r.rrs r __str__zOutlineItemDictionary.__str__RsMdjMMMMMMr")NN) r#r$r%r&r'rrrr!r< __classcell__r8s@r r,r,3s I *.,0 ===~&=j) =  ======"NNNNNNNNNr"r,c8eZdZdZdeddffd ZdefdZxZS)OutlineDictionary)r-typer2r3r4kwargsrNc rtjdi|d|_d|_d|_d|_dS)Nz /Outlinesrr*)r7r!rAr2r3r4)rrBr8s r r!zOutlineDictionary.__init__Ys@""6"""    r"cd|jdS)NzOutlineDictionary(count=r:)r4r;s r r<zOutlineDictionary.__str__`s7$*7777r") r#r$r%r&rr!r'r<r=r>s@r r@r@Vsk9I888888888r"r@sectionsrc#Kt}|Vg}i}|D]Պtjjj}|Vj|vr|j}||_||_jdz |vr|jdz }n|}||_|j ||_ ||_ |xj dz c_ | |||j<fd| D}dS)z Build PDF objects constitutive of the documents outline, and yield them one by one, starting with the outline dictionary )r.rrr Nc2i|]\}}|jk||Sr*)r).0roitemsections r z&build_outline_objs..s6' ' ' u %% 5%%%r")r@r,rrrrr1r0r/r2r3r4appenditems)rEoutline outline_itemslast_outline_item_per_level outline_itemlast_outline_item_at_levelparent_outline_itemrJs @r build_outline_objsrTdsg !!G MMM13MDF" " ,,+    =7 7 7)DW])S &.: & + :L  =1  ; ; ;"=gma>O"P  ") 1   $ , %    !!Q&!!\***5A#GM2' ' ' ' ; A A C C' ' ' ##=" " r"c eZdZdZ ddeeded ed ed ed df d Zddde d efdZ ddde d dfdZ ddde e d dfdZ dS)TableOfContentsa A reference implementation of a Table of Contents (ToC) for use with `fpdf2`. This class provides a customizable Table of Contents that can be used directly or subclassed for additional functionality. To use this class, create an instance of `TableOfContents`, configure it as needed, and pass its `render_toc` method as the `render_toc_function` argument to `FPDF.insert_toc_placeholder()`. NF@?T text_styleuse_section_title_styles level_indent line_spacingignore_pages_before_tocrch|p t|_||_||_||_||_dSr)r rYrZr[r\r])rrYrZr[r\r]s r r!zTableOfContents.__init__s:%3 (@%(('>$$$r"pdfritemc|jr$|j|jr|j|jSt|jjt tfrtd|jj|jS)Nz2Unsupported l_margin value provided as TextStyle: ) rZsection_title_stylesr isinstancerYl_marginr'r ValueError)rr_r`s r get_text_stylezTableOfContents.get_text_stylesu  ( 8S-Edj-Q 8+DJ7 7 do.e = = _T_E]__ r"c ||j}|j|j}||||5|j|jz}||j |z| |j |z |j tjtj|t"j|j|jz|jdz}|}||}|j|z |z |z |jz } | dkrZ|||j |z|}|j|z |z |jz } d} | dkrt7j|| |z| r0| dz } t7j|| |z| 0t;| dkr_| |j|z |jz | ddtjtj|t"j|j|jz||| |j|z |jz |tjtj |t"j!|j|jzddddS#1swxYwYdS) N)page)wtextnew_xnew_ylinkalignhr.r )"add_linkrpages get_labeluse_text_stylerfrr[set_xrd multi_cellepwrr ENDr LASTr J font_sizer\c_marginget_xget_string_widthrir_marginlnr less_thanlenLLMARGINNEXTR) rr_r`rm page_labelindentclearance_margin current_xpage_label_lengthin_between_space in_betweens r render_toc_itemzTableOfContents.render_toc_items"||!1|22Yt/0::<<    3 3C > > ? ?7 7 Z$"33F IIclV+ , , , NN'F"Yhig-$"33     #|a/  I # 4 4Z @ @  !$558HH3<W  !## #,/000IIKK #&59#47H#H3<#W J!##$.((447GG$&#%J %.((447GG$& z??Q&&NN%)+cl:'_"h"i!#g-$*;;# IIi NN%)#cl2lig-$"33    _7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 s)I-K##K'*K'rNc|jJ|D]5}|jr|j|jjkr|||6dS)zUThis method can be overridden by subclasses to customize the Table of Contents style.N)toc_placeholderr]r start_pager)rr_rNrJs r render_toczTableOfContents.render_tocse"... / /G, '3+>+III  g . . . .  / /r")NFrWrXT)r#r$r%__doc__rr boolfloatr!rrfrlistrr*r"r rVrVs+/).!!(, ? ?Y' ?#' ? ?  ? "& ?  ? ? ? ?&9<6<<D<<<<| /f /tN/C / / / / / / /r"rVN)r dataclassesrtypingrrrrrenumsr r r fontsr structure_treersyntaxrrrutilrfpdfrrr,r@rTrVr*r"r rs  "!!!!!CCCCCCCCCCCCCC$$$$$$$$$$&&&&&&8888888888  ''''''' '0 N N N N NI N N NF 8 8 8 8 8 8 8 80 ~&0  "7780 0 0 0 fh/h/h/h/h/h/h/h/h/h/r"