/* constructor ----------- if "szPath" is NULL then we create an untitled document and default object the type is "doctypeNew" if "lhDoc" is NULL and "doctypeEmbedded" if "lhDoc" is non NULL if "szPath" is non NULL we create a document of type "doctypeFromFile" and initialize it from file "szPath" if "lhDoc" is NULL then we call OleRegisterServerDoc() otherwise we just use "lhDoc" as our registration handle */ TOLEDocument::TOLEDocument (TOLEServer &server, LHSERVERDOC lhDoc, LPSTR szPath, BOOL dirty) { szName = 0; lpvtbl = &_vtbl; fRelease = FALSE; fDirty = dirty; server.pDocument = this; // // since we only have one object we can create it now... // pObject = new TOLEObject; if (szPath) LoadFromFile (szPath); else { SetDocumentName (UNNAMED_DOC); type = lhDoc ? doctypeEmbedded : doctypeNew; } if (lhDoc != 0) this->lhDoc = lhDoc; // use registration handle we were given else OleRegisterServerDoc (server.lhServer, szName, this, (LHSERVERDOC FAR *) &this->lhDoc); }
void IT_REGSERVERDOC (ENV *envp, LONGPROC f) { LHSERVER lhHandle; LPSTR lpString1; LPOLESERVERDOC lpdoc; LPBYTE lpStr; LHSERVERDOC lhdoc; DWORD retcode; lhHandle = (LHSERVER)GETDWORD(SP+16); lpString1 = (LPSTR)GetAddress(GETWORD(SP+14),GETWORD(SP+12)); #ifdef LATER translate the LPOLESERVERDOC and the structures behind it #endif lpdoc = (LPOLESERVERDOC)GETDWORD(SP+8); lpStr = (LPBYTE)GetAddress(GETWORD(SP+6),GETWORD(SP+4)); retcode = OleRegisterServerDoc(lhHandle, lpString1, lpdoc, &lhdoc); PUTDWORD(lpStr,lhdoc); envp->reg.sp += 2*DWORD_86 + 2*LP_86 + RET_86; envp->reg.ax = LOWORD(retcode); envp->reg.dx = HIWORD(retcode); }
/* Reset ----- the only reason that we need this routine is that we re-use the document object. if your app doesn't then you would delete the old object and create a new one... SIDE EFFECTS: sets "fDirty" flag to FALSE and "fRelease" to FALSE if "lhDoc" is NULL then call OleRegisterServerDoc() */ void TOLEDocument::Reset (LPSTR szPath) { if (!szPath || !LoadFromFile (szPath)) { ((TWindowServer *) GetApplicationObject()->MainWindow)->ShapeChange (objEllipse); pObject->native.type = objEllipse; pObject->native.version = 1; type = doctypeNew; SetDocumentName (UNNAMED_DOC); } if (lhDoc == 0) { TOLEApp *pApp = (TOLEApp *) GetApplicationObject(); OleRegisterServerDoc (pApp->pServer->lhServer, szName, this, (LHSERVERDOC FAR *) &lhDoc); } fDirty = fRelease = FALSE; }