本文整理汇总了C++中CDocument类的典型用法代码示例。如果您正苦于以下问题:C++ CDocument类的具体用法?C++ CDocument怎么用?C++ CDocument使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CDocument类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FindSkinFile
BOOL CFileView::CloseSkinFile(CString& strPath)
{
CDocument* pDoc = FindSkinFile(strPath);
if(pDoc == NULL)
return FALSE;
pDoc->OnCloseDocument();
return TRUE;
}
示例2: GetDocument
void SECEditView::UpdateViews(CWnd* pSender, LPARAM lHint, CObject* pHint)
{
// This is declared in SECEditCore.h because many OE functions
// Update the view. The default implementation does nothing
// and is called for SECEditCtrl derivatives. This is called
// for SECEditView derivatives
CDocument* pDoc = GetDocument();
if (pDoc)
pDoc->UpdateAllViews((CView*)pSender, lHint, pHint);
}
示例3: InstrumentChanged
void CInstrument::InstrumentChanged() const
{
// Set modified flag
CFrameWnd *pFrameWnd = dynamic_cast<CFrameWnd*>(AfxGetMainWnd());
if (pFrameWnd != NULL) {
CDocument *pDoc = pFrameWnd->GetActiveDocument();
if (pDoc != NULL)
pDoc->SetModifiedFlag();
}
}
示例4: Open
LPDISPATCH CMUSHclientDoc::Open(LPCTSTR FileName)
{
//CDocument * pDoc = App.m_pWorldDocTemplate->OpenDocumentFile (FileName);
CDocument * pDoc = App.OpenDocumentFile (FileName);
if (pDoc)
return pDoc->GetIDispatch (TRUE);
return NULL;
} // end of CMUSHclientDoc::Open
示例5: ui_doc_is_modified
// @pymethod int|PyCDocument|IsModified|Return a flag indicating if the document has been modified.
PyObject *
ui_doc_is_modified(PyObject *self, PyObject *args)
{
CDocument *pDoc;
if (!(pDoc=PyCDocument::GetDoc(self)))
return NULL;
CHECK_NO_ARGS2(args,IsModified);
GUI_BGN_SAVE;
int rc = pDoc->IsModified();
GUI_END_SAVE;
return Py_BuildValue("i", rc); // @pyseemfc CDocument|IsModified
}
示例6: ui_doc_get_title
// @pymethod string|PyCDocument|GetTitle|Returns the title of the current document.
// This will often be the file name portion of the path name.
PyObject *
ui_doc_get_title(PyObject *self, PyObject *args)
{
CDocument *pDoc;
if (!(pDoc=PyCDocument::GetDoc(self)))
return NULL;
CHECK_NO_ARGS2(args,GetTitle);
GUI_BGN_SAVE;
CString path = pDoc->GetTitle(); // @pyseemfc CDocument|GetTitle
GUI_END_SAVE;
return PyWinObject_FromTCHAR(path);
}
示例7: GetFirstDocPosition
void CDocTemplate::OnIdle()
{
POSITION pos = GetFirstDocPosition();
while (pos != NULL)
{
CDocument* pDoc = GetNextDoc(pos);
ASSERT_VALID(pDoc);
ASSERT_KINDOF(CDocument, pDoc);
pDoc->OnIdle();
}
}
示例8: GetDoubleClickedItem
void CXTPShellListView::OnDblclk(NMHDR* /*pNMHDR*/, LRESULT* pResult)
{
int iIndex = GetDoubleClickedItem();
if (iIndex >= 0)
{
CDocument* pDoc = GetDocument();
pDoc->UpdateAllViews(this, SHN_XTP_SELECTCHILD,
(CObject*)GetListCtrl().GetItemData(iIndex));
}
*pResult = 0;
}
示例9: GetActiveDocument
HMENU COleIPFrameWnd::GetInPlaceMenu()
{
// get active document associated with this frame window
CDocument* pDoc = GetActiveDocument();
ASSERT_VALID(pDoc);
// get in-place menu from the doc template
CDocTemplate* pTemplate = pDoc->GetDocTemplate();
ASSERT_VALID(pTemplate);
return pTemplate->m_hMenuInPlaceServer;
}
示例10: test_parser
void test_parser() {
std::string page("<h1><a>wrong link</a><a class=\"special\"\\>some link</a></h1>");
CDocument doc;
doc.parse(page.c_str());
CSelection c = doc.find("h1 a.special");
CNode node = c.nodeAt(0);
printf("Node: %s\n", node.text().c_str());
std::string content = page.substr(node.startPos(), node.endPos()-node.startPos());
printf("Node: %s\n", content.c_str());
}
示例11: OpenPocket
int OpenPocket( const vector<CRossPocketItem>& UnitNos,
CString Title)
{
CDocTemplate* tmpl = GetRossPocketTemplate();;
CDocument* pDocument = tmpl->CreateNewDocument();
if (pDocument == NULL)
{
TRACE0("CDocTemplate::CreateNewDocument returned NULL.\n");
AfxMessageBox(AFX_IDP_FAILED_TO_CREATE_DOC);
return false;
}
ASSERT_VALID(pDocument);
pDocument->m_bAutoDelete = FALSE; // don't destroy if something goes wrong
CFrameWnd* pFrame = tmpl->CreateNewFrame(pDocument, NULL);
pDocument->m_bAutoDelete = TRUE;
if (pFrame == NULL)
{
AfxMessageBox(AFX_IDP_FAILED_TO_CREATE_DOC);
delete pDocument; // explicit delete on error
return FALSE;
};
ASSERT_VALID(pFrame);
pDocument->SetPathName(CString("An entry subset by ")+Title);
// open an existing document
tmpl->InitialUpdateFrame(pFrame, pDocument, TRUE);
POSITION pos = pDocument->GetFirstViewPosition();
CPocketForm* V = (CPocketForm*)(pDocument->GetNextView(pos));
V->m_PocketItems = UnitNos;
V->m_WordList.InsertColumn(1,"Словарный вход", LVCFMT_LEFT, 200);
V->m_WordList.InsertColumn(2,"Номер значения", LVCFMT_LEFT, 60);
V->m_WordList.InsertColumn(2,"Название словаря", LVCFMT_LEFT, 60);
V->m_WordList.SetItemCountEx(UnitNos.size());
V->m_UnitsSize.Format ("Число словарных входов : %i", V->m_WordList.GetItemCount());
V->UpdateData(FALSE);
V->m_WordList.UpdateData(FALSE);
V->m_WordList.Invalidate();
V->m_Title = Title;
// установка размеров
V->GetParent()->SetWindowPos(NULL, 0,0, 535 , 500, SWP_SHOWWINDOW|SWP_NOZORDER|SWP_NOMOVE);
return true;
};
示例12: s
void OleDocRoot::SetTitle(LPCTSTR lpszTitle)
{
CString s(lpszTitle);
CDocTemplate* pTempl = GetDocTemplate();
if (pTempl)
{
flag Found = True;
while (Found)
{
Found = False;
POSITION Pos = pTempl->GetFirstDocPosition();
while (Pos && !Found)
{
CDocument * pDoc = pTempl->GetNextDoc(Pos);
if (pDoc!=this)
{
CString Title = pDoc->GetTitle();
if (Title.GetLength()==s.GetLength() && _stricmp((const char*)s, (const char*)Title)==0)
Found = True;
}
}
if (Found)
{
CString Ext = "";
int DotPos = s.ReverseFind('.');
if (DotPos>=0)
{
Ext = s.Mid(DotPos, 256);
s = s.Left(DotPos);
}
int _Pos = s.ReverseFind('_');
if (_Pos>=0)
{
CString ss = s.Mid(_Pos+1, 256);
s = s.Left(_Pos+1);
if (ss.GetLength()>0)
{
char Buff[32];
sprintf(Buff, "%d", atoi((const char*)ss) + 1);
s += Buff;
}
else
s += "1";
}
else
s += "_1";
s += Ext;
}
}
}
COleLinkingDoc::SetTitle((const char*)s);
}
示例13: while
CWnd* WPhonePlugin::GetActiveWnd(CMultiDocTemplate* doc)
{
CWnd* pView = NULL;
POSITION posdoc = doc->GetFirstDocPosition();
while(posdoc != NULL)
{
CDocument* pdoc = doc->GetNextDoc(posdoc);
POSITION posview = pdoc->GetFirstViewPosition();
pView = (pdoc->GetNextView(posview));
}
return pView;
}
示例14:
CMDIChildWnd *CMDIChildIter::GetNextChild()
{
CDocument *pDoc = m_DocIter.GetNextDoc();
if (pDoc != NULL) {
POSITION pos = pDoc->GetFirstViewPosition();
if (pos != NULL) {
CView *pView = pDoc->GetNextView(pos);
if (pView != NULL)
return(DYNAMIC_DOWNCAST(CMDIChildWnd, pView->GetParentFrame()));
}
}
return(NULL);
}
示例15: OnFileNew
void CFileView::OnFileNew()
{
CMultiDocTemplate* pUIDocTemplate = theApp.GetUIDocTemplate();
CDocument* pDoc = pUIDocTemplate->OpenDocumentFile(NULL);
CString strFilePath = CGlobalVariable::m_strProjectPath + pDoc->GetTitle() + _T(".xml");
pDoc->DoSave(strFilePath);
HTREEITEM hSelectedItem = m_wndFileView.GetSelectedItem();
DWORD dwInfo = m_wndFileView.GetItemData(hSelectedItem);
HTREEITEM hParent = (dwInfo != INFO_FILE) ? hSelectedItem : m_wndFileView.GetParentItem(hSelectedItem);
HTREEITEM hNewItem = m_wndFileView.InsertItem(pDoc->GetTitle(), 2, 2, hParent);
m_wndFileView.SetItemData(hNewItem, INFO_FILE);
m_wndFileView.Expand(hParent, TVE_EXPAND);
}