Exemplo n.º 1
0
 def __init__(self, element, parent=None):
     """
     level: heading level
     string: text body of the paragraph
     """
     Content.__init__(self, HEADING_TYPE, element, parent)
     self.level = ep.ElementProcessor.get_level_number(self.element_style)
Exemplo n.º 2
0
    def __init__(self, element, parent=None):
        """
        element: xml element
        """
        self.element = element
        Content.__init__(self, LIST_PARAGRAPH_TYPE, element, parent)

        return
Exemplo n.º 3
0
    def __init__(self, element, parent=None):
        """
        parent: parent object
        """
        Content.__init__(self, LINK_TYPE, element, parent)
        self.chapter = ep.ElementProcessor.get_current_chapter()
        self.link = element['xlink:href']

        return
Exemplo n.º 4
0
    def __init__(self, string, parent=None):
        """
        string: body text
        parent: parent object
        """
        Content.__init__(self, TEXT_TYPE, None, parent)
        self.string = string

        return
Exemplo n.º 5
0
    def __init__(self, element, parent=None):
        """
        parent: parent object
        """
        Content.__init__(self, MARKER_TYPE, element, parent)
        self.chapter = ep.ElementProcessor.get_current_chapter()
        self.name = element['text:name']

        ep.ElementProcessor.add_marker(self)
        return
Exemplo n.º 6
0
    def __init__(self, element, frame):
        """
        element: xml element
        """
        self.width = frame.width
        self.height = frame.height

        self.image = element['xlink:href']

        Content.__init__(self, IMAGE_TYPE, element)

        return
Exemplo n.º 7
0
    def __init__(self, element, parent=None, category=0):
        """
        element: xml element
        category: type of remarks 1..3
        """
        self.category = category

        Content.__init__(self, REMARK_TYPE, element, parent)

        if category != 0:
            self.category = self.remark_category(element)


#        self.paragraphs = []
#        for paragraph in paragraphs:
#            self.paragraphs.append(Paragraph(paragraph.string))

        return
Exemplo n.º 8
0
    def __init__(self, element, parent=None, level=1):
        self.level = level
        self.kind = List.TYPE_NOT_ASSIGNED
        if parent is None:
            style = None
        else:
            style = parent.element_style
        Content.__init__(self, LIST_TYPE, element, parent, style)
        self.kind = ep.ElementProcessor.get_type_list(self.element_style,
                                                      self.level)

        # sublist
        if len(self.inner_objects) == 1:
            if len(self.inner_objects[0].inner_objects) == 1 and \
               self.inner_objects[0].inner_objects[0].type == LIST_TYPE:
                self.inner_objects.append(
                    self.inner_objects[0].inner_objects[0])
                del self.inner_objects[0]
        return
Exemplo n.º 9
0
    def remark_category(element):
        """
        Return the category of the Remark if the paragraph is a Remark (number greater than 0).
        Otherwise return 0
        """
        category = 0
        element_style = element.get('text:style-name')
        if Content.is_style(element, REMARK_TYPE):
            category = int(element_style[element_style.rfind('_') + 1:])

        return category
Exemplo n.º 10
0
 def __init__(self, element, parent):
     Content.__init__(self, LIST_ITEM_TYPE, element, parent,
                      parent.element_style)
     return
Exemplo n.º 11
0
 def __init__(self, element, parent=None):
     Content.__init__(self, FOOTNOTE_BODY_TYPE, element, parent)
     return
Exemplo n.º 12
0
 def __init__(self, element, parent=None):
     """
     element: span xml element
     """
     Content.__init__(self, SPAN_TYPE, element, parent)
     return
Exemplo n.º 13
0
 def __init__(self, element, parent=None):
     Content.__init__(self, NOSUPPORTED_TYPE, None, parent)
     return
Exemplo n.º 14
0
 def __init__(self, element, parent=None):
     Content.__init__(self, FOOTNOTE_TYPE, element)
     self.__get_note_components(element)
     return