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

List:       koffice-devel
Subject:    Re: kword's libexport
From:       "Johannes Wilm" <j () indymedia ! no>
Date:       2003-06-27 9:02:11
[Download RAW message or body]

Hi again!
I will be gone for a week and I probably will not have internet at all. I
do think it is important that the RTF-filter in 1.3 for kword doesn't
crash applications loading the RTF and table support is important.
I therefor insert my current patch in here. Note it requires changes to
libexport which are being worked on by zack. Some of the data retrieval
will also have to be reworked when his changes have been commited. If
noone has reworked it to work with Zack's changed libexport when I get
back I will do that myself, although I guess I might be running late for
1.3 (???)

--- ExportFilter.cc	2003-06-27 10:49:19.000000000 +0200
+++ ExportFilter.cc.new	2003-06-26 01:52:03.000000000 +0200
@@ -76,35 +76,78 @@

     QValueList<TableCell>::ConstIterator itCell;

-    int rowCurrent=0;
-    m_textBody += "\\row";
-    m_textBody += m_eol;
+    int rowCurrent=-1;
+    QString left;
+    QString  right;
+    QString  bottom;
+    QString  top;
+    QString width;
+    QString  bleftpt;
+    QString  brightpt;
+    QString  bbottompt;
+    QString  btoppt;
+    QString  lWidth;
+    QString  rWidth;
+    QString  tWidth;
+    QString  bWidth;
+    QString  minDASHheight;
+    QString m_rowHeader;
+    QString m_rowBody;
+//    m_rowHeader += "\\trowd" + m_eol +
"\\trgaph36\\trql\\trrh0\\trleft0\\trautofit1\\trbrdrt\\brdrs\\brdrw10
\\trbrdrl\\brdrs\\brdrw10 \\trbrdrb\\brdrs\\brdrw10
\\trbrdrr\\brdrs\\brdrw10" + m_eol;  // start new row
     m_inTable=true;

     for (itCell=anchor.table.cellList.begin();
         itCell!=anchor.table.cellList.end(); itCell++)
     {
-        // ### TODO: rowspan, colspan
+
+	QValueList<FrameData> frameList = *(*itCell).frameList;
+        QValueList<FrameData>::ConstIterator ot;
+	for (ot=frameList.begin();ot!=frameList.end();ot++)
+	{
+	    right = QString::number(qRound(PT_TO_TWIP((*ot).frame.right)) -
m_paperMarginRight);
+	    left = QString::number(qRound(PT_TO_TWIP((*ot).frame.left)) -
m_paperMarginLeft);
+	    top = QString::number(qRound(PT_TO_TWIP((*ot).frame.top)) -
m_paperMarginTop);
+	    bottom = QString::number(qRound(PT_TO_TWIP((*ot).frame.bottom)) -
m_paperMarginBottom);
+	    width = QString::number(qRound((PT_TO_TWIP((*ot).frame.right) -
m_paperMarginRight)-(PT_TO_TWIP((*ot).frame.left) - m_paperMarginLeft)));
+	    brightpt = QString::number(qRound(PT_TO_TWIP((*ot).frame.brightpt)));
+	    bleftpt = QString::number(qRound(PT_TO_TWIP((*ot).frame.bleftpt)));
+	    btoppt = QString::number(qRound(PT_TO_TWIP((*ot).frame.btoppt)));
+	    bbottompt = QString::number(qRound(PT_TO_TWIP((*ot).frame.bbottompt)));
+	    lWidth = QString::number(qRound(PT_TO_TWIP((*ot).frame.lWidth)));
+	    rWidth = QString::number(qRound(PT_TO_TWIP((*ot).frame.rWidth)));
+	    tWidth = QString::number(qRound(PT_TO_TWIP((*ot).frame.tWidth)));
+	    bWidth = QString::number(qRound(PT_TO_TWIP((*ot).frame.bWidth)));
+	    minDASHheight =
QString::number(qRound(PT_TO_TWIP((*ot).frame.minDASHheight)));
+	}
+
+
+	// ### TODO: rowspan, colspan
         if (rowCurrent!=(*itCell).row)
         {
             rowCurrent=(*itCell).row;
-            m_textBody += "\\row";
-            m_textBody += m_eol;
-        }
-        m_textBody += "\\trowd \\trgaph60 \\trleft-60";  // start new row
+	    if (rowCurrent!=0)
+                m_textBody += m_rowHeader + m_eol + m_rowBody+ m_eol+
"\\row" + m_eol; //save last row
+	    m_rowBody ="";
+            m_rowHeader = "\\trowd" + m_eol + "\\trgaph80\\trql\\trrh"+
minDASHheight+"\\trleft"+left+"\\trautofit0" + m_eol;  // start new row
+       }
+        m_rowHeader += "\\clvertalt";
+	if (tWidth != "0") m_rowHeader += "\\clbrdrt\\brdrs\\brdrw" + tWidth;
+	if (bWidth != "0") m_rowHeader += "\\clbrdrb\\brdrs\\brdrw" + bWidth;
+	if (lWidth != "0") m_rowHeader += "\\clbrdrl\\brdrs\\brdrw" + lWidth;
+	if (rWidth != "0") m_rowHeader += "\\clbrdrr\\brdrs\\brdrw" + rWidth;
//borders top, bottom, left and right
+	m_rowHeader += "\\cltxlrtb \\clWidth"+width+"\\clftsWidth3"; //left to
right and top to bottom + cell width
+	m_rowHeader +=  "\\clpadl"+bleftpt+"\\clpadfl3
\\clpadt"+btoppt+"\\clpadft3 \\clpadb"+bbottompt+"\\clpadfb3
\\clpadr"+brightpt+"\\clpadfr3 "; //cell padding
+	m_rowHeader += "\\cellx" + right; //right border of cell

-        QValueList<ParaData> paraList = *(*itCell).paraList;
+	QValueList<ParaData> paraList = *(*itCell).paraList;
         QValueList<ParaData>::ConstIterator it;
-        for (it=paraList.begin();it!=paraList.end();it++)
-            m_textBody += ProcessParagraphData(
(*it).text,(*it).layout,(*it).formattingList) + m_eol;
+	for (it=paraList.begin();it!=paraList.end();it++)
+            m_rowBody += ProcessParagraphData(
(*it).text,(*it).layout,(*it).formattingList) + m_eol;

-        m_textBody += "\\cell";
+        m_rowBody += "\\cell";
     }
     m_inTable=false;
-
-    m_textBody += "\\row\\par";  // delimit last row
-    m_textBody += m_eol;
-
+    m_textBody += m_rowHeader + m_eol + m_rowBody+ m_eol+ "\\row\\pard" +
m_eol; //write last row
     return true;
 }





_______________________________________________
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