Octel Developer Studio Report Generator. Erik J. Johnson Academic Advisor: Dr. Linda Seiter Thursday...
-
Upload
isabel-griffith -
Category
Documents
-
view
216 -
download
0
Transcript of Octel Developer Studio Report Generator. Erik J. Johnson Academic Advisor: Dr. Linda Seiter Thursday...
Octel Developer StudioReport Generator
Erik J. Johnson
Academic Advisor: Dr. Linda Seiter
Thursday May 7, 19982:50 PMEngr 326
Project Description
Fully functional visual development environment, being developed by Lucent Technologies Octel Messaging Division, for building and editing voice mail applications.
Existing printing technology in the Developer Studio was unable to print graphics--very necessary for visualizing the voice mail application.
Integrate a report generator component into the Developer Studio--specifically for graphical Callflow Trees.
Goal: Printing This View
Requirements
Capable of creating textual and/or graphical reports.
Capable of including report options such as headers, footers and margins.
Capable of printing reports which extend beyond one page both horizontally and vertically.
Capable of printing different data options.Exist separately from the main code base
so it maintains portability.
Initial Design
Let Microsoft® do some of the work for me: In the MFC Doc/View architecture, views derived
from the CView class know how to draw themselves.
The Report Engine class would get information from the MFC printing framework, setup viewports for each page, then dynamically bind to the printing methods of the application, eliminating the need for overridden printing methods.
Design Flaw
Although the initial design had a lot of potential for powerful reports, deep within the MFC printing code there is an ASSERT(FALSE) for printing views derived from CTreeView.
Because the entire design relied on the claim that all views know how to draw themselves, which is not entirely true, this design could not work.
Project RedesignDecomposed the report generator:
A Printable View Manager object which maintains margins, headers, footers, viewport settings, pagination, and the printing loop.
• This class can be subclassed to provide drawing for specific report types.
For Callflow reports:Printable Node objects which represent nodes in the
Callflow tree.A intermediary class between the application’s node
database and the report generator. A Tree controlling class which creates the tree of
PrintableNodes.A PrintableViewMgr subclass for the tree-specific
drawing.
View Class
Node
Application Database
PrintableViewMgr
PrintableTreeMgr
NodeAndPhraseTxtBasicNode
PrintableNode
(Abstract)
NodeTree
Class Design(for Callflow reports)
PrintableViewMgr
Base class for the report generator.Handles settings for margins,
indentations, headers and footers.Keeps track of the viewport for each
page and counts the page numbers.Intercepts the CView printing methods
and PrintableViewMgr subclasses draw the report specific data.
PrintableViewMgr (cont.)
Creates fonts for the reports.Sets mapping mode
(MM_ANSIOTROPIC) because it allows the scaling and axis-orientation to be user defined.
Prints header and footer, then calls the subclass’ PrintBody method.
Shifts viewport for the next page.
MFC Print Loop
MyView::OnPreparePrinting
MyView::OnBeginPrinting
StartDoc (MFC function)
MyView::OnPrepareDC
StartPage (MFC function)
MyView::OnPrepareDC(Windows 95 only)
MyView::OnPrint
EndPage (MFC function)
EndDoc (MFC function)
MyView::OnEndPrinting
PrintableViewMgr::OnPreparePrinting
PrintableViewMgr::OnBeginPrinting
PrintableViewMgr:: OnPrepareDC
PrintableViewMgr:: OnPrepareDC
PrintableViewMgr:: OnPrint
PrintHeader
PrintFooter
PrintBody
ShiftPageViewport
PrintableViewMgr:: OnEndPrinting
With PrintableViewMgr
PrintableNode
Data structure representing nodes in the Callflow report.
Data members used to keep track of its position in a tree.
Has pointer to external “Node” objects which get data for the reports from the application’s database.
Pure virtual method, DrawNode draws the representation of the node as defined by a PrintableNode subclass.
NodeTree
Mimics the functionality of CTreeCtrl and creates a tree of PrintableNodes.
Uses a factory method to dynamically create nodes at run time based on the specified report style.
PrintableNodes in a Tree
PrintableTreeMgr
PrintableViewMgr subclass.
Communicates with the NodeTree class to print the Callflow tree by overriding PrintableViewMgr drawing methods.
Printing the Callflow Tree
CTreeView/CTreeCtrl populates a NodeTree of PrintableNodes with the visible node items in the view.
As the MFC printing loop begins, the print calls are forwarded to the PrintableTreeMgr object.
The node tree is recursed and each node draws itself.
Pagination
Pagination is done during tree setup.If a node extends beyond the bottom
margin, it is moved so it begins at the top of the next page down.
If a node extends beyond the right margin, it is moved to begin at the left side of the next page to the right.
Spanning Page Breaks
Page Break If a node does not fit on a page, then it is shifted to the next page to the right.
To keep all nodes at the same depth lined up, a circular doubly linked list is maintained between nodes.
If a node spans a page, then it circles through the list offsetting each node.
OnBeginPrinting()
PrintableTreeMgr NodeTree PrintableNode BasicNode
SetupTree()
SetupTreeFromNode()
VisitEachDepth()
CreateNodeRect()
ShiftNodeOriginPageRight()
ShiftNodeOriginPageDown()
SetInitialNodeOrigin()
SetupNodeForPrinting()
NormalizeXOrigin()
NormalizeXOrigin()
Tree Setup for Printing
PrintableTreeMgr NodeTree PrintableNode BasicNode
PrintBody()
DrawTree()
PrintTreeFromNode()
DrawConnectingLines()
DrawNode() DrawNodeBody()
ConnectTwoNodes()
Tree Printing
Sample Application Output
Sample Output
Sample Output (cont.)