home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / BC_502 / BOCOLE.PAK / BOLEDEFS.H < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-06  |  10.8 KB  |  425 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectComponents
  3. // Copyright (c) 1994, 1996 by Borland International, All Rights Reserved
  4. //
  5. // $Revision:   2.13  $
  6. //
  7. //  Contains the main constants and structures used by Bolero to encapsulate 
  8. //  OLE2 compound document functionality.
  9. //----------------------------------------------------------------------------
  10. #ifndef _BOLEDEFS_H
  11. #define _BOLEDEFS_H
  12.  
  13. #ifndef _BOLEVER_H
  14. #include <bolever.h>
  15. #endif
  16.  
  17. #ifndef _BCOM_H
  18. #include <bcom.h>
  19. #endif
  20.  
  21. #ifdef WIN32
  22.   #define BOLEDLL TEXT("BOLE32.DLL")
  23. #else
  24.   #define BOLEDLL TEXT("BOLE16.DLL")
  25. #endif
  26.  
  27. #ifdef WIN32
  28. #include "pshpack8.h"
  29. #endif
  30.  
  31. #define BOLEBIND TEXT("CREATECLASSMGR")
  32.  
  33.  
  34. /*
  35.  *        Useful OLE2.H  declarations
  36.  */
  37.  
  38. #if !defined(WIN32) && !defined (__WINDOWS_H) && !defined (_INC_WINDOWS)
  39.  
  40.   typedef struct tagPOINT
  41.   {
  42.     int x;
  43.     int y;
  44.   } POINT;
  45.   typedef POINT FAR*  LPPOINT;
  46.  
  47.   typedef struct tagPOINTL
  48.   {
  49.     long x;
  50.     long y;
  51.   } POINTL;
  52.   typedef POINTL FAR*  LPPOINTL;
  53.  
  54.   typedef struct tagRECT
  55.   {
  56.     int left;
  57.     int top;
  58.     int right;
  59.     int bottom;
  60.   } RECT;
  61.   typedef RECT FAR*  LPRECT;
  62. #endif
  63.  
  64. #if !defined(WIN32)
  65.   typedef struct tagACCEL {
  66.     BYTE   fVirt;         /* Also called the flags field */
  67.     WORD   key;
  68.     WORD   cmd;
  69.   } ACCEL, *LPACCEL;
  70. #endif
  71.  
  72.   typedef struct tPOINTF
  73.   {
  74.     float x;
  75.     float y;
  76.   } TPOINTF;
  77.  
  78.  
  79. #if !defined (_OLE2_H_)
  80.  
  81.   #ifdef WIN32
  82.     #define LPRECTL PRECTL
  83.   #else
  84.  
  85.     #if !defined(__SIZEL_POINTL_RECTL_DEFINED)
  86.     #define __SIZEL_POINTL_RECTL_DEFINED
  87.  
  88.       typedef struct FARSTRUCT tagRECTL
  89.       {
  90.       long    left;
  91.       long    top;
  92.       long    right;
  93.       long    bottom;
  94.       } RECTL, FAR* LPRECTL;
  95.  
  96.       typedef struct FARSTRUCT tagPOINTL {
  97.       LONG x;
  98.       LONG y;
  99.       } POINTL;
  100.     #endif
  101.  
  102.   #endif
  103.  
  104.   #ifndef LPCRECT
  105.     typedef const RECT FAR* LPCRECT;
  106.   #endif
  107.  
  108.   #ifndef LPCRECTL
  109.     typedef const RECTL FAR* LPCRECTL;
  110.   #endif
  111.  
  112.   //  opaque pass throughs
  113.  
  114.   struct _ICLASS IMoniker;
  115.   struct _ICLASS IStorage;
  116.   struct _ICLASS IDataObject;
  117.  
  118. #endif
  119.  
  120. typedef const SIZE FAR* LPCSIZE;
  121.  
  122. #if ((defined __BORLANDC__) && (!defined WIN32))
  123. #pragma option -po-
  124. #endif
  125.  
  126. class _ICLASS IBContainer; // forward reference
  127.  
  128. #if ((defined __BORLANDC__) && (!defined WIN32))
  129. #pragma option -po.
  130. #endif
  131.  
  132. /*
  133.  * BOLERO linking and embedding parameter typedefs
  134.  */
  135.  
  136. typedef long Coord;
  137. #define HIMETRIC_PER_INCH   2540      // number HIMETRIC units per inch
  138.  
  139. // MAP_PIX_TO_LOGHIM / MAP_LOGHIM_TO_PIX --
  140. //
  141. // The OLE2-defined macros for these guys don't round. Our versions
  142. // add half the denominator so that the truncated result of the integer
  143. // division is rounded to the nearest integer. e.g. 9/10 truncates to 0,
  144. // instead of rounding to 1, so add 5/10 which makes 14/10 which truncates
  145. // to 1 which simulates rounding.
  146. //
  147. #ifdef MAP_PIX_TO_LOGHIM
  148. #undef MAP_PIX_TO_LOGHIM
  149. #endif
  150. #define MAP_PIX_TO_LOGHIM(pixel, pixelsPerInch) \
  151.   ((ULONG) ((((ULONG)HIMETRIC_PER_INCH) * pixel + (pixelsPerInch >> 1)) / pixelsPerInch))
  152.  
  153. #ifdef MAP_LOGHIM_TO_PIX
  154. #undef MAP_LOGHIM_TO_PIX
  155. #endif
  156. #define MAP_LOGHIM_TO_PIX(hiMetric, pixelsPerInch) \
  157.     (UINT) ((((double) hiMetric) * pixelsPerInch + (HIMETRIC_PER_INCH >> 1)) / HIMETRIC_PER_INCH)
  158.  
  159. #if defined(INIT_BGUID)
  160.   #define DEFINE_BOLEGUID(name, l) \
  161.      EXTERN_C __export const GUID CDECL FAR name = { l, 0, 0, {0xC0,0,0,0,0,0,0,0x46} }
  162. #else
  163.   #define DEFINE_BOLEGUID(name, l) \
  164.      EXTERN_C const GUID CDECL FAR name
  165. #endif
  166.  
  167. DEFINE_BOLEGUID(IID_IBPart,          0x02A104L);
  168. DEFINE_BOLEGUID(IID_IBSite,          0x02A105L);
  169. DEFINE_BOLEGUID(IID_IBContainer,     0x02A106L);
  170. DEFINE_BOLEGUID(IID_IBDocument,      0x02A107L);
  171. DEFINE_BOLEGUID(IID_IBService,       0x02A108L);
  172. DEFINE_BOLEGUID(IID_IBApplication,   0x02A109L);
  173. DEFINE_BOLEGUID(IID_IBClassMgr,      0x02A10AL);
  174. DEFINE_BOLEGUID(IID_IBLinkInfo,      0x02A10BL);
  175. DEFINE_BOLEGUID(IID_IBLinkable,      0x02A10CL);
  176. DEFINE_BOLEGUID(IID_IBRootLinkable,  0x02A10DL);
  177. DEFINE_BOLEGUID(IID_IBContains,      0x02A10EL);
  178. DEFINE_BOLEGUID(IID_BOleDocument,    0x02A10FL);
  179. DEFINE_BOLEGUID(IID_BOlePart,        0x02A110L);
  180. DEFINE_BOLEGUID(IID_IBDataConsumer,  0x02A111L);
  181. DEFINE_BOLEGUID(IID_IBDataProvider,  0x02A112L);
  182. DEFINE_BOLEGUID(IID_IBWindow,        0x02A113L);
  183. DEFINE_BOLEGUID(IID_IBDataNegotiator,0x02A114L);
  184. DEFINE_BOLEGUID(IID_IBDropDest,      0x02A115L);
  185. DEFINE_BOLEGUID(IID_BOleShadowData,  0x02A116L);
  186. DEFINE_BOLEGUID(IID_IBClass,         0x02A117L);
  187. DEFINE_BOLEGUID(IID_IBOverrideBrowseLinks,   0x02A118L);
  188. DEFINE_BOLEGUID(IID_BOleSite,        0x02A119L);
  189. DEFINE_BOLEGUID(IID_IBSite2,         0x02A11AL);
  190. DEFINE_BOLEGUID(IID_IBOverrideHelpButton,  0x02A11BL);
  191. DEFINE_BOLEGUID(IID_IBDataProvider2, 0x02A11CL);
  192. DEFINE_BOLEGUID(IID_IBPart2,         0x02A11DL);
  193. DEFINE_BOLEGUID(IID_IBService2,      0x02A11EL);
  194. DEFINE_BOLEGUID(IID_BOleControl,     0x02A11FL);
  195. DEFINE_BOLEGUID(IID_IBControl,       0x02A120L);
  196. DEFINE_BOLEGUID(IID_IBControlSite,   0x02A121L);
  197. DEFINE_BOLEGUID(IID_BOleFont,        0x02A122L);
  198. DEFINE_BOLEGUID(IID_BOleControlSite, 0x02A123L);
  199. DEFINE_BOLEGUID(IID_IBEventsHandler, 0x02A124L);
  200. DEFINE_BOLEGUID(IID_IBEventClass,    0x02A125L);
  201. DEFINE_BOLEGUID(IID_IBSinkList,      0x02A126L);
  202. DEFINE_BOLEGUID(IID_BOlePicture,     0x02A127L);
  203. DEFINE_BOLEGUID(IID_IBPicture,       0x02A128L);
  204. DEFINE_BOLEGUID(IID_IBDataState,     0x02A129L);
  205.  
  206.  
  207. // Bolero Class ids  for instantiating bolero objects (helpers)
  208.  
  209. typedef ULONG BCID;
  210.  
  211. const BCID      cidBOleService          = 1L;   //
  212. const BCID      cidBOleDocument         = 2L;   // helper for containers
  213. const BCID      cidBOlePart             = 3L;   // helper for sites
  214. const BCID      cidBOleSite             = 4L;   // helper for parts
  215. const BCID      cidBOleInProcSite       = 5L;   // helper for parts
  216. const BCID      cidBOleContainer        = 6L;   // helper for part documents
  217. const BCID      cidBOleData             = 7L;   // helper for data transfer
  218. const BCID      cidBOleFactory          = 8L;   // helper for class factory
  219. const BCID      cidBOleShadowData       = 9L;   // helper for non delayed rendering
  220. const BCID      cidBOleInProcHandler    = 10L;  // helper for dll handler parts
  221. const BCID      cidBOleControl          = 11L;  // helper for controls
  222. const BCID      cidBOleFont             = 12L;  // IBFont implementation
  223. const BCID      cidBOleControlSite      = 13L;  // helper for controls
  224. const BCID      cidBOleControlFactory   = 14L;  // helper for control class factory
  225. const BCID      cidBOlePicture          = 15L;  // IBPicture implementation
  226.  
  227.  
  228. typedef enum {
  229.   BOLE_MED_NULL    = 0,
  230.   BOLE_MED_HGLOBAL = 1,
  231.   BOLE_MED_FILE    = 2,
  232.   BOLE_MED_STREAM  = 4,
  233.   BOLE_MED_STORAGE = 8,
  234.   BOLE_MED_GDI     = 16,
  235.   BOLE_MED_MFPICT  = 32, // leave room for any new OLE mediums
  236.   BOLE_MED_STATIC  = 1024
  237. } BOleMedium;
  238.  
  239. typedef enum {
  240.   BOLE_HELP_EXIT,
  241.   BOLE_HELP_ENTER,
  242.   BOLE_HELP_GET
  243. } BOleHelp;
  244.  
  245. typedef enum {
  246.   BOLE_MOUSEENTER = 1,
  247.   BOLE_MOUSECONTAINED = 2,
  248.   BOLE_MOUSEEXIT = 3
  249. } BOleMouseAction;
  250.  
  251. typedef enum {
  252.   BOLE_DROP_NONE = 0,
  253.   BOLE_DROP_COPY = 1,
  254.   BOLE_DROP_MOVE = 2,
  255.   BOLE_DROP_LINK = 4
  256. } BOleDropAction;
  257.  
  258. typedef enum {
  259.   BOLE_CONTENT         = 1,
  260.   BOLE_THUMBNAIL       = 2,
  261.   BOLE_ICON            = 4,
  262.   BOLE_DOCPRINT        = 8,
  263.   BOLE_DEFAULT         = 16,
  264.   BOLE_ASPECT_MAINTAIN = 32,
  265.   BOLE_CLIP            = 64
  266. } BOleAspect;
  267.  
  268. typedef enum {
  269.   BOLE_DRAW_NONE        = 0,
  270.   BOLE_DRAW_SHADINGONLY = 1,
  271.   BOLE_DRAW_SHOWOBJECTS = 2
  272. } BOleDraw;
  273.  
  274. typedef enum {
  275.   BOLE_SCROLL_UP    = 1,
  276.   BOLE_SCROLL_DOWN  = 2,
  277.   BOLE_SCROLL_LEFT  = 4,
  278.   BOLE_SCROLL_RIGHT = 8
  279. } BOleScroll;
  280.  
  281. typedef enum {
  282.   BOLE_NAME_LONG  = 1,
  283.   BOLE_NAME_SHORT = 2,
  284.   BOLE_NAME_APP   = 3
  285. } BOlePartName;
  286.  
  287. typedef enum {
  288.   BOLE_HELP_BROWSE,
  289.   BOLE_HELP_BROWSECLIPBOARD,
  290.   BOLE_HELP_CONVERT,
  291.   BOLE_HELP_BROWSELINKS,
  292.   BOLE_HELP_CHANGEICON,
  293.   BOLE_HELP_FILEOPEN,
  294.   BOLE_HELP_SOURCESET,
  295.   BOLE_HELP_ICONFILEOPEN,
  296.   BOLE_HELP_BROWSECONTROL
  297. } BOleDialogHelp;
  298.  
  299. typedef enum {
  300.   BOLE_ENABLE_PASTE           = 1,
  301.   BOLE_ENABLE_PASTELINK       = 2,
  302.   BOLE_ENABLE_BROWSECLIPBOARD = 4,
  303.   BOLE_ENABLE_BROWSELINKS     = 8
  304. } BOleMenuEnable;
  305.  
  306. typedef enum {
  307.   BOLE_INVAL_DATA       = 1,
  308.   BOLE_INVAL_VIEW       = 2,
  309.   BOLE_INVAL_PERSISTENT = 4
  310. } BOleInvalidate;
  311.  
  312. typedef struct FAR {
  313.   LPCOLESTR       typeName;
  314.   LPCOLESTR       verbName;
  315.   UINT            verbIndex;
  316.   BOOL            fCanDirty;
  317. } BOleVerb;
  318.  
  319. typedef struct FAR {
  320.   LONG    width[6];
  321. } BOleMenuWidths;
  322.  
  323. typedef struct FAR {
  324.   UINT fmtId;
  325.   OLECHAR fmtName[32];
  326.   OLECHAR fmtResultName[32];
  327.   BOleMedium fmtMedium;
  328.   BOOL fmtIsLinkable;
  329. } BOleFormat;
  330.  
  331. typedef enum {
  332.   BOLE_CONVERT_TO_CLSID   = 1,
  333.   BOLE_ACTIVATE_AS_CLSID  = 2,
  334.   BOLE_ASPECT_TO_ICON     = 4,
  335.   BOLE_ASPECT_TO_CONTENT  = 8
  336. } BOleConvertAction;
  337.  
  338. typedef enum {
  339.   BOLE_LINK,
  340.   BOLE_EMBED,
  341.   BOLE_EMBED_ASMETAFILE,
  342.   BOLE_EMBED_ASBITMAP
  343. } InitHow;
  344.  
  345. typedef enum {
  346.   BOLE_FILE,
  347.   BOLE_STORAGE,
  348.   BOLE_DATAOBJECT,
  349.   BOLE_NEW,
  350.   BOLE_HANDLE,
  351.   BOLE_NEW_OCX,
  352.   BOLE_STREAM
  353. } InitWhere;
  354.  
  355. typedef struct FAR {
  356.   InitHow How;
  357.   InitWhere Where;
  358.   IBContainer FAR* pContainer;
  359.  
  360.   HICON hIcon;
  361.  
  362.   IStorage *pStorage;
  363.   union {
  364.     struct {    // where == BOLE_FILE
  365.       LPCOLESTR pPath;
  366.     } whereFile;
  367.     struct {    // where == BOLE_DATAOBJECT
  368.       IDataObject *pData;
  369.     } whereData;
  370.     struct {    // where == BOLE_NEW
  371.       BCID cid;
  372.     } whereNew;
  373.     struct {    // where == BOLE_HANDLE
  374.       HANDLE data;
  375.       UINT dataFormat;
  376.     } whereHandle;
  377.     struct {    // where == BOLE_STREAM
  378.       LPSTREAM pStream;
  379.     } whereStream;
  380.   };
  381.   inline LONG ReleaseDataObject()
  382.   { return ((Where == BOLE_DATAOBJECT) && whereData.pData) ?
  383.     ((IUnknown *)whereData.pData)->Release() :
  384.     0;
  385.   }
  386.  
  387. } BOleInitInfo;
  388.  
  389. typedef enum {
  390.   BOLE_UPDATE_AUTO   = 1,
  391.   BOLE_UPDATE_MANUAL = 3
  392. } BOleLinkUpdate;
  393.  
  394. typedef struct FAR {
  395.   ULONG       xN;      // numerator in x direction
  396.   ULONG       xD;      // denominator in x direction
  397.   ULONG       yN;      // numerator in y direction
  398.   ULONG       yD;      // denominator in y direction
  399. } BOleScaleFactor;
  400.  
  401. // This tagged union allows macro record/playback on the Convert dialog
  402. //
  403. typedef struct FAR {
  404.   BOleConvertAction action;
  405.   CLSID clsidNew;
  406.   HGLOBAL hIcon;
  407. } BOleConvertInfo;
  408.  
  409. // Entry Points
  410. //
  411. extern "C" {
  412.   extern HRESULT PASCAL FAR _export CreateClassMgr (PIUnknown FAR*pCM, PIUnknown pOut, IMalloc FAR*);
  413. }
  414. inline PIUnknown CreateClassMgr( PIUnknown pOut = NULLP, IMalloc FAR* pMalloc = NULLP)
  415. {
  416.   PIUnknown tmpCM;
  417.   return CreateClassMgr(&tmpCM, pOut, pMalloc) == NOERROR ? tmpCM : NULLP;
  418. }
  419.  
  420. #ifdef WIN32
  421. #include "poppack.h"
  422. #endif
  423.  
  424. #endif
  425.