From ebb3b956d3c5e2ec8c2308e20d650c91fb08cc01 Mon Sep 17 00:00:00 2001
From: xj qian <qianxj15@sina.com>
Date: 星期五, 28 六月 2024 18:04:59 +0800
Subject: [PATCH] update print view

---
 jrj/project/printview/Template.Print.ViewEx.cpp |  287 ++++++++++++++++++++++++++++++--------------------------
 1 files changed, 153 insertions(+), 134 deletions(-)

diff --git a/jrj/project/printview/Template.Print.ViewEx.cpp b/jrj/project/printview/Template.Print.ViewEx.cpp
index 33c4d29..04de185 100644
--- a/jrj/project/printview/Template.Print.ViewEx.cpp
+++ b/jrj/project/printview/Template.Print.ViewEx.cpp
@@ -1,3 +1,13 @@
+#include <wobject/xstring.hpp>
+#include <xcontrol/xtreeview.hpp>
+#include <xcontrol/xdwgrid.hpp>
+#include <xcontrol/xlayersheet.hpp>
+
+#include "vbusiness/vframe/maint.vframe.vbusiness.hpp"
+#include "viewobject/view.base.hpp"
+
+using xml = KXMLDOMDocument;
+
 namespace _excel for ole "Excel.Application,{00020813-0000-0000-C000-000000000046}";
 namespace _mshtml for ole "MSHtml,{3050F1C5-98B5-11CF-BB82-00AA00BDCE0B}";
 
@@ -7,9 +17,9 @@
 	static int CreateInstance() alias "?CreateInstance@CExcelApplication@@SAPAV1@XZ";
 	void put_Visible(bool t) alias "?put_Visible@CExcelApplication@@QAEXH@Z";
 	bool get_Visible() alias "?get_Visible@CExcelApplication@@QAEHXZ";
-	void OpenDocument(const string filename) alias "?OpenDocument@CExcelApplication@@QAEXQA_W@Z";
+	void OpenDocument(const xstring filename) alias "?OpenDocument@CExcelApplication@@QAEXQA_W@Z";
 	void TransShape() alias "?TransShape@CExcelApplication@@QAEXXZ";
-	void SaveToFile(string filename) alias "?SaveToFile@CExcelApplication@@QAEXQA_W@Z";
+	void SaveToFile(xstring filename) alias "?SaveToFile@CExcelApplication@@QAEXQA_W@Z";
 	void Quit() alias "?Quit@CExcelApplication@@QAEXXZ";
 };
 
@@ -18,27 +28,27 @@
    unsigned int	lStructSize;
    unsigned int   hwndOwner;
    unsigned int   hInstance;
-   string		     	lpstrFilter;
+   xstring		     	lpstrFilter;
    
-   string       		lpstrCustomFilter;
+   xstring       		lpstrCustomFilter;
    unsigned int   nMaxCustFilter;
    unsigned int        nFilterIndex;
-   string       			 lpstrFile;
+   xstring       			 lpstrFile;
    
    unsigned int        nMaxFile;
-   string       			 lpstrFileTitle;
+   xstring       			 lpstrFileTitle;
    unsigned int        nMaxFileTitle;
-   string      lpstrInitialDir;
+   xstring      lpstrInitialDir;
    
-   string      			lpstrTitle;
+   xstring      			lpstrTitle;
    unsigned int       Flags;
    unsigned short   nFileOffset;
    unsigned short   nFileExtension;
-   string      lpstrDefExt;
+   xstring      lpstrDefExt;
    
    unsigned int   lCustData;
    unsigned int 	lpfnHook;
-   string      lpTemplateName;
+   xstring      lpTemplateName;
    
 	//_WIN32_WINNT >= 0x0500
    unsigned int		 pvReserved;
@@ -47,55 +57,64 @@
 	// (_WIN32_WINNT >= 0x0500)
 };
 	
