Index: abi/src/wp/impexp/xp/ie_exp_HTML.cpp =================================================================== RCS file: /cvsroot/abi/src/wp/impexp/xp/ie_exp_HTML.cpp,v retrieving revision 1.32 diff -u -r1.32 ie_exp_HTML.cpp --- abi/src/wp/impexp/xp/ie_exp_HTML.cpp 2001/01/12 01:38:26 1.32 +++ abi/src/wp/impexp/xp/ie_exp_HTML.cpp 2001/01/14 09:15:38 @@ -37,6 +37,8 @@ #include "xap_App.h" #include "xap_EncodingManager.h" +#include "ut_debugmsg.h" + /*****************************************************************/ /*****************************************************************/ @@ -91,6 +93,8 @@ #define BT_HEADING3 4 #define BT_BLOCKTEXT 5 #define BT_PLAINTEXT 6 +#define BT_NUMBEREDLIST 7 +#define BT_BULLETLIST 8 class s_HTML_Listener : public PL_Listener { @@ -121,9 +125,9 @@ protected: void _closeSection(void); - void _closeBlock(void); + void _closeTag(void); void _closeSpan(void); - void _openParagraph(PT_AttrPropIndex api); + void _openTag(PT_AttrPropIndex api); void _openSection(PT_AttrPropIndex api); void _openSpan(PT_AttrPropIndex api); void _outputData(const UT_UCSChar * p, UT_uint32 length); @@ -137,11 +141,13 @@ UT_Bool m_bInBlock; UT_Bool m_bInSpan; UT_Bool m_bNextIsSpace; + UT_Bool m_bInList; const PP_AttrProp* m_pAP_Span; // Need to look up proper type, and place to stick #defines... UT_uint16 m_iBlockType; // BT_* + UT_uint16 m_iListDepth; // 0 corresponds to not in a list UT_Wctomb m_wmctomb; }; @@ -157,31 +163,34 @@ return; } -void s_HTML_Listener::_closeBlock(void) +void s_HTML_Listener::_closeTag(void) { if (!m_bInBlock) { return; } - if(m_iBlockType == BT_NORMAL) + if(m_iBlockType == BT_NORMAL) m_pie->write("
\n"); - else if(m_iBlockType == BT_HEADING1) + else if(m_iBlockType == BT_HEADING1) m_pie->write("\n"); - else if(m_iBlockType == BT_HEADING2) + else if(m_iBlockType == BT_HEADING2) m_pie->write("\n"); - else if(m_iBlockType == BT_HEADING3) + else if(m_iBlockType == BT_HEADING3) m_pie->write("\n"); - else if(m_iBlockType == BT_BLOCKTEXT) + else if(m_iBlockType == BT_BLOCKTEXT) m_pie->write("\n"); - else if(m_iBlockType == BT_PLAINTEXT) + else if(m_iBlockType == BT_PLAINTEXT) m_pie->write("\n"); + else if(m_iBlockType == BT_NUMBEREDLIST || m_iBlockType == BT_BULLETLIST) + { /* do nothing, lists are handled differently, as they have multiple tags */ } + // Add "catchall" for now else @@ -191,7 +200,7 @@ return; } -void s_HTML_Listener::_openParagraph(PT_AttrPropIndex api) +void s_HTML_Listener::_openTag(PT_AttrPropIndex api) { if (!m_bInSection) { @@ -205,76 +214,113 @@ if (bHaveProp && pAP) { const XML_Char * szValue; + //const XML_Char * szLevel; + const XML_Char * szListID; - if ( - (pAP->getAttribute((XML_Char*)"style", szValue)) - ) + if ( + (pAP->getAttribute((XML_Char*)"style", szValue)) + ) { - - if(0 == UT_strcmp(szValue, "Heading 1")) - { - - //... - - m_iBlockType = BT_HEADING1; - m_pie->write("
... + m_iBlockType = BT_HEADING1; + m_pie->write("
write("... - } - else if(0 == UT_strcmp(szValue, "Plain Text")) - { - //
... + m_iBlockType = BT_HEADING3; + m_pie->write("
... - m_iBlockType = BT_PLAINTEXT; - m_pie->write("
write("... - //... + m_iBlockType = BT_PLAINTEXT; + m_pie->write("
... m_iBlockType = BT_NORMAL; m_pie->write("write("\n\n"); + else if(m_iBlockType == BT_BULLETLIST) + m_pie->write("\n\n"); + m_bInList = UT_FALSE; + } //
with no style attribute ... - m_iBlockType = BT_NORMAL; - m_pie->write("
write("
write("write("write("; text-decoration: overline"); - textD = UT_TRUE; + textD = UT_TRUE; } else { @@ -839,6 +885,8 @@ m_bInBlock = UT_FALSE; m_bInSpan = UT_FALSE; m_bNextIsSpace = UT_FALSE; + m_bInList = UT_FALSE; + m_iListDepth = 0; m_pie->write("\n"); m_pie->write("\n"); @@ -894,7 +942,7 @@ m_pie->write("\">\n");// looks ugly, but it should work. m_pie->write("
AbiWord Document \n"); m_pie->write("\n"); m_pie->write("\n"); m_pie->write("\n"); @@ -904,7 +952,15 @@ s_HTML_Listener::~s_HTML_Listener() { _closeSpan(); - _closeBlock(); + _closeTag(); + if(m_bInList) + { + m_pie->write("\n"); + if(m_iBlockType == BT_NUMBEREDLIST) + m_pie->write("\n"); + else + m_pie->write("\n"); + } _closeSection(); _handleDataItems(); @@ -981,7 +1037,7 @@ case PTX_Section: { _closeSpan(); - _closeBlock(); + _closeTag(); _closeSection(); PT_AttrPropIndex indexAP = pcr->getIndexAP(); @@ -1014,8 +1070,8 @@ case PTX_Block: { _closeSpan(); - _closeBlock(); - _openParagraph(pcr->getIndexAP()); + _closeTag(); + _openTag(pcr->getIndexAP()); return UT_TRUE; }