Difference between revisions of "Report API"

From Gramps
Jump to: navigation, search
m
Line 18: Line 18:
 
At the moment the combination of textual and graphical elements within one document is not supported (for future plans refer to [[Report API redesign]]), thus Text and Graphical reports are implemented via separate APIs, though they have a common part.
 
At the moment the combination of textual and graphical elements within one document is not supported (for future plans refer to [[Report API redesign]]), thus Text and Graphical reports are implemented via separate APIs, though they have a common part.
 
This common part is implemented in the [http://www.gramps-project.org/api3/BaseDoc.BaseDoc-class.html BaseDoc class], which contains among others basic document opening, closing, and stylesheet handling methods. It also stores the physical description of a page (sheet of paper in print).
 
This common part is implemented in the [http://www.gramps-project.org/api3/BaseDoc.BaseDoc-class.html BaseDoc class], which contains among others basic document opening, closing, and stylesheet handling methods. It also stores the physical description of a page (sheet of paper in print).
<blockquote>'''Note!''' The <tt>open</tt> and the <tt>close</tt> methods have to be implemented by the subclassed document generators.</blockquote>
+
 
 +
'''Note!''' The <tt>BaseDoc.open</tt> and the <tt>BaseDoc.close</tt> methods have to be implemented by the subclassed document generators.
  
 
===Page===
 
===Page===
 
Description of the paper, which every report will be rendered on, is stored by an instance of the [http://www.gramps-project.org/api3/BaseDoc.PaperStyle-class.html PaperStyle class]. This instance is available via the <tt>BaseDoc.paper_style</tt> class attribute. The chosen PaperStyle is given to the document generator at initialization, and is handled by the reporting framework.
 
Description of the paper, which every report will be rendered on, is stored by an instance of the [http://www.gramps-project.org/api3/BaseDoc.PaperStyle-class.html PaperStyle class]. This instance is available via the <tt>BaseDoc.paper_style</tt> class attribute. The chosen PaperStyle is given to the document generator at initialization, and is handled by the reporting framework.
  
Text reports do not need to care about paper properties, as the document generator (or the external viewer) paginates the report according to those properties. While, on the other hand, graphical reports do need to take paper properties into account when creating graphical elements. '''SPACE FOR IMPROVEMENTS'''
+
Text reports do not need to care about paper properties, as the document generator (or the external viewer) paginates the report according to those properties. While, on the other hand, graphical reports do need to take paper properties into account when creating graphical elements.
 +
[[Image:gramps-devel.png|left|22px]] ''document generator should hide paper properies for graphical reports too'' <br/>
  
 
==Text document API==
 
==Text document API==
  
 
==Graphical document API==
 
==Graphical document API==

Revision as of 06:11, 24 September 2007

Gnome-important.png

This is still a draft. Please don't link to it yet!

In GRAMPS there are six different types of reports.

  • Text report
  • Graphical report
  • Book report
  • Code generators
  • Web page generator
  • View only report

Only Text reports and Graphical reports use the Report (Document) API, since the latter three directly write their output into file(s) or onto the screen, while Book reports are simply combination of Text reports and Graphical reports.

Common API

At the moment the combination of textual and graphical elements within one document is not supported (for future plans refer to Report API redesign), thus Text and Graphical reports are implemented via separate APIs, though they have a common part. This common part is implemented in the BaseDoc class, which contains among others basic document opening, closing, and stylesheet handling methods. It also stores the physical description of a page (sheet of paper in print).

Note! The BaseDoc.open and the BaseDoc.close methods have to be implemented by the subclassed document generators.

Page

Description of the paper, which every report will be rendered on, is stored by an instance of the PaperStyle class. This instance is available via the BaseDoc.paper_style class attribute. The chosen PaperStyle is given to the document generator at initialization, and is handled by the reporting framework.

Text reports do not need to care about paper properties, as the document generator (or the external viewer) paginates the report according to those properties. While, on the other hand, graphical reports do need to take paper properties into account when creating graphical elements.

Gramps-devel.png
document generator should hide paper properies for graphical reports too

Text document API

Graphical document API