From: Fridrich S. <str...@us...> - 2005-07-31 06:39:02
|
Update of /cvsroot/libwpd/writerperfect/filter In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3132/filter Modified Files: Tag: fs_refactoring1 TableStyle.cxx WordPerfectCollector.cxx WordPerfectCollector.hxx Log Message: Handle para/column breaks before tables more OOo-like :-) Convert table to text in foot/endnotes (OOo does not support tables in notes) Index: TableStyle.cxx =================================================================== RCS file: /cvsroot/libwpd/writerperfect/filter/TableStyle.cxx,v retrieving revision 1.11 retrieving revision 1.11.2.1 diff -C2 -d -r1.11 -r1.11.2.1 *** TableStyle.cxx 9 Feb 2005 17:56:59 -0000 1.11 --- TableStyle.cxx 31 Jul 2005 06:38:53 -0000 1.11.2.1 *************** *** 123,126 **** --- 123,128 ---- if (mPropList["style:width"]) stylePropertiesOpen.addAttribute("style:width", mPropList["style:width"]->getStr()); + if (mPropList["fo:break-before"]) + stylePropertiesOpen.addAttribute("fo:break-before", mPropList["fo:break-before"]->getStr()); stylePropertiesOpen.write(xHandler); Index: WordPerfectCollector.cxx =================================================================== RCS file: /cvsroot/libwpd/writerperfect/filter/WordPerfectCollector.cxx,v retrieving revision 1.19 retrieving revision 1.19.2.1 diff -C2 -d -r1.19 -r1.19.2.1 *** WordPerfectCollector.cxx 30 Jul 2005 14:01:12 -0000 1.19 --- WordPerfectCollector.cxx 31 Jul 2005 06:38:53 -0000 1.19.2.1 *************** *** 48,52 **** mbListElementOpenedAtCurrentLevel(false), mbTableCellOpened(false), ! mbHeaderRow(false) { } --- 48,53 ---- mbListElementOpenedAtCurrentLevel(false), mbTableCellOpened(false), ! mbHeaderRow(false), ! mbInNote(false) { } *************** *** 747,755 **** mpCurrentContentElements->push_back(static_cast<DocumentElement *>(new TagOpenElement("text:footnote-body"))); ! } void WordPerfectCollector::closeFootnote() { mpCurrentContentElements->push_back(static_cast<DocumentElement *>(new TagCloseElement("text:footnote-body"))); mpCurrentContentElements->push_back(static_cast<DocumentElement *>(new TagCloseElement("text:footnote"))); --- 748,759 ---- mpCurrentContentElements->push_back(static_cast<DocumentElement *>(new TagOpenElement("text:footnote-body"))); ! ! mWriterDocumentState.mbInNote = true; } void WordPerfectCollector::closeFootnote() { + mWriterDocumentState.mbInNote = false; + mpCurrentContentElements->push_back(static_cast<DocumentElement *>(new TagCloseElement("text:footnote-body"))); mpCurrentContentElements->push_back(static_cast<DocumentElement *>(new TagCloseElement("text:footnote"))); *************** *** 766,773 **** mpCurrentContentElements->push_back(static_cast<DocumentElement *>(new TagOpenElement("text:endnote-body"))); ! } void WordPerfectCollector::closeEndnote() { mpCurrentContentElements->push_back(static_cast<DocumentElement *>(new TagCloseElement("text:endnote-body"))); mpCurrentContentElements->push_back(static_cast<DocumentElement *>(new TagCloseElement("text:endnote"))); --- 770,781 ---- mpCurrentContentElements->push_back(static_cast<DocumentElement *>(new TagOpenElement("text:endnote-body"))); ! ! mWriterDocumentState.mbInNote = true; } + void WordPerfectCollector::closeEndnote() { + mWriterDocumentState.mbInNote = false; + mpCurrentContentElements->push_back(static_cast<DocumentElement *>(new TagCloseElement("text:endnote-body"))); mpCurrentContentElements->push_back(static_cast<DocumentElement *>(new TagCloseElement("text:endnote"))); *************** *** 776,814 **** void WordPerfectCollector::openTable(const WPXPropertyList &propList, const WPXPropertyListVector &columns) { ! WPXString sTableName; ! sTableName.sprintf("Table%i", mTableStyles.size()); ! // FIXME: we base the table style off of the page's margin left, ignoring (potential) wordperfect margin ! // state which is transmitted inside the page. could this lead to unacceptable behaviour? ! // WLACH_REFACTORING: characterize this behaviour, probably should nip it at the bud within libwpd ! TableStyle *pTableStyle = new TableStyle(propList, columns, sTableName.cstr()); ! if (mWriterDocumentState.mbFirstElement && mpCurrentContentElements == &mBodyElements) ! { ! WPXString sMasterPageName("Page Style 1"); ! pTableStyle->setMasterPageName(sMasterPageName); ! mWriterDocumentState.mbFirstElement = false; ! } ! mTableStyles.push_back(pTableStyle); ! mpCurrentTableStyle = pTableStyle; ! TagOpenElement *pTableOpenElement = new TagOpenElement("table:table"); ! pTableOpenElement->addAttribute("table:name", sTableName.cstr()); ! pTableOpenElement->addAttribute("table:style-name", sTableName.cstr()); ! mpCurrentContentElements->push_back(static_cast<DocumentElement *>(pTableOpenElement)); ! for (int i=0; i<pTableStyle->getNumColumns(); i++) ! { ! TagOpenElement *pTableColumnOpenElement = new TagOpenElement("table:table-column"); ! WPXString sColumnStyleName; ! sColumnStyleName.sprintf("%s.Column%i", sTableName.cstr(), (i+1)); ! pTableColumnOpenElement->addAttribute("table:style-name", sColumnStyleName.cstr()); ! mpCurrentContentElements->push_back(pTableColumnOpenElement); ! TagCloseElement *pTableColumnCloseElement = new TagCloseElement("table:table-column"); ! mpCurrentContentElements->push_back(pTableColumnCloseElement); } } --- 784,825 ---- void WordPerfectCollector::openTable(const WPXPropertyList &propList, const WPXPropertyListVector &columns) { ! if (!mWriterDocumentState.mbInNote) ! { ! WPXString sTableName; ! sTableName.sprintf("Table%i", mTableStyles.size()); ! // FIXME: we base the table style off of the page's margin left, ignoring (potential) wordperfect margin ! // state which is transmitted inside the page. could this lead to unacceptable behaviour? ! // WLACH_REFACTORING: characterize this behaviour, probably should nip it at the bud within libwpd ! TableStyle *pTableStyle = new TableStyle(propList, columns, sTableName.cstr()); ! if (mWriterDocumentState.mbFirstElement && mpCurrentContentElements == &mBodyElements) ! { ! WPXString sMasterPageName("Page Style 1"); ! pTableStyle->setMasterPageName(sMasterPageName); ! mWriterDocumentState.mbFirstElement = false; ! } ! mTableStyles.push_back(pTableStyle); ! mpCurrentTableStyle = pTableStyle; ! TagOpenElement *pTableOpenElement = new TagOpenElement("table:table"); ! pTableOpenElement->addAttribute("table:name", sTableName.cstr()); ! pTableOpenElement->addAttribute("table:style-name", sTableName.cstr()); ! mpCurrentContentElements->push_back(static_cast<DocumentElement *>(pTableOpenElement)); ! for (int i=0; i<pTableStyle->getNumColumns(); i++) ! { ! TagOpenElement *pTableColumnOpenElement = new TagOpenElement("table:table-column"); ! WPXString sColumnStyleName; ! sColumnStyleName.sprintf("%s.Column%i", sTableName.cstr(), (i+1)); ! pTableColumnOpenElement->addAttribute("table:style-name", sColumnStyleName.cstr()); ! mpCurrentContentElements->push_back(pTableColumnOpenElement); ! TagCloseElement *pTableColumnCloseElement = new TagCloseElement("table:table-column"); ! mpCurrentContentElements->push_back(pTableColumnCloseElement); ! } } } *************** *** 816,842 **** void WordPerfectCollector::openTableRow(const WPXPropertyList &propList) { ! if (propList["libwpd:is-header-row"] && (propList["libwpd:is-header-row"]->getInt())) { ! mpCurrentContentElements->push_back(static_cast<DocumentElement *>(new TagOpenElement("table:table-header-rows"))); ! mWriterDocumentState.mbHeaderRow = true; ! } ! WPXString sTableRowStyleName; ! sTableRowStyleName.sprintf("%s.Row%i", mpCurrentTableStyle->getName().cstr(), mpCurrentTableStyle->getNumTableRowStyles()); ! TableRowStyle *pTableRowStyle = new TableRowStyle(propList, sTableRowStyleName.cstr()); ! mpCurrentTableStyle->addTableRowStyle(pTableRowStyle); ! ! TagOpenElement *pTableRowOpenElement = new TagOpenElement("table:table-row"); ! pTableRowOpenElement->addAttribute("table:style-name", sTableRowStyleName); ! mpCurrentContentElements->push_back(static_cast<DocumentElement *>(pTableRowOpenElement)); } void WordPerfectCollector::closeTableRow() { ! mpCurrentContentElements->push_back(static_cast<DocumentElement *>(new TagCloseElement("table:table-row"))); ! if (mWriterDocumentState.mbHeaderRow) { ! mpCurrentContentElements->push_back(static_cast<DocumentElement *>(new TagCloseElement("table:table-header-rows"))); ! mWriterDocumentState.mbHeaderRow = false; } } --- 827,859 ---- void WordPerfectCollector::openTableRow(const WPXPropertyList &propList) { ! if (!mWriterDocumentState.mbInNote) { ! if (propList["libwpd:is-header-row"] && (propList["libwpd:is-header-row"]->getInt())) ! { ! mpCurrentContentElements->push_back(static_cast<DocumentElement *>(new TagOpenElement("table:table-header-rows"))); ! mWriterDocumentState.mbHeaderRow = true; ! } ! WPXString sTableRowStyleName; ! sTableRowStyleName.sprintf("%s.Row%i", mpCurrentTableStyle->getName().cstr(), mpCurrentTableStyle->getNumTableRowStyles()); ! TableRowStyle *pTableRowStyle = new TableRowStyle(propList, sTableRowStyleName.cstr()); ! mpCurrentTableStyle->addTableRowStyle(pTableRowStyle); ! ! TagOpenElement *pTableRowOpenElement = new TagOpenElement("table:table-row"); ! pTableRowOpenElement->addAttribute("table:style-name", sTableRowStyleName); ! mpCurrentContentElements->push_back(static_cast<DocumentElement *>(pTableRowOpenElement)); ! } } void WordPerfectCollector::closeTableRow() { ! if (!mWriterDocumentState.mbInNote) { ! mpCurrentContentElements->push_back(static_cast<DocumentElement *>(new TagCloseElement("table:table-row"))); ! if (mWriterDocumentState.mbHeaderRow) ! { ! mpCurrentContentElements->push_back(static_cast<DocumentElement *>(new TagCloseElement("table:table-header-rows"))); ! mWriterDocumentState.mbHeaderRow = false; ! } } } *************** *** 844,881 **** void WordPerfectCollector::openTableCell(const WPXPropertyList &propList) { ! WPXString sTableCellStyleName; ! sTableCellStyleName.sprintf( "%s.Cell%i", mpCurrentTableStyle->getName().cstr(), mpCurrentTableStyle->getNumTableCellStyles()); ! TableCellStyle *pTableCellStyle = new TableCellStyle(propList, sTableCellStyleName.cstr()); ! mpCurrentTableStyle->addTableCellStyle(pTableCellStyle); ! TagOpenElement *pTableCellOpenElement = new TagOpenElement("table:table-cell"); ! pTableCellOpenElement->addAttribute("table:style-name", sTableCellStyleName); ! if (propList["table:number-columns-spanned"]) ! pTableCellOpenElement->addAttribute("table:number-columns-spanned", ! propList["table:number-columns-spanned"]->getStr().cstr()); ! if (propList["table:number-rows-spanned"]) ! pTableCellOpenElement->addAttribute("table:number-rows-spanned", ! propList["table:number-rows-spanned"]->getStr().cstr()); ! pTableCellOpenElement->addAttribute("table:value-type", "string"); ! mpCurrentContentElements->push_back(static_cast<DocumentElement *>(pTableCellOpenElement)); ! mWriterDocumentState.mbTableCellOpened = true; } void WordPerfectCollector::closeTableCell() { ! mpCurrentContentElements->push_back(static_cast<DocumentElement *>(new TagCloseElement("table:table-cell"))); ! mWriterDocumentState.mbTableCellOpened = false; } void WordPerfectCollector::insertCoveredTableCell(const WPXPropertyList &propList) { ! mpCurrentContentElements->push_back(static_cast<DocumentElement *>(new TagOpenElement("table:covered-table-cell"))); ! mpCurrentContentElements->push_back(static_cast<DocumentElement *>(new TagCloseElement("table:covered-table-cell"))); } void WordPerfectCollector::closeTable() { ! mpCurrentContentElements->push_back(static_cast<DocumentElement *>(new TagCloseElement("table:table"))); } --- 861,910 ---- void WordPerfectCollector::openTableCell(const WPXPropertyList &propList) { ! if (!mWriterDocumentState.mbInNote) ! { ! WPXString sTableCellStyleName; ! sTableCellStyleName.sprintf( "%s.Cell%i", mpCurrentTableStyle->getName().cstr(), mpCurrentTableStyle->getNumTableCellStyles()); ! TableCellStyle *pTableCellStyle = new TableCellStyle(propList, sTableCellStyleName.cstr()); ! mpCurrentTableStyle->addTableCellStyle(pTableCellStyle); ! TagOpenElement *pTableCellOpenElement = new TagOpenElement("table:table-cell"); ! pTableCellOpenElement->addAttribute("table:style-name", sTableCellStyleName); ! if (propList["table:number-columns-spanned"]) ! pTableCellOpenElement->addAttribute("table:number-columns-spanned", ! propList["table:number-columns-spanned"]->getStr().cstr()); ! if (propList["table:number-rows-spanned"]) ! pTableCellOpenElement->addAttribute("table:number-rows-spanned", ! propList["table:number-rows-spanned"]->getStr().cstr()); ! pTableCellOpenElement->addAttribute("table:value-type", "string"); ! mpCurrentContentElements->push_back(static_cast<DocumentElement *>(pTableCellOpenElement)); ! mWriterDocumentState.mbTableCellOpened = true; ! } } void WordPerfectCollector::closeTableCell() { ! if (!mWriterDocumentState.mbInNote) ! { ! mpCurrentContentElements->push_back(static_cast<DocumentElement *>(new TagCloseElement("table:table-cell"))); ! mWriterDocumentState.mbTableCellOpened = false; ! } } void WordPerfectCollector::insertCoveredTableCell(const WPXPropertyList &propList) { ! if (!mWriterDocumentState.mbInNote) ! { ! mpCurrentContentElements->push_back(static_cast<DocumentElement *>(new TagOpenElement("table:covered-table-cell"))); ! mpCurrentContentElements->push_back(static_cast<DocumentElement *>(new TagCloseElement("table:covered-table-cell"))); ! } } void WordPerfectCollector::closeTable() { ! if (!mWriterDocumentState.mbInNote) ! { ! mpCurrentContentElements->push_back(static_cast<DocumentElement *>(new TagCloseElement("table:table"))); ! } } Index: WordPerfectCollector.hxx =================================================================== RCS file: /cvsroot/libwpd/writerperfect/filter/WordPerfectCollector.hxx,v retrieving revision 1.10 retrieving revision 1.10.2.1 diff -C2 -d -r1.10 -r1.10.2.1 *** WordPerfectCollector.hxx 9 Feb 2005 17:56:59 -0000 1.10 --- WordPerfectCollector.hxx 31 Jul 2005 06:38:53 -0000 1.10.2.1 *************** *** 60,63 **** --- 60,64 ---- bool mbTableCellOpened; bool mbHeaderRow; + bool mbInNote; }; |