§
    £”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" ddl#m$Z$ ddl%m&Z&  G d„ de¦  «        Z'dS )z+|DocumentPart| and closely related objects.é    )Úannotations)ÚIOÚTYPE_CHECKINGÚcast)ÚDocument)ÚRELATIONSHIP_TYPE)ÚCommentsPart)Ú
FooterPartÚ
HeaderPart)ÚNumberingPart)ÚSettingsPart)Ú	StoryPart)Ú
StylesPart)ÚInlineShapes)Úlazyproperty)ÚComments)ÚWD_STYLE_TYPE)ÚCoreProperties)ÚSettings)Ú	BaseStylec                  ó6  — e Zd ZdZd„ Zd„ Zed'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,d„¦   «         Zd-d„Zed.d„¦   «         Zed„ ¦   «         Zed/d!„¦   «         Zed0d#„¦   «         Zed1d%„¦   «         Zd&S )2Ú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        ¦  «        }|                      |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      úb/var/www/finuniver-perm.ru/html/portfolio/venv/lib/python3.11/site-packages/docx/parts/document.pyÚadd_footer_partzDocumentPart.add_footer_part#   ó3   € å ”n T¤\Ñ2Ô2ˆØ�nŠn˜[­"¬)Ñ4Ô4ˆØ˜CÐÐó    c                ó|   — t          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%   Úreturnr   c                ó   — | j         j        S )zJ|Comments| object providing access to the comments added to this document.)Ú_comments_partÚcomments©r   s    r"   r-   zDocumentPart.comments/   s   € ð Ô"Ô+Ð+r%   r   c                ó   — | j         j        S )zfA |CoreProperties| object providing read/write access to the core properties
        of this document.)r   Úcore_propertiesr.   s    r"   r0   zDocumentPart.core_properties4   s   € ð Œ|Ô+Ð+r%   c                ó,   — t          | j        | ¦  «        S )zEA |Document| object providing access to the content of this document.)r   Ú_elementr.   s    r"   ÚdocumentzDocumentPart.document:   s   € õ ˜œ tÑ,Ô,Ð,r%   r!   ÚstrÚNonec                ó0   — |                       |¦  «         dS )z/Remove related header part identified by `rId`.N)Údrop_rel©r   r!   s     r"   Údrop_header_partzDocumentPart.drop_header_part?   s   € à�Š�cÑÔÐÐÐr%   c                ó   — | j         |         S )z%Return |FooterPart| related by `rId`.©Úrelated_partsr8   s     r"   r    zDocumentPart.footer_partC   ó   € àÔ! #Ô&Ð&r%   Ústyle_idú
