Ë
    ^ãjÌ  ã                  óâ   — d Z ddlmZ ddl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 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 erddlmZ ddlm Z  ddl!m"Z"  G d„ de«      Z#y)z+|DocumentPart| and closely related objects.é    )Úannotations)ÚIOÚTYPE_CHECKINGÚcast)ÚDocument)ÚWD_STYLE_TYPE)ÚRELATIONSHIP_TYPE)Ú
FooterPartÚ
HeaderPart)ÚNumberingPart)ÚSettingsPart)Ú	StoryPart)Ú
StylesPart)ÚInlineShapes)Úlazyproperty)ÚCoreProperties)ÚSettings)Ú	BaseStylec                  óÒ   — e Zd ZdZd„ Zd„ Zedd„«       Zed„ «       Zdd„Z	dd„Z
dd„Zd	„ Zdd
„Zed„ «       Zed„ «       Zdd„Zedd„«       Zed„ «       Zedd„«       Zedd„«       Zy)ÚDocumentParta‘  Main document part of a WordprocessingML (WML) package, aka a .docx file.

    Acts as broker to other parts such as image, core properties, and style parts. It
    also acts as a convenient delegate when a mid-document object needs a service
    involving a remote ancestor. The `Parented.part` property inherited by many content
    objects provides access to this part object for that purpose.
    c                óˆ   — t        j                  | j                  «      }| j                  |t        j
                  «      }||fS )z=Return (footer_part, rId) pair for newly-created footer part.)r
   ÚnewÚpackageÚ	relate_toÚRTÚFOOTER)ÚselfÚfooter_partÚrIds      úU/var/www/html/metafoliadorv2/venv/lib/python3.12/site-packages/docx/parts/document.pyÚadd_footer_partzDocumentPart.add_footer_part!   ó3   € ä —n‘n T§\¡\Ó2ˆØ�n‰n˜[¬"¯)©)Ó4ˆØ˜CÐÐó    c                óˆ   — t        j                  | j                  «      }| j                  |t        j
                  «      }||fS )z=Return (header_part, rId) pair for newly-created header part.)r   r   r   r   r   ÚHEADER)r   Úheader_partr   s      r    Úadd_header_partzDocumentPart.add_header_part'   r"   r#   c                ó.   — | j                   j                  S )zfA |CoreProperties| object providing read/write access to the core properties
        of this document.)r   Úcore_properties©r   s    r    r)   zDocumentPart.core_properties-   s   € ð �|‰|×+Ñ+Ð+r#   c                ó.   — t        | j                  | «      S )zEA |Document| object providing access to the content of this document.)r   Ú_elementr*   s    r    ÚdocumentzDocumentPart.document3   s   € ô ˜Ÿ™ tÓ,Ð,r#   c                ó&   — | j                  |«       y)z/Remove related header part identified by `rId`.N)Údrop_rel©r   r   s     r    Údrop_header_partzDocumentPart.drop_header_part8   s   € à�‰�cÕr#   c                ó    — | j                   |   S )z%Return |FooterPart| related by `rId`.©Úrelated_partsr0   s     r    r   zDocumentPart.footer_part<   ó   € à×!Ñ! #Ñ&Ð&r#   c                ó:   — | j                   j                  ||«      S )zÆReturn the style in this document matching `style_id`.

        Returns the default style for `style_type` if `style_id` is |None| or does not
        match a defined style of `style_type`.
        )ÚstylesÚ	get_by_id)r   Ústyle_idÚ
