Ë
    ^ãjU  ã                  ó  — 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 ddlmZ ddlmZmZ ddlmZmZ er4dd	lmZ dd
lmZmZ ddlmZ ddlmZ ddlmZ ddlm Z m!Z! ddl"m#Z# ddl$m%Z%  G d„ de«      Z& G d„ de	«      Z'y	)z'|Document| and closely related objects.é    )Úannotations)ÚIOÚTYPE_CHECKINGÚIteratorÚList)ÚBlockItemContainer)Ú
WD_SECTION)ÚWD_BREAK)ÚSectionÚSections)ÚElementProxyÚEmuN)ÚCT_BodyÚCT_Document)ÚDocumentPart)ÚSettings)ÚLength)ÚParagraphStyleÚ_TableStyle)ÚTable)Ú	Paragraphc                  ó>  ‡ — e Zd ZdZdˆ fd„Zddd„Zd„ Zddd„Z	 	 d	 	 	 	 	 dd„Ze	j                  fdd„Zddd„Zed	„ «       Zed
„ «       Zdd„Zed d„«       Zed!d„«       Zd"d„Zed#d„«       Zed$d„«       Zed„ «       Zed%d„«       Zed&d„«       Zed'd„«       Zˆ xZS )(ÚDocumentz�WordprocessingML (WML) document.

    Not intended to be constructed directly. Use :func:`docx.Document` to open or create
    a document.
    c                óV   •— t         t        | �  |«       || _        || _        d | _        y ©N)Úsuperr   Ú__init__Ú_elementÚ_partÚ_Document__body)ÚselfÚelementÚpartÚ	__class__s      €úO/var/www/html/metafoliadorv2/venv/lib/python3.12/site-packages/docx/document.pyr   zDocument.__init__"   s'   ø€ ÜŒh˜Ñ& wÔ/ØˆŒØˆŒ
Øˆ�ó    c                ót   — d|cxk  rdk  sn t        d|z  «      ‚|dk(  rdnd|z  }| j                  ||«      S )a•  Return a heading paragraph newly added to the end of the document.

        The heading paragraph will contain `text` and have its paragraph style
        determined by `level`. If `level` is 0, the style is set to `Title`. If `level`
        is 1 (or omitted), `Heading 1` is used. Otherwise the style is set to `Heading
        {level}`. Raises |ValueError| if `level` is outside the range 0-9.
        r   é	   z"level must be in range 0-9, got %dÚTitlez
Heading %d)Ú
ValueErrorÚadd_paragraph)r!   ÚtextÚlevelÚstyles       r%   Úadd_headingzDocument.add_heading(   sE   € ð �EŒ˜QŒÜÐAÀEÑIÓJÐJØ  Aš:‘¨<¸%Ñ+?ˆØ×!Ñ! $¨Ó.Ð.r&   c                ó€   — | j                  «       }|j                  «       j                  t        j                  «       |S )z=Return newly |Paragraph| object containing only a page break.)r+   Úadd_runÚ	add_breakr
   ÚPAGE)r!   Ú	paragraphs     r%   Úadd_page_breakzDocument.add_page_break5   s1   € à×&Ñ&Ó(ˆ	Ø×ÑÓ×%Ñ%¤h§m¡mÔ4ØÐr&   c                ó:   — | j                   j                  ||«      S )aš  Return paragraph newly added to the end of the document.

        The paragraph is populated with `text` and having paragraph style `style`.

        `text` can contain tab (``\t``) characters, which are converted to the
        appropriate XML form for a tab. `text` can also include newline (``\n``) or
        carriage return (``\r``) characters, each of which is converted to a line
        break.
        )Ú_bodyr+   )r!   r,   r.   s      r%   r+   zDocument.add_paragraph;   s   € ð �z‰z×'Ñ'¨¨eÓ4Ð4r&   c                ód   — | j                  «       j                  «       }|j                  |||«      S )a�  Return new picture shape added in its own paragraph at end of the document.

        The picture contains the image at `image_path_or_stream`, scaled based on
        `width` and `height`. If neither width nor height is specified, the picture
        appears at its native size. If only one is specified, it is used to compute a
        scaling factor that is then applied to the unspecified dimension, preserving the
        aspect ratio of the image. The native size of the picture is calculated using
        the dots-per-inch (dpi) value specified in the image file, defaulting to 72 dpi
        if no value is specified, as is often the case.
        )r+   r1   Úadd_picture)r!   Úimage_path_or_streamÚwidthÚheightÚruns        r%   r9   zDocument.add_pictureG   s/   € ð  × Ñ Ó"×*Ñ*Ó,ˆØ�‰Ð3°U¸FÓCÐCr&   c                ó„   — | j                   j                  j                  «       }||_        t	        || j
                  «      S )zòReturn a |Section| object newly added at the end of the document.

        The optional `start_type` argument must be a member of the :ref:`WdSectionStart`
        enumeration, and defaults to ``WD_SECTION.NEW_PAGE`` if not provided.
        )r   ÚbodyÚadd_section_breakÚ
