? src/wp/impexp/xp/ie_exp_ISCII.cpp
? src/wp/impexp/xp/ie_imp_ISCII.cpp
? src/wp/impexp/xp/ie_imp_ISCII.h
? src/wp/impexp/xp/ie_exp_ISCII.h
Index: src/af/util/xp/ut_types.h
===================================================================
RCS file: /cvsroot/abi/src/af/util/xp/ut_types.h,v
retrieving revision 1.53
diff -u -r1.53 ut_types.h
--- src/af/util/xp/ut_types.h	2001/06/14 14:25:20	1.53
+++ src/af/util/xp/ut_types.h	2001/06/17 12:47:57
@@ -130,6 +130,7 @@
 #define UCS_LINESEP		((UT_UCSChar)0x2028)			/* Unicode line separator */
 #define UCS_PARASEP		((UT_UCSChar)0x2029)			/* Unicode paragraph separator */
 #define UCS_BOM			((UT_UCSChar)0xFEFF)			/* Byte order mark */
+#define UCS_REPLACECHAR	((UT_UCSChar)0xFFFD)
 
 /* Note: the following are our interpretations, not Unicode's */
 #define UCS_FIELDSTART		((UT_UCSChar)0xFFFE)
Index: src/af/xap/Makefile
===================================================================
RCS file: /cvsroot/abi/src/af/xap/Makefile,v
retrieving revision 1.70
diff -u -r1.70 Makefile
--- src/af/xap/Makefile	2001/06/08 16:06:41	1.70
+++ src/af/xap/Makefile	2001/06/17 12:47:58
@@ -98,6 +98,7 @@
 			$(OBJDIR)/xap_$(ABI_FE)$(ABI_GNOME_PREFIX)Dlg_PrintPreview.$(OBJ_SUFFIX) \
 			$(OBJDIR)/xap_$(ABI_FE)$(ABI_GNOME_PREFIX)Dlg_Language.$(OBJ_SUFFIX)    \
 			$(OBJDIR)/xap_$(ABI_FE)$(ABI_GNOME_PREFIX)Dlg_Zoom.$(OBJ_SUFFIX)	\
+			$(OBJDIR)/xap_$(ABI_FE)$(ABI_GNOME_PREFIX)Dlg_Encoding.$(OBJ_SUFFIX)    \
 			$(OBJDIR)/xap_$(ABI_FE)$(ABI_GNOME_PREFIX)Frame.$(OBJ_SUFFIX)           \
 			$(OBJDIR)/xap_$(ABI_FE)$(ABI_GNOME_PREFIX)PrintGraphics.$(OBJ_SUFFIX)
 
Index: src/wp/ap/beos/ap_BeOSApp.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/beos/ap_BeOSApp.cpp,v
retrieving revision 1.43
diff -u -r1.43 ap_BeOSApp.cpp
--- src/wp/ap/beos/ap_BeOSApp.cpp	2001/05/25 21:32:32	1.43
+++ src/wp/ap/beos/ap_BeOSApp.cpp	2001/06/17 12:48:25
@@ -59,40 +59,15 @@
 
 #include "ap_Clipboard.h"
 
+#include "ie_impexp_Register.h"
+
 #include "ie_exp.h"
-#include "ie_exp_AbiWord_1.h"
-#include "ie_exp_AWT.h"
-#include "ie_exp_GZipAbiWord.h"
-#include "ie_exp_MsWord_97.h"
-#include "ie_exp_MIF.h"
 #include "ie_exp_RTF.h"
 #include "ie_exp_Text.h"
-#include "ie_exp_HRText.h"
-#include "ie_exp_HTML.h"
-#include "ie_exp_LaTeX.h"
-#include "ie_exp_PalmDoc.h"
-#include "ie_exp_WML.h"
-#include "ie_exp_DocBook.h"
-#include "ie_exp_Psion.h"
-#include "ie_exp_Applix.h"
-#include "ie_exp_XSL-FO.h"
-#include "ie_exp_UTF8.h"
 
 #include "ie_imp.h"
-#include "ie_imp_AbiWord_1.h"
-#include "ie_imp_GZipAbiWord.h"
-#include "ie_imp_MsWord_97.h"
 #include "ie_imp_RTF.h"
 #include "ie_imp_Text.h"
-#include "ie_imp_UTF8.h"
-#include "ie_imp_WML.h"
-#include "ie_imp_GraphicAsDocument.h"
-#include "ie_imp_XHTML.h"
-#include "ie_imp_DocBook.h"
-#include "ie_imp_PalmDoc.h"
-#include "ie_imp_Psion.h"
-#include "ie_imp_XSL-FO.h"
-#include "ie_imp_Applix.h"
 
 // Signal handling
 #include <signal.h>
@@ -270,43 +245,7 @@
 	//////////////////////////////////////////////////////////////////
 	// Initialize the importers/exporters
 	//////////////////////////////////////////////////////////////////
-	{
-		IE_Imp::registerImporter(new IE_Imp_AbiWord_1_Sniffer ());
-		IE_Imp::registerImporter(new IE_Imp_Applix_Sniffer ());
-		IE_Imp::registerImporter(new IE_Imp_DocBook_Sniffer ());
-		IE_Imp::registerImporter(new IE_Imp_MsWord_97_Sniffer ());
-		IE_Imp::registerImporter(new IE_Imp_XSL_FO_Sniffer ());
-		IE_Imp::registerImporter(new IE_Imp_XHTML_Sniffer ());
-		IE_Imp::registerImporter(new IE_Imp_PalmDoc_Sniffer ());
-		IE_Imp::registerImporter(new IE_Imp_Psion_TextEd_Sniffer ());
-		IE_Imp::registerImporter(new IE_Imp_Psion_Word_Sniffer ());
-		IE_Imp::registerImporter(new IE_Imp_RTF_Sniffer ());
-		IE_Imp::registerImporter(new IE_Imp_Text_Sniffer ());
-		IE_Imp::registerImporter(new IE_Imp_UTF8_Sniffer ());
-		IE_Imp::registerImporter(new IE_Imp_WML_Sniffer ());
-		IE_Imp::registerImporter(new IE_Imp_GZipAbiWord_Sniffer ());
-
-		IE_Exp::registerExporter(new IE_Exp_AbiWord_1_Sniffer ());
-		IE_Exp::registerExporter(new IE_Exp_AWT_Sniffer ());
-		IE_Exp::registerExporter(new IE_Exp_Applix_Sniffer ());
-		IE_Exp::registerExporter(new IE_Exp_DocBook_Sniffer ());		
-#ifdef DEBUG
-		IE_Exp::registerExporter(new IE_Exp_MsWord_97_Sniffer ());
-#endif	
-		IE_Exp::registerExporter(new IE_Exp_XSL_FO_Sniffer ());
-		IE_Exp::registerExporter(new IE_Exp_HTML_Sniffer ());
-		IE_Exp::registerExporter(new IE_Exp_LaTeX_Sniffer ());
-		IE_Exp::registerExporter(new IE_Exp_PalmDoc_Sniffer ());
-		IE_Exp::registerExporter(new IE_Exp_Psion_TextEd_Sniffer ());
-		IE_Exp::registerExporter(new IE_Exp_Psion_Word_Sniffer ());
-		IE_Exp::registerExporter(new IE_Exp_RTF_Sniffer ());
-		IE_Exp::registerExporter(new IE_Exp_RTF_attic_Sniffer ());
-		IE_Exp::registerExporter(new IE_Exp_Text_Sniffer ());
-		IE_Exp::registerExporter(new IE_Exp_HRText_Sniffer ());
-		IE_Exp::registerExporter(new IE_Exp_UTF8_Sniffer ());
-		IE_Exp::registerExporter(new IE_Exp_WML_Sniffer ());
-		IE_Exp::registerExporter(new IE_Exp_GZipAbiWord_Sniffer ());
-	}
+	IE_ImpExp_RegisterXP ();
 
 	//////////////////////////////////////////////////////////////////
 	// initializes the spell checker.
Index: src/wp/ap/qnx/ap_QNXApp.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/qnx/ap_QNXApp.cpp,v
retrieving revision 1.26
diff -u -r1.26 ap_QNXApp.cpp
--- src/wp/ap/qnx/ap_QNXApp.cpp	2001/05/25 21:32:33	1.26
+++ src/wp/ap/qnx/ap_QNXApp.cpp	2001/06/17 12:48:32
@@ -63,40 +63,15 @@
 #include "fv_View.h"
 #include "fp_Run.h"
 
+#include "ie_impexp_Register.h"
+
 #include "ie_exp.h"
-#include "ie_exp_AbiWord_1.h"
-#include "ie_exp_AWT.h"
-#include "ie_exp_GZipAbiWord.h"
-#include "ie_exp_MsWord_97.h"
-#include "ie_exp_MIF.h"
 #include "ie_exp_RTF.h"
 #include "ie_exp_Text.h"
-#include "ie_exp_HRText.h"
-#include "ie_exp_HTML.h"
-#include "ie_exp_LaTeX.h"
-#include "ie_exp_PalmDoc.h"
-#include "ie_exp_WML.h"
-#include "ie_exp_DocBook.h"
-#include "ie_exp_Psion.h"
-#include "ie_exp_Applix.h"
-#include "ie_exp_XSL-FO.h"
-#include "ie_exp_UTF8.h"
 
 #include "ie_imp.h"
-#include "ie_imp_AbiWord_1.h"
-#include "ie_imp_GZipAbiWord.h"
-#include "ie_imp_MsWord_97.h"
 #include "ie_imp_RTF.h"
 #include "ie_imp_Text.h"
-#include "ie_imp_UTF8.h"
-#include "ie_imp_WML.h"
-#include "ie_imp_GraphicAsDocument.h"
-#include "ie_imp_XHTML.h"
-#include "ie_imp_DocBook.h"
-#include "ie_imp_PalmDoc.h"
-#include "ie_imp_Psion.h"
-#include "ie_imp_XSL-FO.h"
-#include "ie_imp_Applix.h"
 
 void signalWrapper(int sig_num);
 
