From koffice-devel Mon Jul 07 07:02:25 2003 From: "Johannes Wilm" Date: Mon, 07 Jul 2003 07:02:25 +0000 To: koffice-devel Subject: Re: libexport fixes X-MARC-Message: https://marc.info/?l=koffice-devel&m=105756234418255 MIME-Version: 1 Content-Type: multipart/mixed; boundary="------=_20030707090225_60505" ------=_20030707090225_60505 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit 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. ------=_20030707090225_60505 Content-Type: text/x-diff; name="patch" Content-Disposition: attachment; filename="patch" --- 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::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 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 paraList = *(*itCell).paraList; QValueList::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; ------=_20030707090225_60505 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ koffice-devel mailing list koffice-devel@mail.kde.org http://mail.kde.org/mailman/listinfo/koffice-devel ------=_20030707090225_60505--