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

List:       koffice-devel
Subject:    Re: libexport fixes
From:       "Johannes Wilm" <j () indymedia ! no>
Date:       2003-07-07 7:02:25
[Download RAW message or body]

Hi,
here is a patch that lets the rtf-filter compile against Zack's changed
libexport. However it does not build meaningfull rtf-files because one
still can't get to the frame-data of a single cell. Hoever as soon as Zack
has implemented that, it should be possible to render perfect RTF-tables
by changing a single line.


["patch" (text/x-diff)]

--- ExportFilter.cc	2003-07-07 08:57:35.000000000 +0200
+++ ExportFilter.cc	2003-07-07 08:56:35.000000000 +0200
@@ -76,35 +76,50 @@
 
     QValueList<TableCell>::ConstIterator itCell;
 
-    int rowCurrent=0;
-    m_textBody += "\\row";
-    m_textBody += m_eol;
+    int rowCurrent=-1;
+    QString m_rowHeader;
+    QString m_rowBody;
     m_inTable=true;
 
     for (itCell=anchor.table.cellList.begin();
         itCell!=anchor.table.cellList.end(); itCell++)
     {
-        // ### TODO: rowspan, colspan
+
+	QValueList<ParaData> paraList = *(*itCell).paraList;
+//      FrameData frame = paraList.first().formattingList.first().frameAnchor.frame;
+	FrameData frame = anchor.frame;
+	// ### 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"+ \
QString::number(qRound(PT_TO_TWIP(frame.minHeight))); +            m_rowHeader += \
"\\trleft" + QString::number(qRound(PT_TO_TWIP(frame.left)) - m_paperMarginLeft) + \
"\\trautofit0" + m_eol;  // start new row +       }
+        m_rowHeader += "\\clvertalt";
+	if (frame.tWidth != 0) m_rowHeader += "\\clbrdrt\\brdrs\\brdrw" + \
QString::number(qRound(PT_TO_TWIP(frame.tWidth))); +	if (frame.bWidth != 0) \
m_rowHeader += "\\clbrdrb\\brdrs\\brdrw" + \
QString::number(qRound(PT_TO_TWIP(frame.bWidth))); +	if (frame.lWidth != 0) \
m_rowHeader += "\\clbrdrl\\brdrs\\brdrw" + \
QString::number(qRound(PT_TO_TWIP(frame.lWidth))); +	if (frame.rWidth != 0) \
m_rowHeader += "\\clbrdrr\\brdrs\\brdrw" + \
QString::number(qRound(PT_TO_TWIP(frame.rWidth))); //borders top, bottom, left and \
right +	m_rowHeader += "\\cltxlrtb "; //left to right and top to bottom
+        m_rowHeader += "\\clWidth" + QString::number(qRound((PT_TO_TWIP(frame.right) \
- m_paperMarginRight)-(PT_TO_TWIP(anchor.frame.left) - m_paperMarginLeft))) + \
"\\clftsWidth3"; //cell width +	m_rowHeader +=  \
"\\clpadl"+QString::number(qRound(PT_TO_TWIP(frame.bleftpt)))+"\\clpadfl3"; +        \
m_rowHeader += " \\clpadt" + QString::number(qRound(PT_TO_TWIP(frame.btoppt))) + \
"\\clpadft3"; +	m_rowHeader += " \\clpadb" + \
QString::number(qRound(PT_TO_TWIP(frame.bbottompt))) + "\\clpadfb3"; +	m_rowHeader += \
" \\clpadr" + QString::number(qRound(PT_TO_TWIP(frame.brightpt))) + "\\clpadfr3 "; \
//cell padding +	m_rowHeader += "\\cellx" + \
QString::number(qRound(PT_TO_TWIP(frame.right)) - m_paperMarginRight); //right border \
of cell +
 
-        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;
 }
 
@@ -152,8 +167,8 @@
 
   
     // find displayed width and height (in twips)
-    const long width  = (long)(PT_TO_TWIP(anchor.right  - anchor.left));
-    const long height = (long)(PT_TO_TWIP(anchor.bottom - anchor.top));
+    const long width  = (long)(PT_TO_TWIP(anchor.frame.right  - anchor.frame.left));
+    const long height = (long)(PT_TO_TWIP(anchor.frame.bottom - anchor.frame.top));
 
     // find original image width and height (in twips)
     long origWidth  = width;



_______________________________________________
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