From: Fridrich S. <str...@us...> - 2005-08-08 15:45:52
|
Update of /cvsroot/libwpd/libwpd2/src/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8195/src/lib Modified Files: Tag: fs_refactoring1 WP3HLListener.cpp WP42HLListener.cpp WP5HLListener.cpp WP6HLContentListener.cpp WP6HLContentListener.h WPXHLListener.cpp WPXHLListener.h Log Message: Simplification of _flushText() (hurray) + getting list margins correctly + some more miscellaneous fixes to make the stuff more robust Index: WP3HLListener.cpp =================================================================== RCS file: /cvsroot/libwpd/libwpd2/src/lib/WP3HLListener.cpp,v retrieving revision 1.13.2.2 retrieving revision 1.13.2.3 diff -C2 -d -r1.13.2.2 -r1.13.2.3 *** WP3HLListener.cpp 30 Jul 2005 13:08:34 -0000 1.13.2.2 --- WP3HLListener.cpp 8 Aug 2005 15:45:33 -0000 1.13.2.3 *************** *** 69,75 **** if (!isUndoOn()) { - _flushText(); if (!m_ps->m_isSpanOpened) _openSpan(); m_listenerImpl->insertTab(); } --- 69,76 ---- if (!isUndoOn()) { if (!m_ps->m_isSpanOpened) _openSpan(); + else + _flushText(); m_listenerImpl->insertTab(); } *************** *** 80,87 **** if (!isUndoOn()) { ! if (!m_ps->m_isSpanOpened && !m_ps->m_isParagraphOpened && !m_ps->m_isListElementOpened) _openSpan(); - else - _flushText(); if (m_ps->m_isParagraphOpened) _closeParagraph(); --- 81,86 ---- if (!isUndoOn()) { ! if (!m_ps->m_isParagraphOpened && !m_ps->m_isListElementOpened) _openSpan(); if (m_ps->m_isParagraphOpened) _closeParagraph(); *************** *** 94,98 **** void WP3HLListener::endDocument() { ! _flushText(); _closeSection(); _closePageSpan(); --- 93,98 ---- void WP3HLListener::endDocument() { ! _closeSpan(); ! _closeParagraph(); _closeSection(); _closePageSpan(); *************** *** 229,237 **** { if (m_textBuffer.len()) - { - if (!m_ps->m_isSpanOpened) - _openSpan(); m_listenerImpl->insertText(m_textBuffer); ! m_textBuffer.clear(); ! } } --- 229,233 ---- { if (m_textBuffer.len()) m_listenerImpl->insertText(m_textBuffer); ! m_textBuffer.clear(); } Index: WP5HLListener.cpp =================================================================== RCS file: /cvsroot/libwpd/libwpd2/src/lib/WP5HLListener.cpp,v retrieving revision 1.32.2.2 retrieving revision 1.32.2.3 diff -C2 -d -r1.32.2.2 -r1.32.2.3 *** WP5HLListener.cpp 30 Jul 2005 13:08:34 -0000 1.32.2.2 --- WP5HLListener.cpp 8 Aug 2005 15:45:33 -0000 1.32.2.3 *************** *** 65,71 **** void WP5HLListener::insertTab(const uint8_t tabType, const float tabPosition) { - _flushText(); if (!m_ps->m_isSpanOpened) _openSpan(); m_listenerImpl->insertTab(); } --- 65,73 ---- void WP5HLListener::insertTab(const uint8_t tabType, const float tabPosition) { if (!m_ps->m_isSpanOpened) _openSpan(); + else + _flushText(); + m_listenerImpl->insertTab(); } *************** *** 75,82 **** if (!isUndoOn()) { ! if (!m_ps->m_isSpanOpened && !m_ps->m_isParagraphOpened && !m_ps->m_isListElementOpened) _openSpan(); - else - _flushText(); if (m_ps->m_isParagraphOpened) _closeParagraph(); --- 77,82 ---- if (!isUndoOn()) { ! if (!m_ps->m_isParagraphOpened && !m_ps->m_isListElementOpened) _openSpan(); if (m_ps->m_isParagraphOpened) _closeParagraph(); *************** *** 88,92 **** void WP5HLListener::endDocument() { ! _flushText(); _closeSection(); _closePageSpan(); --- 88,93 ---- void WP5HLListener::endDocument() { ! _closeSpan(); ! _closeParagraph(); _closeSection(); _closePageSpan(); *************** *** 197,206 **** { if (m_textBuffer.len()) - { - if (!m_ps->m_isSpanOpened) - _openSpan(); m_listenerImpl->insertText(m_textBuffer); ! m_textBuffer.clear(); ! } } --- 198,203 ---- { if (m_textBuffer.len()) m_listenerImpl->insertText(m_textBuffer); ! m_textBuffer.clear(); } Index: WPXHLListener.cpp =================================================================== RCS file: /cvsroot/libwpd/libwpd2/src/lib/WPXHLListener.cpp,v retrieving revision 1.61.2.7 retrieving revision 1.61.2.8 diff -C2 -d -r1.61.2.7 -r1.61.2.8 *** WPXHLListener.cpp 2 Aug 2005 19:59:36 -0000 1.61.2.7 --- WPXHLListener.cpp 8 Aug 2005 15:45:36 -0000 1.61.2.8 *************** *** 77,80 **** --- 77,81 ---- m_numColumns(1), m_isTextColumnWithoutParagraph(false), + m_isList(false), m_pageFormLength(11.0f), *************** *** 95,98 **** --- 96,102 ---- m_leftMarginByTabs(0.0f), m_rightMarginByTabs(0.0f), + + m_listReferenceOffsetFromText(0.0f), + m_listReferenceLeftOffset(0.0f), m_paragraphTextIndent(0.0f), *************** *** 136,145 **** void WPXHLListener::startDocument() { ! // FIXME: this is stupid, we should store a property list filled with the relevant metadata ! // and then pass that directly.. ! m_listenerImpl->setDocumentMetaData(m_metaData); ! m_listenerImpl->startDocument(); m_ps->m_isDocumentStarted = true; --- 140,152 ---- void WPXHLListener::startDocument() { ! if (!m_ps->m_isDocumentStarted) ! { ! // FIXME: this is stupid, we should store a property list filled with the relevant metadata ! // and then pass that directly.. ! m_listenerImpl->setDocumentMetaData(m_metaData); ! m_listenerImpl->startDocument(); ! } m_ps->m_isDocumentStarted = true; *************** *** 184,198 **** void WPXHLListener::_closeSection() { - if (m_ps->m_isParagraphOpened) - _closeParagraph(); - if (m_ps->m_isListElementOpened) - _closeListElement(); - _flushList(0); - if (m_ps->m_isSectionOpened) m_listenerImpl->closeSection(); ! m_ps->m_sectionAttributesChanged = false; m_ps->m_isSectionOpened = false; } --- 191,208 ---- void WPXHLListener::_closeSection() { if (m_ps->m_isSectionOpened) + { + if (m_ps->m_isParagraphOpened) + _closeParagraph(); + if (m_ps->m_isListElementOpened) + _closeListElement(); + _flushList(0); + m_listenerImpl->closeSection(); ! m_ps->m_sectionAttributesChanged = false; ! } m_ps->m_isSectionOpened = false; + } *************** *** 305,319 **** void WPXHLListener::_closePageSpan() { - if (m_ps->m_isSectionOpened) - _closeSection(); - if (m_ps->m_isPageSpanOpened) m_listenerImpl->closePageSpan(); m_ps->m_isPageSpanOpened = false; } void WPXHLListener::_openParagraph() { if (!m_ps->m_isParagraphOpened && !m_ps->m_isListElementOpened) { --- 315,335 ---- void WPXHLListener::_closePageSpan() { if (m_ps->m_isPageSpanOpened) + { + if (m_ps->m_isSectionOpened) + _closeSection(); + m_listenerImpl->closePageSpan(); + } m_ps->m_isPageSpanOpened = false; + m_ps->m_isPageSpanBreakDeferred = false; } void WPXHLListener::_openParagraph() { + if (m_ps->m_isTableOpened && !m_ps->m_isTableCellOpened) + return; + if (!m_ps->m_isParagraphOpened && !m_ps->m_isListElementOpened) { *************** *** 359,363 **** m_ps->m_rightMarginByTabs = 0.0f; m_ps->m_paragraphTextIndent = m_ps->m_textIndentByParagraphIndentChange; ! m_ps->m_textIndentByTabs = 0.0f; m_ps->m_isCellWithoutParagraph = false; m_ps->m_isTextColumnWithoutParagraph = false; --- 375,380 ---- m_ps->m_rightMarginByTabs = 0.0f; m_ps->m_paragraphTextIndent = m_ps->m_textIndentByParagraphIndentChange; ! m_ps->m_textIndentByTabs = 0.0f; ! m_ps->m_listReferenceOffsetFromText = 0.0f; m_ps->m_isCellWithoutParagraph = false; m_ps->m_isTextColumnWithoutParagraph = false; *************** *** 389,393 **** } ! void WPXHLListener::_appendParagraphProperties(WPXPropertyList &propList) { int justification; --- 406,410 ---- } ! void WPXHLListener::_appendParagraphProperties(WPXPropertyList &propList, const bool isListElement) { int justification; *************** *** 398,408 **** _appendJustification(propList, justification); ! if (m_ps->m_numColumns == 1 && !m_ps->m_isTableOpened) { // these properties are not appropriate inside multiple columns or when ! // a table is opened.. ! propList.insert("fo:margin-left", m_ps->m_paragraphMarginLeft); propList.insert("fo:margin-right", m_ps->m_paragraphMarginRight); - propList.insert("fo:text-indent", m_ps->m_paragraphTextIndent); } propList.insert("fo:margin-top", m_ps->m_paragraphMarginTop); --- 415,433 ---- _appendJustification(propList, justification); ! if (m_ps->m_numColumns <= 1 && !m_ps->m_isTableOpened) { // these properties are not appropriate inside multiple columns or when ! // a table is opened.. ! if (isListElement) ! { ! propList.insert("fo:margin-left", (m_ps->m_listReferenceLeftOffset - m_ps->m_paragraphTextIndent)); ! propList.insert("fo:text-indent", m_ps->m_paragraphTextIndent); ! } ! else ! { ! propList.insert("fo:margin-left", m_ps->m_paragraphMarginLeft); ! propList.insert("fo:text-indent", m_ps->m_paragraphTextIndent - m_ps->m_listReferenceOffsetFromText); ! } propList.insert("fo:margin-right", m_ps->m_paragraphMarginRight); } propList.insert("fo:margin-top", m_ps->m_paragraphMarginTop); *************** *** 464,471 **** void WPXHLListener::_closeParagraph() { - if (m_ps->m_isSpanOpened) - _closeSpan(); if (m_ps->m_isParagraphOpened) m_listenerImpl->closeParagraph(); m_ps->m_isParagraphOpened = false; --- 489,499 ---- void WPXHLListener::_closeParagraph() { if (m_ps->m_isParagraphOpened) + { + if (m_ps->m_isSpanOpened) + _closeSpan(); + m_listenerImpl->closeParagraph(); + } m_ps->m_isParagraphOpened = false; *************** *** 481,485 **** WPXPropertyList propList; ! _appendParagraphProperties(propList); WPXPropertyListVector tabStops; --- 509,513 ---- WPXPropertyList propList; ! _appendParagraphProperties(propList, true); WPXPropertyListVector tabStops; *************** *** 494,502 **** void WPXHLListener::_closeListElement() { - if (m_ps->m_isSpanOpened) - _closeSpan(); if (m_ps->m_isListElementOpened) ! m_listenerImpl->closeListElement(); m_ps->m_isListElementOpened = false; m_ps->m_currentListLevel = 0; --- 522,533 ---- void WPXHLListener::_closeListElement() { if (m_ps->m_isListElementOpened) ! { ! if (m_ps->m_isSpanOpened) ! _closeSpan(); + m_listenerImpl->closeListElement(); + } + m_ps->m_isListElementOpened = false; m_ps->m_currentListLevel = 0; *************** *** 507,510 **** --- 538,544 ---- void WPXHLListener::_openSpan() { + if (m_ps->m_isTableOpened && !m_ps->m_isTableCellOpened) + return; + if (!m_ps->m_isParagraphOpened && !m_ps->m_isListElementOpened) _flushList(m_ps->m_currentListLevel); *************** *** 598,605 **** void WPXHLListener::_closeSpan() { - _flushText(); if (m_ps->m_isSpanOpened) ! m_listenerImpl->closeSpan(); m_ps->m_isSpanOpened = false; } --- 632,642 ---- void WPXHLListener::_closeSpan() { if (m_ps->m_isSpanOpened) ! { ! _flushText(); + m_listenerImpl->closeSpan(); + } + m_ps->m_isSpanOpened = false; } *************** *** 608,612 **** { _closeTable(); ! WPXPropertyList propList; switch (m_ps->m_tableDefinition.m_positionBits) --- 645,649 ---- { _closeTable(); ! WPXPropertyList propList; switch (m_ps->m_tableDefinition.m_positionBits) *************** *** 667,678 **** void WPXHLListener::_closeTable() { - _closeTableRow(); - if (m_ps->m_isTableOpened) { m_listenerImpl->closeTable(); - m_ps->m_currentTableRow = (-1); - m_ps->m_currentTableCol = (-1); } m_ps->m_isTableOpened = false; m_ps->m_wasHeaderRow = false; --- 704,717 ---- void WPXHLListener::_closeTable() { if (m_ps->m_isTableOpened) { + if (m_ps->m_isTableRowOpened) + _closeTableRow(); + m_listenerImpl->closeTable(); } + + m_ps->m_currentTableRow = (-1); + m_ps->m_currentTableCol = (-1); m_ps->m_isTableOpened = false; m_ps->m_wasHeaderRow = false; *************** *** 682,691 **** _flushList(0); // handle case where page span is closed in the middle of a table if (m_ps->m_isPageSpanBreakDeferred && !m_ps->m_inSubDocument) ! { ! _closePageSpan(); ! m_ps->m_isPageSpanBreakDeferred = false; ! } } --- 721,731 ---- _flushList(0); + // handle case where a section attributes changed in the middle of the table + if (m_ps->m_sectionAttributesChanged && !m_ps->m_inSubDocument) + _closeSection(); + // handle case where page span is closed in the middle of a table if (m_ps->m_isPageSpanBreakDeferred && !m_ps->m_inSubDocument) ! _closePageSpan(); } *************** *** 693,696 **** --- 733,737 ---- { _closeTableRow(); + m_ps->m_currentTableCol = 0; *************** *** 719,726 **** void WPXHLListener::_closeTableRow() { - _closeTableCell(); - if (m_ps->m_isTableRowOpened) m_listenerImpl->closeTableRow(); m_ps->m_isTableRowOpened = false; } --- 760,769 ---- void WPXHLListener::_closeTableRow() { if (m_ps->m_isTableRowOpened) + { + if (m_ps->m_isTableCellOpened) + _closeTableCell(); m_listenerImpl->closeTableRow(); + } m_ps->m_isTableRowOpened = false; } *************** *** 804,816 **** void WPXHLListener::_closeTableCell() { - if (m_ps->m_isCellWithoutParagraph) - _openSpan(); - _closeParagraph(); - _closeListElement(); - _flushList(0); - m_ps->m_cellAttributeBits = 0x00000000; if (m_ps->m_isTableCellOpened) ! m_listenerImpl->closeTableCell(); m_ps->m_isTableCellOpened = false; } --- 847,861 ---- void WPXHLListener::_closeTableCell() { if (m_ps->m_isTableCellOpened) ! { ! if (m_ps->m_isCellWithoutParagraph) ! _openSpan(); ! _closeParagraph(); ! _closeListElement(); ! _flushList(0); ! m_ps->m_cellAttributeBits = 0x00000000; + m_listenerImpl->closeTableCell(); + } m_ps->m_isTableCellOpened = false; } *************** *** 849,853 **** if (!isUndoOn()) { - _flushText(); switch (breakType) { --- 894,897 ---- Index: WP6HLContentListener.h =================================================================== RCS file: /cvsroot/libwpd/libwpd2/src/lib/WP6HLContentListener.h,v retrieving revision 1.44.2.3 retrieving revision 1.44.2.4 diff -C2 -d -r1.44.2.3 -r1.44.2.4 *** WP6HLContentListener.h 2 Aug 2005 19:59:36 -0000 1.44.2.3 --- WP6HLContentListener.h 8 Aug 2005 15:45:34 -0000 1.44.2.4 *************** *** 47,50 **** --- 47,52 ---- BEGIN_AFTER_NUMBERING, STYLE_BODY, STYLE_END }; + enum WP6ListType { ORDERED, UNORDERED }; + const int STATE_MEMORY = 3; class WP6StyleStateSequence *************** *** 79,82 **** --- 81,86 ---- int m_numRemovedParagraphBreaks; + + int m_numListExtraTabs; WPXTableList m_tableList; *************** *** 85,88 **** --- 89,93 ---- std::stack<int> m_listLevelStack; + std::stack<WP6ListType> m_listTypeStack; uint16_t m_currentOutlineHash; // probably should replace Hash with Key in these sorts of cases uint8_t m_oldListLevel; *************** *** 195,199 **** WP6ParsingState *m_parseState; ! std::map<int,WP6OutlineDefinition *> m_outlineDefineHash; }; --- 200,204 ---- WP6ParsingState *m_parseState; ! std::map<uint16_t,WP6OutlineDefinition *> m_outlineDefineHash; }; Index: WP42HLListener.cpp =================================================================== RCS file: /cvsroot/libwpd/libwpd2/src/lib/WP42HLListener.cpp,v retrieving revision 1.28.2.2 retrieving revision 1.28.2.3 diff -C2 -d -r1.28.2.2 -r1.28.2.3 *** WP42HLListener.cpp 30 Jul 2005 13:08:34 -0000 1.28.2.2 --- WP42HLListener.cpp 8 Aug 2005 15:45:33 -0000 1.28.2.3 *************** *** 51,57 **** if (!isUndoOn()) { - _flushText(); if (!m_ps->m_isSpanOpened) _openSpan(); m_listenerImpl->insertTab(); } --- 51,59 ---- if (!isUndoOn()) { if (!m_ps->m_isSpanOpened) _openSpan(); + else + _flushText(); + m_listenerImpl->insertTab(); } *************** *** 62,69 **** if (!isUndoOn()) { ! if (!m_ps->m_isSpanOpened && !m_ps->m_isParagraphOpened && !m_ps->m_isListElementOpened) _openSpan(); - else - _flushText(); if (m_ps->m_isParagraphOpened) _closeParagraph(); --- 64,69 ---- if (!isUndoOn()) { ! if (!m_ps->m_isParagraphOpened && !m_ps->m_isListElementOpened) _openSpan(); if (m_ps->m_isParagraphOpened) _closeParagraph(); *************** *** 75,79 **** void WP42HLListener::endDocument() { ! _flushText(); _closeSection(); _closePageSpan(); --- 75,80 ---- void WP42HLListener::endDocument() { ! _closeSpan(); ! _closeParagraph(); _closeSection(); _closePageSpan(); *************** *** 140,148 **** { if (m_textBuffer.len()) - { - if (!m_ps->m_isSpanOpened) - _openSpan(); m_listenerImpl->insertText(m_textBuffer); ! m_textBuffer.clear(); ! } } --- 141,145 ---- { if (m_textBuffer.len()) m_listenerImpl->insertText(m_textBuffer); ! m_textBuffer.clear(); } Index: WPXHLListener.h =================================================================== RCS file: /cvsroot/libwpd/libwpd2/src/lib/WPXHLListener.h,v retrieving revision 1.61.2.4 retrieving revision 1.61.2.5 diff -C2 -d -r1.61.2.4 -r1.61.2.5 *** WPXHLListener.h 2 Aug 2005 19:59:36 -0000 1.61.2.4 --- WPXHLListener.h 8 Aug 2005 15:45:37 -0000 1.61.2.5 *************** *** 102,105 **** --- 102,106 ---- bool m_wasHeaderRow; bool m_isCellWithoutParagraph; + bool m_isList; uint32_t m_cellAttributeBits; uint8_t m_paragraphJustificationBeforeTable; *************** *** 130,136 **** float m_rightMarginByTabs; // only part of the margin that is reset at the end of a paragraph float m_paragraphTextIndent; // resulting first line indent that is one of the paragraph properties float m_textIndentByParagraphIndentChange; // part of the indent due to the PARAGRAPH indent (WP6???) ! float m_textIndentByTabs; // part of the indent due to the "Back Tab" uint8_t m_currentListLevel; --- 131,141 ---- float m_rightMarginByTabs; // only part of the margin that is reset at the end of a paragraph + float m_listReferenceOffsetFromText; // distance between the list number/bullet and the beginning of the text + // at first line + float m_listReferenceLeftOffset; // position from the page left margin of the list number/bullet + float m_paragraphTextIndent; // resulting first line indent that is one of the paragraph properties float m_textIndentByParagraphIndentChange; // part of the indent due to the PARAGRAPH indent (WP6???) ! float m_textIndentByTabs; // part of the indent due to the "Back Tab" or "Left Tab" uint8_t m_currentListLevel; *************** *** 184,188 **** void _closePageSpan(); ! void _appendParagraphProperties(WPXPropertyList &propList); void _getTabStops(WPXPropertyListVector &tabStops); void _appendJustification(WPXPropertyList &propList, int justification); --- 189,193 ---- void _closePageSpan(); ! void _appendParagraphProperties(WPXPropertyList &propList, const bool isListElement=false); void _getTabStops(WPXPropertyListVector &tabStops); void _appendJustification(WPXPropertyList &propList, int justification); Index: WP6HLContentListener.cpp =================================================================== RCS file: /cvsroot/libwpd/libwpd2/src/lib/WP6HLContentListener.cpp,v retrieving revision 1.78.2.10 retrieving revision 1.78.2.11 diff -C2 -d -r1.78.2.10 -r1.78.2.11 *** WP6HLContentListener.cpp 2 Aug 2005 19:59:35 -0000 1.78.2.10 --- WP6HLContentListener.cpp 8 Aug 2005 15:45:33 -0000 1.78.2.11 *************** *** 221,224 **** --- 221,226 ---- m_numRemovedParagraphBreaks(0), + + m_numListExtraTabs(0), m_tableList(tableList), *************** *** 250,254 **** WP6HLContentListener::~WP6HLContentListener() { ! typedef std::map<int, WP6OutlineDefinition *>::iterator Iter; for (Iter outline = m_outlineDefineHash.begin(); outline != m_outlineDefineHash.end(); outline++) { --- 252,256 ---- WP6HLContentListener::~WP6HLContentListener() { ! typedef std::map<uint16_t, WP6OutlineDefinition *>::iterator Iter; for (Iter outline = m_outlineDefineHash.begin(); outline != m_outlineDefineHash.end(); outline++) { *************** *** 329,336 **** --- 331,340 ---- if (!m_ps->m_isSpanOpened) _openSpan(); + m_ps->m_isList = false; appendUCS4(m_parseState->m_bodyText, (uint32_t)character); } else if (m_parseState->m_styleStateSequence.getCurrentState() == BEGIN_BEFORE_NUMBERING) { + m_ps->m_isList = true; appendUCS4(m_parseState->m_textBeforeNumber, (uint32_t)character); } *************** *** 339,342 **** --- 343,347 ---- // left delimeter (or the bullet if there is no display referencing) appendUCS4(m_parseState->m_textBeforeDisplayReference, (uint32_t)character); + m_ps->m_isList = true; } else if (m_parseState->m_styleStateSequence.getCurrentState() == DISPLAY_REFERENCING) *************** *** 344,347 **** --- 349,353 ---- // the actual paragraph number (in varying forms) appendUCS4(m_parseState->m_numberText, (uint32_t)character); + m_ps->m_isList = true; } else if (m_parseState->m_styleStateSequence.getCurrentState() == BEGIN_NUMBERING_AFTER_DISPLAY_REFERENCING) *************** *** 349,356 **** --- 355,364 ---- // right delimeter (if there was a display no. ref. group) appendUCS4(m_parseState->m_textAfterDisplayReference, (uint32_t)character); + m_ps->m_isList = true; } else if (m_parseState->m_styleStateSequence.getCurrentState() == BEGIN_AFTER_NUMBERING) { appendUCS4(m_parseState->m_textAfterNumber, (uint32_t)character); + m_ps->m_isList = true; } } *************** *** 378,390 **** if (!isUndoOn()) { ! if (m_parseState->m_styleStateSequence.getCurrentState() == STYLE_BODY || ! m_parseState->m_styleStateSequence.getCurrentState() == NORMAL) { - _flushText(); - // First of all, open paragraph for tabs that always are converted as tabs switch ((tabType & 0xF8) >> 3) { case WP6_TAB_GROUP_TABLE_TAB: - // case WP6_TAB_GROUP_LEFT_TAB: case WP6_TAB_GROUP_BAR_TAB: // Uncomment when the TabGroup is properly implemented --- 386,396 ---- if (!isUndoOn()) { ! // First of all, open paragraph for tabs that always are converted as tabs ! if ((m_parseState->m_styleStateSequence.getCurrentState() == STYLE_BODY) || ! (m_parseState->m_styleStateSequence.getCurrentState() == NORMAL)) { switch ((tabType & 0xF8) >> 3) { case WP6_TAB_GROUP_TABLE_TAB: case WP6_TAB_GROUP_BAR_TAB: // Uncomment when the TabGroup is properly implemented *************** *** 401,506 **** _openListElement(); break; ! default: break; } ! ! // Following tabs are converted as formating if the paragraph is not opened ! if (!m_ps->m_isParagraphOpened && !m_ps->m_isListElementOpened) { ! switch ((tabType & 0xF8) >> 3) ! { ! // Begin of code to be removed when the TabGroup is properly implemented ! case WP6_TAB_GROUP_CENTER_ON_MARGINS: ! case WP6_TAB_GROUP_CENTER_ON_CURRENT_POSITION: ! m_ps->m_tempParagraphJustification = WP6_PARAGRAPH_JUSTIFICATION_CENTER; ! break; ! case WP6_TAB_GROUP_FLUSH_RIGHT: ! m_ps->m_tempParagraphJustification = WP6_PARAGRAPH_JUSTIFICATION_RIGHT; ! break; ! // End of code to be removed when the TabGroup is properly implemented ! case WP6_TAB_GROUP_LEFT_TAB: // converted as first line indent ! if (tabPosition >= (float)((double)0xFFFE/(double)WPX_NUM_WPUS_PER_INCH)) ! // fall-back solution if we are not able to read the tabPosition ! m_ps->m_textIndentByTabs += 0.5f; ! else ! m_ps->m_textIndentByTabs = tabPosition - m_ps->m_paragraphMarginLeft ! - m_ps->m_pageMarginLeft - m_ps->m_textIndentByParagraphIndentChange; ! break; ! case WP6_TAB_GROUP_BACK_TAB: // converted as hanging indent ! if (tabPosition >= (float)((double)0xFFFE/(double)WPX_NUM_WPUS_PER_INCH)) ! // fall-back solution if we are not able to read the tabPosition ! m_ps->m_textIndentByTabs -= 0.5f; ! else ! m_ps->m_textIndentByTabs = tabPosition - m_ps->m_paragraphMarginLeft ! - m_ps->m_pageMarginLeft - m_ps->m_textIndentByParagraphIndentChange; ! break; ! case WP6_TAB_GROUP_LEFT_INDENT: // converted as left paragraph margin offset ! if (tabPosition >= (float)((double)0xFFFE/(double)WPX_NUM_WPUS_PER_INCH)) ! // fall-back solution if we are not able to read the tabPosition ! m_ps->m_leftMarginByTabs += 0.5f; ! else ! m_ps->m_leftMarginByTabs = tabPosition - m_ps->m_pageMarginLeft ! - m_ps->m_leftMarginByPageMarginChange - m_ps->m_leftMarginByParagraphMarginChange; ! if (m_ps->m_paragraphTextIndent != 0.0f) ! m_ps->m_textIndentByTabs -= m_ps->m_paragraphTextIndent; ! break; ! case WP6_TAB_GROUP_LEFT_RIGHT_INDENT: // converted as left and right paragraph margin offset ! if (tabPosition >= (float)((double)0xFFFE/(double)WPX_NUM_WPUS_PER_INCH)) ! // fall-back solution if we are not able to read the tabPosition ! m_ps->m_leftMarginByTabs += 0.5f; ! else ! m_ps->m_leftMarginByTabs = tabPosition - m_ps->m_pageMarginLeft ! - m_ps->m_leftMarginByPageMarginChange - m_ps->m_leftMarginByParagraphMarginChange; ! // L/R Indent is symetrical from the effective paragraph margins and position indicates only ! // the distance from the left edge ! m_ps->m_rightMarginByTabs = m_ps->m_leftMarginByTabs; ! if (m_ps->m_paragraphTextIndent != 0.0f) ! m_ps->m_textIndentByTabs -= m_ps->m_paragraphTextIndent; ! break; ! default: ! break; ! } ! m_ps->m_paragraphTextIndent = m_ps->m_textIndentByParagraphIndentChange ! + m_ps->m_textIndentByTabs; ! m_ps->m_paragraphMarginLeft = m_ps->m_leftMarginByPageMarginChange ! + m_ps->m_leftMarginByParagraphMarginChange + m_ps->m_leftMarginByTabs; ! m_ps->m_paragraphMarginRight = m_ps->m_rightMarginByPageMarginChange ! + m_ps->m_rightMarginByParagraphMarginChange + m_ps->m_rightMarginByTabs; ! } else ! { ! if (!m_ps->m_isSpanOpened) ! _openSpan(); ! switch ((tabType & 0xF8) >> 3) ! { ! case WP6_TAB_GROUP_TABLE_TAB: ! case WP6_TAB_GROUP_LEFT_TAB: ! case WP6_TAB_GROUP_LEFT_INDENT: ! case WP6_TAB_GROUP_LEFT_RIGHT_INDENT: ! case WP6_TAB_GROUP_CENTER_ON_MARGINS: ! case WP6_TAB_GROUP_CENTER_ON_CURRENT_POSITION: ! case WP6_TAB_GROUP_CENTER_TAB: ! case WP6_TAB_GROUP_FLUSH_RIGHT: ! case WP6_TAB_GROUP_RIGHT_TAB: ! case WP6_TAB_GROUP_DECIMAL_TAB: ! m_listenerImpl->insertTab(); ! break; ! case WP6_TAB_GROUP_BAR_TAB: ! m_listenerImpl->insertTab(); ! insertCharacter('|'); // We emulate the bar tab ! break; ! ! default: ! break; ! } } } --- 407,529 ---- _openListElement(); break; ! default: break; } ! } ! ! // Following tabs are converted as formating if the paragraph is not opened ! if (!m_ps->m_isParagraphOpened && !m_ps->m_isListElementOpened) ! { ! switch ((tabType & 0xF8) >> 3) { ! // Begin of code to be removed when the TabGroup is properly implemented ! case WP6_TAB_GROUP_CENTER_ON_MARGINS: ! case WP6_TAB_GROUP_CENTER_ON_CURRENT_POSITION: ! m_ps->m_tempParagraphJustification = WP6_PARAGRAPH_JUSTIFICATION_CENTER; ! break; ! case WP6_TAB_GROUP_FLUSH_RIGHT: ! m_ps->m_tempParagraphJustification = WP6_PARAGRAPH_JUSTIFICATION_RIGHT; ! break; ! // End of code to be removed when the TabGroup is properly implemented ! case WP6_TAB_GROUP_LEFT_TAB: // converted as first line indent ! if (tabPosition >= (float)((double)0xFFFE/(double)WPX_NUM_WPUS_PER_INCH)) ! // fall-back solution if we are not able to read the tabPosition ! m_ps->m_textIndentByTabs += 0.5f; ! else ! m_ps->m_textIndentByTabs = tabPosition - m_ps->m_paragraphMarginLeft ! - m_ps->m_pageMarginLeft - m_ps->m_textIndentByParagraphIndentChange; ! if (m_ps->m_isList) ! m_parseState->m_numListExtraTabs++; ! break; ! case WP6_TAB_GROUP_BACK_TAB: // converted as hanging indent ! if (tabPosition >= (float)((double)0xFFFE/(double)WPX_NUM_WPUS_PER_INCH)) ! // fall-back solution if we are not able to read the tabPosition ! m_ps->m_textIndentByTabs -= 0.5f; ! else ! m_ps->m_textIndentByTabs = tabPosition - m_ps->m_paragraphMarginLeft ! - m_ps->m_pageMarginLeft - m_ps->m_textIndentByParagraphIndentChange; ! if (m_ps->m_isList) ! m_ps->m_listReferenceOffsetFromText -= m_ps->m_textIndentByTabs; ! break; ! case WP6_TAB_GROUP_LEFT_INDENT: // converted as left paragraph margin offset ! if (tabPosition >= (float)((double)0xFFFE/(double)WPX_NUM_WPUS_PER_INCH)) ! // fall-back solution if we are not able to read the tabPosition ! m_ps->m_leftMarginByTabs += 0.5f; ! else ! m_ps->m_leftMarginByTabs = tabPosition - m_ps->m_pageMarginLeft ! - m_ps->m_leftMarginByPageMarginChange - m_ps->m_leftMarginByParagraphMarginChange; ! if (m_ps->m_isList) ! m_parseState->m_numListExtraTabs++; ! if (m_ps->m_paragraphTextIndent != 0.0f) ! m_ps->m_textIndentByTabs += m_ps->m_paragraphTextIndent; ! break; ! case WP6_TAB_GROUP_LEFT_RIGHT_INDENT: // converted as left and right paragraph margin offset ! if (tabPosition >= (float)((double)0xFFFE/(double)WPX_NUM_WPUS_PER_INCH)) ! // fall-back solution if we are not able to read the tabPosition ! m_ps->m_leftMarginByTabs += 0.5f; ! else ! m_ps->m_leftMarginByTabs = tabPosition - m_ps->m_pageMarginLeft ! - m_ps->m_leftMarginByPageMarginChange - m_ps->m_leftMarginByParagraphMarginChange; ! if (m_ps->m_isList) ! m_parseState->m_numListExtraTabs++; ! // L/R Indent is symetrical from the effective paragraph margins and position indicates only ! // the distance from the left edge ! m_ps->m_rightMarginByTabs = m_ps->m_leftMarginByTabs; ! if (m_ps->m_paragraphTextIndent != 0.0f) ! m_ps->m_textIndentByTabs -= m_ps->m_paragraphTextIndent; ! break; ! default: ! break; } + m_ps->m_paragraphTextIndent = m_ps->m_textIndentByParagraphIndentChange + + m_ps->m_textIndentByTabs; + m_ps->m_paragraphMarginLeft = m_ps->m_leftMarginByPageMarginChange + + m_ps->m_leftMarginByParagraphMarginChange + m_ps->m_leftMarginByTabs; + m_ps->m_paragraphMarginRight = m_ps->m_rightMarginByPageMarginChange + + m_ps->m_rightMarginByParagraphMarginChange + m_ps->m_rightMarginByTabs; + + if (!m_ps->m_isList) + m_ps->m_listReferenceLeftOffset = m_ps->m_paragraphMarginLeft + m_ps->m_paragraphTextIndent; + m_ps->m_listReferenceOffsetFromText = m_ps->m_paragraphMarginLeft + m_ps->m_paragraphTextIndent - m_ps->m_listReferenceLeftOffset; + + } + else if ((m_parseState->m_styleStateSequence.getCurrentState() == STYLE_BODY) || + (m_parseState->m_styleStateSequence.getCurrentState() == NORMAL)) + { + m_ps->m_isList = false; + + if (!m_ps->m_isSpanOpened) + _openSpan(); else ! _flushText(); ! switch ((tabType & 0xF8) >> 3) ! { ! case WP6_TAB_GROUP_TABLE_TAB: ! case WP6_TAB_GROUP_LEFT_TAB: ! case WP6_TAB_GROUP_LEFT_INDENT: ! case WP6_TAB_GROUP_LEFT_RIGHT_INDENT: ! case WP6_TAB_GROUP_CENTER_ON_MARGINS: ! case WP6_TAB_GROUP_CENTER_ON_CURRENT_POSITION: ! case WP6_TAB_GROUP_CENTER_TAB: ! case WP6_TAB_GROUP_FLUSH_RIGHT: ! case WP6_TAB_GROUP_RIGHT_TAB: ! case WP6_TAB_GROUP_DECIMAL_TAB: ! m_listenerImpl->insertTab(); ! break; ! case WP6_TAB_GROUP_BAR_TAB: ! m_listenerImpl->insertTab(); ! insertCharacter('|'); // We emulate the bar tab ! break; ! ! default: ! break; } } *************** *** 512,527 **** if(!isUndoOn()) { - _flushText(); - if (m_parseState->m_styleStateSequence.getCurrentState() == STYLE_BODY || m_parseState->m_styleStateSequence.getCurrentState() == NORMAL) { ! if (!m_ps->m_isParagraphOpened && !m_ps->m_isListElementOpened) ! if (m_ps->m_currentListLevel == 0) ! _openParagraph(); ! else ! _openListElement(); if (!m_ps->m_isSpanOpened) _openSpan(); m_listenerImpl->insertLineBreak(); } --- 535,548 ---- if(!isUndoOn()) { if (m_parseState->m_styleStateSequence.getCurrentState() == STYLE_BODY || m_parseState->m_styleStateSequence.getCurrentState() == NORMAL) { ! m_ps->m_isList = false; ! if (!m_ps->m_isSpanOpened) _openSpan(); + else + _flushText(); + m_listenerImpl->insertLineBreak(); } *************** *** 533,540 **** if (!isUndoOn()) { ! if (!m_ps->m_isSpanOpened && !m_ps->m_isParagraphOpened && !m_ps->m_isListElementOpened) _openSpan(); - else - _flushText(); if (m_ps->m_isParagraphOpened) _closeParagraph(); --- 554,559 ---- if (!isUndoOn()) { ! if (!m_ps->m_isParagraphOpened && !m_ps->m_isListElementOpened) _openSpan(); if (m_ps->m_isParagraphOpened) _closeParagraph(); *************** *** 711,714 **** --- 730,736 ---- } + if (!m_ps->m_isList) + m_ps->m_listReferenceLeftOffset = m_ps->m_paragraphMarginLeft + m_ps->m_paragraphTextIndent; + m_ps->m_listReferenceOffsetFromText = m_ps->m_paragraphMarginLeft + m_ps->m_paragraphTextIndent - m_ps->m_listReferenceLeftOffset; } } *************** *** 740,743 **** --- 762,769 ---- break; } + + if (!m_ps->m_isList) + m_ps->m_listReferenceLeftOffset = m_ps->m_paragraphMarginLeft + m_ps->m_paragraphTextIndent; + m_ps->m_listReferenceOffsetFromText = m_ps->m_paragraphMarginLeft + m_ps->m_paragraphTextIndent - m_ps->m_listReferenceLeftOffset; } } *************** *** 767,771 **** m_ps->m_isTextColumnWithoutParagraph = false; - _flushText(); float remainingSpace = m_ps->m_pageFormWidth - m_ps->m_pageMarginLeft - m_ps->m_pageMarginRight - m_ps->m_leftMarginByPageMarginChange - m_ps->m_rightMarginByPageMarginChange; --- 793,796 ---- *************** *** 850,853 **** --- 875,883 ---- if (!isUndoOn()) { + // Hack: since there can be a paragraph number without para style begin/end on/off functions + // this is the only way how to assure that in this case we enter into "NORMAL" state and + // do not loose text. In the "BEGIN_AFTER_NUMBERING" state are normally only tabs determining + // the position of the text after the number; we are thus compensating this hack with a complicated + // logic in handling tabs. Note done by Fridrich on August 8, 2005 :-) // m_parseState->m_styleStateSequence.setCurrentState(BEGIN_AFTER_NUMBERING); m_parseState->m_styleStateSequence.setCurrentState(NORMAL); *************** *** 942,946 **** WPD_DEBUG_MSG(("WordPerfect: Handling a para style end (ON)\n")); m_parseState->m_styleStateSequence.setCurrentState(STYLE_END); - _flushText(); // flush the item (list or otherwise) text break; } --- 972,975 ---- *************** *** 961,968 **** WPD_DEBUG_MSG(("WordPerfect: Handling a para style begin 2 (OFF)\n")); m_parseState->m_styleStateSequence.setCurrentState(STYLE_BODY); - if (m_parseState->m_putativeListElementHasParagraphNumber) - _handleListChange(m_parseState->m_currentOutlineHash); - else - _flushText(); break; case WP6_STYLE_GROUP_PARASTYLE_END_OFF: --- 990,993 ---- *************** *** 996,1000 **** if (!isUndoOn()) { ! _flushText(); m_parseState->m_styleStateSequence.setCurrentState(DOCUMENT_NOTE); // save a reference to the text PID, we want to parse --- 1021,1025 ---- if (!isUndoOn()) { ! _closeSpan(); m_parseState->m_styleStateSequence.setCurrentState(DOCUMENT_NOTE); // save a reference to the text PID, we want to parse *************** *** 1033,1043 **** void WP6HLContentListener::endDocument() { ! _flushText(); ! // corner case: document ends in a list element ! if (m_parseState->m_styleStateSequence.getCurrentState() != NORMAL) ! { ! m_parseState->m_styleStateSequence.setCurrentState(NORMAL); ! _flushList(0); // flush the list exterior ! } // close the document nice and tight --- 1058,1066 ---- void WP6HLContentListener::endDocument() { ! if (m_ps->m_isParagraphOpened) ! _closeParagraph(); ! if (m_ps->m_isListElementOpened) ! _closeListElement(); ! _flushList(0); // flush the list exterior // close the document nice and tight *************** *** 1184,1188 **** else _openSpan(); ! _flushText(); _closeSection(); --- 1207,1217 ---- else _openSpan(); ! ! // Close the sub-document properly ! if (m_ps->m_isParagraphOpened) ! _closeParagraph(); ! if (m_ps->m_isListElementOpened) ! _closeListElement(); ! _flushList(0); _closeSection(); *************** *** 1206,1236 **** void WP6HLContentListener::_flushText() { ! if (m_parseState->m_bodyText.len() || (m_parseState->m_textBeforeNumber.len() && ! !m_parseState->m_putativeListElementHasParagraphNumber)) { ! if (!m_ps->m_isParagraphOpened && !m_ps->m_isListElementOpened) ! { ! if (m_ps->m_currentListLevel == 0) ! _openParagraph(); ! else ! _openListElement(); ! } ! if (m_parseState->m_textBeforeNumber.len() && ! !m_parseState->m_putativeListElementHasParagraphNumber) ! { ! if (!m_ps->m_isSpanOpened) ! _openSpan(); ! m_listenerImpl->insertText(m_parseState->m_textBeforeNumber); ! m_parseState->m_textBeforeNumber.clear(); ! } ! if (m_parseState->m_bodyText.len()) ! { ! if (!m_ps->m_isSpanOpened) ! _openSpan(); ! m_listenerImpl->insertText(m_parseState->m_bodyText); ! m_parseState->m_bodyText.clear(); ! } } } --- 1235,1295 ---- void WP6HLContentListener::_flushText() { ! if (m_ps->m_isListElementOpened) { ! m_parseState->m_textBeforeNumber.clear(); ! m_parseState->m_textBeforeDisplayReference.clear(); ! m_parseState->m_numberText.clear(); ! m_parseState->m_textAfterDisplayReference.clear(); ! m_parseState->m_textAfterNumber.clear(); ! m_parseState->m_numListExtraTabs = 0; ! } ! ! if (m_parseState->m_textBeforeNumber.len()) ! { ! m_listenerImpl->insertText(m_parseState->m_textBeforeNumber); ! m_parseState->m_textBeforeNumber.clear(); ! } ! ! if (m_parseState->m_textBeforeDisplayReference.len()) ! { ! m_listenerImpl->insertText(m_parseState->m_textBeforeDisplayReference); ! m_parseState->m_textBeforeDisplayReference.clear(); ! } ! ! if (m_parseState->m_numberText.len()) ! { ! m_listenerImpl->insertText(m_parseState->m_numberText); ! m_parseState->m_numberText.clear(); ! } ! ! if (m_parseState->m_textAfterDisplayReference.len()) ! { ! m_listenerImpl->insertText(m_parseState->m_textAfterDisplayReference); ! m_parseState->m_textAfterDisplayReference.clear(); ! } ! ! if (m_parseState->m_textAfterNumber.len()) ! { ! m_listenerImpl->insertText(m_parseState->m_textAfterNumber); ! m_parseState->m_textAfterNumber.clear(); ! } ! ! if (m_parseState->m_numListExtraTabs > 0) ! { ! for (m_parseState->m_numListExtraTabs; m_parseState->m_numListExtraTabs > 0; m_parseState->m_numListExtraTabs--) ! m_listenerImpl->insertTab(); ! m_parseState->m_numListExtraTabs = 0; ! } ! if (m_parseState->m_bodyText.len()) ! { ! m_listenerImpl->insertText(m_parseState->m_bodyText); ! m_parseState->m_bodyText.clear(); } + + + m_ps->m_isList = false; + m_ps->m_listReferenceLeftOffset = m_ps->m_paragraphMarginLeft + m_ps->m_paragraphTextIndent; + m_ps->m_listReferenceOffsetFromText = 0; } *************** *** 1241,1247 **** { if (!m_ps->m_isSectionOpened && !m_ps->m_inSubDocument && !m_ps->m_isTableOpened) ! _openSection(); WP6OutlineDefinition *outlineDefinition; ! if (m_outlineDefineHash.find(outlineHash) == m_outlineDefineHash.end()) { // handle odd case where an outline define hash is not defined prior to being referenced by --- 1300,1306 ---- { if (!m_ps->m_isSectionOpened && !m_ps->m_inSubDocument && !m_ps->m_isTableOpened) ! _openSection(); WP6OutlineDefinition *outlineDefinition; ! if (m_outlineDefineHash.empty() || (m_outlineDefineHash.find(outlineHash) == m_outlineDefineHash.end())) { // handle odd case where an outline define hash is not defined prior to being referenced by *************** *** 1252,1258 **** else outlineDefinition = m_outlineDefineHash.find(outlineHash)->second; ! int oldListLevel; ! (m_parseState->m_listLevelStack.empty()) ? oldListLevel = 0 : oldListLevel = m_parseState->m_listLevelStack.top(); if (m_ps->m_currentListLevel > oldListLevel) --- 1311,1320 ---- else outlineDefinition = m_outlineDefineHash.find(outlineHash)->second; ! int oldListLevel; ! if (m_parseState->m_listLevelStack.empty()) ! oldListLevel = 0; ! else ! oldListLevel = m_parseState->m_listLevelStack.top(); if (m_ps->m_currentListLevel > oldListLevel) *************** *** 1272,1277 **** propList.insert("style:num-suffix", m_parseState->m_textAfterDisplayReference); propList.insert("text:start-value", number); ! propList.insert("text:space-before", (m_ps->m_currentListLevel * WPX_DEFAULT_LIST_INDENT)); ! m_listenerImpl->defineOrderedListLevel(propList); } --- 1334,1339 ---- propList.insert("style:num-suffix", m_parseState->m_textAfterDisplayReference); propList.insert("text:start-value", number); ! propList.insert("text:min-label-width", (m_ps->m_listReferenceOffsetFromText)); ! m_listenerImpl->defineOrderedListLevel(propList); } *************** *** 1279,1287 **** { propList.insert("text:bullet-char", m_parseState->m_textBeforeDisplayReference); ! propList.insert("text:space-before", (m_ps->m_currentListLevel * WPX_DEFAULT_LIST_INDENT)); m_listenerImpl->defineUnorderedListLevel(propList); } ! for (int i=(oldListLevel+1); i<=m_ps->m_currentListLevel; i++) { m_parseState->m_listLevelStack.push(i); WPD_DEBUG_MSG(("Pushed level %i onto the list level stack\n", i)); --- 1341,1352 ---- { propList.insert("text:bullet-char", m_parseState->m_textBeforeDisplayReference); ! propList.insert("text:min-label-width", (m_ps->m_listReferenceOffsetFromText)); ! m_listenerImpl->defineUnorderedListLevel(propList); } ! for (int i=(oldListLevel+1); i<=m_ps->m_currentListLevel; i++) ! { m_parseState->m_listLevelStack.push(i); + WPD_DEBUG_MSG(("Pushed level %i onto the list level stack\n", i)); *************** *** 1290,1304 **** if (m_parseState->m_putativeListElementHasDisplayReferenceNumber) m_listenerImpl->openOrderedListLevel(propList2); else m_listenerImpl->openUnorderedListLevel(propList2); } } else if (m_ps->m_currentListLevel < oldListLevel) { ! while (!m_parseState->m_listLevelStack.empty() && m_parseState->m_listLevelStack.top() > m_ps->m_currentListLevel) { int tempListLevel = m_parseState->m_listLevelStack.top(); m_parseState->m_listLevelStack.pop(); WPD_DEBUG_MSG(("Popped level %i off the list level stack\n", tempListLevel)); --- 1355,1380 ---- if (m_parseState->m_putativeListElementHasDisplayReferenceNumber) + { m_listenerImpl->openOrderedListLevel(propList2); + m_parseState->m_listTypeStack.push(ORDERED); + } else + { m_listenerImpl->openUnorderedListLevel(propList2); + m_parseState->m_listTypeStack.push(UNORDERED); + } } } else if (m_ps->m_currentListLevel < oldListLevel) { ! while (!m_parseState->m_listLevelStack.empty() && !m_parseState->m_listTypeStack.empty() ! && m_parseState->m_listLevelStack.top() > m_ps->m_currentListLevel) { int tempListLevel = m_parseState->m_listLevelStack.top(); m_parseState->m_listLevelStack.pop(); + + WP6ListType tmpListType = m_parseState->m_listTypeStack.top(); + m_parseState->m_listTypeStack.pop(); + WPD_DEBUG_MSG(("Popped level %i off the list level stack\n", tempListLevel)); *************** *** 1308,1312 **** // a priori and I hate writing lame excuses like this, so we might want to // change this at some point ! if (!m_parseState->m_putativeListElementHasDisplayReferenceNumber) m_listenerImpl->closeUnorderedListLevel(); else --- 1384,1388 ---- // a priori and I hate writing lame excuses like this, so we might want to // change this at some point ! if (tmpListType == UNORDERED) m_listenerImpl->closeUnorderedListLevel(); else *************** *** 1315,1318 **** --- 1391,1395 ---- } + #if 0 m_parseState->m_textBeforeNumber.clear(); m_parseState->m_textBeforeDisplayReference.clear(); *************** *** 1320,1328 **** m_parseState->m_textAfterDisplayReference.clear(); m_parseState->m_textAfterNumber.clear(); } void WP6HLContentListener::_flushList(const uint8_t listLevel) { ! _closeListElement(); m_ps->m_currentListLevel = listLevel; _handleListChange(m_parseState->m_currentOutlineHash); --- 1397,1409 ---- m_parseState->m_textAfterDisplayReference.clear(); m_parseState->m_textAfterNumber.clear(); + #endif } void WP6HLContentListener::_flushList(const uint8_t listLevel) { ! if (m_ps->m_isParagraphOpened) ! _closeParagraph(); ! if (m_ps->m_isListElementOpened) ! _closeListElement(); m_ps->m_currentListLevel = listLevel; _handleListChange(m_parseState->m_currentOutlineHash); |