add Table of Contents marks

svn: r6855
This commit is contained in:
Brian Matherly 2006-06-04 04:26:28 +00:00
parent cb4030473c
commit 97a8f19462
10 changed files with 48 additions and 16 deletions

View File

@ -1,3 +1,14 @@
2006-06-03 Brian Matherly <brian@gramps-project.org>
* src/docgen/ODFDoc.py: add Table of Contents mark
* src/docgen/OpenOfficeDoc.py: add Table of Contents mark
* src/plugins/DetDecendantReport: add Table of Contents marks
* src/plugins/AncestorReport.py: add Table of Contents marks
* src/plugins/DetAncestralReport.py: add Table of Contents marks
* src/plugins/DecendReport.py: add Table of Contents marks
* src/plugins/IndivComplete.py: add Table of Contents marks
* src/plugins/FamilyGroup.py: add Table of Contents marks
* src/BaseDoc.py: add TOC levels
2006-06-03 Don Allingham <don@gramps-project.org>
* src/DisplayTabs/_BackRefList.py (BackRefList.right_click):
override right click, because Remove and Add have no relevence

View File

@ -1161,12 +1161,13 @@ class IndexMark:
"""
Defines a mark to be associated with text for indexing.
"""
def __init__(self, key="", type=INDEX_TYPE_ALP):
def __init__(self, key="", type=INDEX_TYPE_ALP, level=1):
"""
Initialize the object with default values, unless values are specified.
"""
self.type = type
self.key = key
self.type = type
self.level = level
#------------------------------------------------------------------------
#

View File

@ -835,9 +835,11 @@ class ODFDoc(BaseDoc.BaseDoc):
key = key.replace('"','&quot;')
if mark.type == BaseDoc.INDEX_TYPE_ALP:
self.cntnt.write('<text:alphabetical-index-mark ')
self.cntnt.write('text:string-value="%s" />' % key)
elif mark.type == BaseDoc.INDEX_TYPE_TOC:
self.cntnt.write('<text:toc-mark ')
self.cntnt.write('text:string-value="%s" />' % key)
self.cntnt.write('text:string-value="%s" ' % key)
self.cntnt.write('text:outline-level="%d" />' % mark.level)
self.cntnt.write(escape(text,_esc_map))
def _write_manifest(self):

View File

@ -738,9 +738,11 @@ class OpenOfficeDoc(BaseDoc.BaseDoc):
key = key.replace('"','&quot;')
if mark.type == BaseDoc.INDEX_TYPE_ALP:
self.cntnt.write('<text:alphabetical-index-mark ')
self.cntnt.write('text:string-value="%s" />' % key)
elif mark.type == BaseDoc.INDEX_TYPE_TOC:
self.cntnt.write('<text:toc-mark ')
self.cntnt.write('text:string-value="%s" />' % key)
self.cntnt.write('text:string-value="%s" ' % key)
self.cntnt.write('text:outline-level="%d" />' % mark.level)
self.cntnt.write(escape(text,_esc_map))
def _write_manifest(self):

View File

@ -98,8 +98,10 @@ class AncestorReport(Report):
self.apply_filter(self.start_person.get_handle(),1)
name = NameDisplay.displayer.display_formal(self.start_person)
title = _("Ahnentafel Report for %s") % name
mark = BaseDoc.IndexMark(title,BaseDoc.INDEX_TYPE_TOC,1)
self.doc.start_paragraph("AHN-Title")
self.doc.write_text(_("Ahnentafel Report for %s") % name)
self.doc.write_text(title,mark)
self.doc.end_paragraph()
keys = self.map.keys()
@ -111,8 +113,9 @@ class AncestorReport(Report):
if self.pgbrk and generation > 0:
self.doc.page_break()
generation += 1
mark = BaseDoc.IndexMark(title,BaseDoc.INDEX_TYPE_TOC,2)
self.doc.start_paragraph("AHN-Generation")
self.doc.write_text(_("Generation %d") % generation)
self.doc.write_text(_("Generation %d") % generation,mark)
self.doc.end_paragraph()
self.doc.start_paragraph("AHN-Entry","%d." % key)
@ -166,7 +169,8 @@ class AncestorOptions(ReportOptions):
para.set_font(font)
para.set_header_level(1)
para.set_top_margin(0.25)
para.set_bottom_margin(0.25)
para.set_bottom_margin(0.25)
para.set_alignment(BaseDoc.PARA_ALIGN_CENTER)
#para.set(pad=0.5)
para.set_description(_('The style used for the title of the page.'))
default_style.add_style("AHN-Title",para)

View File