str | NoneÚ
style_typer   r   c                ó8   — | 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   r>   r@   s      r"   Ú	get_stylezDocumentPart.get_styleG   s   € ð Œ{×$Ò$ X¨zÑ:Ô:Ð:r%   c                ó8   — | 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.
        )rB   Úget_style_id)r   Ústyle_or_namer@   s      r"   rF   zDocumentPart.get_style_idO   s   € ð Œ{×'Ò'¨°zÑBÔBÐBr%   c                ó   — | j         |         S )z%Return |HeaderPart| related by `rId`.r;   r8   s     r"   r(   zDocumentPart.header_partY   r=   r%   c                ó6   — t          | j        j        | ¦  «        S )zIThe |InlineShapes| instance containing the inline shapes in the document.)r   r2   Úbodyr.   s    r"   Úinline_shapeszDocumentPart.inline_shapes]   s   € õ ˜DœMÔ.°Ñ5Ô5Ð5r%   r   c                óò   — 	 t          t          |                      t          j        ¦  «        ¦  «        S # t
          $ r8 t          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.
        )r   r   Úpart_related_byr   Ú	NUMBERINGÚKeyErrorr   r   )r   Únumbering_parts     r"   rP   zDocumentPart.numbering_partb   sr   € ð	"Ý� t×';Ò';½B¼LÑ'IÔ'IÑJÔJÐJøÝð 	"ð 	"ð 	"Ý*Ô.Ñ0Ô0ˆNØ�NŠN˜>­2¬<Ñ8Ô8Ð8Ø!Ð!Ð!Ð!ð	"øøøs   ‚14 ´?A6Á5A6Úpath_or_streamústr | IO[bytes]c                ó:   — | j                              |¦  «         dS )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   rQ   s     r"   rT   zDocumentPart.saveo   s    € ð 	Œ×Ò˜.Ñ)Ô)Ð)Ð)Ð)r%   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"   rW   zDocumentPart.settingst   s   € ð Ô"Ô+Ð+r%   c                ó   — | j         j        S )z]A |Styles| object providing access to the styles in the styles part of this
        document.)Ú_styles_partrB   r.   s    r"   rB   zDocumentPart.stylesz   s   € ð Ô Ô'Ð'r%   r	   c                ó  — 	 t          t          |                      t          j        ¦  «        ¦  «        S # t
          $ rG | j        €J ‚t          j        | j        ¦  «        }|                      |t          j        ¦  «         |cY S w xY w)z™A |CommentsPart| object providing access to the comments added to this document.

        Creates a default comments part if one is not present.
        )	r   r	   rM   r   ÚCOMMENTSrO   r   Údefaultr   )r   Úcomments_parts     r"   r,   zDocumentPart._comments_part€   s„   € ð	!Ý� d×&:Ò&:½2¼;Ñ&GÔ&GÑHÔHÐHøÝð 	!ð 	!ð 	!Ø”<Ð+Ð+Ð+Ý(Ô0°´Ñ>Ô>ˆMØ�NŠN˜=­"¬+Ñ6Ô6Ð6Ø Ð Ð Ð ð		!øøøs   ‚14 ´ABÂBr   c                óþ   — 	 t          t          |                      t          j        ¦  «        ¦  «        S # t
          $ r> t          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   rM   r   ÚSETTINGSrO   r\   r   r   )r   Úsettings_parts     r"   rV   zDocumentPart._settings_partŽ   sv   € ð	!Ý� d×&:Ò&:½2¼;Ñ&GÔ&GÑHÔHÐHøÝð 	!ð 	!ð 	!Ý(Ô0°´Ñ>Ô>ˆMØ�NŠN˜=­"¬+Ñ6Ô6Ð6Ø Ð Ð Ð ð	!øøøs   ‚14 ´AA<Á;A<r   c                ó
  — 	 t          t          |                      t          j        ¦  «        ¦  «        S # t
          $ rD | j        }|€J ‚t          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   rM   r   ÚSTYLESrO   r   r\   r   )r   r   Ústyles_parts      r"   rY   zDocumentPart._styles_partœ   s‡   € ð	Ý�
 D×$8Ò$8½¼Ñ$CÔ$CÑDÔDÐDøÝð 	ð 	ð 	Ø”lˆGØÐ&Ð&Ð&Ý$Ô,¨WÑ5Ô5ˆKØ�NŠN˜;­¬	Ñ2Ô2Ð2ØÐÐÐð	øøøs   ‚14 ´ABÂBN)r*   r   )r*   r   )r!   r4   r*   r5   )r!   r4   )r>   r?   r@   r   r*   r   )r*   r   )rQ   rR   )r*   r   )r*   r	   )r*   r   )r*   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r#   r)   Úpropertyr-   r0   r3   r9   r    rD   rF   r(   r   rK   rP   rT   rW   rB   r,   rV   rY   © r%   r"   r   r      sã  € € € € € ðð ð ð  ð  ð ð  ð  ð ð,ð ,ð ,ñ „Xð,ð ð,ð ,ð ,ñ „Xð,ð
 ð-ð -ñ „Xð-ðð ð ð ð'ð 'ð 'ð 'ð;ð ;ð ;ð ;ðCð Cð Cð'ð 'ð 'ð 'ð ð6ð 6ñ „\ð6ð ð
"ð 
"ð 
"ñ „\ð
"ð*ð *ð *ð *ð
 ð,ð ,ð ,ñ „Xð,ð
 ð(ð (ñ „Xð(ð
 ð!ð !ð !ñ „Xð!ð ð!ð !ð !ñ „Xð!ð ðð ð ñ „Xðð ð r%   r   N)(rg   Ú
__future__r   Útypingr   r   r   Údocx.documentr   Údocx.opc.constantsr   r   Údocx.parts.commentsr	   Údocx.parts.hdrftrr
   r   Údocx.parts.numberingr   Údocx.parts.settingsr   Údocx.parts.storyr   Údocx.parts.stylesr   Ú
docx.shaper   Údocx.sharedr   Údocx.commentsr   Údocx.enum.styler   Údocx.opc.corepropsr   Údocx.settingsr   Údocx.styles.styler   r   ri   r%   r"   ú<module>r{      s•  ðØ 1Ð 1à "Ð "Ð "Ð "Ð "Ð "à *Ð *Ð *Ð *Ð *Ð *Ð *Ð *Ð *Ð *à "Ð "Ð "Ð "Ð "Ð "Ø 6Ð 6Ð 6Ð 6Ð 6Ð 6Ø ,Ð ,Ð ,Ð ,Ð ,Ð ,Ø 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4Ø .Ð .Ð .Ð .Ð .Ð .Ø ,Ð ,Ð ,Ð ,Ð ,Ð ,Ø &Ð &Ð &Ð &Ð &Ð &Ø (Ð (Ð (Ð (Ð (Ð (Ø #Ð #Ð #Ð #Ð #Ð #Ø $Ð $Ð $Ð $Ð $Ð $àð ,Ø&Ð&Ð&Ð&Ð&Ð&Ø-Ð-Ð-Ð-Ð-Ð-Ø1Ð1Ð1Ð1Ð1Ð1Ø&Ð&Ð&Ð&Ð&Ð&Ø+Ð+Ð+Ð+Ð+Ð+ðOð Oð Oð Oð O�9ñ Oô Oð Oð Oð Or%   