B
    W_                 @   sl   d Z ddlmZmZmZmZ ddlZddlmZ	 ddl
mZ ddlmZ G dd deZG d	d
 d
eZdS )zHeader and footer part objects    )absolute_importdivisionprint_functionunicode_literalsN)CONTENT_TYPE)	parse_xml)BaseStoryPartc               @   s(   e Zd ZdZedd Zedd ZdS )
FooterPartzDefinition of a section footer.c             C   s*   | d}tj}t|  }| ||||S )z!Return newly created footer part.z/word/footer%d.xml)next_partnameCTZ
WML_FOOTERr   _default_footer_xml)clspackagepartnamecontent_typeelement r   C/var/www/html/venv/lib/python3.7/site-packages/docx/parts/hdrftr.pynew   s    
zFooterPart.newc          	   C   s@   t jt jtd ddd}t|d}| }W dQ R X |S )z6Return bytes containing XML for a default footer part.r   z..	templateszdefault-footer.xmlrbN)ospathjoinsplit__file__openread)r   r   f	xml_bytesr   r   r   r      s
    zFooterPart._default_footer_xmlN)__name__
__module____qualname____doc__classmethodr   r   r   r   r   r   r	      s   r	   c               @   s(   e Zd ZdZedd Zedd ZdS )
HeaderPartzDefinition of a section header.c             C   s*   | d}tj}t|  }| ||||S )z!Return newly created header part.z/word/header%d.xml)r
   r   Z
WML_HEADERr   _default_header_xml)r   r   r   r   r   r   r   r   r   '   s    
zHeaderPart.newc          	   C   s@   t jt jtd ddd}t|d}| }W dQ R X |S )z6Return bytes containing XML for a default header part.r   z..r   zdefault-header.xmlr   N)r   r   r   r   r   r   r   )r   r   r   r   r   r   r   r&   /   s
    zHeaderPart._default_header_xmlN)r    r!   r"   r#   r$   r   r&   r   r   r   r   r%   $   s   r%   )r#   
__future__r   r   r   r   r   Zdocx.opc.constantsr   r   Z	docx.oxmlr   Zdocx.parts.storyr   r	   r%   r   r   r   r   <module>   s   