@@ -186,43 +161,7 @@
 	//////////////////////////////////////////////////////////////////
 	// Initialize the importers/exporters
 	//////////////////////////////////////////////////////////////////
-	{
-		IE_Imp::registerImporter(new IE_Imp_AbiWord_1_Sniffer ());
-		IE_Imp::registerImporter(new IE_Imp_Applix_Sniffer ());
-		IE_Imp::registerImporter(new IE_Imp_DocBook_Sniffer ());
-		IE_Imp::registerImporter(new IE_Imp_MsWord_97_Sniffer ());
-		IE_Imp::registerImporter(new IE_Imp_XSL_FO_Sniffer ());
-		IE_Imp::registerImporter(new IE_Imp_XHTML_Sniffer ());
-		IE_Imp::registerImporter(new IE_Imp_PalmDoc_Sniffer ());
-		IE_Imp::registerImporter(new IE_Imp_Psion_TextEd_Sniffer ());
-		IE_Imp::registerImporter(new IE_Imp_Psion_Word_Sniffer ());
-		IE_Imp::registerImporter(new IE_Imp_RTF_Sniffer ());
-		IE_Imp::registerImporter(new IE_Imp_Text_Sniffer ());
-		IE_Imp::registerImporter(new IE_Imp_UTF8_Sniffer ());
-		IE_Imp::registerImporter(new IE_Imp_WML_Sniffer ());
-		IE_Imp::registerImporter(new IE_Imp_GZipAbiWord_Sniffer ());
-
-		IE_Exp::registerExporter(new IE_Exp_AbiWord_1_Sniffer ());
-		IE_Exp::registerExporter(new IE_Exp_AWT_Sniffer ());
-		IE_Exp::registerExporter(new IE_Exp_Applix_Sniffer ());
-		IE_Exp::registerExporter(new IE_Exp_DocBook_Sniffer ());		
-#ifdef DEBUG
-		IE_Exp::registerExporter(new IE_Exp_MsWord_97_Sniffer ());
-#endif	
-		IE_Exp::registerExporter(new IE_Exp_XSL_FO_Sniffer ());
-		IE_Exp::registerExporter(new IE_Exp_HTML_Sniffer ());
-		IE_Exp::registerExporter(new IE_Exp_LaTeX_Sniffer ());
-		IE_Exp::registerExporter(new IE_Exp_PalmDoc_Sniffer ());
-		IE_Exp::registerExporter(new IE_Exp_Psion_TextEd_Sniffer ());
-		IE_Exp::registerExporter(new IE_Exp_Psion_Word_Sniffer ());
-		IE_Exp::registerExporter(new IE_Exp_RTF_Sniffer ());
-		IE_Exp::registerExporter(new IE_Exp_RTF_attic_Sniffer ());
-		IE_Exp::registerExporter(new IE_Exp_Text_Sniffer ());
-		IE_Exp::registerExporter(new IE_Exp_HRText_Sniffer ());
-		IE_Exp::registerExporter(new IE_Exp_UTF8_Sniffer ());
-		IE_Exp::registerExporter(new IE_Exp_WML_Sniffer ());
-		IE_Exp::registerExporter(new IE_Exp_GZipAbiWord_Sniffer ());
-	}
+	IE_ImpExp_RegisterXP ();
 
 	//////////////////////////////////////////////////////////////////
 	// initializes the spell checker.
Index: src/wp/ap/win/ap_Win32App.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32App.cpp,v
retrieving revision 1.65
diff -u -r1.65 ap_Win32App.cpp
--- src/wp/ap/win/ap_Win32App.cpp	2001/06/15 22:36:50	1.65
+++ src/wp/ap/win/ap_Win32App.cpp	2001/06/17 12:48:39
@@ -60,38 +60,15 @@
 #include "fp_Run.h"
 #include "ut_Win32OS.h"
 
+#include "ie_impexp_Register.h"
+
 #include "ie_exp.h"
-#include "ie_exp_AbiWord_1.h"
-#include "ie_exp_AWT.h"
-#include "ie_exp_GZipAbiWord.h"
-#include "ie_exp_MsWord_97.h"
-#include "ie_exp_MIF.h"
 #include "ie_exp_RTF.h"
 #include "ie_exp_Text.h"
-#include "ie_exp_HRText.h"
-#include "ie_exp_HTML.h"
-#include "ie_exp_LaTeX.h"
-#include "ie_exp_PalmDoc.h"
-#include "ie_exp_WML.h"
-#include "ie_exp_DocBook.h"
-#include "ie_exp_Psion.h"
-#include "ie_exp_Applix.h"
-#include "ie_exp_XSL-FO.h"
 
 #include "ie_imp.h"
-#include "ie_imp_AbiWord_1.h"
-#include "ie_imp_GZipAbiWord.h"
-#include "ie_imp_MsWord_97.h"
 #include "ie_imp_RTF.h"
 #include "ie_imp_Text.h"
-#include "ie_imp_WML.h"
-#include "ie_imp_GraphicAsDocument.h"
-#include "ie_imp_XHTML.h"
-#include "ie_imp_DocBook.h"
-#include "ie_imp_PalmDoc.h"
-#include "ie_imp_Psion.h"
-#include "ie_imp_XSL-FO.h"
-#include "ie_imp_Applix.h"
 
 /*****************************************************************/
 
@@ -177,43 +154,7 @@
 	//////////////////////////////////////////////////////////////////
 	// Initialize the importers/exporters
 	//////////////////////////////////////////////////////////////////
-	{
-		IE_Imp::registerImporter(new IE_Imp_AbiWord_1_Sniffer ());
-		IE_Imp::registerImporter(new IE_Imp_Applix_Sniffer ());
-		IE_Imp::registerImporter(new IE_Imp_DocBook_Sniffer ());
-		IE_Imp::registerImporter(new IE_Imp_MsWord_97_Sniffer ());
-		IE_Imp::registerImporter(new IE_Imp_XSL_FO_Sniffer ());
-		IE_Imp::registerImporter(new IE_Imp_XHTML_Sniffer ());
-		IE_Imp::registerImporter(new IE_Imp_PalmDoc_Sniffer ());
-		IE_Imp::registerImporter(new IE_Imp_Psion_TextEd_Sniffer ());
-		IE_Imp::registerImporter(new IE_Imp_Psion_Word_Sniffer ());
-		IE_Imp::registerImporter(new IE_Imp_RTF_Sniffer ());
-		IE_Imp::registerImporter(new IE_Imp_Text_Sniffer ());
-		IE_Imp::registerImporter(new IE_Imp_EncodedText_Sniffer ());
-		IE_Imp::registerImporter(new IE_Imp_WML_Sniffer ());
-		IE_Imp::registerImporter(new IE_Imp_GZipAbiWord_Sniffer ());
-
-		IE_Exp::registerExporter(new IE_Exp_AbiWord_1_Sniffer ());
-		IE_Exp::registerExporter(new IE_Exp_AWT_Sniffer ());
-		IE_Exp::registerExporter(new IE_Exp_Applix_Sniffer ());
-		IE_Exp::registerExporter(new IE_Exp_DocBook_Sniffer ());
-#ifdef DEBUG
-		IE_Exp::registerExporter(new IE_Exp_MsWord_97_Sniffer ());
-#endif	
-		IE_Exp::registerExporter(new IE_Exp_XSL_FO_Sniffer ());
-		IE_Exp::registerExporter(new IE_Exp_HTML_Sniffer ());
-		IE_Exp::registerExporter(new IE_Exp_LaTeX_Sniffer ());
-		IE_Exp::registerExporter(new IE_Exp_PalmDoc_Sniffer ());
-		IE_Exp::registerExporter(new IE_Exp_Psion_TextEd_Sniffer ());
-		IE_Exp::registerExporter(new IE_Exp_Psion_Word_Sniffer ());
-		IE_Exp::registerExporter(new IE_Exp_RTF_Sniffer ());
-		IE_Exp::registerExporter(new IE_Exp_RTF_attic_Sniffer ());
-		IE_Exp::registerExporter(new IE_Exp_Text_Sniffer ());
-		IE_Exp::registerExporter(new IE_Exp_EncodedText_Sniffer ());
-		IE_Exp::registerExporter(new IE_Exp_HRText_Sniffer ());
-		IE_Exp::registerExporter(new IE_Exp_WML_Sniffer ());
-		IE_Exp::registerExporter(new IE_Exp_GZipAbiWord_Sniffer ());
-	}
+	IE_ImpExp_RegisterXP ();
 
 	//////////////////////////////////////////////////////////////////
 	// initializes the spell checker.
@@ -500,77 +441,59 @@
 	// right.  Oh, and the value returned by GlobalSize() varies
 	// from call-to-call on the same object.... sigh.
 