@ -150,7 +150,9 @@ class DescendantReport(Report):
def write_report(self):
self.doc.start_paragraph("DR-Title")
name = NameDisplay.displayer.display(self.start_person)
self.doc.write_text(_("Descendants of %s") % name)
title = _("Descendants of %s") % name
mark = BaseDoc.IndexMark(title,BaseDoc.INDEX_TYPE_TOC,1)
self.doc.write_text(title,mark)
self.doc.end_paragraph()
self.dump(1,self.start_person)

View File

@ -149,7 +149,8 @@ class DetAncestorReport(Report):
name = _nd.display_name(self.start_person.get_primary_name())
self.doc.start_paragraph("DAR-Title")
title = _("Ancestral Report for %s") % name
self.doc.write_text(title)
mark = BaseDoc.IndexMark(title,BaseDoc.INDEX_TYPE_TOC,1)
self.doc.write_text(title,mark)
self.doc.end_paragraph()
keys = self.map.keys()
@ -163,7 +164,8 @@ class DetAncestorReport(Report):
self.doc.page_break()
self.doc.start_paragraph("DAR-Generation")
text = _("Generation %d") % (generation+1)
self.doc.write_text(text)
mark = BaseDoc.IndexMark(text,BaseDoc.INDEX_TYPE_TOC,2)
self.doc.write_text(text,mark)
self.doc.end_paragraph()
generation = generation + 1
if self.childRef:
@ -666,6 +668,7 @@ class DetAncestorOptions(ReportOptions):
para.set_header_level(1)
para.set_top_margin(0.25)
para.set_bottom_margin(0.25)
para.set_alignment(BaseDoc.PARA_ALIGN_CENTER)
para.set_description(_('The style used for the title of the page.'))
default_style.add_style("DAR-Title",para)

View File

@ -181,7 +181,8 @@ class DetDescendantReport(Report):
title = _("Descendant Report for %(person_name)s") % {
'person_name' : name }
self.doc.write_text(title)
mark = BaseDoc.IndexMark(title,BaseDoc.INDEX_TYPE_TOC,1)
self.doc.write_text(title,mark)
self.doc.end_paragraph()
keys = self.map.keys()
@ -194,7 +195,8 @@ class DetDescendantReport(Report):
self.doc.page_break()
self.doc.start_paragraph("DDR-Generation")
text = _("Generation %d") % (generation+1)
self.doc.write_text(text)
mark = BaseDoc.IndexMark(text,BaseDoc.INDEX_TYPE_TOC,2)
self.doc.write_text(text,mark)
self.doc.end_paragraph()
if self.childRef:
self.prev_gen_handles = self.gen_handles.copy()
@ -701,6 +703,7 @@ class DetDescendantOptions(ReportOptions):
para.set_header_level(1)
para.set_top_margin(0.25)
para.set_bottom_margin(0.25)
para.set_alignment(BaseDoc.PARA_ALIGN_CENTER)
para.set_description(_('The style used for the title of the page.'))
default_style.add_style("DDR-Title",para)

View File

@ -607,9 +607,11 @@ class FamilyGroup(Report):
def dump_family(self,family_handle,generation):
self.doc.start_paragraph('FGR-Title')
if self.recursive and self.generations:
self.doc.write_text(_("Family Group Report - Generation %d") % generation)
title=_("Family Group Report - Generation %d") % generation
else:
self.doc.write_text(_("Family Group Report") )
title=_("Family Group Report")
mark = BaseDoc.IndexMark(title,BaseDoc.INDEX_TYPE_TOC,1)
self.doc.write_text( title, mark )
self.doc.end_paragraph()
family = self.database.get_family_from_handle(family_handle)
@ -866,6 +868,7 @@ class FamilyGroupOptions(ReportOptions):
font.set_bold(1)
para = BaseDoc.ParagraphStyle()
para.set_font(font)
para.set_alignment(BaseDoc.PARA_ALIGN_CENTER)
para.set_description(_("The style used for the title of the page."))
default_style.add_style('FGR-Title',para)

View File

@ -416,9 +416,10 @@ class IndivCompleteReport(Report):
media_list = self.start_person.get_media_list()
name = self.start_person.get_primary_name().get_regular_name()
mark = ReportUtils.get_person_mark(self.database,self.start_person)
title = _("Summary of %s") % name
mark = BaseDoc.IndexMark(title,BaseDoc.INDEX_TYPE_TOC,1)
self.doc.start_paragraph("IDS-Title")
self.doc.write_text(_("Summary of %s") % name,mark)
self.doc.write_text(title,mark)
self.doc.end_paragraph()
self.doc.start_paragraph("IDS-Normal")