- visualframework_src.zip
- sample
- CNN
- cls.cls
- MSSCCPRJ.SCC
- PrjCnn.dll
- PrjCnn.exp
- PrjCnn.lib
- PrjCnn.vbp
- PrjCnn.vbw
- DemoDoc
- MfcViewLib
- ObjManager
- VbComLib
- VBDoc
- MSSCCPRJ.SCC
- prjVBDoc.vbp
- prjVBDoc.vbw
- UD.dob
- VCSharpComLib
- VisualFrameWork
|
//*******************************************************************************
// COPYRIGHT NOTES
// ---------------
// This source code is a part of Tangram library.
// You may use, compile or redistribute it as part of your application
// for free. You cannot redistribute it as a part of a software development
// library without the agreement of the author. If the sources are
// distributed along with the application, you should leave the original
// copyright notes in the source code without any changes.
// This code can be used WITHOUT ANY WARRANTIES on your own risk.
//
// For the latest updates to this library, check site:
// http://www.tangramdev.com
//
// sunhui
//*******************************************************************************
// TangramDocCntrItem.cpp : implementation file
//
#include "stdafx.h"
#include "tangramDoc.h"
#include "TangramDocCntrItem.h"
#include "TangramServerObj.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CTangramDocCntrItem
IMPLEMENT_SERIAL(CTangramDocCntrItem, CTangramCntrItem, 0)
BEGIN_INTERFACE_MAP(CTangramDocCntrItem, CTangramCntrItem)
INTERFACE_PART(CTangramDocCntrItem, IID_IOleDocumentSite, DocumentSite)
END_INTERFACE_MAP()
CTangramDocCntrItem::CTangramDocCntrItem(COleDocument* pServerDoc)
: CTangramCntrItem(pServerDoc)
{
CString str = "";
str.Format("%x",this);
g_pTangramServer->m_AxDocDictionary[LPCTSTR(str)] = (CObject*)this;
m_pIOleDocView = NULL;
}
CTangramDocCntrItem::~CTangramDocCntrItem()
{
m_pView = NULL;
CString str = "";
str.Format("%x",this);
if(g_pTangramServer)
g_pTangramServer->m_AxDocDictionary.RemoveKey(LPCTSTR(str));
}
BOOL CTangramDocCntrItem::OnDraw(CDC* pDC, CSize& rSize)
{
// Called by the framework to render the OLE item into a metafile.
// The metafile representation of the OLE item is used to display the
// item in the container application. If the container application was
// written with the Microsoft Foundation Class Library, the metafile is
// used by the Draw member function of the corresponding COleClientItem object.
// There is no default implementation. You must override this function to draw
// the item into the device context specified.
ASSERT(FALSE); // remove this after completing the TODO
return TRUE;
}
BEGIN_MESSAGE_MAP(CTangramDocCntrItem, CTangramCntrItem)
//{{AFX_MSG_MAP(CTangramDocCntrItem)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTangramDocCntrItem diagnostics
#ifdef _DEBUG
void CTangramDocCntrItem::AssertValid() const
{
CTangramCntrItem::AssertValid();
}
void CTangramDocCntrItem::Dump(CDumpContext& dc) const
{
CTangramCntrItem::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CTangramDocCntrItem serialization
void CTangramDocCntrItem::Serialize(CArchive& ar)
{
CTangramCntrItem::Serialize(ar);
if (ar.IsStoring())
{
// TODO: add storing code here
}
else
{
// TODO: add loading code here
}
}
void CTangramDocCntrItem::OnDeactivate()
{
if(IsInPlaceActive())
CTangramCntrItem::OnDeactivate();
}
void CTangramDocCntrItem::OnDeactivateUI(BOOL bUndoable)
{
if(m_pIOleDocView)
m_pIOleDocView->Release();
CTangramCntrItem::OnDeactivateUI(bUndoable);
}
/////////////////////////////////////////////////////////////////////////////
STDMETHODIMP_(ULONG) CTangramDocCntrItem::XDocumentSite::AddRef()
{
METHOD_PROLOGUE(CTangramDocCntrItem, DocumentSite)
ULONG nResult = (ULONG)pThis->ExternalAddRef();
return nResult;
}
STDMETHODIMP_(ULONG) CTangramDocCntrItem::XDocumentSite::Release()
{
METHOD_PROLOGUE(CTangramDocCntrItem, DocumentSite)
ULONG nResult = (ULONG)pThis->ExternalRelease();
return nResult;
}
STDMETHODIMP CTangramDocCntrItem::XDocumentSite::QueryInterface(
REFIID iid, LPVOID* ppvObj)
{
METHOD_PROLOGUE(CTangramDocCntrItem, DocumentSite)
HRESULT hr = (HRESULT)pThis->ExternalQueryInterface(&iid, ppvObj);
return hr;
}
STDMETHODIMP CTangramDocCntrItem::XDocumentSite::ActivateMe(IOleDocumentView *pView)
{
METHOD_PROLOGUE(CTangramDocCntrItem, DocumentSite)
CRect rc;
IOleDocument* pDoc;
/*
* If we're passed a NULL view pointer, then try to get one from
* the document object (the object within us).
*/
if (NULL==pView)
{
if (FAILED(pThis->m_lpObject->QueryInterface(IID_IOleDocument, (void **)&pDoc)))
return E_FAIL;
if (FAILED(pDoc->CreateView(&pThis->m_xOleIPSite, 0, 0, &pView)))
return E_OUTOFMEMORY;
// Release doc pointer since CreateView is a good com method that addrefs
pDoc->Release();
}
else
{
//Make sure that the view has our client site
pView->SetInPlaceSite(&pThis->m_xOleIPSiteEx);
//We're holding onto the pointer, so AddRef it.
pView->AddRef();
}
pThis->m_pIOleDocView=pView;
//This sets up toolbars and menus first
pView->UIActivate(TRUE);
//Set the window size sensitive to new toolbars
pThis->GetActiveView()->GetClientRect(rc);
pView->SetRect(&rc);
//Makes it all active
pView->Show(TRUE);
return NOERROR;
}
/////////////////////////////////////////////////////////////////////////////
// CTangramDocCntrItem commands
|
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
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.