1 // ---------------------------------------------------------------------------- 2 // MODULE : OLEProperty.h 3 // LANGUAGE : C++ 4 // AUTHOR : Yue Zhang 5 // DATE : Tuesday, Janurary 23, 1996 6 // DESCRIPTION : This file defines OLE Property object 7 // COMMENT : Enhanced OLE objects which are independent of platform 8 // SCCSID : @(#)oleprop.h 1.5 10:45:20 12 Sep 1997 9 // ---------------------------------------------------------------------------- 10 // Copyright (c) 1999 Digital Imaging Group, Inc. 11 // For conditions of distribution and use, see copyright notice 12 // in Flashpix.h 13 // ---------------------------------------------------------------------------- 14 15 #ifndef OLEProperties_h 16 #define OLEProperties_h 17 18 // ---------------------------------------------------------------------------- 19 20 // Includes 21 // -------- 22 23 #ifndef FPXBaselineIO_h 24 #include "fpxlibio.h" 25 #endif 26 #ifndef SystemToolkit_h 27 #include "ri_sys.h" 28 #endif 29 30 class OLEPropertySection; // to avoid include OLEPropertySet.h 31 class OLEPropertySet; // to avoid include OLEPropertySet.h 32 33 34 // FIX_DICT_PROP ...start addition 35 // Property set dictionary declarations (formerly in OLEPROPS.H) 36 // ----------------------------------------- 37 typedef struct tagENTRY 38 { 39 DWORD dwPropID; 40 DWORD cb; 41 char *sz; 42 } ENTRY; 43 44 typedef struct tagDICTIONARY 45 { 46 DWORD cbEntries; 47 ENTRY *rgEntry; 48 } DICTIONARY; 49 50 // FIX_DICT_PROP ...end of addition 51 // Property types are enum'ed in VARIANT.H which is not a file officially under the 52 // control of FlashPix. Since it can't be edited, a property type was added here 53 // which hopefully will not collide with any changes to the list in VARIANT.H 54 // 55 #define DICT_PROP_TYPE 0x0C00 56 57 // FIX_DICT_PROP ...end of addition 58 59 // Constants 60 // --------- 61 62 // Property id zero 63 #define PROPERTYIDZERO 0 64 65 // Property id one 66 #define PROPERTYIDONE 1 67 68 // Code page 69 #define CODEPAGE 1200 70 71 // Class declarations 72 // ------------------ 73 74 class OLEProperty; 75 class OLEBlob; 76 77 78 // Class definitions 79 // ----------------- 80 81 class OLEProperty : public PToolkitObject { 82 83 friend class OLEPropertySection; 84 85 public: 86 OLEProperty (OLEPropertySet* parentPropSet, 87 OLEPropertySection *parentPropSection, 88 DWORD properID, 89 DWORD properType); 90 virtual ~OLEProperty(); 91 92 // Set the variant structure to zero Clear()93 virtual void Clear() { V_R8(&val) = 0; }; 94 95 // Get the property ID GetPropID()96 virtual unsigned long GetPropID() { return propID; }; 97 98 // Get the property type GetPropType()99 virtual unsigned long GetPropType() { return V_VT(&val); }; 100 101 // Get the property offset GetPropOffset()102 virtual unsigned long GetPropOffset() { return propOffset; }; 103 104 // Set the property offset SetPropOffset(unsigned long off)105 virtual void SetPropOffset(unsigned long off) { propOffset = off; }; 106 107 // Following functions define the VT data types in variant.h that can be assigned 108 // to a OLEProperty class through operator= 109 virtual short& operator=(const short& v); 110 virtual WORD& operator=(const WORD& v); 111 virtual int32_t& operator=(const int32_t& v); 112 virtual DWORD& operator=(const DWORD& v); 113 virtual float& operator=(const float& v); 114 virtual double& operator=(const double& v); 115 virtual Boolean& operator=(const Boolean& v); 116 virtual CY& operator=(const CY& v); 117 virtual FILETIME& operator=(const FILETIME& v); 118 virtual void operator=(const char* v); 119 virtual void operator=(const WCHAR* v); 120 virtual void operator=(const BLOB* v); 121 virtual void operator=(const CLIPDATA* v); 122 virtual void operator=(const CLSID* v); 123 virtual void operator=(const VECTOR* v); 124 125 // Following functions define the VT data types in variant.h that can be extracted 126 // from an OLEProperty class through operator= 127 virtual operator short() const; 128 virtual operator WORD() const; 129 virtual operator DWORD() const; 130 virtual operator int32_t() const; 131 virtual operator float() const; 132 virtual operator double() const; 133 virtual operator Boolean() const; 134 virtual operator CY() const; 135 virtual operator FILETIME() const; 136 virtual operator char*() const; 137 virtual operator WCHAR*() const; 138 virtual operator BLOB*() const; 139 virtual operator const BLOB*() const; 140 virtual operator CLIPDATA*() const; 141 virtual operator const CLIPDATA*() const; 142 virtual operator CLSID*() const; 143 virtual operator VECTOR*() const; 144 virtual operator const VECTOR*() const; 145 146 // Following functions define the data types in FPXBaselineIO.h that can be 147 // assigned to an OLEProperty class through operator= 148 virtual const FPXStr& operator=(const FPXStr& fpxstr); 149 virtual const FPXWideStr& operator=(const FPXWideStr& fpxwstr); 150 virtual const FPXShortArray& operator=(const FPXShortArray& sa); 151 virtual const FPXLongArray& operator=(const FPXLongArray& la); 152 virtual const FPXRealArray& operator=(const FPXRealArray& fa); 153 virtual const FPXClsIDArray& operator=(const FPXClsIDArray& ca); 154 virtual const FPXWideStrArray&operator=(const FPXWideStrArray& wa); 155 virtual const FPXStrArray& operator=(const FPXStrArray& sa); 156 // PTCH_DCG - reinstated the following 3 prototypes 157 virtual const FPXSpacialFrequencyResponseBlock& operator=( 158 const FPXSpacialFrequencyResponseBlock& sfra); 159 virtual const FPXCFA_PatternBlock& operator=(const FPXCFA_PatternBlock& cpba); 160 virtual const FPXOECF_Block& operator=(const FPXOECF_Block& oba); 161 virtual const FPXScannedImageSizeBlock& operator=(const FPXScannedImageSizeBlock& susb); 162 virtual const FPXOpticalFilterArray& operator=(const FPXOpticalFilterArray& ofa); 163 164 // Following functions define the data types in FPXBaselineIO.h that can be 165 // extracted from an OLEProperty class through operator= 166 virtual operator FPXStr() const; 167 virtual operator FPXWideStr() const; 168 virtual operator FPXShortArray() const; 169 virtual operator FPXLongArray() const; 170 virtual operator FPXRealArray() const; 171 virtual operator FPXClsIDArray() const; 172 virtual operator FPXStrArray() const; 173 virtual operator FPXWideStrArray() const; 174 // PTCH_DCG - reinstated the following 3 prototypes 175 virtual operator FPXSpacialFrequencyResponseBlock() const; 176 virtual operator FPXCFA_PatternBlock() const; 177 virtual operator FPXOECF_Block() const; 178 virtual operator FPXScannedImageSizeBlock() const; 179 virtual operator FPXOpticalFilterArray() const; 180 181 protected: 182 DWORD len; // Length of the property 183 VARIANT val; // Value of the property itself (or null) 184 185 // FIX_DICT_PROP - Added a dictionary property member. This is an alternative 186 // to a VARIANT. A DICTIONARY is unlike other properties and never occurs in 187 // a VARIANT. One difference of significance is that the property ID for the 188 // dictionary is 0. 189 // The OLEProperty may contain one or the other, but not both. 190 // 191 // 192 DICTIONARY* pDict; // Pointer to dictionary property (or null) 193 194 OLEPropertySet* parPropSet; // The OLEPropertySet from which this is created 195 OLEPropertySection* OLEPropSec; // The OLEPropertySection from which this is created 196 DWORD propOffset; // The offset of this property 197 DWORD propID; // The ID of this property 198 }; 199 200 201 //------------------------------------------------------------------------------------------- 202 // Global Functions 203 //------------------------------------------------------------------------------------------- 204 205 //------------------------------------------------------------------------------------- 206 // The following functions save VT type data into variant structure 207 //------------------------------------------------------------------------------------- 208 209 // This function duplicate the string and save it into variant 210 DWORD VTtoVariant(VARIANT* pvar, const char * v); 211 212 // This function duplicate the wide string and save it into variant 213 DWORD VTtoVariant(VARIANT* pvar, const WCHAR * v); 214 215 // This function duplicate the blob and save it into variant 216 DWORD VTtoVariant(VARIANT* pvar, const BLOB * pblob); 217 218 // This function duplicate the clipdata and save it into variant 219 DWORD VTtoVariant(VARIANT* pvar, const CLIPDATA * pcf); 220 221 // This function duplicate the clsid and save it into variant 222 DWORD VTtoVariant(VARIANT* pvar, const CLSID * pcls); 223 224 // This function duplicate the vector and save it into variant 225 DWORD VTtoVariant(VARIANT* pvar, const VECTOR * pvector); 226 227 //------------------------------------------------------------------------------------------- 228 // The following functions convert VT data types defined in variant.h to those defined in 229 // FPXBaselineIO.h and vice versa 230 //------------------------------------------------------------------------------------------- 231 232 // This function converts FPXStr to LPSTR 233 char* FPXStrToLPSTR(const FPXStr& fpxstr ); 234 235 // This function converts FPXWideStr to LPWSTR 236 LPWSTR FPXWideStrToLPWSTR(const FPXWideStr& fpxwstr ); 237 238 // PTCH_DCG - added prototype 239 // This function converts an array of bytes in FPXStr to vector 240 VECTOR* FPXStrToVector(const FPXStr& sa ); 241 242 // This function converts FPXShortArray to VECTOR 243 VECTOR* FPXShortArrayToVector(const FPXShortArray& sa ); 244 245 // This function converts FPXLongArray to VECTOR 246 VECTOR* FPXLongArrayToVector(const FPXLongArray& la ); 247 248 // This function converts FPXRealArray to VECTOR 249 VECTOR* FPXRealArrayToVector(const FPXRealArray& fa ); 250 251 // This function converts FPXClsIDArray to VECTOR 252 VECTOR* FPXClsIDArrayToVector(const FPXClsIDArray& ca ); 253 254 // This function converts FPXStrArray to VECTOR 255 VECTOR* FPXStrArrayToVector(const FPXStrArray& sa ); 256 257 // This function converts FPXWideStrArray to VECTOR 258 VECTOR* FPXWideStrArrayToVector(const FPXWideStrArray& wa ); 259 260 // PTCH_DCG - reinstated 261 // This function converts FPXSpacialFrequencyResponseBlock to VECTOR 262 VECTOR* FPXSpacialFrequencyResponseBlockToVector(const FPXSpacialFrequencyResponseBlock& sfra ); 263 264 // This function converts FPXCFA_PatternBlock to VECTOR 265 VECTOR* FPXCFA_PatternBlockToVector(const FPXCFA_PatternBlock& cpba ); 266 267 // This function converts FPXOECF_Block to VECTOR 268 VECTOR* FPXOECF_BlockToVector(const FPXOECF_Block& oeba ); 269 270 // This function converts FPXScannedImageSizeBlock to VECTOR 271 VECTOR* FPXScannedImageSizeBlockToVector(const FPXScannedImageSizeBlock& sisb ); 272 273 // This function converts FPXOpticalFilterArray to VECTOR 274 VECTOR* FPXOpticalFilterArrayToVector(const FPXOpticalFilterArray& sisb ); 275 276 // This function converts LPSTR to FPXStr 277 FPXStr& LPSTRToFPXStr( char* pstr ); 278 279 // This function converts LPWSTR to FPXWideStr 280 FPXWideStr& LPWSTRToFPXWideStr( LPWSTR pwstr ); 281 282 // This function converts string of bytes to string with long count 283 FPXStr& VectorToStr( VECTOR* vec ); 284 285 // This function converts VECTOR to FPXShortArray 286 FPXShortArray& VectorToFPXShortArray( VECTOR* vec ); 287 288 // This function converts VECTOR to FPXLongArray 289 FPXLongArray& VectorToFPXLongArray( VECTOR* vec ); 290 291 // This function converts VECTOR to FPXRealArray 292 FPXRealArray& VectorToFPXRealArray( VECTOR* vec ); 293 294 // This function converts VECTOR to FPXClsIDArray 295 FPXClsIDArray& VectorToFPXClsIDArray( VECTOR* vec ); 296 297 // This function converts VECTOR to FPXStrArray 298 FPXStrArray& VectorToFPXStrArray( VECTOR* vec ); 299 300 // This function converts VECTOR to FPXWideStrArray 301 FPXWideStrArray& VectorToFPXWideStrArray( VECTOR* vec ); 302 303 // PTCH_DCG - reinstated next 3 304 // This function converts VECTOR to FPXSpacialFrequencyResponseBlock 305 FPXSpacialFrequencyResponseBlock& VectorToFPXSpacialFrequencyResponseBlock( VECTOR* pvec ); 306 307 // This function converts VECTOR to FPXCFA_PatternBlock 308 FPXCFA_PatternBlock& VectorToFPXCFA_PatternBlock( VECTOR* pvec ); 309 310 // This function converts VECTOR to FPXOECF_Block 311 FPXOECF_Block& VectorToFPXOECF_Block( VECTOR* pvec ); 312 313 // This function converts VECTOR to FPXScannedImageSizeBlock 314 FPXScannedImageSizeBlock& VectorToFPXScannedImageSizeBlock( VECTOR* pvec ); 315 316 // This function converts VECTOR to FPXOpticalFilterArray 317 FPXOpticalFilterArray& VectorToFPXOpticalFilterArray( VECTOR* pvec ); 318 319 320 // ---------------------------------------------------------------------------- 321 #endif // OLEProperties_h 322 // ---------------------------------------------------------------------------- 323