home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 October / Chip_1997-10_cd.bin / tema / sybase / powerj / hpp.z / wolepsis.hpp < prev    next >
C/C++ Source or Header  |  1996-10-18  |  6KB  |  172 lines

  1. /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2.    %     Copyright (C) 1994, by WATCOM International Inc.  All rights    %
  3.    %     reserved.  No part of this software may be reproduced or        %
  4.    %     used in any form or by any means - graphic, electronic or       %
  5.    %     mechanical, including photocopying, recording, taping or        %
  6.    %     information storage and retrieval systems - except with the     %
  7.    %     written permission of WATCOM International Inc.                 %
  8.    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  9. */
  10.  
  11. /*************************************************************************
  12.  *
  13.  * WOlePersistentObjects -- Ole Persistent Storage interface family
  14.  *
  15.  *   Events:
  16.  *
  17.  *      PersistenceInitNew      -- initialize new persistence storage
  18.  *
  19.  *      PersistenceLoad         -- load an object from persistence storage
  20.  *
  21.  *      PersistenceSave         -- save an object to persistence storage
  22.  *
  23.  *      PersistenceSaveCompleted        -- save to persistent storage is
  24.  *                                         complete
  25.  *
  26.  *      PersistenceHandsOff     -- dump all held storage elements
  27.  *
  28.  *      PersistenceMaximumSize  -- request for the max size of a
  29.  *                                         stream persistent storage object
  30.  *
  31.  *************************************************************************/
  32.  
  33. #ifndef _WOLEPSIS_HPP_INCLUDED
  34. #define _WOLEPSIS_HPP_INCLUDED
  35.  
  36. #ifndef _WNO_PRAGMA_PUSH
  37. #pragma pack(push,8);
  38. #pragma enum int;
  39. #endif
  40.  
  41. #ifndef _WOLETYPE_HPP_INCLUDED
  42. #  include "woletype.hpp"
  43. #endif
  44. #ifndef _WOLEIFAM_HPP_INCLUDED
  45. #  include "woleifam.hpp"
  46. #endif
  47.  
  48. enum WStorageType {
  49.     WStorageTypeNone    = 0,
  50.     WStorageTypeStorage = 1,
  51.     WStorageTypeStream  = 2,
  52.     WStorageTypeFile    = 3,
  53. };
  54.  
  55. struct WPersistenceEventData : public WEventData {
  56.     WStorageType        storageType;
  57.     union {
  58.         WPIStorage      storage;
  59.         WPIStream       stream;
  60.         WFilePath       *fileName;
  61.     };
  62.  
  63.     // Applies only when persisting to Storages (IPersistStorage)
  64.     WBool               sameAsLoad;
  65.  
  66.     // Applies only when persisting to Files (IPersistFile)
  67.     WDWord              mode;
  68.     WBool               remember;
  69. };
  70.  
  71. #define PERSISTENCE_STREAM_DEF_MAX_SIZE 102
  72.  
  73. struct WPersistenceMaximumSizeEventData : public WEventData {
  74.     WULARGE_INTEGER     maximumSize;
  75. };
  76.  
  77. // forward class declarations
  78. class WOlePersistentObjects_IPStg;
  79. class WOlePersistentObjects_IPStrmI;
  80. class WOlePersistentObjects_IPFile;
  81.  
  82. class WCMCLASS WOlePersistentObjects : public WOleInterfaceFamily
  83. {
  84.     WDeclareSubclass( WOlePersistentObjects, WOleInterfaceFamily );
  85.  
  86.     friend class WOlePersistentObjects_IPStg;
  87.     friend class WOlePersistentObjects_IPStrmI;
  88.     friend class WOlePersistentObjects_IPFile;
  89.  
  90.     public:
  91.  
  92.     /**********************************************************
  93.      * Constructors and Destructors
  94.      *********************************************************/
  95.  
  96.         WOlePersistentObjects( WOleServerObject *serverObject );
  97.         virtual ~WOlePersistentObjects();
  98.  
  99.     /**************************************************************
  100.      * Properties
  101.      **************************************************************/
  102.  
  103.         // Dirty
  104.         WBool SetDirty( WBool dirty );
  105.         WBool GetDirty( void ) const;
  106.  
  107.         // Storage type
  108.         WBool SetStorageType( WStorageType storageType );
  109.         WStorageType GetStorageType( void ) const;
  110.  
  111.         // Native Clipboard Format
  112.         WBool SetNativeFormat( WInt format );
  113.         WInt GetNativeFormat( void ) const;
  114.  
  115.         // User Type string
  116.         WBool SetUserType( const WString & userType );
  117.         WString GetUserType( void ) const;
  118.  
  119.         // Default Save Prompt
  120.         WBool SetDefaultSavePrompt( const WFilePath & defaultSavePrompt );
  121.         WFilePath GetDefaultSavePrompt( void ) const;
  122.  
  123.         // Storage Type Locked
  124.         WBool GetStorageTypeLocked( void ) const;
  125.  
  126.         // Hands Off Storage
  127.         WBool GetHandsOffStorage( void ) const;
  128.  
  129.         // Storage
  130.         WPIStorage GetStorage( void ) const;
  131.  
  132.         // Filename
  133.         WFilePath GetFileName( void ) const;
  134.  
  135.     /**************************************************************
  136.      * Methods
  137.      **************************************************************/
  138.  
  139.         // overrides
  140.         virtual WBool QueryInterface( const WCLSID & clsid, void **iface );
  141.  
  142.     /**********************************************************
  143.      * Operators
  144.      *********************************************************/
  145.  
  146.     /**********************************************************
  147.      * Data Members
  148.      *********************************************************/
  149.  
  150.     protected:
  151.  
  152.         WStorageType                    _storageType;
  153.         WBool                           _storageTypeLocked;
  154.         WBool                           _dirty;
  155.         WInt                            _clipboardFormat;
  156.         WString                         _userType;
  157.         WFilePath                       _defaultSavePrompt;
  158.         WOlePersistentObjects_IPStg     *_pIPersistStorage;
  159.         WOlePersistentObjects_IPStrmI   *_pIPersistStreamInit;
  160.         WOlePersistentObjects_IPFile    *_pIPersistFile;
  161.  
  162. };
  163.  
  164.     
  165. #ifndef _WNO_PRAGMA_PUSH
  166. #pragma enum pop;
  167. #pragma pack(pop);
  168. #endif
  169.  
  170. #endif // _WOLEPSIS_HPP_INCLUDED
  171.  
  172.