PDA

View Full Version : Opendocument format read/write *.odt



patrik08
9th September 2008, 12:15
The writer already exist on qt version 4.5 having small bug..
1- writing draw:frame tag (image tag) inside text:span and not on text:p (block tag)
2- it not write pagezise info on style head or page margin default

I start to write a reader today code on:
Only QT4.5
http://ppk.ciz.ch/MiniScribus/TextOdfDebug.1.zip

Only table is not ready why?
i suppose a bug on QT4.5
qtable->mergeCells(gorow,gocool,qAbs(cr - 1),qAbs(cs - 1));
mergeCell can not merge all column from one line if i leave -1
qtable->mergeCells(gorow,gocool,cr,cs);
it not merge cell can anybody try it to find bug on qt 4.5

or can any body confirm a bug on mergeCells?




QTextTable *qtable = cur.insertTable(rowCounter,constraints.size(),tf);
int gorow = -1;
int gocool = -1;

while ( !line.isNull() ) {
if (line.isElement() ) {
const QDomElement oorow = line.toElement();
if (oorow.tagName() == "table:table-row") {
gorow++;
gocool = -1;
QDomElement oocell = oorow.firstChildElement("table:table-cell");
while (!oocell.isNull()) {
gocool++;
const QTextTableCell ctd = qtable->cellAt(gorow,gocool);
const int cr = qMax(oocell.attribute("table:number-rows-spanned").toInt(),0);
const int cs = qMax(oocell.attribute("table:number-columns-spanned").toInt(),0);
qWarning() << "----- spanning /" << cr << "/" << cs << " gocool->" << gocool << " gorow->" << gorow;
if (qMax(cs,cr) !=0) {
/* can not spanning all column */
qtable->mergeCells(gorow,gocool,qAbs(cr - 1),qAbs(cs - 1));
}
cell = qtable->cellAt(gorow,gocool);
//////void QTextTable::mergeCells ( int row, int column, int numRows, int numCols )
/////////////////qWarning() << " cursor on cella /" << gorow << "/" << gocool;
if (!convertCellTable(oocell,cell,cur,tname,processin g)) {
qWarning() << "Error on parse table cell row:" << gorow << " column:" << gocool;
}

oocell = oocell.nextSiblingElement("table:table-cell");
}
}
}
line = line.nextSibling();
}




http://ppk.ciz.ch/MiniScribus/mergecell.png

patrik08
9th September 2008, 20:18
I solved :-)

/* value must having min 1 or row or int 3-4 not automatic accept 0 */




QDomElement oocell = oorow.firstChildElement("table:table-cell");
while (!oocell.isNull()) {
gocool++;
const QTextTableCell ctd = qtable->cellAt(gorow,gocool);
const int cr = qMax(oocell.attribute("table:number-rows-spanned").toInt(),0);
const int cs = qMax(oocell.attribute("table:number-columns-spanned").toInt(),0);
if (qMax(cs,cr) !=0) {
/* value must having min 1 or row or cell */
qtable->mergeCells(gorow,gocool,qMax(cr,1),qMax(cs,1));
}
cell = qtable->cellAt(gorow,gocool);
if (!convertCellTable(oocell,cell,cur,tname,processin g)) {
qWarning() << "Error on parse table cell row:" << gorow << " column:" << gocool;
}
oocell = oocell.nextSiblingElement("table:table-cell");
}

ocean
14th September 2008, 11:38
Which qt snapshot are you using? I tried to compile 3 snapshots but all of them was buggy and didn't able to compile.

patrik08
15th September 2008, 00:21
Which qt snapshot are you using? I tried to compile 3 snapshots but all of them was buggy and didn't able to compile.

If you use mingw ... replace the mingw/ path and take the mingw from trolltech mirror.
ftp://ftp.trolltech.com/qt/source/qt-win-opensource-4.4.1-mingw.exe
Take only the compiler... i suppose it have a patch.... i am not sure.

Only append utlis and minimal sys from self.

From my 10 mounth old mingw install i found compiler error. after i replace the new mingw + window service pack 3 all running easy....

snapshots i install :



-no-exceptions
-qt-zlib
-qt-libtiff
-qt-sql-mysql
-qt-sql-odbc
-qt-sql-sqlite
-qt-gif
-qt-libpng
-qt-libjpeg
-no-openssl
-no-phonon
-no-webkit
-no-scripttools


my mysql is on mingw lib path... and mysql running without plug-in

One from 6 day a go , other from 20080913 i build static.

Can you help me to write last piece (table) from odt reader?
svn http://fop-miniscribus.googlecode.com/svn/trunk/doc/TextOdfDebug/

OOReader.h
OOReader.cpp

I not find difference from a table writteln by openOffice and from QT4.5

My reader can draw table from openOffice odt but not from QT4.5..

If you dont have qt4.5 to test:
i build static /qt4.5_st/demos/textedit/ it save *odt Open Document format
it can only save odt file http://ppk.ciz.ch/MiniScribus/odt/

and i like to test xslt speed.. from 4.5
http://englich.wordpress.com/2008/09/10/xsl-t-and-qt/

ocean
15th September 2008, 12:43
If you use mingw ... replace the mingw/ path and take the mingw from trolltech mirror.
ftp://ftp.trolltech.com/qt/source/qt-win-opensource-4.4.1-mingw.exe
Take only the compiler... i suppose it have a patch.... i am not sure.

Only append utlis and minimal sys from self.

From my 10 mounth old mingw install i found compiler error. after i replace the new mingw + window service pack 3 all running easy....
I have the latest mingw too, but my mingw can't compile snapshots.



Can you help me to write last piece (table) from odt reader?
svn http://fop-miniscribus.googlecode.com/svn/trunk/doc/TextOdfDebug/

OOReader.h
OOReader.cpp

I not find difference from a table writteln by openOffice and from QT4.5

My reader can draw table from openOffice odt but not from QT4.5..
If you dont have qt4.5 to test:
i build static /qt4.5_st/demos/textedit/ it save *odt Open Document format
it can only save odt file http://ppk.ciz.ch/MiniScribus/odt/

Sure, if i can (and have enough time), i will help you. But I didn't understand you, you can't create a table by using Qt Tools?

patrik08
15th September 2008, 13:16
I have the latest mingw too, but my mingw can't compile snapshots.
Sure, if i can (and have enough time), i will help you. But I didn't understand you, you can't create a table by using Qt Tools?



ftp://ftp.trolltech.com/qt/snapshots/qt-win-opensource-src-4.4.3-snapshot-20080913.zip


this snapshots work 100% on my mingw

Have you Service Pack3 on window XP or you use vista?
try to build only:
./configure bla bla..
make sub-src
[only core lib]
not make all demo designer and tool designer, build at end designer & tool

Read table from OpenOffice odt file is ok and working.. :)
Read table from QT4.5 odt file (file created by qt) not working.. :(

OOReader.h
OOReader.cpp

patrik08
16th September 2008, 12:09
sorry i mistake version
this is correct ( it ending all two 913 )



ftp://ftp.trolltech.com/qt/snapshots/qt-win-opensource-src-4.5.0-snapshot-20080913.zip

patrik08
17th September 2008, 01:48
I have now my OpenDocument reader its possibel to build on qt4.4.1 or > on 4.5 reader already exist...

Only the listformat tree it show the first level table col-span and row-span are perfect...
And and one QTextEdit, if You load 30 or more page prepare you mind to wait long time.

I save source on SVN:
http://www.qt-apps.org/content/show.php/OpenDocument+format+Reader%2BWriter+odt?content=80 650



http://www.qt-apps.org/CONTENT/content-pre1/80650-1.png