? c.sh
? changes.diff
? code
? diff.txg
? diff.txt
? out.txt
? table.txt
? unicode.diff
? src/af/ev/win/vc80.pdb
? src/af/ev/xp/vc80.pdb
? src/af/gr/win/vc80.pdb
? src/af/gr/xp/vc80.pdb
? src/af/util/win/make.exe.stackdump
? src/af/util/win/vc80.pdb
? src/af/util/win/win32.txt
? src/af/util/xp/make.exe.stackdump
? src/af/util/xp/ut_iconv.txt
? src/af/util/xp/vc80.pdb
? src/af/xap/diff.txt
? src/af/xap/win/ano.txt
? src/af/xap/win/diff.txt
? src/af/xap/win/vc80.pdb
? src/af/xap/xp/diff.txt
? src/af/xap/xp/make.exe.stackdump
? src/af/xap/xp/vc80.pdb
? src/other/spell/xp/vc80.pdb
? src/text/fmt/xp/vc80.pdb
? src/text/ptbl/xp/vc80.pdb
? src/tools/make.exe.stackdump
? src/tools/cdump/xp/vc80.pdb
? src/tools/po2str/xp/vc80.pdb
? src/wp/ap/win/ap_Win32UIString.h
? src/wp/ap/win/vc80.pdb
? src/wp/ap/xp/vc80.pdb
? src/wp/impexp/win/vc80.pdb
? src/wp/impexp/xp/vc80.pdb
? src/wp/main/win/vc80.pdb
? src/wp/main/xp/vc80.pdb
Index: src/af/ev/win/ev_Win32Keyboard.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/ev/win/ev_Win32Keyboard.cpp,v
retrieving revision 1.53
diff -u -r1.53 ev_Win32Keyboard.cpp
--- src/af/ev/win/ev_Win32Keyboard.cpp	8 Feb 2007 14:49:47 -0000	1.53
+++ src/af/ev/win/ev_Win32Keyboard.cpp	9 Apr 2007 08:36:48 -0000
@@ -21,6 +21,7 @@
 #include <windows.h>
 #include <stdlib.h>
 #include <ctype.h>
+#include <tchar.h>
 
 #include "ut_assert.h"
 #include "ut_types.h"
@@ -80,13 +81,13 @@
 	  m_bWasAnAbiCommand(false)
 {
 	HINSTANCE hInstUser;
-	if (hInstUser = LoadLibrary("USER32.DLL"))
+	if (hInstUser = LoadLibrary(_T("USER32.DLL")))
 	{
 		m_pToUnicodeEx = reinterpret_cast<int (*)(UINT,UINT,CONST PBYTE,LPWSTR,int,UINT,HKL)>
 			(GetProcAddress(hInstUser, "ToUnicodeEx"));
 		FreeLibrary(hInstUser);
 	}
-	
+
 	remapKeyboard(GetKeyboardLayout(0));
 }
 
@@ -106,10 +107,11 @@
 		UT_iconv_close( m_iconv );
 		m_iconv = UT_ICONV_INVALID;
 	}
+	
 	if( hKeyboardLayout != 0 )
 	{
 		strcpy( szCodePage, "CP" );
-		if( GetLocaleInfo( LOWORD( hKeyboardLayout ),
+		if( GetLocaleInfoA( LOWORD( hKeyboardLayout ),
 						   LOCALE_IDEFAULTANSICODEPAGE,
 						   &szCodePage[2],
 						   sizeof( szCodePage ) / sizeof( szCodePage[0] ) - 2 ))
Index: src/af/ev/win/ev_Win32Menu.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/ev/win/ev_Win32Menu.cpp,v
retrieving revision 1.64
diff -u -r1.64 ev_Win32Menu.cpp
--- src/af/ev/win/ev_Win32Menu.cpp	7 Apr 2007 19:56:20 -0000	1.64
+++ src/af/ev/win/ev_Win32Menu.cpp	9 Apr 2007 08:36:50 -0000
@@ -42,6 +42,7 @@
 #include "xap_Win32App.h"
 #include "xap_Win32Toolbar_Icons.h"
 #include "ap_Win32App.h"
+#include "ut_Win32LocaleString.h"
 
 #define SPACE_ICONTEXT	4	// Pixels between the icon and the text
 
@@ -124,27 +125,31 @@
 /*
 
 */
-static const char * _ev_GetLabelName(XAP_Win32App * pWin32App,
+static const TCHAR * _ev_GetLabelName(XAP_Win32App * pWin32App,
 									 XAP_Frame * pFrame, 
 									 const EV_EditEventMapper * pEEM,
 									 const EV_Menu_Action * pAction,
 									 EV_Menu_Label * pLabel)
 {
-	const char * szLabelName;
+	const TCHAR * szLabelName;
+	const char * szLabelName_utf8;
 	
 	if (pAction->hasDynamicLabel())
-		szLabelName = pAction->getDynamicLabel(pLabel);
+		szLabelName_utf8 = pAction->getDynamicLabel(pLabel);
 	else
-		szLabelName = pLabel->getMenuLabel();
+		szLabelName_utf8 = pLabel->getMenuLabel();
 
-	if (!szLabelName || !*szLabelName)
-		return NULL;
+	if (!szLabelName_utf8 || !*szLabelName_utf8)
+		return NULL;		
 
-	UT_String str = AP_Win32App::s_fromUTF8ToWinLocale(szLabelName);
+	UT_Win32LocaleString str;
+	str.fromUTF8 (szLabelName_utf8);
 	szLabelName = str.c_str();
-
 	
-	const char * szShortcut = NULL;
+	const char * szShortcut_ascii = NULL;
+	const TCHAR * szShortcut = NULL;
+	UT_Win32LocaleString shortcut;
+	
 	int len = 0;
 
 	if (pEEM)
@@ -160,35 +165,41 @@
 			EV_EditMethod * pEM = pEMC->findEditMethodByName(szMethodName);
 			UT_ASSERT(pEM);					// make sure it's bound to something
 
-			szShortcut = pEEM->getShortcutFor(pEM);
-			if (szShortcut && *szShortcut)
-				len = strlen(szShortcut) + 1;	// extra char is for the tab
+			szShortcut_ascii = pEEM->getShortcutFor(pEM);
+			if (szShortcut_ascii && *szShortcut_ascii)
+				len = strlen(szShortcut_ascii) + 1;	// extra char is for the tab
 		}
 	}
 	
+	if (szShortcut && *szShortcut) {
+		shortcut.fromASCII (szShortcut_ascii);
+	}
+	
+	
 	if (pAction->raisesDialog())
 		len += 4;
 
 	if (!len)
 	{
-		static char buf[128];
-		strcpy(buf,szLabelName);
+		static TCHAR buf[128];
+		_tcscpy(buf,szLabelName);
 		return buf;
 	}
 
-	static char buf[128];
-	memset(buf,0,NrElements(buf));
-	strncpy(buf,szLabelName,NrElements(buf)-len);
+	static TCHAR buf[128];
+	int l = NrElements(buf);
+	memset(buf,0,l);
+	_tcscpy(buf,szLabelName);
 
 	// append "..." to menu item if it raises a dialog
 	if (pAction->raisesDialog())
-		strcat(buf,"...");
+		_tcscat(buf,_T("..."));
 
 	// append shortcut mnemonic, if any
-	if (szShortcut && *szShortcut)
+	if (shortcut.length())
 	{
-		strcat(buf, "\t");
-		strcat(buf, szShortcut);
+		_tcscat(buf, _T("\t"));
+		_tcscat(buf, shortcut.c_str());
 	}
 										  
 	return buf;
@@ -336,7 +347,7 @@
 
 		// get the name for the menu item
 
-		const char * szLabelName = _ev_GetLabelName(m_pWin32App,pFrame,m_pEEM,pAction,pLabel);
+		const TCHAR * szLabelName = _ev_GetLabelName(m_pWin32App,pFrame,m_pEEM,pAction,pLabel);
 		
 		switch (pLayoutItem->getMenuLayoutFlags())
 		{
@@ -379,13 +390,13 @@
 						item->id = id;					
 						item->pMenu= this;							
 						
-						strcpy (item->szText, szLabelName);					
+						_tcscpy (item->szText, szLabelName);					
 						m_vecItems.addItem(item);
 							
 						if (!m_bTrack && stack.getDepth()==2)
 							AppendMenu(m, flags,u, szLabelName);
 						else
-							AppendMenu(m, flags|MF_OWNERDRAW,u, (const char*) item);
+							AppendMenu(m, flags|MF_OWNERDRAW,u, (const TCHAR*) item);
 					}		
 						
 				}
@@ -396,10 +407,10 @@
 						EV_Menu_Item*	item = new EV_Menu_Item;
 						item->id = id;
 						item->pMenu= this;						
-						strcpy (item->szText, szLabelName);
+						_tcscpy (item->szText, szLabelName);
 						m_vecItems.addItem(item);
 
-						AppendMenu(m, MF_OWNERDRAW , u, (const char*) item);
+						AppendMenu(m, MF_OWNERDRAW , u, (const TCHAR*) item);
 					}
 				}
 
@@ -514,7 +525,7 @@
 				// get the current menu info for this item.
 				
 				MENUITEMINFO mif;
-				char bufMIF[128];
+				TCHAR bufMIF[128];
 				mif.cbSize = sizeof(mif);
 				mif.dwTypeData = bufMIF;
 				mif.cch = NrElements(bufMIF)-1;
@@ -525,7 +536,7 @@
 				// compute the value for the label.
 				// if it is blank, we remove the item from the menu.
 
-				const char * szLabelName = _ev_GetLabelName(m_pWin32App,pFrame,m_pEEM,pAction,pLabel);
+				const TCHAR * szLabelName = _ev_GetLabelName(m_pWin32App,pFrame,m_pEEM,pAction,pLabel);
 
 				BOOL bRemoveIt = (!szLabelName || !*szLabelName);
 
@@ -550,7 +561,7 @@
 						item = (EV_Menu_Item*)m_vecItems.getNthItem(i);
 						if (id==item->id)
 						{
-							strcpy (item->szText, szLabelName);					
+							_tcscpy (item->szText, szLabelName);					
 							//UT_DEBUGMSG(("Menu changing text->%s\n",szLabelName));
 							break;
 						}
@@ -561,10 +572,10 @@
 					EV_Menu_Item*	item = new EV_Menu_Item;
 					item->id = id;					
 					item->pMenu= this;													
-					strcpy (item->szText, szLabelName);					
+					_tcscpy (item->szText, szLabelName);					
 					m_vecItems.addItem(item);
 					//UT_DEBUGMSG(("Menu adding menu->%s\n",szLabelName));
-					AppendMenu(m, MF_OWNERDRAW,cmd, (const char*) item);					
+					AppendMenu(m, MF_OWNERDRAW,cmd, (const TCHAR*) item);
 				}
 				
 				EV_Menu_ItemState mis = pAction->getMenuItemState(pView);
@@ -717,7 +728,7 @@
 	HMENU hMenu = (HMENU) lParam;
 	MENUITEMINFO	menuInfo;
 	int nItems = GetMenuItemCount(hMenu);
-	char szBuff[1024];
+	TCHAR szBuff[1024];
 	
 	for (int i=0; i<nItems; i++)
 	{					
@@ -731,18 +742,19 @@
 
 		if (item)
 		{
-			strcpy (szBuff, item->szText);
-			strlwr(szBuff);			
+			_tcscpy (szBuff, item->szText);
+			_tcslwr(szBuff);			
 
-			char* pHotKeyPos = strchr (szBuff, '&');
+			TCHAR* pHotKeyPos = _tcschr (szBuff, _T('&'));
 				
 			if (pHotKeyPos)
-			{								
-				char n = (char)wParam & 0x000000ff;
+			{					
+				//POSSIBLE BUG?			
+				TCHAR n = (TCHAR)wParam & 0x000000ff;
 
 				pHotKeyPos++;
 
-				if (toupper(*pHotKeyPos)==toupper(n))			
+				if (_totupper(*pHotKeyPos)==_totupper(n))			
 					return MAKELRESULT(i, MNC_EXECUTE);														 
 				
 			}
@@ -764,11 +776,11 @@
     COLORREF crBkgnd;   
 	DWORD dwColor;
 	int x = 255, y=255;									
-	RECT rect;
-	UT_String sTextRight, sTextLeft;
+	RECT rect;	
 	HBITMAP hBitmap;	
 	int colorID;
-	UT_ASSERT(lpdis->CtlType==ODT_MENU); 						
+	UT_ASSERT(lpdis->CtlType==ODT_MENU);
+	UT_Win32LocaleString sTextRight, sTextLeft;
 
 	/* Rect to draw the text */	
 	rect.top =  lpdis->rcItem.top;
@@ -827,23 +839,23 @@
 	/* 
 		Process tabs
 	*/	
-	char* pTabPos = strchr (item->szText, '\t');
+	TCHAR* pTabPos = _tcschr (item->szText, _T('\t'));
 
 	if (pTabPos)
 	{
-		char szTmp[255];
-		char* pTmp;
+		TCHAR szTmp[255];
+		TCHAR* pTmp;
 		
-		strncpy (szTmp, item->szText, pTabPos-item->szText);
+		_tcsncpy (szTmp, item->szText, pTabPos-item->szText);
 		pTmp = szTmp; pTmp+=pTabPos-item->szText; *pTmp=NULL;
-		sTextLeft = szTmp;
+		sTextLeft.fromLocale (szTmp);
 		
-		strcpy (szTmp, pTabPos+1);
-		sTextRight = szTmp;
-		sTextRight +="  ";
+		_tcscpy (szTmp, pTabPos+1);
+		sTextRight.fromLocale (szTmp);
+		sTextRight.appendASCII ("  ");
 	}
 	else
-		sTextLeft = item->szText;		
+		sTextLeft.fromLocale (item->szText);
 	
 	if (lpdis->itemState & ODS_SELECTED) 
 		crBkgnd = SetBkColor(lpdis->hDC, GetSysColor(COLOR_HIGHLIGHT));
@@ -958,8 +970,9 @@
 	if (!szMsg || !*szMsg)
 		szMsg = "TODO This menu item doesn't have a StatusMessage defined.";
 	
-	UT_String str = AP_Win32App::s_fromUTF8ToWinLocale(szMsg);
-	pFrame->setStatusMessage(str.c_str());
+	UT_Win32LocaleString str;
+	str.fromUTF8(szMsg);
+	pFrame->setStatusMessage( (char *)str.c_str());
 	return true;
 }
 
@@ -992,14 +1005,14 @@
 	// make the menubar to layout RTL
 	// see http://www.microsoft.com/middleeast/msdn/faq.aspx
 	MENUITEMINFO mii;
-	char buff[81];
-	memset(buff,80,' ');
-	buff[80] = 0;
+	TCHAR buff[81];
+	memset(buff,80 * sizeof (TCHAR) , _T(' '));
+	buff[80* sizeof (TCHAR)] = 0;
 	
 	mii.cbSize = sizeof(mii);
 	mii.dwTypeData = buff;
 	mii.fType = MF_STRING;
-	mii.cch = 80;
+	mii.cch = 80* sizeof (TCHAR);
 	mii.fState = MFS_DEFAULT;
 	mii.fMask = MIIM_ID | MIIM_DATA | MIIM_TYPE | MIIM_SUBMENU;
 	
@@ -1040,14 +1053,14 @@
 	// make the menubar to layout RTL
 	// see http://www.microsoft.com/middleeast/msdn/faq.aspx
 	MENUITEMINFO mii;
-	char buff[81];
-	memset(buff,80,' ');
-	buff[80] = 0;
+	TCHAR buff[81];
+	memset(buff, 80 * sizeof (TCHAR), _T(' '));
+	buff[80* sizeof (TCHAR)] = 0;
 	
 	mii.cbSize = sizeof(mii);
 	mii.dwTypeData = buff;
 	mii.fType = MF_STRING;
-	mii.cch = 80;
+	mii.cch = 80 * sizeof (TCHAR);
 	mii.fState = MFS_DEFAULT;
 	mii.fMask = MIIM_ID | MIIM_DATA | MIIM_TYPE | MIIM_SUBMENU;
 	
Index: src/af/ev/win/ev_Win32Menu.h
===================================================================
RCS file: /cvsroot/abi/src/af/ev/win/ev_Win32Menu.h,v
retrieving revision 1.31
diff -u -r1.31 ev_Win32Menu.h
--- src/af/ev/win/ev_Win32Menu.h	16 Jan 2007 23:13:15 -0000	1.31
+++ src/af/ev/win/ev_Win32Menu.h	9 Apr 2007 08:36:50 -0000
@@ -89,7 +89,7 @@
 typedef struct
 {
 	XAP_Menu_Id 	id;					// Menu ID
-	char			szText[256];		// Text	
+	TCHAR			szText[256];		// Text	
 	EV_Win32Menu*	pMenu;				
 } EV_Menu_Item;	
 
Index: src/af/ev/win/ev_Win32Toolbar.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/ev/win/ev_Win32Toolbar.cpp,v
retrieving revision 1.102
diff -u -r1.102 ev_Win32Toolbar.cpp
--- src/af/ev/win/ev_Win32Toolbar.cpp	7 Apr 2007 19:56:20 -0000	1.102
+++ src/af/ev/win/ev_Win32Toolbar.cpp	9 Apr 2007 08:36:53 -0000
@@ -48,7 +48,7 @@
 #include "pt_PieceTable.h"
 #include "ap_Win32Toolbar_FontCombo.h"
 #include "ap_Win32App.h"
-
+#include "ut_Win32LocaleString.h"
 
 #ifndef TBSTYLE_EX_DRAWDDARROWS
 #define TBSTYLE_EX_DRAWDDARROWS 0x00000001
@@ -297,14 +297,15 @@
 			LOGFONT logfont;
 			SIZE size;
 			HFONT hfontSave;
+			UT_Win32LocaleString str;
 			const UT_GenericVector<const char*> * v = t->m_pFontCtrl->getContents();
-			const char * sz  = (const char *)v->getNthItem(dis->itemData);			
+			str.fromUTF8 (v->getNthItem(dis->itemData));
 			
 			if(dis->itemState & ODS_COMBOBOXEDIT)
 			{
 				HFONT hUIFont = (HFONT) GetStockObject(DEFAULT_GUI_FONT);
 				hfontSave = (HFONT) SelectObject (dis->hDC, hUIFont);
-				ExtTextOut(dis->hDC, dis->rcItem.left, dis->rcItem.top, ETO_OPAQUE | ETO_CLIPPED, 0, sz, lstrlen(sz), 0);
+				ExtTextOut(dis->hDC, dis->rcItem.left, dis->rcItem.top, ETO_OPAQUE | ETO_CLIPPED, 0, str.c_str(), str.size(), 0);
 				SelectObject (dis->hDC, hfontSave);				
 			}
 			else
@@ -325,7 +326,7 @@
 				logfont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
 				logfont.lfQuality = DEFAULT_QUALITY;
 				logfont.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;			  
-				strcpy (logfont.lfFaceName, sz);   
+				_tcscpy (logfont.lfFaceName, str.c_str());
 				hFont = CreateFontIndirect (&logfont);			
 
 				if(dis->itemState & ODS_SELECTED) /* HighLight the selected text*/
@@ -345,13 +346,13 @@
 
 				/*Fontname in regular font*/
 				hfontSave = (HFONT) SelectObject (dis->hDC, hUIFont);
-				ExtTextOut(dis->hDC, dis->rcItem.left, dis->rcItem.top, ETO_OPAQUE | ETO_CLIPPED, 0, sz, lstrlen(sz), 0);
+				ExtTextOut(dis->hDC, dis->rcItem.left, dis->rcItem.top, ETO_OPAQUE | ETO_CLIPPED, 0, str.c_str(), str.size(), 0);
 				
 				/*Font example after the name*/
-				const char* szSample="AbCdEfGhIj";
-				GetTextExtentPoint32(dis->hDC, sz, lstrlen(sz), &size);
+				TCHAR* szSample = _T("AbCdEfGhIj");
+				GetTextExtentPoint32(dis->hDC, str.c_str(), str.size(), &size);
 				SelectObject (dis->hDC, hFont);
-				ExtTextOut(dis->hDC, dis->rcItem.left+size.cx+5, dis->rcItem.top, ETO_OPAQUE | ETO_CLIPPED, 0, szSample, lstrlen(szSample), 0);					
+				ExtTextOut(dis->hDC, dis->rcItem.left+size.cx+5, dis->rcItem.top, ETO_OPAQUE | ETO_CLIPPED, 0, szSample, _tcslen(szSample), 0);					
 				SelectObject (dis->hDC, hfontSave);									
 				DeleteObject(hFont); 
 			}
@@ -391,11 +392,13 @@
 					if(iSelected != -1)
 					{							
 						static UT_UCSChar ucs_buf[COMBO_BUF_LEN];
+						UT_Win32LocaleString str;
 						UT_uint32 bufLength = SendMessage(hWnd, CB_GETLBTEXTLEN, iSelected, (LPARAM)0) + 1;
-						char* buf = (char*)g_try_malloc(bufLength);
+						TCHAR* buf = (TCHAR*)g_try_malloc(bufLength * sizeof (TCHAR));
 						UT_uint32 dataLength = SendMessage(hWnd, CB_GETLBTEXT, iSelected, (LPARAM)buf);
+						str.fromLocale (buf);
 
-						UT_UCS4_strncpy_char(ucs_buf, buf, COMBO_BUF_LEN-1);
+						UT_UCS4_strncpy_char(ucs_buf, str.utf8_str().utf8_str(), COMBO_BUF_LEN-1);
 						UT_UCSChar * pData = (UT_UCSChar *) ucs_buf;	// HACK: should be void *
 
 						EV_Win32Toolbar * t = (EV_Win32Toolbar *) GetWindowLong(hWnd, GWL_USERDATA);
@@ -526,7 +529,7 @@
 
 	m_hwnd = UT_CreateWindowEx(0, 
 							   TOOLBARCLASSNAME, // window class name
-							   (LPSTR) NULL,			// window caption
+							   NULL,			// window caption
 							   WS_CHILD | WS_VISIBLE 
 							   | WS_CLIPCHILDREN | WS_CLIPSIBLINGS 
 							   | TBSTYLE_TOOLTIPS | TBSTYLE_FLAT
@@ -667,8 +670,8 @@
 							dwStyle |= CBS_OWNERDRAWFIXED;
 
 						HWND hwndCombo = UT_CreateWindowEx ( 0L,   // No extended styles.
-							"COMBOBOX",						// Class name.
-							"",								// Default text.
+							_T("COMBOBOX"),						// Class name.
+							_T(""),								// Default text.
 							dwStyle,						// Styles and defaults.
 							0, 2, iWidth, 250,				// Size and position.
 							m_hwnd,							// Parent window.
@@ -704,10 +707,11 @@
 							{
 								UT_uint32 items = v->getItemCount();
 								int nIndex;
+								UT_Win32LocaleString localised;
 								for (UT_uint32 k=0; k < items; k++)
-								{
-									char * sz = (char *)v->getNthItem(k);
-									nIndex = SendMessage(hwndCombo, CB_ADDSTRING,(WPARAM)0, (LPARAM)sz);
+								{									
+									localised.fromUTF8(v->getNthItem(k));									
+									nIndex = SendMessage(hwndCombo, CB_ADDSTRING,(WPARAM)0, (LPARAM)localised.c_str());
 									SendMessage(hwndCombo,CB_SETITEMDATA, nIndex, k);
 								}
 							}
@@ -725,22 +729,24 @@
 
 						if (hwndTT)
 						{
+							UT_Win32LocaleString str;	
 							const char * szToolTip = pLabel->getToolTip();
 							if (!szToolTip || !*szToolTip)
 							{
 								szToolTip = pLabel->getStatusMsg();
 							}
-
+							str.fromUTF8 (szToolTip);
 
 							// Fill in the TOOLINFO structure.
 							TOOLINFO ti;
 							ti.cbSize = sizeof(ti);
 							ti.uFlags = TTF_IDISHWND | TTF_CENTERTIP;
-							ti.lpszText = (char *) szToolTip;
+							ti.lpszText = (TCHAR *) str.c_str();
 							ti.hwnd = m_hwnd;		// TODO: should this be the frame?
 							ti.uId = (UINT)hwndCombo;
 							// Set up tooltips for the combo box.
 							SendMessage(hwndTT, TTM_ADDTOOL, 0, (LPARAM)(LPTOOLINFO)&ti);
+							
 						}
 						
 						// bind this separator to its control
@@ -1068,24 +1074,24 @@
 				{
 					int idx = SendMessage(hwndCombo, CB_SELECTSTRING, (WPARAM)-1, (LPARAM)szState);
 					if (idx==CB_ERR)
-						SetWindowText(hwndCombo, "");
+						SetWindowText(hwndCombo, _T(""));
 					break;
 				}					
 				
 				szState = XAP_EncodingManager::get_instance()->strToNative(szState, "UTF-8");
 				
 				// Find the proper non-localised text
-				const char* pLocalised = szState;
+				//const TCHAR* pLocalised = szState;
+				UT_Win32LocaleString localised;
+				//
 				if (id==AP_TOOLBAR_ID_FMT_STYLE)
 				{
-						pt_PieceTable::s_getLocalisedStyleName(pLocalised, utf8);
-						pLocalised = utf8.utf8_str();
-						str = AP_Win32App::s_fromUTF8ToWinLocale(pLocalised);
-						pLocalised = str.c_str();						
-				}
-					
+						pt_PieceTable::s_getLocalisedStyleName(szState, utf8);
+						localised.fromUTF8 (utf8.utf8_str());
+				} else
+					localised.fromUTF8 (szState);					
 												
-				int idx = SendMessage(hwndCombo, CB_SELECTSTRING, (WPARAM)-1, (LPARAM)pLocalised);
+				int idx = SendMessage(hwndCombo, CB_SELECTSTRING, (WPARAM)-1, (LPARAM)localised.c_str());
 				/*
 				 * If the string didn't exist within the combos list, we handle things differently for
 				 * different combos.
@@ -1102,7 +1108,7 @@
 					 */
 					case AP_TOOLBAR_ID_FMT_SIZE:
 					case AP_TOOLBAR_ID_FMT_FONT:
-						idx = SendMessage(hwndCombo, WM_SETTEXT, (WPARAM)-1, (LPARAM)pLocalised);
+						idx = SendMessage(hwndCombo, WM_SETTEXT, (WPARAM)-1, (LPARAM)localised.c_str());
 						if (idx == CB_ERR)
 							UT_DEBUGMSG(("refreshToolbar: Failed to set text for font combo.\n"));
 						break;
@@ -1111,7 +1117,8 @@
 					 */
 					case AP_TOOLBAR_ID_ZOOM:
 						pSS = XAP_App::getApp()->getStringSet();
-						idx = SendMessage(hwndCombo, CB_SELECTSTRING, (WPARAM)-1, (LPARAM)pSS->getValue(XAP_STRING_ID_TB_Zoom_Percent));
+						localised.fromUTF8 (pSS->getValue(XAP_STRING_ID_TB_Zoom_Percent));
+						idx = SendMessage(hwndCombo, CB_SELECTSTRING, (WPARAM)-1, (LPARAM)localised.c_str());
 						break;
 
 					case AP_TOOLBAR_ID_FMT_STYLE:
@@ -1175,7 +1182,9 @@
 	if (szToolTip && *szToolTip)
 	{
 		// here 'tis
-		strncpy(lpttt->lpszText, szToolTip, 80);
+		UT_Win32LocaleString str;
+		str.fromUTF8 (szToolTip);
+		_tcsncpy(lpttt->lpszText, str.c_str(), 80);
 	}
 	else
 	{
@@ -1356,14 +1365,15 @@
 	for (UT_uint32 k=0; k < v->getItemCount(); k++)
 	{
 		const char*	sz = (char *)v->getNthItem(k);
-		const char*	pLocalised = sz;
+		//const char*	pLocalised = sz;
+		UT_Win32LocaleString localised;
 
 		pt_PieceTable::s_getLocalisedStyleName(sz, utf8);
-		pLocalised = utf8.utf8_str();
-		str = AP_Win32App::s_fromUTF8ToWinLocale(pLocalised);
-		pLocalised = str.c_str();
+		localised.fromUTF8 (utf8.utf8_str());
+		//str = AP_Win32App::s_fromUTF8ToWinLocale(pLocalised);
+		//pLocalised = str.c_str();
 		
-		nItem = SendMessage(hwndCombo, CB_ADDSTRING,(WPARAM)0, (LPARAM)pLocalised);
+		nItem = SendMessage(hwndCombo, CB_ADDSTRING,(WPARAM)0, (LPARAM)localised.c_str());
 		m_vecOrgStylesNames.addItem (new UT_UTF8String ((char *)v->getNthItem(k)));
 		SendMessage(hwndCombo, CB_SETITEMDATA,(WPARAM)nItem, (LPARAM)m_vecOrgStylesNames.getItemCount()-1);
 	}
Index: src/af/gr/win/gr_Win32Graphics.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/gr/win/gr_Win32Graphics.cpp,v
retrieving revision 1.250
diff -u -r1.250 gr_Win32Graphics.cpp
--- src/af/gr/win/gr_Win32Graphics.cpp	3 Apr 2007 16:29:21 -0000	1.250
+++ src/af/gr/win/gr_Win32Graphics.cpp	9 Apr 2007 08:36:56 -0000
@@ -42,6 +42,7 @@
 #include "ut_assert.h"
 #include "ut_string.h"
 #include "ut_Win32OS.h"
+#include "ut_Win32LocaleString.h"
 
 #ifdef __MINGW32__
 #include <w32api.h>
@@ -339,15 +340,17 @@
 		// This convertion is needed because the windows API expects fontnames
 		// in the native encoding and later lf will be passing to a windows
 		// API funcion (CreateFontIndirect()).
-		strncpy(lf.lfFaceName, 
-		        XAP_App::getApp()->getEncodingManager()->strToNative(pszFontFamily, "UTF-8", false),
+		UT_Win32LocaleString str;
+		str.fromUTF8 (pszFontFamily);
+		_tcsncpy(lf.lfFaceName, 
+		        str.c_str(),
 		        LF_FACESIZE);
 	}
 
 	// Get character set value from the font itself
 	LOGFONT enumlf = { 0 };
 	enumlf.lfCharSet = DEFAULT_CHARSET;
-	strcpy(enumlf.lfFaceName, lf.lfFaceName);
+	_tcscpy(enumlf.lfFaceName, lf.lfFaceName);
 	EnumFontFamiliesEx(m_hdc, &enumlf,
 		(FONTENUMPROC)win32Internal_fontEnumProcedure, (LPARAM)&lf, 0);
 
@@ -1431,8 +1434,10 @@
 		lf.lfPitchAndFamily = DEFAULT_PITCH | FF_MODERN;
 	else
 	{
-			strncpy(lf.lfFaceName, 
-				    XAP_EncodingManager::get_instance()->strToNative(szFontName, "UTF-8", false),
+		UT_Win32LocaleString str;
+		str.fromUTF8 (szFontName);
+			_tcsncpy(lf.lfFaceName, 
+				    str.c_str(),
 			        LF_FACESIZE);
 	}
 
@@ -1442,7 +1447,7 @@
 	// reflect what is being seen on screen.
 
 	HFONT hFont = CreateFontIndirect(&lf);
-	HDC hdc = CreateDC("DISPLAY",NULL,NULL,NULL);
+	HDC hdc = CreateDC(_T("DISPLAY"),NULL,NULL,NULL);
 	HFONT hFontOld = (HFONT) SelectObject(hdc,hFont);
 	GetTextMetrics(hdc,&tm);
 	SelectObject(hdc,hFontOld);
@@ -1545,9 +1550,9 @@
 		else
 		{
 			// Setting the m_hashKey 
-			char lpFaceName[1000];
+			TCHAR lpFaceName[1000];
 			
-			GetTextFace(printHDC, 1000, lpFaceName );
+			GetTextFace(printHDC, 1000 * sizeof (TCHAR), lpFaceName );
 
 			_updateFontYMetrics(hdc, printHDC);
 
@@ -1723,7 +1728,7 @@
 	// calculate the limits of the 256-char page
 	UT_UCS4Char base = (cChar & 0xffffff00);
 	UT_UCS4Char limit = (cChar | 0x000000ff);
-	HDC hdc = CreateDC("DISPLAY",NULL,NULL,NULL);
+	HDC hdc = CreateDC(_T("DISPLAY"),NULL,NULL,NULL);
 	SelectObject(hdc,m_layoutFont);
 	_getCharWidths()->setCharWidthsOfRange(hdc, base, limit);
 	DeleteDC(hdc);
@@ -2304,8 +2309,8 @@
 	goto cleanup;                               \
 }
 
-GR_Graphics * GR_Win32Graphics::getPrinterGraphics(const char * pPrinterName,
-												   const char * pDocName)
+GR_Graphics * GR_Win32Graphics::getPrinterGraphics(const TCHAR * pPrinterName,
+												   const TCHAR * pDocName)
 {
 	UT_return_val_if_fail( pDocName, NULL );
 	GR_Win32Graphics *pGr = NULL;
@@ -2320,8 +2325,8 @@
 
 	// we will use '-' as a shortcut for default printer (the --print command has to have
 	// a parameter)
-	char * pPN = strcmp("-", pPrinterName) == 0 ? NULL : (char *) pPrinterName;
-	const char * pDriver = UT_IsWinNT() ? "WINSPOOL" : NULL;
+	TCHAR * pPN = _tcscmp(_T("-"), pPrinterName) == 0 ? NULL : (TCHAR *) pPrinterName;
+	const TCHAR * pDriver = UT_IsWinNT() ? _T("WINSPOOL") : NULL;
 	
 	if(!pPN)
 	{
@@ -2417,7 +2422,7 @@
 	DWORD       dwNeeded, dwRet;
 
 	//Start by opening the printer
-	if(!OpenPrinter((char*)& pDM->dmDeviceName, &hPrinter, NULL))
+	if(!OpenPrinter((TCHAR*)& pDM->dmDeviceName, &hPrinter, NULL))
 	{
 		UT_String msg;
 		UT_String_sprintf(msg,"Unable to open printer [%s]", (char*)& pDM->dmDeviceName);
@@ -2427,7 +2432,7 @@
 		return false;
 	}
 	
-	dwNeeded = DocumentProperties(NULL,hPrinter, (char*)& pDM->dmDeviceName, NULL, NULL, 0);
+	dwNeeded = DocumentProperties(NULL,hPrinter, (TCHAR*)& pDM->dmDeviceName, NULL, NULL, 0);
 
 	if( (int) dwNeeded > pDM->dmSize + pDM->dmDriverExtra )
 	{
@@ -2444,7 +2449,7 @@
 	}
 	
 	// now get the printer driver to merge the data in the public section into its private part
-	dwRet = DocumentProperties(NULL,hPrinter, (char*)& pDM->dmDeviceName, pDM, pDM, DM_OUT_BUFFER | DM_IN_BUFFER);
+	dwRet = DocumentProperties(NULL,hPrinter, (TCHAR*)& pDM->dmDeviceName, pDM, pDM, DM_OUT_BUFFER | DM_IN_BUFFER);
 
 	// g_free what needs be ...
 	ClosePrinter(hPrinter);
Index: src/af/gr/win/gr_Win32Graphics.h
===================================================================
RCS file: /cvsroot/abi/src/af/gr/win/gr_Win32Graphics.h,v
retrieving revision 1.115
diff -u -r1.115 gr_Win32Graphics.h
--- src/af/gr/win/gr_Win32Graphics.h	3 Apr 2007 16:29:21 -0000	1.115
+++ src/af/gr/win/gr_Win32Graphics.h	9 Apr 2007 08:36:57 -0000
@@ -21,6 +21,7 @@
 #define GR_WIN32GRAPHICS_H
 
 #include <windows.h>
+#include <tchar.h>
 #include "ut_misc.h"
 #include "gr_Graphics.h"
 #include "gr_Win32CharWidths.h"
@@ -187,8 +188,8 @@
 	static const char *    graphicsDescriptor(){return "Win32 Default";}
 	static GR_Graphics *   graphicsAllocator(GR_AllocInfo&);
 
-	static  GR_Graphics *   getPrinterGraphics(const char * pPrinterName,
-											   const char * pDocName);
+	static  GR_Graphics *   getPrinterGraphics(const TCHAR * pPrinterName,
+											   const TCHAR * pDocName);
 	
 	virtual void			drawGlyph(UT_uint32 glyph_idx, UT_sint32 xoff, UT_sint32 yoff);
 	virtual void			drawChar(UT_UCSChar Char, UT_sint32 xoff, UT_sint32 yoff);
Index: src/af/gr/win/gr_Win32USPGraphics.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/gr/win/gr_Win32USPGraphics.cpp,v
retrieving revision 1.85
diff -u -r1.85 gr_Win32USPGraphics.cpp
--- src/af/gr/win/gr_Win32USPGraphics.cpp	29 Mar 2007 02:59:30 -0000	1.85
+++ src/af/gr/win/gr_Win32USPGraphics.cpp	9 Apr 2007 08:37:01 -0000
@@ -354,7 +354,7 @@
 		s_sDescription = "Uniscribe-based graphics";
 		s_Version.set(0,1,0,0);
 		
-		s_hUniscribe = LoadLibrary("usp10.dll");
+		s_hUniscribe = LoadLibrary(_T("usp10.dll"));
 
 		if(!s_hUniscribe)
 		{
@@ -363,7 +363,7 @@
 		}
 		
 #if 1 //def DEBUG
-		char FileName[250];
+		TCHAR FileName[250];
 		if(GetModuleFileName(s_hUniscribe,&FileName[0],250))
 		{
 			DWORD dummy;
@@ -377,7 +377,7 @@
 					LPVOID buff2;
 					UINT   buff2size;
 					
-					if(VerQueryValue(pBuff,"\\",
+					if(VerQueryValue(pBuff, _T("\\"),
 									 &buff2,
 									 &buff2size))
 					{
@@ -587,6 +587,7 @@
 */
 void GR_Win32USPGraphics::setFont(const GR_Font* pFont)
 {
+
 	m_pFont = const_cast<GR_Win32Font *>(static_cast<const GR_Win32Font *>(pFont));
 
 	UT_ASSERT_HARMLESS(pFont);	// TODO should we allow pFont == NULL?
Index: src/af/util/Makefile
===================================================================
RCS file: /cvsroot/abi/src/af/util/Makefile,v
retrieving revision 1.98
diff -u -r1.98 Makefile
--- src/af/util/Makefile	22 Jan 2007 00:50:57 -0000	1.98
+++ src/af/util/Makefile	9 Apr 2007 08:37:02 -0000
@@ -54,10 +54,11 @@
 		$(OBJDIR)/ut_$(ABI_FE)Timer.$(OBJ_SUFFIX)	\
 		$(OBJDIR)/ut_$(ABI_FE)Idle.$(OBJ_SUFFIX)	\
 		$(OBJDIR)/ut_$(ABI_FE)Locale.$(OBJ_SUFFIX)	\
+		$(OBJDIR)/ut_$(ABI_FE)LocaleString.$(OBJ_SUFFIX)	\
 		$(OBJDIR)/ut_sleep.$(OBJ_SUFFIX)            \
 		$(OBJDIR)/ut_Xpm2Bmp.$(OBJ_SUFFIX)			\
 		$(OBJDIR)/ut_Win32Uuid.$(OBJ_SUFFIX)		\
-		$(OBJDIR)/ut_Win32Misc.$(OBJ_SUFFIX)		
+		$(OBJDIR)/ut_Win32Misc.$(OBJ_SUFFIX)				
 endif
 
 ifeq ($(ABI_NATIVE), qnx)
Index: src/af/util/win/Makefile
===================================================================
RCS file: /cvsroot/abi/src/af/util/win/Makefile,v
retrieving revision 1.25
diff -u -r1.25 Makefile
--- src/af/util/win/Makefile	7 Jun 2006 17:45:15 -0000	1.25
+++ src/af/util/win/Makefile	9 Apr 2007 08:37:02 -0000
@@ -32,7 +32,8 @@
 			ut_sleep.cpp		\
 			ut_path.cpp \
 			ut_Win32Uuid.cpp\
-			ut_Win32Misc.cpp
+			ut_Win32Misc.cpp\
+			ut_Win32LocaleString.cpp
 
 
 ifeq ($(ABI_OPT_MSXML),1)
Index: src/af/util/win/ut_Win32Misc.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/util/win/ut_Win32Misc.cpp,v
retrieving revision 1.19
diff -u -r1.19 ut_Win32Misc.cpp
--- src/af/util/win/ut_Win32Misc.cpp	29 Mar 2007 17:41:34 -0000	1.19
+++ src/af/util/win/ut_Win32Misc.cpp	9 Apr 2007 08:37:03 -0000
@@ -28,6 +28,7 @@
 #include "ut_debugmsg.h"
 #include "ut_Win32Resources.rc2"
 #include "ut_Win32Timer.h"
+#include "ut_Win32LocaleString.h"
 
 /*!
     UT_gettimeofday() fills in the timeval structure with current
@@ -97,7 +98,7 @@
 	// I adjusted it, so all the libs are dynamically loaded and unloaded
 
 	HINSTANCE m_hWSInst = NULL;
-	m_hWSInst = LoadLibrary("ws2_32.dll");
+	m_hWSInst = LoadLibrary(_T("ws2_32.dll"));
 	pWSAStartup m_WSAStartup = NULL;
 	
 	if(m_hWSInst < (HINSTANCE) HINSTANCE_ERROR)
@@ -164,7 +165,7 @@
 
 		/* Load the SNMP dll and get the addresses of the functions
 		   necessary */
-		m_hSNMPInst = LoadLibrary("snmpapi.dll");
+		m_hSNMPInst = LoadLibrary(_T("snmpapi.dll"));
 		if(m_hSNMPInst < (HINSTANCE) HINSTANCE_ERROR)
 		{
 			UT_DEBUGMSG(("UT_getEthernetAddress: could not load snmpapi.dll\n"));
@@ -191,7 +192,7 @@
 
 
 		// load the SNMP extension library
-		m_hInst = LoadLibrary("inetmib1.dll");
+		m_hInst = LoadLibrary(_T("inetmib1.dll"));
 
 		if(m_hInst < (HINSTANCE) HINSTANCE_ERROR)
 		{
@@ -339,7 +340,7 @@
 
 		HINSTANCE m_hInst;
 
-		m_hInst = LoadLibrary("netapi32.dll");
+		m_hInst = LoadLibrary(_T("netapi32.dll"));
 		if(m_hInst < (HINSTANCE) HINSTANCE_ERROR)
 		{
 			UT_DEBUGMSG(("UT_getEthernetAddress: could not load netapi32.dll\n"));
@@ -502,9 +503,9 @@
 
 UT_Win32AssertDlg::answer UT_Win32AssertDlg::runModal()
 {
-	LPCTSTR lpTemplate = MAKEINTRESOURCE(UT_RID_DIALOG_ASSERT);
+	LPSTR lpTemplate = MAKEINTRESOURCEA(UT_RID_DIALOG_ASSERT);
 	
-	int result = DialogBoxParam(GetModuleHandle(NULL),
+	int result = DialogBoxParamA(GetModuleHandleA(NULL),
 								lpTemplate,
 								NULL,
 								(DLGPROC)s_dlgProc,(LPARAM)this);
@@ -587,15 +588,15 @@
 	EnumThreadWindows(GetCurrentThreadId(),	s_DisableWindows, lParam);
 
 	// set initial state
-	SetDlgItemText(hWnd,UT_RID_DIALOG_ASSERT_FILE,m_pFile);
-	SetDlgItemText(hWnd,UT_RID_DIALOG_ASSERT_CONDITION,m_pCond);
+	SetDlgItemTextA(hWnd,UT_RID_DIALOG_ASSERT_FILE,m_pFile);
+	SetDlgItemTextA(hWnd,UT_RID_DIALOG_ASSERT_CONDITION,m_pCond);
 
-	char buff[20];
+	char  buff[20];
 	_snprintf(buff, 19, "%d",m_iLine);
-	SetDlgItemText(hWnd,UT_RID_DIALOG_ASSERT_LINE,buff);
+	SetDlgItemTextA(hWnd,UT_RID_DIALOG_ASSERT_LINE,buff);
 
 	_snprintf(buff, 19, "%d",m_iCount);
-	SetDlgItemText(hWnd,UT_RID_DIALOG_ASSERT_COUNT,buff);
+	SetDlgItemTextA(hWnd,UT_RID_DIALOG_ASSERT_COUNT,buff);
 	
 	return 1;				// 1 == we did not call SetFocus()
 }
Index: src/af/util/win/ut_Win32OS.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/util/win/ut_Win32OS.cpp,v
retrieving revision 1.16
diff -u -r1.16 ut_Win32OS.cpp
--- src/af/util/win/ut_Win32OS.cpp	17 Mar 2007 00:27:31 -0000	1.16
+++ src/af/util/win/ut_Win32OS.cpp	9 Apr 2007 08:37:04 -0000
@@ -104,10 +104,10 @@
   #define GETDEFAULTPRINTER "GetDefaultPrinterA"
 #endif
 
-char * UT_GetDefaultPrinterName()
+TCHAR * UT_GetDefaultPrinterName()
 {
 	UT_uint32 iBufferSize = 128; // will become 2x bigger immediately in the loop
-	char * pPrinterName = NULL; 
+	TCHAR * pPrinterName = NULL; 
 	DWORD rc;
 	
 	do
@@ -117,14 +117,14 @@
 		if(pPrinterName)
 			g_free(pPrinterName);
 		
-		pPrinterName = (char *) UT_calloc(sizeof(char),iBufferSize);
+		pPrinterName = (TCHAR *) UT_calloc(sizeof(TCHAR),iBufferSize);
 		UT_return_val_if_fail( pPrinterName, NULL );
 		
 		// the method of obtaining the name is version specific ...
 		OSVERSIONINFO osvi;
 		DWORD iNeeded, iReturned, iBuffSize;
 		LPPRINTER_INFO_5 pPrinterInfo;
-		char* p;
+		TCHAR* p;
 
 		osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
 		GetVersionEx(&osvi);
@@ -158,13 +158,13 @@
 					if (iReturned > 0)
 					{
 						// here we copy the name to our own buffer
-						if ((DWORD) lstrlen(pPrinterInfo->pPrinterName) > iBufferSize-1)
+						if ((DWORD) _tcslen(pPrinterInfo->pPrinterName) > iBufferSize-1)
 						{
 							rc = ERROR_INSUFFICIENT_BUFFER;
 						}
 						else
 						{
-							lstrcpy(pPrinterName,pPrinterInfo->pPrinterName);
+							_tcscpy(pPrinterName,pPrinterInfo->pPrinterName);
 							rc = ERROR_SUCCESS;
 						}
 					}
@@ -184,7 +184,7 @@
 			{
 				iBuffSize = iBufferSize;
 
-				HMODULE hWinSpool = LoadLibrary("winspool.drv");
+				HMODULE hWinSpool = LoadLibrary(_T("winspool.drv"));
 				if (!hWinSpool)
 					return NULL;
 
@@ -206,14 +206,14 @@
 			}
 			else /* Windows NT 4.0 or earlier */
 			{
-				if (GetProfileString("windows","device","",pPrinterName,iBufferSize) == iBufferSize-1)
+				if (GetProfileString(_T("windows"),_T("device"),_T(""),pPrinterName,iBufferSize) == iBufferSize-1)
 				{
 					rc = ERROR_INSUFFICIENT_BUFFER;
 				}
 				else
 				{
 					p = pPrinterName;
-					while (*p != '0' && *p != ',')
+					while (*p != '0' && *p != _T(','))
 						++p;
 					*p = '0';
 
@@ -233,7 +233,7 @@
 */
 HDC  UT_GetDefaultPrinterDC()
 {
-	char * pPrinterName  = UT_GetDefaultPrinterName();
+	TCHAR * pPrinterName  = UT_GetDefaultPrinterName();
 
 	if(!pPrinterName || !*pPrinterName)
 		return NULL;
@@ -242,7 +242,7 @@
 	//	if(!OpenPrinter(pPrinterName, &hPrinter, NULL))
 	//		return NULL;
 
-	const char * pDriver = UT_IsWinNT() ? "WINSPOOL" : NULL;
+	const TCHAR * pDriver = UT_IsWinNT() ? _T("WINSPOOL") : NULL;
 	HDC hdc = CreateDC(pDriver, pPrinterName, NULL, NULL);
 	g_free(pPrinterName);
 	return hdc;
@@ -250,154 +250,62 @@
 
 ATOM UT_RegisterClassEx(UINT style, WNDPROC wndproc, HINSTANCE hInstance,
 						HICON hIcon, HCURSOR hCursor, HBRUSH hbrBackground, HICON hIconSm,
-						const char * menu, const char * name,
-						bool bForceANSI)
+						const TCHAR * menu, const TCHAR * name)
+						
 {
-	if(!bForceANSI && UT_IsWinNT())
-	{
-		// first, transfer the menu and class name into wchar array
-		// this code assumes that these are ASCII strings; this is true both for the win32
-		// system names and our own
-		WCHAR buff1[100];
-		WCHAR buff2[100];
-		
-		const char * p = name;
-		UT_uint32 i = 0;
-		
-		while(p && *p && i < 99) //don't overflow buff1 below
-		{
-			buff1[i] = *p;
-			++p;
-			++i;
-		}
-		buff1[i] = 0;
-		
-		p = menu;
-		i = 0;
-		
-		while(p && *p && i < 99) //don't overflow buff2 below
-		{
-			buff2[i] = *p;
-			++p;
-			++i;
-		}
-		buff2[i] = 0;
-		
-		WNDCLASSEXW  wndclass;
-		memset(&wndclass, 0, sizeof(wndclass));
-		wndclass.cbSize        = sizeof(wndclass);
-		wndclass.style         = style;
-		wndclass.lpfnWndProc   = wndproc;
-		wndclass.cbClsExtra    = 0;
-		wndclass.cbWndExtra    = 0;
-		wndclass.hInstance     = hInstance;
-		wndclass.hIcon         = hIcon;
-		wndclass.hCursor       = hCursor;
-		wndclass.hbrBackground = hbrBackground;
-		wndclass.lpszMenuName  = buff2;
-		wndclass.lpszClassName = buff1;
-		wndclass.hIconSm       = hIconSm;
-		
-		return RegisterClassExW(&wndclass);
-	}
-	else
-	{
-		WNDCLASSEXA  wndclass;
-		memset(&wndclass, 0, sizeof(wndclass));
-		wndclass.cbSize        = sizeof(wndclass);
-		wndclass.style         = style;
-		wndclass.lpfnWndProc   = wndproc;
-		wndclass.cbClsExtra    = 0;
-		wndclass.cbWndExtra    = 0;
-		wndclass.hInstance     = hInstance;
-		wndclass.hIcon         = hIcon;
-		wndclass.hCursor       = hCursor;
-		wndclass.hbrBackground = hbrBackground;
-		wndclass.lpszMenuName  = menu;
-		wndclass.lpszClassName = name;
-		wndclass.hIconSm       = hIconSm;
-		
-		return RegisterClassExA(&wndclass);
-	}
+	ATOM atom;
+	WNDCLASSEX  wndclass;
+	memset(&wndclass, 0, sizeof(wndclass));
+	wndclass.cbSize        = sizeof(wndclass);
+	wndclass.style         = style;
+	wndclass.lpfnWndProc   = wndproc;
+	wndclass.cbClsExtra    = 0;
+	wndclass.cbWndExtra    = 0;
+	wndclass.hInstance     = hInstance;
+	wndclass.hIcon         = hIcon;
+	wndclass.hCursor       = hCursor;
+	wndclass.hbrBackground = hbrBackground;
+	wndclass.lpszMenuName  = menu;
+	wndclass.lpszClassName = name;
+	wndclass.hIconSm       = hIconSm;
+	
+	atom = RegisterClassEx (&wndclass);	
+	UT_ASSERT(atom);
+	return atom;
+	
 }
 
-HWND UT_CreateWindowEx(DWORD dwExStyle, const char * pszClassName, const char * pszWindowName, DWORD dwStyle,
+HWND UT_CreateWindowEx(DWORD dwExStyle, const TCHAR * pszClassName, const TCHAR * pszWindowName, DWORD dwStyle,
 					   int x, int y, int nWidth, int nHeight,
-					   HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam,
-					   bool bForceANSI)
-{
-	if(!bForceANSI && UT_IsWinNT())
-	{
-		WCHAR buff1[100];
-
-		// see comments in UT_RegisterClassEx
-		const char * p = pszClassName;
-		UT_uint32 i = 0;
-		
-		while(p && *p && i < 99) //don't overflow buff1 below
-		{
-			buff1[i] = *p;
-			++p;
-			++i;
-		}
-		buff1[i] = 0;
-
-		// we need to use iconv here, because the name of the window might be localised
-		// (in practice this matters very little, because this only sets the initial name
-		// for the frame, which we immediately change once the windows is created)
-		auto_iconv aic (UT_LocaleInfo::system().getEncoding().utf8_str(), ucs2Internal());
-		WCHAR * ucs2str = (WCHAR*) UT_convert_cd(pszWindowName, strlen(pszWindowName), aic, NULL, NULL);
-		
-		HWND hwnd = CreateWindowExW(dwExStyle, buff1, ucs2str, dwStyle,
-									x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam);
-		g_free(ucs2str);
-		return hwnd;
-	}
-	else
-	{
-		return CreateWindowExA(dwExStyle, pszClassName, pszWindowName,
-							   dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam);
-	}
-	
+					   HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam)
+					   
+{	
+	HWND hwnd =  CreateWindowEx(dwExStyle, pszClassName, pszWindowName,
+		dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam);	
+			
+	UT_ASSERT(hwnd);
+	return hwnd;	
 }
 
-LRESULT UT_DefWindowProc(HWND hWnd, UINT Msg, WPARAM wParam,LPARAM lParam, bool bForceANSI)
+LRESULT UT_DefWindowProc(HWND hWnd, UINT Msg, WPARAM wParam,LPARAM lParam)
 {
-	if(!bForceANSI&& UT_IsWinNT())
-		return DefWindowProcW(hWnd, Msg, wParam, lParam);
-	else
-		return DefWindowProcA(hWnd, Msg, wParam, lParam);
+
+	return DefWindowProc (hWnd, Msg, wParam, lParam);
 }
 
-BOOL UT_SetWindowText(HWND hWnd, const char * lpString, bool bForceANSI)
+BOOL UT_SetWindowText(HWND hWnd, const TCHAR * lpString)
 {
-	if(!bForceANSI&& UT_IsWinNT())
-	{
-		auto_iconv aic("UTF-8", ucs2Internal());
-		WCHAR * ucs2 = (WCHAR*)UT_convert_cd(lpString, strlen(lpString), aic, NULL, NULL);
-		BOOL bRet = SetWindowTextW(hWnd, ucs2);
-		g_free(ucs2);
-		return bRet;
-	}
-	else
-	{
-		return SetWindowTextA(hWnd, lpString);
-	}
+
+	return SetWindowText (hWnd, lpString);	
 }
 
-BOOL UT_GetMessage(LPMSG lpMsg,HWND hWnd,UINT wMsgFilterMin,UINT wMsgFilterMax, bool bForceANSI)
+BOOL UT_GetMessage(LPMSG lpMsg,HWND hWnd,UINT wMsgFilterMin,UINT wMsgFilterMax)
 {
-	if(!bForceANSI&& UT_IsWinNT())
-		return GetMessageW(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
-	else
-		return GetMessageA(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
+	return GetMessage (lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);	
 }
 
-LRESULT UT_DispatchMessage(const MSG *lpmsg, bool bForceANSI)
-{
-	if(!bForceANSI&& UT_IsWinNT())
-		return DispatchMessageW(lpmsg);
-	else
-		return DispatchMessageA(lpmsg);
+LRESULT UT_DispatchMessage(const MSG *lpmsg)
+{	
+	return DispatchMessage(lpmsg);	
 }
 
Index: src/af/util/win/ut_Win32OS.h
===================================================================
RCS file: /cvsroot/abi/src/af/util/win/ut_Win32OS.h,v
retrieving revision 1.14
diff -u -r1.14 ut_Win32OS.h
--- src/af/util/win/ut_Win32OS.h	16 Jan 2007 23:13:27 -0000	1.14
+++ src/af/util/win/ut_Win32OS.h	9 Apr 2007 08:37:04 -0000
@@ -22,6 +22,7 @@
 #define UT_Win32OS_H
 
 #include <windows.h>
+#include <tchar.h>
 #include "ut_types.h"
 
 OSVERSIONINFO& UT_GetWinVersion(void);
@@ -31,25 +32,25 @@
 
 DLGTEMPLATE * WINAPI UT_LockDlgRes(HINSTANCE hinst, LPCTSTR lpszResName);
 
-char * UT_GetDefaultPrinterName();
+TCHAR * UT_GetDefaultPrinterName();
 
 HDC  UT_GetDefaultPrinterDC();
 
 ATOM UT_RegisterClassEx(UINT style, WNDPROC wndproc, HINSTANCE hInstance,
 						HICON hIcon, HCURSOR hCursor, HBRUSH hbrBackground, HICON hIconSm,
-						const char * menu, const char * name, bool bForceANSI = false);
+						const TCHAR * menu, const TCHAR * name);
 
 // NB: the default value for bForceANSI is intentionally set to true, otherwise the
 // tooltips do not work, see bug 8976
-HWND UT_CreateWindowEx(DWORD dwExStyle, LPCTSTR lpClassName, LPCTSTR lpWindowName, DWORD dwStyle,
+HWND UT_CreateWindowEx(DWORD dwExStyle, const TCHAR * lpClassName, const TCHAR * lpWindowName, DWORD dwStyle,
 					   int x, int y, int nWidth, int nHeight,
-					   HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam, bool bForceANSI = true);
+					   HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam);
 
-LRESULT UT_DefWindowProc(HWND hWnd, UINT Msg, WPARAM wParam,LPARAM lParam, bool bForceANSI = false);
+LRESULT UT_DefWindowProc(HWND hWnd, UINT Msg, WPARAM wParam,LPARAM lParam);
 
-BOOL UT_SetWindowText(HWND hWnd, const char * lpString, bool bForceANSI = false);
+BOOL UT_SetWindowText(HWND hWnd, const TCHAR * lpString);
 
-BOOL UT_GetMessage(LPMSG lpMsg,HWND hWnd,UINT wMsgFilterMin,UINT wMsgFilterMax, bool bForceANSI = false);
+BOOL UT_GetMessage(LPMSG lpMsg,HWND hWnd,UINT wMsgFilterMin,UINT wMsgFilterMax);
 
-LRESULT UT_DispatchMessage(const MSG *lpmsg, bool bForceANSI = false);
+LRESULT UT_DispatchMessage(const MSG *lpmsg);
 #endif /* UT_Win32OS_H */
Index: src/af/util/xp/ut_go_file.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/util/xp/ut_go_file.cpp,v
retrieving revision 1.22
diff -u -r1.22 ut_go_file.cpp
--- src/af/util/xp/ut_go_file.cpp	18 Jan 2007 14:54:41 -0000	1.22
+++ src/af/util/xp/ut_go_file.cpp	9 Apr 2007 08:37:07 -0000
@@ -55,11 +55,18 @@
 #include <windows.h>
 #include <shellapi.h>
 #include <io.h>
+#else
+#include <unistd.h>
+#endif
+
+#if !defined(S_ISDIR)
+#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
 #endif
 
+
 #include <string.h>
 #include <stdlib.h>
-#include <unistd.h>
+
 #include <time.h>
 
 #ifndef _
@@ -1575,11 +1582,18 @@
 }
 #endif
 
+#ifdef G_OS_WIN32
+#include "ut_Win32LocaleString.h"
+#endif
+
 GError *
 UT_go_url_show (gchar const *url)
 {
 #ifdef G_OS_WIN32
-	ShellExecute (NULL, "open", url, NULL, NULL, SW_SHOWNORMAL);
+	UT_Win32LocaleString str;
+	str.fromUTF8 (url);
+
+	ShellExecute (NULL, _T("open"), str.c_str(), NULL, NULL, SW_SHOWNORMAL);
 
 	return NULL;
 #else
Index: src/af/util/xp/ut_go_file.h
===================================================================
RCS file: /cvsroot/abi/src/af/util/xp/ut_go_file.h,v
retrieving revision 1.8
diff -u -r1.8 ut_go_file.h
--- src/af/util/xp/ut_go_file.h	16 Jan 2007 23:13:29 -0000	1.8
+++ src/af/util/xp/ut_go_file.h	9 Apr 2007 08:37:07 -0000
@@ -20,8 +20,11 @@
 #ifndef UT_GO_FILE_H
 #define UT_GO_FILE_H
 
+
+
 #include <glib.h>
 #include <gsf/gsf.h>
+#include <glib/gerror.h>
 #include <time.h>
 
 G_BEGIN_DECLS
@@ -96,3 +99,4 @@
 G_END_DECLS
 
 #endif /* UT_GO_FILE_H */
+//#endif
\ No newline at end of file
Index: src/af/util/xp/ut_iconv.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/util/xp/ut_iconv.cpp,v
retrieving revision 1.49
diff -u -r1.49 ut_iconv.cpp
--- src/af/util/xp/ut_iconv.cpp	15 Mar 2007 18:37:54 -0000	1.49
+++ src/af/util/xp/ut_iconv.cpp	9 Apr 2007 08:37:08 -0000
@@ -393,7 +393,7 @@
 
 	/* Due to a GLIBC bug, round outbuf_size up to a multiple of 4 */
 	/* + 1 for nul in case len == 1 */
-	size_t outbuf_size = ((len + 3) & ~3) + 15;
+	size_t outbuf_size = (((4 * len) + 3) & ~3) + 15;
 	size_t outbytes_remaining = outbuf_size - 4; /* -4 for null (allow for ucs4 0) */
 
 	char* pDest = static_cast<char*>(g_try_malloc(outbuf_size));
Index: src/af/util/xp/ut_misc.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/util/xp/ut_misc.cpp,v
retrieving revision 1.104
diff -u -r1.104 ut_misc.cpp
--- src/af/util/xp/ut_misc.cpp	19 Jan 2007 15:34:34 -0000	1.104
+++ src/af/util/xp/ut_misc.cpp	9 Apr 2007 08:37:09 -0000
@@ -1054,7 +1054,7 @@
 
 		char * semi = NULL;
 		const char * p = pProps;
- 		while((semi = strchr(p, ';')))
+ 		while((semi = (char *) strchr(p, ';')))
 		{
 			*semi = 0;
 			p = semi + 1;
@@ -1075,7 +1075,7 @@
 			if(pProps[i] == 0)
 			{
 				pPropsArray[j++] = pStart;
-				char * colon = strchr(pStart, ':');
+				char * colon = (char *)  strchr(pStart, ':');
 				UT_return_val_if_fail( colon,NULL );
 				*colon = 0;
 				pPropsArray[j++] = colon + 1;
Index: src/af/util/xp/ut_string_class.h
===================================================================
RCS file: /cvsroot/abi/src/af/util/xp/ut_string_class.h,v
retrieving revision 1.57
diff -u -r1.57 ut_string_class.h
--- src/af/util/xp/ut_string_class.h	27 Feb 2007 23:50:39 -0000	1.57
+++ src/af/util/xp/ut_string_class.h	9 Apr 2007 08:37:10 -0000
@@ -109,7 +109,7 @@
 	// even if to an empty string.
 	const char* c_str() const;
 
-private:
+protected:
 	class UT_StringImpl<char>* pimpl;
 };
 
@@ -365,7 +365,7 @@
 
 	const char * utf8_str ();
 
-private:
+protected:
 	class UT_StringImpl<UT_UCS4Char>* pimpl;
 };
 
Index: src/af/util/xp/ut_types.h
===================================================================
RCS file: /cvsroot/abi/src/af/util/xp/ut_types.h,v
retrieving revision 1.110
diff -u -r1.110 ut_types.h
--- src/af/util/xp/ut_types.h	19 Jan 2007 15:34:34 -0000	1.110
+++ src/af/util/xp/ut_types.h	9 Apr 2007 08:37:11 -0000
@@ -136,12 +136,16 @@
 	The MSVC debug runtime library can track leaks back to the 
 	original allocation via the following black magic.
 */
+
+#ifdef NOT_IN_VC7
+
 #if defined(_MSC_VER) && defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
 #include <crtdbg.h>
 #define UT_DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
 #define new UT_DEBUG_NEW
 #endif /* _MSC_VER && _DEBUG && _CRTDBG_MAP_ALLOC */
 
+#endif
 
 /* Unicode character constants.  Try to use these rather than
 ** decimal or hex constants throughout the code.  See also bug
Index: src/af/xap/win/winezmouse.h
===================================================================
RCS file: /cvsroot/abi/src/af/xap/win/winezmouse.h,v
retrieving revision 1.3
diff -u -r1.3 winezmouse.h
--- src/af/xap/win/winezmouse.h	16 Jan 2007 23:13:44 -0000	1.3
+++ src/af/xap/win/winezmouse.h	9 Apr 2007 08:37:15 -0000
@@ -21,17 +21,19 @@
  #ifndef __WINE_ZMOUSE_H
  #define __WINE_ZMOUSE_H
  
- #define MSH_MOUSEWHEEL "MSWHEEL_ROLLMSG"
+ #include <tchar.h>
  
- #define MOUSEZ_CLASSNAME  "MouseZ"
- #define MOUSEZ_TITLE      "Magellan MSWHEEL"
+ #define MSH_MOUSEWHEEL _T("MSWHEEL_ROLLMSG")
+ 
+ #define MOUSEZ_CLASSNAME  _T("MouseZ")
+ #define MOUSEZ_TITLE      _T("Magellan MSWHEEL")
  
  #define MSH_WHEELMODULE_CLASS (MOUSEZ_CLASSNAME)
  #define MSH_WHEELMODULE_TITLE (MOUSEZ_TITLE)
  
- #define MSH_WHEELSUPPORT "MSH_WHEELSUPPORT_MSG"
+ #define MSH_WHEELSUPPORT _T("MSH_WHEELSUPPORT_MSG")
  
- #define MSH_SCROLL_LINES "MSH_SCROLL_LINES_MSG"
+ #define MSH_SCROLL_LINES _T("MSH_SCROLL_LINES_MSG")
 
  #ifndef WHEEL_DELTA 
  #define WHEEL_DELTA      120
Index: src/af/xap/win/xap_Win32App.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/xap/win/xap_Win32App.cpp,v
retrieving revision 1.83
diff -u -r1.83 xap_Win32App.cpp
--- src/af/xap/win/xap_Win32App.cpp	1 Mar 2007 12:48:33 -0000	1.83
+++ src/af/xap/win/xap_Win32App.cpp	9 Apr 2007 08:37:16 -0000
@@ -113,7 +113,7 @@
 #if ABI_OPT_DISABLE_USP
 		HINSTANCE hUniscribe = NULL;
 #else
-		HINSTANCE hUniscribe = LoadLibrary("usp10.dll");
+		HINSTANCE hUniscribe = LoadLibrary(_T("usp10.dll"));
 #endif
 
 		if(hUniscribe)
@@ -531,13 +531,8 @@
 
 const char * XAP_Win32App::getDefaultEncoding () const
 {
-	#ifdef UNICODE
+	// ANSI and UNICODE versions work internally with UTF-8
 	return "UTF-8";
-	#else
-	XAP_EncodingManager * pEncodingManager = XAP_EncodingManager::get_instance();
-	return pEncodingManager->getNativeSystemEncodingName();
-	#endif
-	
 }
 
 #ifdef UNICODE
Index: src/af/xap/win/xap_Win32AppImpl.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/xap/win/xap_Win32AppImpl.cpp,v
retrieving revision 1.10
diff -u -r1.10 xap_Win32AppImpl.cpp
--- src/af/xap/win/xap_Win32AppImpl.cpp	1 Mar 2007 13:00:54 -0000	1.10
+++ src/af/xap/win/xap_Win32AppImpl.cpp	9 Apr 2007 08:37:16 -0000
@@ -28,36 +28,39 @@
 #include "xap_Frame.h"
 #include "xap_App.h"
 #include "xap_Win32FrameImpl.h"
+#include "ut_Win32LocaleString.h"
 
 bool XAP_Win32AppImpl::openURL(const char * szURL)
 {
 	// NOTE: could get finer control over browser window via DDE 
 	// NOTE: may need to fallback to WinExec for old NSCP versions
 
-	UT_String sURL = szURL;
+	UT_Win32LocaleString sURL;
+	sURL.fromASCII (szURL);
 
 	// If this is a file:// URL, strip off file:// and make it backslashed
-	if (sURL.substr(0, 7) == "file://")
+	if (sURL.substr(0, 7) == _T("file://"))
 	{
 		sURL = sURL.substr(7, sURL.size() - 7);
 
 		// View as WebPage likes to throw in an extra /\ just for fun, strip it off
-		if (sURL.substr(0, 2) == "/\\")
+		if (sURL.substr(0, 2) == _T("/\\"))
 			sURL = sURL.substr(2, sURL.size() - 2);
 
-		if (sURL.substr(0, 1) == "/")
+		if (sURL.substr(0, 1) == _T("/"))
 			sURL = sURL.substr(1, sURL.size() - 1);
 		
 		// Convert all forwardslashes to backslashes
 		for (unsigned int i=0; i<sURL.length();i++)	
-			if (sURL[i]=='/')	sURL[i]='\\';
+			if (sURL[i]==_T('/')) 
+				sURL[i]=_T('\\');
 
 		// Convert from longpath to 8.3 shortpath, in case of spaces in the path
-		char* longpath = NULL;
-		char* shortpath = NULL;
-		longpath = new char[PATH_MAX];
-		shortpath = new char[PATH_MAX];
-		strcpy(longpath, sURL.c_str());
+		TCHAR* longpath = NULL;
+		TCHAR* shortpath = NULL;
+		longpath = new TCHAR[PATH_MAX];
+		shortpath = new TCHAR[PATH_MAX];
+		_tcscpy(longpath, sURL.c_str());
 		DWORD retval = GetShortPathName(longpath, shortpath, PATH_MAX);
 		if((retval == 0) || (retval > PATH_MAX))
 		{
@@ -66,7 +69,7 @@
 			DELETEP(shortpath);
 			return false;
 		}
-		sURL = shortpath;
+		sURL.fromLocale (shortpath);
 		DELETEP(longpath);
 		DELETEP(shortpath);
 	}
@@ -78,7 +81,7 @@
 	DWORD dwSize;
 	unsigned char* szValue = NULL;
 
-	if (RegOpenKeyEx(HKEY_CLASSES_ROOT, "http\\shell\\open\\command", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
+	if (RegOpenKeyEx(HKEY_CLASSES_ROOT, _T("http\\shell\\open\\command"), 0, KEY_READ, &hKey) == ERROR_SUCCESS)
 	{
 		if(RegQueryValueEx(hKey, NULL, NULL, &lType, NULL, &dwSize) == ERROR_SUCCESS)
 		{
@@ -116,11 +119,11 @@
 	if (pdest != NULL)
 	{
 		int i = pdest - sParams.c_str() + 1;
-		sParams = sParams.substr(0, i-1) + sURL + sParams.substr(i+1, sParams.length()-i+1);
+		sParams = sParams.substr(0, i-1) + sURL.ascii_str() + sParams.substr(i+1, sParams.length()-i+1);
 	}
 	else
 	{
-		sParams = sParams + " " + sURL;
+		sParams = sParams + " " + sURL.ascii_str();
 	}
 
 	// Win95 doesn't like the Browser command to be quoted, so strip em off.
@@ -134,7 +137,7 @@
 	XAP_Win32FrameImpl *pFImp =  (XAP_Win32FrameImpl *) pFrame->getFrameImpl();
 	UT_return_val_if_fail(pFImp, false);
 
-	int res = (int) ShellExecute(pFImp->getTopLevelWindow() /*(HWND)*/,
+	int res = (int) ShellExecuteA(pFImp->getTopLevelWindow() /*(HWND)*/,
 								 "open", sBrowser.c_str(), sParams.c_str(), NULL, SW_SHOW );
 
 	// TODO: localized error messages
@@ -149,8 +152,8 @@
 					errMsg = "Error ("; 
 					errMsg += UT_String_sprintf("%d", res);
 					errMsg += ") displaying URL: The system cannot find the file specified.\n";
-					errMsg += " [ ";  errMsg += sURL;  errMsg += " ] ";
-					MessageBox(pFImp->getTopLevelWindow(), errMsg.c_str(), "Error displaying URL", MB_OK|MB_ICONEXCLAMATION);
+					errMsg += " [ ";  errMsg += sURL.ascii_str();  errMsg += " ] ";
+					MessageBoxA(pFImp->getTopLevelWindow(), errMsg.c_str(), "Error displaying URL", MB_OK|MB_ICONEXCLAMATION);
 				}
 				break;
 
@@ -159,8 +162,8 @@
 					errMsg = "Error ("; 
 					errMsg += UT_String_sprintf("%d", res);
 					errMsg += ") displaying URL: The system cannot find the path specified.\n";
-					errMsg += " [ ";  errMsg += sURL;  errMsg += " ] ";
-					MessageBox(pFImp->getTopLevelWindow(), errMsg.c_str(), "Error displaying URL", MB_OK|MB_ICONEXCLAMATION);
+					errMsg += " [ ";  errMsg += sURL.ascii_str();  errMsg += " ] ";
+					MessageBoxA(pFImp->getTopLevelWindow(), errMsg.c_str(), "Error displaying URL", MB_OK|MB_ICONEXCLAMATION);
 				}
 				break;
 
@@ -169,8 +172,8 @@
 					errMsg = "Error ("; 
 					errMsg += UT_String_sprintf("%d", res);
 					errMsg += ") displaying URL: Access is denied.\n";
-					errMsg += " [ ";  errMsg += sURL;  errMsg += " ] ";
-					MessageBox(pFImp->getTopLevelWindow(), errMsg.c_str(), "Error displaying URL", MB_OK|MB_ICONEXCLAMATION);
+					errMsg += " [ ";  errMsg += sURL.ascii_str();  errMsg += " ] ";
+					MessageBoxA(pFImp->getTopLevelWindow(), errMsg.c_str(), "Error displaying URL", MB_OK|MB_ICONEXCLAMATION);
 				}
 				break;
 
@@ -179,8 +182,8 @@
 					errMsg = "Error ("; 
 					errMsg += UT_String_sprintf("%d", res);
 					errMsg += ") displaying URL: \n";
-					errMsg += " [ ";  errMsg += sURL;  errMsg += " ] ";
-					MessageBox(pFImp->getTopLevelWindow(), errMsg.c_str(), "Error displaying URL", MB_OK|MB_ICONEXCLAMATION);
+					errMsg += " [ ";  errMsg += sURL.ascii_str();  errMsg += " ] ";
+					MessageBoxA(pFImp->getTopLevelWindow(), errMsg.c_str(), "Error displaying URL", MB_OK|MB_ICONEXCLAMATION);
 				}
 				break;
 		} /* switch (res) */
Index: src/af/xap/win/xap_Win32DialogBase.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/xap/win/xap_Win32DialogBase.cpp,v
retrieving revision 1.11
diff -u -r1.11 xap_Win32DialogBase.cpp
--- src/af/xap/win/xap_Win32DialogBase.cpp	16 Jan 2007 23:13:44 -0000	1.11
+++ src/af/xap/win/xap_Win32DialogBase.cpp	9 Apr 2007 08:37:17 -0000
@@ -23,6 +23,7 @@
 #include "xap_Strings.h"
 #include "xap_Win32DialogBase.h"
 #include "xap_Win32FrameImpl.h"
+#include "ut_Win32LocaleString.h"
 
 void XAP_Win32DialogBase::createModal(XAP_Frame* pFrame, LPCTSTR dlgTemplate)
 {
@@ -42,8 +43,7 @@
 	HWND hFrameWnd = pWin32FrameImpl->getTopLevelWindow();
 
 	// raise the dialog
-	const int result =
-		DialogBoxParam(pWin32App->getInstance(),
+	int result = DialogBoxParam(pWin32App->getInstance(),
 						dlgTemplate,
 						hFrameWnd,
 						(DLGPROC)&XAP_Win32DialogBase::s_dlgProc,
@@ -53,66 +53,52 @@
 	UT_ASSERT(result != -1);
 }
 
-
 HWND XAP_Win32DialogBase::createModeless(XAP_Frame* pFrame, LPCTSTR dlgTemplate)
 {
 	UT_ASSERT(m_tag == magic_tag);
-
+	UT_ASSERT(pFrame);
 	XAP_App* pApp = XAP_App::getApp();
 	UT_ASSERT(pApp);
 
 	XAP_Win32App* pWin32App = static_cast<XAP_Win32App*>(pApp);
-
+	
 	XAP_FrameImpl* pFrameImpl = pFrame->getFrameImpl();
-
-	UT_ASSERT(pFrame);
-
 	XAP_Win32FrameImpl* pWin32FrameImpl = static_cast<XAP_Win32FrameImpl*>(pFrameImpl);
-
 	HWND hFrameWnd = pWin32FrameImpl->getTopLevelWindow();
 
-	HWND hWnd =
-		CreateDialogParam(pWin32App->getInstance(),
+	HWND hWnd =	CreateDialogParam(pWin32App->getInstance(),
 							dlgTemplate,
 							hFrameWnd,
 							(DLGPROC)&XAP_Win32DialogBase::s_dlgProc,
 							(LPARAM)this);
 	// possibly we shouldn't check for success/failure here?
 	UT_ASSERT(hWnd != NULL);
-
+	m_hDlg = hWnd;
+	showWindow(SW_SHOW);
+	bringWindowToTop();
 	return hWnd;
 }
 
 
 BOOL CALLBACK XAP_Win32DialogBase::s_dlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 {
-	static const char szProp[] = "abiWin23base_dlgproc";
-
-	XAP_Win32DialogBase* pThis;
+	XAP_Win32DialogBase* pThis = NULL;
 
 	if (msg == WM_INITDIALOG)
-	{
-		pThis = (XAP_Win32DialogBase*)lParam;
-		pThis->m_hDlg = hWnd;
-		SetProp(hWnd, szProp, (HANDLE)lParam /* XAP_Win32DialogBase* */);
+	{		
+		pThis = (XAP_Win32DialogBase *) lParam;
+		SetWindowLong(hWnd, DWL_USER, lParam);
+		pThis->m_hDlg = hWnd;		
 		return pThis->_onInitDialog(hWnd, wParam, lParam);
 	}
-	else
-	{
-		pThis = (XAP_Win32DialogBase*)GetProp(hWnd, szProp);
-	}
-
-	if (!pThis)
-	{
-		// ... then we must assume this is some init out of our control,
-		// and pass it to the system
-		return FALSE;
-	}
-
-	UT_ASSERT(pThis);
+	
+	pThis = (XAP_Win32DialogBase *) GetWindowLong(hWnd,DWL_USER);
+	
+	if (pThis == NULL)
+		return FALSE;	
+	
 	UT_ASSERT(pThis->m_tag == magic_tag);
 
-
 	switch (msg)
 	{
 
@@ -152,7 +138,7 @@
 	return FALSE;
 }
 
-void XAP_Win32DialogBase::checkButton(UT_sint32 controlId, bool bChecked)
+void XAP_Win32DialogBase::checkDlgButton(UT_sint32 controlId, bool bChecked)
 {
 	UT_ASSERT(IsWindow(m_hDlg));
 	CheckDlgButton(m_hDlg, controlId, bChecked ? BST_CHECKED : BST_UNCHECKED);
@@ -167,13 +153,18 @@
 void XAP_Win32DialogBase::destroyWindow()
 {
 	UT_ASSERT(IsWindow(m_hDlg));
-	DestroyWindow(m_hDlg);
+	int iResult = DestroyWindow(m_hDlg);
+	UT_ASSERT_HARMLESS((iResult != 0));
 }
 
-void XAP_Win32DialogBase::setDialogTitle(LPCSTR p_str)
+void XAP_Win32DialogBase::setDialogTitle(const char* uft8_str)
 {
 	UT_ASSERT(IsWindow(m_hDlg));
-	SetWindowText(m_hDlg, p_str);
+	
+	UT_Win32LocaleString str;
+	str.fromUTF8 (uft8_str);
+	SetWindowText (m_hDlg, str.c_str());
+	//SetWindowText(m_hDlg, p_str);
 }
 
 int XAP_Win32DialogBase::showWindow(int Mode )
@@ -190,20 +181,30 @@
 
 int XAP_Win32DialogBase::bringWindowToTop()
 {
-	UT_ASSERT(IsWindow(m_hDlg));
-	const UINT uFlags =	SWP_NOMOVE |
-						SWP_NOOWNERZORDER |
-						SWP_NOSIZE |
-						SWP_NOACTIVATE;
-	return SetWindowPos(m_hDlg, HWND_TOP, 0, 0, 0, 0, uFlags);
+	UT_ASSERT(IsWindow(m_hDlg));	
+	return BringWindowToTop(m_hDlg);
 }
 
+void XAP_Win32DialogBase::notifyCloseFrame(XAP_Frame *pFrame)
+{
+	if((HWND)GetWindowLong(m_hDlg, GWL_HWNDPARENT) == static_cast<XAP_Win32FrameImpl*>(pFrame->getFrameImpl())->getTopLevelWindow())
+	{
+		SetWindowLong(m_hDlg, GWL_HWNDPARENT, NULL);
+		SetWindowPos(m_hDlg, NULL, 0, 0, 0, 0,
+						SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
+	}
+}
+
+
 // Combo boxes.
 
 int XAP_Win32DialogBase::addItemToCombo(UT_sint32 controlId, LPCSTR p_str)
 {
 	UT_ASSERT(IsWindow(m_hDlg));
-	return SendDlgItemMessage(m_hDlg, controlId, CB_ADDSTRING, 0, (LPARAM)p_str);
+	UT_Win32LocaleString str;
+	str.fromUTF8 (p_str); 
+	
+	return SendDlgItemMessage(m_hDlg, controlId, CB_ADDSTRING, 0, (LPARAM)str.c_str());	
 }
 
 int XAP_Win32DialogBase::setComboDataItem(UT_sint32 controlId, int nIndex, DWORD dwData)
@@ -243,6 +244,18 @@
 	SendDlgItemMessage(m_hDlg, controlId, CB_RESETCONTENT, 0, 0);
 }
 
+void XAP_Win32DialogBase::getComboTextItem(UT_sint32 controlId, int index, UT_Win32LocaleString& str)
+{
+	UT_ASSERT(IsWindow(m_hDlg));
+	
+	TCHAR szBuff[1024];	
+
+	if (SendDlgItemMessage(m_hDlg, controlId, CB_GETLBTEXT, index, (LPARAM)szBuff) != CB_ERR)
+		str.fromLocale(szBuff);
+	else
+		str.clear();
+}
+
 // List boxes
 
 void XAP_Win32DialogBase::resetContent(UT_sint32 controlId)
@@ -294,9 +307,34 @@
 void XAP_Win32DialogBase::setControlText(UT_sint32 controlId, LPCSTR p_str)
 {
 	UT_ASSERT(IsWindow(m_hDlg));
-	SetDlgItemText(m_hDlg, controlId, p_str);
+	//SetDlgItemText(m_hDlg, controlId, p_str);
+}
+
+bool XAP_Win32DialogBase::setDlgItemText(int nIDDlgItem,  const char* uft8_str)
+{
+	UT_ASSERT(IsWindow(m_hDlg));
+	
+	UT_Win32LocaleString str;
+	str.fromUTF8 (uft8_str);
+	return (bool) SetDlgItemText (m_hDlg, nIDDlgItem, str.c_str());
+}
+
+bool XAP_Win32DialogBase::getDlgItemText(int nIDDlgItem, UT_Win32LocaleString& str)
+{	
+	TCHAR szBuff [1024];	
+	bool rslt;
+	
+	rslt = (bool) GetDlgItemText(m_hDlg, nIDDlgItem, szBuff, 1024);
+	
+	if (rslt == true)
+		str.fromLocale(szBuff);
+	else
+		str.clear();
+	
+	return rslt;
 }
 
+
 void XAP_Win32DialogBase::setControlInt(UT_sint32 controlId, int value)
 {
 	UT_ASSERT(IsWindow(m_hDlg));
@@ -331,7 +369,7 @@
 											UT_sint32 Buffer_length) const
 {
 	UT_ASSERT(IsWindow(m_hDlg));
-	GetDlgItemText(m_hDlg, controlId, p_buffer, Buffer_length);
+	//GetDlgItemText(m_hDlg, controlId, p_buffer, Buffer_length);
 }
 
 bool XAP_Win32DialogBase::isControlVisible(UT_sint32 controlId) const
@@ -414,4 +452,42 @@
 	return TRUE;
 }
 
+//
+// Static
+//
+
+bool XAP_Win32DialogBase::setWindowText (HWND hWnd, const char* uft8_str)
+{
+	UT_ASSERT(IsWindow(hWnd));
+	
+	UT_Win32LocaleString str;
+	str.fromUTF8 (uft8_str);
+	return (bool) SetWindowText (hWnd, str.c_str());
+}
+
+bool XAP_Win32DialogBase::getDlgItemText(HWND hWnd, int nIDDlgItem, UT_Win32LocaleString& str)
+{	
+	UT_ASSERT(IsWindow(hWnd));
+	
+	TCHAR szBuff [1024];	
+	bool rslt;
+	
+	rslt = (bool) GetDlgItemText(hWnd, nIDDlgItem, szBuff, 1024);
+	
+	if (rslt == true)
+		str.fromLocale(szBuff);
+	else
+		str.clear();
+	
+	return rslt;
+}
+
+bool XAP_Win32DialogBase::setDlgItemText(HWND hWnd, int nIDDlgItem,  const char* uft8_str)
+{
+	UT_ASSERT(IsWindow(hWnd));
+	
+	UT_Win32LocaleString str;
+	str.fromUTF8 (uft8_str);
+	return (bool) SetDlgItemText (hWnd, nIDDlgItem, str.c_str());
+}
 
Index: src/af/xap/win/xap_Win32DialogBase.h
===================================================================
RCS file: /cvsroot/abi/src/af/xap/win/xap_Win32DialogBase.h,v
retrieving revision 1.6
diff -u -r1.6 xap_Win32DialogBase.h
--- src/af/xap/win/xap_Win32DialogBase.h	16 Jan 2007 23:13:44 -0000	1.6
+++ src/af/xap/win/xap_Win32DialogBase.h	9 Apr 2007 08:37:17 -0000
@@ -33,6 +33,7 @@
 #include <commctrl.h>
 
 #include "ut_types.h"
+#include "ut_Win32LocaleString.h"
 /*****************************************************************/
 
 
@@ -44,30 +45,41 @@
 public:
 	XAP_Win32DialogBase() : m_tag(magic_tag), m_hDlg(0), m_pDlg(0), m_pSS(0) {}
 	// no need for user-defined destructor
+	
+	// static functions
+	static bool setWindowText (HWND hWnd, const char* uft8_str);
+	static bool getDlgItemText(HWND hWnd, int nIDDlgItem, UT_Win32LocaleString& str);
+	static bool setDlgItemText(HWND hWnd, int nIDDlgItem, const char* uft8_str);
 		
 protected:
 	void createModal(XAP_Frame* pFrame, LPCTSTR dlgTemplate);
+	void createModal(XAP_Frame* pFrame);
 	HWND createModeless(XAP_Frame* pFrame, LPCTSTR dlgTemplate);
-
+	
+	//
+	void notifyCloseFrame(XAP_Frame *pFrame);
 
 	// Subclasses: override this and use it as your DLGPROC
 	virtual BOOL _onDlgMessage(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
-	virtual BOOL _onInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam) = 0;
-	virtual BOOL _onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam) = 0;
-	virtual BOOL _onDeltaPos(NM_UPDOWN * pnmud) = 0;
+	virtual BOOL _onInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam) {return FALSE;};
+	virtual BOOL _onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam) {return FALSE;};
+	virtual BOOL _onDeltaPos(NM_UPDOWN * pnmud) {return FALSE;};
 	virtual BOOL _callHelp();
 
 
 	// Control Functionality
-	void checkButton(UT_sint32 controlId, bool bChecked = true);
+	void checkDlgButton(UT_sint32 controlId, bool bChecked = true);
 	void enableControl(UT_sint32 controlId, bool bEnabled = true);
-	void destroyWindow();
-	void setDialogTitle(LPCSTR p_str);
+	void destroyWindow();	
+	void setDialogTitle(const char* uft8_str);
 	void localizeDialogTitle(UT_uint32 stringId);
 	int	 showWindow( int Mode );
 	int	 showControl(UT_sint32 controlId, int Mode);
 	int	 bringWindowToTop();
-
+	bool setDlgItemText(int nIDDlgItem, const char* uft8_str);
+	bool getDlgItemText(int nIDDlgItem, UT_Win32LocaleString& str);	
+	
+	
 	// Combo boxes.
 
 	int	 addItemToCombo(UT_sint32 controlId, LPCSTR p_str);
@@ -77,6 +89,7 @@
 	int  getComboItemIndex(UT_sint32 controlId, LPCSTR p_str);
 	int	 getComboSelectedIndex(UT_sint32 controlId) const;
 	void resetComboContent(UT_sint32 controlId);
+	void getComboTextItem(UT_sint32 controlId, int index, UT_Win32LocaleString& str);
 
 	// List boxes
 
@@ -106,7 +119,12 @@
 	void setDialog(XAP_Dialog * pDlg) { m_pDlg = pDlg; };
 	bool isDialogValid() const;
 	
+protected:
+	
+	HWND m_hDlg;
+	
 private:
+	
 	static BOOL CALLBACK s_dlgProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam);
 	
 	// disallow copying and assignment
@@ -117,8 +135,7 @@
 		magic_tag = 0x327211
 	};
 
-	int m_tag;	// all for safety
-	HWND m_hDlg;
+	int m_tag;	// all for safety	
 	XAP_Dialog* m_pDlg;
 	const XAP_StringSet* m_pSS;
 };
Index: src/af/xap/win/xap_Win32DialogHelper.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/xap/win/xap_Win32DialogHelper.cpp,v
retrieving revision 1.19
diff -u -r1.19 xap_Win32DialogHelper.cpp
--- src/af/xap/win/xap_Win32DialogHelper.cpp	16 Jan 2007 23:13:44 -0000	1.19
+++ src/af/xap/win/xap_Win32DialogHelper.cpp	9 Apr 2007 08:37:18 -0000
@@ -139,7 +139,7 @@
 void XAP_Win32DialogHelper::setDialogTitle(LPCSTR p_str)
 {
 	_assertValidDlgHandle(m_hDlg);
-	SetWindowText(m_hDlg, p_str);
+	//SetWindowText(m_hDlg, p_str);
 }
 
 int XAP_Win32DialogHelper::showWindow(int Mode )
@@ -254,13 +254,13 @@
 void XAP_Win32DialogHelper::setControlText(UT_sint32 controlId, LPCSTR p_str)
 {
 	_assertValidDlgHandle(m_hDlg);
-	SetDlgItemText(m_hDlg, controlId, p_str);
+	//SetDlgItemText(m_hDlg, controlId, p_str);
 }
 
 void XAP_Win32DialogHelper::setControlInt(UT_sint32 controlId, int value)
 {
 	_assertValidDlgHandle(m_hDlg);
-	SetDlgItemInt(m_hDlg, controlId, value, TRUE);
+	//SetDlgItemInt(m_hDlg, controlId, value, TRUE);
 }
 
 int XAP_Win32DialogHelper::getControlInt(UT_sint32 controlId) const
@@ -286,7 +286,7 @@
 											UT_sint32 Buffer_length) const
 {
 	_assertValidDlgHandle(m_hDlg);
-	GetDlgItemText(m_hDlg, controlId, p_buffer, Buffer_length);
+//	GetDlgItemText(m_hDlg, controlId, p_buffer, Buffer_length);
 }
 
 bool XAP_Win32DialogHelper::isControlVisible(UT_sint32 controlId) const
Index: src/af/xap/win/xap_Win32Dlg_About.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/xap/win/xap_Win32Dlg_About.cpp,v
retrieving revision 1.34
diff -u -r1.34 xap_Win32Dlg_About.cpp
--- src/af/xap/win/xap_Win32Dlg_About.cpp	8 Feb 2007 14:49:48 -0000	1.34
+++ src/af/xap/win/xap_Win32Dlg_About.cpp	9 Apr 2007 08:37:18 -0000
@@ -35,6 +35,7 @@
 #include "xap_Dialog_Id.h"
 #include "xap_Dlg_About.h"
 #include "xap_Win32Dlg_About.h"
+#include "ut_Win32LocaleString.h"
 
 // #include "xap_Win32Resources.rc2"
 #include "gr_Win32Graphics.h"
@@ -86,6 +87,7 @@
 {
 	// raise the dialog
 	XAP_Win32App * pWin32App = static_cast<XAP_Win32App *>(XAP_App::getApp());
+	UT_Win32LocaleString str, strbis;
 	m_pFrame = pFrame;
 
 	UT_ByteBuf * pBB = new UT_ByteBuf(g_pngSidebar_sizeof);
@@ -100,7 +102,7 @@
 	m_pGrImageSidebar->convertFromBuffer(pBB, iImageWidth, iImageHeight);
 
 	DELETEP(pBB);
-	const char * pClassName = "AbiSource_About";
+	const TCHAR * pClassName = _T("AbiSource_About");
 	
 	ATOM a = UT_RegisterClassEx(CS_HREDRAW | CS_VREDRAW, (WNDPROC) s_dlgProc, pWin32App->getInstance(),
 								NULL, LoadCursor(NULL, IDC_ARROW), GetSysColorBrush(COLOR_BTNFACE), NULL,
@@ -119,10 +121,11 @@
 	BringWindowToTop(hWndFrame);
 	pWin32App->enableAllTopLevelWindows(FALSE);
 
-	char buf[1024];
-	const XAP_StringSet*  pSS = XAP_App::getApp()->getStringSet();	
-	sprintf(buf, pSS->getValue(XAP_STRING_ID_DLG_ABOUT_Title), 
-			XAP_App::getApp()->getApplicationName());
+	TCHAR buf[1024];
+	const XAP_StringSet*  pSS = XAP_App::getApp()->getStringSet();
+	str.fromUTF8 (pSS->getValue(XAP_STRING_ID_DLG_ABOUT_Title));
+	strbis.fromASCII (XAP_App::getApp()->getApplicationName());
+	_stprintf(buf, str.c_str(), strbis.c_str());
 
 	HWND hwndAbout = UT_CreateWindowEx(	0L, pClassName,
 										buf,
@@ -148,9 +151,11 @@
 	GetClientRect(hwndAbout, &rcClient);
 	const int iWidth  = rcClient.right;
 	const int iHeight = rcClient.bottom;
-		
-	HWND hwndOK = CreateWindow("BUTTON",
-							   pSS->getValue(XAP_STRING_ID_DLG_OK),
+	
+	str.fromUTF8 (pSS->getValue(XAP_STRING_ID_DLG_OK));		
+	HWND hwndOK = CreateWindow(_T("BUTTON"),
+								//BUG BUG BUG, to do string conversion?
+							   str.c_str(),
 							   WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_DEFPUSHBUTTON,
 							   iWidth - BUTTON_WIDTH - BUTTON_GAP,
 							   iHeight - BUTTON_HEIGHT - BUTTON_GAP,
@@ -161,8 +166,8 @@
 							   pWin32App->getInstance(),
 							   NULL);
 
-	HWND hwndURL = CreateWindow("BUTTON",
-								"www.abisource.com",
+	HWND hwndURL = CreateWindow(_T("BUTTON"),
+								_T("www.abisource.com"),
 								WS_CHILD | WS_VISIBLE | WS_TABSTOP,
 								iWidth - BUTTON_WIDTH - BUTTON_GAP - 2*BUTTON_WIDTH - BUTTON_GAP,
 								iHeight - BUTTON_HEIGHT - BUTTON_GAP,
@@ -173,8 +178,9 @@
 								pWin32App->getInstance(),
 								NULL);
 
-	HWND hwndStatic_Heading = CreateWindow("STATIC",
-										   XAP_App::getApp()->getApplicationName(),
+	str.fromUTF8 (XAP_App::getApp()->getApplicationName());		
+	HWND hwndStatic_Heading = CreateWindow(_T("STATIC"),
+										   str.c_str(),
 										   WS_CHILD | WS_VISIBLE | SS_CENTER,
 										   iImageWidth,
 										   BUTTON_GAP,
@@ -185,9 +191,15 @@
 										   pWin32App->getInstance(),
 										   NULL);
 
-	sprintf(buf, XAP_ABOUT_VERSION, XAP_App::s_szBuild_Version); 
-	HWND hwndStatic_Version = CreateWindow("STATIC",
-										   buf,
+	str.fromASCII (XAP_App::s_szBuild_Version);
+#ifdef _UNICODE
+	str.appendASCII (" (Unicode build)");
+#else
+	str.appendASCII (" (ANSI build)");
+	
+#endif
+	HWND hwndStatic_Version = CreateWindow(_T("STATIC"),
+										   str.c_str(),
 										   WS_CHILD | WS_VISIBLE | SS_CENTER,
 										   iImageWidth + BUTTON_GAP,
 										   BUTTON_GAP + HEADING_HEIGHT + BUTTON_GAP,
@@ -198,8 +210,9 @@
 										   pWin32App->getInstance(),
 										   NULL);
 
-	HWND hwndStatic_Copyright = CreateWindow("STATIC",
-											 XAP_ABOUT_COPYRIGHT,
+	str.fromASCII (XAP_ABOUT_COPYRIGHT);
+	HWND hwndStatic_Copyright = CreateWindow(_T("STATIC"),
+											 str.c_str(),
 											 WS_CHILD | WS_VISIBLE | SS_LEFT,
 											 iImageWidth + BUTTON_GAP,
 											 BUTTON_GAP + HEADING_HEIGHT + BUTTON_GAP + VERSION_HEIGHT + 1*BUTTON_GAP,
@@ -210,8 +223,10 @@
 											 pWin32App->getInstance(),
 											 NULL);
 
-	sprintf(buf, XAP_ABOUT_GPL_LONG, XAP_App::getApp()->getApplicationName());
-	HWND hwndStatic_GPL = CreateWindow("STATIC",
+	str.fromASCII (XAP_App::getApp()->getApplicationName());
+	strbis.fromASCII (XAP_ABOUT_GPL_LONG);
+	_stprintf(buf, strbis.c_str(), str.c_str());
+	HWND hwndStatic_GPL = CreateWindow(_T("STATIC"),
 									   buf,
 									   WS_CHILD | WS_VISIBLE | SS_LEFT,
 									   iImageWidth + BUTTON_GAP,
@@ -230,8 +245,9 @@
 		GR_Win32USPGraphics * pUSP = static_cast<GR_Win32USPGraphics*>(
 												  pWin32App->getLastFocussedFrame()->getCurrentView()->getGraphics());
 		
-		hwndStatic_USP_Version = CreateWindow("STATIC",
-												   pUSP->getUSPVersion(),
+		str.fromASCII (pUSP->getUSPVersion());
+		hwndStatic_USP_Version = CreateWindow(_T("STATIC"),
+												   str.c_str(),
 												   WS_CHILD | WS_VISIBLE | SS_LEFT,
 												   BUTTON_GAP/2,
  				   								   iHeight - 3*BUTTON_HEIGHT/4,
@@ -246,7 +262,7 @@
 	}
 	
 	LOGFONT lf = { 0 };
-	strcpy(lf.lfFaceName, "MS Sans Serif");
+	_tcscpy(lf.lfFaceName, _T("MS Sans Serif"));
 	
 	lf.lfHeight = 12;
 	lf.lfWeight = 0;
@@ -256,7 +272,7 @@
 	lf.lfWeight = 0;
 	HFONT hfontSmall = CreateFontIndirect(&lf);
 
-	strcpy(lf.lfFaceName, "Arial");
+	_tcscpy(lf.lfFaceName, _T("Arial"));
 	lf.lfHeight = 36;
 	lf.lfWeight = FW_BOLD; 
 	HFONT hfontHeading = CreateFontIndirect(&lf);
@@ -314,6 +330,7 @@
 	{
 		SetFocus(hWndFrame);
 	}
+
 }
 
 BOOL CALLBACK XAP_Win32Dialog_About::s_dlgProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
Index: src/af/xap/win/xap_Win32Dlg_DocComparison.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/xap/win/xap_Win32Dlg_DocComparison.cpp,v
retrieving revision 1.5
diff -u -r1.5 xap_Win32Dlg_DocComparison.cpp
--- src/af/xap/win/xap_Win32Dlg_DocComparison.cpp	7 Apr 2007 17:21:19 -0000	1.5
+++ src/af/xap/win/xap_Win32Dlg_DocComparison.cpp	9 Apr 2007 08:37:18 -0000
@@ -63,69 +63,32 @@
 }
 
 void XAP_Win32Dialog_DocComparison::runModal(XAP_Frame * pFrame)
-{
-	UT_return_if_fail(pFrame);
-	// raise the dialog
+{	
 	XAP_Win32App * pWin32App = static_cast<XAP_Win32App *>(m_pApp);
-
 	XAP_Win32LabelledSeparator_RegisterClass(pWin32App);
-
-	LPCTSTR lpTemplate = NULL;
-
 	UT_ASSERT(m_id == XAP_DIALOG_ID_DOCCOMPARISON);
-
-	lpTemplate = MAKEINTRESOURCE(XAP_RID_DIALOG_DOCCOMPARISON);
-
-	int result = DialogBoxParam(pWin32App->getInstance(),lpTemplate,
-						static_cast<XAP_Win32FrameImpl*>(pFrame->getFrameImpl())->getTopLevelWindow(),
-						(DLGPROC)s_dlgProc,(LPARAM)this);
-	UT_ASSERT_HARMLESS((result != -1));
-	if(result == -1)
-		UT_DEBUGMSG(( "XAP_Win32Dlg_DocComparison::runModal error %d\n", GetLastError() ));
-
-}
-
-BOOL CALLBACK XAP_Win32Dialog_DocComparison::s_dlgProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
-{
-	// This is a static function.
-
-	XAP_Win32Dialog_DocComparison * pThis;
-
-	switch (msg)
-	{
-	case WM_INITDIALOG:
-		pThis = (XAP_Win32Dialog_DocComparison *)lParam;
-		SetWindowLong(hWnd,DWL_USER,lParam);
-		return pThis->_onInitDialog(hWnd,wParam,lParam);
-
-	case WM_COMMAND:
-		pThis = (XAP_Win32Dialog_DocComparison *)GetWindowLong(hWnd,DWL_USER);
-		return pThis->_onCommand(hWnd,wParam,lParam);
-
-	default:
-		return 0;
-	}
+	createModal(pFrame, MAKEINTRESOURCE(XAP_RID_DIALOG_DOCCOMPARISON));
 }
 
 BOOL XAP_Win32Dialog_DocComparison::_onInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
 	// set the window title
-	SetWindowText(hWnd, getWindowLabel());
+	setDialogTitle (getWindowLabel());	
 	
 	// localize buttons
-	SetDlgItemText(hWnd,XAP_RID_DIALOG_DOCCOMPARISON_BTN_OK,getButtonLabel());
+	setDlgItemText(XAP_RID_DIALOG_DOCCOMPARISON_BTN_OK,getButtonLabel());
 
 	// set frame titles
-	SetDlgItemText(hWnd, XAP_RID_DIALOG_DOCCOMPARISON_FRAME1,getFrame1Label());
-	SetDlgItemText(hWnd, XAP_RID_DIALOG_DOCCOMPARISON_FRAME2,getFrame2Label());
+	setDlgItemText(XAP_RID_DIALOG_DOCCOMPARISON_FRAME1,getFrame1Label());
+	setDlgItemText(XAP_RID_DIALOG_DOCCOMPARISON_FRAME2,getFrame2Label());
 
 	// fill frame 1
 	char * p = getPath1();
-	SetDlgItemText(hWnd,XAP_RID_DIALOG_DOCCOMPARISON_PATH1,p);
+	setDlgItemText(XAP_RID_DIALOG_DOCCOMPARISON_PATH1,p);
 	FREEP(p);
 
 	p = getPath2();
-	SetDlgItemText(hWnd,XAP_RID_DIALOG_DOCCOMPARISON_PATH2,p);
+	setDlgItemText(XAP_RID_DIALOG_DOCCOMPARISON_PATH2,p);
 	FREEP(p);
 	
 	// fill frame 2
@@ -135,15 +98,14 @@
 								  
 	for(i = 0; i < getResultCount(); i++)
 	{
-		SetDlgItemText(hWnd,k1 + i,getResultLabel(i));
+		setDlgItemText(k1 + i,getResultLabel(i));
 		
 		char * t = getResultValue(i);
-		SetDlgItemText(hWnd,k2 + i, t);
+		setDlgItemText(k2 + i, t);
 		FREEP(t);
 	}
 
-	XAP_Win32DialogHelper::s_centerDialog(hWnd);	
-
+	centerDialog();
 	return 1;							// 1 == we did not call SetFocus()
 }
 
@@ -164,4 +126,3 @@
 	}
 }
 
-
Index: src/af/xap/win/xap_Win32Dlg_DocComparison.h
===================================================================
RCS file: /cvsroot/abi/src/af/xap/win/xap_Win32Dlg_DocComparison.h,v
retrieving revision 1.3
diff -u -r1.3 xap_Win32Dlg_DocComparison.h
--- src/af/xap/win/xap_Win32Dlg_DocComparison.h	16 Jan 2007 23:13:44 -0000	1.3
+++ src/af/xap/win/xap_Win32Dlg_DocComparison.h	9 Apr 2007 08:37:18 -0000
@@ -23,11 +23,11 @@
 
 #include "xap_Dlg_DocComparison.h"
 #include "xap_Frame.h"
-
+#include "xap_Win32DialogBase.h"
 
 /*****************************************************************/
 
-class XAP_Win32Dialog_DocComparison: public XAP_Dialog_DocComparison
+class XAP_Win32Dialog_DocComparison: public XAP_Dialog_DocComparison, XAP_Win32DialogBase
 {
 public:
 	XAP_Win32Dialog_DocComparison(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id);
@@ -36,8 +36,7 @@
 	virtual void			runModal(XAP_Frame * pFrame);
 
 	static XAP_Dialog *		static_constructor(XAP_DialogFactory *, XAP_Dialog_Id id);
-
-	static BOOL CALLBACK	s_dlgProc(HWND,UINT,WPARAM,LPARAM);
+	
 
 protected:
 	BOOL					_onInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam);
Index: src/af/xap/win/xap_Win32Dlg_FileOpenSaveAs.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/xap/win/xap_Win32Dlg_FileOpenSaveAs.cpp,v
retrieving revision 1.60
diff -u -r1.60 xap_Win32Dlg_FileOpenSaveAs.cpp
--- src/af/xap/win/xap_Win32Dlg_FileOpenSaveAs.cpp	8 Feb 2007 14:49:48 -0000	1.60
+++ src/af/xap/win/xap_Win32Dlg_FileOpenSaveAs.cpp	9 Apr 2007 08:37:20 -0000
@@ -47,7 +47,7 @@
 #include "ie_impGraphic.h"
 
 #include "xap_Win32Resources.rc2"
-
+#include "ut_Win32LocaleString.h"
 
 #define MAX_DLG_INS_PICT_STRING 1030
 /*****************************************************************/
@@ -92,24 +92,28 @@
 
  \param indx -- index into the filter list
  */
-char * XAP_Win32Dialog_FileOpenSaveAs::_getDefaultExtension(UT_uint32 indx)
+TCHAR * XAP_Win32Dialog_FileOpenSaveAs::_getDefaultExtension(UT_uint32 indx)
 {
-	static char abw_sfx[] = "abw";
+	static TCHAR abw_sfx[] = _T("abw");
+	char defaultExtension[DEFAULT_EXT_SIZE + 1];
+	UT_Win32LocaleString def_ext;
 	
 	UT_uint32 end = g_strv_length((gchar **) m_szDescriptions);
 	if(indx >= end)
 		return abw_sfx;
 	
 	// copy at most DEFAULT_EXT_SIZE characters from the suffix;
-	strncpy(m_szDefaultExtension, m_szSuffixes[indx] + 2, DEFAULT_EXT_SIZE);
+	strncpy(defaultExtension, m_szSuffixes[indx] + 2, DEFAULT_EXT_SIZE);
 	
-	m_szDefaultExtension[DEFAULT_EXT_SIZE] = 0;
+	defaultExtension[DEFAULT_EXT_SIZE] = 0;
 	
 	// make sure that we get rid off the semicolon if it got copied
-	char * semicolon = strchr(m_szDefaultExtension, ';');
+	char * semicolon = strchr(defaultExtension, ';');
 	if(semicolon)
 		*semicolon = 0;
 	UT_DEBUGMSG(("Default sfx [%s], (from [%s]\n", m_szDefaultExtension,m_szSuffixes[indx]));
+	def_ext.fromASCII (defaultExtension);
+	_tcscpy (m_szDefaultExtension, def_ext.c_str());
 	return m_szDefaultExtension;
 }
 
@@ -232,22 +236,24 @@
 
 	HWND hFrame = static_cast<XAP_Win32FrameImpl*>(pFrame->getFrameImpl())->getTopLevelWindow();
 
-	char szFile[MAX_DLG_INS_PICT_STRING];	// buffer for filename
-	char szDir[MAX_DLG_INS_PICT_STRING];	// buffer for directory
+	TCHAR szFile[MAX_DLG_INS_PICT_STRING];	// buffer for filename
+	TCHAR szDir[MAX_DLG_INS_PICT_STRING];	// buffer for directory
 	UT_String sFilter;
 	OPENFILENAME_WIN50 ofn;						// common dialog box structure
+	UT_Win32LocaleString filter;
 
 	ZeroMemory(szFile,sizeof(szFile));
 	ZeroMemory(szDir,sizeof(szDir));
 	ZeroMemory(&ofn, sizeof(OPENFILENAME_WIN50));
 
 	_buildFilterList(sFilter);
+	filter.fromASCII (sFilter.c_str(), sFilter.size());
 
 	ofn.lStructSize = sizeof(OPENFILENAME);		// Old size
 	ofn.hwndOwner = hFrame;
 	ofn.lpstrFile = szFile;
 	ofn.nMaxFile = sizeof(szFile);
-	ofn.lpstrFilter = sFilter.c_str();
+	ofn.lpstrFilter = filter.c_str();
 	ofn.nFilterIndex = 1;
 	ofn.lpstrFileTitle = NULL;
 	ofn.nMaxFileTitle = 0;
@@ -272,8 +278,11 @@
 			// the dialog there (but without a filename).
 
 			// use directory(m_szPersistPathname)
-			strcpy(szDir,m_szPersistPathname);
-			char * pLastSlash = strrchr(szDir, '/');
+			UT_Win32LocaleString path;
+			path.fromUTF8 (m_szPersistPathname);
+			
+			_tcscpy(szDir, path.c_str());
+			TCHAR * pLastSlash = _tcsrchr (szDir, _T('/'));
 			if (pLastSlash)
 				pLastSlash[1] = 0;
 			ofn.lpstrInitialDir = szDir;
@@ -296,12 +305,15 @@
 		// it.	either way, we need to cut the pathname into two
 		// parts -- directory and file -- for the common dlg.
 
+		UT_Win32LocaleString uri;
 		const char * szURI = g_filename_from_uri(m_szInitialPathname, NULL, NULL);
 		if(!szURI)
 			szURI = "";
-
-		strcpy(szDir,AP_Win32App::s_fromUTF8ToWinLocale(szURI).c_str());
-		char * pLastSlash = strrchr(szDir, '/');
+		
+		uri.fromUTF8 (szURI);
+		_tcscpy(szDir, uri.c_str());
+		
+		TCHAR * pLastSlash = _tcsrchr(szDir, _T('/'));
 		if (pLastSlash)
 			pLastSlash[1] = 0;
 		ofn.lpstrInitialDir = szDir;
@@ -309,16 +321,16 @@
 		if (m_bSuggestName)
 		{
 			if (pLastSlash)
-				strcpy(szFile, AP_Win32App::s_fromUTF8ToWinLocale(szURI).c_str() + (pLastSlash-szDir+1));
+				_tcscpy(szFile, uri.c_str() + (pLastSlash-szDir+1));
 			else
-				strcpy(szFile, AP_Win32App::s_fromUTF8ToWinLocale(szURI).c_str());
+				_tcscpy(szFile, uri.c_str());
 
 			// if the file name has an extension, remove it
 			// (if we don't, and the document is of a different
 			// type than the one initially selected in the dialogue
 			// and the user just clicks OK, we get type - extension
 			// mismatch)
-			char * dot = strrchr(szFile, '.');
+			TCHAR * dot = _tcsrchr(szFile, _T('.'));
 			if(dot)
 				*dot = 0;
 		}
@@ -346,24 +358,28 @@
 	}
 
 	const XAP_StringSet* pSS = XAP_App::getApp()->getStringSet();
-
+	UT_Win32LocaleString title;
+	
 	switch (m_id)
 	{
-	case XAP_DIALOG_ID_FILE_OPEN:
-		ofn.lpstrTitle = pSS->getValue(XAP_STRING_ID_DLG_FOSA_OpenTitle);
+	case XAP_DIALOG_ID_FILE_OPEN:		
+		title.fromUTF8 (pSS->getValue(XAP_STRING_ID_DLG_FOSA_OpenTitle));
+		ofn.lpstrTitle = title.c_str();
 		ofn.Flags |= OFN_FILEMUSTEXIST;
 		ofn.nFilterIndex = g_strv_length((gchar **) m_szDescriptions) + 1;
 		bDialogResult = GetOpenFileName((OPENFILENAME *)&ofn);
 		break;
 
 	case XAP_DIALOG_ID_PRINTTOFILE:
-		ofn.lpstrTitle = pSS->getValue(XAP_STRING_ID_DLG_FOSA_PrintToFileTitle);
+		title.fromUTF8 (pSS->getValue(XAP_STRING_ID_DLG_FOSA_PrintToFileTitle));
+		ofn.lpstrTitle = title.c_str();		
 		ofn.Flags |= OFN_OVERWRITEPROMPT;
 		bDialogResult = GetSaveFileName((OPENFILENAME *)&ofn);
 		break;
 
 	case XAP_DIALOG_ID_FILE_SAVEAS:
-		ofn.lpstrTitle = pSS->getValue(XAP_STRING_ID_DLG_FOSA_SaveAsTitle);
+		title.fromUTF8 (pSS->getValue(XAP_STRING_ID_DLG_FOSA_SaveAsTitle));
+		ofn.lpstrTitle = title.c_str();
 		ofn.lpfnHook	   = (LPOFNHOOKPROC) s_hookSaveAsProc;
 		ofn.Flags |= OFN_OVERWRITEPROMPT;
 		ofn.Flags |= OFN_EXPLORER;
@@ -373,7 +389,8 @@
 		break;
 
 	case XAP_DIALOG_ID_INSERT_PICTURE:
-		ofn.lpstrTitle	   = pSS->getValue(XAP_STRING_ID_DLG_IP_Title);
+		title.fromUTF8 (pSS->getValue(XAP_STRING_ID_DLG_IP_Title));
+		ofn.lpstrTitle = title.c_str();
 		ofn.hInstance	   = pWin32App->getInstance();
 		ofn.lpTemplateName = MAKEINTRESOURCE(XAP_RID_DIALOG_INSERT_PICTURE);
 		ofn.lpfnHook	   = (LPOFNHOOKPROC) s_hookInsertPicProc;
@@ -385,21 +402,24 @@
 		break;
 
 	case XAP_DIALOG_ID_FILE_IMPORT:
-		ofn.lpstrTitle	 = pSS->getValue(XAP_STRING_ID_DLG_FOSA_ImportTitle);
+		title.fromUTF8 (pSS->getValue(XAP_STRING_ID_DLG_FOSA_ImportTitle));
+		ofn.lpstrTitle = title.c_str();
 		ofn.nFilterIndex = g_strv_length((gchar **) m_szDescriptions) + 1;
 		ofn.Flags |= OFN_FILEMUSTEXIST;
 		bDialogResult = GetOpenFileName((OPENFILENAME *)&ofn);
 		break;
 
 	case XAP_DIALOG_ID_INSERTMATHML:
-		ofn.lpstrTitle	 = pSS->getValue(XAP_STRING_ID_DLG_FOSA_InsertMath);
+		title.fromUTF8 (pSS->getValue(XAP_STRING_ID_DLG_FOSA_InsertMath));
+		ofn.lpstrTitle = title.c_str();
 		ofn.nFilterIndex = g_strv_length((gchar **) m_szDescriptions) + 1;
 		ofn.Flags |= OFN_FILEMUSTEXIST;
 		bDialogResult = GetOpenFileName((OPENFILENAME *)&ofn);
 		break;
 
 	case XAP_DIALOG_ID_FILE_EXPORT:
-		ofn.lpstrTitle = pSS->getValue(XAP_STRING_ID_DLG_FOSA_ExportTitle);
+		title.fromUTF8 (pSS->getValue(XAP_STRING_ID_DLG_FOSA_ExportTitle));
+		ofn.lpstrTitle = title.c_str();
 		ofn.lpfnHook	   = (LPOFNHOOKPROC) s_hookSaveAsProc;
 		ofn.Flags |= OFN_OVERWRITEPROMPT;
 		ofn.Flags |= OFN_EXPLORER;
@@ -408,7 +428,8 @@
 		break;
 
 	case XAP_DIALOG_ID_INSERT_FILE:
-		ofn.lpstrTitle = pSS->getValue(XAP_STRING_ID_DLG_FOSA_InsertTitle);
+		title.fromUTF8 (pSS->getValue(XAP_STRING_ID_DLG_FOSA_InsertTitle));
+		ofn.lpstrTitle = title.c_str();		
 		ofn.Flags |= OFN_FILEMUSTEXIST;
 		ofn.nFilterIndex = g_strv_length((gchar **) m_szDescriptions) + 1;
 		bDialogResult = GetOpenFileName((OPENFILENAME *)&ofn);
@@ -425,9 +446,15 @@
 	if (bDialogResult != FALSE)
 	{
 		UT_uint32 end = g_strv_length((gchar **) m_szSuffixes);
+		char szFileA [MAX_DLG_INS_PICT_STRING];	// buffer for filename
+		UT_Win32LocaleString sfile;
+		sfile.fromLocale (szFile);
+		
+		strcpy (szFileA, sfile.ascii_str());
 
+		// TODO
 		if ((m_id == XAP_DIALOG_ID_FILE_SAVEAS) &&
-			(!UT_pathSuffix(szFile)))
+			(!UT_pathSuffix(szFileA)))
 		{
 			// add suffix based on selected file type
 			// if selected file is "all documents" or "all"
@@ -444,19 +471,19 @@
 			
 			UT_ASSERT(szSuffix);
 
-			UT_uint32 length = strlen(szFile) + strlen(szSuffix) + 1;
+			UT_uint32 length = strlen(szFileA) + strlen(szSuffix) + 1;
 			m_szFinalPathname = (char *)UT_calloc(length,sizeof(char));
 			if (m_szFinalPathname)
 			{
 				char * p = m_szFinalPathname;
 
-				strcpy(p,szFile);
+				strcpy(p,szFileA);
 				strcat(p,szSuffix);
 			}
 		}
 		else
 		{
-			char *uri = UT_go_filename_to_uri(AP_Win32App::s_fromWinLocaleToUTF8(szFile).utf8_str());
+			char *uri = UT_go_filename_to_uri(sfile.utf8_str().utf8_str());
 			if(uri)
 			{
 				if(!(m_szFinalPathname = g_strdup(uri)))
@@ -500,7 +527,7 @@
 UINT CALLBACK XAP_Win32Dialog_FileOpenSaveAs::s_hookSaveAsProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
 {
 	XAP_Win32Dialog_FileOpenSaveAs* pThis;
-	static char buff[MAX_DLG_INS_PICT_STRING];
+	static TCHAR buff[MAX_DLG_INS_PICT_STRING];
 	switch(msg)
 	{
 		case WM_NOTIFY:
@@ -512,31 +539,31 @@
 						{
 							UT_DEBUGMSG(("SaveAs filetype changed to %d\n", pNotify->lpOFN->nFilterIndex));
 							pThis = (XAP_Win32Dialog_FileOpenSaveAs*)pNotify->lpOFN->lCustData;
-							char * ext = pThis->_getDefaultExtension(pNotify->lpOFN->nFilterIndex - 1);
+							TCHAR * ext = pThis->_getDefaultExtension(pNotify->lpOFN->nFilterIndex - 1);
 							// for some reason the  lpstrFile member of the struct will not be set properly
 							// so we have to retrieve the text directly from the control (I could swear that
 							// this used to work, and have no idea what changed)
 							GetDlgItemText(GetParent(hDlg), edt1, buff, MAX_DLG_INS_PICT_STRING);
-							//strcpy(buff,pNotify->lpOFN->lpstrFile);
-							char * dot = strchr(buff, '.');
+							_tcscpy (buff,pNotify->lpOFN->lpstrFile);
+							TCHAR * dot = _tcschr(buff, _T('.'));
 							if(dot)
 							{
 								*(dot+1) = 0;
 							}
 							else if(*buff)
 							{
-								UT_ASSERT(strlen(buff) < MAX_DLG_INS_PICT_STRING);
-								dot = buff + strlen(buff);
-								*dot = '.';
+								UT_ASSERT(_tcslen(buff) < MAX_DLG_INS_PICT_STRING);
+								dot = buff + _tcslen(buff);
+								*dot = _T('.');
 								*(dot+1) = 0;
 							}
 
 							if(dot)
 							{
-								UT_ASSERT(strlen(buff) + strlen(pNotify->lpOFN->lpstrDefExt) < MAX_DLG_INS_PICT_STRING);
+								UT_ASSERT(_tcslen(buff) + _tcslen(pNotify->lpOFN->lpstrDefExt) < MAX_DLG_INS_PICT_STRING);
 
 								if(ext)
-									strcat(buff,ext);
+									_tcscat(buff,ext);
 								else
 									*dot = 0;
 						
@@ -642,21 +669,24 @@
 {
 	HWND hFOSADlg	= GetParent(hDlg);
 	HWND hThumbnail = GetDlgItem(hDlg,XAP_RID_DIALOG_INSERT_PICTURE_IMAGE_PREVIEW);
+	UT_Win32LocaleString str;
 
 	const XAP_StringSet*  pSS	= XAP_App::getApp()->getStringSet();
 	UT_return_val_if_fail(pSS, false);
 
 	// Check if File Name is for a file
-	char buf[MAX_DLG_INS_PICT_STRING];
+	TCHAR buf[MAX_DLG_INS_PICT_STRING];
 	SendMessage( hFOSADlg, CDM_GETFILEPATH, sizeof(buf), (LPARAM) buf );
 	// If a Directory stop
 	if ( GetFileAttributes( buf ) == FILE_ATTRIBUTE_DIRECTORY )
 	{
 		return false;
 	}
+	
+	str.fromLocale (buf);
 
 	// Pass only files that can be openned
-	FILE* fitxer = fopen (buf,"r");
+	FILE* fitxer = fopen (str.ascii_str(),"r");
 
 	if (fitxer)
 		fclose(fitxer);
@@ -668,13 +698,13 @@
 	// Load File into memory
 	UT_ByteBuf* pBB 	= new UT_ByteBuf(NULL);
 	UT_ByteBuf* pTempBB = new UT_ByteBuf(NULL);
-	pBB->insertFromFile(0, buf);
+	pBB->insertFromFile(0, str.ascii_str());
 
 	// Build an Import Graphic based on file type
 	IEGraphicFileType iegft = IEGFT_Unknown;
 	IE_ImpGraphic* pIEG;
-	UT_Error errorCode = UT_ERROR;
-	char *uri = UT_go_filename_to_uri(buf);
+	UT_Error errorCode = UT_ERROR;	
+	char *uri = UT_go_filename_to_uri(str.ascii_str());
 	if(uri)
 		errorCode = IE_ImpGraphic::constructImporter(uri, iegft, &pIEG);
 
@@ -729,16 +759,18 @@
 	}
 
 	// Update Height and Width Strings
-	sprintf( buf, 
-			 "%s %d",
-			  pSS->getValue(XAP_STRING_ID_DLG_IP_Height_Label), 
+	str.fromUTF8 (pSS->getValue(XAP_STRING_ID_DLG_IP_Height_Label));
+	_stprintf( buf, 
+			 _T("%s %d"),
+			  str.c_str(), 
 			  iImageHeight );
 	SetDlgItemText( hDlg,
 					XAP_RID_DIALOG_INSERT_PICTURE_TEXT_HEIGHT,
 					buf );
 
-	sprintf( buf, 
-			 "%s %d",
+	str.fromUTF8 (pSS->getValue(XAP_STRING_ID_DLG_IP_Width_Label));
+	_stprintf( buf, 
+			 _T("%s %d"),
 			 pSS->getValue(XAP_STRING_ID_DLG_IP_Width_Label),
 			 iImageWidth );
 	SetDlgItemText( hDlg,
@@ -781,29 +813,28 @@
 UINT XAP_Win32Dialog_FileOpenSaveAs::_initPreviewDlg(HWND hDlg)
 {
 	HWND hFOSADlg	= GetParent(hDlg);
+	UT_Win32LocaleString str;
+	setHandle (hDlg);
 
 	const XAP_StringSet*  pSS		  = XAP_App::getApp()->getStringSet();
 	UT_return_val_if_fail(pSS, false);
 	
-	SetDlgItemText( hDlg,
-					XAP_RID_DIALOG_INSERT_PICTURE_IMAGE_PREVIEW,
+	setDlgItemText(XAP_RID_DIALOG_INSERT_PICTURE_IMAGE_PREVIEW,
 					pSS->getValue(XAP_STRING_ID_DLG_IP_No_Picture_Label) );
 
-	SetDlgItemText( hDlg,
-					XAP_RID_DIALOG_INSERT_PICTURE_CHECK_ACTIVATE_PREVIEW,
+	setDlgItemText(XAP_RID_DIALOG_INSERT_PICTURE_CHECK_ACTIVATE_PREVIEW,
 					pSS->getValue(XAP_STRING_ID_DLG_IP_Activate_Label) );
 
-	SetDlgItemText( hDlg,
-					XAP_RID_DIALOG_INSERT_PICTURE_TEXT_HEIGHT,
+	setDlgItemText(	XAP_RID_DIALOG_INSERT_PICTURE_TEXT_HEIGHT,
 					pSS->getValue(XAP_STRING_ID_DLG_IP_Height_Label) );
 
-	SetDlgItemText( hDlg,
-					XAP_RID_DIALOG_INSERT_PICTURE_TEXT_WIDTH,
+	setDlgItemText( XAP_RID_DIALOG_INSERT_PICTURE_TEXT_WIDTH,
 					pSS->getValue(XAP_STRING_ID_DLG_IP_Width_Label) );
-
+	
+	str.fromUTF8 (pSS->getValue(XAP_STRING_ID_DLG_IP_Button_Label));
 	SetDlgItemText( hFOSADlg,
 					IDOK,
-					pSS->getValue(XAP_STRING_ID_DLG_IP_Button_Label) );
+					str.c_str());
 
 	return true;
 
Index: src/af/xap/win/xap_Win32Dlg_FileOpenSaveAs.h
===================================================================
RCS file: /cvsroot/abi/src/af/xap/win/xap_Win32Dlg_FileOpenSaveAs.h,v
retrieving revision 1.20
diff -u -r1.20 xap_Win32Dlg_FileOpenSaveAs.h
--- src/af/xap/win/xap_Win32Dlg_FileOpenSaveAs.h	16 Jan 2007 23:13:44 -0000	1.20
+++ src/af/xap/win/xap_Win32Dlg_FileOpenSaveAs.h	9 Apr 2007 08:37:20 -0000
@@ -21,6 +21,7 @@
 #define XAP_WIN32DIALOG_FILEOPENSAVEAS_H
 
 #include "xap_Dlg_FileOpenSaveAs.h"
+#include "xap_Win32DialogBase.h"
 
 class UT_String;
 #include "xap_Frame.h"
@@ -29,7 +30,7 @@
 
 /*****************************************************************/
 
-class XAP_Win32Dialog_FileOpenSaveAs : public XAP_Dialog_FileOpenSaveAs
+class XAP_Win32Dialog_FileOpenSaveAs : public XAP_Dialog_FileOpenSaveAs, public XAP_Win32DialogBase
 {
 public:
 	XAP_Win32Dialog_FileOpenSaveAs(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id);
@@ -47,8 +48,8 @@
 
 	void _buildFilterList(UT_String& sFilter);
 private:
-	char * _getDefaultExtension(UT_uint32 indx);
-	char m_szDefaultExtension[DEFAULT_EXT_SIZE + 1];
+	TCHAR * _getDefaultExtension(UT_uint32 indx);
+	TCHAR m_szDefaultExtension[DEFAULT_EXT_SIZE + 1];
 	
 	//
 	// This the new OPENFILENAME struct included in the most
Index: src/af/xap/win/xap_Win32Dlg_FontChooser.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/xap/win/xap_Win32Dlg_FontChooser.cpp,v
retrieving revision 1.44
diff -u -r1.44 xap_Win32Dlg_FontChooser.cpp
--- src/af/xap/win/xap_Win32Dlg_FontChooser.cpp	8 Feb 2007 14:49:48 -0000	1.44
+++ src/af/xap/win/xap_Win32Dlg_FontChooser.cpp	9 Apr 2007 08:37:20 -0000
@@ -36,8 +36,10 @@
 #include "xap_Win32PreviewWidget.h"
 #include "gr_Graphics.h"
 #include "gr_Win32Graphics.h"
+#include "ut_Win32LocaleString.h"
 
 #include "xap_Win32Resources.rc2"
+#include "xap_Win32DialogBase.h"
 
 /*****************************************************************/
 XAP_Dialog * XAP_Win32Dialog_FontChooser::static_constructor(XAP_DialogFactory * pFactory,
@@ -72,6 +74,7 @@
 	UT_return_if_fail(pApp);
 	const XAP_EncodingManager *pEncMan = pApp->getEncodingManager();
 	UT_return_if_fail(pEncMan);
+	UT_Win32LocaleString family;
 
 	UT_DEBUGMSG(("FontChooserStart: Family[%s] Size[%s] Weight[%s] Style[%s] Color[%s] Underline[%d] StrikeOut[%d]\n",
 				 ((m_pFontFamily) ? m_pFontFamily : ""),
@@ -85,8 +88,7 @@
 	m_bWin32Overline   = m_bOverline;
 	m_bWin32Hidden     = m_bHidden;
 	m_bWin32SuperScript = m_bSuperScript;
-	m_bWin32SubScript = m_bSubScript;
-	
+	m_bWin32SubScript = m_bSubScript;	
 
 	/*
 	   WARNING: any changes to this function should be closely coordinated
@@ -110,8 +112,10 @@
 	cf.lCustData = (LPARAM) this;
 	cf.hInstance = pApp->getInstance();
 
-	if (m_pFontFamily && *m_pFontFamily)
-		strcpy(lf.lfFaceName,pEncMan->strToNative(m_pFontFamily, "UTF-8"));
+	if (m_pFontFamily && *m_pFontFamily) {		
+		family.fromUTF8 (m_pFontFamily);
+		_tcscpy(lf.lfFaceName,family.c_str());
+	}
 	else
 		cf.Flags |= CF_NOFACESEL;
 
@@ -155,9 +159,9 @@
 	// run the actual dialog...
 	m_answer = (ChooseFont(&cf) ? a_OK : a_CANCEL);
 	// Convert the font name returned by the Windows Font Chooser
-	// to UTF-8.
-	// (strToNative() puts the string in a static buffer).
-	const char *szFontFamily = pEncMan->strToNative(lf.lfFaceName, "UTF-8", true);
+	// to UTF-8.		
+	family.fromLocale (lf.lfFaceName);
+	const char *szFontFamily = family.utf8_str().utf8_str();
 
 	if (m_answer == a_OK)
 	{
@@ -305,14 +309,15 @@
 	return 0;
 }
 
-#define _DS(c,s)	SetDlgItemText(hWnd,XAP_RID_DIALOG_##c,pSS->getValue(XAP_STRING_ID_##s))
+#define _DS(c,s)	setDlgItemText(XAP_RID_DIALOG_##c,pSS->getValue(XAP_STRING_ID_##s))
 
 BOOL XAP_Win32Dialog_FontChooser::_onInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
 	XAP_App*              pApp        = XAP_App::getApp();
-	const XAP_StringSet*  pSS         = pApp->getStringSet();
-
-	SetWindowText(hWnd, pSS->getValue(XAP_STRING_ID_DLG_UFS_FontTitle));
+	const XAP_StringSet*  pSS         = pApp->getStringSet();		
+	m_hDlg = hWnd;
+	
+	setDialogTitle(pSS->getValue(XAP_STRING_ID_DLG_UFS_FontTitle));
 
 	// localize controls
 	_DS(FONT_TEXT_FONT,			DLG_UFS_FontLabel);
Index: src/af/xap/win/xap_Win32Dlg_FontChooser.h
===================================================================
RCS file: /cvsroot/abi/src/af/xap/win/xap_Win32Dlg_FontChooser.h,v
retrieving revision 1.16
diff -u -r1.16 xap_Win32Dlg_FontChooser.h
--- src/af/xap/win/xap_Win32Dlg_FontChooser.h	16 Jan 2007 23:13:44 -0000	1.16
+++ src/af/xap/win/xap_Win32Dlg_FontChooser.h	9 Apr 2007 08:37:21 -0000
@@ -22,12 +22,12 @@
 
 #include "xap_Dlg_FontChooser.h"
 #include "xap_Win32PreviewWidget.h"
-
+#include "xap_Win32DialogBase.h"
 #include "xap_Frame.h"
 
 /*****************************************************************/
 
-class XAP_Win32Dialog_FontChooser : public XAP_Dialog_FontChooser
+class XAP_Win32Dialog_FontChooser : public XAP_Dialog_FontChooser, XAP_Win32DialogBase
 {
 public:
 	XAP_Win32Dialog_FontChooser(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id);
Index: src/af/xap/win/xap_Win32Dlg_HTMLOptions.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/xap/win/xap_Win32Dlg_HTMLOptions.cpp,v
retrieving revision 1.8
diff -u -r1.8 xap_Win32Dlg_HTMLOptions.cpp
--- src/af/xap/win/xap_Win32Dlg_HTMLOptions.cpp	7 Apr 2007 17:21:19 -0000	1.8
+++ src/af/xap/win/xap_Win32Dlg_HTMLOptions.cpp	9 Apr 2007 08:37:21 -0000
@@ -155,10 +155,10 @@
 	enableControl(XAP_RID_DIALOG_HTMLOPTIONS_CHK_URLIMAGE),can_set_Embed_Images();
 
 	// set initial state
-	checkButton(XAP_RID_DIALOG_HTMLOPTIONS_CHK_HTML4,get_HTML4());
-	checkButton(XAP_RID_DIALOG_HTMLOPTIONS_CHK_PHP,get_PHTML()); 
-	checkButton(XAP_RID_DIALOG_HTMLOPTIONS_CHK_XML,get_Declare_XML());
-	checkButton(XAP_RID_DIALOG_HTMLOPTIONS_CHK_AWML,get_Allow_AWML());
-	checkButton(XAP_RID_DIALOG_HTMLOPTIONS_CHK_EMBEDCSS,get_Embed_CSS());
-	checkButton(XAP_RID_DIALOG_HTMLOPTIONS_CHK_URLIMAGE,get_Embed_Images());
+	checkDlgButton(XAP_RID_DIALOG_HTMLOPTIONS_CHK_HTML4,get_HTML4());
+	checkDlgButton(XAP_RID_DIALOG_HTMLOPTIONS_CHK_PHP,get_PHTML()); 
+	checkDlgButton(XAP_RID_DIALOG_HTMLOPTIONS_CHK_XML,get_Declare_XML());
+	checkDlgButton(XAP_RID_DIALOG_HTMLOPTIONS_CHK_AWML,get_Allow_AWML());
+	checkDlgButton(XAP_RID_DIALOG_HTMLOPTIONS_CHK_EMBEDCSS,get_Embed_CSS());
+	checkDlgButton(XAP_RID_DIALOG_HTMLOPTIONS_CHK_URLIMAGE,get_Embed_Images());
 }
Index: src/af/xap/win/xap_Win32Dlg_History.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/xap/win/xap_Win32Dlg_History.cpp,v
retrieving revision 1.5
diff -u -r1.5 xap_Win32Dlg_History.cpp
--- src/af/xap/win/xap_Win32Dlg_History.cpp	7 Apr 2007 17:21:19 -0000	1.5
+++ src/af/xap/win/xap_Win32Dlg_History.cpp	9 Apr 2007 08:37:21 -0000
@@ -64,61 +64,24 @@
 
 void XAP_Win32Dialog_History::runModal(XAP_Frame * pFrame)
 {
-	UT_return_if_fail(pFrame);
-	// raise the dialog
 	XAP_Win32App * pWin32App = static_cast<XAP_Win32App *>(m_pApp);
-
 	XAP_Win32LabelledSeparator_RegisterClass(pWin32App);
-
-	LPCTSTR lpTemplate = NULL;
-
-	UT_ASSERT(m_id == XAP_DIALOG_ID_HISTORY);
-
-	lpTemplate = MAKEINTRESOURCE(XAP_RID_DIALOG_HISTORY);
-
-	int result = DialogBoxParam(pWin32App->getInstance(),lpTemplate,
-						static_cast<XAP_Win32FrameImpl*>(pFrame->getFrameImpl())->getTopLevelWindow(),
-						(DLGPROC)s_dlgProc,(LPARAM)this);
-	UT_ASSERT_HARMLESS((result != -1));
-	if(result == -1)
-		UT_DEBUGMSG(( "XAP_Win32Dialog_History::runModal error %d\n", GetLastError() ));
-
-}
-
-BOOL CALLBACK XAP_Win32Dialog_History::s_dlgProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
-{
-	// This is a static function.
-
-	XAP_Win32Dialog_History * pThis;
-
-	switch (msg)
-	{
-	case WM_INITDIALOG:
-		pThis = (XAP_Win32Dialog_History *)lParam;
-		SetWindowLong(hWnd,DWL_USER,lParam);
-		return pThis->_onInitDialog(hWnd,wParam,lParam);
-
-	case WM_COMMAND:
-		pThis = (XAP_Win32Dialog_History *)GetWindowLong(hWnd,DWL_USER);
-		return pThis->_onCommand(hWnd,wParam,lParam);
-
-	default:
-		return 0;
-	}
+	UT_ASSERT(m_id == XAP_DIALOG_ID_HISTORY);	
+	createModal(pFrame, MAKEINTRESOURCE(XAP_RID_DIALOG_HISTORY));	
 }
 
 BOOL XAP_Win32Dialog_History::_onInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
 	// set the window title
-	SetWindowText(hWnd, getWindowLabel());
+	setDialogTitle(getWindowLabel());
 	
 	// localize buttons
-	SetDlgItemText(hWnd,XAP_RID_DIALOG_HISTORY_BTN_OK,getButtonLabel(0));
+	setDlgItemText(XAP_RID_DIALOG_HISTORY_BTN_OK,getButtonLabel(0));
 	//SetDlgItemText(hWnd,XAP_RID_DIALOG_HISTORY_BTN_SHOW,getButtonLabel(1));
-	SetDlgItemText(hWnd,XAP_RID_DIALOG_HISTORY_BTN_CANCEL,getButtonLabel(getButtonCount()-1));
+	setDlgItemText(XAP_RID_DIALOG_HISTORY_BTN_CANCEL,getButtonLabel(getButtonCount()-1));
 
 	// set the list title
-	SetDlgItemText(hWnd, XAP_RID_DIALOG_HISTORY_FRAME,getListTitle());
+	setDlgItemText(XAP_RID_DIALOG_HISTORY_FRAME,getListTitle());
 	
 	// fill in the section above the list
 	UT_uint32 i;
@@ -127,10 +90,10 @@
 								  
 	for(i = 0; i < getHeaderItemCount(); i++)
 	{
-		SetDlgItemText(hWnd,k1 + i,getHeaderLabel(i));
+		setDlgItemText(k1 + i,getHeaderLabel(i));
 		
 		char * t = getHeaderValue(i);
-		SetDlgItemText(hWnd,k2 + i, t);
+		setDlgItemText(k2 + i, t);
 		FREEP(t);
 	}
 
@@ -138,13 +101,15 @@
 	HWND h = GetDlgItem(hWnd, XAP_RID_DIALOG_HISTORY_LIST_VERSIONS);
 
 	LVCOLUMN col;
+	UT_Win32LocaleString str;
 
 	for(i = 0; i < getListColumnCount(); i++)
 	{
+		str.fromUTF8(getListHeader(i));
 		col.mask = LVCF_TEXT | LVCF_SUBITEM | LVCF_WIDTH;
 		col.iSubItem = i;
 		col.cx = 120;
-		col.pszText = const_cast<char*>(getListHeader(i));
+		col.pszText = (TCHAR *)str.c_str();
 		ListView_InsertColumn(h,i,&col);
 	}
 
@@ -156,7 +121,7 @@
 	item.stateMask = 0;
 	item.iImage = 0;
 
-	char buf[35];
+	TCHAR buf[35];
 	item.pszText = buf;
 	char * t;
 
@@ -168,7 +133,8 @@
 		{
 			item.iSubItem = j;
 			t = getListValue(i,j);
-			item.pszText = t;
+			str.fromUTF8(t);
+			item.pszText = (TCHAR *) str.c_str();
 			item.mask = LVIF_TEXT;
 			
 			if(j==0)
@@ -187,7 +153,7 @@
 	}
 	
 	SendMessage(h, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT);  								
-	XAP_Win32DialogHelper::s_centerDialog(hWnd);	
+	centerDialog();
 
 	return 1;							// 1 == we did not call SetFocus()
 }
Index: src/af/xap/win/xap_Win32Dlg_History.h
===================================================================
RCS file: /cvsroot/abi/src/af/xap/win/xap_Win32Dlg_History.h,v
retrieving revision 1.3
diff -u -r1.3 xap_Win32Dlg_History.h
--- src/af/xap/win/xap_Win32Dlg_History.h	16 Jan 2007 23:13:44 -0000	1.3
+++ src/af/xap/win/xap_Win32Dlg_History.h	9 Apr 2007 08:37:21 -0000
@@ -23,11 +23,11 @@
 
 #include "xap_Dlg_History.h"
 #include "xap_Frame.h"
-
+#include "xap_Win32DialogBase.h"
 
 /*****************************************************************/
 
-class XAP_Win32Dialog_History: public XAP_Dialog_History
+class XAP_Win32Dialog_History: public XAP_Dialog_History,  public XAP_Win32DialogBase
 {
 public:
 	XAP_Win32Dialog_History(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id);
@@ -36,10 +36,6 @@
 	virtual void			runModal(XAP_Frame * pFrame);
 
 	static XAP_Dialog *		static_constructor(XAP_DialogFactory *, XAP_Dialog_Id id);
-
-	static BOOL CALLBACK	s_dlgProc(HWND,UINT,WPARAM,LPARAM);
-
-protected:
 	BOOL					_onInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam);
 	BOOL					_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);
 
Index: src/af/xap/win/xap_Win32Dlg_Image.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/xap/win/xap_Win32Dlg_Image.cpp,v
retrieving revision 1.13
diff -u -r1.13 xap_Win32Dlg_Image.cpp
--- src/af/xap/win/xap_Win32Dlg_Image.cpp	8 Feb 2007 14:49:48 -0000	1.13
+++ src/af/xap/win/xap_Win32Dlg_Image.cpp	9 Apr 2007 08:37:22 -0000
@@ -99,9 +99,9 @@
 	// Initialize controls
 	setControlText( XAP_RID_DIALOG_IMAGE_EBX_HEIGHT, getHeightString() );
 	setControlText( XAP_RID_DIALOG_IMAGE_EBX_WIDTH, getWidthString() );
-	setControlText(XAP_RID_DIALOG_IMAGE_EBX_TITLE, AP_Win32App::s_fromUTF8ToWinLocale(getTitle().utf8_str()).c_str());
-	setControlText(XAP_RID_DIALOG_IMAGE_EBX_DESCRIPTION, AP_Win32App::s_fromUTF8ToWinLocale(getDescription().utf8_str()).c_str());
-	checkButton( XAP_RID_DIALOG_IMAGE_CHK_ASPECT, getPreserveAspect());
+	setControlText(XAP_RID_DIALOG_IMAGE_EBX_TITLE, getTitle().utf8_str());
+	setControlText(XAP_RID_DIALOG_IMAGE_EBX_DESCRIPTION, getDescription().utf8_str());
+	checkDlgButton( XAP_RID_DIALOG_IMAGE_CHK_ASPECT, getPreserveAspect());
 
 	// Initialize text wrapping radio buttons
 	if(getWrapping() == WRAP_INLINE)
@@ -238,14 +238,15 @@
 	case XAP_RID_DIALOG_IMAGE_EBX_HEIGHT:
 		if( wNotifyCode == EN_KILLFOCUS )
 		{
-			char buf[BUFSIZE];
-			GetDlgItemText( hWnd, wId, buf, BUFSIZE );
+			UT_Win32LocaleString str, units;
+			getDlgItemText (wId, str);
+			units.fromASCII (UT_dimensionName(getPreferedUnits()));
 
 			//let the user manually change dimensions too
-			if(!strstr(buf,UT_dimensionName(getPreferedUnits())))
-				strcat(buf,UT_dimensionName(getPreferedUnits()));
+			if(!_tcsstr(str.c_str(), units.c_str()))
+				str.appendLocale (units.c_str());
 
-			setHeight( buf );
+			setHeight( str.ascii_str());
 			setControlText( XAP_RID_DIALOG_IMAGE_EBX_HEIGHT, getHeightString() );
 			setControlText( XAP_RID_DIALOG_IMAGE_EBX_WIDTH, getWidthString() );
 		}
@@ -254,14 +255,14 @@
 	case XAP_RID_DIALOG_IMAGE_EBX_WIDTH:
 		if( wNotifyCode == EN_KILLFOCUS )
 		{
-			char buf[BUFSIZE];
-			GetDlgItemText( hWnd, wId, buf, BUFSIZE );
+			UT_Win32LocaleString str, units;
+			getDlgItemText (wId, str);
 
 			//let the user manually change dimensions too
-			if(!strstr(buf,UT_dimensionName(getPreferedUnits())))
-				strcat(buf,UT_dimensionName(getPreferedUnits()));
+			if(!_tcsstr(str.c_str(), units.c_str()))
+				str.appendLocale (units.c_str());
 
-			setWidth( buf );
+			setWidth( str.ascii_str() );
 			setControlText( XAP_RID_DIALOG_IMAGE_EBX_HEIGHT, getHeightString() );
 			setControlText( XAP_RID_DIALOG_IMAGE_EBX_WIDTH, getWidthString() );
 		}
Index: src/af/xap/win/xap_Win32Dlg_Insert_Symbol.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/xap/win/xap_Win32Dlg_Insert_Symbol.cpp,v
retrieving revision 1.28
diff -u -r1.28 xap_Win32Dlg_Insert_Symbol.cpp
--- src/af/xap/win/xap_Win32Dlg_Insert_Symbol.cpp	29 Mar 2007 17:41:35 -0000	1.28
+++ src/af/xap/win/xap_Win32Dlg_Insert_Symbol.cpp	9 Apr 2007 08:37:22 -0000
@@ -99,7 +99,7 @@
 
 	// Update the caption
 	ConstructWindowName();
-	SetWindowText(m_hDlg, (AP_Win32App::s_fromUTF8ToWinLocale(m_WindowName)).c_str());
+	setDialogTitle(m_WindowName);
 
 	iResult = ShowWindow( m_hDlg, SW_SHOW );
 
@@ -118,7 +118,7 @@
 	{
 		// Update the caption
 		ConstructWindowName();
-		SetWindowText(m_hDlg, (AP_Win32App::s_fromUTF8ToWinLocale(m_WindowName)).c_str());
+		setDialogTitle(m_WindowName);		
 
 		SetWindowLong(m_hDlg, GWL_HWNDPARENT, (long)frameHWND);
 		SetWindowPos(m_hDlg, NULL, 0, 0, 0, 0,
@@ -186,10 +186,10 @@
 
 	// Fill the list box with symbol fonts.
 
-	HDC hDCScreen = CreateDC("DISPLAY", NULL, NULL, NULL);
+	HDC hDCScreen = CreateDC(_T("DISPLAY"), NULL, NULL, NULL);
 
 #if 1
-	EnumFontFamilies(hDCScreen, (const char *)NULL, (FONTENUMPROC)fontEnumProcedure, (LPARAM)this);
+	EnumFontFamilies(hDCScreen, (const TCHAR *)NULL, (FONTENUMPROC)fontEnumProcedure, (LPARAM)this);
 #else
 	LOGFONT LogFont;
 //	LogFont.lfCharSet = SYMBOL_CHARSET; - all fonts enum is more inline with XP nature
@@ -214,8 +214,8 @@
 	}
 
 	// Update the caption
-	ConstructWindowName();
-	setDialogTitle((LPCSTR)(AP_Win32App::s_fromUTF8ToWinLocale(m_WindowName)).c_str());
+	ConstructWindowName();	
+	setDialogTitle(m_WindowName);
 	centerDialog();	
 
 	return 1;							// 1 == we did not call SetFocus()
Index: src/af/xap/win/xap_Win32Dlg_Language.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/xap/win/xap_Win32Dlg_Language.cpp,v
retrieving revision 1.22
diff -u -r1.22 xap_Win32Dlg_Language.cpp
--- src/af/xap/win/xap_Win32Dlg_Language.cpp	8 Feb 2007 14:49:48 -0000	1.22
+++ src/af/xap/win/xap_Win32Dlg_Language.cpp	9 Apr 2007 08:37:22 -0000
@@ -45,7 +45,7 @@
 #endif
  
 WHICHPROC gTreeProc;
-#define _DS(c,s)	SetDlgItemText(hWnd,XAP_RID_DIALOG_##c,pSS->getValue(XAP_STRING_ID_##s))
+#define _DS(c,s)	setDlgItemText(XAP_RID_DIALOG_##c,pSS->getValue(XAP_STRING_ID_##s))
 
 
 /*****************************************************************/
@@ -72,47 +72,8 @@
 
 void XAP_Win32Dialog_Language::runModal(XAP_Frame * pFrame)
 {
-	UT_return_if_fail(pFrame);
-
-	XAP_Win32App * pWin32App = static_cast<XAP_Win32App *>(m_pApp);
-	UT_return_if_fail(pWin32App);
-	
-	LPCTSTR lpTemplate = NULL;
-
 	UT_ASSERT(m_id == XAP_DIALOG_ID_LANGUAGE);
-
-	lpTemplate = MAKEINTRESOURCE(XAP_RID_DIALOG_LANGUAGE);
-
-	int result = DialogBoxParam(pWin32App->getInstance(),
-						lpTemplate,
-						static_cast<XAP_Win32FrameImpl*>(pFrame->getFrameImpl())->getTopLevelWindow(),
-						(DLGPROC)s_dlgProc,
-						(LPARAM)this );
-	UT_ASSERT((result != -1));
-}
-
-/*
-	
-*/
-BOOL CALLBACK XAP_Win32Dialog_Language::s_dlgProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
-{
-	// This is a static function.
-	XAP_Win32Dialog_Language * pThis;
-	
-	switch (msg)
-	{			
-	case WM_INITDIALOG:
-		pThis = (XAP_Win32Dialog_Language *)lParam;
-		SetWindowLong(hWnd,DWL_USER,lParam);
-		return pThis->_onInitDialog(hWnd,wParam,lParam);
-		
-	case WM_COMMAND:
-		pThis = (XAP_Win32Dialog_Language *)GetWindowLong(hWnd,DWL_USER);
-		return pThis->_onCommand(hWnd,wParam,lParam);
-		
-	default:
-		return 0;
-	}
+	createModal(pFrame, MAKEINTRESOURCE(XAP_RID_DIALOG_LANGUAGE));	
 }
 
 
@@ -150,9 +111,11 @@
 				tvi.iSelectedImage = tvi.iImage;
 				break;
 			}
-		}		
-		tvi.pszText = (char *)sLang;
-		tvi.cchTextMax = lstrlen(sLang);				
+		}
+		UT_Win32LocaleString str;
+		str.fromUTF8 (sLang);
+		tvi.pszText = (TCHAR *) str.c_str();
+		tvi.cchTextMax = str.length();
 		tvi.lParam=i;
 		tvins.item = tvi;
 		hItem = TreeView_InsertItem(hTV, &tvins);
@@ -209,10 +172,7 @@
 {
 	const XAP_StringSet * pSS = m_pApp->getStringSet();
 	
-	
-	m_hWnd = hWnd;
-	
-	SetWindowText(hWnd, pSS->getValue(XAP_STRING_ID_DLG_ULANG_LangTitle));
+	setDialogTitle (pSS->getValue(XAP_STRING_ID_DLG_ULANG_LangTitle));	
 
 	// localize controls
 	_DS(LANGUAGE_BTN_OK,			DLG_OK);
@@ -247,14 +207,12 @@
 
 	UT_UTF8String s;
 	getDocDefaultLangDescription(s);
-	SetDlgItemText(hWnd, XAP_RID_DIALOG_LANGUAGE_DOCLANG_STATIC,
-				   AP_Win32App::s_fromUTF8ToWinLocale(s.utf8_str()).c_str());
+	setDlgItemText(XAP_RID_DIALOG_LANGUAGE_DOCLANG_STATIC, s.utf8_str());
 
 	getDocDefaultLangCheckboxLabel(s);
-	SetDlgItemText(hWnd, XAP_RID_DIALOG_LANGUAGE_DOCLANG_CHKBOX,
-				   AP_Win32App::s_fromUTF8ToWinLocale(s.utf8_str()).c_str());
+	setDlgItemText(XAP_RID_DIALOG_LANGUAGE_DOCLANG_CHKBOX, s.utf8_str());
 	
-	XAP_Win32DialogHelper::s_centerDialog(hWnd);	
+	centerDialog();
 			
 	return 1;							// 1 == we did not call SetFocus()
 }
Index: src/af/xap/win/xap_Win32Dlg_Language.h
===================================================================
RCS file: /cvsroot/abi/src/af/xap/win/xap_Win32Dlg_Language.h,v
retrieving revision 1.7
diff -u -r1.7 xap_Win32Dlg_Language.h
--- src/af/xap/win/xap_Win32Dlg_Language.h	16 Jan 2007 23:13:44 -0000	1.7
+++ src/af/xap/win/xap_Win32Dlg_Language.h	9 Apr 2007 08:37:22 -0000
@@ -23,10 +23,11 @@
 #include "xap_Dlg_Language.h"
 #include "xap_Win32DialogHelper.h"
 #include "xap_Frame.h"
+#include "xap_Win32DialogBase.h"
 
 /*****************************************************************/
 
-class XAP_Win32Dialog_Language: public XAP_Dialog_Language
+class XAP_Win32Dialog_Language: public XAP_Dialog_Language, public XAP_Win32DialogBase
 {
 public:
 	XAP_Win32Dialog_Language(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id);
@@ -34,9 +35,8 @@
 
 	virtual void			runModal(XAP_Frame * pFrame);
 
-	static XAP_Dialog *		static_constructor(XAP_DialogFactory *, XAP_Dialog_Id id);
+	static XAP_Dialog *		static_constructor(XAP_DialogFactory *, XAP_Dialog_Id id);	
 	
-	static BOOL CALLBACK	s_dlgProc(HWND,UINT,WPARAM,LPARAM);
 	static BOOL CALLBACK 	s_treeProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam);
 	void 					_setLanguageAndExit(UINT nLang);
 		
Index: src/af/xap/win/xap_Win32Dlg_ListDocuments.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/xap/win/xap_Win32Dlg_ListDocuments.cpp,v
retrieving revision 1.7
diff -u -r1.7 xap_Win32Dlg_ListDocuments.cpp
--- src/af/xap/win/xap_Win32Dlg_ListDocuments.cpp	7 Apr 2007 17:21:19 -0000	1.7
+++ src/af/xap/win/xap_Win32Dlg_ListDocuments.cpp	9 Apr 2007 08:37:23 -0000
@@ -113,13 +113,13 @@
 {
 	const XAP_StringSet * pSS = m_pApp->getStringSet();
 
-	SetWindowText(hWnd, _getTitle());
+	//SetWindowText(hWnd, _getTitle());
 
 	// localize controls
-	_DSXS(BTN_OK,    _getOKButtonText());
-	_DSX(BTN_CANCEL, DLG_Cancel);
+	//_DSXS(BTN_OK,    _getOKButtonText());
+	//_DSX(BTN_CANCEL, DLG_Cancel);
 
-	SetDlgItemText(hWnd, XAP_RID_DIALOG_LIST_DOCUMENTS_HEADING,_getHeading());
+	//SetDlgItemText(hWnd, XAP_RID_DIALOG_LIST_DOCUMENTS_HEADING,_getHeading());
 
 	// set the column headings
 	HWND h = GetDlgItem(hWnd, XAP_RID_DIALOG_LIST_DOCUMENTS_LIST);
@@ -142,7 +142,7 @@
 	LVITEM item;
 	for(UT_uint32 i = 0; i < _getDocumentCount(); i++)
 	{
-		item.pszText = (char *)_getNthDocumentName(i);
+		//item.pszText = (char *)_getNthDocumentName(i);
 		item.iItem = i;
 		item.iSubItem = 0;
 		item.lParam = i;
Index: src/af/xap/win/xap_Win32Dlg_MessageBox.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/xap/win/xap_Win32Dlg_MessageBox.cpp,v
retrieving revision 1.18
diff -u -r1.18 xap_Win32Dlg_MessageBox.cpp
--- src/af/xap/win/xap_Win32Dlg_MessageBox.cpp	16 Jan 2007 23:13:44 -0000	1.18
+++ src/af/xap/win/xap_Win32Dlg_MessageBox.cpp	9 Apr 2007 08:37:23 -0000
@@ -23,6 +23,7 @@
 #include "xap_Win32App.h"
 #include "xap_Win32FrameImpl.h"
 #include "xap_EncodingManager.h"
+#include "ut_Win32LocaleString.h"
 
 /*****************************************************************/
 XAP_Dialog * XAP_Win32Dialog_MessageBox::static_constructor(XAP_DialogFactory * pFactory,
@@ -50,7 +51,8 @@
 	XAP_Win32App * pApp = static_cast<XAP_Win32App *>(XAP_App::getApp());
 	UT_return_if_fail(pApp);
 
-	const char * szCaption = pApp->getApplicationTitleForTitleBar();
+	UT_Win32LocaleString caption;
+	caption.fromASCII (pApp->getApplicationTitleForTitleBar());
 
 	HWND hwnd = static_cast<XAP_Win32FrameImpl*>(pFrame->getFrameImpl())->getTopLevelWindow();
 	UINT flags;
@@ -85,7 +87,7 @@
 		UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
 	}
 
-	int res = MessageBox(hwnd, getApp()->getEncodingManager()->strToNative(m_szMessage, "UTF-8"), szCaption, flags);
+	int res = MessageBox(hwnd, (TCHAR *) getApp()->getEncodingManager()->strToNative(m_szMessage, "UTF-8"), caption.c_str(), flags);
 
 	switch (res)
 	{
Index: src/af/xap/win/xap_Win32Dlg_Print.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/xap/win/xap_Win32Dlg_Print.cpp,v
retrieving revision 1.34
diff -u -r1.34 xap_Win32Dlg_Print.cpp
--- src/af/xap/win/xap_Win32Dlg_Print.cpp	1 Apr 2007 21:02:27 -0000	1.34
+++ src/af/xap/win/xap_Win32Dlg_Print.cpp	9 Apr 2007 08:37:24 -0000
@@ -28,7 +28,7 @@
 #include "xap_Win32FrameImpl.h"
 #include "xav_View.h"
 #include "gr_Win32Graphics.h"
-#include "ap_Win32App.h"
+#include "xap_Win32DialogBase.h"
 
 /*****************************************************************/
 static UINT CALLBACK s_PrintHookProc(
@@ -81,13 +81,13 @@
 			
 			if(pThis->getNewPrinter() != pThis->getOrigPrinter())
 			{
-				SetDlgItemText(hdlg,IDCANCEL,pSS->getValue(XAP_STRING_ID_DLG_Close));
+				XAP_Win32DialogBase::setDlgItemText(hdlg,IDCANCEL,pSS->getValue(XAP_STRING_ID_DLG_Close));
 			}
 			else
 			{
 				// the user set the printer back to what it used to be -- revert back to
 				// cancel button
-				SetDlgItemText(hdlg,IDCANCEL,pSS->getValue(XAP_STRING_ID_DLG_Cancel));
+				XAP_Win32DialogBase::setDlgItemText(hdlg,IDCANCEL,pSS->getValue(XAP_STRING_ID_DLG_Cancel));
 			}
 		}
 		else if((int)LOWORD(wParam) == IDCANCEL && HIWORD(wParam) == 0)
@@ -153,9 +153,15 @@
 
 	memset(&m_DocInfo,0,sizeof(m_DocInfo));
 	m_DocInfo.cbSize = sizeof(DOCINFO);
-	m_docName = AP_Win32App::s_fromUTF8ToWinLocale(m_szDocumentPathname);
+	m_docName.fromUTF8 (m_szDocumentPathname);
 	m_DocInfo.lpszDocName = m_docName.c_str();
-	m_DocInfo.lpszOutput = ((m_bDoPrintToFile) ? m_szPrintToFilePathname : NULL);
+	
+	if (m_bDoPrintToFile) {
+		m_fileName.fromUTF8 (m_szPrintToFilePathname);
+		m_DocInfo.lpszOutput = m_fileName.c_str();
+	} else {
+		m_DocInfo.lpszOutput = NULL;	
+	}	
 	
 	GR_Win32AllocInfo ai(m_pPersistPrintDlg->hDC,&m_DocInfo, m_pPersistPrintDlg->hDevMode);
 	GR_Win32Graphics *pGr = (GR_Win32Graphics *)XAP_App::getApp()->newGraphics(ai);
@@ -239,7 +245,7 @@
 			DEVNAMES * pDevNames = (DEVNAMES *)GlobalLock(m_pPersistPrintDlg->hDevNames);
 			UT_return_if_fail(pDevNames); //GlobalLock can return NULL
 
-			char * p = (char *)pDevNames;
+			TCHAR * p = (TCHAR *) pDevNames;
 			m_pPersistPrintDlg->hDC = CreateDC(p + pDevNames->wDriverOffset,
 											   p + pDevNames->wDeviceOffset,
 											   NULL,
Index: src/af/xap/win/xap_Win32Dlg_Print.h
===================================================================
RCS file: /cvsroot/abi/src/af/xap/win/xap_Win32Dlg_Print.h,v
retrieving revision 1.15
diff -u -r1.15 xap_Win32Dlg_Print.h
--- src/af/xap/win/xap_Win32Dlg_Print.h	1 Apr 2007 21:02:27 -0000	1.15
+++ src/af/xap/win/xap_Win32Dlg_Print.h	9 Apr 2007 08:37:24 -0000
@@ -22,6 +22,7 @@
 
 #include "xap_Dlg_Print.h"
 #include "xap_Frame.h"
+#include "ut_Win32LocaleString.h"
 
 #include <commdlg.h>
 /*****************************************************************/
@@ -56,7 +57,8 @@
 	UT_uint32               m_iOrigPrinter;
 	UT_uint32               m_iNewPrinter;
 	bool                    m_bClosed;
-	UT_String				m_docName;
+	UT_Win32LocaleString	m_docName;
+	UT_Win32LocaleString	m_fileName;
 };
 
 #endif /* XAP_WIN32DIALOG_PRINT_H */
Index: src/af/xap/win/xap_Win32Dlg_Zoom.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/xap/win/xap_Win32Dlg_Zoom.cpp,v
retrieving revision 1.25
diff -u -r1.25 xap_Win32Dlg_Zoom.cpp
--- src/af/xap/win/xap_Win32Dlg_Zoom.cpp	8 Feb 2007 14:49:48 -0000	1.25
+++ src/af/xap/win/xap_Win32Dlg_Zoom.cpp	9 Apr 2007 08:37:24 -0000
@@ -124,7 +124,7 @@
 	localizeControlText(XAP_RID_DIALOG_ZOOM_BTN_CLOSE,		XAP_STRING_ID_DLG_Close);
 
 	// set initial state
-	checkButton(XAP_RID_DIALOG_ZOOM_RADIO_200 + m_zoomType);
+	checkDlgButton(XAP_RID_DIALOG_ZOOM_RADIO_200 + m_zoomType);
 	setControlInt(XAP_RID_DIALOG_ZOOM_EDIT_PCT, (UINT) m_zoomPercent);
 	m_bEditPctEnabled = ((XAP_RID_DIALOG_ZOOM_RADIO_200 + m_zoomType) == XAP_RID_DIALOG_ZOOM_RADIO_PCT);
 	enableControl(XAP_RID_DIALOG_ZOOM_EDIT_PCT ,m_bEditPctEnabled);
Index: src/af/xap/win/xap_Win32EncodingManager.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/xap/win/xap_Win32EncodingManager.cpp,v
retrieving revision 1.12
diff -u -r1.12 xap_Win32EncodingManager.cpp
--- src/af/xap/win/xap_Win32EncodingManager.cpp	29 Mar 2007 17:41:35 -0000	1.12
+++ src/af/xap/win/xap_Win32EncodingManager.cpp	9 Apr 2007 08:37:24 -0000
@@ -80,7 +80,7 @@
 
 	// Encodings
 	// User Encoding (Set via Region/Locale; does not require reboot)
-	if (GetLocaleInfo(LOCALE_USER_DEFAULT,LOCALE_IDEFAULTANSICODEPAGE,szLocaleInfo,sizeof(szLocaleInfo)/sizeof(szLocaleInfo[0])))
+	if (GetLocaleInfoA(LOCALE_USER_DEFAULT,LOCALE_IDEFAULTANSICODEPAGE,szLocaleInfo,sizeof(szLocaleInfo)/sizeof(szLocaleInfo[0])))
 	{
 		// Windows Unicode locale?
 		if (!strcmp(szLocaleInfo,"0"))
@@ -94,11 +94,12 @@
 			szCodepage[1] = 'P';
 			strcpy(szCodepage+2,szLocaleInfo);
 			NativeNonUnicodeEncodingName = Native8BitEncodingName = NativeEncodingName = szCodepage;
-			m_bIsUnicodeLocale = false;
+			m_bIsUnicodeLocale = false; 
 		}
-	}
+	}		
+	
 	// System Encoding (Used by GUI,DOS; Set via Region/Default Language; requires reboot)
-	if (GetLocaleInfo(LOCALE_SYSTEM_DEFAULT,LOCALE_IDEFAULTANSICODEPAGE,szLocaleInfo,sizeof(szLocaleInfo)/sizeof(szLocaleInfo[0])))
+	if (GetLocaleInfoA(LOCALE_SYSTEM_DEFAULT,LOCALE_IDEFAULTANSICODEPAGE,szLocaleInfo,sizeof(szLocaleInfo)/sizeof(szLocaleInfo[0])))
 	{
 		// Windows Unicode locale?
 		if (!strcmp(szLocaleInfo,"0"))
@@ -116,6 +117,12 @@
 		}
 	}
 
+#ifdef _UNICODE	
+	m_bIsUnicodeLocale = true;
+	NativeEncodingName = "UCS-2LE";	
+	NativeSystemEncodingName = "UCS-2LE";
+#endif
+
 	if (UT_getISO639Language(szLanguage))
 	{
 		LanguageISOName = szLanguage;
Index: src/af/xap/win/xap_Win32FrameImpl.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/xap/win/xap_Win32FrameImpl.cpp,v
retrieving revision 1.68
diff -u -r1.68 xap_Win32FrameImpl.cpp
--- src/af/xap/win/xap_Win32FrameImpl.cpp	29 Mar 2007 17:41:35 -0000	1.68
+++ src/af/xap/win/xap_Win32FrameImpl.cpp	9 Apr 2007 08:37:26 -0000
@@ -40,7 +40,8 @@
 #include "ap_Win32App.h"
 #include "fg_Graphic.h"
 #include "gr_Win32Graphics.h"
-
+#include "ut_Win32LocaleString.h"
+#include "xap_Win32DialogBase.h"
 
 #ifdef _MSC_VER
 #pragma warning(disable: 4355)	// 'this' used in base member initializer list
@@ -166,8 +167,8 @@
 
 	UT_String sTmp = pFrame->getTitle(INT_MAX);
 	sTmp += " - ";
-	sTmp += XAP_App::getApp()->getApplicationTitleForTitleBar();
-	UT_SetWindowText(m_hwndFrame, sTmp.c_str());
+	sTmp += XAP_App::getApp()->getApplicationTitleForTitleBar();	
+	XAP_Win32DialogBase::setWindowText (m_hwndFrame, sTmp.c_str());
 
 	return true;
 }
@@ -226,8 +227,15 @@
 
 
 	XAP_Win32App *pWin32App = static_cast<XAP_Win32App *>(XAP_App::getApp());
-
-	m_hwndFrame = UT_CreateWindowEx(0L, pWin32App->getApplicationName(), pWin32App->getApplicationTitleForTitleBar(),
+	UT_Win32LocaleString str, title;
+	//MessageBoxA (NULL, pWin32App->getApplicationName(), "ASCII name", NULL);
+	str.fromASCII (pWin32App->getApplicationName());	
+	//MessageBox (NULL, str.c_str(), _T("TCHAR name"), NULL);
+	title.fromASCII (pWin32App->getApplicationTitleForTitleBar());
+	//::MessageBox (NULL, str.c_str(), _T("Appname"), NULL);
+		
+	m_hwndFrame = UT_CreateWindowEx(0L, str.c_str(), title.c_str(),
+	//m_hwndFrame = UT_CreateWindowEx(0L, _T("Abiword"), _T("Abiword"),
 									WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
 									iPosX, iPosY, iWidth, iHeight,
 									NULL, NULL, pWin32App->getInstance(), NULL);
@@ -538,7 +546,7 @@
 {
 	ATOM a = UT_RegisterClassEx(CS_DBLCLKS, XAP_Win32FrameImpl::_FrameWndProc, app->getInstance(),
 								app->getIcon(), LoadCursor(NULL,IDC_ARROW), (HBRUSH)(COLOR_BTNFACE+1), app->getSmallIcon(),
-								NULL, app->getApplicationName());
+								NULL, /*app->getApplicationName()*/ _T("Abiword"));
 	
 	UT_return_val_if_fail(a, false);
 
@@ -952,6 +960,7 @@
 		return 0;
 	}
 
+#if _KK_
 	case WM_DROPFILES:
 		{
 			HDROP hDrop = (HDROP) wParam; 
@@ -1042,8 +1051,9 @@
 			}
 			DragFinish(hDrop);
 		}
+		
 		return 0;
-
+#endif		
 	case WM_DESTROY:
 		return 0;
 
Index: src/af/xap/win/xap_Win32LabelledSeparator.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/xap/win/xap_Win32LabelledSeparator.cpp,v
retrieving revision 1.7
diff -u -r1.7 xap_Win32LabelledSeparator.cpp
--- src/af/xap/win/xap_Win32LabelledSeparator.cpp	7 Apr 2007 17:21:19 -0000	1.7
+++ src/af/xap/win/xap_Win32LabelledSeparator.cpp	9 Apr 2007 08:37:26 -0000
@@ -45,7 +45,7 @@
 /*!
   Windows control class name to use in the creation function or template.
  */
-static const char s_LabelledSeparatorWndClassName[] = "AbiLabelledSeparator";
+static const TCHAR s_LabelledSeparatorWndClassName[] = _T("AbiLabelledSeparator");
 /*!
   Window procedure function of the control base class.
  */
@@ -60,7 +60,7 @@
   \param text the text to be shown by the control
   \param hFont the font handle used to represent text
  */
-static void AdaptSeparatorLength(HWND hwnd, const char* text, HFONT hFont)
+static void AdaptSeparatorLength(HWND hwnd, TCHAR* text, HFONT hFont)
 {
 	// Provide the right font
 	LOGFONT logFont;
@@ -70,7 +70,7 @@
 	UT_return_if_fail(hCtrlFont);
 
 	// Evaluate text size
-	int length = strlen(text);
+	int length = _tcslen(text);
 	SIZE textSize;
 	HFONT hPrevCtrlFont;
 	HDC hdc = GetDC(hwnd);
@@ -114,7 +114,7 @@
 	case WM_CREATE:
 		{
 			CREATESTRUCT* lpCreate = (CREATESTRUCT *) lParam;
-			HWND separator = CreateWindow("STATIC", NULL, 
+			HWND separator = CreateWindow(_T("STATIC"), NULL, 
 				SS_ETCHEDHORZ | WS_CHILD | WS_VISIBLE,
 				0, lpCreate->cy / 2, lpCreate->cx, LINE_HEIGHT,
 				hwnd, (HMENU) IDC_LINE_SEPARATOR, lpCreate->hInstance, NULL);
@@ -127,7 +127,7 @@
 			SWL(hwnd, (HFONT) wParam);
 
 			int length = GetWindowTextLength(hwnd);
-			char* text = new char[length + 1];
+			TCHAR* text = new TCHAR[length + 1];
 			length = GetWindowText(hwnd, text, length + 1);
 			AdaptSeparatorLength(hwnd, text, (HFONT) wParam);
 			delete [] text;
@@ -136,7 +136,7 @@
 
 	case WM_SETTEXT:
 		{
-			AdaptSeparatorLength(hwnd, (const char*) lParam, (HFONT) GWL(hwnd));
+			AdaptSeparatorLength(hwnd, (TCHAR*) lParam, (HFONT) GWL(hwnd));
 			break;
 		}
 		
@@ -182,7 +182,7 @@
 	}
 
 	// get base class information
-	if( ! GetClassInfoEx(NULL, "STATIC", &wndclass))
+	if( ! GetClassInfoEx(NULL, _T("STATIC"), &wndclass))
 	{
 		return false;
 	}
Index: src/af/xap/win/xap_Win32Module.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/xap/win/xap_Win32Module.cpp,v
retrieving revision 1.10
diff -u -r1.10 xap_Win32Module.cpp
--- src/af/xap/win/xap_Win32Module.cpp	17 Jan 2007 14:11:01 -0000	1.10
+++ src/af/xap/win/xap_Win32Module.cpp	9 Apr 2007 08:37:26 -0000
@@ -51,17 +51,17 @@
 			return false;
 		}
 
-		m_hMod = LoadLibrary(name);
+		m_hMod = LoadLibraryA(name);
 		if (!m_hMod)
 		{
 			m_pszErr = szErrNoDllFound;
 			return false;
 		}
 		m_pszErr = 0;
-		m_pszModuleName = new char[lstrlen(name) + 1];
+		m_pszModuleName = new char[strlen(name) + 1];
 		if (m_pszModuleName)
 		{
-			lstrcpy(m_pszModuleName, name);
+			strcpy(m_pszModuleName, name);
 		}
 		return true;
 	}
Index: src/af/xap/win/xap_Win32PreviewWidget.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/xap/win/xap_Win32PreviewWidget.cpp,v
retrieving revision 1.15
diff -u -r1.15 xap_Win32PreviewWidget.cpp
--- src/af/xap/win/xap_Win32PreviewWidget.cpp	16 Jan 2007 23:13:45 -0000	1.15
+++ src/af/xap/win/xap_Win32PreviewWidget.cpp	9 Apr 2007 08:37:27 -0000
@@ -38,7 +38,7 @@
 
 ATOM		XAP_Win32PreviewWidget::m_atomPreviewWidgetClass = NULL;
 UT_uint32	XAP_Win32PreviewWidget::m_iInstanceCount = 0;
-char		XAP_Win32PreviewWidget::m_bufClassName[100];
+TCHAR		XAP_Win32PreviewWidget::m_bufClassName[100];
 
 XAP_Win32PreviewWidget::XAP_Win32PreviewWidget(XAP_Win32App * pWin32App, HWND hwndParent, UINT style)
 {
@@ -50,7 +50,7 @@
 
 	if(!m_atomPreviewWidgetClass)
 	{
-		sprintf(m_bufClassName,"PreviewWidget");
+		_stprintf(m_bufClassName, _T("PreviewWidget"));
 
 		m_atomPreviewWidgetClass = UT_RegisterClassEx(CS_OWNDC | CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | style,
 													  _wndProc, m_pWin32App->getInstance(),
@@ -61,11 +61,11 @@
 
 	RECT rParent;
 	GetClientRect(hwndParent,&rParent);
-	
+
 	m_hwndPreview = UT_CreateWindowEx(0L, m_bufClassName, NULL,
 								 WS_CHILD|WS_VISIBLE,
 								 0,0,(rParent.right-rParent.left),(rParent.bottom-rParent.top),
-								 hwndParent,NULL,m_pWin32App->getInstance(),NULL);
+								 hwndParent,NULL,m_pWin32App->getInstance(), NULL);
 	UT_ASSERT(m_hwndPreview);
 
 	// bind window back to this object.  note that this will happen
Index: src/af/xap/win/xap_Win32PreviewWidget.h
===================================================================
RCS file: /cvsroot/abi/src/af/xap/win/xap_Win32PreviewWidget.h,v
retrieving revision 1.6
diff -u -r1.6 xap_Win32PreviewWidget.h
--- src/af/xap/win/xap_Win32PreviewWidget.h	16 Jan 2007 23:13:45 -0000	1.6
+++ src/af/xap/win/xap_Win32PreviewWidget.h	9 Apr 2007 08:37:27 -0000
@@ -62,7 +62,7 @@
 	GR_Win32Graphics *			m_pGraphics;					// GR_Graphics we give to View to draw in our window
 	XAP_Preview *				m_pPreview;						// View which will draw formatted stuff in our window
 	XAP_Win32Dialog_Insert_Symbol *m_pInsertSymbol;				// Insert symbol dialog parent (if applicable)
-	static char					m_bufClassName[100];			// name for RegisterClass()
+	static TCHAR				m_bufClassName[100];			// name for RegisterClass()
 	static UT_uint32			m_iInstanceCount;				// Number of instance of this window type.
 };
 
Index: src/af/xap/win/xap_Win32PropertySheet.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/xap/win/xap_Win32PropertySheet.cpp,v
retrieving revision 1.20
diff -u -r1.20 xap_Win32PropertySheet.cpp
--- src/af/xap/win/xap_Win32PropertySheet.cpp	7 Apr 2007 17:21:19 -0000	1.20
+++ src/af/xap/win/xap_Win32PropertySheet.cpp	9 Apr 2007 08:37:27 -0000
@@ -57,8 +57,8 @@
 
 void XAP_Win32PropertyPage::setChanged (bool bChanged)
 {
-	HWND hWnd = GetParent(m_hWnd);
-	SendMessage(hWnd, bChanged ? PSM_CHANGED : PSM_UNCHANGED, (WPARAM)m_hWnd, 0);	
+	HWND hWnd = GetParent(m_hDlg);
+	SendMessage(hWnd, bChanged ? PSM_CHANGED : PSM_UNCHANGED, (WPARAM)m_hDlg, 0);	
 }
 
 int CALLBACK XAP_Win32PropertyPage::s_pageWndProc(HWND hWnd, UINT msg, WPARAM wParam,
@@ -73,7 +73,7 @@
 			PROPSHEETPAGE*	pStruct = (PROPSHEETPAGE*)lParam;  		
 			XAP_Win32PropertyPage *pThis = (XAP_Win32PropertyPage *)pStruct->lParam;
 			SetWindowLong(hWnd,DWL_USER,pStruct->lParam);
-			pThis->m_hWnd = hWnd;
+			pThis->m_hDlg = hWnd;
 			pThis->_onInitDialog();
 			return 0;
 		}		
@@ -118,10 +118,7 @@
 {	
 	m_pWin32App = pWin32App;
 	LPCTSTR lpTemplate = MAKEINTRESOURCE(wRscID);	
-	const XAP_StringSet * pSS = getApp()->getStringSet();									
-	
-	m_page.pszTitle = pSS->getValue(nID);
-	
+	const XAP_StringSet * pSS = getApp()->getStringSet();	
 	m_page.dwSize = sizeof(PROPSHEETPAGE);
 	m_page.dwFlags = PSP_DEFAULT;
 	m_page.hInstance = pWin32App->getInstance();
@@ -136,7 +133,8 @@
 	if (nID)
 	{
 		m_page.dwFlags = m_page.dwFlags | PSP_USETITLE;
-		m_page.pszTitle = pSS->getValue(nID);
+		m_title.fromUTF8 (pSS->getValue(nID));
+		m_page.pszTitle = m_title.c_str();
 	}	
 	else
 		m_page.pszTitle = NULL;
@@ -296,7 +294,8 @@
 
 int XAP_Win32PropertySheet::runModal(XAP_Win32App* pWin32App, XAP_Frame * pFrame, XAP_String_Id nID/* = 0*/)
 {	
-	MSG msg;	
+	MSG msg;
+	UT_Win32LocaleString title;
 	m_pages = _buildPageArray();
 	const XAP_StringSet * pSS = pWin32App->getStringSet();
 		
@@ -319,16 +318,15 @@
      	m_psh.dwFlags |= PSH_USECALLBACK;    	
     
     if (!m_bApplyButton)
-    	m_psh.dwFlags |= PSH_NOAPPLYNOW;
-    
-	if (nID)
-		m_psh.pszCaption  = pSS->getValue(nID);    	
+    	m_psh.dwFlags |= PSH_NOAPPLYNOW;   
+
+	if (nID) {
+		title.fromUTF8 (pSS->getValue(nID));
+		m_psh.pszCaption  = title.c_str();
+	}
 	else
 		m_psh.pszCaption  = NULL;
 
-	/*
-		
-	*/
 	m_psh.dwFlags |= PSH_MODELESS;	
 	m_hWnd = (HWND)::PropertySheet(&m_psh);	
 	EnableWindow(m_psh.hwndParent, FALSE);
@@ -356,6 +354,7 @@
 int XAP_Win32PropertySheet::runModeless (XAP_Win32App* pWin32App, XAP_Frame * pFrame, XAP_String_Id nID/* = 0*/)
 {		
 	m_pages = _buildPageArray();
+	UT_Win32LocaleString title;
 	const XAP_StringSet * pSS = pWin32App->getStringSet();	
 	m_nRslt = IDCANCEL;
 	m_modeless = true;
@@ -378,22 +377,23 @@
     
     if (!m_bApplyButton)
     	m_psh.dwFlags |= PSH_NOAPPLYNOW;
-    
-	if (nID)
-		m_psh.pszCaption  = pSS->getValue(nID);    	
+    	
+    if (nID) {
+		title.fromUTF8 (pSS->getValue(nID));
+		m_psh.pszCaption  = title.c_str();
+	}
 	else
 		m_psh.pszCaption  = NULL;
-
-	
+    
+		
 	m_psh.dwFlags |= PSH_MODELESS;	
 	m_hWnd = (HWND)::PropertySheet(&m_psh);		
 
-	if (m_bApplyButton) {		
-		SendMessage (GetDlgItem (m_hWnd, ID_APPLY), WM_SETTEXT, 0,  
-			(LPARAM)(pSS->getValue(XAP_STRING_ID_DLG_Apply)));
+	if (m_bApplyButton) {
+		XAP_Win32DialogBase::setDlgItemText (m_hWnd, ID_APPLY, pSS->getValue(XAP_STRING_ID_DLG_Apply));		
 	}
-	SendMessage(GetDlgItem(m_hWnd,IDCANCEL), WM_SETTEXT, 0, (LPARAM) (pSS->getValue(XAP_STRING_ID_DLG_Cancel)));
-
+	XAP_Win32DialogBase::setDlgItemText (m_hWnd, IDCANCEL, pSS->getValue(XAP_STRING_ID_DLG_Cancel));
+			
 	/* Subclassing */
 
 	m_lpfnDefSheet = (WHICHPROC)GetWindowLong(m_hWnd, GWL_WNDPROC);
Index: src/af/xap/win/xap_Win32PropertySheet.h
===================================================================
RCS file: /cvsroot/abi/src/af/xap/win/xap_Win32PropertySheet.h,v
retrieving revision 1.17
diff -u -r1.17 xap_Win32PropertySheet.h
--- src/af/xap/win/xap_Win32PropertySheet.h	1 Mar 2007 17:03:22 -0000	1.17
+++ src/af/xap/win/xap_Win32PropertySheet.h	9 Apr 2007 08:37:28 -0000
@@ -23,6 +23,7 @@
 #include <commctrl.h>
 #include "ut_vector.h"
 #include "xap_Frame.h"
+#include "xap_Win32DialogBase.h"
 #define ID_APPLY	0x3021
 
 /*****************************************************************/
@@ -39,7 +40,7 @@
 #define ID_APPLY_NOW                    0x3021
 
 
-class XAP_Win32PropertyPage
+class XAP_Win32PropertyPage: public XAP_Win32DialogBase
 {
 public:
 	
@@ -49,13 +50,12 @@
 	void 						createPage(XAP_Win32App* pWin32App, WORD wRscID, XAP_String_Id	nID = 0);	
 	PROPSHEETPAGE*				getStruct(){return &m_page;}
 	XAP_Win32App*				getApp(){return m_pWin32App;}
-	HWND						getHandle(){return m_hWnd;}	
+	HWND						getHandle(){return m_hDlg;}	
 	void						setDialogProc(DLGPROC pfnDlgProc){m_pfnDlgProc=pfnDlgProc;};	
 	virtual	void				_onInitDialog(){};
 	virtual	void				_onKillActive(){}; 	
 	virtual	void				_onOK(){}; 		
-	virtual	void				_onApply(){}; 
-	virtual void				_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam){};
+	virtual	void				_onApply(){}; 	
 	virtual void				_onNotify(LPNMHDR hdr, int iCtrlID){};
 	static int CALLBACK			s_pageWndProc(HWND hWnd, UINT msg, WPARAM wParam,LPARAM lParam);
 	void						setChanged (bool bChanged); // Unables or disables apply button
@@ -64,11 +64,11 @@
 private:
 		
 	PROPSHEETPAGE				m_page;
-	HPROPSHEETPAGE	 			m_hdle;	
-	HWND						m_hWnd;
+	HPROPSHEETPAGE	 			m_hdle;		
 	XAP_Win32App*				m_pWin32App;
 	XAP_Win32PropertySheet*		m_pParent;
 	DLGPROC						m_pfnDlgProc;
+	UT_Win32LocaleString 		m_title;
 		
 };
 
@@ -97,7 +97,7 @@
 	void						setCancelButton(bool b){m_bCancelButton=b;};
 	
 
-	virtual int					_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam){return 1;};
+	virtual BOOL				_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam){return 1;};
 	virtual	void				_onOK(){}; 
 	virtual	void				_onApply(){}; 
 	virtual	void				_onCancel(){}; 
Index: src/af/xap/win/xap_Win32Slurp.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/xap/win/xap_Win32Slurp.cpp,v
retrieving revision 1.20
diff -u -r1.20 xap_Win32Slurp.cpp
--- src/af/xap/win/xap_Win32Slurp.cpp	17 Jan 2007 14:46:45 -0000	1.20
+++ src/af/xap/win/xap_Win32Slurp.cpp	9 Apr 2007 08:37:28 -0000
@@ -62,6 +62,14 @@
 
 static XAP_Win32Slurp * s_Slurp = NULL;
 
+void XAP_Win32Slurp::stuffRegistry(const char * szSuffix,
+								   const char * szApplicationName,
+								   const char * szExePathname,
+								   const char * szContentType)
+{
+	
+}
+
 //////////////////////////////////////////////////////////////////
 
 XAP_Win32Slurp::XAP_Win32Slurp(XAP_Win32App * pApp)
@@ -128,143 +136,17 @@
 
 bool XAP_Win32Slurp::connectSlurper(void)
 {
-	if (m_bInitialized)					// only do this once !!
-		return false;
-	
-	// Register us with the DDE Management Library (DDEML).
-
-	m_idDdeServerInst = 0;
-	UINT nDdeRtnStatus = DdeInitialize(&m_idDdeServerInst,
-									   (PFNCALLBACK)&s_DdeServerCallback,
-									   (  APPCMD_FILTERINITS
-										| CBF_SKIP_CONNECT_CONFIRMS
-										| CBF_FAIL_SELFCONNECTIONS
-										| CBF_FAIL_POKES),
-									   0);
-	if (nDdeRtnStatus != DMLERR_NO_ERROR)
-	{
-		UT_DEBUGMSG(("Unable to initialize DDEML [%d]\n",nDdeRtnStatus));
-		return false;
-	}
-
-	// create two registered strings.
-	// the "ServerName" must match the value in the registry under the key:
-	// HKEY_CLASSES_ROOT\<xxx>\shell\open\ddeexec\application
-	//
-	// the "TopicName" must match the value in the key:
-	// HKEY_CLASSES_ROOT\<xxx>\shell\open\ddeexec\topic
-	
-	m_hszServerName = DdeCreateStringHandle(m_idDdeServerInst, const_cast<char *>(m_pApp->getApplicationName()), CP_WINANSI);
-	m_hszTopic = DdeCreateStringHandle(m_idDdeServerInst, MY_DDE_TOPICNAME, CP_WINANSI);
-
-	// register the server Name
-	HDDEDATA bRegistered = DdeNameService(m_idDdeServerInst, m_hszServerName, NULL, DNS_REGISTER);
-	if (!bRegistered)
-	{
-		UT_DEBUGMSG(("Unable to register NameService with DDEML.\n"));
-		return false;
-	}
-
-	m_bInitialized = true;
-	return true;
+	return 0;	
 }
 
 bool XAP_Win32Slurp::disconnectSlurper(void)
 {
-	if (m_hszServerName)
-		DdeFreeStringHandle(m_idDdeServerInst,m_hszServerName);
-	if (m_hszTopic)
-		DdeFreeStringHandle(m_idDdeServerInst,m_hszTopic);
-	
-	DdeUninitialize(m_idDdeServerInst);
-	m_idDdeServerInst = 0;
-
-	m_bInitialized = false;
-	return true;
+	return 0;
 }
 
 void XAP_Win32Slurp::processCommand(HDDEDATA hData)
 {
-	DWORD bufSize = DdeGetData(hData,NULL,0,0);
-
-	char * pBuf = (char *)UT_calloc(sizeof(char),bufSize+100);
-	if (!pBuf)
-	{
-		UT_DEBUGMSG(("No memory to allocate DDE buffer [size %d]\n",bufSize));
-		return;
-	}
-	
-	DdeGetData(hData,(LPBYTE)pBuf,bufSize+99,0);
-	UT_DEBUGMSG(("DDEML received command '%s'\n",pBuf));
-	
-	// we expect something of the form:
-	//     [Open("<pathname>")]
-	// if anything more complicated is needed, it may be a
-	// good idea to use a regex library
-	// TODO failures just goto Finished. Some error reporting
-	// TODO would be nice
-
-	// pointer to work through the incoming string
-	char * next = pBuf;
-	
-	// pointer used to copy into command and pathname
-	char * dest = 0;
-	
-	// chomp the [
-	if ( *next++ != '[' ) goto Finished;
 	
-	// find the next sequence of non ( characters
-	// this will be the dde command
-	char command[1024];
-	dest = command;
-	for ( ; *next != '('; ++next )
-	{
-		*dest++ = *next;
-	}
-	*dest = 0;
-
-	// chomp the ( and the "
-	if ( *next++ != '(' ) goto Finished;
-	if ( *next++ != '"' ) goto Finished;
-	// go until the next " to get the parameter
-	// " are not allowed in filenames, so we should be safe here
-	char pathname[4096];
-	dest = pathname;
-	for ( ; *next != '"'; ++next )	
-	{
-		*dest++ = *next;
-	}
-	*dest = 0;
-	
-	// chomp the ", ), and ]
-	if ( *next++ != '"' ) goto Finished;
-	if ( *next++ != ')' ) goto Finished;
-	if ( *next++ != ']' ) goto Finished;
-	
-	// now do something useful with the command and its parameter
-	if (g_ascii_strcasecmp(command,"open") == 0)
-		{
-			if (!pathname || !*pathname)
-			{
-				UT_DEBUGMSG(("No pathname given in DDE Open command.\n"));
-				goto Finished;
-			}
-
-			// ask the application to load this document into a window....
-
-			XAP_Win32App *p_app = (XAP_Win32App *)XAP_App::getApp();
-			UT_Error error = p_app->fileOpen(p_app->getLastFocussedFrame(), pathname);
-			
-			if(error != UT_OK)
-			{
-				UT_DEBUGMSG(("Could not load document given in DDE Open command [%s].\n",pathname));
-			}
-
-			goto Finished;
-		}
-
-Finished:
-	FREEP(pBuf);
 }
 
 ///////////////////////////////////////////////////////////////////
@@ -276,396 +158,7 @@
 
 static XX_Status _fetchKey(HKEY k1, const char * szSubKey, HKEY * pkNew)
 {
-	DWORD dwDisposition;
-	LONG eResult = RegCreateKeyEx(k1,szSubKey,0,"",
-								  REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,NULL, 
-								  pkNew, &dwDisposition);
-	if (eResult != ERROR_SUCCESS)
-	{
-		UT_DEBUGMSG(("Could not open key [%s]\n",szSubKey));
-		return X_Error;
-	}
-
-	switch (dwDisposition)
-	{
-	default:
-		UT_ASSERT(UT_SHOULD_NOT_HAPPEN);
-		if (*pkNew)
-			RegCloseKey(*pkNew);
-		*pkNew = 0;
-		return X_Error;
-
-	case REG_CREATED_NEW_KEY:
-		return X_CreatedKey;
-
-	case REG_OPENED_EXISTING_KEY:
-		return X_ExistingKey;
-	}
-}
-
-void XAP_Win32Slurp::stuffRegistry(const char * szSuffix,
-								   const char * szApplicationName,
-								   const char * szExePathname,
-								   const char * szContentType)
-{
-	// load the system registry if there's no info
-	// for us already present for the given suffix.
-	// we assume that the string contains the dot.
-	//
-	// TODO consider raising a dialog asking if they
-	// TODO want us to override any existing settings
-	// TODO if they currently don't point to us.  like
-	// TODO MSFT and NSCP currently (politely) fight
-	// TODO for the .html suffix....
-	//
-	// we construct the following pattern in the registry:
-	//
-	// HKEY_CLASSES_ROOT\<suffix> = <foo>
-	// HKEY_CLASSES_ROOT\<suffix>\Content Type = <content_type>
-	// HKEY_CLASSES_ROOT\<foo> = <application_name> ## " Document"
-	// HKEY_CLASSES_ROOT\<foo>\shell\open\command = <exe_pathname>
-	// HKEY_CLASSES_ROOT\<foo>\shell\open\ddeexec = [Open("%1")]
-	// HKEY_CLASSES_ROOT\<foo>\shell\open\ddeexec\application = <application_name>
-	// HKEY_CLASSES_ROOT\<foo>\shell\open\ddeexec\topic = System
-	// HKEY_CLASSES_ROOT\<foo>\DefaultIcon = <exe_pathname,2>
-
-#define VALUE_DDEEXEC_OPEN			"[Open(\"%1\")]"
-#define FORMAT_OUR_INDIRECTION		"AbiSuite.%s"
-#define CONTENT_TYPE_KEY			"Content Type"
-#define DOCUMENT_ICON_POSITION	2
-#define xx(s)					((LPBYTE)(s)),(strlen(s)+1)
-	
-	char buf[1024];
-	char bufOurFoo[1024];
-	char bufOurFooValue[1024];
-	char bufDefaultIconValue[1024];
-	DWORD dType;
-	LONG eResult;
-	ULONG len;
-	bool bUpdateContentType;
-	bool bCreateOrOverwrite = false;
-
-	HKEY hKeyFoo = 0;
-	HKEY hKeySuffix = 0;
-	HKEY hKeyShell = 0;
-	HKEY hKeyCommand = 0;
-	HKEY hKeyOpen = 0;
-	HKEY hKeyDdeExec = 0;
-	HKEY hKeyApplication = 0;
-	HKEY hKeyTopic = 0;
-	HKEY hKeyDefaultIcon = 0;
-	
-	sprintf(bufOurFoo,"AbiSuite.%s",szApplicationName);
-	strtok(bufOurFoo," ");				// trim key at first whitespace
-
-	sprintf(bufOurFooValue,"%s Document",szApplicationName);
-	
-	///////////////////////////////////////////////////////////////////
-	// See if someone has claimed this suffix.
-	// HKEY_CLASSES_ROOT\<suffix> = <foo>
-	///////////////////////////////////////////////////////////////////
-
-	switch ( _fetchKey(HKEY_CLASSES_ROOT,szSuffix,&hKeySuffix) )
-	{
-	case X_Error:
-		goto CleanupMess;
-
-	case X_CreatedKey:					// we are g_free to create what we want.
-		bCreateOrOverwrite = true;
-		break;
-		
-	case X_ExistingKey:					// see what's already there 
-		{
-			///////////////////////////////////////////////////////////////////
-			// HKEY_CLASSES_ROOT\<suffix> = <foo>
-			// was already present.  Verify the value.
-			///////////////////////////////////////////////////////////////////
-
-			len = NrElements(buf);
-			eResult = RegQueryValueEx(hKeySuffix,NULL,NULL,&dType,(LPBYTE)buf,&len);
-
-			if ((eResult != ERROR_SUCCESS) || (dType != REG_SZ) || (len==0))
-				break;					// bogus data, overwrite it.
-			
-			UT_DEBUGMSG(("Registry: suffix [HKEY_CLASSES_ROOT\\%s] --> [%s]\n",
-						 szSuffix,buf));
-
-			if (g_ascii_strcasecmp(buf,bufOurFoo) != 0)	// we didn't create this so ask first.
-			{
-				if (!_askForStealFromAnotherApplication())
-					goto CleanupMess;
-
-				bCreateOrOverwrite = true;
-				break;
-			}
-		}
-	}
-
-	if (bCreateOrOverwrite)
-	{
-		///////////////////////////////////////////////////////////////////
-		// Set the value <foo> in 
-		// HKEY_CLASSES_ROOT\<suffix> = <foo>
-		///////////////////////////////////////////////////////////////////
-
-		UT_ASSERT(hKeySuffix);
-		eResult = RegSetValueEx(hKeySuffix,NULL,0,REG_SZ,xx(bufOurFoo));
-
-		UT_DEBUGMSG(("Register: HKEY_CLASSES_ROOT\\%s <-- %s [error %d]\n",
-					 szSuffix,bufOurFoo,eResult));
-
-		if (eResult != ERROR_SUCCESS)
-			goto CleanupMess;
-	}
-
-	///////////////////////////////////////////////////////////////////
-	// See if "HKEY_CLASSES_ROOT\<suffix>\Content Type" is present
-	// as a value under the current key.
-	///////////////////////////////////////////////////////////////////
-
-	bUpdateContentType = true;
-	len = NrElements(buf);
-	eResult = RegQueryValueEx(hKeySuffix,CONTENT_TYPE_KEY,NULL,&dType,(LPBYTE)buf,&len);
-	if ((eResult == ERROR_SUCCESS) && (dType == REG_SZ))
-	{
-		UT_DEBUGMSG(("Registry: Existing ContentType [%s]\n",buf));
-		if (g_ascii_strcasecmp(buf,szContentType) == 0)
-			bUpdateContentType = false;
-		else							// we didn't create this so ask first.
-			bUpdateContentType = (_askForStealMimeFromAnotherApplication());
-	}
-
-	if (bUpdateContentType)				// bogus or stale data, overwrite it.
-	{
-		///////////////////////////////////////////////////////////////////
-		// Set the value <content_type> in 
-		// HKEY_CLASSES_ROOT\<suffix>\Content Type = <content_type>
-		///////////////////////////////////////////////////////////////////
-
-		UT_ASSERT(hKeySuffix);
-		eResult = RegSetValueEx(hKeySuffix,CONTENT_TYPE_KEY,0,REG_SZ,xx(szContentType));
-
-		UT_DEBUGMSG(("Register: HKEY_CLASSES_ROOT\\%s\\Content Type <-- %s [error %d]\n",
-					 szSuffix,szContentType,eResult));
-
-		// content-type is not a critical field, so if it fails we just go on.
-		// if (eResult != ERROR_SUCCESS) goto CleanupMess;
-	}
-	
-	///////////////////////////////////////////////////////////////////
-	// Verify that the suffix indirection is defined.
-	// HKEY_CLASSES_ROOT\<foo> = ...
-	///////////////////////////////////////////////////////////////////
-
-	switch ( _fetchKey(HKEY_CLASSES_ROOT,bufOurFoo,&hKeyFoo) )
-	{
-	case X_Error:
-		goto CleanupMess;
-
-	case X_ExistingKey:
-		UT_ASSERT(hKeyFoo);
-		len = NrElements(buf);
-		eResult = RegQueryValueEx(hKeyFoo,NULL,0,&dType,(LPBYTE)buf,&len);
-		if ((eResult==ERROR_SUCCESS) && (dType==REG_SZ) && (g_ascii_strcasecmp(buf,bufOurFooValue)==0))
-			break;					// already has correct value, no need to overwrite.
-
-		/* otherwise, replace the value */
-		/* fall thru intended */
-
-	case X_CreatedKey:
-		UT_ASSERT(hKeyFoo);
-		eResult = RegSetValueEx(hKeyFoo,NULL,0,REG_SZ,xx(bufOurFooValue));
-		if (eResult != ERROR_SUCCESS)
-			goto CleanupMess;
-		break;
-	}
-		
-	///////////////////////////////////////////////////////////////////
-	// Inspect the command path
-	// HKEY_CLASSES_ROOT\<foo>\shell\open\command = <exe_pathname>
-	///////////////////////////////////////////////////////////////////
-	char commandPathWithParam[1024];
-	strcpy ( commandPathWithParam, szExePathname );
-	strcat ( commandPathWithParam, " \"%1\"" );
-
-	if (_fetchKey(hKeyFoo,"shell",&hKeyShell) == X_Error)
-		goto CleanupMess;
-	if (_fetchKey(hKeyShell,"open",&hKeyOpen) == X_Error)
-		goto CleanupMess;
-	switch ( _fetchKey(hKeyOpen,"command",&hKeyCommand) )
-	{
-	case X_Error:
-		goto CleanupMess;
-
-	case X_ExistingKey:	
-		UT_ASSERT(hKeyCommand);
-		len = NrElements(buf);
-		eResult = RegQueryValueEx(hKeyCommand,NULL,0,&dType,(LPBYTE)buf,&len);
-		if ((eResult==ERROR_SUCCESS) && (dType==REG_SZ))
-		{
-			if (g_ascii_strcasecmp(buf,commandPathWithParam) == 0)
-				break;					// already has correct value, no need to overwrite.
-			
-			if(memcmp(buf, commandPathWithParam, strlen(commandPathWithParam)) == 0)
-			{
-				// Path name is the same but has extra at the end.
-				// Probably "%1"
-
-				// Fall throught to update path name.
-			}
-			else
-			{
-				
-				if (!_askForUpdateExePathname())
-					goto CleanupMess;
-			}
-		}
-
-		/* otherwise, replace the value */
-		/* fall thru intended */
-		
-	case X_CreatedKey:
-		UT_ASSERT(hKeyCommand);
-		if (eResult != ERROR_SUCCESS)
-			eResult = RegSetValueEx(hKeyCommand,NULL,0,REG_SZ,xx(commandPathWithParam));
-		goto CleanupMess;
-		break;
-	}
-
-	///////////////////////////////////////////////////////////////////
-	// Inspect the ddeexec key
-	// HKEY_CLASSES_ROOT\<foo>\shell\open\ddeexec = [Open(%1)]
-	///////////////////////////////////////////////////////////////////
-
-	switch ( _fetchKey(hKeyOpen,"ddeexec",&hKeyDdeExec) )
-	{
-	case X_Error:
-		goto CleanupMess;
-
-	case X_ExistingKey:	
-		UT_ASSERT(hKeyDdeExec);
-		len = NrElements(buf);
-		eResult = RegQueryValueEx(hKeyDdeExec,NULL,0,&dType,(LPBYTE)buf,&len);
-		if ((eResult==ERROR_SUCCESS) && (dType==REG_SZ) && (g_ascii_strcasecmp(buf,VALUE_DDEEXEC_OPEN)==0))
-			break;						// already has correct value, no need to overwrite.
-
-		/* otherwise, replace the value */
-		/* fall thru intended */
-		
-	case X_CreatedKey:
-		UT_ASSERT(hKeyDdeExec);
-		eResult = RegSetValueEx(hKeyDdeExec,NULL,0,REG_SZ,xx(VALUE_DDEEXEC_OPEN));
-		if (eResult != ERROR_SUCCESS)
-			goto CleanupMess;
-		break;
-	}
-
-	///////////////////////////////////////////////////////////////////
-	// Inspect the application key
-	// HKEY_CLASSES_ROOT\<foo>\shell\open\ddeexec\application = <application_name>
-	///////////////////////////////////////////////////////////////////
-
-	switch ( _fetchKey(hKeyDdeExec,"application",&hKeyApplication) )
-	{
-	case X_Error:
-		goto CleanupMess;
-
-	case X_ExistingKey:	
-		UT_ASSERT(hKeyApplication);
-		len = NrElements(buf);
-		eResult = RegQueryValueEx(hKeyApplication,NULL,0,&dType,(LPBYTE)buf,&len);
-		if ((eResult==ERROR_SUCCESS) && (dType==REG_SZ) && (g_ascii_strcasecmp(buf,szApplicationName)==0))
-			break;						// already has correct value, no need to overwrite.
-
-		/* otherwise, replace the value */
-		/* fall thru intended */
-		
-	case X_CreatedKey:
-		UT_ASSERT(hKeyApplication);
-		eResult = RegSetValueEx(hKeyApplication,NULL,0,REG_SZ,xx(szApplicationName));
-		if (eResult != ERROR_SUCCESS)
-			goto CleanupMess;
-		break;
-	}
-
-	///////////////////////////////////////////////////////////////////
-	// Inspect the topic key
-	// HKEY_CLASSES_ROOT\<foo>\shell\open\ddeexec\topic = System
-	///////////////////////////////////////////////////////////////////
-
-	switch ( _fetchKey(hKeyDdeExec,"topic",&hKeyTopic) )
-	{
-	case X_Error:
-		goto CleanupMess;
-
-	case X_ExistingKey:	
-		UT_ASSERT(hKeyTopic);
-		len = NrElements(buf);
-		eResult = RegQueryValueEx(hKeyTopic,NULL,0,&dType,(LPBYTE)buf,&len);
-		if ((eResult==ERROR_SUCCESS) && (dType==REG_SZ) && (g_ascii_strcasecmp(buf,MY_DDE_TOPICNAME)==0))
-			break;						// already has correct value, no need to overwrite.
-
-		/* otherwise, replace the value */
-		/* fall thru intended */
-		
-	case X_CreatedKey:
-		UT_ASSERT(hKeyTopic);
-		eResult = RegSetValueEx(hKeyTopic,NULL,0,REG_SZ,xx(MY_DDE_TOPICNAME));
-		if (eResult != ERROR_SUCCESS)
-			goto CleanupMess;
-		break;
-	}
-
-	///////////////////////////////////////////////////////////////////
-	// Set the default icon for the suffix (this is for Explorer et al.
-	// HKEY_CLASSES_ROOT\<foo>\DefaultIcon = <exe_pathname,1>
-	///////////////////////////////////////////////////////////////////
-
-	sprintf(bufDefaultIconValue,"%s,%d",szExePathname,DOCUMENT_ICON_POSITION);
-	switch ( _fetchKey(hKeyFoo,"DefaultIcon",&hKeyDefaultIcon) )
-	{
-	case X_Error:
-		goto CleanupMess;
-
-	case X_ExistingKey:	
-		UT_ASSERT(hKeyDefaultIcon);
-		len = NrElements(buf);
-		eResult = RegQueryValueEx(hKeyDefaultIcon,NULL,0,&dType,(LPBYTE)buf,&len);
-		if ((eResult==ERROR_SUCCESS) && (dType==REG_SZ) && (g_ascii_strcasecmp(buf,bufDefaultIconValue)==0))
-			break;						// already has correct value, no need to overwrite.
-
-		/* otherwise, replace the value */
-		/* fall thru intended */
-		
-	case X_CreatedKey:
-		UT_ASSERT(hKeyDefaultIcon);
-		eResult = RegSetValueEx(hKeyDefaultIcon,NULL,0,REG_SZ,xx(bufDefaultIconValue));
-		if (eResult != ERROR_SUCCESS)
-			goto CleanupMess;
-		break;
-	}
-		
-	///////////////////////////////////////////////////////////////////
-	// Success.
-	///////////////////////////////////////////////////////////////////
-
-	UT_DEBUGMSG(("Successfully stuffed the registry for suffix [%s].\n",szSuffix));
-	
-CleanupMess:
-		
-#define KILLKEY(k)		do { if (k) RegCloseKey(k); (k) = 0; } while (0)
-
-	KILLKEY(hKeyFoo);
-	KILLKEY(hKeySuffix);
-	KILLKEY(hKeyShell);
-	KILLKEY(hKeyCommand);
-	KILLKEY(hKeyOpen);
-	KILLKEY(hKeyDdeExec);
-	KILLKEY(hKeyApplication);
-	KILLKEY(hKeyTopic);
-	KILLKEY(hKeyDefaultIcon);
 
-	return;
 }
 
 bool XAP_Win32Slurp::_askForStealFromAnotherApplication(void) const
Index: src/af/xap/xp/xap_Dialog.h
===================================================================
RCS file: /cvsroot/abi/src/af/xap/xp/xap_Dialog.h,v
retrieving revision 1.30
diff -u -r1.30 xap_Dialog.h
--- src/af/xap/xp/xap_Dialog.h	16 Jan 2007 23:13:46 -0000	1.30
+++ src/af/xap/xp/xap_Dialog.h	9 Apr 2007 08:37:29 -0000
@@ -36,6 +36,7 @@
 #include "ut_assert.h"
 
 #include "xap_Types.h"
+#include <glib.h>
 
 class UT_String;
 
Index: src/config/abi_defs.mk
===================================================================
RCS file: /cvsroot/abi/src/config/abi_defs.mk,v
retrieving revision 1.267
diff -u -r1.267 abi_defs.mk
--- src/config/abi_defs.mk	28 Jan 2007 19:49:22 -0000	1.267
+++ src/config/abi_defs.mk	9 Apr 2007 08:37:30 -0000
@@ -514,6 +514,10 @@
 RCFLAGS += -DABI_BUILD_VERSION_BUILD=$(ABI_BUILD_VERSION_BUILD)
 endif
 
+ifdef ABI_WIN32_UNICODE
+	WIN32_UNICODE = _UNICODE
+endif
+
 
 ##################################################################
 ##################################################################
@@ -527,7 +531,7 @@
 ##################################################################
 ## set everything else from the above variables....
 
-OUTDIR			= $(OUT)/$(OS_NAME)_$(OS_RELEASE)_$(OS_ARCH)_$(OBJ_DIR_SFX)
+OUTDIR			= $(OUT)/$(OS_NAME)_$(OS_RELEASE)_$(OS_ARCH)$(WIN32_UNICODE)_$(OBJ_DIR_SFX)
 OBJDIR			= $(OUTDIR)/obj$(ABI_PEER)
 LIBDIR			= $(OUTDIR)/obj
 BINDIR			= $(OUTDIR)/bin
@@ -576,12 +580,17 @@
   ifeq ($(ABI_OPT_MSXML),1)
 	ABI_OPTIONS+=XML:msxml
   else
-  	XML_CFLAGS = $(shell $(LIBXML_CONFIG) --cflags)
-  	XML_LIBS	 = $(shell $(LIBXML_CONFIG) --libs)
-  	CFLAGS 	 +=	$(XML_CFLAGS)
-  	EXTRA_LIBS +=	$(XML_LIBS)
-  	ABI_OPTIONS+=XML:libxml2
+	ifeq ($(OS_NAME), WIN32)
+		XML_LIBS	 = libxml2.lib
+	else
+	  	XML_CFLAGS = $(shell $(LIBXML_CONFIG) --cflags)
+	  	XML_LIBS	 = $(shell $(LIBXML_CONFIG) --libs)
+	  	CFLAGS 	 +=	$(XML_CFLAGS)
+  	endif
   endif
+  	
+  	ABI_OPTIONS+=XML:libxml2
+  	EXTRA_LIBS +=	$(XML_LIBS)
 endif
 
 ifdef LIBGLADE_CONFIG
Index: src/config/platforms/mingw32.mk
===================================================================
RCS file: /cvsroot/abi/src/config/platforms/mingw32.mk,v
retrieving revision 1.28
diff -u -r1.28 mingw32.mk
--- src/config/platforms/mingw32.mk	21 Dec 2006 02:06:52 -0000	1.28
+++ src/config/platforms/mingw32.mk	9 Apr 2007 08:37:31 -0000
@@ -180,6 +180,7 @@
 ## add wv's mini glib to include list
 #ABI_OTH_INCS+=	/../../wv/glib-wv
 
+
 #ifneq ($(shell which pkg-config), )
 	ABI_GSF_LIB += $(shell pkg-config --libs --silence-errors libgsf-1)
 	ABI_GSF_INC += $(shell pkg-config --cflags --silence-errors libgsf-1)
@@ -195,7 +196,7 @@
 
 # TODO: This is true on about 1/10 platforms.  Why not use pkgconfig?
 ifeq ($(ABI_OPT_PANGO),1)
-OS_INCLUDES += -I/usr/local/include/pango-1.0 -I/usr/local/include/freetype2 $(ABI_GLIB_INC)
+#OS_INCLUDES += -I/usr/local/include/pango-1.0 -I/usr/local/include/freetype2 $(ABI_GLIB_INC)
 endif
 
 # libgsf
@@ -241,6 +242,10 @@
 DEFINES		+= -D_WIN32_IE=0x0400 -DSUPPORTS_UT_IDLE
 OS_CFLAGS += -fvtable-thunks  # required for compiling ole dragndrop
 
+ifdef ABI_WIN32_UNICODE
+	DEFINES		+= -DUNICODE -D_UNICODE
+endif
+
 # Shared library flags
 MKSHLIB			= $(LD) --dll
 
Index: src/config/platforms/nix-common.mk
===================================================================
RCS file: /cvsroot/abi/src/config/platforms/nix-common.mk,v
retrieving revision 1.19
diff -u -r1.19 nix-common.mk
--- src/config/platforms/nix-common.mk	13 Jun 2004 08:05:57 -0000	1.19
+++ src/config/platforms/nix-common.mk	9 Apr 2007 08:37:31 -0000
@@ -173,7 +173,7 @@
 
 # TODO: This is true on about 1/10 platforms.  Why not use pkgconfig?
 ifeq ($(ABI_OPT_PANGO),1)
-OS_INCLUDES += -I/usr/local/include/pango-1.0 -I/usr/local/include/freetype2 -I/usr/local/include/glib-2.0
+OS_INCLUDES +=  -I/usr/local/include/glib-2.0
 endif
 
 # Architecture-specific flags
Index: src/config/platforms/win32.mk
===================================================================
RCS file: /cvsroot/abi/src/config/platforms/win32.mk,v
retrieving revision 1.49
diff -u -r1.49 win32.mk
--- src/config/platforms/win32.mk	22 Sep 2006 05:29:27 -0000	1.49
+++ src/config/platforms/win32.mk	9 Apr 2007 08:37:33 -0000
@@ -96,11 +96,11 @@
 ##################################################################
 # Compiler specific settings
 
-# MSVC 5+
+# Starting from Abiword 2.5x only Visual Studio 2005 or better is supported
 ifeq ($(subst VC7,VC,$(CCSET)), VC)
 CC 	= cl
-CCC 	= cl
-LINK 	= link
+CCC = cl
+LINK = link
 AR 	= lib -NOLOGO -OUT:"$(shell echo $@ | sed 's|/cygdrive/\([a-zA-Z]\)/|\1:/|g' | sed 's|//[a-zA-Z]/|/|g' | sed 's|/|\\\\|g')"
 RC 	= rc.exe $(RCFLAGS) 
 
@@ -108,16 +108,23 @@
 
 # set optimization flags, but only if not already set
 ifeq ($(ABI_OPT_DEBUG),1)
+
 OPTIMIZER 	?= -Od -Ob1
-DEFINES 	= -DDEBUG -D_DEBUG -UNDEBUG -D_CRTDBG_MAP_ALLOC
-OS_CFLAGS 	= -MDd -Z7
+DEFINES 	= -DDEBUG -D_DEBUG -UNDEBUG
+OS_CFLAGS 	= -MDd -Z7  -RTC1 -GS
+
 else
+
 OPTIMIZER	?= -O2
+OPTIMIZER	+= -GL
+LDFLAGS	+= -LTCG
 DEFINES	= -UDEBUG -U_DEBUG -DNDEBUG
 OS_CFLAGS 	= -MD -Zi
 endif
 
-OS_CFLAGS 	+= -W3 -nologo -GF -Gy -GX -Zm200
+OS_CFLAGS 	+= -W3 -nologo -Zm200  -EHsc
+LDFLAGS 	+= -OPT:REF,ICF
+
 # -W# warning level, 3=production level, 4=lint level, 0=disable all warnings
 # -nologo suppresses banner
 # -GF & -Gf enables string pooling (/GF places them in read-only memory)
@@ -132,24 +139,11 @@
 #     frame pointer, use -Oy- after -O2 to force frame pointers
 #     -O2 == /0g /Oi /Ot /Oy /Ob1 /Gs /Gf /Gy
 DLLFLAGS 	= -OUT:"$(shell echo $@ | $(TRANSFORM_TO_DOS_PATH))" 
-LDFLAGS 	= -DEBUG -MACHINE:$(LINK_ARCH) -MAPINFO:LINES -MAP -LIBPATH:$(shell echo $(LIBDIR) | $(TRANSFORM_TO_DOS_PATH) )
+LDFLAGS 	= -DEBUG -MACHINE:$(LINK_ARCH) -MAP -LIBPATH:$(shell echo $(LIBDIR) | $(TRANSFORM_TO_DOS_PATH) )
 OS_DLLFLAGS = -nologo -DLL -SUBSYSTEM:WINDOWS -DEBUG -MACHINE:$(LINK_ARCH)
 
 endif
 
-# MSVC 7+
-# use a few VC 7 specific additions, but otherwise same as VC5+
-ifeq ($(CCSET), VC7)
-
-ifeq ($(ABI_OPT_DEBUG),1)
-OS_CFLAGS 	+= -RTC1 -GS
-else
-OPTIMIZER	+= -GL
-LDFLAGS	+= -LTCG
-endif
-LDFLAGS 	+= -OPT:REF,ICF
-
-endif
 
 # EVC3 - Embedded Visual C++ version 3
 ifeq ($(CCSET), EVC3)
@@ -177,7 +171,7 @@
 OS_CFLAGS 	= -MD -Zi
 endif
 
-OS_CFLAGS 	+= -W3 -nologo -GF -Gy -GX -Zm200
+OS_CFLAGS 	+= -W3 -nologo -GF -Gy -GX22 -Zm200
 DLLFLAGS 	= -OUT:"$(shell echo $@ | $(TRANSFORM_TO_DOS_PATH))" 
 LDFLAGS 	= -DEBUG -MACHINE:$(LINK_ARCH) -MAPINFO:LINES -MAP
 OS_DLLFLAGS = -nologo -DLL -SUBSYSTEM:WINDOWS -DEBUG -MACHINE:$(LINK_ARCH)
@@ -240,34 +234,46 @@
 
 endif
 
+# libgsf                     
+OS_LIBS += 
+ABI_LIBS += libgsf-1-114
+OS_INCLUDES += $(ABI_GSF_INC)
 
 ##################################################################
 # libraries and other compile/link settings
 
-DEFINES 	+= -DWIN32 -DSUPPORTS_UT_IDLE
+DEFINES 	+= -DWIN32 -DSUPPORTS_UT_IDLE -D_CRT_SECURE_NO_DEPRECATE
 
 # we used to always use peer iconv, but not any more as of
 # CVS HEAD, 2 Jun 2006.
-# ABI_REQUIRE_PEER_ICONV = 1
 
+ABI_REQUIRE_PEER_ICONV = 0
+#ABI_LIBS += Abi_libiconv
+
+ABI_LIBS += iconv
 
-ifeq(ABI_REQUIRE_PEER_ICONV, 1)
- ABI_LIBS += Abi_libiconv
-else
- OS_LIBS += $(ICONV_LIBS) -liconv # ICONV_LIBS is set in the environment equal to "-L/some/path" where there is /some/path/libiconv.so.  It may remain unset if the lib is already in the default search path, as it usually is.
-endif
 
 # if not specified, default to libxml2 for xml parsing 7 June 2006
 ABI_OPT_PEER_EXPAT ?= 0
 
-ifeq($(HAVE_WV_PEER),1)
+HAVE_WV_PEER=1
+
+ifeq ($(HAVE_WV_PEER),1)
 # add wv's mini glib to include list
-ABI_OTH_INCS+=	/../../wv/glib-wv
+#ABI_OTH_INCS+=	/../../wv/glib-wv
 else
 HAVE_WV_PEER=0
 endif
 
-ifndef ENABLE_UNICODE
+# glib
+# ABI_OTH_INCS += $(GLIB_INC)
+OS_LIBS += $(ABI_GLIB_LIB)
+ABI_LIBS += glib-2.0 gobject-2.0 
+OS_INCLUDES += $(ABI_GLIB_INC)
+
+
+
+ifndef ABI_WIN32_UNICODE
 UNICODE_CFLAGS =
 UNICODE_LIBS =
 else
Index: src/wp/ap/win/ap_Win32App.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32App.cpp,v
retrieving revision 1.180
diff -u -r1.180 ap_Win32App.cpp
--- src/wp/ap/win/ap_Win32App.cpp	29 Mar 2007 04:00:46 -0000	1.180
+++ src/wp/ap/win/ap_Win32App.cpp	9 Apr 2007 08:37:44 -0000
@@ -90,7 +90,7 @@
 #include "xad_Document.h"
 #include "ap_FrameData.h"
 #include "ut_Win32Locale.h"
-
+#include "ut_Win32LocaleString.h"
 #include "ap_Strings.h"
 
 #include "pt_PieceTable.h"
@@ -127,8 +127,8 @@
 		UT_DEBUGMSG(("Pathname [%s] is not a directory.\n",szDir));
 		return false;
 	}
-
-	if (CreateDirectory(szDir,NULL))
+		
+	if (CreateDirectoryA(szDir,NULL))
 		return true;
 
 	UT_DEBUGMSG(("Could not create Directory [%s].\n",szDir));
@@ -303,11 +303,11 @@
 #endif
 
 	// Ensure that common control DLL is loaded
-	HINSTANCE hinstCC = LoadLibrary("comctl32.dll");
+	HINSTANCE hinstCC = LoadLibrary(_T("comctl32.dll"));
 	UT_return_val_if_fail (hinstCC, false);
 	InitCommonControlsEx_fn  pInitCommonControlsEx = NULL;
 	if( hinstCC != NULL )
-		pInitCommonControlsEx = (InitCommonControlsEx_fn)GetProcAddress( hinstCC, "InitCommonControlsEx" );
+		pInitCommonControlsEx = (InitCommonControlsEx_fn)GetProcAddress( hinstCC, "InitCommonControlsEx");
 	if( pInitCommonControlsEx != NULL )
 	{
 		INITCOMMONCONTROLSEX icex;
@@ -320,11 +320,10 @@
 	else
 	{
 		InitCommonControls();
-
-		UT_String sErr(UT_String_sprintf(m_pStringSet->getValue(AP_STRING_ID_WINDOWS_COMCTL_WARNING),
-										 "Unicows"));
-
-		MessageBox(NULL, sErr.c_str(), NULL, MB_OK);
+		
+		UT_Win32LocaleString err;
+		err.fromUTF8 (m_pStringSet->getValue(AP_STRING_ID_WINDOWS_COMCTL_WARNING));		
+		MessageBox(NULL, err.c_str(), NULL, MB_OK);
 	}
 
 	//////////////////////////////////////////////////////////////////
@@ -1054,7 +1053,7 @@
 
 static HWND hwndSplash = NULL;
 static GR_Image * pSplash = NULL;
-static char s_SplashWndClassName[256];
+static TCHAR s_SplashWndClassName[256];
 
 static void _hideSplash(void)
 {
@@ -1140,9 +1139,9 @@
 		)
 	{
 		// NB: can't access 'this' members from a static member function
-		ATOM a;
-	
-		sprintf(s_SplashWndClassName, "%sSplash", szAppName /* app->getApplicationName() */);
+		ATOM a;	
+		
+		_tcscpy (s_SplashWndClassName, _T("s_SplashWndClassName"));
 
 		a = UT_RegisterClassEx(0L, _SplashWndProc, hInstance,
 							   LoadIcon(hInstance, MAKEINTRESOURCE(AP_RID_ICON_APPLICATION_32)),
@@ -1215,9 +1214,9 @@
 	// TODO: fix Spell dlg so we don't rely on this
 	// ALT:  make it a Preview widget instead
 
-	HINSTANCE hinstRich = LoadLibrary("riched32.dll");
+	HINSTANCE hinstRich = LoadLibrary(_T("riched32.dll"));
 	if (!hinstRich)
-		hinstRich = LoadLibrary("riched20.dll");
+		hinstRich = LoadLibrary(_T("riched20.dll"));
 	UT_return_val_if_fail (hinstRich, 1);
 	
 	AP_Win32App * pMyWin32App;
@@ -1484,6 +1483,7 @@
 // cmdline processing call back I reckon
 void AP_Win32App::errorMsgBadArg(AP_Args * Args, int nextopt)
 {
+	/*
 	char *pszMessage = (char*)g_try_malloc( 500 );
 	UT_return_if_fail(pszMessage);
 	strcpy( pszMessage, "Error on option " );
@@ -1493,6 +1493,7 @@
 	strcat( pszMessage, "\nRun with --help' to see a full list of available command line options.\n" );
 	MessageBox(NULL, pszMessage, "Command Line Option Error", MB_OK|MB_ICONERROR);
 	g_free( pszMessage );
+	*/
 }
 
 // cmdline processing call back I reckon
@@ -1549,7 +1550,10 @@
 			UT_String s = "AbiWord: ";
 			s+= Args->m_sFile;
 			
-			GR_Graphics * pG = GR_Win32Graphics::getPrinterGraphics(Args->m_sPrintTo, s.c_str());
+			UT_Win32LocaleString prn, doc;
+			prn.fromASCII (Args->m_sPrintTo);
+			doc.fromASCII (s.c_str());
+			GR_Graphics * pG = GR_Win32Graphics::getPrinterGraphics(prn.c_str(), doc.c_str());
 			if(!pG)
 			{
 				// do not assert here, if the graphics creation failed, the static
@@ -1559,7 +1563,7 @@
 			
 			conv.setVerbose(Args->m_iVerbose);
 			conv.print (Args->m_sFile, pG, Args->m_sFileExtension);
-	      
+	      	
 			delete pG;
 		}
 		else
@@ -1683,21 +1687,13 @@
 	return false;
 }
 
+/* TO BE MOVED */
 /* From UCS4 To WinLocale */
 UT_String  	AP_Win32App::s_fromUCS4ToWinLocale(const UT_UCS4Char * szIn)
-{		
-	UT_UCS4String sUCS4(szIn);
+{	
 	UT_String sRslt;
-	
-	char *pText = UT_convert ((char *)sUCS4.ucs4_str(),
-							  sUCS4.length()*sizeof(UT_UCS4Char),
-							  ucs4Internal(),
-							  XAP_App::getApp()->getDefaultEncoding(),
-							  NULL, NULL);
-	sRslt = pText;
-	g_free(pText);
+	UT_ASSERT(UT_SHOULD_NOT_HAPPEN);
 	return sRslt;
-
 }
 
 /* From WinLocale To UCS4*/
@@ -1707,7 +1703,7 @@
 	UT_UCS4_strcpy_char(src, (char*)szIn);	
 	UT_UCS4String sRslt(src);	
 	delete src;
-
+	UT_ASSERT(UT_SHOULD_NOT_HAPPEN);
 	return sRslt;
 }
 
@@ -1716,6 +1712,7 @@
 {
 	UT_UTF8String utf8(szInUTF8);	
 	UT_UCS4String sUCS4(utf8.ucs4_str());
+	UT_ASSERT(UT_SHOULD_NOT_HAPPEN);
 	return AP_Win32App::s_fromUCS4ToWinLocale(sUCS4.ucs4_str());
 }
 
@@ -1724,10 +1721,11 @@
 {
 	UT_UCS4String sUCS4 = AP_Win32App::s_fromWinLocaleToUCS4(szIn);
 	UT_UTF8String sRslt(sUCS4.utf8_str());	
-
+	UT_ASSERT(UT_SHOULD_NOT_HAPPEN);
 	return sRslt;
 }
 
+
 GR_Graphics * AP_Win32App::newDefaultScreenGraphics() const
 {
 	XAP_Frame * pFrame = findValidFrame();
Index: src/wp/ap/win/ap_Win32App.h
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32App.h,v
retrieving revision 1.40
diff -u -r1.40 ap_Win32App.h
--- src/wp/ap/win/ap_Win32App.h	19 Jan 2007 15:34:47 -0000	1.40
+++ src/wp/ap/win/ap_Win32App.h	9 Apr 2007 08:37:45 -0000
@@ -100,21 +100,14 @@
 	virtual UT_Error						fileOpen(XAP_Frame * pFrame, const char * pNewFile);
 	UT_Vector*								getInstalledUILanguages(void);
 	bool									doesStringSetExist(const char* pLocale);
-
-	/*
-		Currently we need single byte strings to work with 
-		win32 UI until we do a Unicode port. It's better to do all UI
-		conversions in a single point. You are looking to this point right now. Jordi,
-	*/
+	bool handleModelessDialogMessage( MSG * msg );
+		
+	// TO BE REMOVED
 	static UT_String 		s_fromUCS4ToWinLocale(const UT_UCS4Char * szIn);
 	static UT_UCS4String	s_fromWinLocaleToUCS4(const char* szIn);
 	static UT_String 		s_fromUTF8ToWinLocale(const char* szIn);
 	static UT_UTF8String	s_fromWinLocaleToUTF8(const char* szIn);
 
-	
-	
-	bool handleModelessDialogMessage( MSG * msg );
-
 private:	
 	bool               _copyFmtToClipboard(PD_DocumentRange * pDocRange, UINT iFmt);
 	bool               _copyFmtToClipboard(PD_DocumentRange * pDocRange, const char *pszFmt);
Index: src/wp/ap/win/ap_Win32Dialog_Break.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Dialog_Break.cpp,v
retrieving revision 1.13
diff -u -r1.13 ap_Win32Dialog_Break.cpp
--- src/wp/ap/win/ap_Win32Dialog_Break.cpp	29 Mar 2007 04:00:46 -0000	1.13
+++ src/wp/ap/win/ap_Win32Dialog_Break.cpp	9 Apr 2007 08:37:45 -0000
@@ -83,7 +83,7 @@
 	localizeControlText(AP_RID_DIALOG_BREAK_RADIO_ODD,	AP_STRING_ID_DLG_Break_OddPage);
 
 	// set initial state
-	checkButton(AP_RID_DIALOG_BREAK_RADIO_PAGE + m_break);
+	checkDlgButton(AP_RID_DIALOG_BREAK_RADIO_PAGE + m_break);
 	centerDialog();
 	return 1;							// 1 == we did not call SetFocus()
 }
Index: src/wp/ap/win/ap_Win32Dialog_Columns.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Dialog_Columns.cpp,v
retrieving revision 1.21
diff -u -r1.21 ap_Win32Dialog_Columns.cpp
--- src/wp/ap/win/ap_Win32Dialog_Columns.cpp	29 Mar 2007 04:00:46 -0000	1.21
+++ src/wp/ap/win/ap_Win32Dialog_Columns.cpp	9 Apr 2007 08:37:45 -0000
@@ -129,15 +129,15 @@
 
 	// set initial state
 	char buf[BUFSIZE];
-	checkButton(AP_RID_DIALOG_COLUMN_RADIO_ONE + getColumns() - 1, true);
+	checkDlgButton(AP_RID_DIALOG_COLUMN_RADIO_ONE + getColumns() - 1, true);
 	enableLineBetweenControl(getColumns() != 1);
-	checkButton(AP_RID_DIALOG_COLUMN_CHECK_LINE_BETWEEN, getLineBetween());
+	checkDlgButton(AP_RID_DIALOG_COLUMN_CHECK_LINE_BETWEEN, getLineBetween());
 	setControlText(AP_RID_DIALOG_COLUMN_EDIT_NUMCOLUMNS,itoa(getColumns(),buf,10));
 	setControlText(AP_RID_DIALOG_COLUMN_EDIT_SPACEAFTER, getSpaceAfterString());
 	setControlText(AP_RID_DIALOG_COLUMN_EDIT_MAXSIZE, getHeightString());
 
 	showControl( AP_RID_DIALOG_COLUMN_CHECK_RTL_ORDER, SW_NORMAL );
-	checkButton(AP_RID_DIALOG_COLUMN_CHECK_RTL_ORDER, getColumnOrder()!=false);
+	checkDlgButton(AP_RID_DIALOG_COLUMN_CHECK_RTL_ORDER, getColumnOrder()!=false);
 
 	// Create a preview window.
 
@@ -160,138 +160,10 @@
 
 BOOL AP_Win32Dialog_Columns::_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
-	WORD wNotifyCode = HIWORD(wParam);
-	WORD wId = LOWORD(wParam);
-	char buf[BUFSIZE];
-
-	switch (wId)
-	{
-	case IDCANCEL:						// also AP_RID_DIALOG_COLUMN_BTN_CANCEL
-		m_answer = a_CANCEL;
-		// fall through
-
-	case IDOK:							// also AP_RID_DIALOG_COLUMN_BTN_OK
-		EndDialog(hWnd,0);
-		return 1;
-
-	case AP_RID_DIALOG_COLUMN_RADIO_ONE:
-		setColumns(1);
-		checkButton(AP_RID_DIALOG_COLUMN_RADIO_TWO, false);
-		checkButton(AP_RID_DIALOG_COLUMN_RADIO_THREE, false);
-		setControlText(AP_RID_DIALOG_COLUMN_EDIT_NUMCOLUMNS, itoa(getColumns(),buf,10));
-		return 1;
-
-	case AP_RID_DIALOG_COLUMN_RADIO_TWO:
-		setColumns(2);
-		checkButton(AP_RID_DIALOG_COLUMN_RADIO_ONE, false);
-		checkButton(AP_RID_DIALOG_COLUMN_RADIO_THREE, false);
-		setControlText(AP_RID_DIALOG_COLUMN_EDIT_NUMCOLUMNS, itoa(getColumns(),buf,10));
-		return 1;
-
-	case AP_RID_DIALOG_COLUMN_RADIO_THREE:
-		setColumns(3);
-		checkButton(AP_RID_DIALOG_COLUMN_RADIO_ONE, false);
-		checkButton(AP_RID_DIALOG_COLUMN_RADIO_TWO, false);
-		setControlText(AP_RID_DIALOG_COLUMN_EDIT_NUMCOLUMNS, itoa(getColumns(),buf,10));
-		return 1;
-
-	case AP_RID_DIALOG_COLUMN_CHECK_LINE_BETWEEN:
-		setLineBetween( isChecked(AP_RID_DIALOG_COLUMN_CHECK_LINE_BETWEEN)==BST_CHECKED );
-		return 1;
-
-	case AP_RID_DIALOG_COLUMN_EDIT_NUMCOLUMNS:
-		if( wNotifyCode == EN_KILLFOCUS )
-		{
-			GetDlgItemText( hWnd, wId, buf, BUFSIZE );
-			if( atoi( buf ) > 0 && atoi(buf) != (signed) getColumns() )
-			{
-				setColumns( atoi(buf) );
-			}
-			SetDlgItemText(hWnd, wId, itoa(getColumns(),buf,10));
-			checkButton(AP_RID_DIALOG_COLUMN_RADIO_ONE, (getColumns()==1));
-			checkButton(AP_RID_DIALOG_COLUMN_RADIO_TWO, (getColumns()==2));
-			checkButton(AP_RID_DIALOG_COLUMN_RADIO_THREE, (getColumns()==3));
-		}
-		return 1;
-
-	case AP_RID_DIALOG_COLUMN_EDIT_SPACEAFTER:
-		if( wNotifyCode == EN_KILLFOCUS )
-		{
-			char buf[BUFSIZE];
-			GetDlgItemText( hWnd, wId, buf, BUFSIZE );
-			setSpaceAfter( buf );
-			setControlText(wId, getSpaceAfterString());
-		}
-		return 1;
-
-	case AP_RID_DIALOG_COLUMN_EDIT_MAXSIZE:
-		if( wNotifyCode == EN_KILLFOCUS )
-		{
-			char buf[BUFSIZE];
-			GetDlgItemText( hWnd, wId, buf, BUFSIZE );
-			setMaxHeight( buf );
-			setControlText( wId, getHeightString());
-		}
-		return 1;
-
-	case AP_RID_DIALOG_COLUMN_CHECK_RTL_ORDER:
-		setColumnOrder( (UT_uint32) (isChecked(AP_RID_DIALOG_COLUMN_CHECK_RTL_ORDER) == BST_CHECKED) );
-		return 1;
-
-	default:							// we did not handle this notification
-		UT_DEBUGMSG(("WM_Command for id %ld\n",wId));
-		return 0;						// return zero to let windows take care of it.
-	}
+	return 0;
 }
 
 BOOL AP_Win32Dialog_Columns::_onDeltaPos(NM_UPDOWN * pnmud)
 {
-	char buf[BUFSIZE];
-	switch( pnmud->hdr.idFrom )
-	{
-	case AP_RID_DIALOG_COLUMN_SPIN_NUMCOLUMNS:
-		if( pnmud->iDelta < 0 )
-		{
-			setColumns( getColumns() + 1 );
-		}
-		else
-		{
-			if( getColumns() > 1 )
-			{
-				setColumns( getColumns() - 1 );
-			}
-		}
-		setControlText(AP_RID_DIALOG_COLUMN_EDIT_NUMCOLUMNS,itoa(getColumns(),buf,10));
-		checkButton(AP_RID_DIALOG_COLUMN_RADIO_ONE, (getColumns()==1));
-		checkButton(AP_RID_DIALOG_COLUMN_RADIO_TWO, (getColumns()==2));
-		checkButton(AP_RID_DIALOG_COLUMN_RADIO_THREE, (getColumns()==3));
-		return 1;
-
-	case AP_RID_DIALOG_COLUMN_SPIN_SPACEAFTER:
-		if( pnmud->iDelta < 0 )
-		{
-			incrementSpaceAfter( true );
-		}
-		else
-		{
-			incrementSpaceAfter( false );
-		}
-		setControlText(AP_RID_DIALOG_COLUMN_EDIT_SPACEAFTER, getSpaceAfterString());
-		return 1;
-
-	case AP_RID_DIALOG_COLUMN_SPIN_MAXSIZE:
-		if( pnmud->iDelta < 0 )
-		{
-			incrementMaxHeight( true );
-		}
-		else
-		{
-			incrementMaxHeight( false );
-		}
-		setControlText(AP_RID_DIALOG_COLUMN_EDIT_MAXSIZE, getHeightString());
-		return 1;
-
-	default:
-		return 0;
-	}
+	return 0;
 }
Index: src/wp/ap/win/ap_Win32Dialog_Field.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Dialog_Field.cpp,v
retrieving revision 1.14
diff -u -r1.14 ap_Win32Dialog_Field.cpp
--- src/wp/ap/win/ap_Win32Dialog_Field.cpp	29 Mar 2007 04:00:46 -0000	1.14
+++ src/wp/ap/win/ap_Win32Dialog_Field.cpp	9 Apr 2007 08:37:45 -0000
@@ -139,23 +139,7 @@
 {
 	const XAP_StringSet * pSS = m_pApp->getStringSet();
 	
-	SetWindowText(hWnd, pSS->getValue(AP_STRING_ID_DLG_Field_FieldTitle));
-	
-	// localize controls
-	_DSX(FIELD_BTN_OK,			DLG_OK);
-	_DSX(FIELD_BTN_CANCEL,		DLG_Cancel);
-	
-	_DS(FIELD_TEXT_TYPES,		DLG_Field_Types);
-	_DS(FIELD_TEXT_FORMATS, 	DLG_Field_Fields);
-	_DS(FIELD_TEXT_PARAM,		DLG_Field_Parameters);
-
-	// set initial state
-	m_hwndTypes = GetDlgItem(hWnd, AP_RID_DIALOG_FIELD_LIST_TYPES);
-	m_hwndFormats = GetDlgItem(hWnd, AP_RID_DIALOG_FIELD_LIST_FORMATS);
-	m_hwndParam = GetDlgItem(hWnd, AP_RID_DIALOG_FIELD_EDIT_PARAM);
-	SetTypesList();
-	SetFieldsList();
-	XAP_Win32DialogHelper::s_centerDialog(hWnd);		
+
 	return 1;				// 1 == we did not call SetFocus()
 }
 
Index: src/wp/ap/win/ap_Win32Dialog_FormatFootnotes.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Dialog_FormatFootnotes.cpp,v
retrieving revision 1.10
diff -u -r1.10 ap_Win32Dialog_FormatFootnotes.cpp
--- src/wp/ap/win/ap_Win32Dialog_FormatFootnotes.cpp	19 Jan 2007 15:34:47 -0000	1.10
+++ src/wp/ap/win/ap_Win32Dialog_FormatFootnotes.cpp	9 Apr 2007 08:37:46 -0000
@@ -104,227 +104,15 @@
 // This handles the WM_INITDIALOG message for the top-level dialog.
 BOOL AP_Win32Dialog_FormatFootnotes::_onInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {	
-	const XAP_StringSet * pSS = m_pApp->getStringSet();	
-	m_hwndDlg = hWnd;
-	char szText[16];	
-				
-	/* localize controls  */
-	_DSX(BTN_OK,			DLG_OK);
-	_DSX(BTN_CANCEL,		DLG_Cancel);				
-	_DS(RADIO_RSEL, 		DLG_FormatFootnotes_FootRestartSec);	
-	_DS(RADIO_PAGE,			DLG_FormatFootnotes_FootRestartPage);
-	_DS(RADIO_DONOT,		DLG_FormatFootnotes_FootRestartNone);
-	_DS(STATIC_INITFOOTVAL,	DLG_FormatFootnotes_FootInitialVal);
-	_DS(STATIC_FSTYLES1,	DLG_FormatFootnotes_FootStyle);
-	_DS(STATIC_FSTYLES2,	DLG_FormatFootnotes_FootStyle);
-	_DS(RADIO_ENDDOC,		DLG_FormatFootnotes_EndPlaceEndDoc);	
-	_DS(RADIO_ENDSEC,		DLG_FormatFootnotes_EndPlaceEndSec);	
-	_DS(STATIC_INITENDVAL,	DLG_FormatFootnotes_EndInitialVal);
-	_DS(STATIC_ESTYLES1,	DLG_FormatFootnotes_EndStyle);
-	_DS(STATIC_ESTYLES2, 	DLG_FormatFootnotes_EndStyle);
-	_DS(RADIO_ERSTSEC, 		DLG_FormatFootnotes_EndRestartSec);
-	_DS(STATIC_PLACEMENT, 	DLG_FormatFootnotes_EndPlacement);
-	_DS(STATIC_NUMBERING, 	DLG_FormatFootnotes_FootnoteRestart);
 
 	
-	/*Caption*/
-	SetWindowText(hWnd, pSS->getValue(AP_STRING_ID_DLG_FormatFootnotes_Title));
-		
-	setInitialValues(); /* Parent class loads data*/
-	
-	/* Footnote style combobox*/
-	int nItem;
-	int nDefF = 0;
-	int nDefE = 0;
-	const UT_GenericVector<const gchar*>* pType = getFootnoteTypeLabelList();
-	UT_return_val_if_fail( pType, 0 );
-
-	for(UT_uint32 i = 0; i < pType->getItemCount(); ++i)
-	{
-		 nItem = SendDlgItemMessage(hWnd, AP_RID_DIALOG_FORMATFOOTNOTES_COMBO_FSTYLE, CB_ADDSTRING, 0,
-									(LPARAM)pType->getNthItem(i));
-		 SendDlgItemMessage(hWnd, AP_RID_DIALOG_FORMATFOOTNOTES_COMBO_FSTYLE, CB_SETITEMDATA, nItem, (LPARAM)i);
-
-		 if (i==(UT_uint32)getFootnoteType())
-		  	nDefF = i;			
-
-		 nItem = SendDlgItemMessage(hWnd, AP_RID_DIALOG_FORMATFOOTNOTES_COMBO_ESTYLE, CB_ADDSTRING, 0,
-									(LPARAM)pType->getNthItem(i));
-		 SendDlgItemMessage(hWnd, AP_RID_DIALOG_FORMATFOOTNOTES_COMBO_ESTYLE, CB_SETITEMDATA, nItem, (LPARAM)i);
-		 
-		 if (i==(UT_uint32)getEndnoteType())
-		  	nDefE = i;			
-	}
-
- 	SendDlgItemMessage(hWnd, AP_RID_DIALOG_FORMATFOOTNOTES_COMBO_FSTYLE, CB_SETCURSEL, nDefF, 0);
- 	SendDlgItemMessage(hWnd, AP_RID_DIALOG_FORMATFOOTNOTES_COMBO_ESTYLE, CB_SETCURSEL, nDefE, 0);
-	 	 	
- 	
-	/*Set Default Radio buttons Footnotes */                                                                                                      
-	if (getRestartFootnoteOnSection() || getRestartFootnoteOnPage())
-		CheckRadioButton(hWnd, AP_RID_DIALOG_FORMATFOOTNOTES_RADIO_RSEL, AP_RID_DIALOG_FORMATFOOTNOTES_RADIO_DONOT,
-			getRestartFootnoteOnSection() ? AP_RID_DIALOG_FORMATFOOTNOTES_RADIO_RSEL : AP_RID_DIALOG_FORMATFOOTNOTES_RADIO_PAGE);                                                                              
-	else
-		CheckRadioButton(hWnd, AP_RID_DIALOG_FORMATFOOTNOTES_RADIO_RSEL, AP_RID_DIALOG_FORMATFOOTNOTES_RADIO_DONOT,
-			AP_RID_DIALOG_FORMATFOOTNOTES_RADIO_DONOT);                                                                              
-
-
-	/*Set Default Radio buttons Endnotes */                                                                                                      		
-	CheckRadioButton(hWnd, AP_RID_DIALOG_FORMATFOOTNOTES_RADIO_ENDDOC, AP_RID_DIALOG_FORMATFOOTNOTES_RADIO_ENDSEC,
-		 getPlaceAtDocEnd() ? AP_RID_DIALOG_FORMATFOOTNOTES_RADIO_ENDDOC: AP_RID_DIALOG_FORMATFOOTNOTES_RADIO_ENDSEC);                                                                              		
-				
-	/* Set Footnotes Spin*/ 
-	SendMessage(GetDlgItem(hWnd,AP_RID_DIALOG_FORMATFOOTNOTES_SPIN_FSTYLE),UDM_SETRANGE,(WPARAM)1,(WPARAM)9999);	
-	SendMessage(GetDlgItem(hWnd,AP_RID_DIALOG_FORMATFOOTNOTES_TEXT_FSTYLE),EM_LIMITTEXT,(WPARAM)4,(WPARAM)0);	
-	sprintf (szText, "%u", getFootnoteVal());	
-	SetDlgItemText(hWnd, AP_RID_DIALOG_FORMATFOOTNOTES_TEXT_FSTYLE, szText);
-	
-	/* Set Endnotes Spin*/ 
-	SendMessage(GetDlgItem(hWnd,AP_RID_DIALOG_FORMATFOOTNOTES_SPIN_ESTYLE),UDM_SETRANGE,(WPARAM)1,(WPARAM)9999);	
-	SendMessage(GetDlgItem(hWnd,AP_RID_DIALOG_FORMATFOOTNOTES_TEXT_ESTYLE),EM_LIMITTEXT,(WPARAM)4,(WPARAM)0);		
-	sprintf (szText, "%u", getEndnoteVal());	
-	SetDlgItemText(hWnd, AP_RID_DIALOG_FORMATFOOTNOTES_TEXT_ESTYLE, szText);
-	
-	
-	CheckDlgButton(hWnd, AP_RID_DIALOG_FORMATFOOTNOTES_RADIO_ERSTSEC, getRestartEndnoteOnSection());
-	      
-	XAP_Win32DialogHelper::s_centerDialog(hWnd);	
-	
 	return 0; // 0 because we called SetFocus
 
 }
 
 BOOL AP_Win32Dialog_FormatFootnotes::_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
-	WORD wNotifyCode = HIWORD(wParam);
-	WORD wId = LOWORD(wParam);
-	HWND hWndCtrl = (HWND)lParam;
-
-	switch (wId)
-	{
-		case AP_RID_DIALOG_FORMATFOOTNOTES_BTN_CANCEL:									
-			setAnswer(AP_Dialog_FormatFootnotes::a_CANCEL);
-			EndDialog(hWnd,0);
-			return 1;
-			
-		case AP_RID_DIALOG_FORMATFOOTNOTES_BTN_OK:				
-		{
-			char szValue[16];
-			
-			if (GetDlgItemText(m_hwndDlg, AP_RID_DIALOG_FORMATFOOTNOTES_TEXT_FSTYLE, szValue, 16))	
-				setFootnoteVal(atoi(szValue));
-				
-			if (GetDlgItemText(m_hwndDlg, AP_RID_DIALOG_FORMATFOOTNOTES_TEXT_ESTYLE, szValue, 16))	
-				setEndnoteVal(atoi(szValue));
-		
-			setAnswer(AP_Dialog_FormatFootnotes::a_OK);
-			EndDialog(hWnd,0);
-			return 1;
-		}
-		/*Footnote*/	
-		case AP_RID_DIALOG_FORMATFOOTNOTES_RADIO_RSEL:
-		{
-			if (IsDlgButtonChecked(hWnd, AP_RID_DIALOG_FORMATFOOTNOTES_RADIO_RSEL))
-			{
-				setRestartFootnoteOnPage(false);
-				setRestartFootnoteOnSection(true);
-			}
-			break;
-		}
-		
-		case AP_RID_DIALOG_FORMATFOOTNOTES_RADIO_PAGE:
-		{
-			if (IsDlgButtonChecked(hWnd, AP_RID_DIALOG_FORMATFOOTNOTES_RADIO_PAGE))
-			{
-				setRestartFootnoteOnPage(true);
-				setRestartFootnoteOnSection(false);
-			}
-			break;	
-		}
-
-		case AP_RID_DIALOG_FORMATFOOTNOTES_RADIO_DONOT:
-		{
-			if (IsDlgButtonChecked(hWnd, AP_RID_DIALOG_FORMATFOOTNOTES_RADIO_DONOT))
-			{
-				setRestartFootnoteOnPage(false);
-				setRestartFootnoteOnSection(false);
-			}
-			break;	
-		}
-		
-		/*Endnote*/	
-		case AP_RID_DIALOG_FORMATFOOTNOTES_RADIO_ENDDOC:
-		{
-			if (IsDlgButtonChecked(hWnd, AP_RID_DIALOG_FORMATFOOTNOTES_RADIO_ENDDOC))
-			{
-				setPlaceAtSecEnd(false);
-				setPlaceAtDocEnd(true);
-			}
-			break;
-		}
-		
-		case AP_RID_DIALOG_FORMATFOOTNOTES_RADIO_ENDSEC:
-		{
-			if (IsDlgButtonChecked(hWnd, AP_RID_DIALOG_FORMATFOOTNOTES_RADIO_ENDSEC))
-			{
-				setPlaceAtSecEnd(true);
-				setPlaceAtDocEnd(false);
-			}
-			break;	
-		}
-		
-		
-		/*Checkbox*/
-		case AP_RID_DIALOG_FORMATFOOTNOTES_RADIO_ERSTSEC:
-		{
-			bool bChecked;
-			
-			bChecked = (IsDlgButtonChecked( hWnd, AP_RID_DIALOG_FORMATFOOTNOTES_RADIO_ERSTSEC) == BST_CHECKED);
-			setRestartEndnoteOnSection(bChecked);
-			break;	
-		}
-	
-			
-		case AP_RID_DIALOG_FORMATFOOTNOTES_COMBO_FSTYLE:  
-		{
-			if (wNotifyCode == CBN_SELCHANGE)                       
-			{
-				int nItem = SendDlgItemMessage(hWnd, AP_RID_DIALOG_FORMATFOOTNOTES_COMBO_FSTYLE, CB_GETCURSEL, 0, 0);				
-				
-				if (nItem!=CB_ERR)
-				{
-					UT_uint32 n = (UT_uint32)SendDlgItemMessage(hWnd, AP_RID_DIALOG_FORMATFOOTNOTES_COMBO_FSTYLE,
-																CB_GETITEMDATA,   (WPARAM)nItem, 0);										
-					
-					setFootnoteType((FootnoteType)n);					
-				}
-			}
-			
-			break;
-		}
-		
-		case AP_RID_DIALOG_FORMATFOOTNOTES_COMBO_ESTYLE:  
-		{
-			if (wNotifyCode == CBN_SELCHANGE)                       
-			{
-				int nItem = SendDlgItemMessage(hWnd, AP_RID_DIALOG_FORMATFOOTNOTES_COMBO_ESTYLE, CB_GETCURSEL, 0, 0);				
-				
-				if (nItem!=CB_ERR)
-				{
-					UT_uint32 n = (UT_uint32)SendDlgItemMessage(hWnd, AP_RID_DIALOG_FORMATFOOTNOTES_COMBO_ESTYLE,
-																CB_GETITEMDATA,   (WPARAM)nItem, 0);										
-					
-						setEndnoteType((FootnoteType)n);
-				}
-			}
-			
-			break;
-		}
-
-		default:							// we did not handle this notification
-			UT_DEBUGMSG(("WM_Command for id %ld\n",wId));
-			return 0;						// return zero to let windows take care of it.
-	}
+
 
 	return 0;
 }
Index: src/wp/ap/win/ap_Win32Dialog_FormatFrame.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Dialog_FormatFrame.cpp,v
retrieving revision 1.14
diff -u -r1.14 ap_Win32Dialog_FormatFrame.cpp
--- src/wp/ap/win/ap_Win32Dialog_FormatFrame.cpp	16 Jan 2007 23:16:26 -0000	1.14
+++ src/wp/ap/win/ap_Win32Dialog_FormatFrame.cpp	9 Apr 2007 08:37:46 -0000
@@ -160,270 +160,15 @@
 // This handles the WM_INITDIALOG message for the top-level dialog.
 BOOL AP_Win32Dialog_FormatFrame::_onInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {	
-	HDC hdc;
-	int x, y;	
-	UT_uint32 w,h;
-	UT_sint32 i = 0;
-	RECT rect;	
-	const XAP_StringSet * pSS = m_pApp->getStringSet();
-	DWORD dwColor = GetSysColor(COLOR_BTNFACE);	
-	UT_RGBColor Color(GetRValue(dwColor),GetGValue(dwColor),GetBValue(dwColor));
-	
-	/* The four items are the same size */
-	GetClientRect(GetDlgItem(hWnd, AP_RID_DIALOG_FORMATFRAME_BMP_BOTTOM), &rect);					
-	hdc = GetDC(hWnd);
-	x = rect.right - rect.left;
-	y = rect.bottom - rect.top;
-	
-	/* Localise controls*/
-	_DSX(FORMATFRAME_BTN_CANCEL,		DLG_Close);
-	_DSX(FORMATFRAME_BTN_APPLY,			DLG_Apply);
-	_DS(FORMATFRAME_TEXT_BACKGROUND,	DLG_FormatFrame_Color);
-	_DS(FORMATFRAME_TEXT_PREVIEW,		DLG_FormatFrame_Preview);
-	_DS(FORMATFRAME_TEXT_BORDERS,		DLG_FormatFrame_Border_Color);
-	_DS(FORMATFRAME_TEXT_BORDER, 		DLG_FormatFrame_Color);
-	_DS(FORMATFRAME_TEXT_BACKGROUNDS, 	DLG_FormatFrame_Background);
-	_DS(FORMATFRAME_TEXT_TEXTWRAPS,		DLG_FormatFrame_TextWrapping);
-	_DS(FORMATFRAME_CHK_TEXTWRAP,		DLG_FormatFrame_SetTextWrapping);
-	_DS(FORMATFRAME_TEXT_POSTEXTPOS,	DLG_FormatFrame_PositionTo);
-	_DS(FORMATFRAME_RADIO_PARA,		 	DLG_FormatFrame_SetToParagraph);
-	_DS(FORMATFRAME_RADIO_COLUMN,		DLG_FormatFrame_SetToColumn);
-	_DS(FORMATFRAME_RADIO_PAGE,			DLG_FormatFrame_SetToPage);
-	_DS(FORMATFRAME_BUTTON_SELIMAGE,	DLG_FormatFrame_SelectImage);
-	_DS(FORMATFRAME_BUTTON_NOIMAGE,		DLG_FormatFrame_NoImageBackground);
-	_DS(FORMATFRAME_TEXT_THICKNESS,		DLG_FormatTable_Thickness);
-	_DS(FORMATFRAME_TEXT_IMGBACK,		DLG_FormatFrame_SetImageBackground);
-
-
-	SetWindowText(hWnd, pSS->getValue(AP_STRING_ID_DLG_FormatFrameTitle));	
-	
-	
-	/* Load the bitmaps into the dialog box */								
-    m_hBitmapBottom = _loadBitmap(hWnd,AP_RID_DIALOG_FORMATFRAME_BMP_BOTTOM, "FT_LINEBOTTOM",  x, y, Color);
-    m_hBitmapTop = _loadBitmap(hWnd,AP_RID_DIALOG_FORMATFRAME_BMP_TOP, "FT_LINETOP",  x, y, Color);
-    m_hBitmapRight = _loadBitmap(hWnd,AP_RID_DIALOG_FORMATFRAME_BMP_RIGHT, "FT_LINERIGHT",  x, y, Color);
-    m_hBitmapLeft = _loadBitmap(hWnd,AP_RID_DIALOG_FORMATFRAME_BMP_LEFT, "FT_LINELEFT",  x, y, Color); 
-    
-	/* Preview*/
-	HWND hwndChild = GetDlgItem(hWnd, AP_RID_DIALOG_FORMATFRAME_STATIC_PREVIEW);	
-	UT_return_val_if_fail (hwndChild,1);
-
-	m_pPreviewWidget = new XAP_Win32PreviewWidget(static_cast<XAP_Win32App *>(m_pApp),  hwndChild, 0);	
-	m_pPreviewWidget->getGraphics()->init3dColors();
-	m_pPreviewWidget->getWindowSize(&w,&h);
-	_createPreviewFromGC(m_pPreviewWidget->getGraphics(), w, h);	
-	m_pPreviewWidget->setPreview(m_pFormatFramePreview); 	
-								
-	startUpdater();
-	setAllSensitivities();
-
-	/* Default status for the dialog controls */
-	CheckDlgButton(hWnd, AP_RID_DIALOG_FORMATFRAME_BMP_TOP, getTopToggled() ? BST_CHECKED: BST_UNCHECKED);
-	CheckDlgButton(hWnd, AP_RID_DIALOG_FORMATFRAME_BMP_BOTTOM, getBottomToggled() ? BST_CHECKED: BST_UNCHECKED);
-	CheckDlgButton(hWnd, AP_RID_DIALOG_FORMATFRAME_BMP_RIGHT, getRightToggled() ? BST_CHECKED: BST_UNCHECKED);
-	CheckDlgButton(hWnd, AP_RID_DIALOG_FORMATFRAME_BMP_LEFT, getLeftToggled() ? BST_CHECKED: BST_UNCHECKED);
-
-	/* Position to radio buttons */
-	if(positionMode() == FL_FRAME_POSITIONED_TO_BLOCK)
-	{
-		CheckRadioButton(hWnd, AP_RID_DIALOG_FORMATFRAME_RADIO_PARA, AP_RID_DIALOG_FORMATFRAME_RADIO_PAGE, AP_RID_DIALOG_FORMATFRAME_RADIO_PARA);
-	}
-	else if(positionMode() == FL_FRAME_POSITIONED_TO_COLUMN)
-	{
-		CheckRadioButton(hWnd, AP_RID_DIALOG_FORMATFRAME_RADIO_PARA, AP_RID_DIALOG_FORMATFRAME_RADIO_PAGE, AP_RID_DIALOG_FORMATFRAME_RADIO_COLUMN);
-	}
-	else if(positionMode() == FL_FRAME_POSITIONED_TO_PAGE)
-	{
-		CheckRadioButton(hWnd, AP_RID_DIALOG_FORMATFRAME_RADIO_PARA, AP_RID_DIALOG_FORMATFRAME_RADIO_PAGE, AP_RID_DIALOG_FORMATFRAME_RADIO_PAGE);
-	}
-
-	/* Wrapping checkbox */
-	CheckDlgButton(hWnd, AP_RID_DIALOG_FORMATFRAME_CHK_TEXTWRAP, getWrapping() ? BST_CHECKED: BST_UNCHECKED);
-
-	/* Combo Values for Thickness */
-	HWND hCombo = GetDlgItem(hWnd, AP_RID_DIALOG_FORMATFRAME_COMBO_THICKNESS);
-	
-	for(i=0; i < FORMAT_FRAME_NUMTHICKNESS ;i++)
-		SendMessage(hCombo, CB_ADDSTRING, 0, (WPARAM) sThickness[i]);
-
-	SendMessage(hCombo, CB_SETCURSEL, 0, 0);
-
-	XAP_Win32DialogHelper::s_centerDialog(hWnd);			
 	return 1; 
 }
 
 
 BOOL AP_Win32Dialog_FormatFrame::_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
-	WORD wNotifyCode = HIWORD(wParam);
-	WORD wId = LOWORD(wParam);
-	HWND hWndCtrl = (HWND)lParam;
-
-	switch (wId)
-	{			
-		case AP_RID_DIALOG_FORMATFRAME_BMP_BOTTOM:		
-		{
-			bool bChecked;			
-			bChecked = (bool)(IsDlgButtonChecked(m_hwndDlg, AP_RID_DIALOG_FORMATFRAME_BMP_BOTTOM)==BST_CHECKED);							
-			toggleLineType(AP_Dialog_FormatFrame::toggle_bottom, bChecked);				
-			event_previewExposed();			
-			return 1;
-		}			
-		
-		case AP_RID_DIALOG_FORMATFRAME_BMP_TOP:		
-		{
-			bool bChecked;			
-			bChecked = (bool)(IsDlgButtonChecked(m_hwndDlg, AP_RID_DIALOG_FORMATFRAME_BMP_TOP)==BST_CHECKED);							
-			toggleLineType(AP_Dialog_FormatFrame::toggle_top, bChecked);				
-			event_previewExposed();			
-			return 1;
-		}	
-		
-		case AP_RID_DIALOG_FORMATFRAME_BMP_RIGHT:		
-		{
-			bool bChecked;			
-			bChecked = (bool)(IsDlgButtonChecked(m_hwndDlg, AP_RID_DIALOG_FORMATFRAME_BMP_RIGHT)==BST_CHECKED);							
-			toggleLineType(AP_Dialog_FormatFrame::toggle_right, bChecked);				
-			event_previewExposed();			
-			return 1;
-		}			
-		
-		case AP_RID_DIALOG_FORMATFRAME_BMP_LEFT:		
-		{
-			bool bChecked;			
-			bChecked = (bool)(IsDlgButtonChecked(m_hwndDlg, AP_RID_DIALOG_FORMATFRAME_BMP_LEFT)==BST_CHECKED);							
-			toggleLineType(AP_Dialog_FormatFrame::toggle_left, bChecked);				
-			event_previewExposed();			
-			return 1;
-		}	
-		 
-		 
-		case AP_RID_DIALOG_FORMATFRAME_BTN_BORDERCOLOR:		
-		{	
-			CHOOSECOLOR cc;                
-			static COLORREF acrCustClr[16];
-			
-			/* Initialize CHOOSECOLOR */
-			ZeroMemory(&cc, sizeof(CHOOSECOLOR));
-			cc.lStructSize = sizeof(CHOOSECOLOR);
-			cc.hwndOwner = m_hwndDlg;
-			cc.lpCustColors = (LPDWORD) acrCustClr;
-			cc.rgbResult = 0;
-			cc.Flags = CC_FULLOPEN | CC_RGBINIT;
-		 
-			if(ChooseColor(&cc))			
-			{
-				setBorderColor(UT_RGBColor(GetRValue( cc.rgbResult), GetGValue(cc.rgbResult), GetBValue(cc.rgbResult)));		
-				m_borderButton.setColour(cc.rgbResult);
-
-				/*Force redraw*/
-				InvalidateRect(GetDlgItem(hWnd, AP_RID_DIALOG_FORMATFRAME_BTN_BORDERCOLOR), NULL, FALSE);
-				event_previewExposed();	
-			}
-
-			return 1;
-		}	
-		
-		
-		case AP_RID_DIALOG_FORMATFRAME_BTN_BACKCOLOR:		
-		{	
-			CHOOSECOLOR cc;               
-			static COLORREF acrCustClr2[16];
-			
-			/* Initialize CHOOSECOLOR */
-			ZeroMemory(&cc, sizeof(CHOOSECOLOR));
-			cc.lStructSize = sizeof(CHOOSECOLOR);
-			cc.hwndOwner = m_hwndDlg;
-			cc.lpCustColors = (LPDWORD) acrCustClr2;
-			cc.rgbResult = 0;
-			cc.Flags = CC_FULLOPEN | CC_RGBINIT;
-		 
-			if(ChooseColor(&cc))			
-			{
-				setBGColor(UT_RGBColor(GetRValue( cc.rgbResult), GetGValue(cc.rgbResult), GetBValue(cc.rgbResult)));						
-				m_backgButton.setColour(cc.rgbResult);
-
-				/*Force redraw*/
-				InvalidateRect(GetDlgItem(hWnd, AP_RID_DIALOG_FORMATFRAME_BTN_BACKCOLOR), NULL, FALSE);
-				event_previewExposed();	
-			}
-
-			return 1;
-		}			
-
-		case AP_RID_DIALOG_FORMATFRAME_CHK_TEXTWRAP:
-		{
-			bool bChecked;
-			bChecked = (bool)(IsDlgButtonChecked(m_hwndDlg, AP_RID_DIALOG_FORMATFRAME_CHK_TEXTWRAP)==BST_CHECKED);
-
-			setWrapping(bChecked);
-
-			// Not necessary now, but we may some day show
-			// text wrapping in the preview.
-			event_previewExposed();
-			return 1;
-		}
-
-			
-		case AP_RID_DIALOG_FORMATFRAME_BTN_CANCEL:			
-			m_answer = AP_Dialog_FormatFrame::a_CLOSE;
-			destroy();
-			event_Close();
-			EndDialog(hWnd,0);
-			return 1;
-
-		case AP_RID_DIALOG_FORMATFRAME_COMBO_THICKNESS:
-		{
-			if (wNotifyCode == CBN_SELCHANGE)                       
-			{
-				int nSelected;
-				HWND hCombo = GetDlgItem(hWnd, AP_RID_DIALOG_FORMATFRAME_COMBO_THICKNESS);
-				nSelected = SendMessage(hCombo, CB_GETCURSEL, 0, 0);				
-
-				if (nSelected != CB_ERR)
-				{
-					UT_LocaleTransactor t(LC_NUMERIC, "C");					
-					UT_UTF8String sThickness;
-
-					
-					sThickness = UT_UTF8String_sprintf("%fin",m_dThickness[nSelected]);
-					setBorderThicknessAll(sThickness);					
-					event_previewExposed();
-				}
-			}
-			return 1;
-		}
-
-		case AP_RID_DIALOG_FORMATFRAME_BUTTON_SELIMAGE:
-				askForGraphicPathName();
-				return 1;
-
-		case AP_RID_DIALOG_FORMATFRAME_BUTTON_NOIMAGE:
-				clearImage();
-				return 1;
-
-		case AP_RID_DIALOG_FORMATFRAME_RADIO_PARA:
-				setPositionMode(FL_FRAME_POSITIONED_TO_BLOCK);
-				return 1;
-
-		case AP_RID_DIALOG_FORMATFRAME_RADIO_COLUMN:
-				setPositionMode(FL_FRAME_POSITIONED_TO_COLUMN);
-				return 1;
-
-		case AP_RID_DIALOG_FORMATFRAME_RADIO_PAGE:
-				setPositionMode(FL_FRAME_POSITIONED_TO_PAGE);
-				return 1;
-
-		case AP_RID_DIALOG_FORMATFRAME_BTN_APPLY:
-				applyChanges();
-				return 1;
-
-		
-			
-		default:							// we did not handle this notification 
-			UT_DEBUGMSG(("WM_Command for id %ld\n",wId));
-			return 0;						// return zero to let windows take care of it.
-	}
+
+	return 0;						// return zero to let windows take care of it.
+
 }
 
 void AP_Win32Dialog_FormatFrame::event_previewExposed(void)
@@ -461,19 +206,7 @@
 
 void AP_Win32Dialog_FormatFrame::notifyActiveFrame(XAP_Frame *pFrame)
 { 	
-	setAllSensitivities();
-	
-	if((HWND)GetWindowLong(m_hwndDlg, GWL_HWNDPARENT) != static_cast<XAP_Win32FrameImpl*>(pFrame->getFrameImpl())->getTopLevelWindow())
-	{
-		// Update the caption
-		ConstructWindowName();
-		SetWindowText(m_hwndDlg, m_WindowName);
-
-		SetWindowLong(m_hwndDlg, GWL_HWNDPARENT, (long)static_cast<XAP_Win32FrameImpl*>(pFrame->getFrameImpl())->getTopLevelWindow());
-		SetWindowPos(m_hwndDlg, NULL, 0, 0, 0, 0,
-						SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
 
-	}
 }
 
 
Index: src/wp/ap/win/ap_Win32Dialog_FormatTOC.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Dialog_FormatTOC.cpp,v
retrieving revision 1.19
diff -u -r1.19 ap_Win32Dialog_FormatTOC.cpp
--- src/wp/ap/win/ap_Win32Dialog_FormatTOC.cpp	12 Mar 2007 12:05:32 -0000	1.19
+++ src/wp/ap/win/ap_Win32Dialog_FormatTOC.cpp	9 Apr 2007 08:37:46 -0000
@@ -37,8 +37,8 @@
 #include "xap_Win32PropertySheet.h"
 #include "ap_Win32Resources.rc2"
 #include "xap_Win32DialogHelper.h"
-#include "ap_Dialog_FormatFootnotes.h"
-#include "ap_Win32App.h"                                                        
+#include "ap_Dialog_FormatFootnotes.h"
+#include "ap_Win32App.h"                                                        
 #include "pt_PieceTable.h"
 
 /*****************************************************************/
@@ -52,13 +52,13 @@
 
 AP_Win32Dialog_FormatTOC::AP_Win32Dialog_FormatTOC(XAP_DialogFactory * pDlgFactory,
 										 XAP_Dialog_Id id)
-	: AP_Dialog_FormatTOC(pDlgFactory,id)	
-{
+	: AP_Dialog_FormatTOC(pDlgFactory,id)	
+{
 	m_iStartValue = 1;
 }
 
 AP_Win32Dialog_FormatTOC::~AP_Win32Dialog_FormatTOC(void)
-{
+{
 
 }
 
@@ -68,49 +68,29 @@
 }
 
 void AP_Win32Dialog_FormatTOC::setTOCPropsInGUI(void)
-{
-	if (m_pGeneral)
-		m_pGeneral->_fillGUI();
-		
-	if (m_pLayout)
-		m_pLayout->_fillGUI();
+{
+
 	
 }
 
 
 void AP_Win32Dialog_FormatTOC::setSensitivity(bool bSensitive)
-{
-	if (m_pGeneral) 
-		m_pGeneral->setChanged (bSensitive);
-		
-	if (m_pLayout)
-		m_pLayout->setChanged (bSensitive);
+{
+
 	
 }
 
 void AP_Win32Dialog_FormatTOC::destroy(void)
-{	
+{	
 	
-	finalize();		
-	
-	//Property sheet will be autodestroyed by the cancel action		
-	if (m_pGeneral) {
-		delete m_pGeneral;
-		m_pGeneral = NULL;
-	}
-		
-	if (m_pLayout) {
-		delete m_pLayout;
-		m_pLayout = NULL;
-	}
 
-	//delete m_pSheet;
-
+	//delete m_pSheet;
+
 }
 
 void AP_Win32Dialog_FormatTOC::activate(void)
-{	  	
-
+{	  	
+
 	
 }	
 
@@ -118,694 +98,25 @@
 
 void AP_Win32Dialog_FormatTOC::runModeless(XAP_Frame * pFrame)
 {
-
-	UT_return_if_fail (pFrame);
-	RECT rect;
-	POINT pnt;
-	XAP_Win32App * pWin32App = static_cast<XAP_Win32App *>(XAP_App::getApp());
-
-	m_pSheet = new AP_Win32Dialog_FormatTOC_Sheet();
-	m_pSheet->setContainer (this);	
-	m_pSheet->setApplyButton (true);
-	m_pSheet->setOkButton (true);
-	m_pSheet->setCancelButton(false);
-	
-	m_pGeneral = new AP_Win32Dialog_FormatTOC_General();		
-	m_pGeneral->setContainer (this);	
-	m_pGeneral->createPage(pWin32App, AP_RID_DIALOG_FORMATTOC_GENERAL, AP_STRING_ID_DLG_FormatTOC_General);
-	
-	m_pLayout = new AP_Win32Dialog_FormatTOC_Layout();		
-	m_pLayout->setContainer (this);	
-	m_pLayout->createPage(pWin32App, AP_RID_DIALOG_FORMATTOC_LAYOUTDETAILS, AP_STRING_ID_DLG_FormatTOC_LayoutDetails);	
-	
-	m_pSheet->addPage(m_pGeneral);
-	m_pSheet->addPage(m_pLayout);
-	m_pSheet->runModeless(pWin32App, pFrame, AP_STRING_ID_DLG_FormatTOC_Title);	
-
-	GetWindowRect(GetDlgItem(m_pSheet->getHandle() ,IDCANCEL), &rect);	
-	pnt.x = rect.left;
-	pnt.y = rect.top;
-	ScreenToClient (m_pSheet->getHandle(), &pnt);
-
-	HWND hwndOK = GetDlgItem(m_pSheet->getHandle(),IDOK);
-	MoveWindow (hwndOK, 
-		pnt.x, pnt.y, rect.right - rect.left, rect.bottom - rect.top, true);
-
-	UT_sint32 sid =(UT_sint32)  getDialogId();
-	m_pApp->rememberModelessId( sid, (XAP_Dialog_Modeless *) m_pDialog);
-
-	startUpdater(); 
-}
-
-void AP_Win32Dialog_FormatTOC::setStyle(HWND hWnd, int nCtrlID)
-{
-	UT_UTF8String sVal, str_loc;	
-	UT_UTF8String sProp;
-	UT_String str;
-	HWND hwndCtrl = GetDlgItem (hWnd, nCtrlID);
-
-	switch (nCtrlID) 
-	{
-		case AP_RID_DIALOG_FORMATTOC_GENERAL_TEXT_HEADINGSTYLEVALUE:
-			sProp = static_cast<char *> ("toc-heading-style");
-			break;
-
-		case AP_RID_DIALOG_FORMATTOC_GENERAL_TEXT_FILLSTYLEVALUE:
-			sProp = static_cast<char *> ("toc-source-style");
-			break;
-
-		case AP_RID_DIALOG_FORMATTOC_GENERAL_TEXT_DISPLAYSTYLEVALUE:
-			sProp = static_cast<char *> ("toc-dest-style");
-			break;
-
-		default:
-			break;
-	}
-
-	if(g_ascii_strcasecmp("toc-heading-style",sProp.utf8_str()) != 0)
-	{
-		UT_String sNum =  UT_String_sprintf("%d",getMainLevel());
-		sProp += sNum.c_str();
-	}
-
-	sVal = getNewStyle(sProp);	
-	pt_PieceTable::s_getLocalisedStyleName (sVal.utf8_str(), str_loc);	
-
-	SendMessage (hwndCtrl, WM_SETTEXT, 0, (LPARAM) 
-		(AP_Win32App::s_fromUTF8ToWinLocale (str_loc.utf8_str())).c_str() );
-		
-	setTOCProperty(sProp,sVal);
-	applyTOCPropsToDoc ();
-
-}
-
-
-void AP_Win32Dialog_FormatTOC::setMainLevel(UT_sint32 iLevel)
-{
-	AP_Dialog_FormatTOC::setMainLevel(iLevel);
-	UT_UTF8String sVal, str_loc;
-	UT_String str;
-
-	sVal = getTOCPropVal("toc-dest-style",getMainLevel());
-
-	pt_PieceTable::s_getLocalisedStyleName (sVal.utf8_str(), str_loc);
-	str = AP_Win32App::s_fromUTF8ToWinLocale (str_loc.utf8_str()); 
-
-	SendMessage (GetDlgItem (m_pGeneral->getHandle(), AP_RID_DIALOG_FORMATTOC_GENERAL_TEXT_DISPLAYSTYLEVALUE), 	
-		WM_SETTEXT, 0, (LPARAM)str.c_str());
-
-	sVal = getTOCPropVal("toc-source-style",getMainLevel());
-
-	pt_PieceTable::s_getLocalisedStyleName (sVal.utf8_str(), str_loc);
-	str = AP_Win32App::s_fromUTF8ToWinLocale (str_loc.utf8_str()); 
-
-	SendMessage (GetDlgItem (m_pGeneral->getHandle(), AP_RID_DIALOG_FORMATTOC_GENERAL_TEXT_FILLSTYLEVALUE), 	
-		WM_SETTEXT, 0, (LPARAM)str.c_str());	
-
-	sVal = getTOCPropVal("toc-has-label",getMainLevel());
-	
-	CheckDlgButton(m_pGeneral->getHandle(), AP_RID_DIALOG_FORMATTOC_GENERAL_CHECK_HASLEVEL,
-		(g_ascii_strcasecmp(sVal.utf8_str(),"1") == 0) ? BST_CHECKED :BST_UNCHECKED);	
-}
-
-
-void AP_Win32Dialog_FormatTOC::setDetailsLevel(UT_sint32 iLevel)
-{
-		
-	UT_UTF8String sVal, str_loc;
-	UT_String str;
-
-	AP_Dialog_FormatTOC::setDetailsLevel(iLevel);
-
-	
-	/* Start at */
-	sVal = getTOCPropVal("toc-label-start", getDetailsLevel());
-
-	SetWindowText (GetDlgItem (m_pLayout->getHandle(),
-		AP_RID_DIALOG_FORMATTOC_LAYOUTDETAILS_EDIT_STARTAT), sVal.utf8_str());
-
-	m_pLayout->loadCtrlsValuesForDetailsLevel ();
-
-}
-
-/*
-
-	Sheet
-	
-*/
-AP_Win32Dialog_FormatTOC_Sheet::AP_Win32Dialog_FormatTOC_Sheet() :
-XAP_Win32PropertySheet()
-{
-	setCallBack(s_sheetInit);	
-}
-
-int CALLBACK AP_Win32Dialog_FormatTOC_Sheet::s_sheetInit(HWND hwnd,  UINT uMsg,  LPARAM lParam)
-{	
-	if (uMsg==PSCB_INITIALIZED)
-	{	
-		/* Force the creation of all pages*/		
-		PropSheet_SetCurSel(hwnd, 0,1);		
-		PropSheet_SetCurSel(hwnd, 0,0);
-	}			
-	return 	0;
-}
-
-					  
-void AP_Win32Dialog_FormatTOC_Sheet::_onOK()
-{	
-	getContainer()->destroy();
-	destroy();
-}
-
-void AP_Win32Dialog_FormatTOC_Sheet::_onInitDialog(HWND hwnd)
-{
-	
-	const XAP_StringSet * pSS = getContainer()->getApp()->getStringSet();		
-
-	SendMessage(GetDlgItem(getHandle(),IDOK), WM_SETTEXT, 0,
-		(LPARAM) (pSS->getValue(XAP_STRING_ID_DLG_OK)));
-}
-
-
-void AP_Win32Dialog_FormatTOC_Sheet::cleanup(void) 
-{		
-	getContainer()->modeless_cleanup ();
-}
-
-
-/*
-
-	General
-
-*/
-AP_Win32Dialog_FormatTOC_General::AP_Win32Dialog_FormatTOC_General()
-{
 
 }
 
-AP_Win32Dialog_FormatTOC_General::~AP_Win32Dialog_FormatTOC_General()
+void AP_Win32Dialog_FormatTOC::setStyle(HWND hWnd, int nCtrlID)
 {
 
-}
 
-void AP_Win32Dialog_FormatTOC_General::_fillGUI()
-{														 	
-	
-	UT_UTF8String sVal, str_loc;
-	UT_String str;
-
-	sVal = getContainer()->getTOCPropVal("toc-has-heading"); 
-	if(g_ascii_strcasecmp(sVal.utf8_str(),"1") == 0)
-	{
-		CheckDlgButton(getHandle(), AP_RID_DIALOG_FORMATTOC_GENERAL_CHECK_HASHEADING, BST_CHECKED);
-		EnableWindow(GetDlgItem(getHandle(),AP_RID_DIALOG_FORMATTOC_GENERAL_BUTTON_HEADINGSTYLE), true);
-		EnableWindow(GetDlgItem(getHandle(),AP_RID_DIALOG_FORMATTOC_GENERAL_TEXT_HEADINGSTYLEVALUE), true);
-	}
-	else
-	{
-		CheckDlgButton(getHandle(), AP_RID_DIALOG_FORMATTOC_GENERAL_CHECK_HASHEADING, BST_UNCHECKED);
-		EnableWindow(GetDlgItem(getHandle(),AP_RID_DIALOG_FORMATTOC_GENERAL_BUTTON_HEADINGSTYLE), false);
-		EnableWindow(GetDlgItem(getHandle(),AP_RID_DIALOG_FORMATTOC_GENERAL_TEXT_HEADINGSTYLEVALUE), false);
-	}
-	
-	sVal = getContainer()->getTOCPropVal("toc-has-label", getContainer()->getMainLevel()); 	 
-	CheckDlgButton(getHandle(), AP_RID_DIALOG_FORMATTOC_GENERAL_CHECK_HASLEVEL,
-		(g_ascii_strcasecmp(sVal.utf8_str(),"1") == 0) ? BST_CHECKED :BST_UNCHECKED);
-
-	sVal = getContainer()->getTOCPropVal("toc-heading-style");
-	pt_PieceTable::s_getLocalisedStyleName (sVal.utf8_str(), str_loc);
-	str = AP_Win32App::s_fromUTF8ToWinLocale (str_loc.utf8_str()); 
-
-	SendMessage (GetDlgItem (getHandle(), AP_RID_DIALOG_FORMATTOC_GENERAL_TEXT_HEADINGSTYLEVALUE), 	
-		WM_SETTEXT, 0, (LPARAM)str.c_str());	
-
-	// Set MainLevel for the Combobox	
-	SendMessage(GetDlgItem(getHandle(), AP_RID_DIALOG_FORMATTOC_GENERAL_COMBO_LEVEL), CB_SETCURSEL, getContainer()->getMainLevel() - 1, 0);	
-	getContainer()->setMainLevel(getContainer()->getMainLevel());
-
-	sVal = getContainer()->getTOCPropVal("toc-heading");
-	pt_PieceTable::s_getLocalisedStyleName (sVal.utf8_str(), str_loc);
-	str = AP_Win32App::s_fromUTF8ToWinLocale (str_loc.utf8_str()); 
-
-	SetWindowText (GetDlgItem (getHandle(),
-		AP_RID_DIALOG_FORMATTOC_GENERAL_EDIT_HEADINGTEXT), str.c_str());
-	
-	
 }
 
-void AP_Win32Dialog_FormatTOC_General::_onInitDialog()
-{
-
-	const XAP_StringSet * pSS = getApp()->getStringSet();
-	int i;
 
-	struct control_id_string_id {
-		UT_sint32		controlId;
-		XAP_String_Id	stringId;
-	} static const rgMapping[] =
-	{
-		{AP_RID_DIALOG_FORMATTOC_GENERAL_CHECK_HASHEADING, 		AP_STRING_ID_DLG_FormatTOC_HasHeading},
-		{AP_RID_DIALOG_FORMATTOC_GENERAL_TEXT_HEADINGTEXT,		AP_STRING_ID_DLG_FormatTOC_HeadingText},
-		{AP_RID_DIALOG_FORMATTOC_GENERAL_TEXT_HEADINGSTYLE,		AP_STRING_ID_DLG_FormatTOC_HeadingStyle},
-		{AP_RID_DIALOG_FORMATTOC_GENERAL_BUTTON_HEADINGSTYLE,	AP_STRING_ID_DLG_FormatTOC_ChangeStyle},
-		{AP_RID_DIALOG_FORMATTOC_GENERAL_TEXT_MAINPROPERTIES,	AP_STRING_ID_DLG_FormatTOC_LevelDefs},
-		{AP_RID_DIALOG_FORMATTOC_GENERAL_CHECK_HASLEVEL,		AP_STRING_ID_DLG_FormatTOC_HasLabel},
-		{AP_RID_DIALOG_FORMATTOC_GENERAL_TEXT_FILLSTYLE,		AP_STRING_ID_DLG_FormatTOC_FillStyle},
-		{AP_RID_DIALOG_FORMATTOC_GENERAL_BUTTON_FILLSTYLE,		AP_STRING_ID_DLG_FormatTOC_ChangeStyle},
-		{AP_RID_DIALOG_FORMATTOC_GENERAL_TEXT_DISPLAYSTYLE,		AP_STRING_ID_DLG_FormatTOC_DispStyle},
-		{AP_RID_DIALOG_FORMATTOC_GENERAL_BUTTON_DISPLAYSTYLE,	AP_STRING_ID_DLG_FormatTOC_ChangeStyle},
-		{NULL,NULL}
-	};
-
-	// Localise the controls
-	for (i = 0; i < rgMapping[i].controlId; i++)
-		SetDlgItemText(getHandle(), rgMapping[i].controlId, pSS->getValue(rgMapping[i].stringId));
-
-	/* Levels */
-	int item;
-	int nID [4] = {AP_STRING_ID_DLG_FormatTOC_Level1, AP_STRING_ID_DLG_FormatTOC_Level2,
-	AP_STRING_ID_DLG_FormatTOC_Level3, AP_STRING_ID_DLG_FormatTOC_Level4};
-	for (i = 0; i < 4; i++)
-	{	
-		item = SendDlgItemMessage(getHandle(), AP_RID_DIALOG_FORMATTOC_GENERAL_COMBO_LEVEL, CB_ADDSTRING, 0, 
-			(LPARAM) pSS->getValue(nID[i]));
-
-		SendDlgItemMessage(getHandle(), AP_RID_DIALOG_FORMATTOC_GENERAL_COMBO_LEVEL, CB_SETITEMDATA, item, i+1);
-	}	 
-
-	SendDlgItemMessage(getHandle(), AP_RID_DIALOG_FORMATTOC_GENERAL_COMBO_LEVEL, CB_SETCURSEL, 0, 0);
-
-	getContainer()->setTOCPropsInGUI();	
-}
-
-
-void AP_Win32Dialog_FormatTOC_General::_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
+void AP_Win32Dialog_FormatTOC::setMainLevel(UT_sint32 iLevel)
 {
-	WORD wNotifyCode = HIWORD(wParam);
-	WORD wId = LOWORD(wParam);
-	HWND hWndCtrl = (HWND)lParam;
-	AP_Win32Dialog_FormatTOC*	 pParent=  (AP_Win32Dialog_FormatTOC*)getContainer();	
-	
-	switch (wId)
-	{		
-		case AP_RID_DIALOG_FORMATTOC_GENERAL_CHECK_HASHEADING:
-		{
-			UT_UTF8String sProp = static_cast<char *> ("toc-has-heading");
-			UT_UTF8String sVal = "1";
-
-			if (IsDlgButtonChecked(hWnd, AP_RID_DIALOG_FORMATTOC_GENERAL_CHECK_HASHEADING) != BST_CHECKED)
-			{
-				EnableWindow(GetDlgItem(hWnd,AP_RID_DIALOG_FORMATTOC_GENERAL_BUTTON_HEADINGSTYLE), false);
-				EnableWindow(GetDlgItem(hWnd,AP_RID_DIALOG_FORMATTOC_GENERAL_TEXT_HEADINGSTYLEVALUE), false);
-				sVal = "0";		
-			}
-			else
-			{
-				EnableWindow(GetDlgItem(hWnd,AP_RID_DIALOG_FORMATTOC_GENERAL_BUTTON_HEADINGSTYLE), true);
-				EnableWindow(GetDlgItem(hWnd,AP_RID_DIALOG_FORMATTOC_GENERAL_TEXT_HEADINGSTYLEVALUE), true);			
-			}
-			getContainer()->setTOCProperty(sProp,sVal);			
-			break;
-		}
-				
-		case AP_RID_DIALOG_FORMATTOC_GENERAL_BUTTON_HEADINGSTYLE:						   
-			getContainer()->setStyle(hWnd, AP_RID_DIALOG_FORMATTOC_GENERAL_TEXT_HEADINGSTYLEVALUE);
-			break;
-
-		case AP_RID_DIALOG_FORMATTOC_GENERAL_BUTTON_FILLSTYLE:						   
-			getContainer()->setStyle(hWnd, AP_RID_DIALOG_FORMATTOC_GENERAL_TEXT_FILLSTYLEVALUE);
-			break;
-
-		case AP_RID_DIALOG_FORMATTOC_GENERAL_BUTTON_DISPLAYSTYLE:						   
-			getContainer()->setStyle(hWnd, AP_RID_DIALOG_FORMATTOC_GENERAL_TEXT_DISPLAYSTYLEVALUE);
-			break;
-
-		case AP_RID_DIALOG_FORMATTOC_GENERAL_COMBO_LEVEL:
-		{
-			if (wNotifyCode == CBN_SELCHANGE)
-			{
-				int nSelected, nLevel;
-				HWND hCombo = GetDlgItem(hWnd, AP_RID_DIALOG_FORMATTOC_GENERAL_COMBO_LEVEL);
-
-				nSelected = SendMessage(hCombo, CB_GETCURSEL, 0, 0);					
-
-				if (nSelected!=CB_ERR) 
-				{		
-					nLevel  = SendMessage(hCombo, CB_GETITEMDATA, nSelected, 0);
-					getContainer()->setMainLevel (nLevel);
-				}
-			}
-			break;
-			
-		}
-
-		case AP_RID_DIALOG_FORMATTOC_GENERAL_CHECK_HASLEVEL:
-		{
-
-			UT_UTF8String sProp = static_cast<char *> ("toc-has-label");
-			UT_UTF8String sVal = "1";
-			UT_String sNum =  UT_String_sprintf("%d",getContainer()->getMainLevel());
-
-			/* Has label */
-			sVal = getContainer()->getTOCPropVal(sProp.utf8_str(), getContainer()->getMainLevel());
-			sVal = "1";
-
-			if (IsDlgButtonChecked(getHandle(), AP_RID_DIALOG_FORMATTOC_GENERAL_CHECK_HASLEVEL) != BST_CHECKED)
-				sVal = "0";	
-				
-			sProp += sNum.c_str();			
-			getContainer()->setTOCProperty(sProp,sVal);	
-			break;
-		}
-			
-		default:
-			break;
-	}
-}
-
-void AP_Win32Dialog_FormatTOC_General::_onApply()
-{
-	char szText[1024];
-	UT_UTF8String sUTF8;
-
-	GetWindowText(GetDlgItem (getHandle(),
-		AP_RID_DIALOG_FORMATTOC_GENERAL_EDIT_HEADINGTEXT), szText, 1024);
-
-	sUTF8 = AP_Win32App::s_fromWinLocaleToUTF8 (szText); 
-	
-	getContainer()->setTOCProperty("toc-heading", sUTF8.utf8_str());
-	getContainer()->Apply();
-}
-
-void AP_Win32Dialog_FormatTOC_General::_onOK()
-{
-	_onApply();
-}
-
-
-/*
-
-	Layout Details
-
-*/
-AP_Win32Dialog_FormatTOC_Layout::AP_Win32Dialog_FormatTOC_Layout()
-{
-
-}
-
-AP_Win32Dialog_FormatTOC_Layout::~AP_Win32Dialog_FormatTOC_Layout()
-{
-
-}
-
-void AP_Win32Dialog_FormatTOC_Layout::_fillGUI()
-{														 	
-	UT_UTF8String sVal, str_loc;
-	UT_String str;
-
-	/* Text Before */
-	sVal = getContainer()->getTOCPropVal("toc-label-before", getContainer()->getDetailsLevel());
-	pt_PieceTable::s_getLocalisedStyleName (sVal.utf8_str(), str_loc);
-	str = AP_Win32App::s_fromUTF8ToWinLocale (str_loc.utf8_str()); 
-
-	SetWindowText (GetDlgItem (getHandle(),
-		AP_RID_DIALOG_FORMATTOC_LAYOUTDETAILS_EDIT_TEXTBEFORE), str.c_str());	
-
-	/* Text After */	
-	sVal = getContainer()->getTOCPropVal("toc-label-after", getContainer()->getDetailsLevel());
-	pt_PieceTable::s_getLocalisedStyleName (sVal.utf8_str(), str_loc);
-	str = AP_Win32App::s_fromUTF8ToWinLocale (str_loc.utf8_str()); 
-
-	SetWindowText (GetDlgItem (getHandle(),
-		AP_RID_DIALOG_FORMATTOC_LAYOUTDETAILS_EDIT_TEXTAFTER), str.c_str());	
-
-	/* Start at */
-	sVal = getContainer()->getTOCPropVal("toc-label-start", getContainer()->getDetailsLevel());
-
-	SetWindowText (GetDlgItem (getHandle(),
-		AP_RID_DIALOG_FORMATTOC_LAYOUTDETAILS_EDIT_STARTAT), sVal.utf8_str());
 
 }
 
-void AP_Win32Dialog_FormatTOC_Layout::_onInitDialog()
-{
-	UT_UTF8String sVal, str_loc;
-	UT_String str;
-	const XAP_StringSet * pSS = getApp()->getStringSet();
-	int i;
-
-	struct control_id_string_id {
-		UT_sint32		controlId;
-		XAP_String_Id	stringId;
-	} static const rgMapping[] =
-	{
-		{AP_RID_DIALOG_FORMATTOC_LAYOUTDETAILS_TEXT_STARTAT,		AP_STRING_ID_DLG_FormatTOC_StartAt},
-		{AP_RID_DIALOG_FORMATTOC_LAYOUTDETAILS_TEXT_TEXTBEFORE,		AP_STRING_ID_DLG_FormatTOC_TextBefore},
-		{AP_RID_DIALOG_FORMATTOC_LAYOUTDETAILS_TEXT_TABSPAGENUM,	AP_STRING_ID_DLG_FormatTOC_DetailsTabPage},
-		{AP_RID_DIALOG_FORMATTOC_LAYOUTDETAILS_TEXT_LABELDEF,		AP_STRING_ID_DLG_FormatTOC_DetailsTop},
-		{AP_RID_DIALOG_FORMATTOC_LAYOUTDETAILS_TEXT_NUMTYPE,		AP_STRING_ID_DLG_FormatTOC_NumberingType},
-		{AP_RID_DIALOG_FORMATTOC_LAYOUTDETAILS_TEXT_TEXTAFTER,		AP_STRING_ID_DLG_FormatTOC_TextAfter},
-		{AP_RID_DIALOG_FORMATTOC_LAYOUTDETAILS_CHECK_INHERITLABEL,	AP_STRING_ID_DLG_FormatTOC_InheritLabel},
-		{AP_RID_DIALOG_FORMATTOC_LAYOUTDETAILS_TEXT_TABLEADER,		AP_STRING_ID_DLG_FormatTOC_TabLeader},
-		{AP_RID_DIALOG_FORMATTOC_LAYOUTDETAILS_TEXT_PAGENUMERING,	AP_STRING_ID_DLG_FormatTOC_PageNumbering},
-		{AP_RID_DIALOG_FORMATTOC_LAYOUTDETAILS_TEXT_IDENT,			AP_STRING_ID_DLG_FormatTOC_Indent},
-		{NULL,NULL}
-	};
-
-	// Localise the controls
-	for (i = 0; i < rgMapping[i].controlId; i++)
-		SetDlgItemText(getHandle(), rgMapping[i].controlId, pSS->getValue(rgMapping[i].stringId));
-
-	/* Spin controls */
-	SendMessage(GetDlgItem(getHandle(),AP_RID_DIALOG_FORMATTOC_LAYOUTDETAILS_SPIN_STARTAT),
-		UDM_SETBUDDY, (WPARAM) GetDlgItem(getHandle(),AP_RID_DIALOG_FORMATTOC_LAYOUTDETAILS_EDIT_STARTAT),0);	
-
-	SendMessage(GetDlgItem(getHandle(),AP_RID_DIALOG_FORMATTOC_LAYOUTDETAILS_SPIN_STARTAT),UDM_SETRANGE,
-		0,(WPARAM)9999);
-
-	SendMessage(GetDlgItem(getHandle(),AP_RID_DIALOG_FORMATTOC_LAYOUTDETAILS_SPIN_IDENT),
-		UDM_SETBUDDY, (WPARAM) GetDlgItem(getHandle(),AP_RID_DIALOG_FORMATTOC_LAYOUTDETAILS_EDIT_IDENT),0);	
-
-	SendMessage(GetDlgItem(getHandle(),AP_RID_DIALOG_FORMATTOC_LAYOUTDETAILS_SPIN_IDENT),UDM_SETRANGE,
-		0,(WPARAM)9999);
-
-	/* Levels */
-	int item;
-	int nID [4] = {AP_STRING_ID_DLG_FormatTOC_Level1, AP_STRING_ID_DLG_FormatTOC_Level2,
-	AP_STRING_ID_DLG_FormatTOC_Level3, AP_STRING_ID_DLG_FormatTOC_Level4};
-	for (i = 0; i < 4; i++)
-	{	
-		item = SendDlgItemMessage(getHandle(), AP_RID_DIALOG_FORMATTOC_LAYOUTDETAILS_COMBO_LEVEL, CB_ADDSTRING, 0, 
-			(LPARAM) pSS->getValue(nID[i]));
-
-		SendDlgItemMessage(getHandle(), AP_RID_DIALOG_FORMATTOC_LAYOUTDETAILS_COMBO_LEVEL, CB_SETITEMDATA, item, i+1);
-	}	 
-
-	SendDlgItemMessage(getHandle(), AP_RID_DIALOG_FORMATTOC_LAYOUTDETAILS_COMBO_LEVEL, CB_SETCURSEL, 0, 0);	
-	
 
-	/* Now the Page Numbering style */
-	const UT_GenericVector<const gchar*> * vecTypeList = AP_Dialog_FormatFootnotes::getFootnoteTypeLabelList();
-	const UT_GenericVector<const gchar*> * vecPropList = getContainer()->getVecLabelPropValue();
-	UT_sint32 nTypes = vecTypeList->getItemCount();
-	UT_UTF8String * sProp = NULL;	
-	UT_UTF8String  val;
-	int j;
-	
-	sProp = new UT_UTF8String("toc-page-type");		
-	for (j=0; j< nTypes; j++)
-	{
-		const char * szVal = static_cast<const char *>(vecTypeList->getNthItem(j));
-		item = SendDlgItemMessage(getHandle(), AP_RID_DIALOG_FORMATTOC_LAYOUTDETAILS_COMBO_NUMTYPE, 
-			CB_ADDSTRING, 0, (LPARAM) szVal);
-			
-		item = SendDlgItemMessage(getHandle(), AP_RID_DIALOG_FORMATTOC_LAYOUTDETAILS_COMBO_PAGENUMERING, 
-			CB_ADDSTRING, 0, (LPARAM) szVal);
-	}	
-	
-	/*FV_View * pView = static_cast<FV_View *>(getContainer()->getActiveFrame()->getCurrentView());
-	val = getContainer()->getTOCPropVal("toc-page-type", getContainer()->getDetailsLevel());	
-	UT_sint32 iHist = static_cast<UT_sint32>(pView->getLayout()->FootnoteTypeFromString(val.utf8_str()));
+void AP_Win32Dialog_FormatTOC::setDetailsLevel(UT_sint32 iLevel)
+{
 		
-	SendDlgItemMessage(getHandle(), AP_RID_DIALOG_FORMATTOC_LAYOUTDETAILS_COMBO_NUMTYPE, CB_SETCURSEL, iHist, 0);	*/
-
-	/* Tab Type styles */
-	const UT_GenericVector<const gchar*> * vecLabels = getContainer()->getVecTABLeadersLabel();
-	const UT_GenericVector<const gchar*> * vecProps = getContainer()->getVecTABLeadersProp();
-	nTypes = vecLabels->getItemCount();
-	sProp = NULL;	
-	sProp = new UT_UTF8String("toc-tab-leader");	
-	for(j=0; j< nTypes; j++)
-	{
-		const char * szLab = static_cast<const char *>(vecLabels->getNthItem(j));
-		UT_DEBUGMSG(("Got label %s for item %d \n",szLab,j));		
-
-		item = SendDlgItemMessage(getHandle(), AP_RID_DIALOG_FORMATTOC_LAYOUTDETAILS_COMBO_TABLEADER, 
-			CB_ADDSTRING, 0, (LPARAM) szLab);
-	}
-	
-	SendDlgItemMessage(getHandle(), AP_RID_DIALOG_FORMATTOC_LAYOUTDETAILS_COMBO_TABLEADER, 
-			CB_SETCURSEL, 0, 0);	
-
-	loadCtrlsValuesForDetailsLevel ();	
-
-}
-
 
-void AP_Win32Dialog_FormatTOC_Layout::_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
-{
-	WORD wNotifyCode = HIWORD(wParam);
-	WORD wId = LOWORD(wParam);
-	HWND hWndCtrl = (HWND)lParam;
-	AP_Win32Dialog_FormatTOC_Layout* pParent=  (AP_Win32Dialog_FormatTOC_Layout*)getContainer();	
-	
-	
-	switch (wId)
-	{		
-		case AP_RID_DIALOG_FORMATTOC_LAYOUTDETAILS_COMBO_LEVEL:
-		{
-			if (wNotifyCode == CBN_SELCHANGE)
-			{
-				int nSelected, nLevel;
-				HWND hCombo = GetDlgItem(hWnd, AP_RID_DIALOG_FORMATTOC_LAYOUTDETAILS_COMBO_LEVEL);
-
-				nSelected = SendMessage(hCombo, CB_GETCURSEL, 0, 0);					
-
-				if (nSelected!=CB_ERR) 
-				{					
-					saveCtrlsValuesForDetailsLevel (); // Save current level settings
-
-					nLevel = SendMessage(hCombo, CB_GETITEMDATA, nSelected, 0);
-					getContainer()->setDetailsLevel (nLevel);
-				}
-			}
-
-			break;			
-		}					
-		default:
-			break;
-	}
-}
-
-// Spin control notification
-void AP_Win32Dialog_FormatTOC_Layout::_onNotify(LPNMHDR pNMHDR, int iCtrlID)
-{
-
-	if (pNMHDR->code != UDN_DELTAPOS)
-			return;	
-
-	NMUPDOWN* up = (NMUPDOWN* ) pNMHDR;
-	
-	/* Start at*/
-	UT_sint32 iNew = up->iPos + up->iDelta;
-	bool bInc = true;
-	if(iNew != getContainer()->m_iStartValue)
-	{	
-		UT_UTF8String sVal;
-
-		if(iNew < getContainer()->m_iStartValue)
-			bInc = false;
-		
-		getContainer()->m_iStartValue = iNew;
-		getContainer()->incrementStartAt(getContainer()->getDetailsLevel(),bInc);
-		sVal = getContainer()->getTOCPropVal("toc-label-start",getContainer()->getDetailsLevel());
-		SetWindowText (GetDlgItem (getHandle(),
-			AP_RID_DIALOG_FORMATTOC_LAYOUTDETAILS_EDIT_STARTAT), sVal.utf8_str());
-	}
-
-}
-
-void AP_Win32Dialog_FormatTOC_Layout::loadCtrlsValuesForDetailsLevel ()
-{
-	UT_UTF8String sVal, str_loc;
-	UT_String str;	
-	UT_sint32 iHist;
-
-	FV_View * pView = static_cast<FV_View *>(getContainer()->getActiveFrame()->getCurrentView());
-	sVal = getContainer()->getTOCPropVal("toc-page-type", getContainer()->getDetailsLevel());
-	iHist = static_cast<UT_sint32>(pView->getLayout()->FootnoteTypeFromString(sVal.utf8_str()));
-	SendDlgItemMessage(getHandle(), AP_RID_DIALOG_FORMATTOC_LAYOUTDETAILS_COMBO_NUMTYPE, 
-			CB_SETCURSEL, iHist, 0);
-
-	/* Text Before */
-	sVal = getContainer()->getTOCPropVal("toc-label-before", getContainer()->getDetailsLevel());
-	pt_PieceTable::s_getLocalisedStyleName (sVal.utf8_str(), str_loc);
-	str = AP_Win32App::s_fromUTF8ToWinLocale (str_loc.utf8_str()); 
-
-	SetWindowText (GetDlgItem (getHandle(),
-		AP_RID_DIALOG_FORMATTOC_LAYOUTDETAILS_EDIT_TEXTBEFORE), str.c_str());	
-
-	/* Text After */	
-	sVal = getContainer()->getTOCPropVal("toc-label-after", getContainer()->getDetailsLevel());
-	pt_PieceTable::s_getLocalisedStyleName (sVal.utf8_str(), str_loc);
-	str = AP_Win32App::s_fromUTF8ToWinLocale (str_loc.utf8_str()); 
-
-	SetWindowText (GetDlgItem (getHandle(),
-		AP_RID_DIALOG_FORMATTOC_LAYOUTDETAILS_EDIT_TEXTAFTER), str.c_str());	
-
-}
-
-void AP_Win32Dialog_FormatTOC_Layout::saveCtrlsValuesForDetailsLevel ()
-{
-		
-	UT_UTF8String sProp, sVal;
-	UT_String sNum;
-	char szText[1024];
-	int nSelected;
-
-	
-	/* Text Before */
-	GetWindowText(GetDlgItem (getHandle(),
-		AP_RID_DIALOG_FORMATTOC_LAYOUTDETAILS_EDIT_TEXTBEFORE), szText, 1024);
-
-	sVal = AP_Win32App::s_fromWinLocaleToUTF8 (szText);	
-	
-	sNum =  UT_String_sprintf("%d",getContainer()->getDetailsLevel());	
-	sProp = "toc-label-before";
-	sProp += sNum.c_str();
-	getContainer()->setTOCProperty(sProp, sVal);
-
-	/* Text After */
-	GetWindowText(GetDlgItem (getHandle(),
-		AP_RID_DIALOG_FORMATTOC_LAYOUTDETAILS_EDIT_TEXTAFTER), szText, 1024);
-
-	sVal = AP_Win32App::s_fromWinLocaleToUTF8 (szText);	
-	sProp = "toc-label-after";
-	sProp += sNum.c_str();
-	getContainer()->setTOCProperty(sProp, sVal);
-
-	/* Numering type */
-	HWND hCombo = GetDlgItem(getHandle(), AP_RID_DIALOG_FORMATTOC_LAYOUTDETAILS_COMBO_NUMTYPE);
-	nSelected = SendMessage(hCombo, CB_GETCURSEL, 0, 0);					
-
-	if (nSelected!=CB_ERR) 
-	{	
-		UT_String sNum;		
-
-		const UT_GenericVector<const gchar*> * vecPropList = getContainer()->getVecLabelPropValue();
-		const char * szVal = static_cast<const char *>(vecPropList->getNthItem(nSelected));
-		sProp = static_cast<char *> ("toc-page-type");
-		sVal = static_cast<const char *> (szVal);
-		
-		sNum = UT_String_sprintf("%d",getContainer()->getDetailsLevel());
-		sProp += sNum.c_str();
-		getContainer()->setTOCProperty(sProp,sVal);				
-		
-	}
-
-
-}
 
-void AP_Win32Dialog_FormatTOC_Layout::_onApply()
-{
-
-	saveCtrlsValuesForDetailsLevel ();	
-	getContainer()->Apply(); /* Apply */
-	
-}
-
-
-void AP_Win32Dialog_FormatTOC_Layout::_onOK()
-{
-	_onApply();
-}
+}
Index: src/wp/ap/win/ap_Win32Dialog_FormatTOC.h
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Dialog_FormatTOC.h,v
retrieving revision 1.11
diff -u -r1.11 ap_Win32Dialog_FormatTOC.h
--- src/wp/ap/win/ap_Win32Dialog_FormatTOC.h	12 Mar 2007 12:05:33 -0000	1.11
+++ src/wp/ap/win/ap_Win32Dialog_FormatTOC.h	9 Apr 2007 08:37:46 -0000
@@ -23,106 +23,33 @@
 #include "ap_Dialog_FormatTOC.h"
 #include "xap_Win32PropertySheet.h"
 
-class XAP_Win32Frame;
-class AP_Win32Dialog_FormatTOC_General;
+class XAP_Win32Frame;
+class AP_Win32Dialog_FormatTOC_General;
 class AP_Win32Dialog_FormatTOC_Sheet;
 class AP_Win32Dialog_FormatTOC_Layout;
-
-class AP_Win32Dialog_FormatTOC: public AP_Dialog_FormatTOC
-{
-public:
-	AP_Win32Dialog_FormatTOC(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id);
-	virtual ~AP_Win32Dialog_FormatTOC(void);
-	virtual void			runModeless(XAP_Frame * pFrame);
-
-	static XAP_Dialog *		static_constructor(XAP_DialogFactory *, XAP_Dialog_Id id);
-	virtual void            notifyActiveFrame(XAP_Frame * pFrame);
-	virtual void            setTOCPropsInGUI(void);	
-    virtual void            setSensitivity(bool bSensitive);
-	virtual void            destroy(void);
+
+class AP_Win32Dialog_FormatTOC: public AP_Dialog_FormatTOC
+{
+public:
+	AP_Win32Dialog_FormatTOC(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id);
+	virtual ~AP_Win32Dialog_FormatTOC(void);
+	virtual void			runModeless(XAP_Frame * pFrame);
+
+	static XAP_Dialog *		static_constructor(XAP_DialogFactory *, XAP_Dialog_Id id);
+	virtual void            notifyActiveFrame(XAP_Frame * pFrame);
+	virtual void            setTOCPropsInGUI(void);	
+    virtual void            setSensitivity(bool bSensitive);
+	virtual void            destroy(void);
 	virtual void            activate(void);	
 	void 					setStyle(HWND hWnd, int nCtrlID);
-	void 					setMainLevel(UT_sint32 iLevel);
-	void					setDetailsLevel(UT_sint32 iLevel);
-	UT_sint32				m_iStartValue;
-
-private:
-
-	AP_Win32Dialog_FormatTOC_Sheet* 	m_pSheet;
-	AP_Win32Dialog_FormatTOC_General*	m_pGeneral;
-	AP_Win32Dialog_FormatTOC_Layout*	m_pLayout;
-	
-
-};
-
-class AP_Win32Dialog_FormatTOC_Sheet : public XAP_Win32PropertySheet
-{
-
-public:
-
-	AP_Win32Dialog_FormatTOC_Sheet();
-
-	void						setContainer(AP_Win32Dialog_FormatTOC*	pData){m_pData=pData;};
-	AP_Win32Dialog_FormatTOC*	getContainer(){return m_pData;};
-	static int CALLBACK			s_sheetInit(HWND hwnd,  UINT uMsg,  LPARAM lParam);
-	void						_onInitDialog(HWND hwnd);
-	virtual void				cleanup(void);
-	virtual	void				_onOK();
-
-private:
-
-	AP_Win32Dialog_FormatTOC*			m_pData;
-
-};
+	void 					setMainLevel(UT_sint32 iLevel);
+	void					setDetailsLevel(UT_sint32 iLevel);
+	UT_sint32				m_iStartValue;
 
-class AP_Win32Dialog_FormatTOC_General: public XAP_Win32PropertyPage
-{	
-public:		
-
-	AP_Win32Dialog_FormatTOC_General();
-	~AP_Win32Dialog_FormatTOC_General();	
-
-	void						setContainer(AP_Win32Dialog_FormatTOC*	pData){m_pData=pData;};
-	AP_Win32Dialog_FormatTOC*	getContainer(){return m_pData;};	
-	void						_fillGUI(void);
-	virtual void				_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);	
-private:
-
-	virtual	void				_onInitDialog();
-	virtual	void				_onApply(); 
-	virtual	void				_onOK(); 
-	
-	AP_Win32Dialog_FormatTOC*			m_pData;		
-	
-};
 
-class AP_Win32Dialog_FormatTOC_Layout: public XAP_Win32PropertyPage
-{	
-public:		
-
-	AP_Win32Dialog_FormatTOC_Layout();
-	~AP_Win32Dialog_FormatTOC_Layout();	
-
-	void						setContainer(AP_Win32Dialog_FormatTOC*	pData){m_pData=pData;};
-	AP_Win32Dialog_FormatTOC*	getContainer(){return m_pData;};	
-	void						_fillGUI(void);
-	virtual void				_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);
-	virtual void				_onNotify(LPNMHDR hdr, int iCtrlID);
-	void						saveCtrlsValuesForDetailsLevel ();	
-	void						loadCtrlsValuesForDetailsLevel ();
-	
-private:
-
-	virtual	void				_onInitDialog();
-	virtual	void				_onApply(); 
-	virtual	void				_onOK(); 
-	void						getCtrlsValues ();
-	
-	AP_Win32Dialog_FormatTOC*			m_pData;		
-	
-};
 
 
+};
 
 
 
Index: src/wp/ap/win/ap_Win32Dialog_FormatTable.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Dialog_FormatTable.cpp,v
retrieving revision 1.17
diff -u -r1.17 ap_Win32Dialog_FormatTable.cpp
--- src/wp/ap/win/ap_Win32Dialog_FormatTable.cpp	16 Jan 2007 23:16:26 -0000	1.17
+++ src/wp/ap/win/ap_Win32Dialog_FormatTable.cpp	9 Apr 2007 08:37:47 -0000
@@ -42,8 +42,6 @@
 	
 
 
-#define GWL(hwnd)		(AP_Win32Dialog_FormatTable*)GetWindowLong((hwnd), DWL_USER)
-#define SWL(hwnd, d)	(AP_Win32Dialog_FormatTable*)SetWindowLong((hwnd), DWL_USER,(LONG)(d))
 
 XAP_Dialog * AP_Win32Dialog_FormatTable::static_constructor(XAP_DialogFactory * pFactory,
 													       XAP_Dialog_Id id)
@@ -79,68 +77,36 @@
 
 void AP_Win32Dialog_FormatTable::runModeless(XAP_Frame * pFrame)
 {
-	UT_return_if_fail (pFrame);		
+	UT_return_if_fail (pFrame);
+	UT_return_if_fail (m_id == AP_DIALOG_ID_FORMAT_TABLE);
 	
-	XAP_Win32App * pWin32App = static_cast<XAP_Win32App *>(m_pApp);
-	LPCTSTR lpTemplate = NULL;
+	createModeless(pFrame, MAKEINTRESOURCE(AP_RID_DIALOG_FORMATTABLE));
 	
-	UT_return_if_fail (m_id == AP_DIALOG_ID_FORMAT_TABLE);	
-
-	lpTemplate = MAKEINTRESOURCE(AP_RID_DIALOG_FORMATTABLE);
-	
-	HWND hResult = CreateDialogParam(pWin32App->getInstance(),lpTemplate,
-							static_cast<XAP_Win32FrameImpl*>(pFrame->getFrameImpl())->getTopLevelWindow(),
-							(DLGPROC)s_dlgProc,(LPARAM)this);
-							
-	m_hwndDlg = hResult;										
-
 	// Save dialog the ID number and pointer to the widget
 	UT_sint32 sid =(UT_sint32)  getDialogId();
-	m_pApp->rememberModelessId( sid, (XAP_Dialog_Modeless *) m_pDialog);
-
-	ShowWindow(m_hwndDlg, SW_SHOW);
-	BringWindowToTop(m_hwndDlg);	
-		
+	m_pApp->rememberModelessId( sid, (XAP_Dialog_Modeless *) m_pDialog);		
 }
 
-BOOL CALLBACK AP_Win32Dialog_FormatTable::s_dlgProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
-{		
-	AP_Win32Dialog_FormatTable * pThis;
-	
-	switch (msg)
-	{
-	case WM_INITDIALOG:
-		pThis = (AP_Win32Dialog_FormatTable *)lParam;
-		SWL(hWnd,lParam);		
-		return pThis->_onInitDialog(hWnd,wParam,lParam);
-	
-	case WM_DRAWITEM:	
-	{
-		pThis = GWL(hWnd);
+BOOL AP_Win32Dialog_FormatTable::_onDlgMessage(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{	
+	if (msg == WM_DRAWITEM)
+	{		
 		DRAWITEMSTRUCT* dis =  (DRAWITEMSTRUCT*)lParam;
 		
-		if (dis->CtlID==AP_RID_DIALOG_FORMATTABLE_BTN_BACKCOLOR)		
-			pThis->m_backgButton.draw(dis);			
+		if (dis->CtlID==AP_RID_DIALOG_FORMATTABLE_BTN_BACKCOLOR)
+			m_backgButton.draw(dis);
 			
-		if (dis->CtlID==AP_RID_DIALOG_FORMATTABLE_BTN_BORDERCOLOR)							    
-			pThis->m_borderButton.draw(dis);			
+		if (dis->CtlID==AP_RID_DIALOG_FORMATTABLE_BTN_BORDERCOLOR)
+			m_borderButton.draw(dis);
 			
-		return TRUE;		
-	}
-
-	case WM_DESTROY:
-	{
-		pThis = GWL(hWnd);
-		pThis->finalize();		
-		return 0;
-	}
+		return TRUE;
 		
-	case WM_COMMAND:
-		pThis = GWL(hWnd);
-		return pThis->_onCommand(hWnd,wParam,lParam);
-	default:
-		return 0;
+	} else if (msg == WM_DESTROY) {
+		finalize();
+		return FALSE;
 	}
+		
+	return FALSE;
 }
 
 HBITMAP AP_Win32Dialog_FormatTable::_loadBitmap(HWND hWnd, UINT nId, char* pName, int x, int y, UT_RGBColor color)
@@ -152,8 +118,8 @@
 	return hBitmap; 
 }
 
-#define _DS(c,s)	SetDlgItemText(hWnd,AP_RID_DIALOG_##c,pSS->getValue(AP_STRING_ID_##s))
-#define _DSX(c,s)	SetDlgItemText(hWnd,AP_RID_DIALOG_##c,pSS->getValue(XAP_STRING_ID_##s))
+#define _DS(c,s)	setDlgItemText(AP_RID_DIALOG_##c,pSS->getValue(AP_STRING_ID_##s))
+#define _DSX(c,s)	setDlgItemText(AP_RID_DIALOG_##c,pSS->getValue(XAP_STRING_ID_##s))
 
 // This handles the WM_INITDIALOG message for the top-level dialog.
 BOOL AP_Win32Dialog_FormatTable::_onInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam)
@@ -187,9 +153,7 @@
 	_DS(FORMATTABLE_TEXT_THICKNESS,		DLG_FormatTable_Thickness);
 	_DS(FORMATTABLE_TEXT_IMGBACK,		DLG_FormatTable_SetImageBackground);
 
-	
-	SetWindowText(hWnd, pSS->getValue(AP_STRING_ID_DLG_FormatTableTitle));	
-	
+	setDialogTitle(pSS->getValue(AP_STRING_ID_DLG_FormatTableTitle));
 	
 	/* Load the bitmaps into the dialog box */								
     m_hBitmapBottom = _loadBitmap(hWnd,AP_RID_DIALOG_FORMATTABLE_BMP_BOTTOM, "FT_LINEBOTTOM",  x, y, Color);
@@ -206,50 +170,42 @@
 	m_pPreviewWidget->getGraphics()->init3dColors();
 	m_pPreviewWidget->getWindowSize(&w,&h);
 	_createPreviewFromGC(m_pPreviewWidget->getGraphics(), w, h);	
-	m_pPreviewWidget->setPreview(m_pFormatTablePreview); 
-	
+	m_pPreviewWidget->setPreview(m_pFormatTablePreview); 	
 								
 	startUpdater();
 	setAllSensitivities();
 
 	/* Default status for the push bottons*/
-	CheckDlgButton(m_hwndDlg, AP_RID_DIALOG_FORMATTABLE_BMP_TOP, getTopToggled() ? BST_CHECKED: BST_UNCHECKED);
-	CheckDlgButton(m_hwndDlg, AP_RID_DIALOG_FORMATTABLE_BMP_BOTTOM, getBottomToggled() ? BST_CHECKED: BST_UNCHECKED);
-	CheckDlgButton(m_hwndDlg, AP_RID_DIALOG_FORMATTABLE_BMP_RIGHT, getRightToggled() ? BST_CHECKED: BST_UNCHECKED);
-	CheckDlgButton(m_hwndDlg, AP_RID_DIALOG_FORMATTABLE_BMP_LEFT, getLeftToggled() ? BST_CHECKED: BST_UNCHECKED);
-
-	/* Combo Values for Applyto*/
-	HWND hCombo = GetDlgItem(hWnd, AP_RID_DIALOG_FORMATTABLE_COMBO_APPLYTO);
-
-	nItem = SendMessage(hCombo, CB_ADDSTRING, 0, (WPARAM) pSS->getValue(AP_STRING_ID_DLG_FormatTable_Apply_To_Selection));    			
-	SendMessage(hCombo, CB_SETITEMDATA, nItem, FORMAT_TABLE_SELECTION);
-
-	nItem = SendMessage(hCombo, CB_ADDSTRING, 0, (WPARAM) pSS->getValue(AP_STRING_ID_DLG_FormatTable_Apply_To_Row));    			
-	SendMessage(hCombo, CB_SETITEMDATA, nItem, FORMAT_TABLE_ROW);
-
-	nItem = SendMessage(hCombo, CB_ADDSTRING, 0, (WPARAM) pSS->getValue(AP_STRING_ID_DLG_FormatTable_Apply_To_Column));    			
-	SendMessage(hCombo, CB_SETITEMDATA, nItem, FORMAT_TABLE_COLUMN);
-
-	nItem = SendMessage(hCombo, CB_ADDSTRING, 0, (WPARAM) pSS->getValue(AP_STRING_ID_DLG_FormatTable_Apply_To_Table));    			
-	SendMessage(hCombo, CB_SETITEMDATA, nItem, FORMAT_TABLE_TABLE);
+	CheckDlgButton(m_hDlg, AP_RID_DIALOG_FORMATTABLE_BMP_TOP, getTopToggled() ? BST_CHECKED: BST_UNCHECKED);
+	CheckDlgButton(m_hDlg, AP_RID_DIALOG_FORMATTABLE_BMP_BOTTOM, getBottomToggled() ? BST_CHECKED: BST_UNCHECKED);
+	CheckDlgButton(m_hDlg, AP_RID_DIALOG_FORMATTABLE_BMP_RIGHT, getRightToggled() ? BST_CHECKED: BST_UNCHECKED);
+	CheckDlgButton(m_hDlg, AP_RID_DIALOG_FORMATTABLE_BMP_LEFT, getLeftToggled() ? BST_CHECKED: BST_UNCHECKED);
+
+	/* Combo Values for Applyto*/	
+	nItem = addItemToCombo (AP_RID_DIALOG_FORMATTABLE_COMBO_APPLYTO, pSS->getValue(AP_STRING_ID_DLG_FormatTable_Apply_To_Selection));
+	setComboDataItem (AP_RID_DIALOG_FORMATTABLE_COMBO_APPLYTO, nItem, FORMAT_TABLE_SELECTION);
+	
+	nItem = addItemToCombo (AP_RID_DIALOG_FORMATTABLE_COMBO_APPLYTO, pSS->getValue(AP_STRING_ID_DLG_FormatTable_Apply_To_Row));
+	setComboDataItem (AP_RID_DIALOG_FORMATTABLE_COMBO_APPLYTO, nItem, FORMAT_TABLE_ROW);
+	
+	nItem = addItemToCombo (AP_RID_DIALOG_FORMATTABLE_COMBO_APPLYTO, pSS->getValue(AP_STRING_ID_DLG_FormatTable_Apply_To_Column));
+	setComboDataItem (AP_RID_DIALOG_FORMATTABLE_COMBO_APPLYTO, nItem, FORMAT_TABLE_COLUMN);
+	
+	nItem = addItemToCombo (AP_RID_DIALOG_FORMATTABLE_COMBO_APPLYTO, pSS->getValue(AP_STRING_ID_DLG_FormatTable_Apply_To_Table));
+	setComboDataItem (AP_RID_DIALOG_FORMATTABLE_COMBO_APPLYTO, nItem, FORMAT_TABLE_TABLE);
 			
-	SendMessage(hCombo, CB_SETCURSEL, 0, 0);    			
+	selectComboItem (AP_RID_DIALOG_FORMATTABLE_COMBO_APPLYTO, 0);
 
-	/* Combo Values for Thickness */
-	hCombo = GetDlgItem(hWnd, AP_RID_DIALOG_FORMATTABLE_COMBO_THICKNESS);
-	
-	for(i=0; i < FORMAT_TABLE_NUMTHICKNESS ;i++)
-		SendMessage(hCombo, CB_ADDSTRING, 0, (WPARAM) sThicknessTable[i]);
-
-	SendMessage(hCombo, CB_SETCURSEL, 0, 0);
+	/* Combo Values for Thickness */	
+	for(i=0; i < FORMAT_TABLE_NUMTHICKNESS ;i++)
+		addItemToCombo (AP_RID_DIALOG_FORMATTABLE_COMBO_THICKNESS, sThicknessTable[i]);
 
+	selectComboItem (AP_RID_DIALOG_FORMATTABLE_COMBO_THICKNESS, 0);
 
-
-	XAP_Win32DialogHelper::s_centerDialog(hWnd);			
-	return 1; 
+	centerDialog();
+	return 1;
 }
 
-
 BOOL AP_Win32Dialog_FormatTable::_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
 	WORD wNotifyCode = HIWORD(wParam);
@@ -261,7 +217,7 @@
 		case AP_RID_DIALOG_FORMATTABLE_BMP_BOTTOM:		
 		{
 			bool bChecked;			
-			bChecked = (bool)(IsDlgButtonChecked(m_hwndDlg, AP_RID_DIALOG_FORMATTABLE_BMP_BOTTOM)==BST_CHECKED);							
+			bChecked = (bool)(IsDlgButtonChecked(m_hDlg, AP_RID_DIALOG_FORMATTABLE_BMP_BOTTOM)==BST_CHECKED);							
 			toggleLineType(AP_Dialog_FormatTable::toggle_bottom, bChecked);				
 			event_previewExposed();			
 			return 1;
@@ -270,7 +226,7 @@
 		case AP_RID_DIALOG_FORMATTABLE_BMP_TOP:		
 		{
 			bool bChecked;			
-			bChecked = (bool)(IsDlgButtonChecked(m_hwndDlg, AP_RID_DIALOG_FORMATTABLE_BMP_TOP)==BST_CHECKED);							
+			bChecked = (bool)(IsDlgButtonChecked(m_hDlg, AP_RID_DIALOG_FORMATTABLE_BMP_TOP)==BST_CHECKED);							
 			toggleLineType(AP_Dialog_FormatTable::toggle_top, bChecked);				
 			event_previewExposed();			
 			return 1;
@@ -279,7 +235,7 @@
 		case AP_RID_DIALOG_FORMATTABLE_BMP_RIGHT:		
 		{
 			bool bChecked;			
-			bChecked = (bool)(IsDlgButtonChecked(m_hwndDlg, AP_RID_DIALOG_FORMATTABLE_BMP_RIGHT)==BST_CHECKED);							
+			bChecked = (bool)(IsDlgButtonChecked(m_hDlg, AP_RID_DIALOG_FORMATTABLE_BMP_RIGHT)==BST_CHECKED);							
 			toggleLineType(AP_Dialog_FormatTable::toggle_right, bChecked);				
 			event_previewExposed();			
 			return 1;
@@ -288,7 +244,7 @@
 		case AP_RID_DIALOG_FORMATTABLE_BMP_LEFT:		
 		{
 			bool bChecked;			
-			bChecked = (bool)(IsDlgButtonChecked(m_hwndDlg, AP_RID_DIALOG_FORMATTABLE_BMP_LEFT)==BST_CHECKED);							
+			bChecked = (bool)(IsDlgButtonChecked(m_hDlg, AP_RID_DIALOG_FORMATTABLE_BMP_LEFT)==BST_CHECKED);							
 			toggleLineType(AP_Dialog_FormatTable::toggle_left, bChecked);				
 			event_previewExposed();			
 			return 1;
@@ -303,7 +259,7 @@
 			/* Initialize CHOOSECOLOR */
 			ZeroMemory(&cc, sizeof(CHOOSECOLOR));
 			cc.lStructSize = sizeof(CHOOSECOLOR);
-			cc.hwndOwner = m_hwndDlg;
+			cc.hwndOwner = m_hDlg;
 			cc.lpCustColors = (LPDWORD) acrCustClr;
 			cc.rgbResult = 0;
 			cc.Flags = CC_FULLOPEN | CC_RGBINIT;
@@ -330,7 +286,7 @@
 			/* Initialize CHOOSECOLOR */
 			ZeroMemory(&cc, sizeof(CHOOSECOLOR));
 			cc.lStructSize = sizeof(CHOOSECOLOR);
-			cc.hwndOwner = m_hwndDlg;
+			cc.hwndOwner = m_hDlg;
 			cc.lpCustColors = (LPDWORD) acrCustClr2;
 			cc.rgbResult = 0;
 			cc.Flags = CC_FULLOPEN | CC_RGBINIT;
@@ -352,26 +308,21 @@
 		{
 			if (wNotifyCode == CBN_SELCHANGE)                       
 			{
-				int nSelected;
-				HWND hCombo = GetDlgItem(hWnd, AP_RID_DIALOG_FORMATTABLE_COMBO_THICKNESS);
-				nSelected = SendMessage(hCombo, CB_GETCURSEL, 0, 0);				
-
+				int nSelected = getComboSelectedIndex (AP_RID_DIALOG_FORMATTABLE_COMBO_THICKNESS);
+								
 				if (nSelected != CB_ERR)
 				{
-					char szThickness[1024];
-					UT_UTF8String sThicknessTable;
-
-					SendMessage(hCombo, CB_GETLBTEXT, nSelected, (LPARAM)szThickness);
-					sThicknessTable = szThickness;
-					setBorderThickness(sThicknessTable);
+					UT_Win32LocaleString thickness;
+					getComboTextItem(AP_RID_DIALOG_FORMATTABLE_COMBO_THICKNESS, nSelected, thickness);					
+					
+					setBorderThickness((UT_UTF8String &)thickness.utf8_str());
 					/*Force redraw*/
 					InvalidateRect(GetDlgItem(hWnd, AP_RID_DIALOG_FORMATTABLE_BTN_BACKCOLOR), NULL, FALSE);
-					event_previewExposed();	
+					event_previewExposed();
 				}
 			}
 			return 1;
-		}
-
+		}
 		
 		case AP_RID_DIALOG_FORMATTABLE_BTN_CANCEL:			
 			m_answer = AP_Dialog_FormatTable::a_CLOSE;
@@ -423,7 +374,7 @@
 {
 	m_backgButton.setColour(RGB(clr.m_red,clr.m_grn,clr.m_blu));
 	/* force redraw */
-	InvalidateRect(GetDlgItem(m_hwndDlg, AP_RID_DIALOG_FORMATTABLE_BTN_BACKCOLOR), NULL, FALSE);
+	InvalidateRect(GetDlgItem(m_hDlg, AP_RID_DIALOG_FORMATTABLE_BTN_BACKCOLOR), NULL, FALSE);
 }
 
 void AP_Win32Dialog_FormatTable::setBorderThicknessInGUI(UT_UTF8String & sThick)
@@ -434,16 +385,16 @@
 
 void AP_Win32Dialog_FormatTable::setSensitivity(bool bSens)
 {
-	CheckDlgButton(m_hwndDlg, AP_RID_DIALOG_FORMATTABLE_BMP_TOP, getTopToggled() ? BST_CHECKED: BST_UNCHECKED);
-	CheckDlgButton(m_hwndDlg, AP_RID_DIALOG_FORMATTABLE_BMP_BOTTOM, getBottomToggled() ? BST_CHECKED: BST_UNCHECKED);
-	CheckDlgButton(m_hwndDlg, AP_RID_DIALOG_FORMATTABLE_BMP_RIGHT, getRightToggled() ? BST_CHECKED: BST_UNCHECKED);
-	CheckDlgButton(m_hwndDlg, AP_RID_DIALOG_FORMATTABLE_BMP_LEFT, getLeftToggled() ? BST_CHECKED: BST_UNCHECKED);	
+	CheckDlgButton(m_hDlg, AP_RID_DIALOG_FORMATTABLE_BMP_TOP, getTopToggled() ? BST_CHECKED: BST_UNCHECKED);
+	CheckDlgButton(m_hDlg, AP_RID_DIALOG_FORMATTABLE_BMP_BOTTOM, getBottomToggled() ? BST_CHECKED: BST_UNCHECKED);
+	CheckDlgButton(m_hDlg, AP_RID_DIALOG_FORMATTABLE_BMP_RIGHT, getRightToggled() ? BST_CHECKED: BST_UNCHECKED);
+	CheckDlgButton(m_hDlg, AP_RID_DIALOG_FORMATTABLE_BMP_LEFT, getLeftToggled() ? BST_CHECKED: BST_UNCHECKED);	
 }
 
 void AP_Win32Dialog_FormatTable::destroy(void) 
 {
 	finalize();	
-	DestroyWindow(m_hwndDlg);	
+	DestroyWindow(m_hDlg);	
 }
 
 
@@ -452,23 +403,24 @@
 	ConstructWindowName();
 	setAllSensitivities();	
 	
-	ShowWindow( m_hwndDlg, SW_SHOW );
-	BringWindowToTop( m_hwndDlg );
+	showWindow(SW_SHOW);
+	bringWindowToTop();
 	
 }
 
+
 void AP_Win32Dialog_FormatTable::notifyActiveFrame(XAP_Frame *pFrame)
 { 	
 	setAllSensitivities();
 	
-	if((HWND)GetWindowLong(m_hwndDlg, GWL_HWNDPARENT) != static_cast<XAP_Win32FrameImpl*>(pFrame->getFrameImpl())->getTopLevelWindow())
+	if((HWND)GetWindowLong(m_hDlg, GWL_HWNDPARENT) != static_cast<XAP_Win32FrameImpl*>(pFrame->getFrameImpl())->getTopLevelWindow())
 	{
 		// Update the caption
 		ConstructWindowName();
-		SetWindowText(m_hwndDlg, m_WindowName);
+		setDialogTitle(m_WindowName);
 
-		SetWindowLong(m_hwndDlg, GWL_HWNDPARENT, (long)static_cast<XAP_Win32FrameImpl*>(pFrame->getFrameImpl())->getTopLevelWindow());
-		SetWindowPos(m_hwndDlg, NULL, 0, 0, 0, 0,
+		SetWindowLong(m_hDlg, GWL_HWNDPARENT, (long)static_cast<XAP_Win32FrameImpl*>(pFrame->getFrameImpl())->getTopLevelWindow());
+		SetWindowPos(m_hDlg, NULL, 0, 0, 0, 0,
 						SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
 
 	}
Index: src/wp/ap/win/ap_Win32Dialog_FormatTable.h
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Dialog_FormatTable.h,v
retrieving revision 1.14
diff -u -r1.14 ap_Win32Dialog_FormatTable.h
--- src/wp/ap/win/ap_Win32Dialog_FormatTable.h	16 Jan 2007 23:16:26 -0000	1.14
+++ src/wp/ap/win/ap_Win32Dialog_FormatTable.h	9 Apr 2007 08:37:47 -0000
@@ -25,10 +25,11 @@
 #include "xap_Win32PreviewWidget.h"
 #include "gr_Win32Graphics.h"
 #include "xap_Win32ColourButton.h"
+#include "xap_Win32DialogBase.h"
 
 /*****************************************************************/
 
-class AP_Win32Dialog_FormatTable: public AP_Dialog_FormatTable
+class AP_Win32Dialog_FormatTable: public AP_Dialog_FormatTable, public XAP_Win32DialogBase
 {
 public:
 	AP_Win32Dialog_FormatTable(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id);
@@ -49,12 +50,11 @@
 	
 	HBITMAP 				_loadBitmap(HWND hWnd,UINT nId, char* pName, int x, int y, UT_RGBColor Color);
 	virtual BOOL			_onInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam);
-	virtual BOOL 			_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);
-	static BOOL CALLBACK	s_dlgProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam);
-	
+	virtual BOOL 			_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);	
+	virtual BOOL 			_onDlgMessage(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
 
 protected:
-	HWND					m_hwndDlg;	//  dialog box Windows
+	
 	HBITMAP					m_hBitmapBottom;
 	HBITMAP					m_hBitmapTop;
 	HBITMAP					m_hBitmapRight;
Index: src/wp/ap/win/ap_Win32Dialog_Goto.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Dialog_Goto.cpp,v
retrieving revision 1.21
diff -u -r1.21 ap_Win32Dialog_Goto.cpp
--- src/wp/ap/win/ap_Win32Dialog_Goto.cpp	29 Mar 2007 04:00:46 -0000	1.21
+++ src/wp/ap/win/ap_Win32Dialog_Goto.cpp	9 Apr 2007 08:37:47 -0000
@@ -32,7 +32,6 @@
 #include "ap_Dialog_Goto.h"
 #include "ap_Win32Dialog_Goto.h"
 #include "ap_Win32Resources.rc2"
-#include "xap_Win32DialogHelper.h"
 #include "fv_View.h"
 #include "ap_Win32App.h"
 
@@ -55,30 +54,19 @@
 
 void AP_Win32Dialog_Goto::activate(void)
 {
-	int iResult;
-
 	// Update the caption
 	ConstructWindowName();
-	SetWindowText(m_hWnd, m_WindowName);
+	setDialogTitle (m_WindowName);
 
 	SetFocus( GetDlgItem( m_hWnd,AP_RID_DIALOG_GOTO_EDIT_NUMBER ) );
-
-	iResult = ShowWindow( m_hWnd, SW_SHOW );
-
-	iResult = BringWindowToTop( m_hWnd );
-
-	UT_ASSERT_HARMLESS((iResult != 0));
+	showWindow(SW_SHOW);
+	bringWindowToTop();
 }
 
 
 void AP_Win32Dialog_Goto::destroy(void)
-{
-	DELETEP( m_pszOldValue );
-
-	int iResult = DestroyWindow( m_hWnd );
-
-	UT_ASSERT_HARMLESS((iResult != 0));
-
+{	
+	destroyWindow();
 	modeless_cleanup();
 }
 
@@ -88,7 +76,7 @@
 	{
 		// Update the caption
 		ConstructWindowName();
-		SetWindowText(m_hWnd, m_WindowName);
+		setDialogTitle(m_WindowName);
 
 		SetWindowLong(m_hWnd, GWL_HWNDPARENT, (long)static_cast<XAP_Win32FrameImpl*>(pFrame->getFrameImpl())->getTopLevelWindow());
 		SetWindowPos(m_hWnd, NULL, 0, 0, 0, 0,
@@ -108,60 +96,16 @@
 
 void AP_Win32Dialog_Goto::runModeless(XAP_Frame * pFrame)
 {
-	UT_return_if_fail (pFrame && m_id == AP_DIALOG_ID_GOTO);
-
-	// raise the dialog
-	int iResult;
-	XAP_Win32App * pWin32App = static_cast<XAP_Win32App *>(m_pApp);
-
-	LPCTSTR lpTemplate = NULL;
-
-	lpTemplate = MAKEINTRESOURCE(AP_RID_DIALOG_GOTO);
-
-	HWND hResult = CreateDialogParam(pWin32App->getInstance(),lpTemplate,
-							static_cast<XAP_Win32FrameImpl*>(pFrame->getFrameImpl())->getTopLevelWindow(),
-							(DLGPROC)s_dlgProc,(LPARAM)this);
-
-	UT_return_if_fail ((hResult != NULL));
-
-	m_hWnd = hResult;
-
+	UT_return_if_fail (pFrame && m_id == AP_DIALOG_ID_GOTO);	
+	
+	createModeless (pFrame, MAKEINTRESOURCE(AP_RID_DIALOG_GOTO));
+	
 	// Save dialog the ID number and pointer to the widget
-	UT_sint32 sid =(UT_sint32)	getDialogId();
-	m_pApp->rememberModelessId( sid, (XAP_Dialog_Modeless *) m_pDialog);
-
-	iResult = ShowWindow( m_hWnd, SW_SHOW );
-
-	iResult = BringWindowToTop( m_hWnd );
-
-	UT_ASSERT_HARMLESS((iResult != 0));
+	UT_sint32 sid =(UT_sint32) getDialogId();
+	m_pApp->rememberModelessId (sid, (XAP_Dialog_Modeless *) m_pDialog);
 	m_pView->focusChange(AV_FOCUS_MODELESS);
 }
 
-BOOL CALLBACK AP_Win32Dialog_Goto::s_dlgProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
-{
-	// This is a static function.
-
-	AP_Win32Dialog_Goto * pThis;
-
-	switch (msg)
-	{
-	case WM_INITDIALOG:
-		pThis = (AP_Win32Dialog_Goto *)lParam;
-		SetWindowLong(hWnd,DWL_USER,lParam);
-		return pThis->_onInitDialog(hWnd,wParam,lParam);
-
-	case WM_COMMAND:
-		pThis = (AP_Win32Dialog_Goto *)GetWindowLong(hWnd,DWL_USER);
-		if (pThis)
-			return pThis->_onCommand(hWnd,wParam,lParam);
-		else
-			return 0;
-
-	default:
-		return 0;
-	}
-}
 
 void AP_Win32Dialog_Goto::GoTo (const char *number)
 {
@@ -183,29 +127,32 @@
 	return (m_iRow);
 }
 
-#define _DSI(c,i)	SetDlgItemInt(hWnd,AP_RID_DIALOG_##c,m_count.##i,FALSE)
-#define _DS(c,s)	SetDlgItemText(hWnd,AP_RID_DIALOG_##c,pSS->getValue(AP_STRING_ID_##s))
-#define _DSX(c,s)	SetDlgItemText(hWnd,AP_RID_DIALOG_##c,pSS->getValue(XAP_STRING_ID_##s))
+#define _DSI(c,i)	SetDlgItemInt(m_hDlg,AP_RID_DIALOG_##c,m_count.##i,FALSE)
+#define _DS(c,s)	setDlgItemText(AP_RID_DIALOG_##c,pSS->getValue(AP_STRING_ID_##s))
+#define _DSX(c,s)	setDlgItemText(AP_RID_DIALOG_##c,pSS->getValue(XAP_STRING_ID_##s))
 
 BOOL AP_Win32Dialog_Goto::_onInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
 	int iTarget;
 	char **ppszTargets;
 	const XAP_StringSet * pSS = m_pApp->getStringSet();
-
-	m_pszOldValue = NULL;
+	
+	m_oldvalue.clear();
 
 	// Update the caption
 	ConstructWindowName();
-	SetWindowText(hWnd, (AP_Win32App::s_fromUTF8ToWinLocale(m_WindowName)).c_str()); 
+	setDialogTitle(m_WindowName); 
 
 	// Disable the Go To button until something has been entered into the Number box
 	EnableWindow( GetDlgItem(hWnd,AP_RID_DIALOG_GOTO_BTN_GOTO), FALSE );
 
 	m_iRow = 0;
 	ppszTargets = getJumpTargets();
-	for ( iTarget = 0; ppszTargets[ iTarget ] != NULL; iTarget++ )
-		SendMessage( GetDlgItem(hWnd,AP_RID_DIALOG_GOTO_LIST_WHAT), LB_ADDSTRING, 0, (LPARAM)ppszTargets[ iTarget ] );
+	for ( iTarget = 0; ppszTargets[ iTarget ] != NULL; iTarget++ ) {
+		UT_Win32LocaleString str;
+		str.fromUTF8(ppszTargets[ iTarget ] );
+		SendMessage( GetDlgItem(hWnd,AP_RID_DIALOG_GOTO_LIST_WHAT), LB_ADDSTRING, 0, (LPARAM)str.c_str());
+	}
 
 	SendMessage(GetDlgItem(hWnd,AP_RID_DIALOG_GOTO_LIST_WHAT), LB_SETCURSEL, m_iRow, 0);
 
@@ -230,16 +177,15 @@
 	ShowWindow(GetDlgItem(hWnd,AP_RID_DIALOG_GOTO_LIST_BOOKMARKS), FALSE);
 
 
-	SetFocus( GetDlgItem(hWnd,AP_RID_DIALOG_GOTO_EDIT_NUMBER) );
-	
-	XAP_Win32DialogHelper::s_centerDialog(hWnd);	
+	SetFocus( GetDlgItem(hWnd,AP_RID_DIALOG_GOTO_EDIT_NUMBER) );	
+	centerDialog();	
 
 	return 0;							// 0 == we called SetFocus()
 }
 
 BOOL AP_Win32Dialog_Goto::_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
-	char * pBuf = NULL;
+	TCHAR * pBuf = NULL;
 	bool bValueOK = TRUE;
 	WORD wNotifyCode = HIWORD(wParam);
 	WORD wId = LOWORD(wParam);
@@ -266,14 +212,14 @@
 				ShowWindow(GetDlgItem(hWnd,AP_RID_DIALOG_GOTO_TEXT_INFO),FALSE);
 				ShowWindow(GetDlgItem(hWnd,AP_RID_DIALOG_GOTO_LIST_BOOKMARKS),TRUE);
 				const XAP_StringSet * pSS = m_pApp->getStringSet();
-				SetDlgItemText(hWnd,AP_RID_DIALOG_GOTO_TEXT_NUMBER,pSS->getValue(AP_STRING_ID_DLG_Goto_Label_Name));
+				setDlgItemText (AP_RID_DIALOG_GOTO_TEXT_NUMBER,pSS->getValue(AP_STRING_ID_DLG_Goto_Label_Name));
 			}
 			else
 			{
 				ShowWindow(GetDlgItem(hWnd,AP_RID_DIALOG_GOTO_TEXT_INFO),TRUE);
 				ShowWindow(GetDlgItem(hWnd,AP_RID_DIALOG_GOTO_LIST_BOOKMARKS),FALSE);
 				const XAP_StringSet * pSS = m_pApp->getStringSet();
-				SetDlgItemText(hWnd,AP_RID_DIALOG_GOTO_TEXT_NUMBER,pSS->getValue(AP_STRING_ID_DLG_Goto_Label_Number));
+				setDlgItemText(AP_RID_DIALOG_GOTO_TEXT_NUMBER,pSS->getValue(AP_STRING_ID_DLG_Goto_Label_Number));
 			}
 			return 1;
 
@@ -289,15 +235,15 @@
 			{
 				int nIndex = SendMessage( hWndCtrl, LB_GETCURSEL, 0, 0);
 				if( nIndex != LB_ERR )
-				{
-					DELETEP(m_pszOldValue);
-					m_pszOldValue = new char[1024];
+				{					
+					TCHAR value[1024];
 
-					SendMessage( hWndCtrl, LB_GETTEXT, (WPARAM) nIndex, (LPARAM) m_pszOldValue );
-					SetWindowText( GetDlgItem(hWnd,AP_RID_DIALOG_GOTO_EDIT_NUMBER), m_pszOldValue );
+					SendMessage( hWndCtrl, LB_GETTEXT, (WPARAM) nIndex, (LPARAM) &value);
+					m_oldvalue.fromLocale (value);
+					SetWindowText (GetDlgItem(hWnd,AP_RID_DIALOG_GOTO_EDIT_NUMBER), value);
 					EnableWindow( GetDlgItem(hWnd,AP_RID_DIALOG_GOTO_BTN_GOTO), TRUE );
 					if( wNotifyCode == LBN_DBLCLK )
-						GoTo( m_pszOldValue );
+						GoTo( m_oldvalue.utf8_str().utf8_str());
 				}
 				return 1;
 			}
@@ -309,28 +255,27 @@
 	case AP_RID_DIALOG_GOTO_BTN_PREV:
 		if( m_iRow == (short) AP_JUMPTARGET_BOOKMARK )
 		{
-			DELETEP(m_pszOldValue);
-
-			m_pszOldValue = new char[1024];
-			*m_pszOldValue = 0;
+			m_oldvalue.clear();
+			TCHAR value[1024];
 
 			int nIndex = SendMessage( GetDlgItem(hWnd, AP_RID_DIALOG_GOTO_LIST_BOOKMARKS), LB_GETCURSEL, 0, 0);
 			if( nIndex == LB_ERR ) nIndex = 0;
 			if( nIndex == 0 )
 			{
 				SendMessage( GetDlgItem(hWnd, AP_RID_DIALOG_GOTO_LIST_BOOKMARKS), LB_SETCURSEL, (WPARAM) nIndex, 0);
-				SendMessage( GetDlgItem(hWnd, AP_RID_DIALOG_GOTO_LIST_BOOKMARKS), LB_GETTEXT,	(WPARAM) nIndex, (LPARAM) m_pszOldValue );
+				SendMessage( GetDlgItem(hWnd, AP_RID_DIALOG_GOTO_LIST_BOOKMARKS), LB_GETTEXT,	(WPARAM) nIndex, (LPARAM) value);
 			}
 			else
 			{
 				SendMessage( GetDlgItem(hWnd, AP_RID_DIALOG_GOTO_LIST_BOOKMARKS), LB_SETCURSEL, (WPARAM) nIndex-1, 0);
-				SendMessage( GetDlgItem(hWnd, AP_RID_DIALOG_GOTO_LIST_BOOKMARKS), LB_GETTEXT,	(WPARAM) nIndex-1, (LPARAM) m_pszOldValue );
+				SendMessage( GetDlgItem(hWnd, AP_RID_DIALOG_GOTO_LIST_BOOKMARKS), LB_GETTEXT,	(WPARAM) nIndex-1, (LPARAM)value);
 			}
-			SetWindowText( GetDlgItem(hWnd,AP_RID_DIALOG_GOTO_EDIT_NUMBER), m_pszOldValue );
+			m_oldvalue.fromLocale (value);
+			SetWindowText( GetDlgItem(hWnd,AP_RID_DIALOG_GOTO_EDIT_NUMBER), value);
 			EnableWindow( GetDlgItem(hWnd,AP_RID_DIALOG_GOTO_BTN_GOTO), TRUE );
 
-			if (m_pszOldValue)
-				GoTo(m_pszOldValue );		
+			if (!m_oldvalue.empty ())
+				GoTo(m_oldvalue.utf8_str().utf8_str());
 		}
 		else
 		{
@@ -341,9 +286,8 @@
 	case AP_RID_DIALOG_GOTO_BTN_NEXT:
 		if( m_iRow == (short) AP_JUMPTARGET_BOOKMARK )
 		{
-			DELETEP(m_pszOldValue);
-			m_pszOldValue = new char[1024];
-			*m_pszOldValue = NULL;
+			m_oldvalue.clear();
+			TCHAR value[1024];
 
 			int nCount = SendMessage( GetDlgItem(hWnd, AP_RID_DIALOG_GOTO_LIST_BOOKMARKS), LB_GETCOUNT, 0, 0);
 			int nIndex = SendMessage( GetDlgItem(hWnd, AP_RID_DIALOG_GOTO_LIST_BOOKMARKS), LB_GETCURSEL, 0, 0);
@@ -351,18 +295,18 @@
 			if( nIndex == nCount-1 )
 			{
 				SendMessage( GetDlgItem(hWnd, AP_RID_DIALOG_GOTO_LIST_BOOKMARKS), LB_SETCURSEL, (WPARAM) nIndex, 0);
-				SendMessage( GetDlgItem(hWnd, AP_RID_DIALOG_GOTO_LIST_BOOKMARKS), LB_GETTEXT,	(WPARAM) nIndex, (LPARAM) m_pszOldValue );
+				SendMessage( GetDlgItem(hWnd, AP_RID_DIALOG_GOTO_LIST_BOOKMARKS), LB_GETTEXT,	(WPARAM) nIndex, (LPARAM) value);
 			}
 			else
 			{
 				SendMessage( GetDlgItem(hWnd, AP_RID_DIALOG_GOTO_LIST_BOOKMARKS), LB_SETCURSEL, (WPARAM) nIndex+1, 0);
-				SendMessage( GetDlgItem(hWnd, AP_RID_DIALOG_GOTO_LIST_BOOKMARKS), LB_GETTEXT,	(WPARAM) nIndex+1, (LPARAM) m_pszOldValue );
+				SendMessage( GetDlgItem(hWnd, AP_RID_DIALOG_GOTO_LIST_BOOKMARKS), LB_GETTEXT,	(WPARAM) nIndex+1, (LPARAM) value);
 			}
-			SetWindowText( GetDlgItem(hWnd,AP_RID_DIALOG_GOTO_EDIT_NUMBER), m_pszOldValue );
+			SetWindowText( GetDlgItem(hWnd,AP_RID_DIALOG_GOTO_EDIT_NUMBER), m_oldvalue.c_str());
 			EnableWindow( GetDlgItem(hWnd,AP_RID_DIALOG_GOTO_BTN_GOTO), TRUE );
 
-			if (m_pszOldValue)
-				GoTo(m_pszOldValue);		
+			if (!m_oldvalue.empty ())
+				GoTo( m_oldvalue.utf8_str().utf8_str());
 		}
 		else
 		{		
@@ -371,8 +315,9 @@
 		return 1;
 
 	case AP_RID_DIALOG_GOTO_BTN_GOTO:
-		UT_return_val_if_fail ( m_pszOldValue, 0 );
-		GoTo( m_pszOldValue );
+		if (!m_oldvalue.empty())		
+			GoTo(m_oldvalue.utf8_str().utf8_str());
+			
 		return 1;
 
 	case AP_RID_DIALOG_GOTO_EDIT_NUMBER:
@@ -384,7 +329,7 @@
 			{
 				if( dwTextLength )
 				{
-					pBuf = new char [ dwTextLength + 1 ];
+					pBuf = new TCHAR [ dwTextLength + 1 ];
 					if( !pBuf )
 						return 0;
 				
@@ -402,14 +347,10 @@
 					{
 						if( !UT_UCS4_isdigit( pBuf[ dwCounter ] ) )
 						{
-							if( m_pszOldValue == NULL )
-							{
-								m_pszOldValue = new char[ 1 ];
-								*m_pszOldValue = '\0';
-							}
-							
-							SetWindowText( hWndCtrl, m_pszOldValue );
+							if (!m_oldvalue.empty ())
+								m_oldvalue.fromLocale(_T("0"));
 							
+							SetWindowText( hWndCtrl, m_oldvalue.c_str());
 							bValueOK = FALSE;
 
 							break;
@@ -417,24 +358,21 @@
 					}
 	
 					if( bValueOK )
-					{
-						DELETEP( m_pszOldValue );
-	
-						m_pszOldValue = pBuf;
+					{						
+						m_oldvalue.fromLocale (pBuf);
 	
 						// Only enable the goto button if what we have actually contains a number
 						EnableWindow( GetDlgItem(hWnd,AP_RID_DIALOG_GOTO_BTN_GOTO), !(((pBuf[ 0 ] == '-') || (pBuf[ 0 ] == '+')) && (pBuf[ 1 ] == '\0')) );
 					}
 					else
 					{
-						FREEP( pBuf );
-		
+						FREEP( pBuf );		
 						EnableWindow( GetDlgItem(hWnd,AP_RID_DIALOG_GOTO_BTN_GOTO), FALSE );
 					}
 				}
 				else
 				{
-					DELETEP( m_pszOldValue );
+					m_oldvalue.clear();
 					EnableWindow( GetDlgItem(hWnd,AP_RID_DIALOG_GOTO_BTN_GOTO), FALSE );
 				}
 			}
@@ -443,10 +381,11 @@
 
 				if( dwTextLength )
 				{
-					EnableWindow( GetDlgItem(hWnd,AP_RID_DIALOG_GOTO_BTN_GOTO), TRUE ); 	
-					DELETEP( m_pszOldValue );
-					m_pszOldValue = new char[dwTextLength+1];
-					GetWindowText( hWndCtrl, m_pszOldValue, dwTextLength + 1 );
+					EnableWindow( GetDlgItem(hWnd,AP_RID_DIALOG_GOTO_BTN_GOTO), TRUE ); 						
+					TCHAR* value = new TCHAR [dwTextLength+1];
+					GetWindowText( hWndCtrl, value, dwTextLength + 1 );
+					m_oldvalue.fromLocale (value);
+					delete value;
 				}
 				else
 				{
Index: src/wp/ap/win/ap_Win32Dialog_Goto.h
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Dialog_Goto.h,v
retrieving revision 1.9
diff -u -r1.9 ap_Win32Dialog_Goto.h
--- src/wp/ap/win/ap_Win32Dialog_Goto.h	16 Jan 2007 23:16:26 -0000	1.9
+++ src/wp/ap/win/ap_Win32Dialog_Goto.h	9 Apr 2007 08:37:47 -0000
@@ -22,11 +22,11 @@
 
 #include "ap_Dialog_Goto.h"
 #include "xap_Frame.h"
-
+#include "xap_Win32DialogBase.h"
 
 /*****************************************************************/
 
-class AP_Win32Dialog_Goto: public AP_Dialog_Goto
+class AP_Win32Dialog_Goto: public AP_Dialog_Goto, public XAP_Win32DialogBase
 {
 public:
 	AP_Win32Dialog_Goto(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id);
@@ -38,8 +38,7 @@
 	virtual void			destroy(void);
 	virtual void			activate(void);
 	virtual void			notifyActiveFrame(XAP_Frame *pFrame);
-	virtual void			notifyCloseFrame(XAP_Frame *pFrame);
-	static BOOL CALLBACK	s_dlgProc(HWND,UINT,WPARAM,LPARAM);
+	virtual void			notifyCloseFrame(XAP_Frame *pFrame);	
 	void					GoTo (const char *number);
 	void					setSelectedRow (int row);
 	int 					getSelectedRow (void);
@@ -52,8 +51,7 @@
 
 	int 					m_iRow;
 	HWND					m_hWnd;
-
-	char *				m_pszOldValue;
+	UT_Win32LocaleString	m_oldvalue;
 };
 
 #endif /* AP_WIN32DIALOG_GOTO_H */
Index: src/wp/ap/win/ap_Win32Dialog_HdrFtr.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Dialog_HdrFtr.cpp,v
retrieving revision 1.7
diff -u -r1.7 ap_Win32Dialog_HdrFtr.cpp
--- src/wp/ap/win/ap_Win32Dialog_HdrFtr.cpp	16 Jan 2007 23:16:26 -0000	1.7
+++ src/wp/ap/win/ap_Win32Dialog_HdrFtr.cpp	9 Apr 2007 08:37:48 -0000
@@ -74,119 +74,17 @@
 
 BOOL AP_Win32Dialog_HdrFtr::_onInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
-	XAP_Win32App * app = static_cast<XAP_Win32App *> (m_pApp);
-	UT_return_val_if_fail (app,0);
 
-	m_hThisDlg = hWnd;
-	const XAP_StringSet * pSS = m_pApp->getStringSet();
-	
-	// localize dialog title
-	_win32Dialog.setDialogTitle( pSS->getValue(AP_STRING_ID_DLG_HdrFtr_Title) );
-
-	// localize controls
-	_DSX(HDRFTR_BTN_OK,				DLG_OK);
-	_DSX(HDRFTR_BTN_CANCEL,			DLG_Cancel);
-
-	_DS(HDRFTR_GBX_HDR,				DLG_HdrFtr_HeaderFrame);
-	_DS(HDRFTR_CHK_HDRFACING,		DLG_HdrFtr_HeaderEven);
-	_DS(HDRFTR_CHK_HDRFIRST,		DLG_HdrFtr_HeaderFirst);
-	_DS(HDRFTR_CHK_HDRLAST,			DLG_HdrFtr_HeaderLast);
-	_DS(HDRFTR_GBX_FTR,				DLG_HdrFtr_FooterFrame);
-	_DS(HDRFTR_CHK_FTRFACING,		DLG_HdrFtr_FooterEven);
-	_DS(HDRFTR_CHK_FTRFIRST,		DLG_HdrFtr_FooterFirst);
-	_DS(HDRFTR_CHK_FTRLAST,			DLG_HdrFtr_FooterLast);
-	_DS(HDRFTR_CHK_SECTION,			DLG_HdrFtr_RestartCheck);
-	_DS(HDRFTR_LBL_SECTION,			DLG_HdrFtr_RestartNumbers);
-
-	// set initial state
-	_win32Dialog.checkButton(AP_RID_DIALOG_HDRFTR_CHK_HDRFACING, getValue(HdrEven));
-	_win32Dialog.checkButton(AP_RID_DIALOG_HDRFTR_CHK_HDRFIRST,  getValue(HdrFirst));
-	_win32Dialog.checkButton(AP_RID_DIALOG_HDRFTR_CHK_HDRLAST,   getValue(HdrLast));
-	_win32Dialog.checkButton(AP_RID_DIALOG_HDRFTR_CHK_FTRFACING, getValue(FtrEven));
-	_win32Dialog.checkButton(AP_RID_DIALOG_HDRFTR_CHK_FTRFIRST,  getValue(FtrFirst));
-	_win32Dialog.checkButton(AP_RID_DIALOG_HDRFTR_CHK_FTRLAST,   getValue(FtrLast));
-	_win32Dialog.setControlInt(AP_RID_DIALOG_HDRFTR_EBX_SECTION, getRestartValue());
-
-	bool bRestart = isRestart();
-	_win32Dialog.checkButton(AP_RID_DIALOG_HDRFTR_CHK_SECTION, bRestart);
-	_win32Dialog.enableControl(AP_RID_DIALOG_HDRFTR_LBL_SECTION, bRestart);
-	_win32Dialog.enableControl(AP_RID_DIALOG_HDRFTR_EBX_SECTION, bRestart);
-	_win32Dialog.enableControl(AP_RID_DIALOG_HDRFTR_SPN_SECTION, bRestart);
-	
-	XAP_Win32DialogHelper::s_centerDialog(hWnd);			
 	return 1;
 }
 
 BOOL AP_Win32Dialog_HdrFtr::_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
-	WORD wNotifyCode = HIWORD(wParam);
-	WORD wId = LOWORD(wParam);
-	HWND hWndCtrl = (HWND)lParam;
-
-	switch (wId)
-	{
-	case AP_RID_DIALOG_HDRFTR_BTN_CANCEL:
-		setAnswer( a_CANCEL );
-		EndDialog(hWnd,0);
-		return 1;
-
-	case AP_RID_DIALOG_HDRFTR_BTN_OK:
-		{
-			bool bHdrEven  = _win32Dialog.isChecked(AP_RID_DIALOG_HDRFTR_CHK_HDRFACING) != 0;
-			bool bHdrFirst = _win32Dialog.isChecked(AP_RID_DIALOG_HDRFTR_CHK_HDRFIRST)  != 0;
-			bool bHdrLast  = _win32Dialog.isChecked(AP_RID_DIALOG_HDRFTR_CHK_HDRLAST)   != 0;
-			bool bFtrEven  = _win32Dialog.isChecked(AP_RID_DIALOG_HDRFTR_CHK_FTRFACING) != 0;
-			bool bFtrFirst = _win32Dialog.isChecked(AP_RID_DIALOG_HDRFTR_CHK_FTRFIRST)  != 0;
-			bool bFtrLast  = _win32Dialog.isChecked(AP_RID_DIALOG_HDRFTR_CHK_FTRLAST)   != 0;
- 			bool bRestart  = _win32Dialog.isChecked(AP_RID_DIALOG_HDRFTR_CHK_SECTION)   != 0;
-			UT_sint32 val  = _win32Dialog.getControlInt(AP_RID_DIALOG_HDRFTR_EBX_SECTION);
-
-			setValue( HdrEven,  bHdrEven,  bHdrEven  != getValue(HdrEven)  );
-			setValue( HdrFirst, bHdrFirst, bHdrFirst != getValue(HdrFirst) );
-			setValue( HdrLast,  bHdrLast,  bHdrLast  != getValue(HdrLast)  );
-			setValue( FtrEven,  bFtrEven,  bFtrEven  != getValue(FtrEven)  );
-			setValue( FtrFirst, bFtrFirst, bFtrFirst != getValue(FtrFirst) );
-			setValue( FtrLast,  bFtrLast,  bFtrLast  != getValue(FtrLast)  );
-			setRestart( bRestart, val, (bRestart != isRestart() || val != getRestartValue()) );
-		}
-		setAnswer( a_OK );
-		EndDialog(hWnd,0);
-		return 1;
-
-	case AP_RID_DIALOG_HDRFTR_CHK_SECTION:
-		_win32Dialog.enableControl(AP_RID_DIALOG_HDRFTR_LBL_SECTION, _win32Dialog.isChecked(wId)!=0);
-		_win32Dialog.enableControl(AP_RID_DIALOG_HDRFTR_EBX_SECTION, _win32Dialog.isChecked(wId)!=0);
-		_win32Dialog.enableControl(AP_RID_DIALOG_HDRFTR_SPN_SECTION, _win32Dialog.isChecked(wId)!=0);	
-		return 1;
-
-	case AP_RID_DIALOG_HDRFTR_EBX_SECTION:
-		if( wNotifyCode == EN_KILLFOCUS )
-		{
-			UT_sint32 value = _win32Dialog.getControlInt(AP_RID_DIALOG_HDRFTR_EBX_SECTION);
-			_win32Dialog.setControlInt(AP_RID_DIALOG_HDRFTR_EBX_SECTION, value );
-		}
-		return 1;
-
-	default:							// we did not handle this notification
-		UT_DEBUGMSG(("WM_Command for id %ld\n",wId));
-		return 0;						// return zero to let windows take care of it.
-	}
+	return 0;
 }
 
 BOOL AP_Win32Dialog_HdrFtr::_onDeltaPos(NM_UPDOWN * pnmud)
 {
-	switch( pnmud->hdr.idFrom )
-	{
-	case AP_RID_DIALOG_HDRFTR_SPN_SECTION:
-		{
-			UT_sint32 value = _win32Dialog.getControlInt(AP_RID_DIALOG_HDRFTR_EBX_SECTION);
-			value -= pnmud->iDelta;
-			if( value < 0 ) value = 0;
-			_win32Dialog.setControlInt(AP_RID_DIALOG_HDRFTR_EBX_SECTION, value );
-			return 1;
-		}
-	default:
-		return 0;
-	}
+	return 0;	
 }
 
Index: src/wp/ap/win/ap_Win32Dialog_InsertTable.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Dialog_InsertTable.cpp,v
retrieving revision 1.17
diff -u -r1.17 ap_Win32Dialog_InsertTable.cpp
--- src/wp/ap/win/ap_Win32Dialog_InsertTable.cpp	7 Apr 2007 17:50:22 -0000	1.17
+++ src/wp/ap/win/ap_Win32Dialog_InsertTable.cpp	9 Apr 2007 08:37:48 -0000
@@ -20,6 +20,7 @@
 #include <windows.h>
 #include <commdlg.h>
 #include <commctrl.h>
+#include <stdlib.h>
 
 #include "ut_types.h"
 #include "ut_string.h"
@@ -40,7 +41,7 @@
 #include "ap_Win32Resources.rc2"
 #include "xap_Win32DialogHelper.h"
 
-#define BUFSIZE		128
+#define BUFSIZE		64
 
 /*****************************************************************/
 
@@ -54,7 +55,7 @@
 // Init
 //
 AP_Win32Dialog_InsertTable::AP_Win32Dialog_InsertTable (XAP_DialogFactory *pDlgFactory, XAP_Dialog_Id id)
-: AP_Dialog_InsertTable (pDlgFactory, id), m_hwndDlg(NULL)
+: AP_Dialog_InsertTable (pDlgFactory, id)
 {
 	
 }
@@ -65,69 +66,19 @@
 
 void AP_Win32Dialog_InsertTable::runModal(XAP_Frame *pFrame)
 {
-	UT_return_if_fail (pFrame);	
-	
-	// raise the dialog
-	XAP_Win32App * pWin32App = static_cast<XAP_Win32App *>(m_pApp);
-
-	LPCTSTR lpTemplate = NULL;
-
-	UT_return_if_fail (m_id == AP_DIALOG_ID_INSERT_TABLE);
-
-	lpTemplate = MAKEINTRESOURCE(AP_RID_DIALOG_INSERT_TABLE);
-
-	int result = DialogBoxParam(pWin32App->getInstance(),lpTemplate,
-						static_cast<XAP_Win32FrameImpl*>(pFrame->getFrameImpl())->getTopLevelWindow(),
-						(DLGPROC)s_dlgProc,(LPARAM)this);
-	UT_ASSERT_HARMLESS((result != -1));
-
+	createModal(pFrame, MAKEINTRESOURCE(AP_RID_DIALOG_INSERT_TABLE));
 }
 
 /*****************************************************************/
 
-#define GWL(hwnd)		(AP_Win32Dialog_InsertTable*)GetWindowLong((hwnd), DWL_USER)
-#define SWL(hwnd, d)	(AP_Win32Dialog_InsertTable*)SetWindowLong((hwnd), DWL_USER,(LONG)(d))
-
-
-BOOL CALLBACK AP_Win32Dialog_InsertTable::s_dlgProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
-{
-		
-	AP_Win32Dialog_InsertTable * pThis;
-	
-	switch (msg)
-	{
-	case WM_INITDIALOG:
-		pThis = (AP_Win32Dialog_InsertTable *)lParam;
-		SWL(hWnd,lParam);
-		return pThis->_onInitDialog(hWnd,wParam,lParam);
-
-	case WM_NOTIFY:
-		pThis = GWL(hWnd);
-		switch (((LPNMHDR)lParam)->code)
-		{
-			case UDN_DELTAPOS:		return pThis->_onDeltaPos((NM_UPDOWN *)lParam);
-			default:				return 0;
-		}
-		
-	case WM_COMMAND:
-		pThis = GWL(hWnd);
-		return pThis->_onCommand(hWnd,wParam,lParam);
-	default:
-		return 0;
-	}
-}
-
-
-#define _DS(c,s)	SetDlgItemText(hWnd,AP_RID_DIALOG_INSERTTABLE_##c,pSS->getValue(AP_STRING_ID_##s))
-#define _DSX(c,s)	SetDlgItemText(hWnd,AP_RID_DIALOG_INSERTTABLE_##c,pSS->getValue(XAP_STRING_ID_##s))
+#define _DS(c,s)	setDlgItemText(AP_RID_DIALOG_INSERTTABLE_##c, pSS->getValue(AP_STRING_ID_##s))
+#define _DSX(c,s)	setDlgItemText(AP_RID_DIALOG_INSERTTABLE_##c, pSS->getValue(XAP_STRING_ID_##s))
 
 // This handles the WM_INITDIALOG message for the top-level dialog.
 BOOL AP_Win32Dialog_InsertTable::_onInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {	
 	const XAP_StringSet * pSS = m_pApp->getStringSet();
-	char 	szValue[BUFSIZE];	
-	m_hwndDlg = hWnd;
-		
+	TCHAR szValue[BUFSIZE];
 		
 	// localize controls 
 	_DSX(BTN_OK,		DLG_OK);
@@ -140,7 +91,7 @@
 	_DS(RADIO_FIXED,	DLG_InsertTable_FixedColSize);			
 		
 	// Localise caption
-	SetWindowText(hWnd, pSS->getValue(AP_STRING_ID_DLG_InsertTable_TableTitle));
+	setDialogTitle (pSS->getValue(AP_STRING_ID_DLG_InsertTable_TableTitle));
 
 	// Set Spin range (TODO: check if the max value is correct, copied from the unix version)
 	SendMessage(GetDlgItem(hWnd,AP_RID_DIALOG_INSERTTABLE_SPIN_COLUMN),UDM_SETRANGE,(WPARAM)0,(LPARAM)MAKELONG((short)64,(short)1));
@@ -153,77 +104,88 @@
 	SendMessage(GetDlgItem(hWnd,AP_RID_DIALOG_INSERTTABLE_TEXT_SIZE),EM_LIMITTEXT,(WPARAM)5,(WPARAM)0);
 
 	CheckRadioButton(hWnd, AP_RID_DIALOG_INSERTTABLE_RADIO_AUTO,
-		AP_RID_DIALOG_INSERTTABLE_RADIO_FIXED, AP_RID_DIALOG_INSERTTABLE_RADIO_AUTO);
-	
+		AP_RID_DIALOG_INSERTTABLE_RADIO_FIXED, AP_RID_DIALOG_INSERTTABLE_RADIO_AUTO);	
 	
 	SetFocus(GetDlgItem(hWnd,AP_RID_DIALOG_INSERTTABLE_VAL_COLUMN));
 	SendDlgItemMessage(hWnd, AP_RID_DIALOG_INSERTTABLE_VAL_COLUMN, EM_SETSEL, 0, -1);
 	
 	// Set default values		
-	sprintf(szValue, "%u", getNumCols());
-	SetDlgItemText(hWnd, AP_RID_DIALOG_INSERTTABLE_VAL_COLUMN, szValue);
+	_stprintf(szValue, _T("%u"), getNumCols());
+	SetDlgItemText(m_hDlg, AP_RID_DIALOG_INSERTTABLE_VAL_COLUMN, szValue);
 		
-	sprintf(szValue, "%u", getNumRows());
-	SetDlgItemText(hWnd, AP_RID_DIALOG_INSERTTABLE_VAL_ROW, szValue);
+	_stprintf(szValue, _T("%u"), getNumRows());
+	SetDlgItemText(m_hDlg, AP_RID_DIALOG_INSERTTABLE_VAL_ROW, szValue);
 				
-	sprintf(szValue, "%02.2f", getColumnWidth());
-	SetDlgItemText(hWnd, AP_RID_DIALOG_INSERTTABLE_VAL_SIZE, szValue);
+	_stprintf(szValue, _T("%02.2f"), getColumnWidth());
+	SetDlgItemText(m_hDlg, AP_RID_DIALOG_INSERTTABLE_VAL_SIZE, szValue);
 
 	/* Units name*/
-	SetDlgItemText(hWnd, AP_RID_DIALOG_INSERTTABLE_TEXT_UNITS, UT_dimensionName(m_dim));	
+	setDlgItemText(AP_RID_DIALOG_INSERTTABLE_TEXT_UNITS, UT_dimensionName(m_dim));	
 
 	/* Autosize by default*/
-	EnableWindow(GetDlgItem(m_hwndDlg,AP_RID_DIALOG_INSERTTABLE_VAL_SIZE), FALSE);
-	EnableWindow(GetDlgItem(m_hwndDlg,AP_RID_DIALOG_INSERTTABLE_SPIN_SIZE), FALSE);
+	EnableWindow(GetDlgItem(m_hDlg,AP_RID_DIALOG_INSERTTABLE_VAL_SIZE), FALSE);
+	EnableWindow(GetDlgItem(m_hDlg,AP_RID_DIALOG_INSERTTABLE_SPIN_SIZE), FALSE);
 
-	XAP_Win32DialogHelper::s_centerDialog(hWnd);	
+	centerDialog();	
 	
 	return 0; // 0 because we called SetFocus
 }
 
+#ifdef _UNICODE
+float atofw (const WCHAR *st)
+{
+	UT_Win32LocaleString str;
+	str.fromLocale (st);
+	return atof (str.ascii_str ());
+}
+
+#define	_ttof		atofw
+#else
+#define	_ttof		atof
+#endif
+
 //
 // Gets the values from the spin controls
 //
 void AP_Win32Dialog_InsertTable::getCtrlValues(void)
 {	
-	char 	szValue[BUFSIZE];	
+	UT_Win32LocaleString str;
 		
-	if (GetDlgItemText(m_hwndDlg, AP_RID_DIALOG_INSERTTABLE_VAL_COLUMN, szValue, BUFSIZE ))	
-		m_numCols = atoi(szValue);
+	if (getDlgItemText(AP_RID_DIALOG_INSERTTABLE_VAL_COLUMN, str))
+		m_numCols = _ttoi(str.c_str ());
 	
-	if (GetDlgItemText(m_hwndDlg, AP_RID_DIALOG_INSERTTABLE_VAL_ROW, szValue, BUFSIZE ))	
-		m_numRows = atoi(szValue);
+	if (getDlgItemText(AP_RID_DIALOG_INSERTTABLE_VAL_ROW, str))
+		m_numRows = _ttoi(str.c_str ());
 		
-	if (GetDlgItemText(m_hwndDlg, AP_RID_DIALOG_INSERTTABLE_VAL_SIZE, szValue, BUFSIZE ))	
-		setColumnWidth((float) atof(szValue));
+	if (getDlgItemText(AP_RID_DIALOG_INSERTTABLE_VAL_SIZE, str))
+		setColumnWidth((float) _ttof(str.c_str ()));
 	
-	if (IsDlgButtonChecked(m_hwndDlg, AP_RID_DIALOG_INSERTTABLE_RADIO_AUTO))
+	if (IsDlgButtonChecked(m_hDlg, AP_RID_DIALOG_INSERTTABLE_RADIO_AUTO))
 		m_columnType = AP_Dialog_InsertTable::b_AUTOSIZE;
 		
-	if (IsDlgButtonChecked(m_hwndDlg, AP_RID_DIALOG_INSERTTABLE_RADIO_FIXED))
+	if (IsDlgButtonChecked(m_hDlg, AP_RID_DIALOG_INSERTTABLE_RADIO_FIXED))
 		m_columnType = AP_Dialog_InsertTable::b_FIXEDSIZE;
 }
 
 BOOL AP_Win32Dialog_InsertTable::_onDeltaPos(NM_UPDOWN * pnmud)
 {
 	if(pnmud->hdr.idFrom!=AP_RID_DIALOG_INSERTTABLE_SPIN_SIZE)
-		return false;
+		return FALSE;
 
 	UT_DEBUGMSG(("onDeltaPos: [idFrom %d][iPos %d][iDelta %d]\n",
 				 pnmud->hdr.idFrom,pnmud->iPos,pnmud->iDelta));
 				 
-	char szBuff[256]="";			 					 
+	UT_Win32LocaleString str;
+	TCHAR szBuff[255];
 	double dValue = 0;
 	
-	if (GetDlgItemText(m_hwndDlg, AP_RID_DIALOG_INSERTTABLE_VAL_SIZE, szBuff, 255 ))	
-		dValue = (float) atof(szBuff);
-												 
-	dValue = atof(szBuff);						 
-	
+	if (GetDlgItemText(m_hDlg, AP_RID_DIALOG_INSERTTABLE_VAL_SIZE, szBuff, 255 ))	
+		dValue = (float) _ttof(szBuff);
+		
 	_doSpin((0 - (UT_sint32) (-1) *pnmud->iDelta), dValue);
-	
-	sprintf (szBuff, "%02.2f", dValue);
-	SetWindowText (GetDlgItem(m_hwndDlg,AP_RID_DIALOG_INSERTTABLE_VAL_SIZE), szBuff);
+		
+	_stprintf (szBuff, _T("%02.2f"), dValue);
+	SetWindowText (GetDlgItem(m_hDlg,AP_RID_DIALOG_INSERTTABLE_VAL_SIZE), szBuff);
 	
 	return TRUE;	
 }
@@ -248,13 +210,12 @@
 		case AP_RID_DIALOG_INSERTTABLE_RADIO_FIXED:
 		case AP_RID_DIALOG_INSERTTABLE_RADIO_AUTO:
 		{
-			BOOL bEnable = IsDlgButtonChecked(m_hwndDlg, AP_RID_DIALOG_INSERTTABLE_RADIO_FIXED);
+			BOOL bEnable = IsDlgButtonChecked(m_hDlg, AP_RID_DIALOG_INSERTTABLE_RADIO_FIXED);
 
-			EnableWindow(GetDlgItem(m_hwndDlg,AP_RID_DIALOG_INSERTTABLE_VAL_SIZE), bEnable);
-			EnableWindow(GetDlgItem(m_hwndDlg,AP_RID_DIALOG_INSERTTABLE_SPIN_SIZE), bEnable);
+			EnableWindow(GetDlgItem(m_hDlg,AP_RID_DIALOG_INSERTTABLE_VAL_SIZE), bEnable);
+			EnableWindow(GetDlgItem(m_hDlg,AP_RID_DIALOG_INSERTTABLE_SPIN_SIZE), bEnable);
 			return 1;
-		}
-			
+		}			
 
 		default:							// we did not handle this notification
 			UT_DEBUGMSG(("WM_Command for id %ld\n",wId));
Index: src/wp/ap/win/ap_Win32Dialog_InsertTable.h
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Dialog_InsertTable.h,v
retrieving revision 1.6
diff -u -r1.6 ap_Win32Dialog_InsertTable.h
--- src/wp/ap/win/ap_Win32Dialog_InsertTable.h	16 Jan 2007 23:16:27 -0000	1.6
+++ src/wp/ap/win/ap_Win32Dialog_InsertTable.h	9 Apr 2007 08:37:48 -0000
@@ -21,8 +21,9 @@
 #define AP_Win32Dialog_InsertTable_H
 
 #include "ap_Dialog_InsertTable.h"
+#include "xap_Win32DialogBase.h"
 
-class AP_Win32Dialog_InsertTable : public AP_Dialog_InsertTable
+class AP_Win32Dialog_InsertTable : public AP_Dialog_InsertTable, public XAP_Win32DialogBase
 {
 public:
 	
@@ -31,12 +32,10 @@
 
 	virtual void				runModal(XAP_Frame * pFrame);
 	static XAP_Dialog *			static_constructor(XAP_DialogFactory *, XAP_Dialog_Id id);	
-	BOOL 						_onDeltaPos(NM_UPDOWN * pnmud);
-	static BOOL CALLBACK		s_dlgProc(HWND,UINT,WPARAM,LPARAM);	
+	BOOL 						_onDeltaPos(NM_UPDOWN * pnmud);	
 
 protected:
-
-	HWND						m_hwndDlg;	//  dialog box Windows	
+	
 	BOOL						_onInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam);
 	BOOL						_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);   
 	
Index: src/wp/ap/win/ap_Win32Dialog_Insert_DateTime.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Dialog_Insert_DateTime.cpp,v
retrieving revision 1.12
diff -u -r1.12 ap_Win32Dialog_Insert_DateTime.cpp
--- src/wp/ap/win/ap_Win32Dialog_Insert_DateTime.cpp	7 Apr 2007 17:50:22 -0000	1.12
+++ src/wp/ap/win/ap_Win32Dialog_Insert_DateTime.cpp	9 Apr 2007 08:37:48 -0000
@@ -59,46 +59,15 @@
 void AP_Win32Dialog_Insert_DateTime::runModal(XAP_Frame * pFrame)
 {
     // raise the dialog
-    XAP_Win32App * pWin32App = static_cast<XAP_Win32App *>(m_pApp);
-
-    LPCTSTR lpTemplate = NULL;
-
     UT_return_if_fail (m_id == AP_DIALOG_ID_INSERT_DATETIME);
-
-    lpTemplate = MAKEINTRESOURCE(AP_RID_DIALOG_DATETIME);
-
-    int result = DialogBoxParam(pWin32App->getInstance(),lpTemplate,
-                static_cast<XAP_Win32FrameImpl*>(pFrame->getFrameImpl())->getTopLevelWindow(),
-                (DLGPROC)s_dlgProc,(LPARAM)this);
-    UT_ASSERT_HARMLESS((result != -1));
-}
-
-BOOL CALLBACK AP_Win32Dialog_Insert_DateTime::s_dlgProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
-{
-    // This is a static function.
-
-    AP_Win32Dialog_Insert_DateTime * pThis;
-
-
-    switch (msg){
-    case WM_INITDIALOG:
-        pThis = (AP_Win32Dialog_Insert_DateTime *)lParam;
-        SetWindowLong(hWnd,DWL_USER,lParam);
-        return pThis->_onInitDialog(hWnd,wParam,lParam);
-
-    case WM_COMMAND:
-        pThis = (AP_Win32Dialog_Insert_DateTime *)GetWindowLong(hWnd,DWL_USER);
-        return pThis->_onCommand(hWnd,wParam,lParam);
-
-    default:
-        return 0;
-    }
-}
+    
+	createModal(pFrame, MAKEINTRESOURCE(AP_RID_DIALOG_DATETIME));	
+}	
 
 void AP_Win32Dialog_Insert_DateTime::SetFormatsList(void)
 {
     int i;
-    char szCurrentDateTime[CURRENT_DATE_TIME_SIZE];
+    TCHAR szCurrentDateTime[CURRENT_DATE_TIME_SIZE];
     time_t  tim = time(NULL);
     struct tm *pTime = localtime(&tim);
 
@@ -125,21 +94,23 @@
 	
 	UT_LocaleTransactor t(LC_ALL, s.c_str());
 
+	UT_Win32LocaleString str;
     for (i = 0;InsertDateTimeFmts[i] != NULL;i++) {
-        strftime(szCurrentDateTime, CURRENT_DATE_TIME_SIZE, InsertDateTimeFmts[i], pTime);
+    	str.fromASCII (InsertDateTimeFmts[i]);
+        _tcsftime(szCurrentDateTime, CURRENT_DATE_TIME_SIZE, str.c_str(), pTime);
         SendMessage(m_hwndFormats, LB_ADDSTRING, 0, (LPARAM)szCurrentDateTime);
     }
 }
 
 
-#define _DS(c,s)	SetDlgItemText(hWnd,AP_RID_DIALOG_##c,pSS->getValue(AP_STRING_ID_##s))
-#define _DSX(c,s)	SetDlgItemText(hWnd,AP_RID_DIALOG_##c,pSS->getValue(XAP_STRING_ID_##s))
+#define _DS(c,s)	setDlgItemText(AP_RID_DIALOG_##c,pSS->getValue(AP_STRING_ID_##s))
+#define _DSX(c,s)	setDlgItemText(AP_RID_DIALOG_##c,pSS->getValue(XAP_STRING_ID_##s))
 
 BOOL AP_Win32Dialog_Insert_DateTime::_onInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
-	const XAP_StringSet * pSS = m_pApp->getStringSet();
+	const XAP_StringSet * pSS = m_pApp->getStringSet();	
 	
-	SetWindowText(hWnd, pSS->getValue(AP_STRING_ID_DLG_DateTime_DateTimeTitle));
+	setDialogTitle(pSS->getValue(AP_STRING_ID_DLG_DateTime_DateTimeTitle));
 
 	// localize controls
 	_DSX(DATETIME_BTN_OK,			DLG_OK);
Index: src/wp/ap/win/ap_Win32Dialog_Insert_DateTime.h
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Dialog_Insert_DateTime.h,v
retrieving revision 1.4
diff -u -r1.4 ap_Win32Dialog_Insert_DateTime.h
--- src/wp/ap/win/ap_Win32Dialog_Insert_DateTime.h	16 Jan 2007 23:16:27 -0000	1.4
+++ src/wp/ap/win/ap_Win32Dialog_Insert_DateTime.h	9 Apr 2007 08:37:48 -0000
@@ -22,16 +22,16 @@
 
 #include "ap_Dialog_Insert_DateTime.h"
 #include "xap_Frame.h"
+#include "xap_Win32DialogBase.h"
 
-class AP_Win32Dialog_Insert_DateTime : public AP_Dialog_Insert_DateTime
+class AP_Win32Dialog_Insert_DateTime : public AP_Dialog_Insert_DateTime, public XAP_Win32DialogBase
 {
 public:
     AP_Win32Dialog_Insert_DateTime(XAP_DialogFactory * pDlgFactory,XAP_Dialog_Id id);
 
     virtual void      runModal(XAP_Frame * pFrame);
 
-    static XAP_Dialog *   static_constructor(XAP_DialogFactory *, XAP_Dialog_Id id);
-    static BOOL CALLBACK  s_dlgProc(HWND,UINT,WPARAM,LPARAM);
+    static XAP_Dialog *   static_constructor(XAP_DialogFactory *, XAP_Dialog_Id id);    
 protected:
     BOOL          _onInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam);
     BOOL          _onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);
Index: src/wp/ap/win/ap_Win32Dialog_Latex.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Dialog_Latex.cpp,v
retrieving revision 1.16
diff -u -r1.16 ap_Win32Dialog_Latex.cpp
--- src/wp/ap/win/ap_Win32Dialog_Latex.cpp	16 Jan 2007 23:16:27 -0000	1.16
+++ src/wp/ap/win/ap_Win32Dialog_Latex.cpp	9 Apr 2007 08:37:49 -0000
@@ -53,7 +53,7 @@
 	int iResult;	
 	
 	ConstructWindowName();
-	setDialogTitle((LPCSTR)(AP_Win32App::s_fromUTF8ToWinLocale(m_sWindowName.utf8_str())).c_str());
+//	setDialogTitle((LPCSTR)(AP_Win32App::s_fromUTF8ToWinLocale(m_sWindowName.utf8_str())).c_str());
 	
 	iResult = ShowWindow( m_hDlg, SW_SHOW );
 	iResult = BringWindowToTop( m_hDlg );
@@ -63,7 +63,7 @@
 
 void AP_Win32Dialog_Latex::runModeless(XAP_Frame * pFrame)
 {
-	UT_ASSERT(pFrame);
+	/*UT_ASSERT(pFrame);
 	UT_ASSERT(m_id == AP_DIALOG_ID_LATEX);
 
 	setDialog(this);
@@ -72,7 +72,7 @@
 	UT_ASSERT((hWndDialog != NULL));
 	ShowWindow(hWndDialog, SW_SHOW);
 
-	m_pApp->rememberModelessId(m_id, this);		
+	m_pApp->rememberModelessId(m_id, this);	*/
 }
 
 
@@ -94,19 +94,7 @@
 
 void AP_Win32Dialog_Latex::notifyActiveFrame(XAP_Frame *pFrame)
 {
-	UT_return_if_fail(pFrame);
-
-	HWND frameHWND = static_cast<XAP_Win32FrameImpl*>(pFrame->getFrameImpl())->getTopLevelWindow();
-	if((HWND)GetWindowLong(m_hDlg, GWL_HWNDPARENT) != frameHWND)
-	{
-		// Update the caption
-		ConstructWindowName();
-		setDialogTitle((LPCSTR)(AP_Win32App::s_fromUTF8ToWinLocale(m_sWindowName.utf8_str())).c_str());
 
-		SetWindowLong(m_hDlg, GWL_HWNDPARENT, (long)frameHWND);
-		SetWindowPos(m_hDlg, NULL, 0, 0, 0, 0,
-						SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
-	}
 }
 
 void AP_Win32Dialog_Latex::notifyCloseFrame(XAP_Frame *pFrame)
@@ -133,19 +121,12 @@
 	UT_UTF8String sLatex;
 	getLatex(sLatex);
 
-	setControlText(AP_RID_DIALOG_LATEX_EDIT_LATEX, (LPCSTR)(AP_Win32App::s_fromUTF8ToWinLocale(sLatex.utf8_str())).c_str());
+//	setControlText(AP_RID_DIALOG_LATEX_EDIT_LATEX, (LPCSTR)(AP_Win32App::s_fromUTF8ToWinLocale(sLatex.utf8_str())).c_str());
 }
 
 bool AP_Win32Dialog_Latex::getLatexFromGUI(void)
 {
-	char buffer[2048]; // TODO: FIXME: BAD BAD FIXED LENGTH
-	UT_UTF8String sLatex;
 
-	getControlText(AP_RID_DIALOG_LATEX_EDIT_LATEX, (LPSTR) buffer, 2048);
-	sLatex = AP_Win32App::s_fromWinLocaleToUTF8(buffer);
-	
-	UT_DEBUGMSG(("LaTeX from widget is %s \n",sLatex.utf8_str()));
-	setLatex(sLatex);
 		
 	return true;
 }
@@ -155,51 +136,16 @@
 
 BOOL AP_Win32Dialog_Latex::_onInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
-	m_hDlg = hWnd;
-	
-	// Update the caption
-	ConstructWindowName();
-	setDialogTitle((LPCSTR)(AP_Win32App::s_fromUTF8ToWinLocale(m_sWindowName.utf8_str())).c_str());
-
-	// localize controls
-	localizeControlText(AP_RID_DIALOG_LATEX_TEXT_EXAMPLE,AP_STRING_ID_DLG_Latex_Example);
-	localizeControlText(AP_RID_DIALOG_LATEX_TEXT_LATEXEQUATION,AP_STRING_ID_DLG_Latex_LatexEquation);
-	localizeControlText(AP_RID_DIALOG_LATEX_BTN_CLOSE,XAP_STRING_ID_DLG_Close);
-	localizeControlText(AP_RID_DIALOG_LATEX_BTN_INSERT,XAP_STRING_ID_DLG_Insert);
-
-	setLatexInGUI();
-	centerDialog();	
-
-	if (GetDlgCtrlID((HWND) wParam) != AP_RID_DIALOG_LATEX_EDIT_LATEX) 
-	{ 
-		SetFocus(GetDlgItem(hWnd, AP_RID_DIALOG_LATEX_EDIT_LATEX)); 
-		return 0; 
-	} 	
+
 	return 1;							// 1 == we did not call SetFocus()
 }
 
 
 BOOL AP_Win32Dialog_Latex::_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
-	WORD wNotifyCode = HIWORD(wParam);
-	WORD wId = LOWORD(wParam);
-	HWND hWndCtrl = (HWND)lParam;
-	XAP_Frame *	pFrame = getActiveFrame();
 
-	switch (wId)
-	{
-	case AP_RID_DIALOG_LATEX_BTN_CLOSE:	// also AP_RID_DIALOG_WORDCOUNT_BTN_CLOSE
-		event_Close();
-		return 1;
-		
-	case AP_RID_DIALOG_LATEX_BTN_INSERT:
-		event_Insert();
-		return 1;		
-	
-	default:							// we did not handle this notification
-		UT_DEBUGMSG(("WM_Command for id %ld\n",wId));
-		return 0;						// return zero to let windows take care of it.
-	}
+	return 0;						// return zero to let windows take care of it.
+
 }
 
 BOOL AP_Win32Dialog_Latex::_onDeltaPos(NM_UPDOWN * pnmud)
Index: src/wp/ap/win/ap_Win32Dialog_ListRevisions.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Dialog_ListRevisions.cpp,v
retrieving revision 1.11
diff -u -r1.11 ap_Win32Dialog_ListRevisions.cpp
--- src/wp/ap/win/ap_Win32Dialog_ListRevisions.cpp	7 Apr 2007 17:50:22 -0000	1.11
+++ src/wp/ap/win/ap_Win32Dialog_ListRevisions.cpp	9 Apr 2007 08:37:49 -0000
@@ -114,117 +114,14 @@
 {
 	const XAP_StringSet * pSS = m_pApp->getStringSet();
 
-	SetWindowText(hWnd, getTitle());
-
-	// localize controls
-	_DSX(BTN_OK,			DLG_OK);
-	_DSX(BTN_CANCEL,		DLG_Cancel);
-
-	SetDlgItemText(hWnd, AP_RID_DIALOG_LIST_REVISIONS_FRAME,getLabel1());
-
-	// set the column headings
-	HWND h = GetDlgItem(hWnd, AP_RID_DIALOG_LIST_REVISIONS_LIST);
-
-	LVCOLUMN col;
-	col.mask = LVCF_TEXT | LVCF_SUBITEM | LVCF_WIDTH;
-
-	col.iSubItem = 0;
-	col.cx = 80;
-
-	col.pszText = const_cast<char*>(getColumn1Label());
-	ListView_InsertColumn(h,0,&col);
-
-	col.iSubItem = 1;
-	col.cx = 160;
-	col.pszText = const_cast<char*>(getColumn2Label());
-	ListView_InsertColumn(h,1,&col);
-
-	col.iSubItem = 2;
-	col.cx = 230;
-	col.pszText = const_cast<char*>(getColumn3Label());
-	ListView_InsertColumn(h,2,&col);
-	
-	ListView_SetItemCount(h, getItemCount());
-
-	LVITEM item;
-	item.state = 0;
-	item.stateMask = 0;
-	item.iImage = 0;
-
-	char buf[35];
-	item.pszText = buf;
-	char * t;
-
-	for(UT_uint32 i = 0; i < getItemCount(); i++)
-	{
-		sprintf(buf,"%d",getNthItemId(i));
-		item.pszText = buf;
-		item.iItem = i;
-		item.iSubItem = 0;
-		item.lParam = getNthItemId(i);
-		item.mask = LVIF_TEXT | LVIF_PARAM;
-		ListView_InsertItem(h, &item);
-
-		item.iSubItem = 1;
-		item.pszText = const_cast<char *>(getNthItemTime(i));
-		item.mask = LVIF_TEXT;
-		ListView_SetItem(h, &item);
-		
-		item.iSubItem = 2;
-		t = getNthItemText(i);
-		item.pszText = t;
-		item.mask = LVIF_TEXT;
-		ListView_SetItem(h, &item);
-		FREEP(t);
-	}
 	
-	SendMessage(h, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT);  								
-	XAP_Win32DialogHelper::s_centerDialog(hWnd);	
 
 	return 1;							// 1 == we did not call SetFocus()
 }
 
 BOOL AP_Win32Dialog_ListRevisions::_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
-	WORD wId = LOWORD(wParam);
-
-	switch (wId)
-	{
-		case IDCANCEL:
-			m_answer = a_CANCEL;
-			EndDialog(hWnd,0);
-			return 1;
-
-		case IDOK:
-			{
-				HWND h = GetDlgItem(hWnd, AP_RID_DIALOG_LIST_REVISIONS_LIST);
-				int iSelCount = ListView_GetSelectedCount(h);
-				m_answer = a_OK;
-				if(iSelCount)
-				{
-					LVITEM item;
-
-					item.iSubItem = 0;
-					item.iItem = ListView_GetSelectionMark(h);
-					item.mask = LVIF_PARAM;
-					item.pszText = 0;
-					item.cchTextMax = 0;
-
-					ListView_GetItem(h,&item);
-
-					m_iId = item.lParam;
-				}
-				else
-					m_iId = 0;
-
-				EndDialog(hWnd,0);
-				return 1;
-			}
-
-		default:							// we did not handle this notification
-			UT_DEBUGMSG(("WM_Command for id %ld\n",wId));
-			return 0;						// return zero to let windows take care of it.
-	}
+	return 0;
 }
 
 
Index: src/wp/ap/win/ap_Win32Dialog_Lists.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Dialog_Lists.cpp,v
retrieving revision 1.50
diff -u -r1.50 ap_Win32Dialog_Lists.cpp
--- src/wp/ap/win/ap_Win32Dialog_Lists.cpp	7 Apr 2007 17:50:22 -0000	1.50
+++ src/wp/ap/win/ap_Win32Dialog_Lists.cpp	9 Apr 2007 08:37:50 -0000
@@ -631,119 +631,12 @@
 {
 	UT_return_if_fail (iType >= -1 && iType <=2);
 
-	const UT_sint32 idComboStyle = AP_RID_DIALOG_LIST_COMBO_STYLE;
 
-	_win32Dialog.resetComboContent(idComboStyle);
-
-	if (iType == -1 /* no combo selection */ ||
-		iType == 0 /* List Type "None" selected */)
-	{
-		return;
-	}
-
-	// Dare Fight Bloat. Put the data in a read-only data segment.
-	static const XAP_String_Id rgBulletIDs[] =
-	{
-		AP_STRING_ID_DLG_Lists_Bullet_List,
-		AP_STRING_ID_DLG_Lists_Dashed_List,
-		AP_STRING_ID_DLG_Lists_Square_List,
-		AP_STRING_ID_DLG_Lists_Triangle_List,
-		AP_STRING_ID_DLG_Lists_Diamond_List,
-		AP_STRING_ID_DLG_Lists_Star_List,
-		AP_STRING_ID_DLG_Lists_Implies_List,
-		AP_STRING_ID_DLG_Lists_Tick_List,
-		AP_STRING_ID_DLG_Lists_Box_List,
-		AP_STRING_ID_DLG_Lists_Hand_List,
-		AP_STRING_ID_DLG_Lists_Heart_List
-	};
-
-	static const XAP_String_Id rgNumberedIDs[] =
-	{
-		AP_STRING_ID_DLG_Lists_Numbered_List,
-		AP_STRING_ID_DLG_Lists_Lower_Case_List,
-		AP_STRING_ID_DLG_Lists_Upper_Case_List,
-		AP_STRING_ID_DLG_Lists_Lower_Roman_List,
-		AP_STRING_ID_DLG_Lists_Upper_Roman_List,
-		AP_STRING_ID_DLG_Lists_Arabic_List,
-		AP_STRING_ID_DLG_Lists_Hebrew_List
-	};
-
-	const XAP_String_Id*	pIDs;
-	size_t					nIDs;
-
-	switch (iType)
-	{
-		case 1:	// bullet list
-			pIDs = rgBulletIDs;
-			nIDs = NrElements(rgBulletIDs);
-			break;
-		case 2:	// numbered list
-			pIDs = rgNumberedIDs;
-			nIDs = NrElements(rgNumberedIDs);
-			break;
-	}
-
-	const XAP_StringSet * pSS = m_pApp->getStringSet();
-	UT_return_if_fail (pSS);	// TODO: Would an error handler be more appropriate here?
-
-	HWND hComboStyle = GetDlgItem(m_hThisDlg, AP_RID_DIALOG_LIST_COMBO_STYLE);
-	UT_return_if_fail (hComboStyle);
-	int nMaxWidth = 0;
-
-	// Get the HDC of the droplist to be able to get the
-	// width of each of the strings.
-	HDC hDCcombo = GetDC(hComboStyle);
-	HDC hDC = CreateCompatibleDC(hDCcombo);
-	ReleaseDC(hComboStyle, hDCcombo);
-
-	HFONT hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
-	SelectObject(hDC, hFont);
-
-	for (size_t i = 0; i < nIDs; ++i)
-	{
-		LPCSTR psz = pSS->getValue(pIDs[i]);
-		_win32Dialog.addItemToCombo(idComboStyle, psz);
-
-		if (hDC)
-		{
-			SIZE size;
-			::GetTextExtentPoint32(hDC, psz, strlen(psz), &size);
-			if (size.cx > nMaxWidth)
-			{
-				nMaxWidth = size.cx;
-			}
-		}
-	}
-
-	DeleteDC(hDC);
-
-	if (nMaxWidth > 50 && nMaxWidth < 500 /* sanity check*/)
-	{
-		SendMessage(hComboStyle, CB_SETDROPPEDWIDTH,
-					(WPARAM)nMaxWidth + 8, 0);
-	}
 }
 
 void AP_Win32Dialog_Lists::_fillFoldingList()
 {
-	const XAP_StringSet * pSS = m_pApp->getStringSet();
 
-	UT_return_if_fail (pSS);	// TODO: Would an error handler be more appropriate here?
-
-	static const XAP_String_Id rgIDs[] =
-	{
-		AP_STRING_ID_DLG_Lists_FoldingLevel0,
-		AP_STRING_ID_DLG_Lists_FoldingLevel1,
-		AP_STRING_ID_DLG_Lists_FoldingLevel2,
-		AP_STRING_ID_DLG_Lists_FoldingLevel3,
-		AP_STRING_ID_DLG_Lists_FoldingLevel4
-	};
-
-	for (int i = 0; i < NrElements(rgIDs); ++i)
-	{
-		_win32Dialog.addItemToCombo(AP_RID_DIALOG_LIST_COMBO_FOLDING,
-									pSS->getValue(rgIDs[i]));
-	}
 }
 
 void AP_Win32Dialog_Lists::_typeChanged()
@@ -833,7 +726,7 @@
 void AP_Win32Dialog_Lists::_updateCaption()
 {
 	ConstructWindowName();
-	_win32Dialog.setDialogTitle((LPCSTR)(AP_Win32App::s_fromUTF8ToWinLocale( getWindowName())).c_str());	
+//	_win32Dialog.setDialogTitle((LPCSTR)(AP_Win32App::s_fromUTF8ToWinLocale( getWindowName())).c_str());	
 }
 
 void AP_Win32Dialog_Lists::_previewExposed()
Index: src/wp/ap/win/ap_Win32Dialog_MailMerge.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Dialog_MailMerge.cpp,v
retrieving revision 1.11
diff -u -r1.11 ap_Win32Dialog_MailMerge.cpp
--- src/wp/ap/win/ap_Win32Dialog_MailMerge.cpp	16 Jan 2007 23:16:27 -0000	1.11
+++ src/wp/ap/win/ap_Win32Dialog_MailMerge.cpp	9 Apr 2007 08:37:50 -0000
@@ -123,118 +123,19 @@
 BOOL AP_Win32Dialog_MailMerge::_onInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {		
 	
-	
-	const XAP_StringSet * pSS = m_pApp->getStringSet();
-	
-	// Localise Controls
-	_DS(STATIC_AVAIL,	DLG_MailMerge_AvailableFields);		
-	_DS(STATIC_FIELD,	DLG_MailMerge_Insert_No_Colon);		
-	_DS(BTN_OPEN,		DLG_MailMerge_OpenFile);		
-	_DS(BTN_INSERT,		DLG_InsertButton);		
-	_DSX(BTN_CLOSE,		DLG_Close);				
-	
-	SetWindowText(hWnd, pSS->getValue(AP_STRING_ID_DLG_MailMerge_MailMergeTitle));	
-	
-	XAP_Win32DialogHelper::s_centerDialog(hWnd);	
-	
-	SetFocus(GetDlgItem(hWnd,AP_RID_DIALOG_MAILMERGE_BTN_CLOSE));
+
 	return 0; // 0 because we called SetFocus
 }
 
 BOOL AP_Win32Dialog_MailMerge::_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
-	WORD wNotifyCode = HIWORD(wParam);
-	WORD wId = LOWORD(wParam);
-	HWND hWndCtrl = (HWND)lParam;
-
-	switch (wId)
-	{
-		case AP_RID_DIALOG_MAILMERGE_LISTBOX:
-		if (HIWORD(wParam)==LBN_DBLCLK)
-		{
-			char szBuff[255];
-			int nItem = SendMessage(GetDlgItem(m_hwndDlg, AP_RID_DIALOG_MAILMERGE_LISTBOX), LB_GETCURSEL, 0, 0);
-			
-			if (nItem!=LB_ERR)
-			{	
-				SendMessage(GetDlgItem(m_hwndDlg, AP_RID_DIALOG_MAILMERGE_LISTBOX), LB_GETTEXT, nItem,  (LPARAM)szBuff);			
-				setMergeField(szBuff);			
-				addClicked();
-			}
-			return 1;
-		}
-		else
-		{
-			return 0;
-		}
-		
-		case AP_RID_DIALOG_MAILMERGE_BTN_INSERT:		
-		{	
-			char szBuff[255];
-			
-			int nChars = GetDlgItemText(m_hwndDlg,  AP_RID_DIALOG_MAILMERGE_EDIT_FIELD, szBuff, 255);
-			if (nChars > 0)
-			{
-				setMergeField(szBuff);
-				addClicked();
-			} 
-			else
-			{
-				char szBuff[255];
-				int nItem = SendMessage(GetDlgItem(m_hwndDlg, AP_RID_DIALOG_MAILMERGE_LISTBOX), LB_GETCURSEL, 0, 0);
-			
-				if (nItem!=LB_ERR)
-				{	
-					SendMessage(GetDlgItem(m_hwndDlg, AP_RID_DIALOG_MAILMERGE_LISTBOX), LB_GETTEXT, nItem,  (LPARAM)szBuff);			
-					setMergeField(szBuff);			
-					addClicked();
-				}				 
-			}
-
-			return 1;
-		}
-		
-		case AP_RID_DIALOG_MAILMERGE_BTN_OPEN:		
-		{			
-			eventOpen();
-			SetFocus(m_hwndDlg);
-			return 1;
-		}	
-				
-		case AP_RID_DIALOG_MAILMERGE_BTN_CLOSE:		
-		case IDCANCEL:		// We want to close button work
-		{			
-			destroy();
-			return 1;
-		}	
-		
-		default:							// we did not handle this notification
-			UT_DEBUGMSG(("WM_Command for id %ld\n",wId));
-			return 0;						// return zero to let windows take care of it.
-	}
+	return 0;
 }
 
 
 void AP_Win32Dialog_MailMerge::setFieldList()
 {
-	if(!m_vecFields.size())	return;	
 
-	UT_uint32 i;
-	UT_UTF8String * str;
-	UT_String	sAnsi;
-	
-	SendMessage(GetDlgItem(m_hwndDlg, AP_RID_DIALOG_MAILMERGE_LISTBOX), LB_RESETCONTENT,	0, 0);
-		
- 	// build a list of all items
-    for (i = 0; i < m_vecFields.size(); i++)
-	{
-		str = (UT_UTF8String*)m_vecFields[i];
-		sAnsi = 	AP_Win32App::s_fromUTF8ToWinLocale(str->utf8_str());
-		
-		SendMessage(GetDlgItem(m_hwndDlg, AP_RID_DIALOG_MAILMERGE_LISTBOX), LB_ADDSTRING,
-			0, (LPARAM)sAnsi.c_str());
-	}
-	
 }
 
 void AP_Win32Dialog_MailMerge::destroy(void)
Index: src/wp/ap/win/ap_Win32Dialog_MarkRevisions.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Dialog_MarkRevisions.cpp,v
retrieving revision 1.11
diff -u -r1.11 ap_Win32Dialog_MarkRevisions.cpp
--- src/wp/ap/win/ap_Win32Dialog_MarkRevisions.cpp	7 Apr 2007 17:50:22 -0000	1.11
+++ src/wp/ap/win/ap_Win32Dialog_MarkRevisions.cpp	9 Apr 2007 08:37:51 -0000
@@ -57,111 +57,19 @@
 
 void AP_Win32Dialog_MarkRevisions::runModal(XAP_Frame * pFrame)
 {
-	UT_return_if_fail (pFrame);
-	// raise the dialog
-	XAP_Win32App * pWin32App = static_cast<XAP_Win32App *>(m_pApp);
-
-	XAP_Win32LabelledSeparator_RegisterClass(pWin32App);
-
-	LPCTSTR lpTemplate = NULL;
-
-	UT_return_if_fail (m_id == AP_DIALOG_ID_MARK_REVISIONS);
-
-	lpTemplate = MAKEINTRESOURCE(AP_RID_DIALOG_MARK_REVISIONS);
-
-	int result = DialogBoxParam(pWin32App->getInstance(),lpTemplate,
-						static_cast<XAP_Win32FrameImpl*>(pFrame->getFrameImpl())->getTopLevelWindow(),
-						(DLGPROC)s_dlgProc,(LPARAM)this);
-	UT_ASSERT_HARMLESS((result != -1));
-	if(result == -1)
-		UT_DEBUGMSG(( "AP_Win32Dialog_MarkRevisions::runModal error %d\n", GetLastError() ));
-
+	
 }
 
 BOOL CALLBACK AP_Win32Dialog_MarkRevisions::s_dlgProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
 {
-	// This is a static function.
-
-	AP_Win32Dialog_MarkRevisions * pThis;
-
-	switch (msg)
-	{
-	case WM_INITDIALOG:
-		pThis = (AP_Win32Dialog_MarkRevisions *)lParam;
-		SetWindowLong(hWnd,DWL_USER,lParam);
-		return pThis->_onInitDialog(hWnd,wParam,lParam);
-
-	case WM_COMMAND:
-		pThis = (AP_Win32Dialog_MarkRevisions *)GetWindowLong(hWnd,DWL_USER);
-		return pThis->_onCommand(hWnd,wParam,lParam);
-
-	default:
-		return 0;
-	}
+	return 0;
 }
 
 #define _DSX(c,s)	SetDlgItemText(hWnd,AP_RID_DIALOG_MARK_REVISIONS_##c,pSS->getValue(XAP_STRING_ID_##s))
 
 BOOL AP_Win32Dialog_MarkRevisions::_onInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
-	const XAP_StringSet * pSS = m_pApp->getStringSet();
-
-	SetWindowText(hWnd, getTitle());
-
-	// localize controls
-	_DSX(BTN_OK,			DLG_OK);
-	_DSX(BTN_CANCEL,		DLG_Cancel);
-
-	char * pStr = getRadio1Label();
-	if(pStr)
-	{
-		SetDlgItemText(hWnd, AP_RID_DIALOG_MARK_REVISIONS_RADIO1,pStr);
-		FREEP(pStr);
-
-		CheckDlgButton(hWnd, AP_RID_DIALOG_MARK_REVISIONS_RADIO1,BST_CHECKED);
-		HWND h = GetDlgItem(hWnd,AP_RID_DIALOG_MARK_REVISIONS_RADIO1);
-		SetFocus(h);
-
-		pStr = getComment1();
-		SetDlgItemText(hWnd, AP_RID_DIALOG_MARK_REVISIONS_LABEL1,pStr);
-		FREEP(pStr);
-
-		SetDlgItemText(hWnd, AP_RID_DIALOG_MARK_REVISIONS_RADIO2,getRadio2Label());
-
-		//disable the edit box
-		h = GetDlgItem(hWnd,AP_RID_DIALOG_MARK_REVISIONS_EDIT2);
-		EnableWindow(h, FALSE);
-	}
-	else
-	{
-		// there are no exising revisions in this doc, so we hide
-		// everything but the edit control
-		HWND h = GetDlgItem(hWnd,AP_RID_DIALOG_MARK_REVISIONS_RADIO1);
-		ShowWindow(h,SW_HIDE);
-
-		h = GetDlgItem(hWnd,AP_RID_DIALOG_MARK_REVISIONS_RADIO2);
-		ShowWindow(h,SW_HIDE);
-
-		h = GetDlgItem(hWnd,AP_RID_DIALOG_MARK_REVISIONS_LABEL1);
-		ShowWindow(h,SW_HIDE);
-
-		h = GetDlgItem(hWnd,AP_RID_DIALOG_MARK_REVISIONS_EDIT2);
-		EnableWindow(h, TRUE);
-
-		//move the edit control and its label higher up
-		SetWindowPos(h,0,30,80,0,0,SWP_NOOWNERZORDER | SWP_NOSIZE | SWP_NOZORDER);
-		SetFocus(h);
-
-		h = GetDlgItem(hWnd,AP_RID_DIALOG_MARK_REVISIONS_LABEL2);
-		SetWindowPos(h,0,30,60,0,0,SWP_NOOWNERZORDER | SWP_NOSIZE | SWP_NOZORDER);
-
-
-	}
-
-	SetDlgItemText(hWnd, AP_RID_DIALOG_MARK_REVISIONS_LABEL2,getComment2Label());
-
-
-	XAP_Win32DialogHelper::s_centerDialog(hWnd);	
+	
 
 	return 0;							// 1 == we did not call SetFocus()
 }
@@ -181,55 +89,9 @@
 
 BOOL AP_Win32Dialog_MarkRevisions::_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
-	WORD wId = LOWORD(wParam);
-	HWND h;
-
-	int n;
+	
+	return 0;						// return zero to let windows take care of it.
 
-	switch (wId)
-	{
-	case IDCANCEL:
-		m_answer = a_CANCEL;
-		EndDialog(hWnd,0);
-		return 1;
-
-	case IDOK:
-		n = _getRBOffset(hWnd,
-						 AP_RID_DIALOG_MARK_REVISIONS_RADIO1,
-						 AP_RID_DIALOG_MARK_REVISIONS_RADIO2);
-
-		//UT_ASSERT(n >= 0);
-
-		if(n == 1 || n == -1)
-		{
-			// get the text from the edit control
-			char text[200];
-			GetDlgItemText(hWnd, AP_RID_DIALOG_MARK_REVISIONS_EDIT2, text, 200);
-			setComment2(text);
-		}
-
-		m_answer = a_OK;
-
-		EndDialog(hWnd,0);
-		return 1;
-
-	case AP_RID_DIALOG_MARK_REVISIONS_RADIO1:
-		// disable the edit box
-		h = GetDlgItem(hWnd,AP_RID_DIALOG_MARK_REVISIONS_EDIT2);
-		EnableWindow(h, FALSE);
-		return 0;
-
-	case AP_RID_DIALOG_MARK_REVISIONS_RADIO2:
-		// enable the edit box
-		h = GetDlgItem(hWnd,AP_RID_DIALOG_MARK_REVISIONS_EDIT2);
-		EnableWindow(h, TRUE);
-		SetFocus(h);
-		return 0;
-
-	default:							// we did not handle this notification
-		UT_DEBUGMSG(("WM_Command for id %ld\n",wId));
-		return 0;						// return zero to let windows take care of it.
-	}
 }
 
 
Index: src/wp/ap/win/ap_Win32Dialog_MergeCells.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Dialog_MergeCells.cpp,v
retrieving revision 1.15
diff -u -r1.15 ap_Win32Dialog_MergeCells.cpp
--- src/wp/ap/win/ap_Win32Dialog_MergeCells.cpp	7 Apr 2007 17:50:22 -0000	1.15
+++ src/wp/ap/win/ap_Win32Dialog_MergeCells.cpp	9 Apr 2007 08:37:51 -0000
@@ -69,34 +69,7 @@
 
 void AP_Win32Dialog_MergeCells::runModeless(XAP_Frame * pFrame)
 {
-	// raise the dialog
-	int iResult;
-	XAP_Win32App * pWin32App = static_cast<XAP_Win32App *>(m_pApp);
-
-	LPCTSTR lpTemplate = NULL;
-
-	UT_return_if_fail (m_id == AP_DIALOG_ID_MERGE_CELLS);
-
-	lpTemplate = MAKEINTRESOURCE(AP_RID_DIALOG_MERGECELLS);
-
-	HWND hResult = CreateDialogParam(pWin32App->getInstance(),lpTemplate,
-							static_cast<XAP_Win32FrameImpl*>(pFrame->getFrameImpl())->getTopLevelWindow(),
-							(DLGPROC)s_dlgProc,(LPARAM)this);
-	UT_ASSERT_HARMLESS((hResult != NULL));
-
-	m_hwndDlg = hResult;
-
-	// Save dialog the ID number and pointer to the widget
-	UT_sint32 sid =(UT_sint32)  getDialogId();
-	m_pApp->rememberModelessId( sid, (XAP_Dialog_Modeless *) m_pDialog);
-
-	iResult = ShowWindow( m_hwndDlg, SW_SHOW );
-
-	iResult = BringWindowToTop( m_hwndDlg );
-
-	startUpdater();
-
-	UT_ASSERT_HARMLESS((iResult != 0));
+	
 
 }
 
@@ -104,26 +77,7 @@
 {		
 	AP_Win32Dialog_MergeCells * pThis;
 	
-	switch (msg)
-	{
-	case WM_INITDIALOG:
-		pThis = (AP_Win32Dialog_MergeCells *)lParam;
-		SWL(hWnd,lParam);
-		return pThis->_onInitDialog(hWnd,wParam,lParam);
-
-	case WM_COMMAND:
-		pThis = GWL(hWnd);
-		return pThis->_onCommand(hWnd,wParam,lParam);
-
-	case WM_DESTROY:
-		pThis = GWL(hWnd);
-		if(pThis)
-			pThis->destroy();
-		return 0;
-
-	default:
-		return 0;
-	}
+	return 0;
 }
 #define _DS(c,s)	SetDlgItemText(hWnd,AP_RID_DIALOG_MERGECELLS_##c,pSS->getValue(AP_STRING_ID_##s))
 #define _DSX(c,s)	SetDlgItemText(hWnd,AP_RID_DIALOG_MERGECELLS_##c,pSS->getValue(XAP_STRING_ID_##s))
@@ -146,42 +100,7 @@
 {	
 	HDC hdc;
 	int x, y;	
-	RECT rect;
-	DWORD dwColor = GetSysColor(COLOR_BTNFACE);	
-	UT_RGBColor Color(GetRValue(dwColor),GetGValue(dwColor),GetBValue(dwColor));
-	const XAP_StringSet * pSS = m_pApp->getStringSet();
-	
-	m_hwndDlg = hWnd;
-
-	// localise controls 		
-	_DS(TEXT_LEFT,		DLG_MergeCells_Left);		
-	_DS(TEXT_RIGHT,		DLG_MergeCells_Right);		
-	_DS(TEXT_ABOVE,		DLG_MergeCells_Above);		
-	_DS(TEXT_BELOW,		DLG_MergeCells_Below);		
-	_DS(TEXT_FRAME,		DLG_MergeCells_Frame);		
-	_DSX(BTN_CANCEL,	DLG_Close);				
-				
-	// Localise caption
-	ConstructWindowName();
-	SetWindowText(m_hwndDlg, m_WindowName);
 
-	// The four items are the same size
-	GetClientRect(GetDlgItem(hWnd, AP_RID_DIALOG_MERGECELLS_BMP_LEFT), &rect);			
-		
-	hdc = GetDC(hWnd);
-	x = rect.right - rect.left,
-	y = rect.bottom - rect.top,
-	
-	// Load the bitmaps into the dialog box								
-    m_hBitmapLeft = _loadBitmap(hWnd,AP_RID_DIALOG_MERGECELLS_BMP_LEFT, "MERGELEFT",  x, y, Color);
-    m_hBitmapRight = _loadBitmap(hWnd,AP_RID_DIALOG_MERGECELLS_BMP_RIGHT, "MERGERIGHT", x, y, Color);
-    m_hBitmapAbove = _loadBitmap(hWnd,AP_RID_DIALOG_MERGECELLS_BMP_ABOVE, "MERGEABOVE", x, y, Color);
-    m_hBitmapBelow = _loadBitmap(hWnd,AP_RID_DIALOG_MERGECELLS_BMP_BELOW, "MERGEBELOW", x, y, Color);
-	
-	setAllSensitivities();
-	XAP_Win32DialogHelper::s_centerDialog(hWnd);	
-	
-	SetFocus(GetDlgItem(hWnd,AP_RID_DIALOG_MERGECELLS_BTN_CANCEL));
 	return 0; // 0 because we called SetFocus
 }
 
@@ -189,28 +108,7 @@
 
 void AP_Win32Dialog_MergeCells::setSensitivity(AP_Dialog_MergeCells::mergeWithCell mergeThis, bool bSens)
 {
-	switch(mergeThis)
-	{
-	case AP_Dialog_MergeCells::radio_left:
-		EnableWindow(GetDlgItem(m_hwndDlg, AP_RID_DIALOG_MERGECELLS_BMP_LEFT), bSens);
-		EnableWindow(GetDlgItem(m_hwndDlg, AP_RID_DIALOG_MERGECELLS_TEXT_LEFT), bSens);
-		break;
-		
-	case AP_Dialog_MergeCells::radio_right:
-		EnableWindow(GetDlgItem(m_hwndDlg, AP_RID_DIALOG_MERGECELLS_BMP_RIGHT), bSens);
-		EnableWindow(GetDlgItem(m_hwndDlg, AP_RID_DIALOG_MERGECELLS_TEXT_RIGHT), bSens);
-		break;	
-	case AP_Dialog_MergeCells::radio_above:
-		EnableWindow(GetDlgItem(m_hwndDlg, AP_RID_DIALOG_MERGECELLS_BMP_ABOVE), bSens);
-		EnableWindow(GetDlgItem(m_hwndDlg, AP_RID_DIALOG_MERGECELLS_TEXT_ABOVE), bSens);
-		break;
-	case AP_Dialog_MergeCells::radio_below:
-		EnableWindow(GetDlgItem(m_hwndDlg, AP_RID_DIALOG_MERGECELLS_BMP_BELOW), bSens);
-		EnableWindow(GetDlgItem(m_hwndDlg, AP_RID_DIALOG_MERGECELLS_TEXT_BELOW), bSens);
-		break;		
-	default:
-		break;
-	}
+
 
 }
 
@@ -223,61 +121,15 @@
 
 void AP_Win32Dialog_MergeCells::notifyActiveFrame(XAP_Frame *pFrame)
 {
-	if((HWND)GetWindowLong(m_hwndDlg, GWL_HWNDPARENT) != static_cast<XAP_Win32FrameImpl*>(pFrame->getFrameImpl())->getTopLevelWindow())
-	{
-		ConstructWindowName();
-		SetWindowText(m_hwndDlg, m_WindowName);
-
-		SetWindowLong(m_hwndDlg, GWL_HWNDPARENT, (long)static_cast<XAP_Win32FrameImpl*>(pFrame->getFrameImpl())->getTopLevelWindow());
-		SetWindowPos(m_hwndDlg, NULL, 0, 0, 0, 0,
-						SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
-	}
+
 	setAllSensitivities();
 }
 
 BOOL AP_Win32Dialog_MergeCells::_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
-	WORD wId = LOWORD(wParam);
 
-	switch (wId)
-	{
-		case AP_RID_DIALOG_MERGECELLS_BMP_LEFT:		
-		{	
-			setMergeType(AP_Dialog_MergeCells::radio_left);
-			onMerge();
-			return 1;
-		}
-		
-		case AP_RID_DIALOG_MERGECELLS_BMP_RIGHT:		
-		{	
-			setMergeType(AP_Dialog_MergeCells::radio_right);
-			onMerge();
-			return 1;
-		}
-		
-		case AP_RID_DIALOG_MERGECELLS_BMP_ABOVE:		
-		{	
-			setMergeType(AP_Dialog_MergeCells::radio_above);
-			onMerge();
-			return 1;
-		}
-		case AP_RID_DIALOG_MERGECELLS_BMP_BELOW:		
-		{	
-			setMergeType(AP_Dialog_MergeCells::radio_below);
-			onMerge();
-			return 1;
-		}		
-		
-		case AP_RID_DIALOG_MERGECELLS_BTN_CANCEL:						
-		case IDCANCEL:		// We want to close button work
-			m_answer = a_CANCEL; 						
-			destroy();
-			return 1;
-			
-		default:							// we did not handle this notification
-			UT_DEBUGMSG(("WM_Command for id %ld\n",wId));
-			return 0;						// return zero to let windows take care of it.
-	}
+	return 0;	
+
 }
 
 
@@ -292,7 +144,7 @@
 void AP_Win32Dialog_MergeCells::activate(void)
 {
 	ConstructWindowName();
-	SetWindowText(m_hwndDlg, m_WindowName);
+	
 
 	setAllSensitivities();
 }
Index: src/wp/ap/win/ap_Win32Dialog_MetaData.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Dialog_MetaData.cpp,v
retrieving revision 1.14
diff -u -r1.14 ap_Win32Dialog_MetaData.cpp
--- src/wp/ap/win/ap_Win32Dialog_MetaData.cpp	16 Jan 2007 23:16:27 -0000	1.14
+++ src/wp/ap/win/ap_Win32Dialog_MetaData.cpp	9 Apr 2007 08:37:51 -0000
@@ -46,14 +46,16 @@
 
 const char* fromUTF8toWinLocale(const char* szIn)
 {
-	sRslt =	AP_Win32App::s_fromUTF8ToWinLocale(szIn);
-	return sRslt.c_str();
+	//sRslt =	AP_Win32App::s_fromUTF8ToWinLocale(szIn);
+	//return sRslt.c_str();
+	return NULL;
 }
 
 const char* fromWinLocaletoUTF8(const char* szIn)
 {
-	sRsltUTF8 = AP_Win32App::s_fromWinLocaleToUTF8(szIn);				
-	return sRsltUTF8.utf8_str();
+	//sRsltUTF8 = AP_Win32App::s_fromWinLocaleToUTF8(szIn);				
+	//7return sRsltUTF8.utf8_str();
+	return NULL;
 }
 
 
@@ -79,37 +81,7 @@
 
 void AP_Win32Dialog_MetaData::runModal(XAP_Frame * pFrame)
 {
-	UT_return_if_fail (pFrame);	
-	XAP_Win32App * pWin32App = static_cast<XAP_Win32App *>(XAP_App::getApp());	
-		
-	XAP_Win32PropertySheet				sheet;
-	AP_Win32Dialog_MetaData_General		general;
-	AP_Win32Dialog_MetaData_Summary		summary;
-	AP_Win32Dialog_MetaData_Permissions	permissions;	
-	
-	general.setContainer(this);	
-	general.createPage(pWin32App, AP_RID_DIALOG_META_GENERAL, AP_STRING_ID_DLG_MetaData_TAB_General);	
-	sheet.addPage(&general);		
-    
-    summary.setContainer(this);	
-    summary.createPage(pWin32App, AP_RID_DIALOG_META_SUMMARY, AP_STRING_ID_DLG_MetaData_TAB_Summary);	
-	sheet.addPage(&summary);			
-	
-	permissions.setContainer(this);	
-	permissions.createPage(pWin32App, AP_RID_DIALOG_META_PERMISSIONS, AP_STRING_ID_DLG_MetaData_TAB_Permission);	
-	sheet.addPage(&permissions);				
-    
-	int nRslt = sheet.runModal(pWin32App, pFrame, AP_STRING_ID_DLG_MetaData_Title);
-	
-	if (nRslt==IDOK)
-	{
-		general.transferData();
-		summary.transferData();
-		permissions.transferData();
-		setAnswer ( AP_Dialog_MetaData::a_OK);		
-	}		
-	else
-		setAnswer ( AP_Dialog_MetaData::a_CANCEL);		
+
 	
 }
 
@@ -134,43 +106,12 @@
 */	
 void AP_Win32Dialog_MetaData_General::_onInitDialog()
 {				
-	const XAP_StringSet * pSS = getApp()->getStringSet();		
-	
-	control_id_string_id rgMapping[] =
-	{						 
-		{AP_RID_DIALOG_META_GENERAL_TEXT_TITLE,			AP_STRING_ID_DLG_MetaData_Title_LBL},
-		{AP_RID_DIALOG_META_GENERAL_TEXT_SUBJECT,		AP_STRING_ID_DLG_MetaData_Subject_LBL},
-		{AP_RID_DIALOG_META_GENERAL_TEXT_AUTHOR,		AP_STRING_ID_DLG_MetaData_Author_LBL},
-		{AP_RID_DIALOG_META_GENERAL_TEXT_PUBLISHER,		AP_STRING_ID_DLG_MetaData_Publisher_LBL},
-		{AP_RID_DIALOG_META_GENERAL_TEXT_CONTRIBUTOR,	AP_STRING_ID_DLG_MetaData_CoAuthor_LBL},			
-		{NULL,NULL}
-	};		
-	
-	// Localise the controls
-	for (int i = 0; i < rgMapping[i].controlId; i++)		
-		SetDlgItemText(getHandle(), rgMapping[i].controlId, pSS->getValue(rgMapping[i].stringId));						
-	
-	// Setup previous text	
-	SetDlgItemText(getHandle(), AP_RID_DIALOG_META_GENERAL_EDIT_TITLE,			fromUTF8toWinLocale(getContainer()->getTitle().utf8_str()));									
-	SetDlgItemText(getHandle(), AP_RID_DIALOG_META_GENERAL_EDIT_SUBJECT,		fromUTF8toWinLocale(getContainer()->getSubject().utf8_str()));									
-	SetDlgItemText(getHandle(), AP_RID_DIALOG_META_GENERAL_EDIT_AUTHOR,			fromUTF8toWinLocale(getContainer()->getAuthor().utf8_str()));									
-	SetDlgItemText(getHandle(), AP_RID_DIALOG_META_GENERAL_EDIT_PUBLISHER,		fromUTF8toWinLocale(getContainer()->getPublisher().utf8_str()));									
-	SetDlgItemText(getHandle(), AP_RID_DIALOG_META_GENERAL_EDIT_CONTRIBUTOR,	fromUTF8toWinLocale(getContainer()->getCoAuthor().utf8_str()));									
-	
-	
-	HWND hParent = GetParent(getHandle());						
-	SetDlgItemText(hParent, IDOK, pSS->getValue(XAP_STRING_ID_DLG_OK));
-	SetDlgItemText(hParent, IDCANCEL, pSS->getValue(XAP_STRING_ID_DLG_Cancel));				
-	
-	XAP_Win32DialogHelper::s_centerDialog(hParent);							
+
 }
 
 char* AP_Win32Dialog_MetaData_General::_get_text(XAP_String_Id nID, char *szBuff, int nSize)
 {
-	*szBuff=0;
-	 GetDlgItemText(getHandle(), nID, szBuff, nSize); 
-	 strcpy (szBuff, (AP_Win32App::s_fromWinLocaleToUTF8(szBuff)).utf8_str());
-	 return szBuff;
+	return NULL;
 }
 
 /*
@@ -178,13 +119,7 @@
 */
 void AP_Win32Dialog_MetaData_General::_onOK()
 {	
-	char szBuff[1024];
 
-	m_sTitle = 	_get_text(AP_RID_DIALOG_META_GENERAL_EDIT_TITLE, szBuff, sizeof(szBuff));
-	m_sSubject = _get_text(AP_RID_DIALOG_META_GENERAL_EDIT_SUBJECT, szBuff, sizeof(szBuff));
-	m_sAuthor =  _get_text(AP_RID_DIALOG_META_GENERAL_EDIT_AUTHOR, szBuff, sizeof(szBuff));
-	m_sPublisher = _get_text(AP_RID_DIALOG_META_GENERAL_EDIT_PUBLISHER, szBuff, sizeof(szBuff));
-	m_sCoAuthor = _get_text(AP_RID_DIALOG_META_GENERAL_EDIT_CONTRIBUTOR, szBuff, sizeof(szBuff));	
 }
 
 /*
@@ -221,36 +156,13 @@
 */	
 void AP_Win32Dialog_MetaData_Summary::_onInitDialog()
 {		
-	const XAP_StringSet * pSS = getApp()->getStringSet();
 	
-	control_id_string_id rgMapping[] =
-	{						 
-		{AP_RID_DIALOG_META_SUMMARY_TEXT_KEYWORDS,		AP_STRING_ID_DLG_MetaData_Keywords_LBL},
-		{AP_RID_DIALOG_META_SUMMARY_TEXT_LANGUAGE,		AP_STRING_ID_DLG_MetaData_Languages_LBL},			
-		{AP_RID_DIALOG_META_SUMMARY_TEXT_CATEGORY,		AP_STRING_ID_DLG_MetaData_Category_LBL},     
-		{AP_RID_DIALOG_META_SUMMARY_TEXT_DESCRIPTION,	AP_STRING_ID_DLG_MetaData_Description_LBL},     
-		
-		{NULL,NULL}
-	};		
-	
-	// Localise the controls
-	for (int i = 0; i < rgMapping[i].controlId; i++)		
-		SetDlgItemText(getHandle(), rgMapping[i].controlId, pSS->getValue(rgMapping[i].stringId));				
-
-	// Setup previous text	
-	SetDlgItemText(getHandle(), AP_RID_DIALOG_META_SUMMARY_EDIT_CATEGORY,		fromUTF8toWinLocale(getContainer()->getCategory().utf8_str()));									
-	SetDlgItemText(getHandle(), AP_RID_DIALOG_META_SUMMARY_EDIT_KEYWORDS,		fromUTF8toWinLocale(getContainer()->getKeywords().utf8_str()));									
-	SetDlgItemText(getHandle(), AP_RID_DIALOG_META_SUMMARY_EDIT_LANGUAGE,		fromUTF8toWinLocale(getContainer()->getLanguages().utf8_str()));									
-	SetDlgItemText(getHandle(), AP_RID_DIALOG_META_SUMMARY_EDIT_DESCRIPTION,	fromUTF8toWinLocale(getContainer()->getDescription().utf8_str()));									
 
 }
 
 char* AP_Win32Dialog_MetaData_Summary::_get_text(XAP_String_Id nID, char *szBuff, int nSize)
 {
-	*szBuff=0;
-	 GetDlgItemText(getHandle(), nID, szBuff, nSize); 
-	 strcpy (szBuff, (AP_Win32App::s_fromWinLocaleToUTF8(szBuff)).utf8_str());
-	 return szBuff;
+	return 0;
 }
 
 
@@ -259,12 +171,7 @@
 */
 void AP_Win32Dialog_MetaData_Summary::_onOK()
 {	
-	char szBuff[4096];	// description can be long
-
-	m_sCategory = 	_get_text(AP_RID_DIALOG_META_SUMMARY_EDIT_CATEGORY, szBuff, sizeof(szBuff));
-	m_sKeywords = _get_text(AP_RID_DIALOG_META_SUMMARY_EDIT_KEYWORDS, szBuff, sizeof(szBuff));
-	m_sLanguages =  _get_text(AP_RID_DIALOG_META_SUMMARY_EDIT_LANGUAGE, szBuff, sizeof(szBuff));
-	m_sDescription = _get_text(AP_RID_DIALOG_META_SUMMARY_EDIT_DESCRIPTION, szBuff, sizeof(szBuff));
+	
 }
 
 /*
@@ -300,26 +207,7 @@
 */	
 void AP_Win32Dialog_MetaData_Permissions::_onInitDialog()
 {				
-	const XAP_StringSet * pSS = getApp()->getStringSet();
 	
-	control_id_string_id rgMapping[] =
-	{	
-		{AP_RID_DIALOG_META_PERMISSIONS_TEXT_SOURCE,	AP_STRING_ID_DLG_MetaData_Source_LBL},
-		{AP_RID_DIALOG_META_PERMISSIONS_TEXT_RELATION,	AP_STRING_ID_DLG_MetaData_Relation_LBL},
-		{AP_RID_DIALOG_META_PERMISSIONS_TEXT_COVERAGE,	AP_STRING_ID_DLG_MetaData_Coverage_LBL},
-		{AP_RID_DIALOG_META_PERMISSIONS_TEXT_RIGHTS,	AP_STRING_ID_DLG_MetaData_Rights_LBL},     			
-		{NULL,NULL}
-	};		
-	
-	// Localise the controls
-	for (int i = 0; i < rgMapping[i].controlId; i++)		
-		SetDlgItemText(getHandle(), rgMapping[i].controlId, pSS->getValue(rgMapping[i].stringId));				
-
-	// Setup previous text	
-	SetDlgItemText(getHandle(), AP_RID_DIALOG_META_PERMISSIONS_EDIT_SOURCE,		fromUTF8toWinLocale(getContainer()->getSource().utf8_str()));											
-	SetDlgItemText(getHandle(), AP_RID_DIALOG_META_PERMISSIONS_EDIT_RELATION,	fromUTF8toWinLocale(getContainer()->getRelation().utf8_str()));											
-	SetDlgItemText(getHandle(), AP_RID_DIALOG_META_PERMISSIONS_EDIT_COVERAGE,	fromUTF8toWinLocale(getContainer()->getCoverage().utf8_str()));											
-	SetDlgItemText(getHandle(), AP_RID_DIALOG_META_PERMISSIONS_EDIT_RIGHTS,		fromUTF8toWinLocale(getContainer()->getRights().utf8_str()));									
 
 }												
 
@@ -352,8 +240,5 @@
 
 char* AP_Win32Dialog_MetaData_Permissions::_get_text(XAP_String_Id nID, char *szBuff, int nSize)
 {
-	 *szBuff=0;
-	 GetDlgItemText(getHandle(), nID, szBuff, nSize); 
-	 strcpy (szBuff, (AP_Win32App::s_fromWinLocaleToUTF8(szBuff)).utf8_str());
-	 return szBuff;
+	return NULL;
 }
Index: src/wp/ap/win/ap_Win32Dialog_New.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Dialog_New.cpp,v
retrieving revision 1.18
diff -u -r1.18 ap_Win32Dialog_New.cpp
--- src/wp/ap/win/ap_Win32Dialog_New.cpp	7 Apr 2007 20:17:14 -0000	1.18
+++ src/wp/ap/win/ap_Win32Dialog_New.cpp	9 Apr 2007 08:37:52 -0000
@@ -43,6 +43,7 @@
 #include "ut_string_class.h"
 #include "xap_Win32DialogHelper.h"
 #include "ap_Win32Resources.rc2"
+#include "ut_Win32LocaleString.h"
 
 /*****************************************************************/
 
@@ -93,13 +94,6 @@
 
 	_win32Dialog.setDialogTitle(pSS->getValue(AP_STRING_ID_DLG_NEW_Title));
 
-	// localize controls
-	_DSX(NEW_BTN_OK,		DLG_OK);
-	_DSX(NEW_BTN_CANCEL,	DLG_Cancel);
-	_DS(NEW_RDO_TEMPLATE,	DLG_NEW_Create);
-	_DS(NEW_RDO_EXISTING,	DLG_NEW_Open);
-    _DS(NEW_BTN_EXISTING,	DLG_NEW_Choose);
-
 	// set initial state
 	_win32Dialog.setControlText(AP_RID_DIALOG_NEW_EBX_EXISTING, 
   								pSS->getValue(AP_STRING_ID_DLG_NEW_NoFile));
@@ -123,7 +117,9 @@
 			if(!strstr(templateName.c_str(), "normal.awt-")) // don't truncate localized template names
 				templateName = templateName.substr ( 0, templateName.size () - 4 ) ;
 
-			char *uri = UT_go_filename_to_uri(AP_Win32App::s_fromWinLocaleToUTF8(templateName.c_str()).utf8_str());
+			UT_Win32LocaleString str;
+			str.fromASCII (templateName.c_str());
+			char *uri = UT_go_filename_to_uri(str.utf8_str().utf8_str());
 			UT_continue_if_fail(uri);
 
 			UT_sint32 nIndex = SendMessage( hControl, LB_ADDSTRING, 0, (LPARAM) UT_basename( uri ) );
@@ -148,7 +144,9 @@
 			if(!strstr(templateName.c_str(), "normal.awt-"))  // don't truncate localized template names
 				templateName = templateName.substr ( 0, templateName.size () - 4 ) ;
 
-			char *uri = UT_go_filename_to_uri(AP_Win32App::s_fromWinLocaleToUTF8(templateName.c_str()).utf8_str());
+			UT_Win32LocaleString str;
+			str.fromASCII (templateName.c_str());
+			char *uri = UT_go_filename_to_uri(str.utf8_str().utf8_str());
 			UT_continue_if_fail(uri);
 
 			UT_sint32 nIndex = SendMessage( hControl, LB_ADDSTRING, 0, (LPARAM) UT_basename( uri ) );
@@ -344,7 +342,7 @@
 		if(!strstr(buf, "normal.awt-")) // don't append awt to localized templates
 			templateName += ".awt";
 
-		char *uri = UT_go_filename_to_uri(AP_Win32App::s_fromWinLocaleToUTF8(templateName.c_str()).utf8_str());
+		char *uri = NULL;//UT_go_filename_to_uri(AP_Win32App::s_fromWinLocaleToUTF8(templateName.c_str()).utf8_str());
 		UT_return_if_fail(uri);
 
 		setFileName(uri);
Index: src/wp/ap/win/ap_Win32Dialog_Options.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Dialog_Options.cpp,v
retrieving revision 1.80
diff -u -r1.80 ap_Win32Dialog_Options.cpp
--- src/wp/ap/win/ap_Win32Dialog_Options.cpp	7 Apr 2007 17:50:23 -0000	1.80
+++ src/wp/ap/win/ap_Win32Dialog_Options.cpp	9 Apr 2007 08:37:53 -0000
@@ -47,7 +47,7 @@
 #include "ap_Win32Dialog_Background.h"
 #include "xap_Win32DialogHelper.h"
 #include "ut_Language.h"
-
+#include "ut_Win32LocaleString.h"
 
 
 /*****************************************************************/
@@ -141,9 +141,11 @@
 
 	if (m_langchanged) 
 	{
-		const XAP_StringSet * pSS = getApp()->getStringSet();	
-		::MessageBox(NULL, pSS->getValue(AP_STRING_ID_DLG_Options_Prompt_YouMustRestart), 
-			"Abiword",MB_OK);
+		const XAP_StringSet * pSS = getApp()->getStringSet();
+		UT_Win32LocaleString str;
+			
+		str.fromUTF8 (pSS->getValue(AP_STRING_ID_DLG_Options_Prompt_YouMustRestart));
+		::MessageBox(NULL, str.c_str(), _T("Abiword"),MB_OK);
 	}
 	
 }	
@@ -159,9 +161,9 @@
 	{ DIM_PI, XAP_STRING_ID_DLG_Unit_pica },
 };
 #define SIZE_aAlignUnit  (sizeof(s_aAlignUnit)/sizeof(s_aAlignUnit[0]))
-#define _CDB(c,i)	CheckDlgButton(hWnd,AP_RID_DIALOG_##c,_getCheckItemValue(i))
-#define _DS2(c,s)	SetDlgItemText(getHandle(),AP_RID_DIALOG_##c,pSS->getValue(AP_STRING_ID_##s))
-#define _DSX2(c,s)	SetDlgItemText(getHandle(),AP_RID_DIALOG_##c,pSS->getValue(XAP_STRING_ID_##s))
+#define _CDB(c,i)	checkDlgButton(AP_RID_DIALOG_##c,_getCheckItemValue(i))
+#define _DS2(c,s)	setDlgItemText(AP_RID_DIALOG_##c,pSS->getValue(AP_STRING_ID_##s))
+#define _DSX2(c,s)	setDlgItemText(AP_RID_DIALOG_##c,pSS->getValue(XAP_STRING_ID_##s))
 
 
 /*
@@ -349,16 +351,15 @@
 
 void AP_Win32Dialog_Options::_gatherAutoSaveFileExt(UT_String &stRetVal)
 {
-	char szExtension[ 10 ];
+	UT_Win32LocaleString str;
+	XAP_Win32DialogBase::getDlgItemText(getPage(PG_DOCUMENT), AP_RID_DIALOG_OPTIONS_TXT_AutoSaveExtension, str);
 
-	GetDlgItemText( (HWND)getPage(PG_DOCUMENT), AP_RID_DIALOG_OPTIONS_TXT_AutoSaveExtension, szExtension, 7 );
-
-	stRetVal = szExtension;
+	stRetVal = str.ascii_str();
 }
 
 void AP_Win32Dialog_Options::_setAutoSaveFileExt(const UT_String &stExt)
-{
-	SetDlgItemText( (HWND)getPage(PG_DOCUMENT), AP_RID_DIALOG_OPTIONS_TXT_AutoSaveExtension, stExt.c_str() );
+{	
+	XAP_Win32DialogBase::setDlgItemText(getPage(PG_DOCUMENT), AP_RID_DIALOG_OPTIONS_TXT_AutoSaveExtension, stExt.c_str());
 }
 
 void AP_Win32Dialog_Options::_gatherAutoSaveFilePeriod(UT_String &stRetVal)
@@ -465,7 +466,7 @@
 /*
 	Sheet window procedure
 */
-int AP_Win32Dialog_Options_Sheet::_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
+BOOL AP_Win32Dialog_Options_Sheet::_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
 	WORD wID = LOWORD(wParam); 
 	
@@ -516,9 +517,9 @@
 	// Apply button -> save 
 	const XAP_StringSet * pSS = getParent()->getApp()->getStringSet();	
 	EnableWindow(GetDlgItem(hwnd, ID_APPLY_NOW), TRUE);
-	SetWindowText(GetDlgItem(hwnd, ID_APPLY_NOW), pSS->getValue(AP_STRING_ID_DLG_Options_Btn_Default));
-	SetWindowText(GetDlgItem(hwnd, IDOK), pSS->getValue(XAP_STRING_ID_DLG_OK));
-	SetWindowText(GetDlgItem(hwnd, IDCANCEL), pSS->getValue(XAP_STRING_ID_DLG_Cancel));	
+	XAP_Win32DialogBase::setWindowText(GetDlgItem(hwnd, ID_APPLY_NOW), pSS->getValue(AP_STRING_ID_DLG_Options_Btn_Default));
+	XAP_Win32DialogBase::setWindowText(GetDlgItem(hwnd, IDOK), pSS->getValue(XAP_STRING_ID_DLG_OK));
+	XAP_Win32DialogBase::setWindowText(GetDlgItem(hwnd, IDCANCEL), pSS->getValue(XAP_STRING_ID_DLG_Cancel));	
 
 	AP_Win32Dialog_Options*	 pParent=  (AP_Win32Dialog_Options*)getParent();		
 	int nDefPage = pParent->getInitialPageNum();		
@@ -543,10 +544,10 @@
 	
 }
 
-void AP_Win32Dialog_Options_Spelling::_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
+/*void AP_Win32Dialog_Options_Spelling::_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
 
-}
+}*/
 
 /*
 	
@@ -619,7 +620,7 @@
 /*
 	
 */	
-void AP_Win32Dialog_Options_General::_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
+BOOL AP_Win32Dialog_Options_General::_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
 	WORD wId = LOWORD(wParam);
 	AP_Win32Dialog_Options*	 pParent=  (AP_Win32Dialog_Options*)getContainer();	
@@ -631,7 +632,8 @@
 		case AP_RID_DIALOG_OPTIONS_BTN_BGColor:
 		{
 			pColorDialog = (AP_Dialog_Background *)(pParent->getDialogFactory()->requestDialog(AP_DIALOG_ID_BACKGROUND));
-			UT_return_if_fail (pColorDialog);
+			if (pColorDialog == NULL)
+				return FALSE;
 	
 			UT_parseColor(pParent->_gatherColorForTransparent(), rgbColor );
 			pColorDialog->setColor(rgbColor);
@@ -641,13 +643,13 @@
 				pParent->_setColorForTransparent(pColorDialog->getColor());
 				
 			pParent->getDialogFactory()->releaseDialog(pColorDialog);
+			return TRUE;
 		}
-
-		return;
-
 		default:
 			break;
 	}
+	
+	return FALSE;
 }
 
 /*
@@ -658,10 +660,9 @@
 	const gchar *pLangCode;
 	const gchar *pLang;
 	UT_Language	lang;	
-	int	i, nIndex;;
+	int	i, nIndex;
 	const XAP_StringSet * pSS = getApp()->getStringSet();	
-	AP_Win32App * pApp = static_cast<AP_Win32App*>(XAP_App::getApp());
-	HWND hCtrlUILang	= GetDlgItem(getHandle(), AP_RID_DIALOG_OPTIONS_COMBO_UILANG);
+	AP_Win32App * pApp = static_cast<AP_Win32App*>(XAP_App::getApp());	
 	
 	// localize controls	
 	_DS2(OPTIONS_CHK_ViewCursorBlink,		DLG_Options_Label_ViewCursorBlink);	
@@ -676,13 +677,12 @@
 	_DS2(OPTIONS_TEXT_UILANG,				DLG_Options_Label_UILang);
 	_DS2(OPTIONS_STATIC_LANGUAGE, 			DLG_Options_Label_LangSettings);
 	
-	// Populate values in the _COMBO_UNITS
-	HWND hwndAlign = GetDlgItem(getHandle(), AP_RID_DIALOG_OPTIONS_COMBO_UNITS);
+	// Populate values in the _COMBO_UNITS	
 	for(i = 0; i < SIZE_aAlignUnit; i++ )
 	{
-		SendMessage(hwndAlign, CB_ADDSTRING, 0, (LPARAM)pSS->getValue(s_aAlignUnit[i].id));
-	}	
-	
+		addItemToCombo(AP_RID_DIALOG_OPTIONS_COMBO_UNITS, pSS->getValue(s_aAlignUnit[i].id));
+	}		
+		
 	// Setup bold font for some controls	
 	UINT boldFields[]={AP_RID_DIALOG_OPTIONS_STATIC_UI, AP_RID_DIALOG_OPTIONS_STATIC_APPSTARTUP, 
 		AP_RID_DIALOG_OPTIONS_STATIC_LANGUAGE, 0};
@@ -705,16 +705,20 @@
 			int id = lang.getIndxFromCode(pLangCode);
 			pLang  = lang.getNthLangName(id);
 			
-			nIndex = SendMessage(hCtrlUILang, CB_ADDSTRING, 0, (LPARAM)pLang);
-			SendMessage(hCtrlUILang, CB_SETITEMDATA, nIndex, id);
+			nIndex = addItemToCombo (AP_RID_DIALOG_OPTIONS_COMBO_UILANG, pLang);
+			setComboDataItem (AP_RID_DIALOG_OPTIONS_COMBO_UILANG, nIndex, id);			
 		}							
 	}
 	else
-		EnableWindow(hCtrlUILang, FALSE);
+		EnableWindow(GetDlgItem(getHandle(), AP_RID_DIALOG_OPTIONS_COMBO_UILANG), FALSE);
 
-
-	SetWindowLong(getHandle(), GWL_USERDATA, (LONG)this);
+	SetWindowLong(getHandle(), GWL_USERDATA, (LONG)this);	
 	
+	SendMessage(GetDlgItem (m_hDlg, AP_RID_DIALOG_OPTIONS_COMBO_UNITS), 
+		WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), MAKELPARAM(TRUE, 0));
+		
+	SendMessage(GetDlgItem (m_hDlg, AP_RID_DIALOG_OPTIONS_COMBO_UILANG), 
+		WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), MAKELPARAM(TRUE, 0));	
 }
 
 
@@ -758,7 +762,7 @@
 /*
 	
 */	
-void AP_Win32Dialog_Options_Document::_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
+BOOL AP_Win32Dialog_Options_Document::_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
 	WORD wId = LOWORD(wParam);	
 	AP_Win32Dialog_Options*	 pParent=  (AP_Win32Dialog_Options*)getContainer();	
@@ -772,19 +776,21 @@
 			EnableWindow( GetDlgItem( hWnd, AP_RID_DIALOG_OPTIONS_TXT_AutoSavePeriod), bChecked );
 			EnableWindow( GetDlgItem( hWnd, AP_RID_DIALOG_OPTIONS_SPN_AutoSavePeriodSpin), bChecked );
 			EnableWindow( GetDlgItem( hWnd, AP_RID_DIALOG_OPTIONS_TXT_AutoSaveExtension), bChecked );
-		return;
+			return TRUE;
 
-	case AP_RID_DIALOG_OPTIONS_CHK_ShowSplash:			
-		pParent->_enableDisableLogic(AP_Dialog_Options::id_SHOWSPLASH); 	
-		return;	
-	
-	case AP_RID_DIALOG_OPTIONS_CHK_LanguageWithKeyboard:  pParent->_enableDisableLogic(AP_Dialog_Options::id_CHECK_LANG_WITH_KEYBOARD);return;
-
-		
+		case AP_RID_DIALOG_OPTIONS_CHK_ShowSplash:			
+			pParent->_enableDisableLogic(AP_Dialog_Options::id_SHOWSPLASH); 	
+			return TRUE;
+		
+		case AP_RID_DIALOG_OPTIONS_CHK_LanguageWithKeyboard:  
+			pParent->_enableDisableLogic(AP_Dialog_Options::id_CHECK_LANG_WITH_KEYBOARD);
+			return TRUE;
+			
 		default:
-		break;
+			break;
 	}
-
+	
+	return FALSE;
 }
 
 /*
@@ -834,10 +840,12 @@
 	snprintf( szTemp, 10, "%d", iValue);	
 	
 	if (iValue<MINAUTOSAVEPERIOD || iValue>MAXAUTOSAVEPERIOD)
-	{				
-			const XAP_StringSet * pSS = getApp()->getStringSet();	
-			::MessageBox(NULL, pSS->getValue(AP_STRING_ID_DLG_Options_Label_InvalidRangeForAutoSave), 
-				"",MB_OK);
+	{
+			UT_Win32LocaleString str;			
+			const XAP_StringSet * pSS = getApp()->getStringSet();
+			
+			str.fromUTF8 (pSS->getValue(AP_STRING_ID_DLG_Options_Label_InvalidRangeForAutoSave));
+			MessageBox(NULL, str.c_str(), _T("Abiword"),MB_OK);
 		
 		return false;
 	}
Index: src/wp/ap/win/ap_Win32Dialog_Options.h
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Dialog_Options.h,v
retrieving revision 1.46
diff -u -r1.46 ap_Win32Dialog_Options.h
--- src/wp/ap/win/ap_Win32Dialog_Options.h	16 Jan 2007 23:16:27 -0000	1.46
+++ src/wp/ap/win/ap_Win32Dialog_Options.h	9 Apr 2007 08:37:53 -0000
@@ -43,7 +43,7 @@
 		
 		void setParent(AP_Win32Dialog_Options*	pData){m_pParent=pData;};
 		AP_Win32Dialog_Options* getParent(){return m_pParent;};
-		int _onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);
+		BOOL _onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);
 		static int CALLBACK s_sheetInit(HWND hwnd,  UINT uMsg,  LPARAM lParam);
 		
 private:		
@@ -72,7 +72,7 @@
 
 	void						_onInitDialog();
 	void						_onKillActive(){};
-	void						_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);
+	//void						_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);
 		
 	AP_Win32Dialog_Options*		m_pParent;		
 	
@@ -97,8 +97,8 @@
 private:
 
 	void						_onInitDialog();
-	void						_onKillActive(){};
-	void						_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);
+	void						_onKillActive(){};	
+	BOOL						_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);
 		
 	AP_Win32Dialog_Options*		m_pParent;
 	int							m_nCentered;
@@ -126,7 +126,7 @@
 
 	void						_onInitDialog();
 	void						_onKillActive(){};
-	void						_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);
+	BOOL						_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);
 		
 	AP_Win32Dialog_Options*		m_pParent;	
 	
Index: src/wp/ap/win/ap_Win32Dialog_PageNumbers.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Dialog_PageNumbers.cpp,v
retrieving revision 1.17
diff -u -r1.17 ap_Win32Dialog_PageNumbers.cpp
--- src/wp/ap/win/ap_Win32Dialog_PageNumbers.cpp	7 Apr 2007 17:50:23 -0000	1.17
+++ src/wp/ap/win/ap_Win32Dialog_PageNumbers.cpp	9 Apr 2007 08:37:54 -0000
@@ -82,38 +82,7 @@
 
 BOOL AP_Win32Dialog_PageNumbers::_onInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
-	m_hThisDlg = hWnd;
 
-	const XAP_StringSet* pSS = m_pApp->getStringSet();
-
-	// Update the caption
-	m_helper.setDialogTitle(pSS->getValue(AP_STRING_ID_DLG_PageNumbers_Title));
-
-	/* Localise controls*/
-	_DSX(PAGENUMBERS_BTN_OK,				DLG_OK);
-	_DSX(PAGENUMBERS_BTN_CANCEL,			DLG_Cancel);
-	_DS(PAGENUMBERS_STATIC_ALIGNMENT,		DLG_PageNumbers_Alignment);
-	_DS(PAGENUMBERS_STATIC_POSITION,		DLG_PageNumbers_Position);
-	_DS(PAGENUMBERS_STATIC_PREVIEW,			DLG_PageNumbers_Preview);
-	
-	_DS(PAGENUMBERS_RADIO_POSITIONLEFT,		DLG_PageNumbers_Left);
-	_DS(PAGENUMBERS_RADIO_POSITIONRIGHT,	DLG_PageNumbers_Right);
-	_DS(PAGENUMBERS_RADIO_POSITIONCENTER,	DLG_PageNumbers_Center);
-	_DS(PAGENUMBERS_RADIO_ALIGNFOOTER,		DLG_PageNumbers_Footer);
-	_DS(PAGENUMBERS_RADIO_ALIGNHEADER,		DLG_PageNumbers_Header);
-	
-	/*Set Default Radio buttons */	
-	CheckRadioButton(hWnd, AP_RID_DIALOG_PAGENUMBERS_RADIO_POSITIONLEFT, AP_RID_DIALOG_PAGENUMBERS_RADIO_POSITIONCENTER,
-		AP_RID_DIALOG_PAGENUMBERS_RADIO_POSITIONCENTER);
-		
-	CheckRadioButton(hWnd, AP_RID_DIALOG_PAGENUMBERS_RADIO_ALIGNFOOTER, AP_RID_DIALOG_PAGENUMBERS_RADIO_ALIGNHEADER,
-		AP_RID_DIALOG_PAGENUMBERS_RADIO_ALIGNFOOTER);
-
-	_createPreviewWidget();
-	m_pPreviewWidget->getGraphics()->init3dColors();
-	_updatePreview(m_align, m_control);
-	
-	m_helper.centerDialog();
 
 	return 1;	// 0 == we called SetFocus()
 }
Index: src/wp/ap/win/ap_Win32Dialog_PageSetup.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Dialog_PageSetup.cpp,v
retrieving revision 1.34
diff -u -r1.34 ap_Win32Dialog_PageSetup.cpp
--- src/wp/ap/win/ap_Win32Dialog_PageSetup.cpp	16 Jan 2007 23:16:28 -0000	1.34
+++ src/wp/ap/win/ap_Win32Dialog_PageSetup.cpp	9 Apr 2007 08:37:54 -0000
@@ -118,7 +118,7 @@
 /*
 	Sheet window procedure
 */
-int AP_Win32Dialog_PageSetup_Sheet::_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
+BOOL AP_Win32Dialog_PageSetup_Sheet::_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
 	WORD wID = LOWORD(wParam); 
 	
@@ -155,11 +155,6 @@
 
 void AP_Win32Dialog_PageSetup_Sheet::_onInitDialog(HWND hwnd)
 {		
-	const XAP_StringSet * pSS = getParent()->getApp()->getStringSet();	
-	SetWindowText(GetDlgItem(hwnd, IDOK), pSS->getValue(XAP_STRING_ID_DLG_OK));
-	SetWindowText(GetDlgItem(hwnd, IDCANCEL), pSS->getValue(XAP_STRING_ID_DLG_Cancel));	
-
-	PropSheet_SetCurSel(hwnd, 0, 0);
 
 	// Initialize Dialog Data
 	m_pParent->updateMargins();
@@ -185,332 +180,24 @@
 int CALLBACK AP_Win32Dialog_PageSetup_Page::s_pageWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 {
 	
-	if (msg==WM_NOTIFY)
-	{
-		AP_Win32Dialog_PageSetup_Page *pThis = (AP_Win32Dialog_PageSetup_Page *) GetWindowLong(hWnd, GWL_USERDATA);					
-
-		NMHDR* pHdr = (NMHDR*)lParam;
-		LPNMUPDOWN lpnmud = (LPNMUPDOWN)lParam;
 
-		if ( lpnmud->hdr.code == UDN_DELTAPOS )
-		{
-			pThis->doSpinControl(lpnmud->hdr.idFrom, -lpnmud->iDelta);
-		}
 
-		if (pHdr->code==PSN_SETACTIVE)			
-		{
-			if (pThis->m_nCentered<2)
-			{
-			   	pThis->m_nCentered++;
-				XAP_Win32DialogHelper::s_centerDialog(GetParent(hWnd));			
-			}
-		}
-	}   	
-	
 	return XAP_Win32PropertyPage::s_pageWndProc(hWnd, msg, wParam,lParam);
 }
 
 void AP_Win32Dialog_PageSetup_Page::doSpinControl(UT_uint32 id, UT_sint32 delta)
 {
-	char buf[BUFSIZE];
-	int updatedData =  0;
-	int pageScale   = ( m_pParent->getPageUnits()   == DIM_MM ) ? 1 : 10;
-	int marginScale = ( m_pParent->getMarginUnits() == DIM_MM ) ? 1 : 10;
-
-	switch( id )
-	{
-	case AP_RID_DIALOG_PAGE_SETUP_SPN_WIDTH:
-		updatedData = (int)( m_pParent->m_PageSize.Width(m_pParent->getPageUnits()) * pageScale + delta + 0.05f );
-		if( updatedData >= 0 )
-		{
-			m_pParent->m_PageSize.Set( (m_pParent->getPageOrientation() == m_pParent->PORTRAIT) ? (double) updatedData / (double) pageScale : m_pParent->m_PageSize.Height(m_pParent->getPageUnits()),
-							(m_pParent->getPageOrientation() == m_pParent->PORTRAIT) ? m_pParent->m_PageSize.Height(m_pParent->getPageUnits()) : (double) updatedData / (double) pageScale,
-							m_pParent->getPageUnits() );
-			m_pParent->updatePageSize();
-			m_pParent->updateWidth();
-			m_pParent->updatePreview();
-		}
-		break;
-
-	case AP_RID_DIALOG_PAGE_SETUP_SPN_HEIGHT:
-		updatedData = (int)( m_pParent->m_PageSize.Height(m_pParent->getPageUnits()) * pageScale + delta + 0.05f );
-		if( updatedData >= 0 )
-		{
-			m_pParent->m_PageSize.Set( (m_pParent->getPageOrientation() == m_pParent->PORTRAIT) ? m_pParent->m_PageSize.Width(m_pParent->getPageUnits()) : (double) updatedData / (double) pageScale,
-							(m_pParent->getPageOrientation() == m_pParent->PORTRAIT) ? (double) updatedData / (double) pageScale : m_pParent->m_PageSize.Width(m_pParent->getPageUnits()),
-							m_pParent->getPageUnits() );
-			m_pParent->updatePageSize();
-			m_pParent->updateHeight();
-			m_pParent->updatePreview();
-		}
-		break;
-
-	case AP_RID_DIALOG_PAGE_SETUP_SPN_SCALE:
-		updatedData = m_pParent->getPageScale() + delta;
-		if( updatedData >= 0 )
-		{
-			m_pParent->setPageScale( updatedData);
-			SetDlgItemText( getHandle(),
-		                    AP_RID_DIALOG_PAGE_SETUP_EBX_SCALE,
-			                itoa( m_pParent->getPageScale() , buf, 10 ) );
-		}
-		break;
 
-	default:
-		break;
-	}
 }
 
-void AP_Win32Dialog_PageSetup_Page::_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
+BOOL AP_Win32Dialog_PageSetup_Page::_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
-	WORD wNotifyCode = HIWORD(wParam);
-	WORD wId = LOWORD(wParam);
-	HWND hWndCtrl = (HWND)lParam;	
-	AP_Win32Dialog_PageSetup*	 pParent=  (AP_Win32Dialog_PageSetup*)getContainer();	
-	
-	
-	switch (wId)
-	{
-	case AP_RID_DIALOG_PAGE_SETUP_LBX_PAPERSIZE:
-		if( wNotifyCode == CBN_SELCHANGE )
-		{
-			UT_sint32 previous = (UT_sint32) fp_PageSize::NameToPredefined( m_pParent->m_PageSize.getPredefinedName()  );
-			UT_sint32 selected = SendMessage( hWndCtrl, CB_GETCURSEL, (WPARAM) 0, (LPARAM) 0 );
-			if( selected != previous )
-			{
-				m_pParent->m_PageSize.Set( (fp_PageSize::Predefined)selected );
-#if 0
-				// let user select units she wants, see bug 8118
-				if( m_pParent->getPageUnits() != m_pParent->m_PageSize.getDims() )
-				{
-					SendDlgItemMessage( hWnd,
-								 		AP_RID_DIALOG_PAGE_SETUP_LBX_UNITS,
-								 		CB_SETCURSEL, 
-								 		(WPARAM) m_pParent->m_PageSize.getDims(),
-							 			(LPARAM) 0);
-					m_pParent->setPageUnits( m_pParent->m_PageSize.getDims() );
-				}
-#endif
-				m_pParent->updateWidth();
-				m_pParent->updateHeight();
-				m_pParent->updatePreview();
-			}
-		}
-		return;
-
-	case AP_RID_DIALOG_PAGE_SETUP_LBX_UNITS:
-		if( wNotifyCode == CBN_SELCHANGE )
-		{
-			UT_Dimension unit = (UT_Dimension)SendMessage( hWndCtrl, CB_GETCURSEL, (WPARAM) 0, (LPARAM) 0 );
-			if( unit != m_pParent->getPageUnits() )
-			{
-				m_pParent->setPageUnits( unit );
-				m_pParent->updateWidth();
-				m_pParent->updateHeight();
-				m_pParent->updatePreview();
-			}
-		}
-		return;
-
-	case AP_RID_DIALOG_PAGE_SETUP_EBX_WIDTH:
-		if( wNotifyCode == EN_KILLFOCUS )
-		{
-			char buf[BUFSIZE];
-			GetDlgItemText( hWnd, wId, buf, BUFSIZE );
-			if( atof(buf) >= 0.0 && atof(buf) != m_pParent->m_PageSize.Width(m_pParent->getPageUnits()) )
-			{
-				m_pParent->m_PageSize.Set( (m_pParent->getPageOrientation() == m_pParent->PORTRAIT) ? atof(buf) : m_pParent->m_PageSize.Height(m_pParent->getPageUnits()),
-								(m_pParent->getPageOrientation() == m_pParent->PORTRAIT) ? m_pParent->m_PageSize.Height(m_pParent->getPageUnits()) : atof(buf),
-								m_pParent->getPageUnits() );
-				m_pParent->updatePageSize();
-				m_pParent->updatePreview();
-
-			}
-			m_pParent->updateWidth();		
-		}
-		return;
-
-	case AP_RID_DIALOG_PAGE_SETUP_EBX_HEIGHT:
-		if( wNotifyCode == EN_KILLFOCUS )
-		{
-			char buf[BUFSIZE];
-			GetDlgItemText( hWnd, wId, buf, BUFSIZE );
-			if( atof(buf) >= 0.0 && atof(buf) != m_pParent->m_PageSize.Height(m_pParent->getPageUnits()) )
-			{
-				m_pParent->m_PageSize.Set( (m_pParent->getPageOrientation() == m_pParent->PORTRAIT) ? m_pParent->m_PageSize.Width(m_pParent->getPageUnits()) : atof(buf), 
-								(m_pParent->getPageOrientation() == m_pParent->PORTRAIT) ? atof(buf) : m_pParent->m_PageSize.Width(m_pParent->getPageUnits()),
-								m_pParent->getPageUnits() );
-				m_pParent->updatePageSize();
-				m_pParent->updatePreview();
-			}
-			m_pParent->updateHeight();
-		}
-		return;
-
-	case AP_RID_DIALOG_PAGE_SETUP_EBX_SCALE:
-		if( wNotifyCode == EN_KILLFOCUS )
-		{
-			char buf[BUFSIZE];
-			GetDlgItemText( hWnd, wId, buf, BUFSIZE );
-			if( (atoi(buf) >= 1) && (atoi(buf) <= 1000) && (atoi(buf) != m_pParent->getPageScale()) )
-			{
-				m_pParent->setPageScale( atoi(buf) );
-
-			}
-			SetDlgItemText( hWnd, wId, itoa( m_pParent->getPageScale() , buf, 10 ) );
-
-		}
-		return;
-
-	case AP_RID_DIALOG_PAGE_SETUP_RDO_PORTRAIT:
-		if( m_pParent->getPageOrientation() != m_pParent->PORTRAIT )
-		{
-			m_pParent->setPageOrientation( m_pParent->PORTRAIT );
-			m_pParent->m_PageSize.setPortrait();
-			SendDlgItemMessage( hWnd, 
-   	                            AP_RID_DIALOG_PAGE_SETUP_BMP_ORIENTATION, 
-       	                        STM_SETIMAGE, 
-           	                    IMAGE_BITMAP, 
-								(LPARAM) m_pParent->m_bmpPortrait );
-			m_pParent->updateWidth();
-			m_pParent->updateHeight();
-			m_pParent->updatePreview();
-		}
-		return;
-		
-	case AP_RID_DIALOG_PAGE_SETUP_RDO_LANDSCAPE:
-		if( m_pParent->getPageOrientation() != m_pParent->LANDSCAPE )
-		{
-			m_pParent->setPageOrientation( m_pParent->LANDSCAPE );
-			m_pParent->m_PageSize.setLandscape();
-			SendDlgItemMessage( hWnd, 
-   	                            AP_RID_DIALOG_PAGE_SETUP_BMP_ORIENTATION, 
-       	                        STM_SETIMAGE, 
-           	                    IMAGE_BITMAP, 
-								(LPARAM) m_pParent->m_bmpLandscape );
-			m_pParent->updateWidth();
-			m_pParent->updateHeight();
-			m_pParent->updatePreview();
-		}
-		return;
-
-	default:
-		UT_DEBUGMSG(("WM_Command for id %ld for Page sub-dialog\n",wId));
-		return;
-	}
+	return 0;
 }
 
 void AP_Win32Dialog_PageSetup_Page::_onInitDialog()
 {				
-	const XAP_StringSet * pSS = getApp()->getStringSet();
-	
-	// Initialize Page page's dialog items
-	_DS(PAGE_SETUP_GBX_PAPER,			DLG_PageSetup_Paper);
-	_DS(PAGE_SETUP_GBX_ORIENTATION,		DLG_PageSetup_Orient);
-	_DS(PAGE_SETUP_GBX_SCALE,	     	DLG_PageSetup_Scale);
-	_DS(PAGE_SETUP_LBL_PAPERSIZE,		DLG_PageSetup_Paper_Size);			
-	_DS(PAGE_SETUP_LBL_WITDH,			DLG_PageSetup_Width);			
-	_DS(PAGE_SETUP_LBL_HEIGHT,			DLG_PageSetup_Height);			
-	_DS(PAGE_SETUP_LBL_UNITS,			DLG_PageSetup_Units);			
-	_DS(PAGE_SETUP_RDO_PORTRAIT,		DLG_PageSetup_Portrait);			
-	_DS(PAGE_SETUP_RDO_LANDSCAPE,		DLG_PageSetup_Landscape);			
-	_DS(PAGE_SETUP_LBL_ADJUSTTO,		DLG_PageSetup_Adjust);			
-	_DS(PAGE_SETUP_LBL_PERCENTOFSIZE,	DLG_PageSetup_Percent);	
-
-	// Populate Paper Size combo box
-	HWND hwndPaperSize = GetDlgItem(getHandle(), AP_RID_DIALOG_PAGE_SETUP_LBX_PAPERSIZE);
-	for (UT_uint32 i = (UT_uint32)fp_PageSize::_first_predefined_pagesize_; i < (UT_uint32)fp_PageSize::_last_predefined_pagesize_dont_use_; i++)
-	{
-		SendMessage( hwndPaperSize, CB_INSERTSTRING ,
-					 (WPARAM) (fp_PageSize::Predefined)i,
-				     (LPARAM) fp_PageSize::PredefinedToName( (fp_PageSize::Predefined)i ) );
-	}
 
-	// Populate Units combo box
-	HWND hwndUnits = GetDlgItem(getHandle(), AP_RID_DIALOG_PAGE_SETUP_LBX_UNITS);
-	// NB: cannot insert string at index 1 before inserting one at index 0
-	SendMessage( hwndUnits, CB_INSERTSTRING , (WPARAM) DIM_IN, (LPARAM) _GVX(DLG_Unit_inch) );
-	SendMessage( hwndUnits, CB_INSERTSTRING , (WPARAM) DIM_CM,   (LPARAM) _GVX(DLG_Unit_cm) );
-	SendMessage( hwndUnits, CB_INSERTSTRING , (WPARAM) DIM_MM,   (LPARAM) _GVX(DLG_Unit_mm) );
-			
-	m_pParent->m_PageSize = m_pParent->getPageSize();
-	if( m_pParent->getPageOrientation() == m_pParent->PORTRAIT )
-	{
-		m_pParent->m_PageSize.setPortrait();
-	}
-	else
-	{
-		m_pParent->m_PageSize.setLandscape();
-	}
-
-	char buf[BUFSIZE];
-	m_pParent->updateWidth();
-	m_pParent->updateHeight();
-	SetDlgItemText( getHandle(),
-                    AP_RID_DIALOG_PAGE_SETUP_EBX_SCALE,
-                    itoa( m_pParent->getPageScale(), buf, 10 ) );
-
-	CheckRadioButton( getHandle(),
-					AP_RID_DIALOG_PAGE_SETUP_RDO_PORTRAIT,
-					AP_RID_DIALOG_PAGE_SETUP_RDO_LANDSCAPE,
-					( m_pParent->getPageOrientation() == m_pParent->PORTRAIT ) ?
-					AP_RID_DIALOG_PAGE_SETUP_RDO_PORTRAIT :
-					AP_RID_DIALOG_PAGE_SETUP_RDO_LANDSCAPE );
-
-	m_pParent->updatePageSize();
-
-	int nUnit =  m_pParent->getPageUnits();
-	SendMessage( hwndUnits, CB_SETCURSEL, (WPARAM) nUnit, (LPARAM) 0 );
-
-	// Load Appropriate XPM to BMPs
-	COLORREF ColorRef = GetSysColor(COLOR_BTNFACE);
-	UT_RGBColor Color( GetRValue(ColorRef), GetGValue(ColorRef), GetBValue(ColorRef));
-	HDC hdc = GetDC(getHandle());
-	RECT rect;
-	GetClientRect(GetDlgItem(getHandle(), AP_RID_DIALOG_PAGE_SETUP_BMP_ORIENTATION), &rect);
-	UT_Xpm2Bmp( rect.right - rect.left,
-                rect.bottom - rect.top,
-                (const char**) orient_vertical_xpm,
-				sizeof(orient_vertical_xpm),
-				hdc,
-                &Color,
-				&m_pParent->m_bmpPortrait);
-	UT_Xpm2Bmp( rect.right - rect.left,
-                rect.bottom - rect.top,
-                (const char**) orient_horizontal_xpm,
-				sizeof(orient_horizontal_xpm),
-				hdc,
-                &Color,
-				&m_pParent->m_bmpLandscape);
-	GetClientRect(GetDlgItem(getHandle(), AP_RID_DIALOG_PAGE_SETUP_BMP_PREVIEW), &rect);
-	m_pParent->m_bmpPreview = CreateCompatibleBitmap( hdc, rect.right - rect.left, rect.bottom - rect.top );
-	ReleaseDC( getHandle(), hdc );
-
-	if( m_pParent->getPageOrientation() == m_pParent->PORTRAIT )
-	{
-		SendDlgItemMessage( getHandle(), 
-    	                    AP_RID_DIALOG_PAGE_SETUP_BMP_ORIENTATION, 
-        	                STM_SETIMAGE, 
-            	            IMAGE_BITMAP, 
-							(LPARAM) m_pParent->m_bmpPortrait );
-	}
-	else
-	{
-		SendDlgItemMessage( getHandle(), 
-    	                    AP_RID_DIALOG_PAGE_SETUP_BMP_ORIENTATION, 
-        	                STM_SETIMAGE, 
-            	            IMAGE_BITMAP, 
-							(LPARAM) m_pParent->m_bmpLandscape );
-	}
-
-	SendDlgItemMessage( getHandle(), 
-				        AP_RID_DIALOG_PAGE_SETUP_BMP_PREVIEW,
-				        STM_SETIMAGE, 
-						IMAGE_BITMAP, 
-						(LPARAM)m_pParent->m_bmpPreview );			
-
-
-	SetWindowLong(getHandle(), GWL_USERDATA, (LONG)this);
 }
 
 /*
@@ -528,237 +215,24 @@
 
 }
 
-void AP_Win32Dialog_PageSetup_Margin::_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
+BOOL AP_Win32Dialog_PageSetup_Margin::_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
-	WORD wNotifyCode = HIWORD(wParam);
-	WORD wId = LOWORD(wParam);
-	HWND hWndCtrl = (HWND)lParam;	
-	AP_Win32Dialog_PageSetup*	 pParent=  (AP_Win32Dialog_PageSetup*)getContainer();	
-	
-	
-	switch (wId)
-	{
-	case AP_RID_DIALOG_PAGE_SETUP_LBX_MARGINUNITS:
-		if( wNotifyCode == CBN_SELCHANGE )
-		{
-			UT_sint32 selected = SendMessage( hWndCtrl, CB_GETCURSEL, (WPARAM) 0, (LPARAM) 0 );
-			if( m_pParent->getMarginUnits() != (UT_Dimension) selected )
-			{
-				m_pParent->setMarginTop(    m_pParent->getMarginTop()   * mScale[m_pParent->getMarginUnits()] / mScale[selected] );
-				m_pParent->setMarginBottom( m_pParent->getMarginBottom()* mScale[m_pParent->getMarginUnits()] / mScale[selected] );
-				m_pParent->setMarginLeft(   m_pParent->getMarginLeft()  * mScale[m_pParent->getMarginUnits()] / mScale[selected] );
-				m_pParent->setMarginRight(  m_pParent->getMarginRight() * mScale[m_pParent->getMarginUnits()] / mScale[selected] );
-				m_pParent->setMarginHeader( m_pParent->getMarginHeader()* mScale[m_pParent->getMarginUnits()] / mScale[selected] );
-				m_pParent->setMarginFooter( m_pParent->getMarginFooter()* mScale[m_pParent->getMarginUnits()] / mScale[selected] );
-				
-				m_pParent->updateMargins();
-				m_pParent->setMarginUnits( (UT_Dimension) selected );
-			}
-		}
-		return;
-
-	case AP_RID_DIALOG_PAGE_SETUP_EBX_TOP:
-		if( wNotifyCode == EN_KILLFOCUS )
-		{
-			char buf[BUFSIZE];
-			GetDlgItemText( hWnd, wId, buf, BUFSIZE );
-			if( (atof( buf ) > -EPSILON) && (fabs(atof(buf) - (double) m_pParent->getMarginTop()) > EPSILON ) )
-			{
-				m_pParent->setMarginTop( (float) atof(buf) );
-				m_pParent->updatePreview();
-			}
-			m_pParent->updateTopMargin();
-		}
-		return;
-
-	case AP_RID_DIALOG_PAGE_SETUP_EBX_BOTTOM:
-		if( wNotifyCode == EN_KILLFOCUS )
-		{
-			char buf[BUFSIZE];
-			GetDlgItemText( hWnd, wId, buf, BUFSIZE );
-			if( (atof( buf ) > -EPSILON) && (fabs(atof(buf) - (double) m_pParent->getMarginBottom()) > EPSILON ) )
-			{
-				m_pParent->setMarginBottom( (float) atof(buf) );
-				m_pParent->updatePreview();
-			}
-			m_pParent->updateBottomMargin();
-		}
-		return;
-
-	case AP_RID_DIALOG_PAGE_SETUP_EBX_LEFT:
-		if( wNotifyCode == EN_KILLFOCUS )
-		{
-			char buf[BUFSIZE];
-			GetDlgItemText( hWnd, wId, buf, BUFSIZE );
-			if( (atof( buf ) > -EPSILON) && (fabs(atof(buf) - (double) m_pParent->getMarginLeft()) > EPSILON ) )
-			{
-				m_pParent->setMarginLeft( (float) atof(buf) );
-				m_pParent->updatePreview();
-			}
-			m_pParent->updateLeftMargin();
-		}
-		return;
-
-	case AP_RID_DIALOG_PAGE_SETUP_EBX_RIGHT:
-		if( wNotifyCode == EN_KILLFOCUS )
-		{
-			char buf[BUFSIZE];
-			GetDlgItemText( hWnd, wId, buf, BUFSIZE );
-			if( (atof( buf ) > -EPSILON) && (fabs(atof(buf) - (double) m_pParent->getMarginRight()) > EPSILON ) )
-			{
-				m_pParent->setMarginRight( (float) atof(buf) );
-				m_pParent->updatePreview();
-			}
-			m_pParent->updateRightMargin();
-		}
-		return;
-
-	case AP_RID_DIALOG_PAGE_SETUP_EBX_HEADER:
-		if( wNotifyCode == EN_KILLFOCUS )
-		{
-			char buf[BUFSIZE];
-			GetDlgItemText( hWnd, wId, buf, BUFSIZE );
-			if( (atof( buf ) > -EPSILON) && (fabs(atof(buf) - (double) m_pParent->getMarginHeader()) > EPSILON ) )
-			{
-				m_pParent->setMarginHeader( (float) atof(buf) );
-				m_pParent->updatePreview();
-			}
-			m_pParent->updateHeaderMargin();
-		}
-		return;
-
-	case AP_RID_DIALOG_PAGE_SETUP_EBX_FOOTER:
-		if( wNotifyCode == EN_KILLFOCUS )
-		{
-			char buf[BUFSIZE];
-			GetDlgItemText( hWnd, wId, buf, BUFSIZE );
-			if( (atof( buf ) > -EPSILON) && (fabs(atof(buf) - (double) m_pParent->getMarginFooter()) > EPSILON ) )
-			{
-				m_pParent->setMarginFooter( (float) atof(buf) );
-				m_pParent->updatePreview();
-			}
-			m_pParent->updateFooterMargin();
-		}
-		return;
-
-	default:
-		UT_DEBUGMSG(("WM_Command for id %ld for Page sub-dialog\n",wId));
-		return;
-	}
+	return 0;
 }
 
 void AP_Win32Dialog_PageSetup_Margin::_onInitDialog()
 {
-		const XAP_StringSet * pSS = getApp()->getStringSet();	
-	
-		// Localize Controls
-		_DS(PAGE_SETUP_LBL_UNITS,			DLG_PageSetup_Units);			
-		_DS(PAGE_SETUP_LBL_TOP,				DLG_PageSetup_Top);
-		_DS(PAGE_SETUP_LBL_BOTTOM,			DLG_PageSetup_Bottom);
-		_DS(PAGE_SETUP_LBL_LEFT,	     	DLG_PageSetup_Left);
-		_DS(PAGE_SETUP_LBL_RIGHT,			DLG_PageSetup_Right);			
-		_DS(PAGE_SETUP_LBL_HEADER,			DLG_PageSetup_Header);			
-		_DS(PAGE_SETUP_LBL_FOOTER,			DLG_PageSetup_Footer);			
-
-		// Populate Margin Units combo box
-		HWND hwndMarginUnits = GetDlgItem(getHandle(), AP_RID_DIALOG_PAGE_SETUP_LBX_MARGINUNITS);
-		SendMessage( hwndMarginUnits, CB_INSERTSTRING , (WPARAM) DIM_IN, (LPARAM) _GVX(DLG_Unit_inch) );                                
-		SendMessage( hwndMarginUnits, CB_INSERTSTRING , (WPARAM) DIM_CM,   (LPARAM) _GVX(DLG_Unit_cm) );                                
-		SendMessage( hwndMarginUnits, CB_INSERTSTRING , (WPARAM) DIM_MM,   (LPARAM) _GVX(DLG_Unit_mm) );                                
-
-		// Initialize Data
-		SendMessage( hwndMarginUnits, CB_SETCURSEL, (WPARAM) m_pParent->getMarginUnits(), (LPARAM) 0 );
-		SetWindowLong(getHandle(), GWL_USERDATA, (LONG)this);
+
 }
 
 int CALLBACK AP_Win32Dialog_PageSetup_Margin::s_pageWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 {
-	if (msg==WM_NOTIFY)
-	{
-		AP_Win32Dialog_PageSetup_Margin *pThis = (AP_Win32Dialog_PageSetup_Margin *) GetWindowLong(hWnd, GWL_USERDATA);					
-
-		LPNMUPDOWN lpnmud = (LPNMUPDOWN)lParam;
-
-		if ( lpnmud->hdr.code == UDN_DELTAPOS )
-		{
-			pThis->doSpinControl(lpnmud->hdr.idFrom, -lpnmud->iDelta);
-		}
-	}   	
-	
-	return XAP_Win32PropertyPage::s_pageWndProc(hWnd, msg, wParam,lParam);
+	return 0;
 }
 
 void AP_Win32Dialog_PageSetup_Margin::doSpinControl(UT_uint32 id, UT_sint32 delta)
 {
-	int updatedData =  0;
-	int pageScale   = ( m_pParent->getPageUnits()   == DIM_MM ) ? 1 : 10;
-	int marginScale = ( m_pParent->getMarginUnits() == DIM_MM ) ? 1 : 10;
-
-	switch( id )
-	{
-	case AP_RID_DIALOG_PAGE_SETUP_SPN_TOP:
-		updatedData = (int)( m_pParent->getMarginTop()*marginScale + delta + 0.05f );
-		if( updatedData >= 0 ) 
-		{
-			m_pParent->setMarginTop( (float) updatedData/marginScale );
-			m_pParent->updateTopMargin();
-			m_pParent->updatePreview();
-		}
-		break;
-
-	case AP_RID_DIALOG_PAGE_SETUP_SPN_BOTTOM:
-		updatedData = (int)( m_pParent->getMarginBottom()*marginScale + delta + 0.05f );
-		if( updatedData >= 0 ) 
-		{
-			m_pParent->setMarginBottom( (float) updatedData/marginScale );
-			m_pParent->updateBottomMargin();
-			m_pParent->updatePreview();
-		}
-		break;
-
-	case AP_RID_DIALOG_PAGE_SETUP_SPN_LEFT:
-		updatedData = (int)( m_pParent->getMarginLeft()*marginScale + delta + 0.05f );
-		if( updatedData >= 0 )
-		{
-			m_pParent->setMarginLeft( (float) updatedData/marginScale );
-			m_pParent->updateLeftMargin();
-			m_pParent->updatePreview();
-		}
-		break;
-
-	case AP_RID_DIALOG_PAGE_SETUP_SPN_RIGHT:
-		updatedData = (int)( m_pParent->getMarginRight()*marginScale + delta + 0.05f );
-		if( updatedData >= 0 ) 
-		{
-			m_pParent->setMarginRight( (float) updatedData/marginScale );
-			m_pParent->updateRightMargin();
-			m_pParent->updatePreview();
-		}
-		break;
-
-	case AP_RID_DIALOG_PAGE_SETUP_SPN_HEADER:
-		updatedData = (int)( m_pParent->getMarginHeader()*marginScale + delta + 0.05f );
-		if( updatedData >= 0 ) 
-		{
-			m_pParent->setMarginHeader( (float) updatedData/marginScale );
-			m_pParent->updateHeaderMargin();
-			m_pParent->updatePreview();
-		}
-		break;
-
-	case AP_RID_DIALOG_PAGE_SETUP_SPN_FOOTER:
-		updatedData = (int)( m_pParent->getMarginFooter()*marginScale + delta + 0.05f );
-		if( updatedData >= 0 ) 
-		{
-			m_pParent->setMarginFooter( (float) updatedData/marginScale );
-			m_pParent->updateFooterMargin();
-			m_pParent->updatePreview();
-		}
-		break;
-
-	default:
-		break;
-	}
+	
 }
 
 
@@ -774,20 +248,13 @@
 void AP_Win32Dialog_PageSetup::updateWidth()
 {
 
-	char buf[BUFSIZE];
-
-	sprintf (buf, FMT_STRING, m_PageSize.Width (getPageUnits()));
-	SetDlgItemText( m_page.getHandle(),
-			AP_RID_DIALOG_PAGE_SETUP_EBX_WIDTH, buf);
+	
 	
 }
 
 void AP_Win32Dialog_PageSetup::updateHeight()
 {
-	char buf[BUFSIZE];
-	sprintf (buf, FMT_STRING, m_PageSize.Height(getPageUnits()));
-	SetDlgItemText( m_page.getHandle(),
-   	                AP_RID_DIALOG_PAGE_SETUP_EBX_HEIGHT, buf);
+	
 }
 
 
@@ -803,119 +270,35 @@
 
 void AP_Win32Dialog_PageSetup::updateTopMargin()
 {
-	char buf[BUFSIZE];
-	SetDlgItemText( m_margin.getHandle(),
-                    AP_RID_DIALOG_PAGE_SETUP_EBX_TOP,
-                    gcvt( (double)getMarginTop(), SIGDIGIT, buf ) );
+
 }
 
 void AP_Win32Dialog_PageSetup::updateBottomMargin()
 {
-	char buf[BUFSIZE];
-	SetDlgItemText( m_margin.getHandle(),
-                    AP_RID_DIALOG_PAGE_SETUP_EBX_BOTTOM,
-                    gcvt( (double)getMarginBottom(), SIGDIGIT, buf ) );
+
 }
 
 void AP_Win32Dialog_PageSetup::updateLeftMargin()
 {
-	char buf[BUFSIZE];
-	SetDlgItemText( m_margin.getHandle(),
-                    AP_RID_DIALOG_PAGE_SETUP_EBX_LEFT,
-                    gcvt( (double)getMarginLeft(), SIGDIGIT, buf ) );
+
 }
 
 void AP_Win32Dialog_PageSetup::updateRightMargin()
 {
-	char buf[BUFSIZE];
-	SetDlgItemText( m_margin.getHandle(),
-                    AP_RID_DIALOG_PAGE_SETUP_EBX_RIGHT,
-                    gcvt( (double)getMarginRight(), SIGDIGIT, buf ) );
+
 }
 
 void AP_Win32Dialog_PageSetup::updateHeaderMargin()
 {
-	char buf[BUFSIZE];
-	SetDlgItemText( m_margin.getHandle(),
-                    AP_RID_DIALOG_PAGE_SETUP_EBX_HEADER,
-                    gcvt( (double)getMarginHeader(), SIGDIGIT, buf ) );
+
 }
 
 void AP_Win32Dialog_PageSetup::updateFooterMargin()
 {
-	char buf[BUFSIZE];
-	SetDlgItemText( m_margin.getHandle(),
-                    AP_RID_DIALOG_PAGE_SETUP_EBX_FOOTER,
-                    gcvt( (double)getMarginFooter(), SIGDIGIT, buf ) );
+
 }
 
 void AP_Win32Dialog_PageSetup::updatePreview()
 {
-	UT_uint16 offset = 5;
-
-	RECT rectBorder;
-	RECT rectPage;
-	RECT rectShadow;
-	RECT rectMargin;
-
-	COLORREF colorBackground = GetSysColor(COLOR_BTNFACE);
-	COLORREF colorWhite(0x00FFFFFF);
-	COLORREF colorBlack(0x00000000);
-	HBRUSH brushBackground = CreateSolidBrush( colorBackground );
-	HBRUSH brushWhite = CreateSolidBrush( colorWhite );
-	HBRUSH brushBlack = CreateSolidBrush( colorBlack );
-
-	HWND hwndPreview = GetDlgItem( m_page.getHandle(),
-		                            AP_RID_DIALOG_PAGE_SETUP_BMP_PREVIEW );
-
-	HWND hwndMargin = GetDlgItem( m_margin.getHandle(),
-								  AP_RID_DIALOG_PAGE_SETUP_BMP_MARGINPREVIEW );
-	// Calculate Rectangles
-	GetClientRect(hwndPreview, &rectBorder);
-	
-	UT_uint16 borderWidth  = rectBorder.right  - rectBorder.left - offset;
-	UT_uint16 borderHeight = rectBorder.bottom - rectBorder.top  - offset;
-
-	UT_uint16 pageWidth  = (UT_uint16) m_PageSize.Width( DIM_MM );  // in mm
-	UT_uint16 pageHeight = (UT_uint16) m_PageSize.Height( DIM_MM ); // in mm
-	UT_uint16 marginTop  = (UT_uint16) (getMarginTop() * mScale[getMarginUnits()] );
-	UT_uint16 marginLeft = (UT_uint16) (getMarginLeft() * mScale[getMarginUnits()] );
-	UT_uint16 marginRight= (UT_uint16) (getMarginRight() * mScale[getMarginUnits()] );
-	UT_uint16 marginBottom  = (UT_uint16) (getMarginBottom() * mScale[getMarginUnits()] );
-
-	double scale = ( (double)pageWidth/borderWidth > (double)pageHeight/borderHeight ) ?
-					(double)pageWidth / borderWidth :
-					(double)pageHeight / borderHeight ;
-
-	rectPage.left   = rectBorder.left   + ( borderWidth  - (int)(pageWidth/scale) ) / 2;
-	rectPage.right  = rectBorder.right  - ( borderWidth  - (int)(pageWidth/scale) ) / 2 - offset;
-	rectPage.top    = rectBorder.top    + ( borderHeight - (int)(pageHeight/scale) ) / 2;
-	rectPage.bottom = rectBorder.bottom - ( borderHeight - (int)(pageHeight/scale) ) / 2 - offset;
-
-	CopyRect( &rectShadow, &rectPage );
-	OffsetRect( &rectShadow, offset, offset );
-
-	rectMargin.left   = rectPage.left  + (int)(marginLeft/scale);
-	rectMargin.right  = rectPage.right - (int)(marginRight/scale);
-	rectMargin.top    = rectPage.top   + (int)(marginTop/scale);
-	rectMargin.bottom = rectPage.bottom - (int)(marginBottom/scale);
-
-	HDC hDC = CreateCompatibleDC(NULL);
-
-	SelectObject( hDC, m_bmpPreview );
-	FillRect( hDC, &rectBorder, brushBackground );
-	FillRect( hDC, &rectShadow, brushBlack );
-	FillRect( hDC, &rectPage, brushWhite );
-	FrameRect( hDC, &rectMargin, brushBlack );
-
-	SendMessage( hwndPreview, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)m_bmpPreview );
-	InvalidateRgn( hwndPreview, NULL, FALSE );
-
-	if( hwndMargin )
-	{
-		SendMessage( hwndMargin,  STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)m_bmpPreview );
-		InvalidateRgn( hwndMargin,  NULL, FALSE );
-	}
 	
-	DeleteDC( hDC );
 }
Index: src/wp/ap/win/ap_Win32Dialog_PageSetup.h
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Dialog_PageSetup.h,v
retrieving revision 1.9
diff -u -r1.9 ap_Win32Dialog_PageSetup.h
--- src/wp/ap/win/ap_Win32Dialog_PageSetup.h	16 Jan 2007 23:16:28 -0000	1.9
+++ src/wp/ap/win/ap_Win32Dialog_PageSetup.h	9 Apr 2007 08:37:54 -0000
@@ -37,7 +37,7 @@
 		
 		void setParent(AP_Win32Dialog_PageSetup*	pData){m_pParent=pData;};
 		AP_Win32Dialog_PageSetup* getParent(){return m_pParent;};
-		int _onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);
+		BOOL _onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);
 		static int CALLBACK s_sheetInit(HWND hwnd,  UINT uMsg,  LPARAM lParam);
 		
 private:		
@@ -65,7 +65,7 @@
 
 	void						_onInitDialog();
 	void						_onKillActive(){};
-	void						_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);
+	BOOL						_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);
 		
 	AP_Win32Dialog_PageSetup*	m_pParent;	
     int							m_nCentered;	
@@ -91,7 +91,7 @@
 
 	void						_onInitDialog();
 	void						_onKillActive(){};
-	void						_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);
+	BOOL						_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);
 		
 	AP_Win32Dialog_PageSetup*	m_pParent;	
 	
Index: src/wp/ap/win/ap_Win32Dialog_Paragraph.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Dialog_Paragraph.cpp,v
retrieving revision 1.25
diff -u -r1.25 ap_Win32Dialog_Paragraph.cpp
--- src/wp/ap/win/ap_Win32Dialog_Paragraph.cpp	16 Jan 2007 23:16:28 -0000	1.25
+++ src/wp/ap/win/ap_Win32Dialog_Paragraph.cpp	9 Apr 2007 08:37:55 -0000
@@ -222,68 +222,7 @@
 
 BOOL AP_Win32Dialog_Paragraph::_onInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
-	const XAP_StringSet * pSS = m_pApp->getStringSet();
-
-	SetWindowText(hWnd, pSS->getValue(AP_STRING_ID_DLG_Para_ParaTitle));
-
-	// localize controls
-	_DSX(PARA_BTN_OK,			DLG_OK);
-	_DSX(PARA_BTN_CANCEL,		DLG_Cancel);
-
-	_DS(PARA_BTN_TABS,			DLG_Para_ButtonTabs);
-
-	// setup the tabs
-	{
-		TabParam tp;
-		TCITEM tie;
-
-		XAP_Win32App * pWin32App = static_cast<XAP_Win32App *>(m_pApp);
-		HINSTANCE hinst = pWin32App->getInstance();
-		DLGTEMPLATE * pTemplate = NULL;
-		HWND w = NULL;
-
-		tp.pThis = this;
-
-		// remember the windows we're using
-
-		m_hwndDlg = hWnd;
-		m_hwndTab = GetDlgItem(hWnd, AP_RID_DIALOG_PARA_TAB);
-
-		// add a tab for each of the child dialog boxes
-
-		tie.mask = TCIF_TEXT | TCIF_IMAGE | TCIF_PARAM;
-		tie.iImage = -1;
-		tie.pszText = (LPSTR) _GV(DLG_Para_TabLabelIndentsAndSpacing);
-		tie.lParam = AP_RID_DIALOG_PARA_TAB1;
-		TabCtrl_InsertItem(m_hwndTab, 0, &tie);
-		tie.pszText = (LPSTR) _GV(DLG_Para_TabLabelLineAndPageBreaks);
-		tie.lParam = AP_RID_DIALOG_PARA_TAB2;
-		TabCtrl_InsertItem(m_hwndTab, 1, &tie);
-
-		// finally, create the (modeless) child dialogs
-
-		tp.which = AP_RID_DIALOG_PARA_TAB1;
-		pTemplate = UT_LockDlgRes(hinst, MAKEINTRESOURCE(tp.which));
-		w = CreateDialogIndirectParam(hinst, pTemplate, m_hwndTab,
-										(DLGPROC)s_tabProc, (LPARAM)&tp);
-		UT_ASSERT_HARMLESS((w && (w == m_hwndSpacing)));
-
-		tp.which = AP_RID_DIALOG_PARA_TAB2;
-		pTemplate = UT_LockDlgRes(hinst, MAKEINTRESOURCE(tp.which));
-		w = CreateDialogIndirectParam(hinst, pTemplate, m_hwndTab,
-										(DLGPROC)s_tabProc, (LPARAM)&tp);
-		UT_ASSERT_HARMLESS((w && (w == m_hwndBreaks)));
-	}
-
-	// HACK: make sure the first tab is visible
-	// TODO: trigger selchange logic instead
-	ShowWindow(m_hwndSpacing, SW_SHOW);
-
-	// sync all controls once to get started
-	// HACK: the first arg gets ignored
-	_syncControls(id_MENU_ALIGNMENT, true);
-	XAP_Win32DialogHelper::s_centerDialog(hWnd);	
-	return 1;							// 1 == we did not call SetFocus()
+	return 0;
 }
 
 /*****************************************************************/
@@ -294,156 +233,6 @@
 
 BOOL AP_Win32Dialog_Paragraph::_onInitTab(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
-	const XAP_StringSet * pSS = m_pApp->getStringSet();
-
-	// position ourselves w.r.t. containing tab
-
-	RECT r;
-	GetClientRect(m_hwndTab, &r);
-	TabCtrl_AdjustRect(m_hwndTab, FALSE, &r);
-    SetWindowPos(hWnd, HWND_TOP, r.left, r.top, 0, 0, SWP_NOSIZE);
-
-	// remember which window is which tab
-
-	TabParam * pTP = (TabParam *) lParam;
-	switch (pTP->which)
-	{
-	case AP_RID_DIALOG_PARA_TAB1:		// first tab
-		{
-			m_hwndSpacing = hWnd;
-
-			// Hide Bidi Check Box unless required
-			{
-				HWND hwndBidi = GetDlgItem(hWnd, AP_RID_DIALOG_PARA_CHECK_BIDI);
-				ShowWindow(hwndBidi,SW_HIDE);
-				ShowWindow(hwndBidi,SW_SHOW);
-			}
-
-			// localize controls
-			_DS(PARA_TEXT_ALIGN,		DLG_Para_LabelAlignment);
-			_DS(PARA_TEXT_INDENT,		DLG_Para_LabelIndentation);
-			_DS(PARA_TEXT_LEFT,			DLG_Para_LabelLeft);
-			_DS(PARA_TEXT_RIGHT,		DLG_Para_LabelRight);
-			_DS(PARA_TEXT_HANG,			DLG_Para_LabelSpecial);
-			_DS(PARA_TEXT_BY,			DLG_Para_LabelBy);
-			_DS(PARA_TEXT_SPACING,		DLG_Para_LabelSpacing);
-			_DS(PARA_TEXT_BEFORE,		DLG_Para_LabelBefore);
-			_DS(PARA_TEXT_AFTER,		DLG_Para_LabelAfter);
-			_DS(PARA_TEXT_LEAD,			DLG_Para_LabelLineSpacing);
-			_DS(PARA_TEXT_AT,			DLG_Para_LabelAt);
-			_DS(PARA_CHECK_BIDI,		DLG_Para_DomDirection);
-
-			// populate fixed choices
-			{
-				HWND hwndAlign = GetDlgItem(hWnd, AP_RID_DIALOG_PARA_COMBO_ALIGN);
-				// insert the empty value (for multi-para selections with different state)
-				SendMessage(hwndAlign, CB_ADDSTRING, 0, (LPARAM) "");
-				_CAS(hwndAlign, DLG_Para_AlignLeft);
-				_CAS(hwndAlign, DLG_Para_AlignCentered);
-				_CAS(hwndAlign, DLG_Para_AlignRight);
-				_CAS(hwndAlign, DLG_Para_AlignJustified);
-				SendMessage(hwndAlign, CB_SETCURSEL, (WPARAM) _getMenuItemValue(id_MENU_ALIGNMENT), 0);
-
-				HWND hwndHang = GetDlgItem(hWnd, AP_RID_DIALOG_PARA_COMBO_HANG);
-				SendMessage(hwndHang, CB_ADDSTRING, 0, (LPARAM) "");
-				_CAS(hwndHang, DLG_Para_SpecialNone);
-				_CAS(hwndHang, DLG_Para_SpecialFirstLine);
-				_CAS(hwndHang, DLG_Para_SpecialHanging);
-				SendMessage(hwndHang, CB_SETCURSEL, (WPARAM) _getMenuItemValue(id_MENU_SPECIAL_INDENT), 0);
-
-				HWND hwndLead = GetDlgItem(hWnd, AP_RID_DIALOG_PARA_COMBO_LEAD);
-				SendMessage(hwndLead, CB_ADDSTRING, 0, (LPARAM) "");
-				_CAS(hwndLead, DLG_Para_SpacingSingle);
-				_CAS(hwndLead, DLG_Para_SpacingHalf);
-				_CAS(hwndLead, DLG_Para_SpacingDouble);
-				_CAS(hwndLead, DLG_Para_SpacingAtLeast);
-				_CAS(hwndLead, DLG_Para_SpacingExactly);
-				_CAS(hwndLead, DLG_Para_SpacingMultiple);
-				SendMessage(hwndLead, CB_SETCURSEL, (WPARAM) _getMenuItemValue(id_MENU_SPECIAL_SPACING), 0);
-			}
-
-			// set initial state
-			_SST(PARA_EDIT_LEFT,	id_SPIN_LEFT_INDENT);
-			_SST(PARA_EDIT_RIGHT,	id_SPIN_RIGHT_INDENT);
-			_SST(PARA_EDIT_BY,		id_SPIN_SPECIAL_INDENT);
-			_SST(PARA_EDIT_BEFORE,	id_SPIN_BEFORE_SPACING);
-			_SST(PARA_EDIT_AFTER,	id_SPIN_AFTER_SPACING);
-			_SST(PARA_EDIT_AT,		id_SPIN_SPECIAL_SPACING);
-			_CDB(PARA_CHECK_BIDI,	id_CHECK_DOMDIRECTION);
-		}
-		break;
-
-	case AP_RID_DIALOG_PARA_TAB2:		// second tab
-		{
-			m_hwndBreaks = hWnd;
-
-			// localize controls
-			_DS(PARA_TEXT_PAGE,			DLG_Para_LabelPagination);
-			_DS(PARA_CHECK_WIDOW,		DLG_Para_PushWidowOrphanControl);
-			_DS(PARA_CHECK_NEXT,		DLG_Para_PushKeepWithNext);
-			_DS(PARA_CHECK_TOGETHER,	DLG_Para_PushKeepLinesTogether);
-			_DS(PARA_CHECK_BREAK,		DLG_Para_PushPageBreakBefore);
-			_DS(PARA_CHECK_SUPPRESS,	DLG_Para_PushSuppressLineNumbers);
-			_DS(PARA_CHECK_NOHYPHEN,	DLG_Para_PushNoHyphenate);
-
-			// set initial state
-			_CDB(PARA_CHECK_WIDOW,		id_CHECK_WIDOW_ORPHAN);
-			_CDB(PARA_CHECK_NEXT,		id_CHECK_KEEP_NEXT);
-			_CDB(PARA_CHECK_TOGETHER,	id_CHECK_KEEP_LINES);
-			_CDB(PARA_CHECK_BREAK,		id_CHECK_PAGE_BREAK);
-			_CDB(PARA_CHECK_SUPPRESS,	id_CHECK_SUPPRESS);
-			_CDB(PARA_CHECK_NOHYPHEN,	id_CHECK_NO_HYPHENATE);
-		}
-		break;
-
-	default:
-		UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
-		break;
-	}
-
-	// the following are common to each tab
-
-	_DS(PARA_TEXT_PREVIEW,		DLG_Para_LabelPreview);
-
-	if (!m_pPreviewWidget)
-	{
-		// for XP purposes, life is simplest if we only have one preview
-		// widget which "floats" above both tabs.  to get the window
-		// parentage right, we use the dimensions and location of the
-		// owner-draw control on the tab to position *another* dummy
-		// window which is parented by the main dialog instead.
-
-		HWND hwndChild = GetDlgItem(hWnd, AP_RID_DIALOG_PARA_PREVIEW);
-		HWND hwndFloater = GetDlgItem(m_hwndDlg, AP_RID_DIALOG_PARA_PREVIEW);
-
-		RECT r2;
-		GetWindowRect(hwndChild, &r2);
-
-		POINT pt;
-		pt.x = r2.left;
-		pt.y = r2.top;
-		ScreenToClient(m_hwndDlg, &pt);
-
-		SetWindowPos(hwndFloater, HWND_TOP, pt.x, pt.y,
-					 r2.right - r2.left, r2.bottom - r2.top, SWP_NOREDRAW);
-
-		// use this floater window as a parent to the widget that we create
-		// here and thus have complete control of.
-
-		m_pPreviewWidget = new XAP_Win32PreviewWidget(static_cast<XAP_Win32App *>(m_pApp),
-													  hwndFloater,
-													  0);
-
-		// instantiate the XP preview object using the win32 preview widget (window)
-		// we just created.  we seem to have a mish-mash of terms here, sorry.
-
-		UT_uint32 w,h;
-		m_pPreviewWidget->getWindowSize(&w,&h);
-
-		_createPreviewFromGC(m_pPreviewWidget->getGraphics(),w,h);
-		m_pPreviewWidget->setPreview(m_paragraphPreview); // we need this to call draw() on WM_PAINTs
-//		_updatePreview();
-	}
 
 	return 1;							// 1 == we did not call SetFocus()
 }
@@ -497,50 +286,9 @@
 
 BOOL AP_Win32Dialog_Paragraph::_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
-	WORD wNotifyCode = HIWORD(wParam);
-	WORD wId = LOWORD(wParam);
-	HWND hWndCtrl = (HWND)lParam;
-
-	switch (wId)
-	{
-	_COMBO(PARA_COMBO_ALIGN,	id_MENU_ALIGNMENT);
-	_COMBO(PARA_COMBO_HANG,		id_MENU_SPECIAL_INDENT);
-	_COMBO(PARA_COMBO_LEAD,		id_MENU_SPECIAL_SPACING);
-
-	_EDIT(PARA_EDIT_LEFT,		id_SPIN_LEFT_INDENT);
-	_EDIT(PARA_EDIT_RIGHT,		id_SPIN_RIGHT_INDENT);
-	_EDIT(PARA_EDIT_BY,			id_SPIN_SPECIAL_INDENT);
-	_EDIT(PARA_EDIT_BEFORE,		id_SPIN_BEFORE_SPACING);
-	_EDIT(PARA_EDIT_AFTER,		id_SPIN_AFTER_SPACING);
-	_EDIT(PARA_EDIT_AT,			id_SPIN_SPECIAL_SPACING);
-
-	_CHECK(PARA_CHECK_WIDOW,	id_CHECK_WIDOW_ORPHAN);
-	_CHECK(PARA_CHECK_NEXT,		id_CHECK_KEEP_NEXT);
-	_CHECK(PARA_CHECK_TOGETHER,	id_CHECK_KEEP_LINES);
-	_CHECK(PARA_CHECK_BREAK,	id_CHECK_PAGE_BREAK);
-	_CHECK(PARA_CHECK_SUPPRESS,	id_CHECK_SUPPRESS);
-	_CHECK(PARA_CHECK_NOHYPHEN,	id_CHECK_NO_HYPHENATE);
-	_CHECK(PARA_CHECK_BIDI,		id_CHECK_DOMDIRECTION);
-
-	case IDCANCEL:						// also AP_RID_DIALOG_PARA_BTN_CANCEL
-		m_answer = a_CANCEL;
-		EndDialog(hWnd,0);
-		return 1;
-
-	case IDOK:							// also AP_RID_DIALOG_PARA_BTN_OK
-		m_answer = a_OK;
-		EndDialog(hWnd,0);
-		return 1;
-
-	case AP_RID_DIALOG_PARA_BTN_TABS:
-		m_answer = a_TABS;
-		EndDialog(hWnd,0);
-		return 1;
-
-	default:							// we did not handle this notification
-		UT_DEBUGMSG(("WM_Command for id %ld\n",wId));
-		return 0;						// return zero to let windows take care of it.
-	}
+
+	return 0;						// return zero to let windows take care of it.
+
 }
 
 /*****************************************************************/
@@ -558,29 +306,7 @@
 
 BOOL AP_Win32Dialog_Paragraph::_onDeltaPos(NM_UPDOWN * pnmud)
 {
-	// respond to WM_NOTIFY/UDN_DELTAPOS message
-	// return TRUE to prevent the change from happening
-	// return FALSE to allow it to occur
-	// we may alter the change by changing the fields in pnmud.
-
-	UT_DEBUGMSG(("onDeltaPos: [idFrom %d][iPos %d][iDelta %d]\n",
-				 pnmud->hdr.idFrom,pnmud->iPos,pnmud->iDelta));
-
-	char buf[SPIN_BUF_TEXT_SIZE];
-
-	switch(pnmud->hdr.idFrom)
-	{
-	_SPIN(m_hwndSpacing, LEFT,		id_SPIN_LEFT_INDENT);
-	_SPIN(m_hwndSpacing, RIGHT,		id_SPIN_RIGHT_INDENT);
-	_SPIN(m_hwndSpacing, BY,		id_SPIN_SPECIAL_INDENT);
-	_SPIN(m_hwndSpacing, BEFORE,	id_SPIN_BEFORE_SPACING);
-	_SPIN(m_hwndSpacing, AFTER,		id_SPIN_AFTER_SPACING);
-	_SPIN(m_hwndSpacing, AT,		id_SPIN_SPECIAL_SPACING);
-
-	default:
-		UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
-		break;
-	}
+
 
 	return FALSE;
 }
@@ -594,83 +320,5 @@
 
 void AP_Win32Dialog_Paragraph::_syncControls(tControl changed, bool bAll /* = false */)
 {
-	// let parent sync any member variables first
-
-	AP_Dialog_Paragraph::_syncControls(changed, bAll);
-
-	// sync the display
-
-	// 1.  link the "hanging indent by" combo and spinner
-
-	if (bAll || (changed == id_SPIN_SPECIAL_INDENT))
-	{
-		// typing in the control can change the associated combo
-		if (_getMenuItemValue(id_MENU_SPECIAL_INDENT) == indent_FIRSTLINE)
-		{
-			HWND h = GetDlgItem(m_hwndSpacing, AP_RID_DIALOG_PARA_COMBO_HANG);
-			SendMessage(h, CB_SETCURSEL, (WPARAM) _getMenuItemValue(id_MENU_SPECIAL_INDENT), 0);
-		}
-	}
-	if (bAll || (changed == id_MENU_SPECIAL_INDENT))
-	{
-		switch(_getMenuItemValue(id_MENU_SPECIAL_INDENT))
-		{
-		case indent_NONE:
-			// clear the spin control
-			SetDlgItemText(m_hwndSpacing, AP_RID_DIALOG_PARA_EDIT_BY, NULL);
-			break;
-
-		default:
-			// set the spin control
-			SetDlgItemText(m_hwndSpacing, AP_RID_DIALOG_PARA_EDIT_BY, _getSpinItemValue(id_SPIN_SPECIAL_INDENT));
-			break;
-		}
-	}
-
-	// 2.  link the "line spacing at" combo and spinner
-
-	if (bAll || (changed == id_SPIN_SPECIAL_SPACING))
-	{
-		// typing in the control can change the associated combo
-		if (_getMenuItemValue(id_MENU_SPECIAL_SPACING) == spacing_MULTIPLE)
-		{
-			HWND h = GetDlgItem(m_hwndSpacing, AP_RID_DIALOG_PARA_COMBO_LEAD);
-			SendMessage(h, CB_SETCURSEL, (WPARAM) _getMenuItemValue(id_MENU_SPECIAL_SPACING), 0);
-		}
-	}
-	if (bAll || (changed == id_MENU_SPECIAL_SPACING))
-	{
-		switch(_getMenuItemValue(id_MENU_SPECIAL_SPACING))
-		{
-		case spacing_SINGLE:
-		case spacing_ONEANDHALF:
-		case spacing_DOUBLE:
-			// clear the spin control
-			SetDlgItemText(m_hwndSpacing, AP_RID_DIALOG_PARA_EDIT_AT, NULL);
-			break;
-
-		default:
-			// set the spin control
-			SetDlgItemText(m_hwndSpacing, AP_RID_DIALOG_PARA_EDIT_AT, _getSpinItemValue(id_SPIN_SPECIAL_SPACING));
-			break;
-		}
-	}
-
-	// 3.  move results of _doSpin() back to screen
-
-	if (!bAll)
-	{
-		// spin controls only sync when spun
-		switch (changed)
-		{
-		_syncSPIN(m_hwndSpacing, PARA_EDIT_LEFT,	id_SPIN_LEFT_INDENT)
-		_syncSPIN(m_hwndSpacing, PARA_EDIT_RIGHT,	id_SPIN_RIGHT_INDENT)
-		_syncSPIN(m_hwndSpacing, PARA_EDIT_BY,		id_SPIN_SPECIAL_INDENT)
-		_syncSPIN(m_hwndSpacing, PARA_EDIT_BEFORE,	id_SPIN_BEFORE_SPACING)
-		_syncSPIN(m_hwndSpacing, PARA_EDIT_AFTER,	id_SPIN_AFTER_SPACING)
-		_syncSPIN(m_hwndSpacing, PARA_EDIT_AT,		id_SPIN_SPECIAL_SPACING)
-		default:
-			break;
-		}
-	}
+	
 }
Index: src/wp/ap/win/ap_Win32Dialog_Replace.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Dialog_Replace.cpp,v
retrieving revision 1.41
diff -u -r1.41 ap_Win32Dialog_Replace.cpp
--- src/wp/ap/win/ap_Win32Dialog_Replace.cpp	7 Apr 2007 17:50:23 -0000	1.41
+++ src/wp/ap/win/ap_Win32Dialog_Replace.cpp	9 Apr 2007 08:37:56 -0000
@@ -50,7 +50,7 @@
 											   XAP_Dialog_Id id)
 	: AP_Dialog_Replace(pDlgFactory,id)
 {
-	m_hWnd = 0;
+	
 }
 
 AP_Win32Dialog_Replace::~AP_Win32Dialog_Replace(void)
@@ -60,45 +60,39 @@
 void AP_Win32Dialog_Replace::activate(void)
 {
 	int iResult;
+	UT_Win32LocaleString findstr;
 
 	// Update the caption
 	ConstructWindowName();
-	SetWindowText(m_hWnd, (AP_Win32App::s_fromUTF8ToWinLocale(m_WindowName)).c_str()); 
+	setDialogTitle(m_WindowName);
 
-	SetFocus( GetDlgItem( m_hWnd,AP_RID_DIALOG_REPLACE_COMBO_FIND) );
+	SetFocus( GetDlgItem( m_hDlg,AP_RID_DIALOG_REPLACE_COMBO_FIND) );
 
-	iResult = ShowWindow( m_hWnd, SW_SHOW );
+	iResult = ShowWindow( m_hDlg, SW_SHOW );
 
-	iResult = BringWindowToTop( m_hWnd );
+	iResult = BringWindowToTop( m_hDlg );
 	
 	UT_return_if_fail ((iResult != 0));
 	
 	{
 	UT_UCSChar * bufferUnicode = getFindString();
-	UT_uint32 lenUnicode = UT_UCS4_strlen(bufferUnicode);
-	if (lenUnicode)
+	findstr.fromUCS4 (bufferUnicode);
+	if (!findstr.empty())
 	{
-		char * bufferNormal = new char [lenUnicode + 1];
-		UT_UCS4_strcpy_to_char(bufferNormal, bufferUnicode);
-		SetDlgItemText(m_hWnd,AP_RID_DIALOG_REPLACE_COMBO_FIND,bufferNormal);
-		SendMessage(GetDlgItem(m_hWnd,AP_RID_DIALOG_REPLACE_COMBO_FIND), CB_SETEDITSEL, 0, MAKELONG (0, -1));
-		DELETEP(bufferNormal);
+		SetDlgItemText(m_hDlg, AP_RID_DIALOG_REPLACE_COMBO_FIND,findstr.c_str());
+		SendMessage(GetDlgItem(m_hDlg,AP_RID_DIALOG_REPLACE_COMBO_FIND), CB_SETEDITSEL, 0, MAKELONG (0, -1));		
 	}
 	FREEP(bufferUnicode);
 	}
 	
 	if (m_id == AP_DIALOG_ID_REPLACE)
-	{
-	
+	{	
 		UT_UCSChar * bufferUnicode = getReplaceString();
-		UT_uint32 lenUnicode = UT_UCS4_strlen(bufferUnicode);
-		if (lenUnicode)
-		{
-			char * bufferNormal = new char [lenUnicode + 1];
-			UT_UCS4_strcpy_to_char(bufferNormal, bufferUnicode);
-			SetDlgItemText(m_hWnd,AP_RID_DIALOG_REPLACE_COMBO_REPLACE,bufferNormal);
-			SendMessage(GetDlgItem(m_hWnd,AP_RID_DIALOG_REPLACE_COMBO_FIND), CB_SETEDITSEL, 0, MAKELONG (0, -1));
-			DELETEP(bufferNormal);
+		findstr.fromUCS4 (bufferUnicode);
+		if (!findstr.empty())
+		{			
+			SetDlgItemText(m_hDlg,AP_RID_DIALOG_REPLACE_COMBO_REPLACE,findstr.c_str());
+			SendMessage(GetDlgItem(m_hDlg,AP_RID_DIALOG_REPLACE_COMBO_FIND), CB_SETEDITSEL, 0, MAKELONG (0, -1));			
 		}
 		FREEP(bufferUnicode);
 	}
@@ -107,7 +101,7 @@
 
 void AP_Win32Dialog_Replace::destroy(void)
 {
-	int iResult = DestroyWindow( m_hWnd );
+	int iResult = DestroyWindow( m_hDlg );
 
 	UT_ASSERT_HARMLESS((iResult != 0));
 
@@ -116,24 +110,24 @@
 
 void AP_Win32Dialog_Replace::notifyActiveFrame(XAP_Frame *pFrame)
 {
-	if((HWND)GetWindowLong(m_hWnd, GWL_HWNDPARENT) != static_cast<XAP_Win32FrameImpl*>(pFrame->getFrameImpl())->getTopLevelWindow())
+	if((HWND)GetWindowLong(m_hDlg, GWL_HWNDPARENT) != static_cast<XAP_Win32FrameImpl*>(pFrame->getFrameImpl())->getTopLevelWindow())
 	{
 		// Update the caption
 		ConstructWindowName();
-		SetWindowText(m_hWnd, (AP_Win32App::s_fromUTF8ToWinLocale(m_WindowName)).c_str()); 
+		setDialogTitle(m_WindowName);
 
-		SetWindowLong(m_hWnd, GWL_HWNDPARENT, (long)static_cast<XAP_Win32FrameImpl*>(pFrame->getFrameImpl())->getTopLevelWindow());
-		SetWindowPos(m_hWnd, NULL, 0, 0, 0, 0,
+		SetWindowLong(m_hDlg, GWL_HWNDPARENT, (long)static_cast<XAP_Win32FrameImpl*>(pFrame->getFrameImpl())->getTopLevelWindow());
+		SetWindowPos(m_hDlg, NULL, 0, 0, 0, 0,
 						SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
 	}
 }
 
 void AP_Win32Dialog_Replace::notifyCloseFrame(XAP_Frame *pFrame)
 {
-	if((HWND)GetWindowLong(m_hWnd, GWL_HWNDPARENT) == static_cast<XAP_Win32FrameImpl*>(pFrame->getFrameImpl())->getTopLevelWindow())
+	if((HWND)GetWindowLong(m_hDlg, GWL_HWNDPARENT) == static_cast<XAP_Win32FrameImpl*>(pFrame->getFrameImpl())->getTopLevelWindow())
 	{
-		SetWindowLong(m_hWnd, GWL_HWNDPARENT, NULL);
-		SetWindowPos(m_hWnd, NULL, 0, 0, 0, 0,
+		SetWindowLong(m_hDlg, GWL_HWNDPARENT, NULL);
+		SetWindowPos(m_hDlg, NULL, 0, 0, 0, 0,
 						SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
 	}
 }
@@ -154,31 +148,19 @@
 	}
 
 	setView(static_cast<FV_View *> (pFrame->getCurrentView()) );
+	createModeless(pFrame, lpTemplate);	
 
-	int iResult;
-	HWND hResult = CreateDialogParam(pWin32App->getInstance(),lpTemplate,
-							static_cast<XAP_Win32FrameImpl*>(pFrame->getFrameImpl())->getTopLevelWindow(),
-							(DLGPROC)s_dlgProc,(LPARAM)this);
-
-	UT_return_if_fail ((hResult != NULL));
-
-	m_hWnd = hResult;
-
-	// Save dialog the ID number and pointer to the widget
-	UT_sint32 sid =(UT_sint32)	getDialogId();
-	m_pApp->rememberModelessId( sid, (XAP_Dialog_Modeless *) m_pDialog);
+	// Save dialog the ID number and pointer to the widget	
+	m_pApp->rememberModelessId(/* (UT_sint32)*/	getDialogId(), (XAP_Dialog_Modeless *) m_pDialog);
 
 	// Update the caption
-	ConstructWindowName();
-	SetWindowText(m_hWnd, (AP_Win32App::s_fromUTF8ToWinLocale(m_WindowName)).c_str()); 
+	ConstructWindowName();	
+	setDialogTitle(m_WindowName);
 
-	iResult = ShowWindow( m_hWnd, SW_SHOW );
-
-	iResult = BringWindowToTop( m_hWnd );
-	UT_ASSERT_HARMLESS((iResult != 0));
+	ShowWindow( m_hDlg, SW_SHOW );	
 	m_pView->focusChange(AV_FOCUS_MODELESS);
 }
-
+/*
 BOOL CALLBACK AP_Win32Dialog_Replace::s_dlgProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
 {
 	// This is a static function.
@@ -207,7 +189,7 @@
 	default:
 		return 0;
 	}
-}
+}*/
 
 void AP_Win32Dialog_Replace::_initButtons(HWND hWnd)
 {
@@ -240,19 +222,17 @@
 	return;
 }
 
-#define _DS(c,s)	SetDlgItemText(hWnd,AP_RID_DIALOG_##c,pSS->getValue(AP_STRING_ID_##s))
-#define _DSX(c,s)	SetDlgItemText(hWnd,AP_RID_DIALOG_##c,pSS->getValue(XAP_STRING_ID_##s))
+#define _DS(c,s)	setDlgItemText(AP_RID_DIALOG_##c,pSS->getValue(AP_STRING_ID_##s))
+#define _DSX(c,s)	setDlgItemText(AP_RID_DIALOG_##c,pSS->getValue(XAP_STRING_ID_##s))
 
 BOOL AP_Win32Dialog_Replace::_onInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam)
-{
-	
-	
+{	
 	const XAP_StringSet * pSS = m_pApp->getStringSet();
 
 	if (m_id == AP_DIALOG_ID_FIND)
-		SetWindowText(hWnd, pSS->getValue(AP_STRING_ID_DLG_FR_FindTitle));
+		setDialogTitle(pSS->getValue(AP_STRING_ID_DLG_FR_FindTitle));
 	else
-		SetWindowText(hWnd, pSS->getValue(AP_STRING_ID_DLG_FR_ReplaceTitle));
+		setDialogTitle(pSS->getValue(AP_STRING_ID_DLG_FR_ReplaceTitle));
 
 	// localize controls shared across dialogs
 	_DS(REPLACE_BTN_FINDNEXT,		DLG_FR_FindNextButton);
@@ -277,8 +257,7 @@
 
 	SetFocus( GetDlgItem(hWnd,AP_RID_DIALOG_REPLACE_COMBO_FIND) );
 
-	XAP_Win32DialogHelper::s_centerDialog(hWnd);	
-	
+	centerDialog();
 	return 0;							// 0 == we did call SetFocus()
 }
 
@@ -361,10 +340,11 @@
 
 BOOL AP_Win32Dialog_Replace::_onBtn_Find(HWND hWnd, tFindType tFindType)
 {
-	char * pBufFromDialogFind = NULL;
-	UT_UCSChar * pUCSFind = NULL;
-	char * pBufFromDialogReplace = NULL;
+	TCHAR * pBufFromDialogFind = NULL;
+	//UT_UCSChar * pUCSFind = NULL;
+	TCHAR * pBufFromDialogReplace = NULL;
 	UT_UCSChar * pUCSReplace = NULL;
+	UT_Win32LocaleString findstr;
 
 	// Check find string
 	HWND hWndEditFind = GetDlgItem(hWnd,AP_RID_DIALOG_REPLACE_COMBO_FIND);
@@ -372,20 +352,22 @@
 	if (!lenFind)
 		return 1;
 
-	pBufFromDialogFind = new char [lenFind + 1];
+	pBufFromDialogFind = new TCHAR [lenFind + 1];
 	if (!pBufFromDialogFind)
 		goto FreeMemory;
 	GetWindowText(hWndEditFind,pBufFromDialogFind,lenFind+1);
 
 	UT_DEBUGMSG(("Find entry contents: [%s]\n",pBufFromDialogFind));
 
-	UT_UCS4_cloneString_char(&pUCSFind,pBufFromDialogFind);
-	if (!pUCSFind)
-		goto FreeMemory;
+	//UT_UCS4_cloneString_char(&pUCSFind,pBufFromDialogFind);
+	//if (!pUCSFind)
+	//	goto FreeMemory;
+	
+	findstr.fromLocale (pBufFromDialogFind);
 
-	setFindString(pUCSFind);
+	setFindString(findstr.ucs4_str().ucs4_str());
 
-	if (m_id == AP_DIALOG_ID_REPLACE)
+	/*if (m_id == AP_DIALOG_ID_REPLACE)
 	{
 		// Check Replace string
 		HWND hWndEditReplace = GetDlgItem(hWnd,AP_RID_DIALOG_REPLACE_COMBO_REPLACE);
@@ -403,7 +385,7 @@
 			goto FreeMemory;
 
 		setReplaceString(pUCSReplace);
-	}
+	}*/
 
 	if (tFindType == find_REPLACE_ALL)
 	{
@@ -428,7 +410,7 @@
 
 FreeMemory:
 	DELETEP(pBufFromDialogFind);
-	FREEP(pUCSFind);
+	//FREEP(pUCSFind);
 	DELETEP(pBufFromDialogReplace);
 	FREEP(pUCSReplace);
 	return 1;
@@ -436,8 +418,8 @@
 
 void AP_Win32Dialog_Replace::_updateLists()
 {		
-	_updateList(GetDlgItem(m_hWnd, AP_RID_DIALOG_REPLACE_COMBO_FIND), 		&m_findList);
-	_updateList(GetDlgItem(m_hWnd, AP_RID_DIALOG_REPLACE_COMBO_REPLACE), 	&m_replaceList);	
+	_updateList(GetDlgItem(m_hDlg, AP_RID_DIALOG_REPLACE_COMBO_FIND), 		&m_findList);
+	_updateList(GetDlgItem(m_hDlg, AP_RID_DIALOG_REPLACE_COMBO_REPLACE), 	&m_replaceList);	
 }
 
 void AP_Win32Dialog_Replace::_updateList(HWND hWnd, UT_GenericVector<UT_UCS4Char*> *list)
@@ -445,23 +427,15 @@
 	UT_DEBUGMSG(("AP_Win32Dialog_Replace::_updateList\n"));
 	
 	UT_uint32 i = 0;
+	UT_Win32LocaleString str;
 	
 	SendMessage(hWnd, CB_RESETCONTENT, 0,0);		
 	
 	for (i = 0; i< list->getItemCount(); i++)
 	{
 		// leaving the size 0 causes the string class to determine the length itself
-		UT_UCS4String ucs4s((UT_UCS4Char*)list->getNthItem(i), 0); 
-		
-		// clone the string, since we can't use utf8_str()'s result -> ucs4s will disappear from stack
-		char* utf8s = g_strdup(ucs4s.utf8_str()); 
-		
-		// add it to the list
-		UT_DEBUGMSG(("FODDEX: find/replace list: %d = '%s'\n", i, utf8s));   
-				
-    	SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)(AP_Win32App::s_fromUTF8ToWinLocale(utf8s)).c_str());    		
-
-		g_free(utf8s);
+		str.fromUCS4 ((UT_UCS4Char*)list->getNthItem(i));
+    	SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM) str.c_str());		
 	}		
 	
 	SendMessage(hWnd, CB_SETCURSEL, 0,0);		
Index: src/wp/ap/win/ap_Win32Dialog_Replace.h
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Dialog_Replace.h,v
retrieving revision 1.15
diff -u -r1.15 ap_Win32Dialog_Replace.h
--- src/wp/ap/win/ap_Win32Dialog_Replace.h	16 Jan 2007 23:16:28 -0000	1.15
+++ src/wp/ap/win/ap_Win32Dialog_Replace.h	9 Apr 2007 08:37:56 -0000
@@ -22,11 +22,11 @@
 
 #include "ap_Dialog_Replace.h"
 #include "xap_Frame.h"
-
+#include "xap_Win32DialogBase.h"
 
 /*****************************************************************/
 
-class AP_Win32Dialog_Replace: public AP_Dialog_Replace
+class AP_Win32Dialog_Replace: public AP_Dialog_Replace, XAP_Win32DialogBase
 {
 public:
 	AP_Win32Dialog_Replace(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id);
@@ -38,10 +38,10 @@
 	virtual void			notifyCloseFrame(XAP_Frame *pFrame);
 	virtual void			destroy(void);
 	virtual void			activate(void);
-	virtual void *			pGetWindowHandle( void ) { return (void*)m_hWnd; }
+	virtual void *			pGetWindowHandle( void ) { return (void*)m_hDlg; }
 
 	static XAP_Dialog * 	static_constructor(XAP_DialogFactory *, XAP_Dialog_Id id);
-	static BOOL CALLBACK	s_dlgProc(HWND,UINT,WPARAM,LPARAM);
+	//static BOOL CALLBACK	s_dlgProc(HWND,UINT,WPARAM,LPARAM);
 	
     virtual void                    _updateLists();    
 	      
@@ -51,7 +51,6 @@
 	BOOL					_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);
 	BOOL					_onBtn_Find(HWND hWnd, tFindType tFindType);
 	void 					_updateList(HWND hWnd, UT_GenericVector<UT_UCS4Char*>* vec);
-	HWND					m_hWnd;
 };
 
 #endif /* AP_WIN32DIALOG_REPLACE_H */
Index: src/wp/ap/win/ap_Win32Dialog_Spell.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Dialog_Spell.cpp,v
retrieving revision 1.16
diff -u -r1.16 ap_Win32Dialog_Spell.cpp
--- src/wp/ap/win/ap_Win32Dialog_Spell.cpp	16 Jan 2007 23:16:28 -0000	1.16
+++ src/wp/ap/win/ap_Win32Dialog_Spell.cpp	9 Apr 2007 08:37:56 -0000
@@ -112,30 +112,6 @@
 {
 	const XAP_StringSet * pSS = m_pApp->getStringSet();
 	
-	SetWindowText(hWnd, pSS->getValue(AP_STRING_ID_DLG_Spell_SpellTitle));
-
-	// localize controls
-	_DSX(SPELL_BTN_CANCEL,		DLG_Cancel);
-
-	_DS(SPELL_TEXT_NOT,			DLG_Spell_UnknownWord);
-	_DS(SPELL_TEXT_CHANGE,		DLG_Spell_ChangeTo);
-	_DS(SPELL_TEXT_SUGGEST,		DLG_Spell_Suggestions);
-	_DS(SPELL_BTN_IGNORE,		DLG_Spell_Ignore);
-	_DS(SPELL_BTN_IGNOREALL,	DLG_Spell_IgnoreAll);
-	_DS(SPELL_BTN_ADD,			DLG_Spell_AddToDict);
-	_DS(SPELL_BTN_CHANGE,		DLG_Spell_Change);
-	_DS(SPELL_BTN_CHANGEALL,	DLG_Spell_ChangeAll);
-
-	// remember the windows we're using 
-	m_hwndDlg = hWnd;
-	m_hwndSentence = GetDlgItem(hWnd, AP_RID_DIALOG_SPELL_RICH_SENTENCE);
-	m_hwndChangeTo = GetDlgItem(hWnd, AP_RID_DIALOG_SPELL_EDIT_CHANGE);
-	m_hwndSuggest  = GetDlgItem(hWnd, AP_RID_DIALOG_SPELL_LIST_SUGGEST);
-
-	// set initial state
-	makeWordVisible();
-	_showMisspelledWord();
-	XAP_Win32DialogHelper::s_centerDialog(hWnd);			
 
 	return 1;							// 1 == we did not call SetFocus()
 }
@@ -148,174 +124,17 @@
 
 void AP_Win32Dialog_Spell::_showMisspelledWord(void)
 {
-	// clear existing values
-	SendMessage(m_hwndSentence, WM_SETTEXT, 0, 0);
-	SendMessage(m_hwndChangeTo, WM_SETTEXT, 0, 0);
-	SendMessage(m_hwndSuggest, LB_RESETCONTENT, 0, 0);
-
-	CHARFORMAT cf;
-	const UT_UCSChar *p;
-	UT_uint32 len;
-	UT_uint32 sum = 0;
-	char * buf;
-
-	// insert start of sentence
-	SendMessage(m_hwndSentence, EM_SETSEL, (WPARAM) sum, (LPARAM) sum);
-
-	cf.cbSize = sizeof(cf);
-	cf.dwMask = CFM_COLOR | CFM_PROTECTED;
-	cf.dwEffects = CFE_AUTOCOLOR | CFE_PROTECTED;
-	SendMessage(m_hwndSentence, EM_SETCHARFORMAT, (WPARAM) SCF_ALL, (LPARAM) &cf);
-
-	UT_sint32 iLength;
-
-    p = m_pWordIterator->getPreWord(iLength);
-	if (0 < iLength)
-	{
-// FIXME: this is broken - should take iLength characters from p
-// and convert them to char. I.e., first substr p, then
-// convert. But output length is not necessarily related to iLength!
-		buf = new char [iLength + 1];
-		UT_UCS4_strncpy_to_char(buf, p, iLength);
-		buf[iLength] = '\0';
-		SendMessage(m_hwndSentence, WM_SETTEXT, 0, (LPARAM)buf);
-		DELETEP(buf);
-	}
-	sum += iLength;
-
-	// insert misspelled word (in highlight color)
-	SendMessage(m_hwndSentence, EM_SETSEL, (WPARAM) sum, (LPARAM) sum);
-
-	cf.dwMask = CFM_COLOR | CFM_PROTECTED;
-	cf.dwEffects = CFE_PROTECTED;
-	cf.crTextColor = RGB(255,0,0);
-	SendMessage(m_hwndSentence, EM_SETCHARFORMAT, (WPARAM) SCF_SELECTION, (LPARAM) &cf);
-
-    p = m_pWordIterator->getCurrentWord(iLength);
-	if (0 < iLength)
-	{
-// FIXME: this is broken - should take iLength characters from p
-// and convert them to char. I.e., first substr p, then
-// convert. But output length is not necessarily related to iLength!
-		buf = new char [iLength + 1];
-		UT_UCS4_strncpy_to_char(buf, p, iLength);
-		buf[iLength] = '\0';
-		SendMessage(m_hwndSentence, EM_REPLACESEL, FALSE, (LPARAM)buf);
-		DELETEP(buf);
-	}
-	sum += iLength;
-
-    // save this offset for centering of selected word later on
-    m_iWordOffsetInSentence = sum;
-
-	// insert end of sentence
-	SendMessage(m_hwndSentence, EM_SETSEL, (WPARAM) sum, (LPARAM) sum);
-	cf.dwMask = CFM_COLOR | CFM_PROTECTED;
-	cf.dwEffects = CFE_AUTOCOLOR | CFE_PROTECTED;
-	SendMessage(m_hwndSentence, EM_SETCHARFORMAT, (WPARAM) SCF_SELECTION, (LPARAM) &cf);
-
-    p = m_pWordIterator->getPostWord(iLength);
-	if (0 < iLength)
-	{
-// FIXME: this is broken - should take iLength characters from p
-// and convert them to char. I.e., first substr p, then
-// convert. But output length is not necessarily related to iLength!
-		buf = new char [iLength + 1];
-		UT_UCS4_strncpy_to_char(buf, p, iLength);
-		buf[iLength] = '\0';
-		SendMessage(m_hwndSentence, EM_REPLACESEL, FALSE, (LPARAM)buf);
-		DELETEP(buf);
-	}
-
-	// insert suggestions
-	if (!m_Suggestions->getItemCount())
-	{
-		const XAP_StringSet * pSS = m_pApp->getStringSet();
-		SendMessage(m_hwndSuggest, LB_ADDSTRING, 0, (LPARAM) pSS->getValue(AP_STRING_ID_DLG_Spell_NoSuggestions));
 
-		m_iSelectedRow = -1;
-		_toggleChangeButtons(false);
-	} 
-	else 
-	{
-		for (UT_uint32 i = 0; i < m_Suggestions->getItemCount(); i++)
-		{
-			p = (UT_UCSChar *) m_Suggestions->getNthItem(i);
-			len = UT_UCS4_strlen(p);
-			if (len)
-			{
-				buf = new char [len + 1];
-				UT_UCS4_strcpy_to_char(buf, p);
-				SendMessage(m_hwndSuggest, LB_ADDSTRING, 0, (LPARAM)buf);
-				DELETEP(buf);
-			}
-		}
-
-		m_iSelectedRow = 0;
-		_toggleChangeButtons(true);
-	}
-
-	SendMessage(m_hwndSuggest, LB_SETCURSEL, m_iSelectedRow, 0);
-
-	// populate the change field, if appropriate
-	m_bChangingSelection = 1;
-	_suggestChange();
-	m_bChangingSelection = 0;
 }
 
 void AP_Win32Dialog_Spell::_suggestChange(void)
 {
-	// cast is to match Unix usage
-	// should be safe here, because there just aren't that many suggestions 
-	m_iSelectedRow = (short) SendMessage(m_hwndSuggest, LB_GETCURSEL, 0, 0);
 
-	if (!m_Suggestions->getItemCount()) 
-	{
-		// FIXME: this should insert the original word, surely!
-
-		// no change to suggest, ignore it
-		if (m_iSelectedRow != -1)
-			SendMessage(m_hwndSuggest, LB_SETCURSEL, -1, 0);
-	}
-	else
-	{
-		// copy suggestion to edit field
-		UT_return_if_fail ((m_iSelectedRow > -1));
-
-		char buf[256];
-		SendMessage(m_hwndSuggest, LB_GETTEXT, m_iSelectedRow, (LPARAM)buf);
-		SendMessage(m_hwndChangeTo, WM_SETTEXT, 0, (LPARAM)buf);
-
-		// you'd think this'd be overkill...
-		SendMessage(m_hwndSuggest, LB_SETCURSEL, m_iSelectedRow, 0);
-	}
 }
 
 // returns a pointer which needs to be FREEP'd by the caller
 static UT_UCSChar * s_getUCSText(HWND hwnd)
 {
-	char * pBuf = NULL;
-	UT_UCSChar * pUCS = NULL;
-
-	DWORD len = GetWindowTextLength(hwnd);
-	if (!len)
-		return NULL;
-
-	pBuf = new char [len + 1];
-	if (!pBuf)
-		goto FreeMemory;
-	GetWindowText(hwnd,pBuf,len+1);
-
-	UT_UCS4_cloneString_char(&pUCS,pBuf);
-	if (!pUCS)
-		goto FreeMemory;
-
-	DELETEP(pBuf);
-	return pUCS;
-
-FreeMemory:
-	DELETEP(pBuf);
-	FREEP(pUCS);
 
 	return NULL;
 }
Index: src/wp/ap/win/ap_Win32Dialog_SplitCells.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Dialog_SplitCells.cpp,v
retrieving revision 1.8
diff -u -r1.8 ap_Win32Dialog_SplitCells.cpp
--- src/wp/ap/win/ap_Win32Dialog_SplitCells.cpp	16 Jan 2007 23:16:28 -0000	1.8
+++ src/wp/ap/win/ap_Win32Dialog_SplitCells.cpp	9 Apr 2007 08:37:56 -0000
@@ -75,59 +75,14 @@
 {
 	// raise the dialog
 	int iResult;
-	XAP_Win32App * pWin32App = static_cast<XAP_Win32App *>(m_pApp);
-
-	LPCTSTR lpTemplate = NULL;
-
-	UT_return_if_fail (m_id == AP_DIALOG_ID_SPLIT_CELLS);
-
-	lpTemplate = MAKEINTRESOURCE(AP_RID_DIALOG_SPLITCELLS);
-
-	HWND hResult = CreateDialogParam(pWin32App->getInstance(),lpTemplate,
-							static_cast<XAP_Win32FrameImpl*>(pFrame->getFrameImpl())->getTopLevelWindow(),
-							(DLGPROC)s_dlgProc,(LPARAM)this);
-	UT_ASSERT_HARMLESS((hResult != NULL));
-
-	m_hwndDlg = hResult;
-
-	// Save dialog the ID number and pointer to the widget
-	UT_sint32 sid =(UT_sint32)  getDialogId();
-	m_pApp->rememberModelessId( sid, (XAP_Dialog_Modeless *) m_pDialog);
-
-	iResult = ShowWindow( m_hwndDlg, SW_SHOW );
-
-	iResult = BringWindowToTop( m_hwndDlg );
-
-	startUpdater();
-
-	UT_ASSERT_HARMLESS((iResult != 0));
 
 }
 
 BOOL CALLBACK AP_Win32Dialog_SplitCells::s_dlgProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
 {		
 	AP_Win32Dialog_SplitCells * pThis;
-	
-	switch (msg)
-	{
-	case WM_INITDIALOG:
-		pThis = (AP_Win32Dialog_SplitCells *)lParam;
-		SWL(hWnd,lParam);
-		return pThis->_onInitDialog(hWnd,wParam,lParam);
-
-	case WM_COMMAND:
-		pThis = GWL(hWnd);
-		return pThis->_onCommand(hWnd,wParam,lParam);
-
-	case WM_DESTROY:
-		pThis = GWL(hWnd);
-		if(pThis)
-			pThis->destroy();
-		return 0;
-
-	default:
-		return 0;
-	}
+	return 0;
+
 }
 #define _DS(c,s)	SetDlgItemText(hWnd,AP_RID_DIALOG_SPLITCELLS_##c,pSS->getValue(AP_STRING_ID_##s))
 #define _DSX(c,s)	SetDlgItemText(hWnd,AP_RID_DIALOG_SPLITCELLS_##c,pSS->getValue(XAP_STRING_ID_##s))
@@ -136,60 +91,14 @@
 HBITMAP AP_Win32Dialog_SplitCells::_loadBitmap(HWND hWnd, UINT nId, char* pName, int x, int y, UT_RGBColor color)
 {
 	HBITMAP hBitmap = NULL;
-	
-	AP_Win32Toolbar_Icons::getBitmapForIcon(hWnd, x,y, &color,	pName,	&hBitmap);	
-				
-	SendDlgItemMessage(hWnd,  nId, 
-        	            BM_SETIMAGE,  IMAGE_BITMAP, (LPARAM) hBitmap);				
-	
+
 	return hBitmap; 
 }
 
 // This handles the WM_INITDIALOG message for the top-level dialog.
 BOOL AP_Win32Dialog_SplitCells::_onInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {	
-	HDC hdc;
-	int x, y;	
-	RECT rect;
-	DWORD dwColor = GetSysColor(COLOR_BTNFACE);	
-	UT_RGBColor Color(GetRValue(dwColor),GetGValue(dwColor),GetBValue(dwColor));
-	const XAP_StringSet * pSS = m_pApp->getStringSet();
-	
-	m_hwndDlg = hWnd;
 
-	// localise controls 		
-	_DS(TEXT_LEFT,		DLG_SplitCells_Left);
-	_DS(TEXT_VERTMID,	DLG_SplitCells_VertMid);
-	_DS(TEXT_RIGHT,		DLG_SplitCells_Right);		
-	_DS(TEXT_ABOVE,		DLG_SplitCells_Above);
-	_DS(TEXT_HORIMID,	DLG_SplitCells_HoriMid);
-	_DS(TEXT_BELOW,		DLG_SplitCells_Below);		
-	_DS(TEXT_FRAME,		DLG_SplitCells_Frame);		
-	_DSX(BTN_CANCEL,	DLG_Close);				
-				
-	// Localise caption
-	ConstructWindowName();
-	SetWindowText(m_hwndDlg, m_WindowName);
-
-	// The four items are the same size
-	GetClientRect(GetDlgItem(hWnd, AP_RID_DIALOG_SPLITCELLS_BMP_LEFT), &rect);			
-		
-	hdc = GetDC(hWnd);
-	x = rect.right - rect.left,
-	y = rect.bottom - rect.top,
-	
-	// Load the bitmaps into the dialog box								
-    m_hBitmapLeft = _loadBitmap(hWnd,AP_RID_DIALOG_SPLITCELLS_BMP_LEFT, "SPLITLEFT",  x, y, Color);
-	m_hBitmapRight = _loadBitmap(hWnd,AP_RID_DIALOG_SPLITCELLS_BMP_VERTMID, "SPLITVERTMID", x, y, Color);
-    m_hBitmapRight = _loadBitmap(hWnd,AP_RID_DIALOG_SPLITCELLS_BMP_RIGHT, "SPLITRIGHT", x, y, Color);
-    m_hBitmapAbove = _loadBitmap(hWnd,AP_RID_DIALOG_SPLITCELLS_BMP_ABOVE, "SPLITABOVE", x, y, Color);
-	m_hBitmapAbove = _loadBitmap(hWnd,AP_RID_DIALOG_SPLITCELLS_BMP_HORIMID, "SPLITHORIMID", x, y, Color);
-    m_hBitmapBelow = _loadBitmap(hWnd,AP_RID_DIALOG_SPLITCELLS_BMP_BELOW, "SPLITBELOW", x, y, Color);
-	
-	setAllSensitivities();
-	XAP_Win32DialogHelper::s_centerDialog(hWnd);	
-	
-	SetFocus(GetDlgItem(hWnd,AP_RID_DIALOG_SPLITCELLS_BTN_CANCEL));
 	return 0; // 0 because we called SetFocus
 }
 
@@ -197,35 +106,6 @@
 
 void AP_Win32Dialog_SplitCells::setSensitivity(AP_CellSplitType splitThis, bool bSens)
 {
-	switch(splitThis)
-	{
-	case hori_left:
-		EnableWindow(GetDlgItem(m_hwndDlg, AP_RID_DIALOG_SPLITCELLS_BMP_LEFT), bSens);
-		EnableWindow(GetDlgItem(m_hwndDlg, AP_RID_DIALOG_SPLITCELLS_TEXT_LEFT), bSens);
-		break;
-	case hori_mid:
-		EnableWindow(GetDlgItem(m_hwndDlg, AP_RID_DIALOG_SPLITCELLS_BMP_HORIMID), bSens);
-		EnableWindow(GetDlgItem(m_hwndDlg, AP_RID_DIALOG_SPLITCELLS_TEXT_HORIMID), bSens);
-		break;
-	case hori_right:
-		EnableWindow(GetDlgItem(m_hwndDlg, AP_RID_DIALOG_SPLITCELLS_BMP_RIGHT), bSens);
-		EnableWindow(GetDlgItem(m_hwndDlg, AP_RID_DIALOG_SPLITCELLS_TEXT_RIGHT), bSens);
-		break;	
-	case vert_above:
-		EnableWindow(GetDlgItem(m_hwndDlg, AP_RID_DIALOG_SPLITCELLS_BMP_ABOVE), bSens);
-		EnableWindow(GetDlgItem(m_hwndDlg, AP_RID_DIALOG_SPLITCELLS_TEXT_ABOVE), bSens);
-		break;
-	case vert_mid:
-		EnableWindow(GetDlgItem(m_hwndDlg, AP_RID_DIALOG_SPLITCELLS_BMP_VERTMID), bSens);
-		EnableWindow(GetDlgItem(m_hwndDlg, AP_RID_DIALOG_SPLITCELLS_TEXT_VERTMID), bSens);
-		break;
-	case vert_below:
-		EnableWindow(GetDlgItem(m_hwndDlg, AP_RID_DIALOG_SPLITCELLS_BMP_BELOW), bSens);
-		EnableWindow(GetDlgItem(m_hwndDlg, AP_RID_DIALOG_SPLITCELLS_TEXT_BELOW), bSens);
-		break;		
-	default:
-		break;
-	}
 
 }
 
@@ -238,73 +118,13 @@
 
 void AP_Win32Dialog_SplitCells::notifyActiveFrame(XAP_Frame *pFrame)
 {
-	if((HWND)GetWindowLong(m_hwndDlg, GWL_HWNDPARENT) != static_cast<XAP_Win32FrameImpl*>(pFrame->getFrameImpl())->getTopLevelWindow())
-	{
-		ConstructWindowName();
-		SetWindowText(m_hwndDlg, m_WindowName);
-
-		SetWindowLong(m_hwndDlg, GWL_HWNDPARENT, (long)static_cast<XAP_Win32FrameImpl*>(pFrame->getFrameImpl())->getTopLevelWindow());
-		SetWindowPos(m_hwndDlg, NULL, 0, 0, 0, 0,
-						SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
-	}
-	setAllSensitivities();
+
 }
 
 BOOL AP_Win32Dialog_SplitCells::_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
 	WORD wNotifyCode = HIWORD(wParam);
-	WORD wId = LOWORD(wParam);
-	HWND hWndCtrl = (HWND)lParam;
-
-	switch (wId)
-	{
-		case AP_RID_DIALOG_SPLITCELLS_BMP_LEFT:		
-		{	
-			setSplitType(hori_left);
-			onSplit();
-			return 1;
-		}
-		case AP_RID_DIALOG_SPLITCELLS_BMP_HORIMID:		
-		{	
-			setSplitType(hori_mid);
-			onSplit();
-			return 1;
-		}		
-		case AP_RID_DIALOG_SPLITCELLS_BMP_RIGHT:		
-		{	
-			setSplitType(hori_right);
-			onSplit();
-			return 1;
-		}
-		
-		case AP_RID_DIALOG_SPLITCELLS_BMP_ABOVE:
-		{
-			setSplitType(vert_above);
-			onSplit();
-			return 1;
-		}
-		case AP_RID_DIALOG_SPLITCELLS_BMP_VERTMID:
-		{
-			setSplitType(vert_mid);
-			onSplit();
-			return 1;
-		}
-		case AP_RID_DIALOG_SPLITCELLS_BMP_BELOW:		
-		{	
-			setSplitType(vert_below);
-			onSplit();
-			return 1;
-		}
-		
-		case AP_RID_DIALOG_SPLITCELLS_BTN_CANCEL:						
-			m_answer = a_CANCEL; 						
-			destroy();
-			return 1;
-			
-		default:							// we did not handle this notification
-			UT_DEBUGMSG(("WM_Command for id %ld\n",wId));
-			return 0;						// return zero to let windows take care of it.
-	}
+	return 0;	
 }
 
 
@@ -319,7 +139,7 @@
 void AP_Win32Dialog_SplitCells::activate(void)
 {
 	ConstructWindowName();
-	SetWindowText(m_hwndDlg, m_WindowName);
+	
 
 	setAllSensitivities();
 }
Index: src/wp/ap/win/ap_Win32Dialog_Styles.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Dialog_Styles.cpp,v
retrieving revision 1.26
diff -u -r1.26 ap_Win32Dialog_Styles.cpp
--- src/wp/ap/win/ap_Win32Dialog_Styles.cpp	29 Mar 2007 04:00:46 -0000	1.26
+++ src/wp/ap/win/ap_Win32Dialog_Styles.cpp	9 Apr 2007 08:37:57 -0000
@@ -76,36 +76,9 @@
 */
 BOOL CALLBACK AP_Win32Dialog_Styles::s_dlgProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
 {
-	// This is a static function.
-
-	AP_Win32Dialog_Styles * pThis;
-	switch (msg)
-	{
-	case WM_INITDIALOG:	
-		pThis = (AP_Win32Dialog_Styles *)lParam;		
-		SetWindowLong(hWnd,DWL_USER,lParam);
-		return pThis->_onInitDialog(hWnd,wParam,lParam);
-
-	case WM_COMMAND:
-		
-		pThis = (AP_Win32Dialog_Styles *)GetWindowLong(hWnd,DWL_USER);
-		if(pThis)
-			return pThis->_onCommand(hWnd,wParam,lParam);
-		else		
-			return 0;
-			
-	case WM_DRAWITEM:		
-		AP_Win32Dialog_Styles * pThis;
-		pThis = (AP_Win32Dialog_Styles *)lParam;				
-		
-		if (wParam==AP_RID_DIALOG_STYLES_NEWMODIFY_BTN_TOGGLEITEMS)
-			pThis->_onDrawButton((LPDRAWITEMSTRUCT)lParam, hWnd);
-		
-		return 0;
 	
-	default:
-		return 0;
-	}
+	return 0;
+	
 }
 
 
@@ -114,62 +87,7 @@
 */
 void AP_Win32Dialog_Styles::_onDrawButton(LPDRAWITEMSTRUCT lpDrawItemStruct, HWND hWnd)
 {
-    UINT			uiState    = lpDrawItemStruct->itemState;
-    HPEN			hPen;
-    HPEN			pOldPen;
-	HDC				hdc = lpDrawItemStruct->hDC;
-	int				nWidth;
-	int				nHeight;
-	int		 		x, xEnd, xStart;
-	int 			y;
-	POINT 			p;	
-	const char* 	pText;
-	HWND 			hParent;
-	LONG			lData;
-	
-	// Get parent object and get the App object from there
-	hParent = GetParent(hWnd);	
-	lData = GetWindowLong(hWnd,DWL_USER);			
-	AP_Win32Dialog_Styles * pParent = (AP_Win32Dialog_Styles *)lData;
-	const XAP_StringSet * pSS = pParent->m_pApp->getStringSet();		
-	
-	pText=	pSS->getValue(AP_STRING_ID_DLG_Styles_ModifyFormat);		
-	
-	nWidth = lpDrawItemStruct->rcItem.right - lpDrawItemStruct->rcItem.left;
-	nHeight = lpDrawItemStruct->rcItem.bottom - lpDrawItemStruct->rcItem.top;
-		      
-    // set the pen color
-    if (uiState&ODS_DISABLED)
-        hPen = CreatePen(PS_SOLID, 0, GetSysColor(COLOR_GRAYTEXT));
-    else
-        hPen = CreatePen(PS_SOLID, 0, GetSysColor(COLOR_BTNTEXT));
     
-    pOldPen =  (HPEN) SelectObject(hdc, hPen);
-
-    // draw the border of the button
-    if(uiState&ODS_SELECTED)
-        DrawFrameControl(hdc, &lpDrawItemStruct->rcItem, DFC_BUTTON, DFCS_BUTTONPUSH|DFCS_PUSHED);
-    else
-        DrawFrameControl(hdc, &lpDrawItemStruct->rcItem, DFC_BUTTON, DFCS_BUTTONPUSH);	
-	
-	// Draw arrow
-	y = nHeight/2;
-	xStart = (nWidth/6)*5;
-	for (int i=0; i<4; i++)
-	{
-  	   x = xStart + i;
-	   xEnd = xStart + 7 - i;
-
-	   ::MoveToEx(hdc, x, y, &p);	   
-       ::LineTo(hdc, xEnd, y);
-	   y++;
-	 }
-
-	ExtTextOut(hdc, (nWidth/6)*1, ((nHeight/4)), 0, NULL, pText,  strlen(pText), NULL);
-		
-    // Clean Up
-    SelectObject(hdc, pOldPen);       
-    DeleteObject(hPen);
 }
 
 void AP_Win32Dialog_Styles::runModal(XAP_Frame * pFrame)
@@ -206,623 +124,12 @@
 
 BOOL AP_Win32Dialog_Styles::_onInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
-	XAP_Win32App * app = static_cast<XAP_Win32App *> (m_pApp);
-	UT_return_val_if_fail (app,0);
-	
-	const XAP_StringSet * pSS = m_pApp->getStringSet();
-
-	char szTemp[20];
-	GetWindowText(hWnd, szTemp, 20 );	
-			
-	// Regular dialog box
-	if( strncmp(szTemp, "Styles", 20) == 0 )
-	{	
-		SetWindowText(hWnd, pSS->getValue(AP_STRING_ID_DLG_Styles_StylesTitle));
-
-		// localize controls
-		struct control_id_string_id {
-			UT_sint32		controlId;
-			XAP_String_Id	stringId;
-		} static const rgMapping[] =
-		{
-			{AP_RID_DIALOG_STYLES_TOP_TEXT_LIST				, AP_STRING_ID_DLG_Styles_List},
-			{AP_RID_DIALOG_STYLES_TOP_TEXT_PARAGRAPH_PREVIEW	, AP_STRING_ID_DLG_Styles_ParaPrev},
-			{AP_RID_DIALOG_STYLES_TOP_TEXT_CHARACTER_PREVIEW	, AP_STRING_ID_DLG_Styles_CharPrev},
-			{AP_RID_DIALOG_STYLES_TOP_TEXT_DESCRIPTION		, AP_STRING_ID_DLG_Styles_Description},
-			{AP_RID_DIALOG_STYLES_TOP_BUTTON_DELETE			, AP_STRING_ID_DLG_Styles_Delete},
-			{AP_RID_DIALOG_STYLES_TOP_BUTTON_MODIFY			, AP_STRING_ID_DLG_Styles_Modify},
-			{AP_RID_DIALOG_STYLES_TOP_BUTTON_NEW				, AP_STRING_ID_DLG_Styles_New},
-			{AP_RID_DIALOG_STYLES_TOP_TEXT_AVAILABLE			, AP_STRING_ID_DLG_Styles_Available},	// "Available Styles" GROUPBOX
-			{AP_RID_DIALOG_STYLES_TOP_BUTTON_APPLY			, XAP_STRING_ID_DLG_Apply},
-			{AP_RID_DIALOG_STYLES_TOP_BUTTON_CLOSE			, XAP_STRING_ID_DLG_Close}
-		};
-
-		for (int i = 0; i < NrElements(rgMapping); ++i)
-		{
-			_win32Dialog.setControlText(rgMapping[i].controlId,
-										pSS->getValue(rgMapping[i].stringId));
-		}
-
-		// Set the list combo.
-
-		_win32Dialog.addItemToCombo(AP_RID_DIALOG_STYLES_TOP_COMBO_LIST, 
-									pSS->getValue (AP_STRING_ID_DLG_Styles_LBL_InUse));
-		_win32Dialog.addItemToCombo(AP_RID_DIALOG_STYLES_TOP_COMBO_LIST, 
-									pSS->getValue(AP_STRING_ID_DLG_Styles_LBL_All));
-		_win32Dialog.addItemToCombo(AP_RID_DIALOG_STYLES_TOP_COMBO_LIST,
-									pSS->getValue(AP_STRING_ID_DLG_Styles_LBL_UserDefined));
-		_win32Dialog.selectComboItem(AP_RID_DIALOG_STYLES_TOP_COMBO_LIST, (int)m_whichType);
-	
-
-		// Create a preview windows.
-
-		HWND hwndChild = GetDlgItem(hWnd, AP_RID_DIALOG_STYLES_TOP_TEXT_PARAGRAPH_PREVIEW);
-
-		m_pParaPreviewWidget = new XAP_Win32PreviewWidget(static_cast<XAP_Win32App *>(m_pApp),
-														  hwndChild,
-														  0);
-		UT_uint32 w,h;
-		m_pParaPreviewWidget->getWindowSize(&w,&h);
-		_createParaPreviewFromGC(m_pParaPreviewWidget->getGraphics(), w, h);
-		m_pParaPreviewWidget->setPreview(m_pParaPreview);
-
-		hwndChild = GetDlgItem(hWnd, AP_RID_DIALOG_STYLES_TOP_TEXT_CHARACTER_PREVIEW);
-
-		m_pCharPreviewWidget = new XAP_Win32PreviewWidget(static_cast<XAP_Win32App *>(m_pApp),
-														  hwndChild,
-														  0);
-		m_pCharPreviewWidget->getWindowSize(&w,&h);
-		_createCharPreviewFromGC(m_pCharPreviewWidget->getGraphics(), w, h);
-		m_pCharPreviewWidget->setPreview(m_pCharPreview);
-
-		_populateWindowData();
-	}
-	// This is either the new or Modify sub dialog of styles
-	else  
-	{
-		// Localize the controls Labels etc...
-		SetWindowText(hWnd, pSS->getValue( (m_bisNewStyle) ? 
-                                           AP_STRING_ID_DLG_Styles_NewTitle :
-                                           AP_STRING_ID_DLG_Styles_ModifyTitle ));
-
-		_win32DialogNewModify.setHandle(hWnd);
-		
-		#define _DS(c,s)  _win32DialogNewModify.setControlText(AP_RID_DIALOG_##c,pSS->getValue(AP_STRING_ID_##s))
-		#define _DSX(c,s)  _win32DialogNewModify.setControlText(AP_RID_DIALOG_##c,pSS->getValue(XAP_STRING_ID_##s))
-		_DS(STYLES_NEWMODIFY_LBL_NAME,			DLG_Styles_ModifyName);
-		_DS(STYLES_NEWMODIFY_LBL_BASEDON,		DLG_Styles_ModifyBasedOn);
-		_DS(STYLES_NEWMODIFY_LBL_TYPE,			DLG_Styles_ModifyType);
-		_DS(STYLES_NEWMODIFY_LBL_FOLLOWPARA,	DLG_Styles_ModifyFollowing);
-		_DS(STYLES_NEWMODIFY_LBL_REMOVE,		DLG_Styles_RemoveLab);
-		_DS(STYLES_NEWMODIFY_GBX_PREVIEW,		DLG_Styles_ModifyPreview);
-		_DS(STYLES_NEWMODIFY_GBX_DESC,			DLG_Styles_ModifyDescription);
-		_DS(STYLES_NEWMODIFY_BTN_REMOVE,		DLG_Styles_RemoveButton);		
-		_DS(STYLES_NEWMODIFY_BTN_SHORTCUT,		DLG_Styles_ModifyShortCut);
-		_DSX(STYLES_NEWMODIFY_BTN_OK,			DLG_OK);
-		_DSX(STYLES_NEWMODIFY_BTN_CANCEL,		DLG_Cancel);
-		#undef _DSX
-		#undef _DS
-		
-		
-		// Changes basic controls based upon either New or Modify Dialog
-		_win32DialogNewModify.showControl( AP_RID_DIALOG_STYLES_NEWMODIFY_EBX_TYPE , 
-                                           (m_bisNewStyle) ? SW_HIDE : SW_SHOW );
-		_win32DialogNewModify.showControl( AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_TYPE , 
-                                           (m_bisNewStyle) ? SW_SHOW : SW_HIDE );
-		// Initialize the controls with appropriate data
-
-		size_t nStyles = getDoc()->getStyleCount();
-		const char * name = NULL;
-		const char * pLocalised = NULL;
-		const PD_Style * pcStyle = NULL;
-		int nIndex;
-		UT_UTF8String utf8;
-		UT_String str;	
-
-		UT_GenericVector<PD_Style*> * pStyles = NULL;
-		getDoc()->enumStyles(pStyles);
-		UT_return_val_if_fail( pStyles, FALSE );
-		
-		for (UT_uint32 i = 0; i < nStyles; i++)
-		{
-    		pcStyle = pStyles->getNthItem(i);
-			UT_return_val_if_fail( pcStyle, FALSE );
-			name = pcStyle->getName();
-			
-   			pt_PieceTable::s_getLocalisedStyleName(name, utf8);			
-			pLocalised = utf8.utf8_str();
-			str = AP_Win32App::s_fromUTF8ToWinLocale (pLocalised);
-			pLocalised = str.c_str();	
-			
-			nIndex = _win32DialogNewModify.addItemToCombo(AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_BASEDON, pLocalised);				
-			_win32DialogNewModify.setComboDataItem(AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_BASEDON, 
-				nIndex, i);				
-			
-			nIndex = _win32DialogNewModify.addItemToCombo(AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_FOLLOWPARA, pLocalised);				
-			_win32DialogNewModify.setComboDataItem(AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_FOLLOWPARA, 
-				nIndex, i);				
-		}
-
-		delete pStyles;
-		
-		// Strings (not styles names)
-		const char*	pDefCurrent = pSS->getValue(AP_STRING_ID_DLG_Styles_DefCurrent);
-		const char*	pDefNone = pSS->getValue(AP_STRING_ID_DLG_Styles_DefNone);
-		
-		str = AP_Win32App::s_fromUTF8ToWinLocale(pDefCurrent);
-		pDefCurrent = str.c_str();	
-		
-		_win32DialogNewModify.addItemToCombo( AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_FOLLOWPARA, 
-                                              pDefCurrent );
-
-
-		str = AP_Win32App::s_fromUTF8ToWinLocale(pDefNone);
-		pDefNone = str.c_str();							
-
-		_win32DialogNewModify.addItemToCombo( AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_BASEDON, 
-                                              pDefNone);
-		
-		
-		if( m_bisNewStyle )
-		{	
-			
-			const char* p = pSS->getValue(AP_STRING_ID_DLG_Styles_ModifyParagraph);
-			
-			_win32DialogNewModify.addItemToCombo( AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_TYPE,
-                                                  p );
-                                                  
-			p = pSS->getValue(AP_STRING_ID_DLG_Styles_ModifyCharacter);
-                                                  
-			_win32DialogNewModify.addItemToCombo( AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_TYPE,
-                                                  p);			                         
-                                                  
-			// Set the Default syltes: none, default current
-			UT_sint32 result;
-			result = SendDlgItemMessage(hWnd, AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_BASEDON, CB_FINDSTRING, -1,
-										(LPARAM) pSS->getValue(AP_STRING_ID_DLG_Styles_DefNone));
-			_win32DialogNewModify.selectComboItem( AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_BASEDON, result );
-			
-			result = SendDlgItemMessage(hWnd, AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_FOLLOWPARA, CB_FINDSTRING, -1,
-										(LPARAM) pSS->getValue(AP_STRING_ID_DLG_Styles_DefCurrent));
-			_win32DialogNewModify.selectComboItem( AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_FOLLOWPARA, result );
-			
-			result = SendDlgItemMessage(hWnd, AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_TYPE, CB_FINDSTRING, -1,
-										(LPARAM) pSS->getValue(AP_STRING_ID_DLG_Styles_ModifyParagraph));
-			_win32DialogNewModify.selectComboItem( AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_TYPE, result );
-
-			eventBasedOn();
-			eventFollowedBy();
-			eventStyleType();
-			fillVecFromCurrentPoint();			
-		}
-		else
-		{
-			const char * szCurrentStyle = NULL;
-			const char * szBasedOn = NULL;
-			const char * szFollowedBy = NULL;
-			const char * pLocalised = NULL;
-			PD_Style * pStyle = NULL;
-			PD_Style * pBasedOnStyle = NULL;
-			PD_Style * pFollowedByStyle = NULL;
-			UT_UTF8String utf8;
-			UT_String str;	
-			
-			szCurrentStyle = m_selectedStyle.c_str();
-			
-			pt_PieceTable::s_getLocalisedStyleName(szCurrentStyle, utf8);						
-			pLocalised = utf8.utf8_str();
-			str = AP_Win32App::s_fromUTF8ToWinLocale(pLocalised);
-			pLocalised = str.c_str();
 	
-		
-			_win32DialogNewModify.setControlText( AP_RID_DIALOG_STYLES_NEWMODIFY_EBX_NAME,
-                                                  pLocalised);
-                                                  
-			if(szCurrentStyle)
-				getDoc()->getStyle(szCurrentStyle,&pStyle);
-				
-			if(!pStyle)
-			{
-				XAP_Frame * pFrame = getFrame();
-				pFrame->showMessageBox( pSS->getValue(AP_STRING_ID_DLG_Styles_ErrNoStyle),
-										XAP_Dialog_MessageBox::b_O,
-										XAP_Dialog_MessageBox::a_OK);                                        
-				m_answer = AP_Dialog_Styles::a_CANCEL;
-				return false;
-			}
-			//
-			// Valid style get the Based On and followed by values
-			//
-		    pBasedOnStyle = pStyle->getBasedOn();
-			pFollowedByStyle = pStyle->getFollowedBy();
-			
-			size_t nStyles = getDoc()->getStyleCount();
-			const char * name = NULL;
-			const PD_Style * pcStyle = NULL;
-			UT_GenericVector<PD_Style*> * pStyles = NULL;
-			getDoc()->enumStyles(pStyles);
-			UT_return_val_if_fail( pStyles, FALSE );
-	
-			for (UT_uint32 i = 0; i < nStyles; i++)
-			{
-				pcStyle = pStyles->getNthItem(i);
-				UT_return_val_if_fail( pcStyle, FALSE );
-				name = pcStyle->getName();
-
-				if(pBasedOnStyle && pcStyle == pBasedOnStyle)
-				{
-					szBasedOn = name;
-				}
-				if(pFollowedByStyle && pcStyle == pFollowedByStyle)
-				{
-					szFollowedBy = name;
-				}
-			}
-
-			delete pStyles;
-			
-			if(pBasedOnStyle != NULL)
-			{
-
-				pt_PieceTable::s_getLocalisedStyleName(szBasedOn, utf8);
-				pLocalised = utf8.utf8_str();
-				str = AP_Win32App::s_fromUTF8ToWinLocale(pLocalised);
-				pLocalised = str.c_str();
-	
-				
-				UT_uint32 result = SendDlgItemMessage(hWnd, AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_BASEDON, CB_FINDSTRING, -1,
-										(LPARAM)pLocalised);
-										
-				_win32DialogNewModify.selectComboItem( AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_BASEDON, result );
-			}
-			else
-			{
-				// Not a style name
-				UT_uint32 result = SendDlgItemMessage(hWnd, AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_BASEDON, CB_FINDSTRING, -1,
-										(LPARAM) pSS->getValue(AP_STRING_ID_DLG_Styles_DefNone));
-										
-				_win32DialogNewModify.selectComboItem( AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_BASEDON, result );
-			}
-
-			if(pFollowedByStyle != NULL)
-			{
-				pt_PieceTable::s_getLocalisedStyleName(szFollowedBy, utf8);		
-				pLocalised = utf8.utf8_str();
-				str = AP_Win32App::s_fromUTF8ToWinLocale(pLocalised);
-				pLocalised = str.c_str();
-				
-				UT_uint32 result = SendDlgItemMessage(hWnd, AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_FOLLOWPARA, CB_FINDSTRING, -1,
-										(LPARAM)pLocalised);
-				_win32DialogNewModify.selectComboItem( AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_FOLLOWPARA, result );
-			}
-			else
-			{
-				pt_PieceTable::s_getLocalisedStyleName(pSS->getValue(AP_STRING_ID_DLG_Styles_DefCurrent), utf8);		
-				pLocalised = utf8.utf8_str();
-				str = AP_Win32App::s_fromUTF8ToWinLocale(pLocalised);
-				pLocalised = str.c_str();
-
-				
-				UT_uint32 result = SendDlgItemMessage(hWnd, AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_FOLLOWPARA, CB_FINDSTRING, -1,
-										(LPARAM) pLocalised);
-				_win32DialogNewModify.selectComboItem( AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_FOLLOWPARA, result );
-			}
-			
-			if(strstr(getAttsVal("type"),"P") != 0)
-			{
-				_win32DialogNewModify.setControlText( AP_RID_DIALOG_STYLES_NEWMODIFY_EBX_TYPE, 
-                                                      pSS->getValue(AP_STRING_ID_DLG_Styles_ModifyParagraph) );
-			}
-			else
-			{
-				_win32DialogNewModify.setControlText( AP_RID_DIALOG_STYLES_NEWMODIFY_EBX_TYPE, 
-                                                      pSS->getValue(AP_STRING_ID_DLG_Styles_ModifyCharacter) );
-			}
-
-			// Disable for editing top controls in Modify Dialog
-			_win32DialogNewModify.enableControl( AP_RID_DIALOG_STYLES_NEWMODIFY_EBX_NAME, false );
-			_win32DialogNewModify.enableControl( AP_RID_DIALOG_STYLES_NEWMODIFY_EBX_TYPE, false ); 
-
-			fillVecWithProps(szCurrentStyle,true);
-		}
-
-		// Generate the Preview class
-		HWND hwndChild = GetDlgItem( hWnd, AP_RID_DIALOG_STYLES_NEWMODIFY_CTL_PREVIEW );
-
-		m_pAbiPreviewWidget = new XAP_Win32PreviewWidget(static_cast<XAP_Win32App *>(m_pApp),
-														  hwndChild,
-														  0);
-		UT_uint32 w,h;
-		m_pAbiPreviewWidget->getWindowSize(&w,&h);
-		_createAbiPreviewFromGC(m_pAbiPreviewWidget->getGraphics(), w, h);
-		_populateAbiPreview(m_bisNewStyle);
-		m_pAbiPreviewWidget->setPreview(m_pAbiPreview);
-
-		rebuildDeleteProps();
-		_populatePreviews(true);
-
-	}
-	
-	XAP_Win32DialogHelper::s_centerDialog(hWnd);	
 	return 1;							// 1 == we did not call SetFocus()
 }
 
 BOOL AP_Win32Dialog_Styles::_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
-	WORD wNotifyCode = HIWORD(wParam);
-	WORD wId = LOWORD(wParam);
-	HWND hWndCtrl = (HWND)lParam;
-
-	switch (wId)
-	{
-	case AP_RID_DIALOG_STYLES_TOP_BUTTON_APPLY:
-		{
-			const gchar * szStyle = getCurrentStyle();
-			if(szStyle && *szStyle)
-			{
-				getView()->setStyle(szStyle);
-			}		
-		}
-		m_answer = a_OK;
-		return 1;
-
-	case AP_RID_DIALOG_STYLES_TOP_BUTTON_CLOSE:
-	case IDCANCEL:
-		m_answer = a_CANCEL;
-		EndDialog(hWnd,0);
-		return 1;
-
-	case IDOK:
-		{	
-     		const XAP_StringSet * pSS = m_pApp->getStringSet ();
-			// Verfiy a name value for the style
-			// TODO - Verify unique name value
-			_win32DialogNewModify.getControlText( AP_RID_DIALOG_STYLES_NEWMODIFY_EBX_NAME,
-                                                  m_newStyleName,
-	                                              MAX_EBX_LENGTH );
-			
-
-			if( !m_newStyleName || !strlen(m_newStyleName) )
-			{
-			    getFrame()->showMessageBox( pSS->getValue (AP_STRING_ID_DLG_Styles_ErrBlankName),
-											XAP_Dialog_MessageBox::b_O,
-											XAP_Dialog_MessageBox::a_OK);
-
-			    return 1;
-    		}
-
-			strcpy (m_newStyleName, (AP_Win32App::s_fromWinLocaleToUTF8(m_newStyleName)).utf8_str());
-
-		}
-		m_answer = a_OK;
-		EndDialog(hWnd,0);
-		return 1;
-
-
-	case AP_RID_DIALOG_STYLES_TOP_COMBO_LIST:
-		if( wNotifyCode == CBN_SELCHANGE )
-		{
-			switch(_win32Dialog.getComboSelectedIndex(AP_RID_DIALOG_STYLES_TOP_COMBO_LIST))
-			{
-			case 0:
-				m_whichType = USED_STYLES;
-				break;
-				
-			case 1:
-				m_whichType = ALL_STYLES;
-				break;
-				
-			case 2:
-				m_whichType = USER_STYLES;
-				break;
-			}
-
-			_populateWindowData();
-		}
-		return 1;
-
-	case AP_RID_DIALOG_STYLES_TOP_LIST_STYLES:
-		if (wNotifyCode == LBN_SELCHANGE)
-		{
-			
-			UT_uint32	nData = -1;
-			const char* name;
-			const PD_Style * pcStyle = NULL;
-			
-			int row = _win32Dialog.getListSelectedIndex(AP_RID_DIALOG_STYLES_TOP_LIST_STYLES);					
-			
-			nData = _win32Dialog.getListDataItem( AP_RID_DIALOG_STYLES_TOP_LIST_STYLES, row);
-			
-			if (row!=LB_ERR)
-			{
-				getDoc()->enumStyles(nData, &name, &pcStyle);				
-				m_selectedStyle = name; 
-				
-				m_nSelectedStyleIdx = nData;
-							
-				// refresh the previews
-				_populatePreviews(false);	
-			}
-			
-			break;			
-		}
-		return 1;
-
-	case AP_RID_DIALOG_STYLES_TOP_BUTTON_DELETE:
-		{
-			if( m_selectedStyle != "" )
-			{
-				if ( !getDoc()->removeStyle(m_selectedStyle.c_str()) ) // actually remove the style
-				{
-					const XAP_StringSet * pSS = m_pApp->getStringSet();
-					getFrame()->showMessageBox( pSS->getValue (AP_STRING_ID_DLG_Styles_ErrStyleCantDelete),
-												XAP_Dialog_MessageBox::b_O,
-												XAP_Dialog_MessageBox::a_OK	);
-					return 1;
-				}
-				getFrame()->repopulateCombos();
-				_populateWindowData(); // force a refresh
-				getDoc()->signalListeners(PD_SIGNAL_UPDATE_LAYOUT);
-				m_selectedStyle = "";
-			}
-    	}
-		return 1;
-
-	case AP_RID_DIALOG_STYLES_TOP_BUTTON_NEW:
-		{
-			m_bisNewStyle = true;
-			//_win32Dialog.showWindow(SW_HIDE);
-			XAP_Frame* pFrame = getFrame();
-			_win32DialogNewModify.runModal(pFrame, AP_DIALOG_ID_STYLES, AP_RID_DIALOG_STYLES_NEWMODIFY, this);
-			if(m_answer == AP_Dialog_Styles::a_OK)
-			{
-				createNewStyle((gchar *) m_newStyleName);
-				_populateCList();
-			}
-			destroyAbiPreview();
-			DELETEP(m_pAbiPreviewWidget);
-			//_win32Dialog.showWindow(SW_SHOW);
-		}
-		return 1;
-
-	case AP_RID_DIALOG_STYLES_TOP_BUTTON_MODIFY:
-		{
-			// Verify that a style is selected
-			if( m_selectedStyle == "" )
-			{
-				XAP_Frame * pFrame = getFrame();
-				const XAP_StringSet * pSS = m_pApp->getStringSet();
-				pFrame->showMessageBox( pSS->getValue(AP_STRING_ID_DLG_Styles_ErrNoStyle),
-										XAP_Dialog_MessageBox::b_O,
-										XAP_Dialog_MessageBox::a_OK);                                        
-				m_answer = AP_Dialog_Styles::a_CANCEL;
-				return 1;
-			}
-			else
-			{
-				PD_Style * pStyle = NULL;
-				getDoc()->getStyle(m_selectedStyle.c_str(), &pStyle);
-
-				m_bisNewStyle = false;
-				XAP_Frame* pFrame = getFrame();			
-				
-				XAP_Win32App * pWin32App = static_cast<XAP_Win32App *>(getApp());
-			
-				LPCTSTR lpTemplate = MAKEINTRESOURCE(AP_RID_DIALOG_STYLES_NEWMODIFY);				
-											
-				int result = DialogBoxParam(pWin32App->getInstance(), lpTemplate,
-									static_cast<XAP_Win32FrameImpl*>(pFrame->getFrameImpl())->getTopLevelWindow(),
-									(DLGPROC)s_dlgProc, (LPARAM)this);
-				
-				if(m_answer == AP_Dialog_Styles::a_OK)
-				{
-					applyModifiedStyleToDoc();
-					getDoc()->updateDocForStyleChange(getCurrentStyle(),true);
-					getDoc()->signalListeners(PD_SIGNAL_UPDATE_LAYOUT);
-				}
-
-				destroyAbiPreview();
-				DELETEP(m_pAbiPreviewWidget);
-			}
-		}
-		return 1;
-
-	case AP_RID_DIALOG_STYLES_NEWMODIFY_BTN_REMOVE:
-		{
-			char szTemp[128];
-			_win32DialogNewModify.getControlText( AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_REMOVE,
-                                                  szTemp,
-	                                              sizeof(szTemp) );			
-			removeVecProp(szTemp);
-			rebuildDeleteProps();
-			updateCurrentStyle();
-		}
-		return 1;
-
-	case AP_RID_DIALOG_STYLES_NEWMODIFY_BTN_TOGGLEITEMS:
-	{
-	    RECT 	rect;
-	    HMENU 	hMenu;
-	    int		x,y;	    	    
-	    HWND	hWndButton;
-	    
-	    hWndButton = GetDlgItem(hWnd, AP_RID_DIALOG_STYLES_NEWMODIFY_BTN_TOGGLEITEMS);
-	    XAP_Win32App * app = static_cast<XAP_Win32App *> (m_pApp);		
-		const XAP_StringSet * pSS = m_pApp->getStringSet();
-	    
-		// Get button position
-	    GetWindowRect(hWndButton, &rect);
-	    x = rect.left;
-	    y = rect.bottom;	               		
-
-	    // Menu creation
-	    hMenu =  CreatePopupMenu();
-	    AppendMenu(hMenu, MF_ENABLED|MF_STRING, 1, (LPCTSTR)pSS->getValue(AP_STRING_ID_DLG_Styles_ModifyParagraph));
-	    AppendMenu(hMenu, MF_ENABLED|MF_STRING, 2, (LPCTSTR)pSS->getValue(AP_STRING_ID_DLG_Styles_ModifyFont));
-	    AppendMenu(hMenu, MF_ENABLED|MF_STRING, 3, (LPCTSTR)pSS->getValue(AP_STRING_ID_DLG_Styles_ModifyTabs));
-	    AppendMenu(hMenu, MF_ENABLED|MF_STRING, 4, (LPCTSTR)pSS->getValue(AP_STRING_ID_DLG_Styles_ModifyNumbering));
-	    AppendMenu(hMenu, MF_ENABLED|MF_STRING, 5, (LPCTSTR)pSS->getValue(AP_STRING_ID_DLG_Styles_ModifyLanguage));
-	    
-	    // show and track the menu
-    	m_selectToggle = TrackPopupMenu(hMenu, TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_NONOTIFY|TPM_RETURNCMD,
-    						x,y,0, hWndButton,  NULL);		    							    	        						 							    
-	    
-	    switch(m_selectToggle)
-		{
-		case 0:	// user has cancelled
-			break;
-		case 1:
-			ModifyParagraph();
-			break;
-		case 2:
-			ModifyFont();
-			break;
-		case 3:
-			ModifyTabs();
-			break;
-		case 4:
-			ModifyLists();
-			break;
-		case 5:
-			ModifyLang();
-			break;
-		default:
-			break;			
-		}
-		
-		rebuildDeleteProps();
-		updateCurrentStyle();
-	    DestroyMenu(hMenu);
-		return 1;
-	}
-
-
-	case AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_BASEDON:
-		if( wNotifyCode == CBN_SELCHANGE )
-		{
-			eventBasedOn();
-			rebuildDeleteProps();
-		}	
-		return 1;
-
-	case AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_FOLLOWPARA:
-		if( wNotifyCode == CBN_SELCHANGE )
-		{
-			eventFollowedBy();
-		}	
-		return 1;
-
-	case AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_TYPE:
-		if( wNotifyCode == CBN_SELCHANGE )
-		{
-			eventStyleType();
-		}
-		return 1;
-
-	default:							// we did not handle this notification
-		UT_DEBUGMSG(("WM_Command for id %ld\n",wId));
-		return 0;						// return zero to let windows take care of it.
-	}
 	
 	return 0;						// return zero to let windows take care of it.
 }
Index: src/wp/ap/win/ap_Win32Dialog_Stylist.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Dialog_Stylist.cpp,v
retrieving revision 1.20
diff -u -r1.20 ap_Win32Dialog_Stylist.cpp
--- src/wp/ap/win/ap_Win32Dialog_Stylist.cpp	29 Mar 2007 04:00:46 -0000	1.20
+++ src/wp/ap/win/ap_Win32Dialog_Stylist.cpp	9 Apr 2007 08:37:57 -0000
@@ -231,49 +231,13 @@
 	m_hWnd = hWnd;
 	
 	// Localise caption
-	SetWindowText(hWnd, pSS->getValue(AP_STRING_ID_DLG_Stylist_Title));	
-			
-	// localize controls
-	_DSX(BTN_OK,		DLG_OK);
-	_DSX(BTN_CANCEL,	DLG_Close);
-
-	_DS(TEXT_STYLES,	DLG_Stylist_Styles);
-
-	_populateWindowData();
-
-	HWND hTree = GetDlgItem(m_hWnd, AP_RID_DIALOG_STYLIST_TREE_STYLIST);
-	hTreeProc = (WHICHPROC) GetWindowLong(hTree, GWL_WNDPROC); // save off our prior callback
-	SetWindowLong(hTree, GWL_WNDPROC, (LONG)s_treeProc); // tie the treeview to the new callback
-	SetWindowLong(hTree, GWL_USERDATA, (LONG)this);
-	XAP_Win32DialogHelper::s_centerDialog(hWnd);
 
 	return 1;							// 1 == we did not call SetFocus()
 }
 
 BOOL AP_Win32Dialog_Stylist::_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
-	WORD wId = LOWORD(wParam);
-
-	switch (wId)
-	{
-		case IDOK: {
-			setStyleValid(true);
-			if (_styleClicked())
-				Apply();
-			}
-			destroy();
-			return 0;
-
-		case IDCANCEL:						// also AP_RID_DIALOG_STYLIST_BTN_CLOSE
-//			m_answer = a_CANCEL;
-			setStyleValid(false);
-			destroy();
-			return 1;
-		
-		default:							// we did not handle this notification
-			UT_DEBUGMSG(("WM_Command for id %ld\n",wId));
-			return 0;						// return zero to let windows take care of it.
-	}
+	return 0;
 }
 
 void AP_Win32Dialog_Stylist::_populateWindowData(void)
@@ -287,110 +251,8 @@
  */
 void AP_Win32Dialog_Stylist::_fillTree(void)
 {
-	Stylist_tree * pStyleTree = getStyleTree();
-	if(pStyleTree == NULL)
-	{
-		updateDialog();
-		pStyleTree = getStyleTree();
-	}
-	if(pStyleTree->getNumRows() == 0)
-	{
-		updateDialog();
-		pStyleTree = getStyleTree();
-	}
-	UT_DEBUGMSG(("Number of rows of styles in document %d \n",pStyleTree->getNumRows()));
-
-	HWND hTree = GetDlgItem(m_hWnd, AP_RID_DIALOG_STYLIST_TREE_STYLIST);
-
-	// Purge any existing TreeView items
-	TreeView_DeleteAllItems(hTree);
-
-	TV_ITEM tvi;
-	TV_INSERTSTRUCT tvins;
-    HTREEITEM hParentItem; // Parent handle to link Styles to their Heading
-
-	tvi.mask = TVIF_TEXT | TVIF_PARAM | TVIF_CHILDREN;               
-	tvi.stateMask =0;
-
-	UT_sint32 row, col;
-	UT_UTF8String sTmp(""), str_loc;
-	UT_String str;		   		 
-
-	//int iter = 0; // Unique key for each item in the treeview
-	for(row= 0; row < pStyleTree->getNumRows(); row++)
-	{
-		if(!pStyleTree->getNameOfRow(sTmp,row))
-		{
-			UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
-			break;
-		}
-		
-		pt_PieceTable::s_getLocalisedStyleName (sTmp.utf8_str(), str_loc);
-		str = AP_Win32App::s_fromUTF8ToWinLocale (str_loc.utf8_str());
-
-		xxx_UT_DEBUGMSG(("Adding Heading %s at row %d \n",sTmp.utf8_str(),row));
-
-		// Insert the item into the treeview
-		tvi.pszText = (LPTSTR)str.c_str();
-		tvi.cchTextMax = str.length() + 1;
-		tvi.lParam = row;
-		if (pStyleTree->getNumCols(row) > 0)
-			tvi.cChildren = 1;
-		else
-			tvi.cChildren = 0;
-
-		tvins.item = tvi;
-		tvins.hParent = TVI_ROOT;
-		tvins.hInsertAfter = TVI_LAST;
-		
-		hParentItem = TreeView_InsertItem(hTree, &tvins);
-
-		// Add any children (columns) this row contains to be added
-		if (pStyleTree->getNumCols(row) > 0)
-		{
-			for(col = 0; col < pStyleTree->getNumCols(row); col++)
-			{
-				if(!pStyleTree->getStyleAtRowCol(sTmp,row,col))
-				{
-					UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
-					break;
-				}
-				xxx_UT_DEBUGMSG(("Adding style %s at row %d col %d \n",sTmp.utf8_str(),row,col+1));
-
-				pt_PieceTable::s_getLocalisedStyleName (sTmp.utf8_str(), str_loc);
-				str = AP_Win32App::s_fromUTF8ToWinLocale (str_loc.utf8_str());
-
-
-				// Insert the item into the treeview
-				tvi.pszText = (LPTSTR)str.c_str();
-				tvi.cchTextMax = str.length() + 1;
-				tvi.cChildren = 0;
-				tvi.lParam = col;
-
-				tvins.item = tvi;
-				tvins.hParent = hParentItem;
-				tvins.hInsertAfter = TVI_LAST;
-
-				TreeView_InsertItem(hTree, &tvins);
-			}
-		}
-	}
-
-	setStyleTreeChanged(false);
-}
-
-BOOL CALLBACK AP_Win32Dialog_Stylist::s_treeProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
-{		
-	if (msg == WM_LBUTTONDBLCLK)
-	{
-		// The user has double clicked on a tree item
-		AP_Win32Dialog_Stylist * pThis = (AP_Win32Dialog_Stylist *)GetWindowLong(hWnd,GWL_USERDATA);
-		if (pThis->_styleClicked())
-			pThis->Apply();
-		return 1;
-	}
 
-	return CallWindowProc(hTreeProc, hWnd, msg, wParam, lParam);
+//	return CallWindowProc(hTreeProc, hWnd, msg, wParam, lParam);
 }
 
 BOOL AP_Win32Dialog_Stylist::_styleClicked(void)
Index: src/wp/ap/win/ap_Win32Dialog_Tab.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Dialog_Tab.cpp,v
retrieving revision 1.17
diff -u -r1.17 ap_Win32Dialog_Tab.cpp
--- src/wp/ap/win/ap_Win32Dialog_Tab.cpp	29 Mar 2007 04:00:46 -0000	1.17
+++ src/wp/ap/win/ap_Win32Dialog_Tab.cpp	9 Apr 2007 08:37:58 -0000
@@ -71,117 +71,13 @@
 
 BOOL AP_Win32Dialog_Tab::_onInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
-	XAP_Win32App * app = static_cast<XAP_Win32App *> (m_pApp);
-	UT_return_val_if_fail (app,0);
-
-	const XAP_StringSet * pSS = m_pApp->getStringSet();
-	
-	SetWindowText(hWnd, pSS->getValue(AP_STRING_ID_DLG_Tab_TabTitle));
-
-	// localize controls
-	_DSX(TABS_OK_BUTTON,				DLG_OK);
-	_DSX(TABS_CANCEL_BUTTON,			DLG_Cancel);
-	_DSX(TABS_APPLY_BUTTON,				DLG_Apply);
-										
-	_DS(TABS_TAB_STOP_POSITION_LABEL,	DLG_Tab_Label_TabPosition);
-	_DS(TABS_TAB_STOPS_CLEARED_LABEL,	DLG_Tab_Label_TabToClear);
-	_DS(TABS_DEFAULT_TAB_STOPS_LABEL,	DLG_Tab_Label_DefaultTS);
-
-	_DS(TABS_ALIGNMENT_LABEL,			DLG_Tab_Label_Alignment);
-	_DS(TABS_LEFT_RADIO,				DLG_Tab_Radio_Left);
-	_DS(TABS_CENTER_RADIO,				DLG_Tab_Radio_Center);
-	_DS(TABS_RIGHT_RADIO,				DLG_Tab_Radio_Right);
-	_DS(TABS_DECIMAL_RADIO,				DLG_Tab_Radio_Decimal);
-	_DS(TABS_BAR_RADIO,					DLG_Tab_Radio_Bar);
-
-	_DS(TABS_LEADER_LABEL,				DLG_Tab_Label_Leader);
-	_DS(TABS_NONE_RADIO,				DLG_Tab_Radio_None);
-	_DS(TABS_DOTS_RADIO,				DLG_Tab_Radio_Dot);
-	_DS(TABS_DASH_RADIO,				DLG_Tab_Radio_Dash);
-	_DS(TABS_UNDERLINE_RADIO,			DLG_Tab_Radio_Underline);
-
-	_DS(TABS_SET_BUTTON,				DLG_Tab_Button_Set);
-	_DS(TABS_CLEAR_BUTTON,				DLG_Tab_Button_Clear);
-	_DS(TABS_CLEAR_ALL_BUTTON,			DLG_Tab_Button_ClearAll);
-
-	_populateWindowData();
-	
-	_win32Dialog.checkButton(AP_RID_DIALOG_TABS_NONE_RADIO);
-	_event_somethingChanged();
-	_win32Dialog.centerDialog();
 	
 	return 1;							// 1 == we did not call SetFocus()
 }
 
 BOOL AP_Win32Dialog_Tab::_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
-	WORD wNotifyCode = HIWORD(wParam);
-	WORD wId = LOWORD(wParam);
-
-	switch (wId)
-	{
-	case AP_RID_DIALOG_TABS_OK_BUTTON:
-		m_answer = a_OK;
-		_storeWindowData();
-		EndDialog(hWnd, 1);
-		return 1;
-
-	case AP_RID_DIALOG_TABS_CANCEL_BUTTON:
-		m_answer = a_CANCEL;
-		EndDialog(hWnd, 0);
-		return 1;
-
-	case AP_RID_DIALOG_TABS_APPLY_BUTTON:
-		_storeWindowData();
-		return 1;
-
-	case AP_RID_DIALOG_TABS_TAB_STOP_POSITION_EDIT:
-		if(wNotifyCode == EN_CHANGE)
-		{
-			_event_TabChange();
-		}
-		return 1;
-
-	case AP_RID_DIALOG_TABS_SET_BUTTON:
-		_event_Set();
-		return 1;
-
-	case AP_RID_DIALOG_TABS_TAB_STOP_POSITION_LIST:
-		if(wNotifyCode == LBN_SELCHANGE)
-		{
-			UT_uint32 Index = (UT_uint32)_win32Dialog.getListSelectedIndex(AP_RID_DIALOG_TABS_TAB_STOP_POSITION_LIST);
-			_event_TabSelected(Index);
-		}
-		return 1;
-
-	case AP_RID_DIALOG_TABS_LEFT_RADIO:
-	case AP_RID_DIALOG_TABS_CENTER_RADIO:
-	case AP_RID_DIALOG_TABS_RIGHT_RADIO:
-	case AP_RID_DIALOG_TABS_DECIMAL_RADIO:
-	case AP_RID_DIALOG_TABS_BAR_RADIO:
-		_event_AlignmentChange();
-		return 1;
-
-	case AP_RID_DIALOG_TABS_NONE_RADIO:
-	case AP_RID_DIALOG_TABS_DOTS_RADIO:
-	case AP_RID_DIALOG_TABS_DASH_RADIO:
-	case AP_RID_DIALOG_TABS_UNDERLINE_RADIO:
-		_event_somethingChanged();
-		return 1;
-		
-	case AP_RID_DIALOG_TABS_CLEAR_ALL_BUTTON:
-		_event_ClearAll();
-		return 1;
-
-	case AP_RID_DIALOG_TABS_CLEAR_BUTTON:
-		_event_Clear();
-		return 1;
-
-	default:							// we did not handle this notification
-		UT_DEBUGMSG(("WM_Command for id %ld\n",wId));
-		return 0;						// return zero to let windows take care of it.
-	}
-
+	return 0;
 }
 
 BOOL AP_Win32Dialog_Tab::_onDeltaPos(NM_UPDOWN * pnmud)
@@ -201,88 +97,7 @@
 
 void AP_Win32Dialog_Tab::_controlEnable( tControl id, bool value )
 {
-	int WinControlID;
-
-	switch(id)
-	{
-	case id_EDIT_TAB:
-		WinControlID = AP_RID_DIALOG_TABS_TAB_STOP_POSITION_EDIT;
-		break;
-
-	case id_LIST_TAB:
-		WinControlID = AP_RID_DIALOG_TABS_TAB_STOP_POSITION_LIST;
-		break;
-
-	case id_SPIN_DEFAULT_TAB_STOP:
-		WinControlID = AP_RID_DIALOG_TABS_DEFAULT_TAB_STOPS_EDIT;
-		break;
-
-	case id_ALIGN_LEFT:
-		WinControlID = AP_RID_DIALOG_TABS_LEFT_RADIO;
-		break;
-		
-	case id_ALIGN_CENTER:
-		WinControlID = AP_RID_DIALOG_TABS_CENTER_RADIO;
-		break;
-		
-	case id_ALIGN_RIGHT:
-		WinControlID = AP_RID_DIALOG_TABS_RIGHT_RADIO;
-		break;
-		
-	case id_ALIGN_DECIMAL:
-		WinControlID = AP_RID_DIALOG_TABS_DECIMAL_RADIO;
-		break;
-		
-	case id_ALIGN_BAR:
-		WinControlID = AP_RID_DIALOG_TABS_BAR_RADIO;
-		break;
-
-	case id_LEADER_NONE:
-		WinControlID = AP_RID_DIALOG_TABS_NONE_RADIO;
-		break;
-		
-	case id_LEADER_DOT:
-		WinControlID = AP_RID_DIALOG_TABS_DOTS_RADIO;
-		break;
-		
-	case id_LEADER_DASH:
-		WinControlID = AP_RID_DIALOG_TABS_DASH_RADIO;
-		break;
-		
-	case id_LEADER_UNDERLINE:
-		WinControlID = AP_RID_DIALOG_TABS_UNDERLINE_RADIO;
-		break;
-
-	case id_BUTTON_SET:
-		WinControlID = AP_RID_DIALOG_TABS_SET_BUTTON;
-		break;
-		
-	case id_BUTTON_CLEAR:
-		WinControlID = AP_RID_DIALOG_TABS_CLEAR_BUTTON;
-		break;
-		
-	case id_BUTTON_CLEAR_ALL:
-		WinControlID = AP_RID_DIALOG_TABS_CLEAR_ALL_BUTTON;
-		break;
-
-	case id_BUTTON_OK:
-		WinControlID = AP_RID_DIALOG_TABS_OK_BUTTON;
-		break;
-		
-	case id_BUTTON_CANCEL:
-		WinControlID = AP_RID_DIALOG_TABS_CANCEL_BUTTON;
-		break;
-
-	default:
-		WinControlID = 0;
-		UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
-		break;
-	}
 
-	if(WinControlID)
-	{
-		_win32Dialog.enableControl(WinControlID, value);
-	}
 
 }
 
@@ -335,23 +150,19 @@
 
 void AP_Win32Dialog_Tab::_setLeader( eTabLeader a )
 {
-	_win32Dialog.checkButton(AP_RID_DIALOG_TABS_NONE_RADIO, a == FL_LEADER_NONE);
-	_win32Dialog.checkButton(AP_RID_DIALOG_TABS_DOTS_RADIO, a == FL_LEADER_DOT);
-	_win32Dialog.checkButton(AP_RID_DIALOG_TABS_DASH_RADIO, a == FL_LEADER_HYPHEN);
-	_win32Dialog.checkButton(AP_RID_DIALOG_TABS_UNDERLINE_RADIO, a == FL_LEADER_UNDERLINE);
+	
 }
 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 const gchar * AP_Win32Dialog_Tab::_gatherDefaultTabStop()
 {
-	_win32Dialog.getControlText(AP_RID_DIALOG_TABS_DEFAULT_TAB_STOPS_EDIT, Buffer, 128);
-
+	
 	return Buffer;
 }
 
 void AP_Win32Dialog_Tab::_setDefaultTabStop( const gchar* default_tab )
 {
-	_win32Dialog.setControlText(AP_RID_DIALOG_TABS_DEFAULT_TAB_STOPS_EDIT, default_tab);
+	
 }
 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
@@ -375,27 +186,25 @@
 
 UT_sint32 AP_Win32Dialog_Tab::_gatherSelectTab()
 {
-	return _win32Dialog.getListSelectedIndex(AP_RID_DIALOG_TABS_TAB_STOP_POSITION_LIST);
+	return 0;
 }
 
 void AP_Win32Dialog_Tab::_setSelectTab( UT_sint32 v )
 {
 
-	_win32Dialog.selectListItem(AP_RID_DIALOG_TABS_TAB_STOP_POSITION_LIST, v);
+	
 }
 
 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 const char * AP_Win32Dialog_Tab::_gatherTabEdit()
 {
-	_win32Dialog.getControlText(AP_RID_DIALOG_TABS_TAB_STOP_POSITION_EDIT, Buffer, 128);
-
-	return Buffer;
+	return NULL;
 }
 
 void AP_Win32Dialog_Tab::_setTabEdit( const char *pszStr )
 {
-	_win32Dialog.setControlText(AP_RID_DIALOG_TABS_TAB_STOP_POSITION_EDIT, pszStr);
+	
 }
 
 
@@ -403,5 +212,5 @@
 void AP_Win32Dialog_Tab::_clearList()
 {
 
-	_win32Dialog.resetContent(AP_RID_DIALOG_TABS_TAB_STOP_POSITION_LIST);
+	
 }
Index: src/wp/ap/win/ap_Win32Dialog_ToggleCase.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Dialog_ToggleCase.cpp,v
retrieving revision 1.10
diff -u -r1.10 ap_Win32Dialog_ToggleCase.cpp
--- src/wp/ap/win/ap_Win32Dialog_ToggleCase.cpp	16 Jan 2007 23:16:30 -0000	1.10
+++ src/wp/ap/win/ap_Win32Dialog_ToggleCase.cpp	9 Apr 2007 08:37:58 -0000
@@ -70,71 +70,13 @@
 
 BOOL AP_Win32Dialog_ToggleCase::_onInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
-	m_hThisDlg = hWnd;
-
-	const XAP_StringSet * pSS = m_pApp->getStringSet();
-
-	SetWindowText( hWnd, pSS->getValue(AP_STRING_ID_DLG_ToggleCase_Title) );
-
-	// localize controls
-	_DSX(TOGGLECASE_BTN_OK,			DLG_OK);
-	_DSX(TOGGLECASE_BTN_CANCEL,		DLG_Cancel);
-	
-	_DS(TOGGLECASE_RDO_SentenceCase,	DLG_ToggleCase_SentenceCase);
-	_DS(TOGGLECASE_RDO_LowerCase,		DLG_ToggleCase_LowerCase);
-	_DS(TOGGLECASE_RDO_UpperCase,		DLG_ToggleCase_UpperCase);
-	_DS(TOGGLECASE_RDO_TitleCase,		DLG_ToggleCase_FirstUpperCase);
-	_DS(TOGGLECASE_RDO_ToggleCase,		DLG_ToggleCase_ToggleCase);
-
-	m_helper.checkButton(AP_RID_DIALOG_TOGGLECASE_RDO_SentenceCase, true);
-	XAP_Win32DialogHelper::s_centerDialog(hWnd);	
 
 	return 1;							// 1 == we did not call SetFocus()
 }
 
 BOOL AP_Win32Dialog_ToggleCase::_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
-	WORD wNotifyCode = HIWORD(wParam);
-	WORD wId = LOWORD(wParam);
-	HWND hWndCtrl = (HWND)lParam;
-
-	switch (wId)
-	{
-	case IDCANCEL:						// also AP_RID_DIALOG_TOGGLECASE_BTN_CANCEL
-		setAnswer(a_CANCEL);
-		EndDialog(hWnd,0);
-		return 1;
-
-	case IDOK:							// also AP_RID_DIALOG_TOGGLECASE_BTN_OK
-		setAnswer(a_OK);
-		setCase(m_iWhichCase);
-		EndDialog(hWnd,0);
-		return 1;
-
-	case AP_RID_DIALOG_TOGGLECASE_RDO_SentenceCase:
-		m_iWhichCase = CASE_SENTENCE;
-		return 1;
-
-	case AP_RID_DIALOG_TOGGLECASE_RDO_LowerCase:
-		m_iWhichCase = CASE_LOWER;
-		return 1;
-		
-	case AP_RID_DIALOG_TOGGLECASE_RDO_UpperCase:
-		m_iWhichCase = CASE_UPPER;
-		return 1;
-		
-	case AP_RID_DIALOG_TOGGLECASE_RDO_TitleCase:
-		m_iWhichCase = CASE_FIRST_CAPITAL;
-		return 1;
-		
-	case AP_RID_DIALOG_TOGGLECASE_RDO_ToggleCase:
-		m_iWhichCase = CASE_TOGGLE;
-		return 1;
-
-	default:							// we did not handle this notification
-		UT_DEBUGMSG(("WM_Command for id %ld\n",wId));
-		return 0;						// return zero to let windows take care of it.
-	}
+	return 0;
 }
 	
 BOOL AP_Win32Dialog_ToggleCase::_onDeltaPos(NM_UPDOWN * pnmud)
Index: src/wp/ap/win/ap_Win32Dialog_WordCount.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Dialog_WordCount.cpp,v
retrieving revision 1.23
diff -u -r1.23 ap_Win32Dialog_WordCount.cpp
--- src/wp/ap/win/ap_Win32Dialog_WordCount.cpp	29 Mar 2007 04:00:46 -0000	1.23
+++ src/wp/ap/win/ap_Win32Dialog_WordCount.cpp	9 Apr 2007 08:37:58 -0000
@@ -31,8 +31,8 @@
 #include "ap_Dialog_Id.h"
 #include "ap_Dialog_WordCount.h"
 #include "ap_Win32Dialog_WordCount.h"
-#include "xap_Win32DialogHelper.h"
 #include "ap_Win32Resources.rc2"
+#include "ut_Win32LocaleString.h"
 
 /*****************************************************************/
 
@@ -60,49 +60,19 @@
 void AP_Win32Dialog_WordCount::runModal(XAP_Frame * pFrame)
 {
 	// raise the dialog
-	XAP_Win32App * pWin32App = static_cast<XAP_Win32App *>(m_pApp);
-
-	LPCTSTR lpTemplate = NULL;
-
 	UT_return_if_fail (m_id == AP_DIALOG_ID_WORDCOUNT);
-
-	lpTemplate = MAKEINTRESOURCE(AP_RID_DIALOG_WORDCOUNT);
-
-	int result = DialogBoxParam(pWin32App->getInstance(),lpTemplate,
-						static_cast<XAP_Win32FrameImpl*>(pFrame->getFrameImpl())->getTopLevelWindow(),
-						(DLGPROC)s_dlgProc,(LPARAM)this);
-	UT_ASSERT_HARMLESS((result != -1));
+	createModal (pFrame, MAKEINTRESOURCE(AP_RID_DIALOG_WORDCOUNT));	
 }
 
 void AP_Win32Dialog_WordCount::runModeless(XAP_Frame * pFrame)
 {
-	// raise the dialog
-	int iResult;
-	XAP_Win32App * pWin32App = static_cast<XAP_Win32App *>(m_pApp);
-
-	LPCTSTR lpTemplate = NULL;
-
-	UT_return_if_fail (m_id == AP_DIALOG_ID_WORDCOUNT);
-
-	lpTemplate = MAKEINTRESOURCE(AP_RID_DIALOG_WORDCOUNT);
-
-	HWND hResult = CreateDialogParam(pWin32App->getInstance(),lpTemplate,
-							static_cast<XAP_Win32FrameImpl*>(pFrame->getFrameImpl())->getTopLevelWindow(),
-							(DLGPROC)s_dlgProc,(LPARAM)this);
-
-	UT_ASSERT_HARMLESS((hResult != NULL));
-
-	m_hWnd = hResult;
-
+	// raise the dialog	
+	UT_return_if_fail (m_id == AP_DIALOG_ID_WORDCOUNT);	
+	createModeless (pFrame, MAKEINTRESOURCE(AP_RID_DIALOG_WORDCOUNT));
+	
 	// Save dialog the ID number and pointer to the widget
-	UT_sint32 sid =(UT_sint32)  getDialogId();
-	m_pApp->rememberModelessId( sid, (XAP_Dialog_Modeless *) m_pDialog);
-
-	iResult = ShowWindow( m_hWnd, SW_SHOW );
-
-	iResult = BringWindowToTop( m_hWnd );
-
-	UT_ASSERT_HARMLESS((iResult != 0));
+	UT_sint32 sid =(UT_sint32) getDialogId();
+	m_pApp->rememberModelessId (sid, (XAP_Dialog_Modeless *) m_pDialog);
 }
 
 void    AP_Win32Dialog_WordCount::setUpdateCounter( UT_uint32 iRate )
@@ -154,140 +124,94 @@
 	m_bDestroy_says_stopupdating = true;
 
 	m_pAutoUpdateWC->stop();
-
-	int iResult = DestroyWindow( m_hWnd );
-
-	UT_ASSERT_HARMLESS((iResult != 0));
-
+	destroyWindow ();
 	modeless_cleanup();
 }
 
 void AP_Win32Dialog_WordCount::activate(void)
 {
-	int iResult;
-
 	// Update the caption
 	ConstructWindowName();
-	SetWindowText(m_hWnd, m_WindowName);
-
-	iResult = ShowWindow( m_hWnd, SW_SHOW );
-
-	iResult = BringWindowToTop( m_hWnd );
-
-	UT_ASSERT_HARMLESS((iResult != 0));
+	setDialogTitle(m_WindowName);
+	showWindow(SW_SHOW);
+	bringWindowToTop();
 }
 
 void AP_Win32Dialog_WordCount::notifyActiveFrame(XAP_Frame *pFrame)
 {
-	if((HWND)GetWindowLong(m_hWnd, GWL_HWNDPARENT) != static_cast<XAP_Win32FrameImpl*>(pFrame->getFrameImpl())->getTopLevelWindow())
+	if((HWND)GetWindowLong(m_hDlg, GWL_HWNDPARENT) != static_cast<XAP_Win32FrameImpl*>(pFrame->getFrameImpl())->getTopLevelWindow())
 	{
 		// Update the caption
 		ConstructWindowName();
-		SetWindowText(m_hWnd, m_WindowName);
+		setDialogTitle (m_WindowName);
 
-		SetWindowLong(m_hWnd, GWL_HWNDPARENT, (long)static_cast<XAP_Win32FrameImpl*>(pFrame->getFrameImpl())->getTopLevelWindow());
-		SetWindowPos(m_hWnd, NULL, 0, 0, 0, 0,
+		SetWindowLong(m_hDlg, GWL_HWNDPARENT, (long)static_cast<XAP_Win32FrameImpl*>(pFrame->getFrameImpl())->getTopLevelWindow());
+		SetWindowPos(m_hDlg, NULL, 0, 0, 0, 0,
 						SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
 		
 		event_Update();
 	}
 }
 
-void AP_Win32Dialog_WordCount::notifyCloseFrame(XAP_Frame *pFrame)
+BOOL AP_Win32Dialog_WordCount::_onDlgMessage(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 {
-	if((HWND)GetWindowLong(m_hWnd, GWL_HWNDPARENT) == static_cast<XAP_Win32FrameImpl*>(pFrame->getFrameImpl())->getTopLevelWindow())
-	{
-		SetWindowLong(m_hWnd, GWL_HWNDPARENT, NULL);
-		SetWindowPos(m_hWnd, NULL, 0, 0, 0, 0,
-						SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
-	}
-}
-
-BOOL CALLBACK AP_Win32Dialog_WordCount::s_dlgProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
-{
-	// This is a static function.
-
-	AP_Win32Dialog_WordCount * pThis;
-	
-	switch (msg)
-	{
-	case WM_INITDIALOG:
-		pThis = (AP_Win32Dialog_WordCount *)lParam;
-		SetWindowLong(hWnd,DWL_USER,lParam);
-		return pThis->_onInitDialog(hWnd,wParam,lParam);
+	if (msg != WM_VSCROLL)
+		return FALSE;
 		
-	case WM_COMMAND:
-		pThis = (AP_Win32Dialog_WordCount *)GetWindowLong(hWnd,DWL_USER);
-		if (pThis)
-			return pThis->_onCommand(hWnd,wParam,lParam);
-		else
-			return 0;
-		
-	case WM_VSCROLL:
-		pThis = (AP_Win32Dialog_WordCount *)GetWindowLong(hWnd,DWL_USER);
-		pThis->setUpdateCounter( (UT_uint32)HIWORD(wParam) );
-		pThis->event_Update();
-		return 1;
-
-	default:
-		return 0;
-	}
+	setUpdateCounter( (UT_uint32)HIWORD(wParam) );
+	event_Update();		
+	return TRUE;
 }
 
 static NUMBERFMT numberfmt;
-static char gszDecSep[16];
-static char gszThSep[16];		
+static TCHAR gszDecSep[16];
+static TCHAR gszThSep[16];		
 
 void AP_Win32Dialog_WordCount::_setDlgItemInt(UINT nCtrl, int nValue)
-{
-	
-	char szFormatted[128], szUnFormatted[128];
-	sprintf(szUnFormatted, "%d", nValue);
+{	
+	TCHAR szFormatted[64], szUnFormatted[64];
+	_stprintf(szUnFormatted, _T("%d"), nValue);
 
 	if (numberfmt.lpThousandSep==NULL)	// We only do this the first time
 	{
-		char szBuffer[16];
+		TCHAR szBuffer[16];
 		
 		GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, gszDecSep, sizeof(gszDecSep));
 		GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STHOUSAND, gszThSep, sizeof(gszThSep));
 				
 		numberfmt.NumDigits = 0;		
 		GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ILZERO, szBuffer, sizeof(szBuffer));
-		numberfmt.LeadingZero = atoi(szBuffer);
+		numberfmt.LeadingZero = _ttoi(szBuffer);
 
 		GetLocaleInfo( LOCALE_USER_DEFAULT, LOCALE_SGROUPING, szBuffer, sizeof(szBuffer));
-		numberfmt.Grouping = atoi(szBuffer);
+		numberfmt.Grouping = _ttoi(szBuffer);
 		numberfmt.lpDecimalSep = gszDecSep;
 		numberfmt.lpThousandSep = gszThSep;
 
 		GetLocaleInfo( LOCALE_USER_DEFAULT, LOCALE_INEGNUMBER, szBuffer, sizeof(szBuffer));
-		numberfmt.NegativeOrder = atoi(szBuffer);
+		numberfmt.NegativeOrder = _ttoi(szBuffer);
 	}
 	
 	/* Convert the number string into the proper locale defn */
 	GetNumberFormat(LOCALE_USER_DEFAULT, 0, szUnFormatted,
 		&numberfmt, szFormatted, sizeof(szFormatted));
 
-	SetDlgItemText(m_hWnd, nCtrl, szFormatted);		
+	SetDlgItemText(m_hDlg, nCtrl, szFormatted);
 }						
 					
-					
-#define _DS(c,s)	SetDlgItemText(hWnd,AP_RID_DIALOG_##c,pSS->getValue(AP_STRING_ID_##s))
-#define _DSX(c,s)	SetDlgItemText(hWnd,AP_RID_DIALOG_##c,pSS->getValue(XAP_STRING_ID_##s))
-
+#define _DS(c,s)	setDlgItemText(AP_RID_DIALOG_##c,pSS->getValue(AP_STRING_ID_##s))
+#define _DSX(c,s)	setDlgItemText(AP_RID_DIALOG_##c,pSS->getValue(XAP_STRING_ID_##s))					
 
 BOOL AP_Win32Dialog_WordCount::_onInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam)
-{
-	const XAP_StringSet * pSS = m_pApp->getStringSet();
-	m_hWnd = hWnd;
+{	
+	const XAP_StringSet * pSS = m_pApp->getStringSet();	
 	
 	// Update the caption
-	ConstructWindowName();
-	SetWindowText(hWnd, m_WindowName);
+	ConstructWindowName();		
+	setDialogTitle (m_WindowName);
 			
 	m_pAutoUpdateWC = UT_Timer::static_constructor(autoupdateWC,this);
-	setUpdateCounter( 1 );
-
+	setUpdateCounter( 1 );	
 	// localize controls
 	_DSX(WORDCOUNT_BTN_CLOSE,		DLG_Close);
 	
@@ -300,16 +224,14 @@
 	_DS(WORDCOUNT_TEXT_LINE,		DLG_WordCount_Lines);
 	_DS(WORDCOUNT_TEXT_WORDSONLY,	DLG_WordCount_Words_No_Notes);
 	
-	_updateWindowData ();
-	XAP_Win32DialogHelper::s_centerDialog(hWnd);	
+	_updateWindowData();
+	centerDialog();
 
 	return 1;							// 1 == we did not call SetFocus()
 }
 
 void AP_Win32Dialog_WordCount::_updateWindowData(void)
 {
-	HWND hWnd = m_hWnd;
-
 	_setDlgItemInt(AP_RID_DIALOG_WORDCOUNT_VAL_PAGE,		m_count.page);
 	_setDlgItemInt(AP_RID_DIALOG_WORDCOUNT_VAL_WORD,		m_count.word);
 	_setDlgItemInt(AP_RID_DIALOG_WORDCOUNT_VAL_CH,			m_count.ch_no);
@@ -320,11 +242,11 @@
 
 	// Update the caption in case the name of the document has changed
 	ConstructWindowName();
-	SetWindowText(hWnd, m_WindowName);
+	setDialogTitle (m_WindowName);
 }
 
 BOOL AP_Win32Dialog_WordCount::_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
-{
+{	
 	WORD wId = LOWORD(wParam);
 
 	switch (wId)
Index: src/wp/ap/win/ap_Win32Dialog_WordCount.h
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Dialog_WordCount.h,v
retrieving revision 1.12
diff -u -r1.12 ap_Win32Dialog_WordCount.h
--- src/wp/ap/win/ap_Win32Dialog_WordCount.h	16 Jan 2007 23:16:30 -0000	1.12
+++ src/wp/ap/win/ap_Win32Dialog_WordCount.h	9 Apr 2007 08:37:58 -0000
@@ -24,11 +24,11 @@
 #include "ap_Dialog_WordCount.h"
 #include "ut_timer.h"
 #include "xap_Frame.h"
-
+#include "xap_Win32DialogBase.h"
 
 /*****************************************************************/
 
-class AP_Win32Dialog_WordCount: public AP_Dialog_WordCount
+class AP_Win32Dialog_WordCount: public AP_Dialog_WordCount, public XAP_Win32DialogBase
 {
 public:
 	AP_Win32Dialog_WordCount(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id);
@@ -39,23 +39,22 @@
 	virtual void			runModeless(XAP_Frame * pFrame);
 	virtual void			destroy(void);
 	virtual void			activate(void);
-	virtual void			notifyActiveFrame(XAP_Frame *pFrame);
-	virtual void			notifyCloseFrame(XAP_Frame *pFrame);
+	virtual void			notifyActiveFrame(XAP_Frame *pFrame);	
 
 	static XAP_Dialog *		static_constructor(XAP_DialogFactory *, XAP_Dialog_Id id);
 	static void				autoupdateWC(UT_Worker * pTimer);
 	virtual void			setUpdateCounter( UT_uint32 );
 	virtual void			event_Update(void);
 	static BOOL CALLBACK	s_dlgProc(HWND,UINT,WPARAM,LPARAM);
-	void *					pGetWindowHandle( void ) { return (void*)m_hWnd; }
+	void *					pGetWindowHandle( void ) { return (void*)m_hDlg; }
+	virtual BOOL 			_onDlgMessage(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
 	
 protected:
 	BOOL					_onInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam);
-	BOOL					_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);
+	BOOL					_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);	
 	void					_setDlgItemInt(UINT nCtrl, int nValue);
-	void 					_updateWindowData(void);       
-
-	HWND                    m_hWnd;
+	void 					_updateWindowData(void);
+	
 	bool					m_bAutoWC;
 
 	UT_Timer *				m_pAutoUpdateWC;
Index: src/wp/ap/win/ap_Win32FrameImpl.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32FrameImpl.cpp,v
retrieving revision 1.54
diff -u -r1.54 ap_Win32FrameImpl.cpp
--- src/wp/ap/win/ap_Win32FrameImpl.cpp	16 Jan 2007 23:16:31 -0000	1.54
+++ src/wp/ap/win/ap_Win32FrameImpl.cpp	9 Apr 2007 08:38:00 -0000
@@ -27,6 +27,7 @@
 #include "ap_Win32TopRuler.h"
 #include "ap_Win32LeftRuler.h"
 #include "ap_Win32StatusBar.h"
+#include "ut_Win32LocaleString.h"
 
 #include <winuser.h>
 
@@ -54,8 +55,8 @@
 #define SWL(hwnd, f)	reinterpret_cast<AP_Win32Frame *>(SetWindowLong((hwnd), GWL_USERDATA,(LONG)(f)))
 
 // reserve space for static variables
-char AP_Win32FrameImpl::s_ContainerWndClassName[MAXCNTWNDCLSNMSIZE];
-char AP_Win32FrameImpl::s_DocumentWndClassName[MAXDOCWNDCLSNMSIZE];
+TCHAR AP_Win32FrameImpl::s_ContainerWndClassName[MAXCNTWNDCLSNMSIZE];
+TCHAR AP_Win32FrameImpl::s_DocumentWndClassName[MAXDOCWNDCLSNMSIZE];
 //static char s_LeftRulerWndClassName[256];
 
 AP_Win32FrameImpl::AP_Win32FrameImpl(AP_Frame *pFrame) :
@@ -128,7 +129,7 @@
 	const int cyHScroll = GetSystemMetrics(SM_CYHSCROLL);
 	const int cxVScroll = GetSystemMetrics(SM_CXVSCROLL);
 
-	m_hWndHScroll = UT_CreateWindowEx(0, "ScrollBar", 0, WS_CHILD | WS_VISIBLE | SBS_HORZ,
+	m_hWndHScroll = UT_CreateWindowEx(0, _T("ScrollBar"), 0, WS_CHILD | WS_VISIBLE | SBS_HORZ,
 									0, r.bottom - cyHScroll,
 									r.right - cxVScroll, cyHScroll,
 									m_hwndContainer,
@@ -138,7 +139,7 @@
 	//SWL(m_hWndHScroll, this);
 	SWL(m_hWndHScroll, pFrame);
 
-	m_hWndVScroll = UT_CreateWindowEx(0, "ScrollBar", 0, WS_CHILD | WS_VISIBLE | SBS_VERT,
+	m_hWndVScroll = UT_CreateWindowEx(0, _T("ScrollBar"), 0, WS_CHILD | WS_VISIBLE | SBS_VERT,
 									r.right - cxVScroll, 0,
 									cxVScroll, r.bottom - cyHScroll,
 									m_hwndContainer,
@@ -154,7 +155,7 @@
 #  define XX_StyleBits          (SBS_SIZEGRIP)
 #endif
 
-	m_hWndGripperHack = UT_CreateWindowEx(0,"ScrollBar", 0,
+	m_hWndGripperHack = UT_CreateWindowEx(0, _T("ScrollBar"), 0,
 										WS_CHILD | WS_VISIBLE | XX_StyleBits,
 										r.right-cxVScroll, r.bottom-cyHScroll, cxVScroll, cyHScroll,
 										m_hwndContainer, NULL, static_cast<XAP_Win32App *>(XAP_App::getApp())->getInstance(), NULL);
@@ -621,11 +622,13 @@
 		return false;
 
 	ATOM a;
+	UT_Win32LocaleString str;	
 
 	// register class for the container window (this will contain the document
 	// and the rulers and the scroll bars)
 
-	_snprintf(s_ContainerWndClassName, MAXCNTWNDCLSNMSIZE, "%sContainer", app->getApplicationName());
+	str.fromASCII (app->getApplicationName());	
+	_sntprintf(s_ContainerWndClassName, MAXCNTWNDCLSNMSIZE, _T("%sContainer"), str.c_str());
 
 	a = UT_RegisterClassEx(CS_DBLCLKS | CS_OWNDC, AP_Win32FrameImpl::_ContainerWndProc, app->getInstance(),
 						   NULL, LoadCursor(NULL, IDC_ARROW), NULL, NULL,
@@ -634,7 +637,8 @@
 	UT_return_val_if_fail(a, false);
 
 	// register class for the actual document window
-	_snprintf(s_DocumentWndClassName, MAXDOCWNDCLSNMSIZE, "%sDocument", app->getApplicationName());
+	//_snprintf(s_DocumentWndClassName, MAXDOCWNDCLSNMSIZE, "%sDocument", app->getApplicationName());
+	_tcscpy (s_DocumentWndClassName, _T("Document"));
 
 	a = UT_RegisterClassEx(CS_DBLCLKS | CS_OWNDC, AP_Win32FrameImpl::_DocumentWndProc, app->getInstance(),
 						   NULL, NULL, NULL, NULL,
@@ -645,9 +649,11 @@
 	if (!AP_Win32TopRuler::RegisterClass(app) ||
 		!AP_Win32LeftRuler::RegisterClass(app))
 	{
+		//::MessageBox (NULL, _T("Registered at AP_Win32FrameImpl::_RegisterClass failed"), NULL, NULL);
 		return false;
 	}
 
+	//::MessageBox (NULL, _T("Registered at AP_Win32FrameImpl::_RegisterClass ok"), NULL, NULL);
 	return true;
 }
 
@@ -1235,6 +1241,7 @@
 
 		case WM_CHAR:
 		{
+			bool is_uni = IsWindowUnicode (hwnd);
 			UT_DEBUGMSG(("WM_CHAR %d  - %d\n",wParam, lParam));
 			ev_Win32Keyboard *pWin32Keyboard = static_cast<ev_Win32Keyboard *>(fImpl->m_pKeyboard);
 	    
Index: src/wp/ap/win/ap_Win32FrameImpl.h
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32FrameImpl.h,v
retrieving revision 1.18
diff -u -r1.18 ap_Win32FrameImpl.h
--- src/wp/ap/win/ap_Win32FrameImpl.h	16 Jan 2007 23:16:31 -0000	1.18
+++ src/wp/ap/win/ap_Win32FrameImpl.h	9 Apr 2007 08:38:01 -0000
@@ -25,7 +25,7 @@
 #include "xap_Win32FrameImpl.h"
 #include "ap_FrameData.h"
 #include "gr_Win32Graphics.h"
-
+#include <tchar.h>
 
 class ABI_EXPORT AP_Win32FrameImpl : public XAP_Win32FrameImpl
 {
@@ -132,8 +132,8 @@
 
 	#define MAXDOCWNDCLSNMSIZE 256
 	#define MAXCNTWNDCLSNMSIZE 256
-	static char s_ContainerWndClassName[MAXCNTWNDCLSNMSIZE];
-	static char s_DocumentWndClassName[MAXDOCWNDCLSNMSIZE];
+	static TCHAR s_ContainerWndClassName[MAXCNTWNDCLSNMSIZE];
+	static TCHAR s_DocumentWndClassName[MAXDOCWNDCLSNMSIZE];
 };
 
 #endif /* AP_WIN32FRAMEIMPL_H */
Index: src/wp/ap/win/ap_Win32LeftRuler.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32LeftRuler.cpp,v
retrieving revision 1.26
diff -u -r1.26 ap_Win32LeftRuler.cpp
--- src/wp/ap/win/ap_Win32LeftRuler.cpp	16 Jan 2007 23:16:31 -0000	1.26
+++ src/wp/ap/win/ap_Win32LeftRuler.cpp	9 Apr 2007 08:38:01 -0000
@@ -27,6 +27,7 @@
 #include "gr_Win32Graphics.h"
 #include "xap_Win32App.h"
 #include "ap_Win32Frame.h"
+#include "ut_Win32LocaleString.h"
 
 /*****************************************************************/
 
@@ -35,7 +36,7 @@
 
 #define ENSUREP(p)		do { UT_ASSERT_HARMLESS(p); if (!p) goto Cleanup; } while (0)
 
-static char s_LeftRulerWndClassName[256];
+static TCHAR s_LeftRulerWndClassName[256];
 
 /*****************************************************************/
 
@@ -76,10 +77,12 @@
 bool AP_Win32LeftRuler::RegisterClass(XAP_Win32App * app)
 {
 	ATOM a;
+	UT_Win32LocaleString str;
 	
+	str.fromASCII (app->getApplicationName());
 	// register class for the top ruler
-	sprintf(s_LeftRulerWndClassName, "%sLeftRuler", app->getApplicationName());
-
+	_stprintf (s_LeftRulerWndClassName, _T("%sLeftRuler"), str.c_str());
+		
 	a = UT_RegisterClassEx(CS_DBLCLKS | CS_OWNDC, AP_Win32LeftRuler::_LeftRulerWndProc, app->getInstance(),
 						   NULL, LoadCursor(NULL, IDC_ARROW), GetSysColorBrush(COLOR_BTNFACE), NULL,
 						   NULL, s_LeftRulerWndClassName);
Index: src/wp/ap/win/ap_Win32Prefs.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Prefs.cpp,v
retrieving revision 1.21
diff -u -r1.21 ap_Win32Prefs.cpp
--- src/wp/ap/win/ap_Win32Prefs.cpp	16 Jan 2007 23:16:31 -0000	1.21
+++ src/wp/ap/win/ap_Win32Prefs.cpp	9 Apr 2007 08:38:01 -0000
@@ -48,7 +48,7 @@
 	bool ret = AP_Prefs::loadBuiltinPrefs();
 
 	// Add information from Win32 system and user setup
-	if( GetLocaleInfo( LOCALE_USER_DEFAULT, LOCALE_IMEASURE, szLocaleInfo, sizeof( szLocaleInfo ) / sizeof( szLocaleInfo[0] ) ) )
+	if( GetLocaleInfoA( LOCALE_USER_DEFAULT, LOCALE_IMEASURE, szLocaleInfo, sizeof( szLocaleInfo ) / sizeof( szLocaleInfo[0] ) ) )
 	{
 		m_builtinScheme->setValue( AP_PREF_KEY_RulerUnits, UT_dimensionName( szLocaleInfo[0] == '0' ? DIM_CM : DIM_IN ) );
 	}
Index: src/wp/ap/win/ap_Win32StatusBar.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32StatusBar.cpp,v
retrieving revision 1.37
diff -u -r1.37 ap_Win32StatusBar.cpp
--- src/wp/ap/win/ap_Win32StatusBar.cpp	7 Apr 2007 17:50:23 -0000	1.37
+++ src/wp/ap/win/ap_Win32StatusBar.cpp	9 Apr 2007 08:38:02 -0000
@@ -29,6 +29,7 @@
 #include "xap_Win32App.h"
 #include "ap_Win32Frame.h"
 #include "ap_Win32App.h"
+#include "ut_Win32LocaleString.h"
 
 LRESULT APIENTRY StatusbarWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { 
 
@@ -143,8 +144,9 @@
 
 	UT_return_if_fail (m_hWnd && m_pSB);	
 	AP_StatusBarField_TextInfo * textInfo = ((AP_StatusBarField_TextInfo *)m_pStatusBarField);
-	UT_String 	s =	AP_Win32App::s_fromUTF8ToWinLocale(textInfo->getBuf().utf8_str());	
-	SendMessage(m_hWnd, SB_SETTEXT, m_nID | m_pSB->getDir(), (LPARAM)  s.c_str());
+	UT_Win32LocaleString str;	
+	str.fromUTF8 (textInfo->getBuf().utf8_str());	
+	SendMessage(m_hWnd, SB_SETTEXT, m_nID | m_pSB->getDir(), (LPARAM)  str.c_str());
 	
 }
 
Index: src/wp/ap/win/ap_Win32Toolbar_FontCombo.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Toolbar_FontCombo.cpp,v
retrieving revision 1.14
diff -u -r1.14 ap_Win32Toolbar_FontCombo.cpp
--- src/wp/ap/win/ap_Win32Toolbar_FontCombo.cpp	18 Jan 2007 13:14:53 -0000	1.14
+++ src/wp/ap/win/ap_Win32Toolbar_FontCombo.cpp	9 Apr 2007 08:38:02 -0000
@@ -27,6 +27,7 @@
 #include "ap_Toolbar_Id.h"
 #include "xap_Frame.h"
 #include "ut_debugmsg.h"
+#include "ut_Win32LocaleString.h"
 
 /*****************************************************************/
 
@@ -95,7 +96,9 @@
 		return 1 ;
 #endif	
 
-	char * p = g_strdup(lplf->lfFaceName);
+	UT_Win32LocaleString str;
+	str.fromLocale (lplf->lfFaceName);
+	char * p = g_strdup((str.utf8_str().utf8_str()));
 	ctl->m_vecContents.addItem(p);
 	ctl->m_vecFontCharSet.addItem((void*)lplf->lfCharSet);
 
Index: src/wp/ap/win/ap_Win32TopRuler.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32TopRuler.cpp,v
retrieving revision 1.40
diff -u -r1.40 ap_Win32TopRuler.cpp
--- src/wp/ap/win/ap_Win32TopRuler.cpp	16 Jan 2007 23:16:32 -0000	1.40
+++ src/wp/ap/win/ap_Win32TopRuler.cpp	9 Apr 2007 08:38:02 -0000
@@ -28,7 +28,7 @@
 #include "gr_Win32Graphics.h"
 #include "xap_Win32App.h"
 #include "ap_Win32FrameImpl.h"
-
+#include "ut_Win32LocaleString.h"
 #include "fv_View.h"
 
 /*****************************************************************/
@@ -38,7 +38,7 @@
 
 #define ENSUREP(p)		do { UT_ASSERT_HARMLESS(p); if (!p) goto Cleanup; } while (0)
 
-static char s_TopRulerWndClassName[256];
+static TCHAR s_TopRulerWndClassName[256];
 
 /*****************************************************************/
 
@@ -82,9 +82,11 @@
 bool AP_Win32TopRuler::RegisterClass(XAP_Win32App * app)
 {
 	ATOM a;
+	UT_Win32LocaleString str;	
+	str.fromASCII (app->getApplicationName());
 	
 	// register class for the top ruler
-	sprintf(s_TopRulerWndClassName, "%sTopRuler", app->getApplicationName());
+	_stprintf (s_TopRulerWndClassName, _T("%sTopRuler"), str.c_str());	
 
 	a = UT_RegisterClassEx(CS_OWNDC, AP_Win32TopRuler::_TopRulerWndProc, app->getInstance(),
 						   NULL, LoadCursor(NULL, IDC_ARROW), GetSysColorBrush(COLOR_BTNFACE), NULL,
Index: src/wp/ap/xp/ap_App.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/xp/ap_App.cpp,v
retrieving revision 1.20
diff -u -r1.20 ap_App.cpp
--- src/wp/ap/xp/ap_App.cpp	16 Jan 2007 23:16:33 -0000	1.20
+++ src/wp/ap/xp/ap_App.cpp	9 Apr 2007 08:38:03 -0000
@@ -24,7 +24,7 @@
 #include "ap_Prefs_SchemeIds.h"
 #include "xap_Frame.h"
 #include "pd_Document.h"
-
+#include "ut_Win32LocaleString.h"
 #include "ie_imp.h"
 
 #if defined(WIN32)
@@ -62,7 +62,9 @@
 		char * uri = NULL;
 
 #if defined(WIN32)
-		uri = UT_go_shell_arg_to_uri (AP_Win32App::s_fromWinLocaleToUTF8(file).utf8_str());
+		UT_Win32LocaleString str;	
+		str.fromASCII (file);	
+		uri = UT_go_shell_arg_to_uri (str.utf8_str().utf8_str());
 #else
 		uri = UT_go_shell_arg_to_uri (file);
 #endif
Index: src/wp/ap/xp/ap_Args.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/xp/ap_Args.cpp,v
retrieving revision 1.41
diff -u -r1.41 ap_Args.cpp
--- src/wp/ap/xp/ap_Args.cpp	19 Jan 2007 15:34:48 -0000	1.41
+++ src/wp/ap/xp/ap_Args.cpp	9 Apr 2007 08:38:03 -0000
@@ -106,11 +106,11 @@
     }
 
  	if (m_iVersion)
- 	{		
+ 	{		/*
  		printf("%s\n", XAP_App::s_szBuild_Version);
 		#ifdef _WIN32
-			MessageBox(NULL, XAP_App::s_szBuild_Version, "Version", MB_OK|MB_ICONINFORMATION);
-		#endif
+			MessageBox(NULL, XAP_App::s_szBuild_Version, _T("Version"), MB_OK|MB_ICONINFORMATION);
+		#endif*/
 		exit(0);
  	}
 
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.366
diff -u -r1.366 ie_imp_MsWord_97.cpp
--- src/wp/impexp/xp/ie_imp_MsWord_97.cpp	6 Mar 2007 03:42:09 -0000	1.366
+++ src/wp/impexp/xp/ie_imp_MsWord_97.cpp	9 Apr 2007 08:38:16 -0000
@@ -1101,7 +1101,8 @@
 {
   wvParseStruct ps;
 
-  int ret = wvInitParser_gsf(&ps, fp);
+  //int ret = wvInitParser_gsf(&ps, fp);
+  int ret = 0;
   const char * password = NULL;
 
   if (ret & 0x8000)		/* Password protected? */