-	// TODO These macros should probably be functions now...
-
-#define TRY_TO_PASTE_IN_FORMAT(fmt,type)							\
-	do {															\
-		HANDLE hData;												\
-		hData = m_pClipboard->getHandleInFormat( fmt );				\
-		if (hData)													\
-		{															\
-			unsigned char * pData = (unsigned char *)GlobalLock(hData);				\
-			UT_DEBUGMSG(("Paste: [fmt %s][hdata 0x%08lx][pData 0x%08lx]\n",			\
-						 ##fmt, hData, pData));						\
-			UT_uint32 iSize = GlobalSize(hData);					\
-			UT_uint32 iStrLen = strlen((const char *)pData);		\
-			UT_uint32 iLen = MyMin(iSize,iStrLen);					\
-																	\
-			type * pImp = new type (pDocRange->m_pDoc);				\
-			if (pImp)												\
-			{														\
-				pImp->pasteFromBuffer(pDocRange,pData,iLen);		\
-				delete pImp;										\
-			}														\
-																	\
-			GlobalUnlock(hData);									\
-			goto MyEnd;												\
-		}															\
-	} while (0)
-
-#define TRY_TO_PASTE_IN_FORMAT_WIDE(fmt,type)						\
-	do {															\
-		HANDLE hData;												\
-		hData = m_pClipboard->getHandleInFormat( fmt );				\
-		if (hData)													\
-		{															\
-			unsigned char * pData = (unsigned char *)GlobalLock(hData);				\
-			UT_DEBUGMSG(("Paste: [fmt %s][hdata 0x%08lx][pData 0x%08lx]\n",			\
-						 ##fmt, hData, pData));						\
-			UT_uint32 iSize = GlobalSize(hData);					\
-			UT_uint32 iStrLen = wcslen((const wchar_t *)pData) * 2;	\
-			UT_uint32 iLen = MyMin(iSize,iStrLen);					\
-																	\
-			type * pImp = new type (pDocRange->m_pDoc);				\
-			if (pImp)												\
-			{														\
-				pImp->pasteFromBuffer(pDocRange,pData,iLen);		\
-				delete pImp;										\
-			}														\
-																	\
-			GlobalUnlock(hData);									\
-			goto MyEnd;												\
-		}															\
-	} while (0)
-
-
 	if (!m_pClipboard->openClipboard())			// try to lock the clipboard
 		return;
 	
 	{
 		// TODO Paste the most detailed version unless user overrides.
 		// TODO decide if we need to support .ABW on the clipboard.
-		if (bHonorFormatting)
-			TRY_TO_PASTE_IN_FORMAT(AP_CLIPBOARD_RTF, IE_Imp_RTF);
-		TRY_TO_PASTE_IN_FORMAT_WIDE(AP_CLIPBOARD_TEXTPLAIN_UCS2, IE_Imp_Text);
-		TRY_TO_PASTE_IN_FORMAT(AP_CLIPBOARD_TEXTPLAIN_8BIT, IE_Imp_Text);
-		
-		// TODO figure out what to do with an image and other formats....
-		UT_DEBUGMSG(("PasteFromClipboard: TODO support this format..."));
+		if (!((bHonorFormatting && _pasteFormatFromClipboard(pDocRange, AP_CLIPBOARD_RTF, ".rtf", false)) ||
+			_pasteFormatFromClipboard(pDocRange, AP_CLIPBOARD_TEXTPLAIN_UCS2, ".txt", true) ||
+			_pasteFormatFromClipboard(pDocRange, AP_CLIPBOARD_TEXTPLAIN_8BIT, ".txt", false)))
+		{
+			// TODO figure out what to do with an image and other formats....
+			UT_DEBUGMSG(("PasteFromClipboard: TODO support this format..."));
+		}
 	}
 
-MyEnd:
 	m_pClipboard->closeClipboard();				// release clipboard lock
 	return;
+}
+
+bool AP_Win32App::_pasteFormatFromClipboard(PD_DocumentRange * pDocRange, const char * szFormat,
+											const char * szType, bool bWide)
+{
+	HANDLE hData;
+	bool bSuccess = false;
+
+	if (hData = m_pClipboard->getHandleInFormat(szFormat))
+	{
+		unsigned char * pData = static_cast<unsigned char *>(GlobalLock(hData));
+		UT_DEBUGMSG(("Paste: [fmt %s][hdata 0x%08lx][pData 0x%08lx]\n",
+					 szFormat, hData, pData));
+		UT_uint32 iSize = GlobalSize(hData);
+		UT_uint32 iStrLen = bWide
+			? wcslen(reinterpret_cast<const wchar_t *>(pData)) * 2
+			: strlen(reinterpret_cast<const char *>(pData));
+		UT_uint32 iLen = MyMin(iSize,iStrLen);
+
+		IE_Imp * pImp = 0;
+		IE_Imp::constructImporter(pDocRange->m_pDoc, 0, IE_Imp::fileTypeForSuffix(szType), &pImp, 0);
+		if (pImp)
+		{
+			const char * szEncoding = 0;
+			if (bWide)
+				szEncoding = XAP_EncodingManager::get_instance()->getUCS2LEName();
+			else
+				; // TODO Get code page using CF_LOCALE
+			pImp->pasteFromBuffer(pDocRange,pData,iLen,szEncoding);
+			delete pImp;
+		}
+
+		GlobalUnlock(hData);
+		bSuccess = true;
+	}
+	return bSuccess;
 }
 
 bool AP_Win32App::canPasteFromClipboard(void)
Index: src/wp/ap/win/ap_Win32App.h
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32App.h,v
retrieving revision 1.19
diff -u -r1.19 ap_Win32App.h
--- src/wp/ap/win/ap_Win32App.h	2001/05/04 15:33:35	1.19
+++ src/wp/ap/win/ap_Win32App.h	2001/06/17 12:48:40
@@ -66,6 +66,8 @@
 	bool handleModelessDialogMessage( MSG * msg );
 
 protected:
+	bool					_pasteFormatFromClipboard(PD_DocumentRange * pDocRange, const char * szFormat,
+													 const char * szType, bool bWide);
 	XAP_StringSet *			m_pStringSet;
 	AP_Win32Clipboard *		m_pClipboard;
 };
Index: src/wp/impexp/xp/GNUmakefile.am
===================================================================
RCS file: /cvsroot/abi/src/wp/impexp/xp/GNUmakefile.am,v
retrieving revision 1.9
diff -u -r1.9 GNUmakefile.am
--- src/wp/impexp/xp/GNUmakefile.am	2001/06/07 15:52:41	1.9
+++ src/wp/impexp/xp/GNUmakefile.am	2001/06/17 12:48:46
@@ -44,6 +44,7 @@
 	ie_exp_PalmDoc.cpp			\
 	ie_exp_Psion.cpp			\
 	ie_exp_XSL-FO.cpp			\
+	ie_exp_ISCII.cpp			\
 	ie_imp.cpp				\
 	ie_imp_AbiWord_1.cpp			\
 	ie_imp_Applix.cpp			\
@@ -62,5 +63,6 @@
 	ie_impGraphic_SVG.cpp			\
 	ie_impGraphic_BMP.cpp			\
 	ie_imp_Psion.cpp			\
-	ie_imp_PalmDoc.cpp
+	ie_imp_PalmDoc.cpp			\
+	ie_imp_ISCII.cpp
 
Index: src/wp/impexp/xp/Makefile
===================================================================
RCS file: /cvsroot/abi/src/wp/impexp/xp/Makefile,v
retrieving revision 1.56
diff -u -r1.56 Makefile
--- src/wp/impexp/xp/Makefile	2001/06/07 15:52:42	1.56
+++ src/wp/impexp/xp/Makefile	2001/06/17 12:48:46
@@ -42,6 +42,7 @@
 			ie_exp_Psion.cpp			\
 			ie_exp_MIF.cpp				\
 			ie_exp_XSL-FO.cpp			\
+			ie_exp_ISCII.cpp			\
 			ie_imp.cpp				\
 			ie_imp_XML.cpp				\
 			ie_imp_AbiWord_1.cpp			\
@@ -61,7 +62,8 @@
 			ie_impGraphic_PNG.cpp			\
 			ie_impGraphic_SVG.cpp			\
 			ie_impGraphic_BMP.cpp			\
-			ie_imp_Psion.cpp
+			ie_imp_Psion.cpp				\
+			ie_imp_ISCII.cpp
 
 
 LIBRARY_NAME=		AbiImpExp
Index: src/wp/impexp/xp/Makefile.mpw
===================================================================
RCS file: /cvsroot/abi/src/wp/impexp/xp/Makefile.mpw,v
retrieving revision 1.5
diff -u -r1.5 Makefile.mpw
--- src/wp/impexp/xp/Makefile.mpw	2001/02/13 00:39:05	1.5
+++ src/wp/impexp/xp/Makefile.mpw	2001/06/17 12:48:46
@@ -38,6 +38,7 @@
 		   "ie_exp_Text.o" 
 		   "ie_exp_UTF8.o" 
 		   "ie_exp_WML.o" 
+		   "ie_exp_ISCII.o" 
 		   "ie_imp.o" 
 		   "ie_imp_AbiWord_1.o" 
 		   "ie_imp_ClarisWorks.o" 
@@ -53,6 +54,7 @@
 		   "ie_imp_WML.o" 
 		   "ie_imp_XHTML.o" 
 		   "ie_imp_XML.o" 
+		   "ie_imp_ISCII.o" 
 		   "ie_impexp_MSWrite.o" 
 		   "ie_impGraphic.o" 
 		   "ie_impGraphic_BMP.o" 
Index: src/wp/impexp/xp/ie_exp_Text.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/impexp/xp/ie_exp_Text.cpp,v
retrieving revision 1.27
diff -u -r1.27 ie_exp_Text.cpp
--- src/wp/impexp/xp/ie_exp_Text.cpp	2001/06/15 22:36:56	1.27
+++ src/wp/impexp/xp/ie_exp_Text.cpp	2001/06/17 12:48:56
@@ -42,67 +42,6 @@
 #include "ut_Win32OS.h"
 #endif
 
-#define MY_MB_LEN_MAX 6
-
-//////////////////////////////////////////////////////////////////
-// a private listener class to help us translate the document
-// into a text stream.  code is at the bottom of this file.
-//////////////////////////////////////////////////////////////////
-
-class s_Text_Listener : public PL_Listener
-{
-public:
-	s_Text_Listener(PD_Document * pDocument,
-					IE_Exp_Text * pie,
-					bool bToClipboard,
-					const char *szEncoding,
-					bool bIs16Bit,
-					bool bUseBOM,
-					bool bBigEndian);
-	virtual ~s_Text_Listener() {}
-
-	virtual bool		populate(PL_StruxFmtHandle sfh,
-								 const PX_ChangeRecord * pcr);
-
-	virtual bool		populateStrux(PL_StruxDocHandle sdh,
-									  const PX_ChangeRecord * pcr,
-									  PL_StruxFmtHandle * psfh);
-
-	virtual bool		change(PL_StruxFmtHandle sfh,
-							   const PX_ChangeRecord * pcr);
-
-	virtual bool		insertStrux(PL_StruxFmtHandle sfh,
-									const PX_ChangeRecord * pcr,
-									PL_StruxDocHandle sdh,
-									PL_ListenerId lid,
-									void (* pfnBindHandles)(PL_StruxDocHandle sdhNew,
-															PL_ListenerId lid,
-															PL_StruxFmtHandle sfhNew));
-
-	virtual bool		signal(UT_uint32 iSignal);
-
-protected:
-	void				_genBOM(void);
-	void				_genLineBreak(void);
-	void				_outputData(const UT_UCSChar * p, UT_uint32 length);
-	void				_closeBlock(void);
-
-	PD_Document *		m_pDocument;
-	IE_Exp_Text *		m_pie;
-	UT_Wctomb 			m_wctomb;
-	char				m_mbBOM[MY_MB_LEN_MAX];
-	int					m_iBOMLen;
-	char				m_mbLineBreak[MY_MB_LEN_MAX*2];
-	int					m_iLineBreakLen;
-	bool				m_bInBlock;
-	bool				m_bToClipboard;
-	bool				m_bFirstWrite;
-	const char *		m_szEncoding;
-	bool				m_bIs16Bit;
-	bool				m_bBigEndian;
-	bool				m_bUseBOM;
-};
-
 /*****************************************************************/
 /*****************************************************************/
 
@@ -187,11 +126,19 @@
 /*****************************************************************/
 /*****************************************************************/
 
+PL_Listener * IE_Exp_Text::_constructListener(void)
+{
+	return new Text_Listener(m_pDocument,this,(m_pDocRange!=NULL),m_szEncoding,m_bIs16Bit,m_bUseBOM,m_bBigEndian);
+}
+
 // TODO This function is also used for Copy and Paste.
-// TODO We should really always Copy Unicode to the clipboard and have the
-// TODO clipboard handle conversion.  Currently we use the same encoding
-// TODO as when we're Saving a file.
-// TODO We'll need a way of knowing which Unicode format each OS needs for its clipboard.
+// TODO We should really always Copy Unicode to the clipboard.
+// TODO On NT, the OS will implicitly convert the clipboard from Unicode for old apps.
+// TODO On 95/98/ME we should probably convert it ourselves during "Copy".
+// TODO NT also automatically puts locale info on the clipboard based on the input locale,
+// TODO but it would be better to use the document locale.
+// TODO On 95/98/NT we need to put locale info on the clipboard manually anyway.
+// TODO Unicode clipboard and localized clipboard support for non-Windows OSes.
 
 UT_Error IE_Exp_Text::_writeDocument(void)
 {
@@ -206,7 +153,7 @@
 #endif
 	}
 
-	m_pListener = new s_Text_Listener(m_pDocument,this,(m_pDocRange!=NULL),m_szEncoding,m_bIs16Bit,m_bUseBOM,m_bBigEndian);
+	m_pListener = _constructListener();
 	if (!m_pListener)
 		return UT_IE_NOMEMORY;
 
@@ -243,10 +190,10 @@
 	XAP_Dialog_Id id = XAP_DIALOG_ID_ENCODING;
 
 	XAP_DialogFactory * pDialogFactory
-		= reinterpret_cast<XAP_DialogFactory *>(m_pDocument->getApp()->getDialogFactory());
+		= static_cast<XAP_DialogFactory *>(m_pDocument->getApp()->getDialogFactory());
 
 	XAP_Dialog_Encoding * pDialog
-		= reinterpret_cast<XAP_Dialog_Encoding *>(pDialogFactory->requestDialog(id));
+		= static_cast<XAP_Dialog_Encoding *>(pDialogFactory->requestDialog(id));
 	UT_ASSERT(pDialog);
 
 	pDialog->setEncoding(szEncoding);
@@ -270,7 +217,7 @@
 		UT_ASSERT (s);
 
 		strcpy(szEnc,s);
-		_setEncoding(reinterpret_cast<const char *>(szEnc));
+		_setEncoding(static_cast<const char *>(szEnc));
 		m_pDocument->setEncodingName(szEnc);
 	}
 
@@ -283,27 +230,30 @@
   Set exporter's encoding and related members
  \param szEncoding Encoding to export file into
 
- Decides endian and BOM policy based on encoding
+ Decides endian and BOM policy based on encoding.
+ Set to 0 to handle raw bytes.
+ This function should be identical to the one in IE_Imp_Text.
  */
 void IE_Exp_Text::_setEncoding(const char *szEncoding)
 {
-	UT_ASSERT(szEncoding);
-
 	m_szEncoding = szEncoding;
 
-	// TODO some iconvs use a different string!
-	if (!strncmp(m_szEncoding,"UCS-2",5))
+	// TODO Should BOM use be a user pref?
+	// TODO Does Mac OSX prefer BOMs?
+	if (szEncoding && !strcmp(szEncoding,XAP_EncodingManager::get_instance()->getUCS2LEName()))
 	{
 		m_bIs16Bit = true;
-		if (!strcmp(m_szEncoding + strlen(m_szEncoding) - 2, "BE"))
-			m_bBigEndian = true;
-		else if (!strcmp(m_szEncoding + strlen(m_szEncoding) - 2, "LE"))
-			m_bBigEndian = false;
-		else
-			UT_ASSERT(UT_SHOULD_NOT_HAPPEN);
-
-		// TODO Should BOM use be a user pref?
-		// TODO Does Mac OSX prefer BOMs?
+		m_bBigEndian = false;
+#ifdef WIN32
+		m_bUseBOM = true;
+#else
+		m_bUseBOM = false;
+#endif
+	}
+	else if (szEncoding && !strcmp(szEncoding,XAP_EncodingManager::get_instance()->getUCS2BEName()))
+	{
+		m_bIs16Bit = true;
+		m_bBigEndian = true;
 #ifdef WIN32
 		m_bUseBOM = true;
 #else
@@ -327,23 +277,23 @@
 
  Makes a Byte Order Mark correct for the encoding.
  */
-void s_Text_Listener::_genBOM(void)
+void Text_Listener::_genBOM(void)
 {
 	// TODO iconv (at least libiconv) actually converts BOM to nothing at all ):
 #if 0
 	UT_UCSChar wcBOM[2] = {0,0};
-	UT_UCSChar *pWC = wcBOM;
-	char *pMB = reinterpret_cast<char *>(m_mbBOM);
+	UT_UCSChar *pWC;
+	char *pMB = static_cast<char *>(m_mbBOM);
 	int mbLen;
 
 	wcBOM[0] = UCS_BOM;
 
-	while (*pWC)
+	for (pWC = wcBOM; *pWC; ++pwC)
 	{
-		if (!m_wctomb.wctomb(pMB,mbLen,static_cast<wchar_t>(*pWC)))
+		if (_wctomb(pMB,mbLen,static_cast<wchar_t>(*pWC)))
+			pMB += mbLen;
+		else
 			UT_ASSERT(UT_SHOULD_NOT_HAPPEN);
-		++pWC;
-		pMB += mbLen;
 	}
 	m_iBOMLen = pMB - m_mbBOM;
 #else
@@ -377,11 +327,11 @@
 
  Makes a line break correct for the encoding and platform.
  */
-void s_Text_Listener::_genLineBreak(void)
+void Text_Listener::_genLineBreak(void)
 {
 	UT_UCSChar wcLineBreak[3] = {0,0,0};
-	UT_UCSChar *pWC = wcLineBreak;
-	char *pMB = reinterpret_cast<char *>(m_mbLineBreak);
+	UT_UCSChar *pWC;
+	char *pMB = static_cast<char *>(m_mbLineBreak);
 	int mbLen;
 
 	// TODO Old Mac should use "\r".  Mac OSX should Use U+2028 or U+2029.
@@ -392,14 +342,15 @@
 	wcLineBreak[0] = '\n';
 #endif
 
-	while (*pWC)
+	for (pWC = wcLineBreak; *pWC; ++pWC)
 	{
-		if (!m_wctomb.wctomb(pMB,mbLen,static_cast<wchar_t>(*pWC)))
+		if (_wctomb(pMB,mbLen,static_cast<wchar_t>(*pWC)))
+			pMB += mbLen;
+		else
 			UT_ASSERT(UT_SHOULD_NOT_HAPPEN);
-		++pWC;
-		pMB += mbLen;
 	}
 	m_iLineBreakLen = pMB - m_mbLineBreak;
+	UT_ASSERT(m_iLineBreakLen);
 }
 
 /*!
@@ -407,7 +358,7 @@
  \param data Buffer to output
  \param length Size of buffer
  */
-void s_Text_Listener::_outputData(const UT_UCSChar * data, UT_uint32 length)
+void Text_Listener::_outputData(const UT_UCSChar * data, UT_uint32 length)
 {
 	UT_ByteBuf bBuf;
 	const UT_UCSChar * pData;
@@ -417,16 +368,16 @@
 
 	if (m_bFirstWrite)
 	{
-		UT_ASSERT(m_szEncoding);
-		m_wctomb.setOutCharset(m_szEncoding);
+		if (m_szEncoding)
+			m_wctomb.setOutCharset(m_szEncoding);
 
-		if (m_bUseBOM)
-			_genBOM();
 		_genLineBreak();
 
-		// TODO BOMs need separate code for UTF-7, UCS-4, etc
 		if (m_bUseBOM)
-			m_pie->write(reinterpret_cast<const char *>(m_mbBOM),m_iBOMLen);
+		{
+			_genBOM();
+			m_pie->write(static_cast<const char *>(m_mbBOM),m_iBOMLen);
+		}
 
 		m_bFirstWrite = false;
 	}
@@ -438,8 +389,9 @@
 			bBuf.append(reinterpret_cast<UT_Byte *>(m_mbLineBreak),m_iLineBreakLen);
 		else
 		{
-			if (!m_wctomb.wctomb(pC,mbLen,static_cast<wchar_t>(*pData)))
+			if (!_wctomb(pC,mbLen,static_cast<wchar_t>(*pData)))
 			{
+				UT_ASSERT(!m_bIs16Bit);
 				mbLen=1;
 				pC[0]='?';
 				m_wctomb.initialize();
@@ -452,7 +404,7 @@
 	m_pie->write(reinterpret_cast<const char *>(bBuf.getPointer(0)),bBuf.getLength());
 }
 
-void s_Text_Listener::_closeBlock(void)
+void Text_Listener::_closeBlock(void)
 {
 	if (!m_bInBlock)
 		return;
@@ -460,19 +412,19 @@
 	UT_ASSERT(!m_bFirstWrite);
 	UT_ASSERT(m_iLineBreakLen);
 
-	m_pie->write(reinterpret_cast<const char *>(m_mbLineBreak),m_iLineBreakLen);
+	m_pie->write(static_cast<const char *>(m_mbLineBreak),m_iLineBreakLen);
 
 	m_bInBlock = false;
 	return;
 }
 
-s_Text_Listener::s_Text_Listener(PD_Document * pDocument,
-								 IE_Exp_Text * pie,
-								 bool bToClipboard,
-								 const char *szEncoding,
-								 bool bIs16Bit,
-								 bool bUseBOM,
-								 bool bBigEndian)
+Text_Listener::Text_Listener(PD_Document * pDocument,
+							 IE_Exp_Text * pie,
+							 bool bToClipboard,
+							 const char *szEncoding,
+							 bool bIs16Bit,
+							 bool bUseBOM,
+							 bool bBigEndian)
 	: m_pDocument(pDocument),
 	  m_pie(pie),
 	  // when we are going to the clipboard, we should implicitly
@@ -488,7 +440,7 @@
 {
 }
 
-bool s_Text_Listener::populate(PL_StruxFmtHandle /*sfh*/,
+bool Text_Listener::populate(PL_StruxFmtHandle /*sfh*/,
 								  const PX_ChangeRecord * pcr)
 {
 	switch (pcr->getType())
@@ -547,7 +499,7 @@
 	}
 }
 
-bool s_Text_Listener::populateStrux(PL_StruxDocHandle /*sdh*/,
+bool Text_Listener::populateStrux(PL_StruxDocHandle /*sdh*/,
 									   const PX_ChangeRecord * pcr,
 									   PL_StruxFmtHandle * psfh)
 {
@@ -582,14 +534,14 @@
 	}
 }
 
-bool s_Text_Listener::change(PL_StruxFmtHandle /*sfh*/,
+bool Text_Listener::change(PL_StruxFmtHandle /*sfh*/,
 								const PX_ChangeRecord * /*pcr*/)
 {
 	UT_ASSERT(0);						// this function is not used.
 	return false;
 }
 
-bool s_Text_Listener::insertStrux(PL_StruxFmtHandle /*sfh*/,
+bool Text_Listener::insertStrux(PL_StruxFmtHandle /*sfh*/,
 									 const PX_ChangeRecord * /*pcr*/,
 									 PL_StruxDocHandle /*sdh*/,
 									 PL_ListenerId /* lid */,
@@ -601,7 +553,7 @@
 	return false;
 }
 
-bool s_Text_Listener::signal(UT_uint32 /* iSignal */)
+bool Text_Listener::signal(UT_uint32 /* iSignal */)
 {
 	UT_ASSERT(UT_SHOULD_NOT_HAPPEN);
 	return false;
Index: src/wp/impexp/xp/ie_exp_Text.h
===================================================================
RCS file: /cvsroot/abi/src/wp/impexp/xp/ie_exp_Text.h,v
retrieving revision 1.10
diff -u -r1.10 ie_exp_Text.h
--- src/wp/impexp/xp/ie_exp_Text.h	2001/06/15 22:36:56	1.10
+++ src/wp/impexp/xp/ie_exp_Text.h	2001/06/17 12:48:56
@@ -23,8 +23,12 @@
 
 #include "ie_exp.h"
 #include "pl_Listener.h"
+#include "ut_wctomb.h"
+
+#define MY_MB_LEN_MAX 6
+
 class PD_Document;
-class s_Text_Listener;
+class Text_Listener;
 
 // The exporter/writer for Plain Text Files.
 
@@ -69,13 +73,74 @@
 	virtual ~IE_Exp_Text() {}
 
 protected:
+	virtual PL_Listener *	_constructListener(void);
 	virtual UT_Error	_writeDocument(void);
 	virtual bool		_openFile(const char * szFilename);
 	bool				_doEncodingDialog(const char *szEncoding);
 	void				_setEncoding(const char *szEncoding);
 
-	s_Text_Listener *	m_pListener;
+	PL_Listener *		m_pListener;
 	bool				m_bIsEncoded;
+	const char *		m_szEncoding;
+	bool				m_bIs16Bit;
+	bool				m_bBigEndian;
+	bool				m_bUseBOM;
+};
+
+//////////////////////////////////////////////////////////////////
+// a private listener class to help us translate the document
+// into a text stream.
+//////////////////////////////////////////////////////////////////
+
+class Text_Listener : public PL_Listener
+{
+public:
+	Text_Listener(PD_Document * pDocument,
+					IE_Exp_Text * pie,
+					bool bToClipboard = false,
+					const char *szEncoding = 0,
+					bool bIs16Bit = false,
+					bool bUseBOM = false,
+					bool bBigEndian = false);
+	virtual ~Text_Listener() {}
+
+	virtual bool		populate(PL_StruxFmtHandle sfh,
+								 const PX_ChangeRecord * pcr);
+
+	virtual bool		populateStrux(PL_StruxDocHandle sdh,
+									  const PX_ChangeRecord * pcr,
+									  PL_StruxFmtHandle * psfh);
+
+	virtual bool		change(PL_StruxFmtHandle sfh,
+							   const PX_ChangeRecord * pcr);
+
+	virtual bool		insertStrux(PL_StruxFmtHandle sfh,
+									const PX_ChangeRecord * pcr,
+									PL_StruxDocHandle sdh,
+									PL_ListenerId lid,
+									void (* pfnBindHandles)(PL_StruxDocHandle sdhNew,
+															PL_ListenerId lid,
+															PL_StruxFmtHandle sfhNew));
+
+	virtual bool		signal(UT_uint32 iSignal);
+
+protected:
+	virtual int			_wctomb(char * pC, int & length, wchar_t wc) { return m_wctomb.wctomb(pC,length,wc); }
+	void				_genBOM(void);
+	void				_genLineBreak(void);
+	virtual void		_outputData(const UT_UCSChar * p, UT_uint32 length);
+	void				_closeBlock(void);
+
+	PD_Document *		m_pDocument;
+	IE_Exp_Text *		m_pie;
+	UT_Wctomb 			m_wctomb;
+	char				m_mbBOM[MY_MB_LEN_MAX];
+	int					m_iBOMLen;
+	char				m_mbLineBreak[MY_MB_LEN_MAX*2];
+	int					m_iLineBreakLen;
+	bool				m_bInBlock;
+	bool				m_bToClipboard;
+	bool				m_bFirstWrite;
 	const char *		m_szEncoding;
 	bool				m_bIs16Bit;
 	bool				m_bBigEndian;
Index: src/wp/impexp/xp/ie_imp.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/impexp/xp/ie_imp.cpp,v
retrieving revision 1.45
diff -u -r1.45 ie_imp.cpp
--- src/wp/impexp/xp/ie_imp.cpp	2001/05/25 18:02:35	1.45
+++ src/wp/impexp/xp/ie_imp.cpp	2001/06/17 12:48:58
@@ -160,25 +160,34 @@
 	
 }
 
+/*! 
+  Construct an importer of the right type.
+ \param pDocument Document
+ \param szFilename Name of file - optional
+ \param ieft Desired filetype - pass IEFT_Unknown for best guess
+ \param ppie Pointer to return importer in
+ \param pieft Pointer to fill in actual filetype
+
+ Caller is responsible for deleting the importer object
+ when finished with it.
+*/
 UT_Error IE_Imp::constructImporter(PD_Document * pDocument,
 								   const char * szFilename,
 								   IEFileType ieft,
 								   IE_Imp ** ppie,
 								   IEFileType * pieft)
 {
-	// construct an importer of the right type.
-	// caller is responsible for deleting the importer object
-	// when finished with it.
+	bool bUseGuesswork = (ieft != IEFT_Unknown);
 	
 	UT_ASSERT(pDocument);
-	UT_ASSERT(szFilename && *szFilename);
+	UT_ASSERT(ieft != IEFT_Unknown || (szFilename && *szFilename));
 	UT_ASSERT(ppie);
 
 	// no filter will support IEFT_Unknown, so we try to detect
 	// from the contents of the file or the filename suffix
 	// the importer to use and assign that back to ieft.
 	// Give precedence to the file contents
-	if (ieft == IEFT_Unknown)
+	if (ieft == IEFT_Unknown && szFilename && *szFilename)
 	{
 		char szBuf[4096];  // 4096 ought to be enough
 		int iNumbytes;
@@ -191,7 +200,7 @@
 			ieft = IE_Imp::fileTypeForContents(szBuf, iNumbytes);
 		}
 	}
-	if (ieft == IEFT_Unknown)
+	if (ieft == IEFT_Unknown && szFilename && *szFilename)
 	{
 		ieft = IE_Imp::fileTypeForSuffix(UT_pathSuffix(szFilename));
 	}
@@ -243,8 +252,13 @@
 	// type of file we're supposed to be reading.
 	// assume it is our format and try to read it.
 	// if that fails, just give up.
-	*ppie = new IE_Imp_AbiWord_1(pDocument);
-	return ((*ppie) ? UT_OK : UT_IE_NOMEMORY);
+	if (bUseGuesswork)
+	{
+		*ppie = new IE_Imp_AbiWord_1(pDocument);
+		return ((*ppie) ? UT_OK : UT_IE_NOMEMORY);
+	}
+	else
+		return UT_ERROR;
 }
 
 bool IE_Imp::enumerateDlgLabels(UT_uint32 ndx,
Index: src/wp/impexp/xp/ie_imp.h
===================================================================
RCS file: /cvsroot/abi/src/wp/impexp/xp/ie_imp.h,v
retrieving revision 1.20
diff -u -r1.20 ie_imp.h
--- src/wp/impexp/xp/ie_imp.h	2001/06/08 16:07:10	1.20
+++ src/wp/impexp/xp/ie_imp.h	2001/06/17 12:48:58
@@ -97,7 +97,7 @@
 	virtual ~IE_Imp();
 	virtual UT_Error	importFile(const char * szFilename) = 0;
 	virtual void		pasteFromBuffer(PD_DocumentRange * pDocRange,
-						unsigned char * pData, UT_uint32 lenData) = 0;
+						unsigned char * pData, UT_uint32 lenData, const char * szEncoding = 0) = 0;
 
 protected:
 	PD_Document *		m_pDocument;
Index: src/wp/impexp/xp/ie_imp_Applix.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/impexp/xp/ie_imp_Applix.cpp,v
retrieving revision 1.10
diff -u -r1.10 ie_imp_Applix.cpp
--- src/wp/impexp/xp/ie_imp_Applix.cpp	2001/05/25 05:52:20	1.10
+++ src/wp/impexp/xp/ie_imp_Applix.cpp	2001/06/17 12:49:03
@@ -710,7 +710,7 @@
 /*****************************************************************/
 
 void IE_Imp_Applix::pasteFromBuffer(PD_DocumentRange * pDocRange,
-				    unsigned char * pData, UT_uint32 lenData)
+				    unsigned char * pData, UT_uint32 lenData, const char * szEncoding)
 {
 	return;
 }
Index: src/wp/impexp/xp/ie_imp_Applix.h
===================================================================
RCS file: /cvsroot/abi/src/wp/impexp/xp/ie_imp_Applix.h,v
retrieving revision 1.7
diff -u -r1.7 ie_imp_Applix.h
--- src/wp/impexp/xp/ie_imp_Applix.h	2001/05/23 13:04:45	1.7
+++ src/wp/impexp/xp/ie_imp_Applix.h	2001/06/17 12:49:04
@@ -61,7 +61,8 @@
 	virtual UT_Error	importFile(const char * szFilename);
 	virtual void		pasteFromBuffer(PD_DocumentRange * pDocRange,
 						unsigned char * pData, 
-						UT_uint32 lenData);
+						UT_uint32 lenData,
+						const char * szEncoding = 0);
 	
 protected:
 	UT_Error			_parseFile(FILE * fp);
Index: src/wp/impexp/xp/ie_imp_GraphicAsDocument.h
===================================================================
RCS file: /cvsroot/abi/src/wp/impexp/xp/ie_imp_GraphicAsDocument.h,v
retrieving revision 1.1
diff -u -r1.1 ie_imp_GraphicAsDocument.h
--- src/wp/impexp/xp/ie_imp_GraphicAsDocument.h	2000/06/21 12:47:00	1.1
+++ src/wp/impexp/xp/ie_imp_GraphicAsDocument.h	2001/06/17 12:49:05
@@ -36,7 +36,7 @@
 
 	virtual UT_Error	importFile(const char * szFilename);
    	void		pasteFromBuffer(PD_DocumentRange * pDocRange,
-					unsigned char * pData, UT_uint32 lenData) {}
+					unsigned char * pData, UT_uint32 lenData, const char * szEncoding = 0) {}
 	void 		setGraphicImporter(IE_ImpGraphic* importer) 
 	     { DELETEP(m_pGraphicImporter); m_pGraphicImporter = importer; }
 
Index: src/wp/impexp/xp/ie_imp_MIF.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/impexp/xp/ie_imp_MIF.cpp,v
retrieving revision 1.4
diff -u -r1.4 ie_imp_MIF.cpp
--- src/wp/impexp/xp/ie_imp_MIF.cpp	2001/05/25 05:52:20	1.4
+++ src/wp/impexp/xp/ie_imp_MIF.cpp	2001/06/17 12:49:06
@@ -197,7 +197,7 @@
 /*****************************************************************/
 
 void IE_Imp_MIF::pasteFromBuffer(PD_DocumentRange * pDocRange,
-								  unsigned char * pData, UT_uint32 lenData)
+								  unsigned char * pData, UT_uint32 lenData, const char * szEncoding)
 {
 	return;
 }
Index: src/wp/impexp/xp/ie_imp_MIF.h
===================================================================
RCS file: /cvsroot/abi/src/wp/impexp/xp/ie_imp_MIF.h,v
retrieving revision 1.2
diff -u -r1.2 ie_imp_MIF.h
--- src/wp/impexp/xp/ie_imp_MIF.h	2001/05/03 00:45:35	1.2
+++ src/wp/impexp/xp/ie_imp_MIF.h	2001/06/17 12:49:08
@@ -55,7 +55,7 @@
 
 	virtual UT_Error	importFile(const char * szFilename);
 	virtual void		pasteFromBuffer(PD_DocumentRange * pDocRange,
-										unsigned char * pData, UT_uint32 lenData);
+										unsigned char * pData, UT_uint32 lenData, const char * szEncoding = 0);
 
 	static bool		RecognizeContents(const char * szBuf, UT_uint32 iNumbytes);
 	static bool		RecognizeSuffix(const char * szSuffix);
Index: src/wp/impexp/xp/ie_imp_MsWord_97.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/impexp/xp/ie_imp_MsWord_97.cpp,v
retrieving revision 1.94
diff -u -r1.94 ie_imp_MsWord_97.cpp
--- src/wp/impexp/xp/ie_imp_MsWord_97.cpp	2001/06/12 20:10:14	1.94
+++ src/wp/impexp/xp/ie_imp_MsWord_97.cpp	2001/06/17 12:49:17
@@ -438,7 +438,7 @@
 }
 
 void IE_Imp_MsWord_97::pasteFromBuffer (PD_DocumentRange *, 
-										unsigned char *, unsigned int)
+										unsigned char *, unsigned int, const char *)
 {
 	// nada
 }
