Annotation of mstools/mfc/samples/oserver/bibsvr.cpp, revision 1.1

1.1     ! root        1: // This is a part of the Microsoft Foundation Classes C++ library.
        !             2: // Copyright (C) 1992 Microsoft Corporation
        !             3: // All rights reserved.
        !             4: //
        !             5: // This source code is only intended as a supplement to the
        !             6: // Microsoft Foundation Classes Reference and Microsoft
        !             7: // QuickHelp documentation provided with the library.
        !             8: // See these sources for detailed information regarding the
        !             9: // Microsoft Foundation Classes product.
        !            10: 
        !            11: 
        !            12: #include "bibref.h"
        !            13: #include "bibsvr.h"
        !            14: #include "bibdoc.h"
        !            15: 
        !            16: #include "mainwnd.h"
        !            17: 
        !            18: /////////////////////////////////////////////////////////////////////////////
        !            19: 
        !            20: // For an MDI server, a CBibDoc (or CServerDoc) would be created by
        !            21: //  the server in response to OnOpenDoc, OnCreateDoc or OnEditDoc.
        !            22: // Since we are an SDI server (just one document at a time), we create
        !            23: //  one document on program startup, and return it when a new server
        !            24: //  document is requested.
        !            25: 
        !            26: static CBibDoc* GetOnlyDoc()
        !            27: {
        !            28:        // ok we'll fake it
        !            29:        CMainWnd* pView = (CMainWnd*)AfxGetApp()->m_pMainWnd;
        !            30:        if (pView == NULL)
        !            31:                return NULL;
        !            32:        CBibDoc* pDoc = pView->GetDocument();
        !            33:        if (pDoc == NULL)
        !            34:                return NULL;
        !            35: 
        !            36:        ASSERT(!pDoc->IsOpen());
        !            37:        return pDoc;
        !            38: }
        !            39: 
        !            40: COleServerDoc*
        !            41: CBibServer::OnOpenDoc(LPCSTR lpszDoc)
        !            42: {
        !            43:        TRACE("BibServer: Open document (%Fs)\n", lpszDoc);
        !            44:        (void)lpszDoc;  // file name ignored
        !            45: 
        !            46:        return GetOnlyDoc();
        !            47: }
        !            48: 
        !            49: COleServerDoc*
        !            50: CBibServer::OnCreateDoc(LPCSTR lpszClass, LPCSTR lpszDoc)
        !            51: {
        !            52:        TRACE("BibServer: Create (%Fs, %Fs)\n", lpszClass, lpszDoc);
        !            53: 
        !            54:        return GetOnlyDoc();
        !            55: }
        !            56: 
        !            57: COleServerDoc*
        !            58: CBibServer::OnEditDoc(LPCSTR lpszClass, LPCSTR lpszDoc)
        !            59: {
        !            60:        TRACE("BibServer: Edit (%Fs, %Fs)\n", lpszClass, lpszDoc);
        !            61: 
        !            62:        return GetOnlyDoc();
        !            63: }
        !            64: 
        !            65: 
        !            66: /////////////////////////////////////////////////////////////////////////////

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.