-class TemplatePrintViewEx : public frame
+class  __declspec(dllexport) TemplatePrintViewEx : public xframe
 {	
+public:
 	xole ole_print;
 	xcell cell;
-	string m_EntityName;
-	string m_EntityID;
-	string m_EntityNo;
-	string m_strHtml;
-	string m_spath;
+	xstring m_EntityName;
+	xstring m_EntityID;
+	xstring m_EntityNo;
+	xstring m_strHtml;
+	xstring m_spath;
 	bool updated;
 
-	string   htmlStr;
+	xstring   htmlStr;
 	cexcel   excel;
 	bool 	   editing;
 
-	string  billName ;
-	string  billID ;
-	string  billPre;
+	xstring  billName ;
+	xstring  billID ;
+	xstring  billPre;
 
-	string  m_DocumentID;
+	xstring  m_DocumentID;
 	xml	  m_dataset;
 	//bool showgrid;
 	bool PaperPrint;
 
-	static stdcall int GetModuleFileName(int hModule ,string lpFileName ,int nSize ) native from "kernel32.dll" alias "GetModuleFileNameW";
-	static stdcall int PathRemoveFileSpec(string lpFileName ) native from "shlwapi.dll" alias "PathRemoveFileSpecW";
-	static stdcall int DeleteFile(string lpFileName) native from "kernel32.dll" alias "DeleteFileW";	
+	static stdcall int GetModuleFileName(int hModule ,xstring lpFileName ,int nSize ) native from "kernel32.dll" alias "GetModuleFileNameW";
+	static stdcall int PathRemoveFileSpec(xstring lpFileName ) native from "shlwapi.dll" alias "PathRemoveFileSpecW";
+	static stdcall int DeleteFile(xstring lpFileName) native from "kernel32.dll" alias "DeleteFileW";	
 	static stdcall bool GetSaveFileName(ref MYOPENFILENAMEW)native from "comdlg32.dll" alias "GetSaveFileNameW"; 
 
-	string GetModulePath()
+public:
+	TemplatePrintViewEx(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {}
+public:
+	static TemplatePrintViewEx* CreateInstance(void* implPtr, void* hWnd)
 	{
-		string str =L"";
+		TemplatePrintViewEx* pWin = new TemplatePrintViewEx(implPtr, (HWND)hWnd);
+		return pWin;
+	}
+	xstring GetModulePath()
+	{
+		xstring str =L"";
 		str = str.space(255);
 		GetModuleFileName(0,str,250);
 		PathRemoveFileSpec(str);
 		return str;
 	}
-	string GetModuleTmpPath()
+	xstring GetModuleTmpPath()
 	{
-		string str =L"";
+		xstring str =L"";
 		str = str.space(255);
 		GetModuleFileName(0,str,250);
 		PathRemoveFileSpec(str);
-		string tmp = str + L"\\Temp";
+		xstring tmp = str + L"\\Temp";
 		xaserver::CreateDirectory(tmp);
 		return tmp;
 	}
 	
-	string GetSaveFileName(string initFileName, string filter, string ext)
+	xstring GetSaveFileName(xstring initFileName, xstring filter, xstring ext)
 	{
 		char[]  szFileName = new char[255] ;
 		char[]  szPath =  new char[255];
@@ -151,14 +170,14 @@
 			
 	int OnExport()
 	{
-		string pre = billPre;
+		xstring pre = billPre;
 		if(pre==L"")
 		{
 			pre = m_EntityName;
 			if(m_EntityName==L"SaleOrder") pre=L"PI";
 			if(m_EntityName==L"GDN3")pre=L"INV";
 		}
-		string file1 =  GetSaveFileName(pre+m_EntityNo+L".xlsx",
+		xstring file1 =  GetSaveFileName(pre+m_EntityNo+L".xlsx",
 			"Excel1文件(*.xlsx)\0*.xlsx;*.xls\0Excel97文件(*.xls)\0*.xls\0PDF文件(*.pdf)\0*.pdf\0",
 			"xlsx");
 		if(file1 ==L"") return 1;
@@ -179,8 +198,8 @@
 			return 1;
 		}
 
-		string gid =  publiccode::GetGuid();
-		string filename= pre+m_EntityNo+L"_.htm";
+		xstring gid =  publiccode::GetGuid();
+		xstring filename= pre+m_EntityNo+L"_.htm";
 		xutil::SaveToFile(GetModuleTmpPath() + L"\\"+ filename, htmlStr,L"",L"",L"");
 		trace(L"\r\n excel to open");
 		excel .OpenDocument(GetModuleTmpPath() + L"\\"+ filename);
@@ -217,12 +236,12 @@
 		excel = new cexcel;
 		excel.setNativePointer(cexcel::CreateInstance());
 		
-		string gid =  publiccode::GetGuid();
-		string pre = m_EntityName;
+		xstring gid =  publiccode::GetGuid();
+		xstring pre = m_EntityName;
 		if(m_EntityName==L"SaleOrder") pre=L"PI";
 		if(m_EntityName==L"GDN3")pre=L"INV";
-		string filename= pre+m_EntityNo+L".htm";
-		string filenameex= pre+m_EntityNo+L".xlsx";
+		xstring filename= pre+m_EntityNo+L".htm";
+		xstring filenameex= pre+m_EntityNo+L".xlsx";
 		xutil::SaveToFile(GetModuleTmpPath() + L"\\"+ filename, htmlStr,L"",L"",L"");
 		excel .OpenDocument(GetModuleTmpPath() + L"\\"+ filename);
 		//excel.put_Visible(true);
@@ -236,10 +255,10 @@
 		return 1;
 	}
 
-	string getfilePath()
+	xstring getfilePath()
 	{
-		string path=GetModulePath()+L"\\resource\\image";		
-		string filename=L"contract.jpg";
+		xstring path=GetModulePath()+L"\\resource\\image";		
+		xstring filename=L"contract.jpg";
 		filename=L"sign.png";
 		filename=L"jrj_maersk.png";
 		filename=L"HomeDecorSign.png";
@@ -249,18 +268,18 @@
 		return path;
 	}
 	
-	string replaceInnerElement(string html)
+	xstring replaceInnerElement(xstring html)
 	{
-		string str = html;
+		xstring str = html;
 		if(str.find(L"[$element:")<0) return str;
 		
 		int len = 0;
 		int pos = 0;
 		int pos1 = 0;
-		string pre=L"";
-		string left=L"";
-		string right=L"";
-		string tag=L"";
+		xstring pre=L"";
+		xstring left=L"";
+		xstring right=L"";
+		xstring tag=L"";
 		
 		len = L"[$element:".length();
 		while(true)
@@ -310,7 +329,7 @@
 		return str;
 	}
 
-	string adjustXsl(string str,string localPath)
+	xstring adjustXsl(xstring str,xstring localPath)
 	{
 		//if(str.find(L"%")>=0)  str = str.replace(L"%",L"");
 		if(str.find(L"[$path]/rpttemplate")>=0) str = str.replace(L"[$path]/rpttemplate",localPath);
@@ -318,7 +337,7 @@
 		return str;
 	}
 	
-	string DownLoadSKUNoPic(string SKUNo,string CustomerID=L"",string CustomerItemNo=L"")
+	xstring DownLoadSKUNoPic(xstring SKUNo,xstring CustomerID=L"",xstring CustomerItemNo=L"")
 	{
 		
 		if(SKUNo.length()>20) return DownLoadPaperPic(SKUNo);
@@ -329,7 +348,7 @@
 		arg.setNativePointer(arg.CreateInstance());
 		arg.AddArg(L"SKUNo",SKUNo);
 		
-		string src =L"/sale/data/ProductLibrary3/pref/picture/imagelistSKUNo";
+		xstring src =L"/sale/data/ProductLibrary3/pref/picture/imagelistSKUNo";
 		if(CustomerID !=L"")
 		{
 			arg.AddArg(L"CustomerID",CustomerID);
@@ -343,9 +362,9 @@
 			return "";
 		}
 		
-		string spath = L"";
-		string path =GetModuleTmpPath();
-		string ext = L"jpg";
+		xstring spath = L"";
+		xstring path =GetModuleTmpPath();
+		xstring ext = L"jpg";
 		if(x.GetXmlDoc().selectSingleNode(L"//FileExt[1]"))
 		{
 			ext = x.GetXmlDoc().selectSingleNode(L"//FileExt[1]").text;
@@ -361,7 +380,7 @@
 				ext = x.GetXmlDoc().selectSingleNode(L"//FileExt[1]").text;
 		}
 			
-		string filename = SKUNo + L"." + ext;
+		xstring filename = SKUNo + L"." + ext;
 		if(x.GetXmlDoc().selectSingleNode(L"//PicPath[1]"))
 			spath = x.GetXmlDoc().selectSingleNode(L"//PicPath[1]").text;
 		if(spath != L"")
@@ -371,7 +390,7 @@
 		return "file://"+ path+L"/"+filename;
 	}
 		
-	string DownLoadSKUNoPic(string SKUNo,string CustomerID=L"",string CustomerItemNo=L"")
+	xstring DownLoadSKUNoPic(xstring SKUNo,xstring CustomerID=L"",xstring CustomerItemNo=L"")
 	{
 		
 		if(SKUNo.length()>20) return DownLoadPaperPic(SKUNo);
@@ -382,7 +401,7 @@
 		arg.setNativePointer(arg.CreateInstance());
 		arg.AddArg(L"SKUNo",SKUNo);
 		
-		string src =L"/sale/data/ProductLibrary3/pref/picture/imagelistSKUNo";
+		xstring src =L"/sale/data/ProductLibrary3/pref/picture/imagelistSKUNo";
 		if(CustomerID !=L"")
 		{
 			arg.AddArg(L"CustomerID",CustomerID);
@@ -396,9 +415,9 @@
 			return "";
 		}
 		
-		string spath = L"";
-		string path =GetModuleTmpPath();
-		string ext = L"jpg";
+		xstring spath = L"";
+		xstring path =GetModuleTmpPath();
+		xstring ext = L"jpg";
 		if(x.GetXmlDoc().selectSingleNode(L"//FileExt[1]"))
 		{
 			ext = x.GetXmlDoc().selectSingleNode(L"//FileExt[1]").text;
@@ -414,7 +433,7 @@
 				ext = x.GetXmlDoc().selectSingleNode(L"//FileExt[1]").text;
 		}
 			
-		string filename = SKUNo + L"." + ext;
+		xstring filename = SKUNo + L"." + ext;
 		if(x.GetXmlDoc().selectSingleNode(L"//PicPath[1]"))
 			spath = x.GetXmlDoc().selectSingleNode(L"//PicPath[1]").text;
 		if(spath != L"")
@@ -424,7 +443,7 @@
 		return "file://"+ path+L"/"+filename;
 	}
 		
-	string GetImageUrl(string id)
+	xstring GetImageUrl(xstring id)
 	{
 		xml xp=new xml;
 		xp.setNativePointer(xml::CreateInstance());
@@ -432,50 +451,50 @@
 		arg_pic.setNativePointer(arg_pic.CreateInstance());	
 		arg_pic.AddArg(L"id",id);
 		
-		string res = L"/sale/data/productlibrary3/image/url";
+		xstring res = L"/sale/data/productlibrary3/image/url";
 		if(url::get(res,arg_pic.GetString(),xp)!=1)
 		{
 			xp.GetXml();
 			return 1;
 		}else
 		{
-			string path = xp.GetXmlDoc().text;
+			xstring path = xp.GetXmlDoc().text;
 			if(path !=L"") return path;
 		}
 		
 		return "/business/products/chanpin/"+id.left(2)+L"/"+ id+L".jpg";
 	}
 	
-	string DownLoadPaperPic(string guid)
+	xstring DownLoadPaperPic(xstring guid)
 	{
 		
-		string path =GetModuleTmpPath();
-		string ext = L"jpg";
-		string filename = guid + L"." + ext;
-		string spath = GetImageUrl(guid);
+		xstring path =GetModuleTmpPath();
+		xstring ext = L"jpg";
+		xstring filename = guid + L"." + ext;
+		xstring spath = GetImageUrl(guid);
 		//alert(spath);
 		xaserver::DownLoadFile(GetServerUrl(),spath,L"",path+L"/"+filename);
 		return "file://"+ path+L"/"+filename;
 	}
 			
-	string DownLoadPaperPic1(string guid)
+	xstring DownLoadPaperPic1(xstring guid)
 	{
-		string path =GetModuleTmpPath();
-		string ext = L"jpg";
-		string filename = guid + L"." + ext;
-		string str = guid.mid(0,2);
-		string spath = L"/business/products/chanpin/"+str+L"/"+guid+L".jpg";
+		xstring path =GetModuleTmpPath();
+		xstring ext = L"jpg";
+		xstring filename = guid + L"." + ext;
+		xstring str = guid.mid(0,2);
+		xstring spath = L"/business/products/chanpin/"+str+L"/"+guid+L".jpg";
 		xaserver::DownLoadFile(GetServerUrl(),spath,L"",path+L"/"+filename);
 		return "file://"+ path+L"/"+filename;
 	}
 	
-	string DownLoadUrlPic(string src)
+	xstring DownLoadUrlPic(xstring src)
 	{
-		string guid =  publiccode::GetGuid();
-		string path =GetModuleTmpPath();
-		string ext = L"jpg";
-		string filename = guid + L"." + ext;
-		string spath = src;
+		xstring guid =  publiccode::GetGuid();
+		xstring path =GetModuleTmpPath();
+		xstring ext = L"jpg";
+		xstring filename = guid + L"." + ext;
+		xstring spath = src;
 		xaserver::DownLoadFile(GetServerUrl(),spath,L"",path+L"/"+filename);
 		return "file://"+ path+L"/"+filename;
 	}
@@ -484,9 +503,9 @@
 	{
 		int hCursor = xutil::SetCursorWait();
 
-		string sEntityName = arg.GetArgString(L"EntityName");
-		string sEntityID = arg.GetArgString(L"EntityID");
-		string dataUrl = arg.GetArgString(L"DataUrl");
+		xstring sEntityName = arg.GetArgString(L"EntityName");
+		xstring sEntityID = arg.GetArgString(L"EntityID");
+		xstring dataUrl = arg.GetArgString(L"DataUrl");
 		if(dataUrl==L"") 
 			dataUrl = L"/sale/data/"+sEntityName+L"/print/dataset";
 		else if(dataUrl.left(1)!=L"/") 
@@ -504,7 +523,7 @@
 			m_dataset = x0;
 		}
 			
-		string sPath;
+		xstring sPath;
 		sPath = getfilePath();
 		arg.AddArg(L"sPath",sPath);
 		m_spath = sPath;
@@ -517,7 +536,7 @@
 			return 0;
 		}
 		
-		string xslStr = xsl.GetXml();
+		xstring xslStr = xsl.GetXml();
 		
 		xslStr = adjustXsl(xslStr,sPath);
 		xsl.LoadXml(xslStr);
@@ -526,21 +545,21 @@
 		trace(L"\r\n--------\r\n"+xslStr);
 		
 		m_strHtml = m_dataset.GetXmlDoc().transformNode(xsl.GetXmlDoc());
-		string aspace = m_strHtml.replace(L"[空]",L"&nbsp;",0);
+		xstring aspace = m_strHtml.replace(L"[空]",L"&nbsp;",0);
 		aspace = aspace.replace(L"[line]",L"<br/>",0);
-		string scontent = aspace.replace(L"<?xml version=\"1.0\"?>",L"",0);
+		xstring scontent = aspace.replace(L"<?xml version=\"1.0\"?>",L"",0);
 		
-		string head =L"";
-		string tail = scontent;
+		xstring head =L"";
+		xstring tail = scontent;
 
 		int pos = tail.find(L"src=\"item-picture:");
 		while(pos > 0)
 		{
 			int spos = pos+L"src=\"item-picture:".length();
 			int pos1 = tail.find(L"\"",spos+1);
-			string skuno = tail.mid(spos,pos1 - spos ).trim();
-			string CustomerID=L"";
-			string CustomerItemNo=L"";
+			xstring skuno = tail.mid(spos,pos1 - spos ).trim();
+			xstring CustomerID=L"";
+			xstring CustomerItemNo=L"";
 			if(skuno.find(L",L")>0)
 			{
 				CustomerID = skuno.left(skuno.find(L",L")).trim();
@@ -551,7 +570,7 @@
 				CustomerItemNo = skuno.left(skuno.find(L",L")).trim();
 				skuno = skuno.mid(skuno.find(L",L")+1,256).trim();
 			}
-			string src =  DownLoadSKUNoPic(skuno,CustomerID,CustomerItemNo);
+			xstring src =  DownLoadSKUNoPic(skuno,CustomerID,CustomerItemNo);
 			head += tail.left(pos) + L"src=\"" + src;
 			tail = tail.mid(pos1,999999999);
 			pos = tail.find(L"src=\"item-picture:");
@@ -565,8 +584,8 @@
 		{
 			int sposition = position+L"src=\"paper-picture:".length();
 			int position1 = tail.find(L"\"",sposition+1);
-			string guid = tail.mid(sposition,position1 - sposition ).trim();
-			string src2 =  DownLoadPaperPic(guid);
+			xstring guid = tail.mid(sposition,position1 - sposition ).trim();
+			xstring src2 =  DownLoadPaperPic(guid);
 			head += tail.left(position) + L"src=\"" + src2;
 			tail = tail.mid(position1,999999999);
 			position = tail.find(L"src=\"paper-picture:");
@@ -594,13 +613,13 @@
 		
 		xml x1 = new xml;
 		x1.setNativePointer(xml ::CreateInstance());
-		//string xcontent = m_strHtml.replace(L"&nbsp;",L"[空]",0);
-		string xcontent = m_strHtml.replace(L"[空]",L" ",0);
+		//xstring xcontent = m_strHtml.replace(L"&nbsp;",L"[空]",0);
+		xstring xcontent = m_strHtml.replace(L"[空]",L" ",0);
 		int pos0 = xcontent.find(L"<xml");
 		int pos2 = xcontent.find(L"</xml>");
 		if(pos0>=0)
 		{
-			string str = xcontent.left(pos0)+ xcontent.mid(pos2+6,9999999);
+			xstring str = xcontent.left(pos0)+ xcontent.mid(pos2+6,9999999);
 			xcontent = str;
 		}
 		x1.LoadXml(xcontent);
@@ -656,8 +675,8 @@
 			arg.AddArg(L"DocumentID",L"");
 			arg.AddArg(L"ok",L"");
 			openUrl(L"/sale/view/view.dlg/xpage/Template/PrintDialog", p);
-			string ret = arg.GetArgString(L"return");
-			string action = arg.GetArgString(L"action");
+			xstring ret = arg.GetArgString(L"return");
+			xstring action = arg.GetArgString(L"action");
 			if (ret ==L"ok") 
 			{
 				if(action ==L"open")
@@ -665,7 +684,7 @@
 					m_DocumentID = arg.GetArgString(L"DocumentID");
 					xml x = new xml;
 					x.setNativePointer(xml::CreateInstance());	
-					string prestr = m_DocumentID.mid(0,2);
+					xstring prestr = m_DocumentID.mid(0,2);
 					prestr = prestr.upper();
 					xaserver::LoadUrl(GetServerUrl(),L"/business/data/bill/"+prestr+L"/"+ m_DocumentID+L".jpg",L"",x);
 					if(x.GetXml()!=L"")
@@ -689,7 +708,7 @@
 				}
 				else
 				{
-					string templateName = arg.GetArgString(L"template-name");
+					xstring templateName = arg.GetArgString(L"template-name");
 					win32::SetWindowText(GetHWND(),templateName);
 					billName = templateName;
 					billPre = arg.GetArgString(L"template-pre");
@@ -716,8 +735,8 @@
 			int p = arg.ptr_native_;
 			arg.AddArg(L"ok",L"");
 			openUrl(L"/sale/view/view.dlg/xpage/Template/PrintDialog", p);
-			string ret = arg.GetArgString(L"return");
-			string action = arg.GetArgString(L"action");
+			xstring ret = arg.GetArgString(L"return");
+			xstring action = arg.GetArgString(L"action");
 			if (ret ==L"ok") 
 			{
 				updated = false;
@@ -726,13 +745,13 @@
 					m_DocumentID = arg.GetArgString(L"DocumentID");
 					xml x = new xml;
 					x.setNativePointer(xml::CreateInstance());	
-					string prestr = m_DocumentID.mid(0,2);
+					xstring prestr = m_DocumentID.mid(0,2);
 					prestr = prestr.upper();
 					xaserver::LoadUrl(GetServerUrl(),L"/business/data/bill/"+prestr+L"/"+ m_DocumentID+L".jpg",L"",x);
 					if(x.GetXml()!=L"")
 					{
 						
-						string content = L"";
+						xstring content = L"";
 						if(x.GetXmlDoc().documentElement.tagName==L"Bill")
 						{
 							content = x.GetXmlDoc().documentElement.text;
@@ -749,7 +768,7 @@
 								}*/
 								xml x1 = new xml;
 								x1.setNativePointer(xml::CreateInstance());	
-								string content1 = x.GetXml();
+								xstring content1 = x.GetXml();
 								content1 = content1.replace(L"[空]",L" ",0);
 								//trace(content1);
 								x1.LoadXml(content1);
@@ -768,7 +787,7 @@
 				}
 				else
 				{
-					string templateName = arg.GetArgString(L"template-name");
+					xstring templateName = arg.GetArgString(L"template-name");
 					win32::SetWindowText(GetHWND(),templateName);
 					billName = templateName;
 					billPre = arg.GetArgString(L"template-pre");
@@ -786,16 +805,16 @@
 			
 	int SetAgent()
 	{	
-		string xfNodeAgentArea  = L"agentarea";
+		xstring xfNodeAgentArea  = L"agentarea";
 		xnode anode = GetAgentNode(xfNodeAgentArea);
-		msxml::IXMLDOMElement xframeElement =  GetElement();
-		msxml::IXMLDOMNode agent = xframeElement.selectSingleNode(L"agent/"+xfNodeAgentArea+L"[1]/*");
+		KXMLDOMElement xframeElement =  GetElement();
+		KXMLDOMNode agent = xframeElement.selectSingleNode(L"agent/"+xfNodeAgentArea+L"[1]/*");
 
-		msxml::IXMLDOMNodeList nlist;
+		KXMLDOMNodeList nlist;
 		int  index;
 		int  nlen;
-		msxml::IXMLDOMElement ele;
-		string tools=L"<hbox class=''>";
+		KXMLDOMElement ele;
+		xstring tools=L"<hbox class=''>";
 		if(agent)
 		{
 			nlist = agent.SelectNodes(L".//xtoolbutton");
@@ -803,10 +822,10 @@
 			for(index=0;index<nlen;index++)
 			{
 				ele  =  nlist.item(index);
-				string name = ele.selectSingleNode(L"@name").text;
-				string label  =  ele.selectSingleNode(L"@caption").text;
-				string image;
-				string src = L"";
+				xstring name = ele.selectSingleNode(L"@name").text;
+				xstring label  =  ele.selectSingleNode(L"@caption").text;
+				xstring image;
+				xstring src = L"";
 				if(ele.selectSingleNode(L"@image"))
 					image = ele.selectSingleNode(L"@image").text;
 				else
@@ -817,7 +836,7 @@
 				
 				int strLen = label.length();
 				int width = 60 + (strLen - 2) * 10;
-				string tool;
+				xstring tool;
 				if (src != L"")
 					tool = L"<xtoolbutton src='"+src+L"'  caption='"+label+L"' name='"+name+L"' height='28'  class1='action'/>";
 				else
@@ -826,7 +845,7 @@
 			}
 		}
 		tools +=L"</hbox>";
-		SetAgentNodeContent(anode, tools);
+		SetAgentNode(anode, tools);
 		return 1;
 	}
 
@@ -847,7 +866,7 @@
 		}else
 		{
 			htmlStr = cell.GetHtml();
-			//string content = htmlStr;
+			//xstring content = htmlStr;
 			htmlStr = htmlStr.replace(L"[空]",L"&nbsp;",0);
 			htmlStr = htmlStr.replace(L"[line]",L"<br/>",0);
 			ole_print.LoadHtml(htmlStr);	
@@ -931,11 +950,11 @@
 	
 	int OnAddToDocument()
 	{
-		string content = htmlStr;
+		xstring content = htmlStr;
 		if(editing)content = cell.GetHtml();
-		string guid = publiccode::GetGuid();
+		xstring guid = publiccode::GetGuid();
 		
-		string prestr = guid.mid(0,2);
+		xstring prestr = guid.mid(0,2);
 		prestr = prestr.upper();
 		
 		
@@ -952,7 +971,7 @@
 		int ret= xaserver::UploadData(L"bill"+prestr, guid+L".jpg", content);
 		if(ret < 0) trace(L"error upload");
 		
-		string ls_xml =L"<DocumentList guid='"+guid+L"' update.modify='1' update.new='1'>";
+		xstring ls_xml =L"<DocumentList guid='"+guid+L"' update.modify='1' update.new='1'>";
 		ls_xml += L"<EntityName>"+ m_EntityName + L"</EntityName>";
 		ls_xml += L"<EntityID>"+ m_EntityID + L"</EntityID>";
 		ls_xml += L"<EntityNo>"+ m_EntityNo + L"</EntityNo>";
@@ -969,11 +988,11 @@
 		
 		if(url::get(L"/sale/data/DocumentList3/bill/update", arg.GetString(),x)!=1)
 		{
-			string error = x.GetXmlDoc().text;
+			xstring error = x.GetXmlDoc().text;
 			alert(L"err:"+error);
 			return 1;
 		}
-		string str = x.GetXmlDoc().documentElement.getAttribute(L"text");
+		xstring str = x.GetXmlDoc().documentElement.getAttribute(L"text");
 		if(str == L"true")
 		{
 			alert(L"保存成功!"); 
@@ -986,7 +1005,7 @@
 		return 1;
 	}
 	
-	int SendCtrlCmd(xcontrol xc, string cmd)
+	int SendCtrlCmd(xcontrol xc, xstring cmd)
 	{
 		win32::SendMessage(xc.GetId(),0x401,cmd,0);
 		return 1;
@@ -996,7 +1015,7 @@
 	{
 		xaserverarg arg = new xaserverarg;
 		arg.setNativePointer(GetParam());
-		string templateName = arg.GetArgString(L"template-name");
+		xstring templateName = arg.GetArgString(L"template-name");
 		win32::SetWindowText(GetHWND(),templateName);
 		OnHtml(arg);
 		billName = templateName;
@@ -1009,7 +1028,7 @@
 		return 1;
 	}
 		
-	int OnCmdDispatch(string comdid)
+	int OnCmdDispatch(xstring comdid)
 	{
 		if(comdid==L"xmSort")
 		{
@@ -1082,13 +1101,13 @@
 		
 		if(comdid.left(3) == L"xmSort")
 		{
-			//string str = 
+			//xstring str = 
 			return 1;
 		}
 		
 		if(comdid.left(3) == L"IK_")
 		{
-			string cmd = comdid.mid(3, comdid.length());
+			xstring cmd = comdid.mid(3, comdid.length());
 			SendCtrlCmd(cell,cmd);
 			return 1;
 		}
@@ -1123,7 +1142,7 @@
 				alert(L"数据集出错了!");
 				return 0;
 			}
-			string strHtml = x.GetXml();
+			xstring strHtml = x.GetXml();
 			ole_print.LoadHtml(strHtml);		
 		}
 		return 0;
@@ -1191,7 +1210,7 @@
 		{
 			xaserverarg arg = new xaserverarg;
 			arg.setNativePointer(GetParam());
-			string templateName = arg.GetArgString(L"template-name");
+			xstring templateName = arg.GetArgString(L"template-name");
 			if(templateName ==L"")
 			{
 				OnPrintDialog();

--
Gitblit v1.9.3