Index: src/wp/impexp/xp/ie_imp_MsWord_97.h
===================================================================
RCS file: /cvsroot/abi/src/wp/impexp/xp/ie_imp_MsWord_97.h,v
retrieving revision 1.30
diff -u -r1.30 ie_imp_MsWord_97.h
--- src/wp/impexp/xp/ie_imp_MsWord_97.h	2001/06/08 16:07:10	1.30
+++ src/wp/impexp/xp/ie_imp_MsWord_97.h	2001/06/17 12:49:18
@@ -69,7 +69,7 @@
 
 	UT_Error			importFile (const char * szFilename);
 	void                pasteFromBuffer (PD_DocumentRange *, 
-										 unsigned char *, unsigned int);
+										 unsigned char *, unsigned int, const char * szEncoding = 0);
 
    	// wv's callbacks need access to these, so they have to be public
 	int             _specCharProc (wvParseStruct *ps, UT_uint16 eachchar, 
Index: src/wp/impexp/xp/ie_imp_PalmDoc.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/impexp/xp/ie_imp_PalmDoc.cpp,v
retrieving revision 1.6
diff -u -r1.6 ie_imp_PalmDoc.cpp
--- src/wp/impexp/xp/ie_imp_PalmDoc.cpp	2001/05/25 05:52:20	1.6
+++ src/wp/impexp/xp/ie_imp_PalmDoc.cpp	2001/06/17 12:49:19
@@ -353,7 +353,7 @@
 /*****************************************************************/
 
 void IE_Imp_PalmDoc::pasteFromBuffer(PD_DocumentRange * pDocRange,
-				     unsigned char * pData, UT_uint32 lenData)
+				     unsigned char * pData, UT_uint32 lenData, const char * szEncoding)
 {
 }
 
