lpod.toc

class lpod.toc.odf_toc(native_element)

Bases: lpod.element.odf_element

get_formatted_text(context)
get_toc_body()
get_toc_name()
get_toc_outline_level()
get_toc_style()
get_toc_title()
is_toc_protected()
set_toc_body(body=None)
set_toc_name(name)
set_toc_outline_level(level)
set_toc_protected(protected)
set_toc_style(style)
set_toc_title(title, style=None, text_style=None)
toc_fill(document=None, use_default_styles=True)

Fill the TOC with the titles found in the document. A TOC is not contextual so it will catch all titles before and after its insertion. If the TOC is not attached to a document, attach it beforehand or provide one as argument.

For having a pretty TOC, let use_default_styles by default.

Arguments:

document – odf_document

use_default_styles – bool

lpod.toc.odf_create_index_body()
lpod.toc.odf_create_index_title(title=None, name=None, style=None, text_style=None)

Create an index title

Arguments:

title – unicode

Return: odf_element

lpod.toc.odf_create_toc(title=u'Table of Contents', name=None, protected=True, outline_level=None, style=None, title_style=u'Contents_20_Heading', entry_style=u'Contents_20_%d')

Create a table of contents. Default parameters are what most people use: Protected from manual modifications and not limited in title levels.

The name is mandatory and derived automatically from the title if not given. Provide one in case of a conflict with other TOCs in the same document.

Arguments:

title – unicode

name – unicode

protected – bool

outline_level – int

style – unicode

title_style – unicode

entry_style – unicode

Return: odf_toc

lpod.toc.odf_create_toc_level_style(level)

Generate an automatic default style for the given TOC level.

lpod.toc.odf_create_toc_source(title=None, outline_level=10, title_style=u'Contents_20_Heading', entry_style=u'Contents_20_%d')