start_typer   r   )r!   rA   Ú
new_sectPrs      r%   Úadd_sectionzDocument.add_sectionZ   s5   € ð —]‘]×'Ñ'×9Ñ9Ó;ˆ
Ø *ˆ
ÔÜ�z 4§:¡:Ó.Ð.r&   c                ób   — | j                   j                  ||| j                  «      }||_        |S )zòAdd a table having row and column counts of `rows` and `cols` respectively.

        `style` may be a table style object or a table style name. If `style` is |None|,
        the table inherits the default table style of the document.
        )r7   Ú	add_tableÚ_block_widthr.   )r!   ÚrowsÚcolsr.   Útables        r%   rE   zDocument.add_tabled   s.   € ð —
‘
×$Ñ$ T¨4°×1BÑ1BÓCˆØˆŒØˆr&   c                ó.   — | j                   j                  S )zGA |CoreProperties| object providing Dublin Core properties of document.)r   Úcore_properties©r!   s    r%   rK   zDocument.core_propertiesn   s   € ð �z‰z×)Ñ)Ð)r&   c                ó.   — | j                   j                  S )zùThe |InlineShapes| collection for this document.

        An inline shape is a graphical object, such as a picture, contained in a run of
        text and behaving like a character glyph, being flowed like other text in a
        paragraph.
        )r   Úinline_shapesrL   s    r%   rN   zDocument.inline_shapess   s   € ð �z‰z×'Ñ'Ð'r&   c                ó6   — | j                   j                  «       S )zHGenerate each `Paragraph` or `Table` in this document in document order.)r7   Úiter_inner_contentrL   s    r%   rP   zDocument.iter_inner_content}   s   € à�z‰z×,Ñ,Ó.Ð.r&   c                ó.   — | j                   j                  S )zÁThe |Paragraph| instances in the document, in document order.

        Note that paragraphs within revision marks such as ``<w:ins>`` or ``<w:del>`` do
        not appear in this list.
        )r7   Ú
paragraphsrL   s    r%   rR   zDocument.paragraphs�   s   € ð �z‰z×$Ñ$Ð$r&   c                ó   — | j                   S )z+The |DocumentPart| object of this document.)r   rL   s    r%   r#   zDocument.partŠ   s   € ð �z‰zÐr&   c                ó:   — | j                   j                  |«       y)z¢Save this document to `path_or_stream`.

        `path_or_stream` can be either a path to a filesystem location (a string) or a
        file-like object.
        N)r   Úsave)r!   Úpath_or_streams     r%   rU   zDocument.save�   s   € ð 	�
‰
�‰˜Õ'r&   c                óB   — t        | j                  | j                  «      S )zD|Sections| object providing access to each section in this document.)r   r   r   rL   s    r%   ÚsectionszDocument.sections—   s   € ô ˜Ÿ™ t§z¡zÓ2Ð2r&   c                ó.   — | j                   j                  S )zDA |Settings| object providing access to the document-level settings.)r   ÚsettingsrL   s    r%   rZ   zDocument.settingsœ   s   € ð �z‰z×"Ñ"Ð"r&   c                ó.   — | j                   j                  S )zBA |Styles| object providing access to the styles in this document.)r   ÚstylesrL   s    r%   r\   zDocument.styles¡   s   € ð �z‰z× Ñ Ð r&   c                ó.   — | j                   j                  S )aP  All |Table| instances in the document, in document order.

        Note that only tables appearing at the top level of the document appear in this
        list; a table nested inside a table cell does not appear. A table within
        revision marks such as ``<w:ins>`` or ``<w:del>`` will also not appear in the
        list.
        )r7   ÚtablesrL   s    r%   r^   zDocument.tables¦   s   € ð �z‰z× Ñ Ð r&   c                ó~   — | j                   d   }t        |j                  |j                  z
  |j                  z
  «      S )zGA |Length| object specifying the space between margins in last section.éÿÿÿÿ)rX   r   Ú
