|
#pragma once
#include "DocTemplate3.h"
#include "DocTemplate3Doc.h"
#include "DocTemplate3View.h"
#include "ChildFrm.h"
#include "WinFormsView.h"
#include "resource.h"
using namespace System;
namespace DocTemplate3
{
/// <summary>
/// Summary for Document
/// </summary>
__gc public class DocTemplate : public Object
{
public:
DocTemplate(void)
{
}
~DocTemplate(void)
{
TerminateExtLib();
}
/*******************************************************************************
��TangramLittle������Ҫ�������ĵ����һ���Ѵ��ڵ��ĵ�ʱ��ϵͳ��õ�һ����ģ��
������ص��ַ�����ϵͳ������ַ��������ĵ�ģ���ֵ䣬�����ѯʧ�ܣ�TangramLittle
��������ActiveDocTemplate����һ���ĵ�ģ�壬���ǿ������ĵ�ģ���������Ҫ��ʱ��
�Ų���Ӧ�ó�����ĵ�ģ����У��������ĵ�ʱ����ͨ�����������ĵ�ģ���xml�ļ��õ�
����ַ����ģ����ĵ�ʱ�����Dz��ýṹ���洢�����õ�����ַ����������ϸ����ο�
��̬���MfcDotNetExtLib��
*******************************************************************************/
void ActiveDocTemplate(String* strExtImpl)
{
if(!g_pDotNetExtImpl)
{
CString str = strExtImpl;
g_pDotNetExtImpl = (DotNetExtImpl*)_atoi64(str);
InitialExtLib();
CWinApp* pApp = AfxGetApp();
ASSERT(pApp!=NULL);
AfxSetResourceHandle(theApp.m_hInstance);
Object* pObj = NULL;
//�õ�Ӧ�ó������
pObj = reinterpret_cast<Object*>(System::Runtime::InteropServices::Marshal::GetObjectForIUnknown(g_pDotNetExtImpl->m_pAppDisp.p));
theApp.m_pAppObj = pObj;
if(theApp.m_pAppObj)
{
Type* t = theApp.m_pAppObj->GetType();
PropertyInfo* m_pPropertyInfo = t->GetProperty(S"PrjItem");
String* p[] = new String*[1];
String* strIndex = g_pDotNetExtImpl->m_strCurDocTemplateID;
p[0] = strIndex;
m_pPropertyInfo->SetValue(theApp.m_pAppObj,this,p);
}
//�õ���չӦ�ó������
if(g_pDotNetExtImpl->m_pExtAppDisp)
{
pObj = reinterpret_cast<Object*>(System::Runtime::InteropServices::Marshal::GetObjectForIUnknown(g_pDotNetExtImpl->m_pExtAppDisp.p));
theApp.m_pExternalAppObj = pObj;
}
CMultiDocTemplate* pDocTemplate;
pDocTemplate = new CMultiDocTemplate(IDR_DocTemplate3TYPE,
RUNTIME_CLASS(CDocTemplate3Doc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CDocTemplate3View));
if (!pDocTemplate)
return ;
CString strFileInfo,strFileExt;
pDocTemplate->GetDocString(strFileInfo,CDocTemplate::filterName);
pDocTemplate->GetDocString(strFileExt,CDocTemplate::filterExt);
g_pDotNetExtImpl->m_DocInfoDictionary[strFileInfo] = strFileExt;
g_pDotNetExtImpl->m_DocTemplateCnnDictionary[g_pDotNetExtImpl->m_strCurDocTemplateID] = pDocTemplate;
g_pDotNetExtImpl->m_WinAppCnnDictionary[g_pDotNetExtImpl->m_strCurDocTemplateID] = &theApp;
g_pDotNetExtImpl->m_pCurDocTemplate = pDocTemplate;
pApp->AddDocTemplate(pDocTemplate);
}
}
};
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here