style_types      r    Ú	get_stylezDocumentPart.get_style@   s   € ð �{‰{×$Ñ$ X¨zÓ:Ð:r#   c                ó:   — | j                   j                  ||«      S )aT  Return the style_id (|str|) of the style of `style_type` matching
        `style_or_name`.

        Returns |None| if the style resolves to the default style for `style_type` or if
        `style_or_name` is itself |None|. Raises if `style_or_name` is a style of the
        wrong type or names a style not present in the document.
        )r7   Úget_style_id)r   Ústyle_or_namer:   s      r    r=   zDocumentPart.get_style_idH   s   € ð �{‰{×'Ñ'¨°zÓBÐBr#   c                ó    — | j                   |   S )z%Return |HeaderPart| related by `rId`.r3   r0   s     r    r&   zDocumentPart.header_partR   r5   r#   c                óB   — t        | j                  j                  | «      S )zIThe |InlineShapes| instance containing the inline shapes in the document.)r   r,   Úbodyr*   s    r    Úinline_shapeszDocumentPart.inline_shapesV   s   € ô ˜DŸM™M×.Ñ.°Ó5Ð5r#   c                óÌ   — 	 | j                  t        j                  «      S # t        $ r9 t	        j
                  «       }| j                  |t        j                  «       |cY S w xY w)zªA |NumberingPart| object providing access to the numbering definitions for
        this document.

        Creates an empty numbering part if one is not present.
        )Úpart_related_byr   Ú	NUMBERINGÚKeyErrorr   r   r   )r   Únumbering_parts     r    rG   zDocumentPart.numbering_part[   sQ   € ð	"Ø×'Ñ'¬¯©Ó5Ð5øÜò 	"Ü*×.Ñ.Ó0ˆNØ�N‰N˜>¬2¯<©<Ô8Ø!Ò!ð	"ús   ‚! ¡?A#Á"A#c                ó:   — | j                   j                  |«       y)z…Save this document to `path_or_stream`, which can be either a path to a
        filesystem location (a string) or a file-like object.N)r   Úsave)r   Úpath_or_streams     r    rI   zDocumentPart.savei   s   € ð 	�‰×Ñ˜.Õ)r#   c                ó.   — | j                   j                  S )zcA |Settings| object providing access to the settings in the settings part of
        this document.)Ú_settings_partÚsettingsr*   s    r    rM   zDocumentPart.settingsn   s   € ð ×"Ñ"×+Ñ+Ð+r#   c                ó.   — | j                   j                  S )z]A |Styles| object providing access to the styles in the styles part of this
        document.)Ú_styles_partr7   r*   s    r    r7   zDocumentPart.stylest   s   € ð × Ñ ×'Ñ'Ð'r#   c                óþ   — 	 t        t        | j                  t        j                  «      «      S # t
        $ rD t        j                  | j                  «      }| j                  |t        j                  «       |cY S w xY w)z«A |SettingsPart| object providing access to the document-level settings for
        this document.

        Creates a default settings part if one is not present.
        )	r   r   rD   r   ÚSETTINGSrF   Údefaultr   r   )r   Úsettings_parts     r    rL   zDocumentPart._settings_partz   s^   € ð	!Üœ d×&:Ñ&:¼2¿;¹;Ó&GÓHÐHøÜò 	!Ü(×0Ñ0°·±Ó>ˆMØ�N‰N˜=¬"¯+©+Ô6Ø Ò ð	!ús   ‚,/ ¯A
A<Á;A<c                ó
  — 	 t        t        | j                  t        j                  «      «      S # t
        $ rJ | j                  }|€J ‚t        j                  |«      }| j                  |t        j                  «       |cY S w xY w)zqInstance of |StylesPart| for this document.

        Creates an empty styles part if one is not present.
        )	r   r   rD   r   ÚSTYLESrF   r   rR   r   )r   r   Ústyles_parts      r    rO   zDocumentPart._styles_partˆ   so   € ð	Üœ
 D×$8Ñ$8¼¿¹Ó$CÓDÐDøÜò 	Ø—l‘lˆGØÐ&Ð&Ð&Ü$×,Ñ,¨WÓ5ˆKØ�N‰N˜;¬¯	©	Ô2ØÒð	ús   ‚,/ ¯ABÂBN)Úreturnr   )r   ÚstrrW   ÚNone)r   rX   )r9   z
str | Noner:   r   rW   r   )rJ   zstr | IO[bytes])rW   r   )rW   r   )rW   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r!   r'   Úpropertyr)   r-   r1   r   r;   r=   r&   r   rB   rG   rI   rM   r7   rL   rO   © r#   r    r   r      sÐ   „ ñò ò ð ò,ó ð,ð
 ñ-ó ð-óó'ó;òCó'ð ñ6ó ð6ð ñ"ó ð"ó*ð
 ò,ó ð,ð
 ñ(ó ð(ð
 ò!ó ð!ð òó ñr#   r   N)$r]   Ú
__future__r   Útypingr   r   r   Údocx.documentr   Údocx.enum.styler   Údocx.opc.constantsr	   r   Údocx.parts.hdrftrr
   r   Údocx.parts.numberingr   Údocx.parts.settingsr   Údocx.parts.storyr   Údocx.parts.stylesr   Ú
docx.shaper   Údocx.sharedr   Údocx.opc.corepropsr   Údocx.settingsr   Údocx.styles.styler   r   r_   r#   r    ú<module>ro      sI   ðÙ 1å "ç *Ñ *å "Ý )Ý 6ß 4Ý .Ý ,Ý &Ý (Ý #Ý $áÝ1Ý&Ý+ô}�9õ }r#   