OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
stgdoc.h
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// ObjectComponents
3// Copyright (c) 1993, 1996 by Borland International, All Rights Reserved
4//
5//----------------------------------------------------------------------------
6
7#if !defined(OCF_STGDOC_H)
8#define OCF_STGDOC_H
9
10#include <owl/private/defs.h>
11#include <ocf/defs.h>
12#if defined(BI_HAS_PRAGMA_ONCE)
13# pragma once
14#endif
15
16#include <owl/docview.h>
17
18//
19// Forward reference OLE interface without including headers
20//
21 interface IStorage;
22 interface IStream;
23
24
25namespace ocf {
26
27// Generic definitions/compiler options (eg. alignment) preceeding the
28// definition of classes
29#include <owl/preclass.h>
30
31//
32// class TStorageDocument
33// ~~~~~ ~~~~~~~~~~~~~~~~
35 public:
38 CreateTime, // FILETIME
39 ModifyTime, // FILETIME
40 AccessTime, // FILETIME
41 StorageSize, // owl::ulong
42 IStorageInstance, // IStorage*
44 };
47 virtual bool ReleaseDoc();
48
49 // Implement virtual methods of owl::TDocument
50 //
51 owl::TInStream* InStream(int omode, LPCTSTR strmId=0);
52 owl::TOutStream* OutStream(int omode, LPCTSTR strmId=0);
53 bool Open(int omode, LPCTSTR stgId);
54 bool Close();
55 bool Commit(bool force = false);
56 bool CommitTransactedStorage();
57 bool Revert(bool clear = false);
58 bool SetDocPath(LPCTSTR path);
59 bool IsOpen();
60
61 int FindProperty(LPCTSTR name); // return index
62 int PropertyFlags(int index);
63 LPCTSTR PropertyName(int index);
64 int PropertyCount();
65 int GetProperty(int index, void * dest, int textlen=0);
66 bool SetProperty(int index, const void * src);
67
68 // Additional methods for obtaining or changing the IStorage
69 //
70 virtual bool SetStorage(IStorage* stg, bool remember = true); // Set a new IStorage
71 virtual bool RestoreStorage();
72 virtual IStorage* GetNewStorage();
73 IStorage* GetStorage();
74
75 virtual bool OpenHandle(int omode, HANDLE hGlobal); // open on global memory
76 virtual bool SetHandle(int omode, HANDLE hGlobal, bool create = false, bool remember = false);
77 virtual bool GetHandle(HGLOBAL* handle);
78
79 protected:
80 int GetThisOpen();
81 IStorage* GetOrgStorageI();
82 ILockBytes* GetLockBytes();
83
85 int ThisOpen; ///< Actual mode bits used for opening storage
86 IStorage* StorageI; ///< Current IStorage instance, 0 if not open
87 IStorage* OrgStorageI; ///< Pointer to original IStorage interface
88 ILockBytes* LockBytes; ///< Pointer to ILockBytes used, if any
89
90 private:
91 bool CanRelease; ///< Can we release the IStorage?
92 int OpenCount;
93
94 void DetachStream(owl::TStream& strm); // Override owl::TDocument virtual
95
97 friend class TStorageInStream;
98 friend class TStorageOutStream;
99};
100
101// Generic definitions/compiler options (eg. alignment) following the
102// definition of classes
103#include <owl/posclass.h>
104
105// --------------------------------------------------------------------------
106// Inline implementations
107
108//
109/// Construct a default Storage document object
110//
112:
113 owl::TDocument(parent), StorageI(0), OpenCount(0), CanRelease(false),
114 OrgStorageI(0), LockBytes(0)
115{
116}
117
118//
119/// Return 'true' if the storage document object has opened an OLE storage.
120/// Return 'false' otherwise.
121//
123 return (StorageI != 0);
124}
125
126//
127/// Return the number of properties supported by the storage document object.
128/// \note The number includes the inherited properties of the storage
129// document object.
130//
132 return NextProperty - 1;
133}
134
135//
136/// Return the IStorage interface pointer currently associated with the
137/// storage document object. Returns 0 if no storage is currently opened.
138//
140 return StorageI;
141}
142
143//
144/// Return the mode bits used to open the storage currently associated with
145/// this storage object.
146//
148 return ThisOpen;
149}
150
151//
152/// Return a pointer to the original IStorage interface associated with this
153/// storage document object.
154//
156 return OrgStorageI;
157}
158
159//
160/// Return a pointer to the ILockBytes interface currently being used by this
161/// storage document object. Return 0 if no ILockBytes interface is in use.
162//
164 return LockBytes;
165}
166
167} // OCF namespace
168
169
170#endif // OWL_STGDOC_H
IStorage * GetStorage()
Return the IStorage interface pointer currently associated with the storage document object.
Definition stgdoc.h:139
ILockBytes * GetLockBytes()
Return a pointer to the ILockBytes interface currently being used by this storage document object.
Definition stgdoc.h:163
IStorage * GetOrgStorageI()
Return a pointer to the original IStorage interface associated with this storage document object.
Definition stgdoc.h:155
int PropertyCount()
Return the number of properties supported by the storage document object.
Definition stgdoc.h:131
int GetThisOpen()
Return the mode bits used to open the storage currently associated with this storage object.
Definition stgdoc.h:147
bool IsOpen()
Return 'true' if the storage document object has opened an OLE storage.
Definition stgdoc.h:122
TStorageDocument(owl::TDocument *parent=0)
Construct a default Storage document object.
Definition stgdoc.h:111
An abstract base class, TDocument is the base class for all document objects and serves as an interfa...
Definition docview.h:187
@ NextProperty
Next index to be used by derived class.
Definition docview.h:203
Derived from TStream and istream, TInStream is a base class used to define input streams for document...
Definition docview.h:594
Derived from TStream and ostream, TOutStream is a base class used to create output storage streams fo...
Definition docview.h:605
An abstract base class, TStream provides links between streams and documents, views,...
Definition docview.h:568
Definition of classes TDocument, TView, TWindowView, TStream, TInStream, TOutStream.
Object Component Framework (COM encapsulation)
Definition appdesc.h:22
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
interface _ICLASS IStorage
Definition ocdoc.h:25
ObjectComponents fundamental definitions.
#define DECLARE_STREAMABLE_OCF(cls, ver)
Definition defs.h:61
#define _OCFCLASS
Definition defs.h:45
interface _ICLASS ILockBytes
Definition ocstorag.h:27
interface _ICLASS IStream
Definition ocstorag.h:26
#define protected_data
Definition defs.h:208