From: Fridrich S. <str...@us...> - 2005-08-25 14:32:48
|
Update of /cvsroot/libwpd/writerperfect/filter In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27570/filter Modified Files: ListStyle.cxx ListStyle.hxx TableStyle.cxx WordPerfectCollector.cxx WordPerfectCollector.hxx Log Message: Merging the fs_refactoring1 branch into HEAD Index: TableStyle.cxx =================================================================== RCS file: /cvsroot/libwpd/writerperfect/filter/TableStyle.cxx,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** TableStyle.cxx 9 Feb 2005 17:56:59 -0000 1.11 --- TableStyle.cxx 25 Aug 2005 14:32:34 -0000 1.12 *************** *** 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.20 diff -C2 -d -r1.19 -r1.20 *** WordPerfectCollector.cxx 30 Jul 2005 14:01:12 -0000 1.19 --- WordPerfectCollector.cxx 25 Aug 2005 14:32:34 -0000 1.20 *************** *** 48,52 **** mbListElementOpenedAtCurrentLevel(false), mbTableCellOpened(false), ! mbHeaderRow(false) { } --- 48,53 ---- mbListElementOpenedAtCurrentLevel(false), mbTableCellOpened(false), ! mbHeaderRow(false), ! mbInNote(false) { } *************** *** 567,575 **** if (mpCurrentListStyle && mpCurrentListStyle->getListID() == id) pOrderedListStyle = static_cast<OrderedListStyle *>(mpCurrentListStyle); // FIXME: using a dynamic cast here causes oo to crash?! // this rather appalling conditional makes sure we only start a new list (rather than continue an old ! // one) iff: (1) we have no prior list OR (2) the prior list is actually definitively different // from the list that is just being defined (listIDs differ) OR (3) we can tell that the user actually // is starting a new list at level 1 (and only level 1) ! if (pOrderedListStyle == NULL || pOrderedListStyle->getListID() != id || (propList["libwpd:level"] && propList["libwpd:level"]->getInt()==1 && (propList["text:start-value"] && propList["text:start-value"]->getInt() != (miLastListNumber+1)))) --- 568,577 ---- if (mpCurrentListStyle && mpCurrentListStyle->getListID() == id) pOrderedListStyle = static_cast<OrderedListStyle *>(mpCurrentListStyle); // FIXME: using a dynamic cast here causes oo to crash?! + // this rather appalling conditional makes sure we only start a new list (rather than continue an old ! // one) if: (1) we have no prior list OR (2) the prior list is actually definitively different // from the list that is just being defined (listIDs differ) OR (3) we can tell that the user actually // is starting a new list at level 1 (and only level 1) ! if (pOrderedListStyle == NULL || pOrderedListStyle->getListID() != id || (propList["libwpd:level"] && propList["libwpd:level"]->getInt()==1 && (propList["text:start-value"] && propList["text:start-value"]->getInt() != (miLastListNumber+1)))) *************** *** 588,592 **** mbListContinueNumbering = true; ! pOrderedListStyle->updateListLevel(miCurrentListLevel, propList); } --- 590,601 ---- mbListContinueNumbering = true; ! // Iterate through ALL list styles with the same WordPerfect list id and define a level if it is not already defined ! // This solves certain problems with lists that start and finish without reaching certain levels and then begin again ! // and reach those levels. See gradguide0405_PC.wpd in the regression suite ! for (std::vector<ListStyle *>::iterator iterOrderedListStyles = mListStyles.begin(); iterOrderedListStyles != mListStyles.end(); iterOrderedListStyles++) ! { ! if ((* iterOrderedListStyles)->getListID() == propList["libwpd:id"]->getInt()) ! (* iterOrderedListStyles)->updateListLevel((propList["libwpd:level"]->getInt() - 1), propList); ! } } *************** *** 609,613 **** mpCurrentListStyle = static_cast<ListStyle *>(pUnorderedListStyle); } ! pUnorderedListStyle->updateListLevel(miCurrentListLevel, propList); } --- 618,628 ---- mpCurrentListStyle = static_cast<ListStyle *>(pUnorderedListStyle); } ! ! // See comment in WordPerfectCollector::defineOrderedListLevel ! for (std::vector<ListStyle *>::iterator iterUnorderedListStyles = mListStyles.begin(); iterUnorderedListStyles != mListStyles.end(); iterUnorderedListStyles++) ! { ! if ((* iterUnorderedListStyles)->getListID() == propList["libwpd:id"]->getInt()) ! (* iterUnorderedListStyles)->updateListLevel((propList["libwpd:level"]->getInt() - 1), propList); ! } } *************** *** 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"))); --- 762,773 ---- 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"))); --- 784,795 ---- 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); } } --- 798,839 ---- 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; } } --- 841,873 ---- 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"))); } --- 875,924 ---- 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.11 diff -C2 -d -r1.10 -r1.11 *** WordPerfectCollector.hxx 9 Feb 2005 17:56:59 -0000 1.10 --- WordPerfectCollector.hxx 25 Aug 2005 14:32:34 -0000 1.11 *************** *** 60,63 **** --- 60,64 ---- bool mbTableCellOpened; bool mbHeaderRow; + bool mbInNote; }; Index: ListStyle.hxx =================================================================== RCS file: /cvsroot/libwpd/writerperfect/filter/ListStyle.hxx,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ListStyle.hxx 8 Dec 2004 05:03:56 -0000 1.2 --- ListStyle.hxx 25 Aug 2005 14:32:34 -0000 1.3 *************** *** 65,68 **** --- 65,69 ---- ListStyle(const char *psName, const int iListID); virtual ~ListStyle(); + virtual void updateListLevel(const int iLevel, const WPXPropertyList &xPropList) = 0; virtual void write(DocumentHandler &xHandler) const; const int getListID() { return miListID; } Index: ListStyle.cxx =================================================================== RCS file: /cvsroot/libwpd/writerperfect/filter/ListStyle.cxx,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ListStyle.cxx 16 Jan 2005 08:47:53 -0000 1.5 --- ListStyle.cxx 25 Aug 2005 14:32:34 -0000 1.6 *************** *** 36,39 **** --- 36,41 ---- void OrderedListStyle::updateListLevel(const int iLevel, const WPXPropertyList &xPropList) { + if (iLevel < 0) + return; if (!isListLevelDefined(iLevel)) setListLevel(iLevel, new OrderedListLevelStyle(xPropList)); *************** *** 61,65 **** if (mPropList["text:space-before"]) stylePropertiesOpen.addAttribute("text:space-before", mPropList["text:space-before"]->getStr()); ! stylePropertiesOpen.addAttribute("text:min-label-width", "0.499cm"); stylePropertiesOpen.write(xHandler); --- 63,70 ---- if (mPropList["text:space-before"]) stylePropertiesOpen.addAttribute("text:space-before", mPropList["text:space-before"]->getStr()); ! if (mPropList["text:min-label-width"]) ! stylePropertiesOpen.addAttribute("text:min-label-width", mPropList["text:min-label-width"]->getStr()); ! if (mPropList["text:min-label-distance"]) ! stylePropertiesOpen.addAttribute("text:min-label-distance", mPropList["text:min-label-distance"]->getStr()); stylePropertiesOpen.write(xHandler); *************** *** 75,78 **** --- 80,85 ---- void UnorderedListStyle::updateListLevel(const int iLevel, const WPXPropertyList &xPropList) { + if (iLevel < 0) + return; if (!isListLevelDefined(iLevel)) setListLevel(iLevel, new UnorderedListLevelStyle(xPropList)); *************** *** 93,99 **** TagOpenElement stylePropertiesOpen("style:properties"); if (mPropList["text:space-before"]) ! listLevelStyleOpen.addAttribute("text:space-before", mPropList["text:space-before"]->getStr()); ! stylePropertiesOpen.addAttribute("text:min-label-width", "0.499cm"); ! stylePropertiesOpen.addAttribute("style:font-name", "StarSymbol"); stylePropertiesOpen.write(xHandler); --- 100,109 ---- TagOpenElement stylePropertiesOpen("style:properties"); if (mPropList["text:space-before"]) ! stylePropertiesOpen.addAttribute("text:space-before", mPropList["text:space-before"]->getStr()); ! if (mPropList["text:min-label-width"]) ! stylePropertiesOpen.addAttribute("text:min-label-width", mPropList["text:min-label-width"]->getStr()); ! if (mPropList["text:min-label-distance"]) ! stylePropertiesOpen.addAttribute("text:min-label-distance", mPropList["text:min-label-distance"]->getStr()); ! stylePropertiesOpen.addAttribute("style:font-name", "OpenSymbol"); stylePropertiesOpen.write(xHandler); |