--VbJkn9YxBvnuCH5J Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Sep 10, 2001 at 02:16:12PM +0200, Eva Brucherseifer wrote: >=20 > Hi, Hi Eva! > At work I had a similar problem and finally found a wonderful solution fr= om=20 > the design patterns, that might suit here too. It is the builder patterns= ,=20 > which consists of 2 parts: the director and the builder. >=20 > director: > The director parses the input and extracts the tasks to do in order to bu= ild=20 > a document in another format. It doesn't have any knowledge about how to= =20 > perform the tasks. This fits perfectly for the HTML export of kspread and kword, yes. One dire= ctor per application (maybe inhariting a basic implementation) looks very good t= o me! > builder: > The builder puts the output format together. It has an interface that=20 > provides methods for sub-tasks. These are called by the director. It does= n't=20 > have any knowledge about the input format. >=20 > So how does this look like for the html export filter? You have the build= er=20 > that can set together a html page. Here is a rough sketch of a html build= er=20 > class: >=20 > class KHTMLBuilder : public KOfficeBuilder > { > public:=09 > virtual void buildDocument(...); // initialization > virtual void buildHeader(...); virtual void addHeader(QString name, QString value); // sets author stuff, = known meta tags are converted. > virtual buildFooter(...); > virtual buildParagraph(...); > virtual buildTable(...); don't forget that this method needs a created paragraph as an argument.= (actually an ID, see below) > virtual buildTableRow(...); > virtual HTMLDocument* getHTML(); > } >=20 > The HTMLDocument can be another internal structure than easily can be par= sed=20 > afterwards or a string (or you add another function "getString()"). >=20 > But would imply, that there is some kind of "general=20 > document structure", that is implemented in the builder interface - don't= =20 > know, if this is possible... The builder has as many methods as needed to provide all the functionality = of the export filter, this is inharent to the pattern. If you make a method like buildTable have an paragraphId as argument, and a= lso use the paragraphId on creating the paragraph itself, then the elements dont have to be called in the same order as they are presented in the output fil= e. Consider the following; int parag=3D1; myBuilder.buildParagraph(parag++); // create parag 1 myBuilder.buildParagraph(parag++); // create parag 2 int table=3D1; myBuilder.buildTable(1,table); // create table 1 in parag 1 int row=3D1; myBuilder.buildTableRow(table,row++); // create tableRow 1 in table 1 myBuilder.buildTableRow(table,row); // create tableRow 2 in table 1 myBuilder.buildTableCell(table,row,1,3,4); // create tableCell 1 in tab= le 1 in row 2, table cell has width=3D4 height=3D3 This simply builds the HTML in a internal structure inside the builder, cal= ling this in another order does not make to much of a difference, as long as something is created before you use it. I don't think you will find to many problems with document structures if yo= u do it like this. > Well, any comments are welcome. >=20 I think this is a very nice addition, and maybe you can check with Frank wh= at=20 he has allready then the solve will form itself. ps. Frank has posted his source on:=20 http://www.student.kuleuven.ac.be/~m9823990/html2kwd.tbz2 --=20 Thomas Zander zander@earthling.n= et The only thing worse than failure is the fear of trying something new --VbJkn9YxBvnuCH5J Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE7nQ/HCojCW6H2z/QRApFkAJwK22WcXc08/QQdoX5E7tCHWNfH8QCgx1ge lOmZFXKSPBClIhh7QTmbf+0= =bVaT -----END PGP SIGNATURE----- --VbJkn9YxBvnuCH5J-- _______________________________________________ Koffice-devel mailing list Koffice-devel@mail.kde.org http://mail.kde.org/mailman/listinfo/koffice-devel