Index: src/wp/impexp/xp/ie_imp_PalmDoc.h
===================================================================
RCS file: /cvsroot/abi/src/wp/impexp/xp/ie_imp_PalmDoc.h,v
retrieving revision 1.4
diff -u -r1.4 ie_imp_PalmDoc.h
--- src/wp/impexp/xp/ie_imp_PalmDoc.h	2001/05/03 18:53:31	1.4
+++ src/wp/impexp/xp/ie_imp_PalmDoc.h	2001/06/17 12:49:20
@@ -57,7 +57,7 @@
 
 	virtual UT_Error	importFile(const char * szFilename);
 	virtual void		pasteFromBuffer(PD_DocumentRange * pDocRange,
-										unsigned char * pData, UT_uint32 lenData);
+										unsigned char * pData, UT_uint32 lenData, const char * szEncoding = 0);
 	
 protected:
 	UT_Error			_parseFile(FILE * fp);
Index: src/wp/impexp/xp/ie_imp_Psion.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/impexp/xp/ie_imp_Psion.cpp,v
retrieving revision 1.8
diff -u -r1.8 ie_imp_Psion.cpp
--- src/wp/impexp/xp/ie_imp_Psion.cpp	2001/05/25 05:52:20	1.8
+++ src/wp/impexp/xp/ie_imp_Psion.cpp	2001/06/17 12:49:25
@@ -913,7 +913,7 @@
 }
 
 void IE_Imp_Psion::pasteFromBuffer(PD_DocumentRange * pDocRange,
-                                   unsigned char * pData, UT_uint32 lenData)
+                                   unsigned char * pData, UT_uint32 lenData, const char * szEncoding)
 {
 	UT_ASSERT(UT_NOT_IMPLEMENTED);
 }
