View Single Post
Old 02-20-2009, 10:52 AM   #4 (permalink)
Gibou
The Contributor
 
Gibou's Avatar
 
Join Date: Nov 2007
Location: France, near Paris
Posts: 53
Thanks: 6
Gibou is on a distinguished road
Default

To me, I would design it like that:

- A class WordDocument
|_ title
|_ collection of 'Page'
|_ ...

- A class Page
|_ id
|_ collection of 'Paragraph'
|_ header (instance of 'Paragraph')
|_ footer (instance of 'Paragraph')
|_ ...

- A class Paragraph
|_ text
|_ adaptation (left, right, centered, justified)
|_ ...

- A class Image
|_ url
|_ width
|_ height
|_ ...

Headers and footers are nothing but a paragraphs so no need to create those classes. Find just a way to store in your WordDocument the information about "are the headers and the footers the same for all pages or are they differents for the first one ?". In the 'Page' constructor, if a header and/or a footer have already been created, just think to add to the 'header' and/or the 'footer' attributes a reference to those created.

The WordDocument class has a collection of class Page so typically, an array of instances of class 'Page'.

The Paragraph class could contain text and images but no need to create the class Text. What methods could exist in a such class ?

mmmm I don't see anything more.

Someone correct me if I'm wrong
__________________
Wedus project's Website
Send a message via MSN to Gibou
Gibou is offline  
Reply With Quote