
    hU                       S r SSKJr  SSKJrJrJrJr  SSKJ	r	  SSK
Jr  SSKJr  SSKJrJr  SSKJrJr  \(       a4  SS	KJr  SS
KJrJr  SSKJr  SSKJr  SSKJr  SSKJ r J!r!  SSK"J#r#  SSK$J%r%   " S S\5      r& " S S\	5      r'g	)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                  p  ^  \ rS rSrSrSU 4S jjrSSS jjrS rSSS jjr  S     SS jjr	\
R                  4SS jjrSS S	 jjr\S
 5       r\S 5       rS!S jr\S"S j5       r\S#S j5       rS$S jr\S%S j5       r\S&S j5       r\S 5       r\S'S j5       r\S(S j5       r\S)S j5       rSrU =r$ )*Document   zWordprocessingML (WML) document.

Not intended to be constructed directly. Use :func:`docx.Document` to open or create
a document.
c                R   > [         [        U ]  U5        Xl        X l        S U l        g N)superr   __init___element_part_Document__body)selfelementpart	__class__s      ?/var/www/html/env/lib/python3.13/site-packages/docx/document.pyr   Document.__init__"   s#    h&w/
    c                x    SUs=::  a  S::  d  O  [        SU-  5      eUS:X  a  SOSU-  nU R                  X5      $ )am  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_headingDocument.add_heading(   sC     EQAEIJJ A:<%+?!!$..r(   c                    U R                  5       nUR                  5       R                  [        R                  5        U$ )z=Return newly |Paragraph| object containing only a page break.)r-   add_run	add_breakr
   PAGE)r"   	paragraphs     r&   add_page_breakDocument.add_page_break5   s1    &&(	%%hmm4r(   c                8    U R                   R                  X5      $ )aj  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.   r0   s      r&   r-   Document.add_paragraph;   s     zz''44r(   c                b    U R                  5       R                  5       nUR                  XU5      $ )aP  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-   r4   add_picture)r"   image_path_or_streamwidthheightruns        r&   r>   Document.add_pictureG   s-        "**,3FCCr(   c                    U R                   R                  R                  5       nXl        [	        X R
                  5      $ )zReturn 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"   rG   
new_sectPrs      r&   add_sectionDocument.add_sectionZ   s1     ]]''99;
 *z::..r(   c                ^    U R                   R                  XU R                  5      nX4l        U$ )zAdd 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.
)r;   	add_table_block_widthr0   )r"   rowscolsr0   tables        r&   rL   Document.add_tabled   s*     

$$T1B1BCr(   c                .    U R                   R                  $ )zGA |CoreProperties| object providing Dublin Core properties of document.)r    core_propertiesr"   s    r&   rS   Document.core_propertiesn   s     zz)))r(   c                .    U R                   R                  $ )zThe |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_shapesrT   s    r&   rW   Document.inline_shapess   s     zz'''r(   c                6    U R                   R                  5       $ )zHGenerate each `Paragraph` or `Table` in this document in document order.)r;   iter_inner_contentrT   s    r&   rZ   Document.iter_inner_content}   s    zz,,..r(   c                .    U R                   R                  $ )zThe |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.
)r;   
paragraphsrT   s    r&   r]   Document.paragraphs   s     zz$$$r(   c                    U R                   $ )z+The |DocumentPart| object of this document.)r    rT   s    r&   r$   Document.part   s     zzr(   c                :    U R                   R                  U5        g)zSave 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&   rb   Document.save   s     	

'r(   c                B    [        U R                  U R                  5      $ )zD|Sections| object providing access to each section in this document.)r   r   r    rT   s    r&   sectionsDocument.sections   s     tzz22r(   c                .    U R                   R                  $ )zDA |Settings| object providing access to the document-level settings.)r    settingsrT   s    r&   ri   Document.settings   s     zz"""r(   c                .    U R                   R                  $ )zBA |Styles| object providing access to the styles in this document.)r    stylesrT   s    r&   rl   Document.styles   s     zz   r(   c                .    U R                   R                  $ )a(  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.
)r;   tablesrT   s    r&   ro   Document.tables   s     zz   r(   c                ~    U R                   S   n[        UR                  UR                  -
  UR                  -
  5      $ )zGA |Length| object specifying the space between margins in last section.)rf   r   
page_widthleft_marginright_margin)r"   sections     r&   rM   Document._block_width   s9     --#7%%(;(;;g>R>RRSSr(   c                ~    U R                   c%  [        U R                  R                  U 5      U l         U R                   $ )z>The |_Body| instance containing the content for this document.)r!   _Bodyr   rE   rT   s    r&   r;   Document._body   s0     ;; 2 2D9DK{{r(   )__bodyr   r    )r#   r   r$   r   )    )r.   strr/   int)r|   N)r.   r~   r0   zstr | ParagraphStyle | Nonereturnr   )NN)r?   str | IO[bytes]r@   int | Length | NonerA   r   )rG   r	   r   )rN   r   rO   r   r0   zstr | _TableStyle | None)r   zIterator[Paragraph | Table])r   zList[Paragraph])r   r   )rc   r   )r   r   )r   r   )r   zList[Table])r   r   )r   ry   )__name__
__module____qualname____firstlineno____doc__r   r1   r8   r-   r>   r	   NEW_PAGErI   rL   propertyrS   rW   rZ   r]   r$   rb   rf   ri   rl   ro   rM   r;   __static_attributes____classcell__r%   s   @r&   r   r      s2   /
5 &*&*	D-D #D $	D& 4>3F3F / * * ( (/ % %  ( 3 3 # # ! ! ! ! T T
  r(   r   c                  6   ^  \ rS rSrSrSU 4S jjrS rSrU =r$ )ry      zgProxy for `<w:body>` element in this document.

It's primary role is a container for document content.
c                8   > [         [        U ]  X5        Xl        g r   )r   ry   r   r;   )r"   body_elmparentr%   s      r&   r   _Body.__init__   s    eT#H5
r(   c                :    U R                   R                  5         U $ )zReturn this |_Body| instance after clearing it of all content.

Section properties for the main document story, if present, are preserved.
)r;   clear_contentrT   s    r&   r   _Body.clear_content   s    
 	

  "r(   )r;   )r   r   r   zt.ProvidesStoryPart)	r   r   r   r   r   r   r   r   r   r   s   @r&   ry   ry      s    
 r(   ry   )(r   
__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   ry    r(   r&   <module>r      sY    . " 4 4 , ( # * )70&"= -a| aH r(   