From: Fridrich S. <str...@us...> - 2005-08-01 16:48:28
|
Update of /cvsroot/libwpd/libwpd2/src/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26804/src/lib Modified Files: Tag: fs_refactoring1 WP6HLContentListener.cpp WPXHLListener.cpp WPXHLListener.h Log Message: With this one, the regression tests pass correctly. I still have to crosscheck the document visually one by one on a machine with WordPerfect installed, but I am almost happy with the result Index: WP6HLContentListener.cpp =================================================================== RCS file: /cvsroot/libwpd/libwpd2/src/lib/WP6HLContentListener.cpp,v retrieving revision 1.78.2.8 retrieving revision 1.78.2.9 diff -C2 -d -r1.78.2.8 -r1.78.2.9 *** WP6HLContentListener.cpp 1 Aug 2005 09:21:38 -0000 1.78.2.8 --- WP6HLContentListener.cpp 1 Aug 2005 16:47:56 -0000 1.78.2.9 *************** *** 1226,1240 **** } - // create a new section, and a new paragraph, if our section attributes have changed and we have inserted - // something into the document (or we have forced a break, which assumes the same condition) - #if 0 - if (m_ps->m_sectionAttributesChanged && m_parseState->m_bodyText.len()) - { - if (!m_ps->m_isTableOpened) { - _closeSection(); - _openSection();} - } - #endif - if (m_parseState->m_bodyText.len() || (m_parseState->m_textBeforeNumber.len() && !m_parseState->m_putativeListElementHasParagraphNumber)) --- 1226,1229 ---- *************** *** 1284,1292 **** int oldListLevel; (m_parseState->m_listLevelStack.empty()) ? oldListLevel = 0 : oldListLevel = m_parseState->m_listLevelStack.top(); ! if (oldListLevel == 0) ! { ! _closeParagraph(); ! } ! if (m_ps->m_currentListLevel > oldListLevel) --- 1273,1278 ---- int oldListLevel; (m_parseState->m_listLevelStack.empty()) ? oldListLevel = 0 : oldListLevel = m_parseState->m_listLevelStack.top(); ! _closeParagraph(); // Fridrich: both listElement and paragraph should be already closed, but do this for security ! _closeListElement(); if (m_ps->m_currentListLevel > oldListLevel) *************** *** 1317,1323 **** } for (int i=(oldListLevel+1); i<=m_ps->m_currentListLevel; i++) { - // Fridrich: we should not define list sublevels _inside_ of list elements; - // so we just close the element to prevent call graph failure - _closeListElement(); m_parseState->m_listLevelStack.push(i); WPD_DEBUG_MSG(("Pushed level %i onto the list level stack\n", i)); --- 1303,1306 ---- *************** *** 1334,1340 **** else if (m_ps->m_currentListLevel < oldListLevel) { - _closeListElement(); // close the current element, which must exist - // now keep on closing levels until we reach the current list level, or the list - // level stack is empty (signalling that we are out of a list) while (!m_parseState->m_listLevelStack.empty() && m_parseState->m_listLevelStack.top() > m_ps->m_currentListLevel) { --- 1317,1320 ---- *************** *** 1352,1368 **** else m_listenerImpl->closeOrderedListLevel(); - - // if we are in a sub-level (beyond 1), and we still haven't reached the current list level, - // then that implies that we opened an element that needs to be closed.. - if (!m_parseState->m_listLevelStack.empty()) - _closeListElement(); } } - else if (m_ps->m_currentListLevel == oldListLevel) - { - // keep the last element on the stack, as it's replaced by this element - // (a NULL operation) - _closeListElement(); // but close it - } m_parseState->m_textBeforeNumber.clear(); --- 1332,1337 ---- *************** *** 1371,1381 **** m_parseState->m_textAfterDisplayReference.clear(); m_parseState->m_textAfterNumber.clear(); - #if 0 - // open a new list element, if we're still in the list - if (m_ps->m_currentListLevel > 0) - { - _openListElement(); - } - #endif } --- 1340,1343 ---- Index: WPXHLListener.cpp =================================================================== RCS file: /cvsroot/libwpd/libwpd2/src/lib/WPXHLListener.cpp,v retrieving revision 1.61.2.5 retrieving revision 1.61.2.6 diff -C2 -d -r1.61.2.5 -r1.61.2.6 *** WPXHLListener.cpp 1 Aug 2005 09:21:38 -0000 1.61.2.5 --- WPXHLListener.cpp 1 Aug 2005 16:47:57 -0000 1.61.2.6 *************** *** 57,63 **** m_isPageSpanBreakDeferred(false), m_isParagraphOpened(false), m_isListElementOpened(false), - m_isSpanOpened(false), m_currentTableCol(0), --- 57,63 ---- m_isPageSpanBreakDeferred(false), + m_isSpanOpened(false), m_isParagraphOpened(false), m_isListElementOpened(false), m_currentTableCol(0), *************** *** 188,191 **** --- 188,192 ---- if (m_ps->m_isListElementOpened) _closeListElement(); + _flushList(); if (m_ps->m_isSectionOpened) *************** *** 675,681 **** m_ps->m_isTableOpened = false; m_ps->m_wasHeaderRow = false; // handle case where page span is closed in the middle of a table ! if (m_ps->m_isPageSpanBreakDeferred) { _closePageSpan(); --- 676,686 ---- m_ps->m_isTableOpened = false; m_ps->m_wasHeaderRow = false; + + _closeParagraph(); + _closeListElement(); + _flushList(); // handle case where page span is closed in the middle of a table ! if (m_ps->m_isPageSpanBreakDeferred && !m_ps->m_inSubDocument) { _closePageSpan(); *************** *** 801,804 **** --- 806,811 ---- _openSpan(); _closeParagraph(); + _closeListElement(); + _flushList(); m_ps->m_cellAttributeBits = 0x00000000; if (m_ps->m_isTableCellOpened) Index: WPXHLListener.h =================================================================== RCS file: /cvsroot/libwpd/libwpd2/src/lib/WPXHLListener.h,v retrieving revision 1.61.2.2 retrieving revision 1.61.2.3 diff -C2 -d -r1.61.2.2 -r1.61.2.3 *** WPXHLListener.h 30 Jul 2005 13:08:35 -0000 1.61.2.2 --- WPXHLListener.h 1 Aug 2005 16:47:57 -0000 1.61.2.3 *************** *** 89,95 **** bool m_isPageSpanBreakDeferred; bool m_isParagraphOpened; bool m_isListElementOpened; - bool m_isSpanOpened; WPXTableDefinition m_tableDefinition; --- 89,95 ---- bool m_isPageSpanBreakDeferred; + bool m_isSpanOpened; bool m_isParagraphOpened; bool m_isListElementOpened; WPXTableDefinition m_tableDefinition; *************** *** 192,196 **** void _openListElement(); ! void _closeListElement(); void _openSpan(); --- 192,196 ---- void _openListElement(); ! void _closeListElement(); void _openSpan(); |