Index: src/wp/impexp/xp/ie_imp_Psion.h
===================================================================
RCS file: /cvsroot/abi/src/wp/impexp/xp/ie_imp_Psion.h,v
retrieving revision 1.4
diff -u -r1.4 ie_imp_Psion.h
--- src/wp/impexp/xp/ie_imp_Psion.h	2001/05/03 00:45:36	1.4
+++ src/wp/impexp/xp/ie_imp_Psion.h	2001/06/17 12:49:25
@@ -42,7 +42,8 @@
 	virtual UT_Error	importFile(const char * szFilename);
 	virtual void        pasteFromBuffer(PD_DocumentRange * pDocRange,
 	                                    unsigned char * pData, 
-	                                    UT_uint32 lenData);
+	                                    UT_uint32 lenData,
+										const char * szEncoding = 0);
 
 protected:
 		bool			getCharacterAttributes(psiconv_character_layout layout, UT_ByteBuf *props);
Index: src/wp/impexp/xp/ie_imp_RTF.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/impexp/xp/ie_imp_RTF.cpp,v
retrieving revision 1.73
diff -u -r1.73 ie_imp_RTF.cpp
--- src/wp/impexp/xp/ie_imp_RTF.cpp	2001/06/11 12:04:18	1.73
+++ src/wp/impexp/xp/ie_imp_RTF.cpp	2001/06/17 12:49:41
@@ -4148,7 +4151,7 @@
 //////////////////////////////////////////////////////////////////
 
 void IE_Imp_RTF::pasteFromBuffer(PD_DocumentRange * pDocRange,
-								 unsigned char * pData, UT_uint32 lenData)
+								 unsigned char * pData, UT_uint32 lenData, const char * /* szEncoding */)
 {
 	UT_ASSERT(m_pDocument == pDocRange->m_pDoc);
 	UT_ASSERT(pDocRange->m_pos1 == pDocRange->m_pos2);
Index: src/wp/impexp/xp/ie_imp_RTF.h
===================================================================
RCS file: /cvsroot/abi/src/wp/impexp/xp/ie_imp_RTF.h,v
retrieving revision 1.37
diff -u -r1.37 ie_imp_RTF.h
--- src/wp/impexp/xp/ie_imp_RTF.h	2001/06/11 11:27:01	1.37
+++ src/wp/impexp/xp/ie_imp_RTF.h	2001/06/17 12:49:43
@@ -233,7 +233,7 @@
 
 	virtual UT_Error	importFile(const char * szFilename);
 	virtual void		pasteFromBuffer(PD_DocumentRange * pDocRange,
-										unsigned char * pData, UT_uint32 lenData);
+										unsigned char * pData, UT_uint32 lenData, const char * szEncoding = 0);
 
 protected:
 	UT_Error			_parseFile(FILE * fp);
