OLESERVERDOCVTBL

typedef struct _OLESERVERDOCVTBL { /* odv */

OLESTATUS (CALLBACK* Save) (LPOLESERVERDOC);

OLESTATUS (CALLBACK* Close)(LPOLESERVERDOC);

OLESTATUS (CALLBACK* SetHostNames)(LPOLESERVERDOC,

OLE_LPCSTR, OLE_LPCSTR);

OLESTATUS (CALLBACK* SetDocDimensions)(LPOLESERVERDOC,

OLE_CONST RECT FAR*);

OLESTATUS (CALLBACK* GetObject)(LPOLESERVERDOC, OLE_LPCSTR,

LPOLEOBJECT FAR*, LPOLECLIENT);

OLESTATUS (CALLBACK* Release)(LPOLESERVERDOC);

OLESTATUS (CALLBACK* SetColorScheme)(LPOLESERVERDOC,

OLE_CONST LOGPALETTE FAR*);

OLESTATUS (CALLBACK* Execute) (LPOLESERVERDOC, HGLOBAL);

} OLESERVERDOCVTBL;

The OLESERVERDOCVTBL structure points to functions that manipulate a document. A server application creates this structure and an OLESERVERDOC structure to give the server library access to a document.

Documents opened or created on request from the library should not be shown to the user for editing until the library requests that they be shown.

Every function except Release can return OLE_BUSY.

Save

  OLESTATUS Save(lpDoc)    
  LPOLESERVERDOC lpDoc;    

The Save function instructs the server to save the document.

Parameters

lpDoc

Points to an OLESERVERDOC structure corresponding to the document to save.

Return Value

The return value is OLE_OK if the function is successful. Otherwise, it is an error value.

Close

  OLESTATUS Close(lpDoc)    
  LPOLESERVERDOC lpDoc;    

The Close function instructs the server application to unconditionally close the document.

Parameters

lpDoc

Points to an OLESERVERDOC structure corresponding to the document to close.

Return Value

The return value is OLE_OK if the function is successful. Otherwise, it is an error value.

Comments

The server application should not prompt the user to save the document or take other actions; prompts of this kind are handled by the client application.

When a document is closed, the server should free the memory for the OLESERVERDOCVTBL structure and associated resources.

SetHostNames

  OLESTATUS SetHostNames(lpDoc, lpszClient, lpszDoc)    
  LPOLESERVERDOC lpDoc;    
  LPSTR lpszClient;    
  LPSTR lpszDoc;    

The SetHostNames function sets the names that should be used for window titles. These names are used only for embedded objects, because linked objects have their own titles. This function is used only for documents that are embedded objects.

Parameters

lpDoc

Points to an OLESERVERDOC structure corresponding to a document that is the embedded object for which names are specified.

lpszClient

Points to a null-terminated string specifying the name of the client.

lpszDoc

Points to a null-terminated string specifying the client's name for the object.

Return Value

The return value is OLE_OK if the function is successful. Otherwise, it is an error value.

SetDocDimensions

  OLESTATUS SetDocDimensions(lpDoc, lpRect)    
  LPOLESERVERDOC lpDoc;    
  LPRECT lpRect;    

The SetDocDimensions function gives the server the rectangle on the target device for which the object should be formatted. This function is relevant only for documents that are embedded objects.

Parameters

lpDoc

Points to the OLESERVERDOC structure corresponding to the document that is the embedded object for which the target size is specified.

lpRect

Points to a RECT structure containing the target size of the object, in MM_HIMETRIC units. (In the MM_HIMETRIC mapping mode, the positive y direction is up.)

Return Value

The return value is OLE_OK if the function is successful. Otherwise, it is an error value.

GetObject

  OLESTATUS GetObject(lpDoc, lpszItem, lplpObject, lpClient)    
  LPOLESERVERDOC lpDoc;    
  LPSTR lpszItem;    
  LPOLEOBJECT FAR * lplpObject;    
  LPOLECLIENT lpClient;    

The GetObject function requests the server to create an OLEOBJECT structure.

Parameters

lpDoc

Points to an OLESERVERDOC structure corresponding to this document.

lpszItem

Points to a null-terminated string specifying the name of an item in the specified document for which an object structure is requested. If this string is NULL, the entire document is requested.

lplpObject

Points to a variable of type LPOLEOBJECT where the server application should return a long pointer to the allocated OLEOBJECT structure.

lpClient

Points to an OLECLIENT structure allocated by the library. The server should associate the OLECLIENT structure with the object and use it to notify the library of changes to the object.

Return Value

The return value is OLE_OK if the function is successful. Otherwise, it is an error value.

Comments

The server application should allocate and initialize the OLEOBJECT structure, associate it with the OLECLIENT structure pointed to by the lpClient parameter and return a pointer to the OLEOBJECT structure through the lplpObject argument.

The library calls the GetObject function to associate a client with the part of the document identified by the lpszItemname parameter. When a client has been associated with an object by this function, the server can send notifications to the client.

Release

  OLESTATUS Release(lpDoc)    
  LPOLESERVERDOC lpDoc;    

The Release function notifies the server when a revoked document has terminated conversations and may be destroyed.

Parameters

lpDoc

Points to an OLESERVERDOC structure for which the handle was revoked and which may now be released.

Return Value

The return value is OLE_OK if the function is successful. Otherwise, it is an error value.

SetColorScheme

  OLESTATUS SetColorScheme(lpDoc, lpPal)    
  LPOLESERVERDOC lpDoc;    
  LPLOGPALETTE lpPal;    

The SetColorScheme function sends the server application the color palette recommended by the client application.

Parameters

lpDoc

Points to an OLESERVERDOC structure for which the client application recommends a palette.

lpPal

Points to a LOGPALETTE structure specifying the recommended palette.

Return Value

The return value is OLE_OK if the function is successful. Otherwise, it is an error value.

Comments

Server applications are not required to use the palette recommended by the client application.

The first palette entry in the LOGPALETTE structure specifies the foreground color recommended by the client application. The second palette entry specifies the background color. The first half of the remaining palette entries are fill colors and the second half are colors for lines and text.

Client applications typically specify an even number of palette entries. When there is an uneven number of entries, the server should round to the fill colors; that is, if there are seven entries, three should be interpreted as fill colors and two as line and text colors.

Execute

  OLESTATUS Execute(lpDoc, hCommands)    
  LPOLESERVERDOC lpDoc;    
  HANDLE hCommands;    

The Execute function sends the server application one or more DDE execute commands.

Parameters

lpDoc

Points to an OLESERVERDOC structure to which the DDE commands apply.

hCommands

Identifies memory containing one or more DDE execute commands.

Return Value

The return value is OLE_OK if the function is successful. Otherwise, it is an error value.