page_widthÚleft_marginÚright_margin)r!   Úsections     r%   rF   zDocument._block_width±   s9   € ð —-‘- Ñ#ˆÜ�7×%Ñ%¨×(;Ñ(;Ñ;¸g×>RÑ>RÑRÓSÐSr&   c                ó|   — | j                   €%t        | j                  j                  | «      | _         | j                   S )z>The |_Body| instance containing the content for this document.)r    Ú_Bodyr   r?   rL   s    r%   r7   zDocument._body·   s0   € ð �;‰;ÐÜ §¡× 2Ñ 2°DÓ9ˆDŒKØ�{‰{Ðr&   )r"   r   r#   r   )Ú é   )r,   Ústrr-   Úint)rg   N)r,   ri   r.   zstr | ParagraphStyle | NoneÚreturnr   )NN)r:   ústr | IO[bytes]r;   úint | Length | Noner<   rm   )rA   r	   r   )rG   rj   rH   rj   r.   zstr | _TableStyle | None)rk   zIterator[Paragraph | Table])rk   zList[Paragraph])rk   r   )rV   rl   )rk   r   )rk   r   )rk   zList[Table])rk   r   )rk   rf   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r/   r5   r+   r9   r	   ÚNEW_PAGErC   rE   ÚpropertyrK   rN   rP   rR   r#   rU   rX   rZ   r\   r^   rF   r7   Ú__classcell__©r$   s   @r%   r   r      s2  ø„ ñõô/òô
5ð &*Ø&*ð	Dà-ðDð #ðDð $ó	Dð& 4>×3FÑ3Fô /ôð ñ*ó ð*ð ñ(ó ð(ó/ð ò%ó ð%ð òó ðó(ð ò3ó ð3ð ò#ó ð#ð ñ!ó ð!ð ò!ó ð!ð òTó ðTð
 òó ôr&   r   c                  ó*   ‡ — e Zd ZdZdˆ fd„Zd„ Zˆ xZS )rf   zoProxy for `<w:body>` element in this document.

    It's primary role is a container for document content.
    c                ó<   •— t         t        | �  ||«       || _        y r   )r   rf   r   r7   )r!   Úbody_elmÚparentr$   s      €r%   r   z_Body.__init__Å   s   ø€ ÜŒe�TÑ# H¨fÔ5Øˆ�
r&   c                ó:   — | j                   j                  «        | S )z›Return this |_Body| instance after clearing it of all content.

        Section properties for the main document story, if present, are preserved.
        )r7   Úclear_contentrL   s    r%   r{   z_Body.clear_contentÉ   s   € ð
 	�
‰
× Ñ Ô"Øˆr&   )rx   r   ry   zt.ProvidesStoryPart)rn   ro   rp   rq   r   r{   rt   ru   s   @r%   rf   rf   ¿   s   ø„ ñõ
ör&   rf   )(rq   Ú
__future__r   Útypingr   r   r   r   Údocx.blkcntnrr   Údocx.enum.sectionr	   Údocx.enum.textr
   Údocx.sectionr   r   Údocx.sharedr   r   Ú
docx.typesÚtypesÚtÚdocx.oxml.documentr   r   Údocx.parts.documentr   Údocx.settingsr   r   Údocx.styles.styler   r   Ú
docx.tabler   Údocx.text.paragraphr   r   rf   © r&   r%   ú<module>r�      sY   ðñ .å "ç 4Ó 4å ,Ý (Ý #ß *ß )áÝß7Ý0Ý&Ý"ß=Ý Ý-ôaˆ|ô aôHÐõ r&   