Index: src/wp/impexp/xp/ie_imp_Text.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/impexp/xp/ie_imp_Text.cpp,v
retrieving revision 1.29
diff -u -r1.29 ie_imp_Text.cpp
--- src/wp/impexp/xp/ie_imp_Text.cpp	2001/06/14 14:25:26	1.29
+++ src/wp/impexp/xp/ie_imp_Text.cpp	2001/06/17 12:49:46
@@ -41,7 +41,8 @@
  */
 ImportStream::ImportStream() :
 	m_ucsLookAhead(0),
-	m_bEOF(false)
+	m_bEOF(false),
+	m_bRaw(false)
 {
 }
 
@@ -49,12 +50,16 @@
   Initialize ImportStream
  \param szEncoding Text encoding to convert from
 
- Sets encoding and prefetches lookahead character
+ Sets encoding and prefetches lookahead character.
+ Set to 0 to handle raw bytes.
  */
 bool ImportStream::init(const char *szEncoding)
 {
-	UT_ASSERT(szEncoding);
-	m_Mbtowc.setInCharset(szEncoding);
+	if (szEncoding)
+		m_Mbtowc.setInCharset(szEncoding);
+	else
+		m_bRaw = true;
+
 	UT_UCSChar dummy;
 	return getChar(dummy);
 }
@@ -95,6 +100,11 @@
 			m_bEOF = true;
 			break;
 		}
+		else if (m_bRaw)
+		{
+			wc = b;
+			break;
+		}
 
 	} while (!m_Mbtowc.mbtowc(wc,b));
 
@@ -147,21 +157,6 @@
 	return true;
 }
 
-// Helper class so we can parse files and clipboard with same code
-
-class Inserter
-{
-public:
-	Inserter(PD_Document * pDocument);
-	Inserter(PD_Document * pDocument, PT_DocPosition dPos);
-	bool insertBlock();
-	bool insertSpan(UT_GrowBuf &b);
-private:
-	PD_Document * m_pDocument;
-	bool m_bClipboard;
-	PT_DocPosition m_dPos;
-};
-
 /*!
   Construct Inserter helper class
  \param pDocument Document to insert data into
@@ -245,13 +240,9 @@
 	bSuccess = _recognizeUTF8(szBuf, iNumbytes);
 
 	if (bSuccess == false)
-	{
 		if (_recognizeUCS2(szBuf, iNumbytes, false) != UE_NotUCS)
-		{
 			bSuccess = true;
-		}
-	}
-	
+
 	return bSuccess;
 }
 
@@ -487,10 +478,11 @@
 	// Call encoding dialog
 	if (!m_bIsEncoded || _doEncodingDialog(m_szEncoding))
 	{
-		ImportStreamFile stream(fp);
+		ImportStream *pStream = 0;
+		X_CleanupIfError(error,_constructStream(pStream,fp));
 		Inserter ins(m_pDocument);
 		X_CleanupIfError(error,_writeHeader(fp));
-		X_CleanupIfError(error,_parseStream(stream,ins));
+		X_CleanupIfError(error,_parseStream(pStream,ins));
 		error = UT_OK;
 	}
 	else
@@ -562,9 +554,7 @@
 UT_Error IE_Imp_Text::_recognizeEncoding(const char *szBuf, UT_uint32 iNumbytes)
 {
 	if (IE_Imp_Text_Sniffer::_recognizeUTF8(szBuf, iNumbytes))
-	{
 		_setEncoding("UTF-8");
-	}
 	else
 	{
 		IE_Imp_Text_Sniffer::UCS2_Endian eUcs2 = IE_Imp_Text_Sniffer::UE_NotUCS;
@@ -581,6 +571,18 @@
 }
 
 /*!
+  Create a stream of the appropriate type
+ \param pStream Pointer to created stream
+ \param fp File to construct stream from
+
+ Override this virtual function to derive from the text importer
+ */
+UT_Error IE_Imp_Text::_constructStream(ImportStream *& pStream, FILE * fp)
+{
+	return (pStream = new ImportStreamFile(fp)) ? UT_OK : UT_IE_NOMEMORY;
+}
+
+/*!
   Write header to document
 
  Writes the minimum needed Section and Block before we begin import
@@ -600,14 +602,16 @@
 
  This code is used for both files and the clipboard
  */
-UT_Error IE_Imp_Text::_parseStream(ImportStream & stream, Inserter & ins)
+UT_Error IE_Imp_Text::_parseStream(ImportStream * pStream, Inserter & ins)
 {
+	UT_ASSERT(pStream);
+
 	UT_GrowBuf gbBlock(1024);
 	UT_UCSChar c;
 
-	stream.init(m_szEncoding);
+	pStream->init(m_szEncoding);
 
-	while (stream.getChar(c))
+	while (pStream->getChar(c))
 	{
 		// TODO We should switch fonts when we encounter
 		// TODO characters from different scripts
@@ -631,7 +635,7 @@
 			X_ReturnNoMemIfError(gbBlock.append(&c,1));
 			break;
 		}
-	} 
+	}
 
 	if (gbBlock.getLength() > 0)
 		X_ReturnNoMemIfError(ins.insertSpan(gbBlock));
