Hi all, With this patch, the WordPerfect importer should handle text aligment much better. Look for an example to the trivial 2-lined attached wp document...
Marc
Index: abi/src/wp/impexp/xp/ie_imp_WordPerfect.cpp =================================================================== RCS file: /cvsroot/abi/src/wp/impexp/xp/ie_imp_WordPerfect.cpp,v retrieving revision 1.14 diff -u -r1.14 ie_imp_WordPerfect.cpp --- abi/src/wp/impexp/xp/ie_imp_WordPerfect.cpp 7 Feb 2002 18:15:17 -0000 1.14 +++ abi/src/wp/impexp/xp/ie_imp_WordPerfect.cpp 20 Feb 2002 11:21:59 -0000 @@ -265,8 +265,8 @@ IE_Imp_WordPerfect::IE_Imp_WordPerfect(PD_Document * pDocument) : IE_Imp (pDocument) { - m_firstParagraph = true; m_undoOn = false; + m_paragraphChanged = true; m_wordPerfectDispatchBytes.addItem(new WordPerfectByteTag(WP_TOP_SOFT_EOL, &IE_Imp_WordPerfect::_insertSpace)); m_wordPerfectDispatchBytes.addItem(new WordPerfectByteTag(WP_TOP_SOFT_SPACE, &IE_Imp_WordPerfect::_insertSpace)); @@ -612,9 +612,7 @@ } } } - - - + UT_DEBUGMSG(("WordPerfect: File Pointer at %i equals or exceeds document length of %i\n", (int)ftell(m_importFile), (int)m_documentEnd)); X_CheckWordPerfectError(_flushText()); @@ -651,9 +649,9 @@ // (TODO: eliminate a prev space if it's just before this) UT_DEBUGMSG(("WordPerfect: Handling a hard EOL \n")); if(!m_undoOn) - { + { X_CheckWordPerfectError(_flushText()); - X_CheckWordPerfectError(_appendCurrentParagraphProperties()); + _appendCurrentParagraphProperties(); } return UT_OK; @@ -759,7 +757,6 @@ UT_uint16 nonDeletableInfoSize; X_CheckWordPerfectError(_handleVariableGroupHeader(startPosition, subGroup, size, flags)); - X_CheckFileReadElementError(fread(&nonDeletableInfoSize, sizeof(UT_uint16), 1, m_importFile)); // dispatch to subgroup to handle the rest of the relevant properties within the @@ -770,7 +767,8 @@ X_CheckWordPerfectError(_handleParagraphGroupJustification()); break; } - + m_paragraphChanged = true; + X_CheckWordPerfectError(_skipGroup(startPosition, size)); return UT_OK; @@ -794,7 +792,7 @@ } // handles a tab group -// (TODO: not implemented, just skips over it) +// (TODO: partially implemented, only basic tab import is done) UT_Error IE_Imp_WordPerfect::_handleTabGroup() { UT_DEBUGMSG(("WordPerfect: Handling a tab group\n")); @@ -802,7 +800,6 @@ long startPosition = ftell(m_importFile); unsigned char tabDefinition; UT_uint16 size; - unsigned char flags; X_CheckFileReadElementError(fread(&tabDefinition, sizeof(unsigned char), 1, m_importFile)); X_CheckFileReadElementError(fread(&size, sizeof(UT_uint16), 1, m_importFile)); // I have no idea WHAT this var. does. but it's there. @@ -1351,17 +1348,17 @@ { UT_DEBUGMSG(("WordPerfect: Flushing Text\n")); - // if this is the first time we're calling this, then we must append the current paragraph properties - // so we will have a structure to insert into - if(m_firstParagraph) + // append the current paragraph properties if they are changed; m_paragraphChanged +is initialized with true, so the first time + // we will have a structure to insert into + if(m_paragraphChanged) { _appendCurrentParagraphProperties(); - m_firstParagraph = false; } if(m_textBuf.getLength() > 0) X_CheckDocumentError(getDoc()->appendSpan(m_textBuf.getPointer(0), m_textBuf.getLength())); m_textBuf.truncate(0); + UT_DEBUGMSG(("WordPerfect: Text flushed\n")); return UT_OK; @@ -1447,6 +1444,7 @@ propsArray[0] = pProps; propsArray[1] = propBuffer; propsArray[2] = NULL; + m_paragraphChanged = false; X_CheckDocumentError(getDoc()->appendStrux(PTX_Block, propsArray)); Index: abi/src/wp/impexp/xp/ie_imp_WordPerfect.h =================================================================== RCS file: /cvsroot/abi/src/wp/impexp/xp/ie_imp_WordPerfect.h,v retrieving revision 1.7 diff -u -r1.7 ie_imp_WordPerfect.h --- abi/src/wp/impexp/xp/ie_imp_WordPerfect.h 13 Jan 2002 17:13:42 -0000 1.7 +++ abi/src/wp/impexp/xp/ie_imp_WordPerfect.h 20 Feb 2002 11:22:00 -0000 @@ -276,7 +276,7 @@ UT_uint32 m_documentPointer; UT_uint16 m_indexPointer; bool m_undoOn; - bool m_firstParagraph; + bool m_paragraphChanged; UT_Mbtowc m_Mbtowc; UT_GrowBuf m_textBuf; UT_Vector m_fontDescriptorList;
align.wpd
Description: application/wordperfect