
    kh                     f    d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl	m	Z	 dd	l
mZ  G d
 de      Zy)z>Collection of :py:class:`~pdf2docx.layout.Section` instances.
    )
WD_SECTION)Pt   )BaseCollection)reset_paragraph_format   )Section)	constantsc                   *    e Zd ZdefdZd Zd Zd Zy)Sectionsrawsc                     | j                          |D ],  }t               j                  |      }| j                  |       . | S )z#Restore sections from source dicts.)resetr	   restoreappend)selfr   rawsections       T/var/www/teggl/fontify/venv/lib/python3.12/site-packages/pdf2docx/layout/Sections.pyr   zSections.restore   s?    

 	!Ci'',GKK 	!     c                 8    | D ]  } |j                   di |  | S )z!Parse layout under section level. )parse)r   settingsr   s      r   r   zSections.parse   s"    6G]W]]6X66r   c                    | syt        j                        }fd}| d   }|j                  t        j                  kD  r ||       |j
                  dk(  rj                  t        j                         |j                         | dd D ]  }j                  t        j                         j                  d   }|j                  j                         s'd|j                  j                  v rj                  d   }|j                  }t        |j                        |_        |j                          | j"                  j$                  D ]   }|j                  j                  |          " y)	zCreate sections in docx.Nc                     j                         }t        | j                  d      }t        |t	        |            }t	        | j                  |z
        |_        y )N   )line_spacing)add_paragraphminbefore_spacer   r   space_after)r   pline_heightpfdocs       r   "create_dummy_paragraph_for_sectionz>Sections.make_docx.<locals>.create_dummy_paragraph_for_section&   sJ    !!#Ag22B7K';HB 4 4[ @ABNr   r   r   r   graphicData)len
paragraphsr!   r
   
MINOR_DISTnum_colsadd_sectionr   
CONTINUOUS	make_docxtextstrip_pxmlparagraph_formatr   r"   parentfloat_images)r   r&   nr'   r   r#   r%   images    `      r   r1   zSections.make_docx   s5   V 	B q')"6"66.w7 QOOJ112#
 ABx 	#GOOJ112 r"A66<<>mqttxx&?NN2&##B 4 45BN c"!	#, [[-- 	/EOOCNN1-.	/r   c                 ~    | D ]8  }|D ]1  }|j                  |dd       |j                  j                  |       3 : y)z*Plot all section blocks for debug purpose.)r   r   r   g      ?)strokewidthN)plotblocks)r   pager   columns       r   r>   zSections.plotV   sD     	)G! )D<""4()	)r   N)__name__
__module____qualname__listr   r   r1   r>   r   r   r   r   r      s    4 4/n)r   r   N)__doc__docx.enum.sectionr   docx.sharedr   common.Collectionr   common.docxr   r	   commonr
   r   r   r   r   <module>rL      s,    )  . 0  M)~ M)r   