@@ -686,20 +690,20 @@
 }
 
 /*!
-  Set exporter's encoding and related members
+  Set importer's encoding and related members
  \param szEncoding Encoding to export file into
 
- Decides endian and BOM policy based on encoding
+ Decides endian and BOM policy based on encoding.
+ Set to 0 to handle raw bytes.
+ This function should be identical to the one in IE_Exp_Text.
  */
 void IE_Imp_Text::_setEncoding(const char *szEncoding)
 {
-	UT_ASSERT(szEncoding);
-
 	m_szEncoding = szEncoding;
 
 	// TODO Should BOM use be a user pref?
 	// TODO Does Mac OSX prefer BOMs?
-	if (!strcmp(m_szEncoding,XAP_EncodingManager::get_instance()->getUCS2LEName()))
+	if (szEncoding && !strcmp(szEncoding,XAP_EncodingManager::get_instance()->getUCS2LEName()))
 	{
 		m_bIs16Bit = true;
 		m_bBigEndian = false;
@@ -709,7 +713,7 @@
 		m_bUseBOM = false;
 #endif
 	}
-	else if (!strcmp(m_szEncoding,XAP_EncodingManager::get_instance()->getUCS2BEName()))
+	else if (szEncoding && !strcmp(szEncoding,XAP_EncodingManager::get_instance()->getUCS2BEName()))
 	{
 		m_bIs16Bit = true;
 		m_bBigEndian = true;
@@ -740,17 +744,21 @@
 // TODO always interpreted using the system default encoding which can be wrong.
 
 void IE_Imp_Text::pasteFromBuffer(PD_DocumentRange * pDocRange,
-								  unsigned char * pData, UT_uint32 lenData)
+								  unsigned char * pData, UT_uint32 lenData,
+								  const char *szEncoding)
 {
 	UT_ASSERT(m_pDocument == pDocRange->m_pDoc);
 	UT_ASSERT(pDocRange->m_pos1 == pDocRange->m_pos2);
 
 	// Attempt to guess whether we're pasting 8 bit or unicode text
-	_recognizeEncoding((const char *)pData, lenData);
+	if (szEncoding)
+		_setEncoding(szEncoding);
+	else
+		_recognizeEncoding((const char *)pData, lenData);
 
 	ImportStreamClipboard stream(pData, lenData);
 	Inserter ins(m_pDocument, pDocRange->m_pos1);
 
-	_parseStream(stream,ins);
+	_parseStream(&stream, ins);
 }
 
Index: src/wp/impexp/xp/ie_imp_Text.h
===================================================================
RCS file: /cvsroot/abi/src/wp/impexp/xp/ie_imp_Text.h,v
retrieving revision 1.16
diff -u -r1.16 ie_imp_Text.h
--- src/wp/impexp/xp/ie_imp_Text.h	2001/06/14 14:25:26	1.16
+++ src/wp/impexp/xp/ie_imp_Text.h	2001/06/17 12:49:47
@@ -23,55 +23,26 @@
 
 #include <stdio.h>
 #include "ie_imp.h"
-#include"ut_mbtowc.h"
-class PD_Document;
+#include "ut_mbtowc.h"
+#include "pd_Document.h"
 
-// The importer/reader for Plain Text Files.
-
-class IE_Imp_Text_Sniffer : public IE_ImpSniffer
-{
-	friend class IE_Imp;
-	friend class IE_Imp_Text;
-
-public:
-	IE_Imp_Text_Sniffer() {}
-	virtual ~IE_Imp_Text_Sniffer() {}
-
-	virtual bool recognizeContents (const char * szBuf, 
-									UT_uint32 iNumbytes);
-	virtual bool recognizeSuffix (const char * szSuffix);
-	virtual bool getDlgLabels (const char ** szDesc,
-							   const char ** szSuffixList,
-							   IEFileType * ft);
-	virtual UT_Error constructImporter (PD_Document * pDocument,
-										IE_Imp ** ppie);
-
-protected:
-	enum UCS2_Endian { UE_BigEnd = -1, UE_NotUCS = 0, UE_LittleEnd };
-
-	static bool _recognizeUTF8 (const char * szBuf,
-								UT_uint32 iNumbytes);
-	static UCS2_Endian _recognizeUCS2 (const char * szBuf,
-									   UT_uint32 iNumbytes,
-									   bool bDeep);
-};
-
 // Stream class can be File or Clipboard
 
 class ImportStream
 {
 public:
 	ImportStream();
-	virtual ~ImportStream() {};
+	virtual ~ImportStream() {}
 	bool init(const char *szEncoding);
 	bool getChar(UT_UCSChar &b);
 	UT_UCSChar peekChar() { return m_ucsLookAhead; }
-private:
+protected:
 	virtual bool _getByte(unsigned char &b) = 0;
-	bool getRawChar(UT_UCSChar &b);
+	virtual bool getRawChar(UT_UCSChar &b);
 	UT_Mbtowc m_Mbtowc;
 	UT_UCSChar m_ucsLookAhead;
 	bool m_bEOF;
+	bool m_bRaw;
 };
 
 // File stream class
@@ -80,10 +51,11 @@
 {
 public:
 	ImportStreamFile(FILE *pFile);
-	~ImportStreamFile() {};
+	~ImportStreamFile() {}
 	bool getChar();
-private:
+protected:
 	bool _getByte(unsigned char &b);
+private:
 	FILE *m_pFile;
 };
 
@@ -95,12 +67,58 @@
 	ImportStreamClipboard(unsigned char *pClipboard, UT_uint32 iLength);
 	~ImportStreamClipboard() {};
 	bool getChar();
-private:
+protected:
 	bool _getByte(unsigned char &b);
+private:
 	unsigned char *m_p;
 	unsigned char *m_pEnd;
 };
 
+// Helper class so we can parse files and clipboard with same code
+
+class Inserter
+{
+public:
+	Inserter(PD_Document * pDocument);
+	Inserter(PD_Document * pDocument, PT_DocPosition dPos);
+	bool insertBlock();
+	bool insertSpan(UT_GrowBuf &b);
+private:
+	PD_Document * m_pDocument;
+	bool m_bClipboard;
+	PT_DocPosition m_dPos;
+};
+
+// The importer/reader for Plain Text Files.
+
+class IE_Imp_Text_Sniffer : public IE_ImpSniffer
+{
+	friend class IE_Imp;
+	friend class IE_Imp_Text;
+
+public:
+	IE_Imp_Text_Sniffer() {}
+	virtual ~IE_Imp_Text_Sniffer() {}
+
+	virtual bool recognizeContents (const char * szBuf,
+									UT_uint32 iNumbytes);
+	virtual bool recognizeSuffix (const char * szSuffix);
+	virtual bool getDlgLabels (const char ** szDesc,
+							   const char ** szSuffixList,
+							   IEFileType * ft);
+	virtual UT_Error constructImporter (PD_Document * pDocument,
+										IE_Imp ** ppie);
+
+protected:
+	enum UCS2_Endian { UE_BigEnd = -1, UE_NotUCS = 0, UE_LittleEnd };
+
+	static bool _recognizeUTF8 (const char * szBuf,
+								UT_uint32 iNumbytes);
+	static UCS2_Endian _recognizeUCS2 (const char * szBuf,
+									   UT_uint32 iNumbytes,
+									   bool bDeep);
+};
+
 // The importer/reader for Plain Text Files with selectable encoding.
 
 class IE_Imp_EncodedText_Sniffer : public IE_Imp_Text_Sniffer
@@ -130,13 +148,14 @@
 
 	virtual UT_Error	importFile(const char * szFilename);
 	virtual void		pasteFromBuffer(PD_DocumentRange * pDocRange,
-										unsigned char * pData, UT_uint32 lenData);
-	
+										unsigned char * pData, UT_uint32 lenData, const char * szEncoding = 0);
+
 protected:
 	UT_Error			_recognizeEncoding(FILE * fp);
 	UT_Error			_recognizeEncoding(const char *szBuf, UT_uint32 iNumbytes);
-	UT_Error			_parseStream(ImportStream & stream, class Inserter & ins);
+	virtual UT_Error	_constructStream(ImportStream *& pStream, FILE * fp);
 	UT_Error			_writeHeader(FILE * fp);
+	UT_Error			_parseStream(ImportStream * pStream, class Inserter & ins);
 	bool				_doEncodingDialog(const char *szEncoding);
 	void				_setEncoding(const char *szEncoding);
 
Index: src/wp/impexp/xp/ie_imp_XML.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/impexp/xp/ie_imp_XML.cpp,v
retrieving revision 1.23
diff -u -r1.23 ie_imp_XML.cpp
--- src/wp/impexp/xp/ie_imp_XML.cpp	2001/06/12 20:10:14	1.23
+++ src/wp/impexp/xp/ie_imp_XML.cpp	2001/06/17 12:49:53
@@ -499,7 +495,7 @@
 }
 
 void IE_Imp_XML::pasteFromBuffer(PD_DocumentRange * pDocRange,
-				       unsigned char * pData, UT_uint32 lenData)
+				       unsigned char * pData, UT_uint32 lenData, const char * szEncoding)
 {
 	UT_ASSERT(UT_NOT_IMPLEMENTED);
 }
Index: src/wp/impexp/xp/ie_imp_XML.h
===================================================================
RCS file: /cvsroot/abi/src/wp/impexp/xp/ie_imp_XML.h,v
retrieving revision 1.15
diff -u -r1.15 ie_imp_XML.h
--- src/wp/impexp/xp/ie_imp_XML.h	2001/05/07 06:49:06	1.15
+++ src/wp/impexp/xp/ie_imp_XML.h	2001/06/17 12:49:54
@@ -49,7 +49,8 @@
     virtual UT_Error	importFile(const char * szFilename);
     virtual void	pasteFromBuffer(PD_DocumentRange * pDocRange,
 					unsigned char * pData, 
-					UT_uint32 lenData);
+					UT_uint32 lenData,
+					const char * szEncoding = 0);
 
     // the following are public only so that the
     // XML parser callback routines can access them.
Index: src/wp/impexp/xp/ie_impexp_Register.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/impexp/xp/ie_impexp_Register.cpp,v
retrieving revision 1.2
diff -u -r1.2 ie_impexp_Register.cpp
--- src/wp/impexp/xp/ie_impexp_Register.cpp	2001/06/08 16:07:10	1.2
+++ src/wp/impexp/xp/ie_impexp_Register.cpp	2001/06/17 12:49:59
@@ -39,6 +39,7 @@
 #include "ie_exp_Psion.h"
 #include "ie_exp_Applix.h"
 #include "ie_exp_XSL-FO.h"
+#include "ie_exp_ISCII.h"
 
 #include "ie_imp_AbiWord_1.h"
 #include "ie_imp_GZipAbiWord.h"
@@ -53,6 +54,7 @@
 #include "ie_imp_Psion.h"
 #include "ie_imp_XSL-FO.h"
 #include "ie_imp_Applix.h"
+#include "ie_imp_ISCII.h"
 
 
 /*!
@@ -74,8 +76,10 @@
 	IE_Imp::registerImporter(new IE_Imp_Psion_Word_Sniffer ());
 	IE_Imp::registerImporter(new IE_Imp_RTF_Sniffer ());
 	IE_Imp::registerImporter(new IE_Imp_Text_Sniffer ());
+	IE_Imp::registerImporter(new IE_Imp_EncodedText_Sniffer ());
 	IE_Imp::registerImporter(new IE_Imp_WML_Sniffer ());
 	IE_Imp::registerImporter(new IE_Imp_GZipAbiWord_Sniffer ());
+	IE_Imp::registerImporter(new IE_Imp_ISCII_Sniffer ());
 	
 	IE_Exp::registerExporter(new IE_Exp_AbiWord_1_Sniffer ());
 	IE_Exp::registerExporter(new IE_Exp_Applix_Sniffer ());
@@ -93,8 +97,10 @@
 	IE_Exp::registerExporter(new IE_Exp_RTF_Sniffer ());
 	IE_Exp::registerExporter(new IE_Exp_RTF_attic_Sniffer ());
 	IE_Exp::registerExporter(new IE_Exp_Text_Sniffer ());
+	IE_Exp::registerExporter(new IE_Exp_EncodedText_Sniffer ());
 	IE_Exp::registerExporter(new IE_Exp_HRText_Sniffer ());
 	IE_Exp::registerExporter(new IE_Exp_WML_Sniffer ());
 	IE_Exp::registerExporter(new IE_Exp_GZipAbiWord_Sniffer ());
+	IE_Exp::registerExporter(new IE_Exp_ISCII_Sniffer ());
 }
     
