BOB: GNOME Word Processor Efforts



Ok, I was out of the office for three weeks, thinking the entire time
about how to approach the building of a word processor.

After spending an ungodly amount of money on various MS Office books and
really looking at how they look, I realized something: all Office apps share
the same infrastructure.  There's the document part, and then there's the
stuff wrapped around it.  

The document part is very similar across all Office apps.  You can tell
this by comparing Word and PowerPoint in their appearance; they are very
similar in this regard.  The document widget is told the display style,
whether to use a ruler, etc., and is reponsible for doing printing,
print preview, and all other document display functions.  (At least,
that's what it looks like.)  Editing is done here.

Then there are the outside parts.  Clicking the "B" button in word probably
calls CurrentDocument->SetStyleBold(*CurrentSelection), or something.
The search function probably uses bunches of GetNextWord() calls to pull
text out of the doc.  Again, this is just what I am guessing from looking
at lots of functional descriptions and screenshots.

How does this work under the hood?  Well, one way it could work for us is
to use the canvaas to build a similar piece of infrastructure.  For each
Gnoffice app, i.e., for each different type of document that you want an
editor for (a presentation document, a structured document, a traditional
word processor document), you take the XML definition of your doc type and
make your own doc widget which inherits a lot of functionality from the
basic XML handler widget.  You then export lots of functions, like:

selection manipulators (MoveCursorToOffset(int NumWordsFromStart), etc.)
style selectors
doc querying functions (GetNextWord, InsertFootnote(* DocLocation), etc.)
editing functions (InsertText, Delete Text, InsertSection)

And then I got back and read the DOM docs from the W3C, and I realized
that other people were already way ahead of me on how to do this stuff.
The DOM presents a generic way to do this for any XML stylesheet, and is,
therefore, a Godsend for people writing GNOME Office applications.

My TODO list for getting a great Word clone written at this point would be
as follows:

- take canvaas and expand it to be a document widget.  (Encapsulate it in a
new document widget.)  Add these features:
	+ page view and document view
	+ rulers
	+ print preview

- write up an XML stylesheet for RTF and use this as your base.  Where are
the RTF docs?  Does it support (foot/end/margin)notes?

- take a look at the DOM docs and see how we want to export a document
object to the world with baboon.  Also take a look at the Word COM APIs,
which, according to the OLE article in this Summer's Perl Journal,
are included with Word itself.  Figure out what our exposed API for a
Word-like document object would be.

- implement.

Once this component is written, adding all of the GUI trappings is trivial.
If ORBit supported perl, you could easily write the actual WP in perl.  You
are just wrapping the document API in some buttons and menus.

Does this sound reasonable?  Is this the right way to write a word processor?

--
Todd Graham Lewis            32°49'N,83°36'W          (800) 719-4664, x2804
******Linux******         MindSpring Enterprises      tlewis@mindspring.net



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]