[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    Working on kword tables? (includes patch)
From:       Carl G Lewis <carll () optushome ! com ! au>
Date:       2003-04-13 5:01:33
[Download RAW message or body]



Hello, 

I am interested in doing some work on koffice, in particular trying to improve 
tables in kword. 

In the cvs log for kwtableframeset.cc, David says that he wants to move from 
the m_cells QPtrList to the m_rowArray data structure. I could do this, if 
no-one else is planning to do it immediately.

I have read most of kwtableframeset.cc, and understand some of it, although 
the important methods are quite difficult to fully understand, eg 
drawBorders() and recalcRows(). drawBorders() seems to be involved in some of 
the crashes, too.

So my thoughts were that we could move to the new data structure, plus try and 
do a bit of a cleanup (mainly introducing more (small) methods to make code 
more comprehensible). As part of this I will also try to fix bugs as I can 
figure out what they are.

Although it is probably better to fix bugs first then make changes, I am not 
really sure if that is the easiest approach in this case :-P

BTW, I have not worked on KDE applications before, although I am quite 
familiar with Qt because I used it for a couple of uni projects.

Please let me know it is OK to start working on this.

Also, here is a one-liner patch that fixes a crash. getCell() gets called from 
drawBorders(), which sometimes passes in an invalid column, because it 
subtracts 1 from the 'col' variable when it is zero. col is unsigned, so we 
pass in 2^32 or so. When the returned pointer is then used, trouble is not 
far away! Returning 0 is fine, as drawBorders()  checks for this.


Index: kwtableframeset.cc
===================================================================
RCS file: /home/kde/koffice/kword/kwtableframeset.cc,v
retrieving revision 1.236
diff -u -3 -p -r1.236 kwtableframeset.cc
--- kwtableframeset.cc	25 Feb 2003 19:12:39 -0000	1.236
+++ kwtableframeset.cc	13 Apr 2003 04:18:39 -0000
@@ -223,7 +223,7 @@ double KWTableFrameSet::leftWithoutBorde
 /* returns the cell that occupies row, col. */
 KWTableFrameSet::Cell *KWTableFrameSet::getCell( unsigned int row, unsigned 
int col )
 {
-    if ( row < m_rowArray.size() ) {
+    if ( row < m_rowArray.size() && col < m_rowArray[row]->size() ) {
         Cell* cell = (*m_rowArray[row])[col];
         if ( cell )
             return cell;


Carl.

_______________________________________________
koffice-devel mailing list
koffice-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic