OWLNext
7.0
Borland's Object Windows Library for the modern age
Toggle main menu visibility
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
25
namespace
ocf
{
26
27
// Generic definitions/compiler options (eg. alignment) preceding the
28
// definition of classes
29
#include <
owl/preclass.h
>
30
31
//
32
// class TStorageDocument
33
// ~~~~~ ~~~~~~~~~~~~~~~~
34
class
_OCFCLASS
TStorageDocument
:
public
owl::TDocument
{
35
public
:
36
enum
TStgDocProp
{
37
PrevProperty
=
owl::TDocument::NextProperty
-1,
38
CreateTime
,
// FILETIME
39
ModifyTime
,
// FILETIME
40
AccessTime
,
// FILETIME
41
StorageSize
,
// owl::ulong
42
IStorageInstance
,
// IStorage*
43
NextProperty
,
44
};
45
TStorageDocument
(
owl::TDocument
* parent = 0);
46
~TStorageDocument
();
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
84
protected_data
:
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
96
DECLARE_STREAMABLE_OCF
(
TStorageDocument
,1);
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
//
111
inline
TStorageDocument::TStorageDocument
(
owl::TDocument
* parent)
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
//
122
inline
bool
TStorageDocument::IsOpen
() {
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
//
131
inline
int
TStorageDocument::PropertyCount
() {
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
//
139
inline
IStorage
*
TStorageDocument::GetStorage
() {
140
return
StorageI;
141
}
142
143
//
144
/// Return the mode bits used to open the storage currently associated with
145
/// this storage object.
146
//
147
inline
int
TStorageDocument::GetThisOpen
() {
148
return
ThisOpen;
149
}
150
151
//
152
/// Return a pointer to the original IStorage interface associated with this
153
/// storage document object.
154
//
155
inline
IStorage
*
TStorageDocument::GetOrgStorageI
() {
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
//
163
inline
ILockBytes
*
TStorageDocument::GetLockBytes
() {
164
return
LockBytes;
165
}
166
167
}
// OCF namespace
168
169
170
#endif
// OWL_STGDOC_H
ocf::TStorageDocument
Definition
stgdoc.h:34
ocf::TStorageDocument::GetStorage
IStorage * GetStorage()
Return the IStorage interface pointer currently associated with the storage document object.
Definition
stgdoc.h:139
ocf::TStorageDocument::TStgDocProp
TStgDocProp
Definition
stgdoc.h:36
ocf::TStorageDocument::CreateTime
@ CreateTime
Definition
stgdoc.h:38
ocf::TStorageDocument::ModifyTime
@ ModifyTime
Definition
stgdoc.h:39
ocf::TStorageDocument::PrevProperty
@ PrevProperty
Definition
stgdoc.h:37
ocf::TStorageDocument::NextProperty
@ NextProperty
Definition
stgdoc.h:43
ocf::TStorageDocument::IStorageInstance
@ IStorageInstance
Definition
stgdoc.h:42
ocf::TStorageDocument::AccessTime
@ AccessTime
Definition
stgdoc.h:40
ocf::TStorageDocument::StorageSize
@ StorageSize
Definition
stgdoc.h:41
ocf::TStorageDocument::TStorageInStream
friend class TStorageInStream
Definition
stgdoc.h:97
ocf::TStorageDocument::GetLockBytes
ILockBytes * GetLockBytes()
Return a pointer to the ILockBytes interface currently being used by this storage document object.
Definition
stgdoc.h:163
ocf::TStorageDocument::GetOrgStorageI
IStorage * GetOrgStorageI()
Return a pointer to the original IStorage interface associated with this storage document object.
Definition
stgdoc.h:155
ocf::TStorageDocument::PropertyCount
int PropertyCount()
Return the number of properties supported by the storage document object.
Definition
stgdoc.h:131
ocf::TStorageDocument::TStorageOutStream
friend class TStorageOutStream
Definition
stgdoc.h:98
ocf::TStorageDocument::GetThisOpen
int GetThisOpen()
Return the mode bits used to open the storage currently associated with this storage object.
Definition
stgdoc.h:147
ocf::TStorageDocument::IsOpen
bool IsOpen()
Return 'true' if the storage document object has opened an OLE storage.
Definition
stgdoc.h:122
ocf::TStorageDocument::TStorageDocument
TStorageDocument(owl::TDocument *parent=0)
Construct a default Storage document object.
Definition
stgdoc.h:111
owl::TDocument
An abstract base class, TDocument is the base class for all document objects and serves as an interfa...
Definition
docview.h:187
owl::TDocument::TDocument
TDocument(TDocument *parent=nullptr)
Although you do not create a TDocument object directly, you must call the constructor when you create...
Definition
document.cpp:34
owl::TDocument::NextProperty
@ NextProperty
Next index to be used by derived class.
Definition
docview.h:203
owl::TInStream
Derived from TStream and istream, TInStream is a base class used to define input streams for document...
Definition
docview.h:594
owl::TOutStream
Derived from TStream and ostream, TOutStream is a base class used to create output storage streams fo...
Definition
docview.h:605
owl::TStream
An abstract base class, TStream provides links between streams and documents, views,...
Definition
docview.h:568
docview.h
Definition of classes TDocument, TView, TWindowView, TStream, TInStream, TOutStream.
ocf
Object Component Framework (COM encapsulation).
Definition
appdesc.h:22
owl
Object Windows Library (OWLNext Core).
Definition
animctrl.h:22
IStorage
interface _ICLASS IStorage
Definition
ocdoc.h:25
defs.h
ObjectComponents fundamental definitions.
DECLARE_STREAMABLE_OCF
#define DECLARE_STREAMABLE_OCF(cls, ver)
Definition
defs.h:61
_OCFCLASS
#define _OCFCLASS
Definition
defs.h:45
ILockBytes
interface _ICLASS ILockBytes
Definition
ocstorag.h:27
IStream
interface _ICLASS IStream
Definition
ocstorag.h:26
protected_data
#define protected_data
Definition
defs.h:208
defs.h
posclass.h
preclass.h
include
ocf
stgdoc.h
Generated by
1.18.0