OWLNext    7.0
Borland's Object Windows Library for the modern age
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
oledoc.h
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// ObjectComponents
3// Copyright (c) 1994, 1996 by Borland International, All Rights Reserved
4//
5//----------------------------------------------------------------------------
6
7#if !defined(OCF_OLEDOC_H)
8#define OCF_OLEDOC_H
9
10#include <owl/private/defs.h>
11#if defined(BI_HAS_PRAGMA_ONCE)
12# pragma once
13#endif
14
15#include <ocf/stgdoc.h>
16#include <ocf/ocfevent.h>
17#include <ocf/ocdoc.h>
18
19
20
21namespace ocf {
22
23// Generic definitions/compiler options (eg. alignment) preceding the
24// definition of classes
25#include <owl/preclass.h>
26
28
29//
30/// \class TOleDocument
31// ~~~~~ ~~~~~~~~~~~~
32/// Derived from TStorageDocument, TOleDocument implements the document half of the
33/// Doc/View pair. It manages the document's data while the corresponding TOleView
34/// object determines how the data is displayed on the screen. Basically,
35/// TOleDocument is a TStorageDocument with a knowledge of TOcDocument through its
36/// pointer to TOcDocument.
37///
38/// TOleDocument is responsible for creating compound documents, closing documents,
39/// reading documents from storage, and writing documents to storage. In the case of
40/// a server, the document consists of a single object. In the case of a container,
41/// the document can consist of one or more embedded objects (also referred to as
42/// parts).
43///
44/// To accomplish these tasks, TOleDocument talks to the underlying ObjectComponents
45/// classes through the use of functions such as GetOcApp, GetOcDoc, and SetOcDoc.
46//
48 public:
49 TOleDocument(owl::TDocument* parent = 0);
51
52 /// \name Accessors
53 /// @{
54 void SetOcDoc(TOcDocument* doc);
55 TOcDocument* GetOcDoc();
56 TOcApp* GetOcApp();
57 /// @}
58
59 /// \name Overridables:
60 /// @{
61 // owl::TDocument:
62 bool Commit(bool force);
63 bool Open(int mode, LPCTSTR path = 0);
64 bool Close();
65 bool InitDoc();
66 bool CanClose();
67 bool Revert(bool clear);
68
69 // TStorageDocument:
70 bool SetStorage(IStorage* stg, bool remember = true);
71 bool RestoreStorage();
72 bool ReleaseDoc();
73
74 // TOleDocument:
75 virtual void PreOpen();
76 virtual bool Read();
77 virtual bool Write();
78 virtual bool CommitSelection(TOleWindow& oleWin, void* userData);
79 /// @}
80
81 /// \name Utilities
82 /// @{
83 bool PathChanged();
84 void OleViewClose();
85 /// @}
86
87 private:
88 TOcDocument* OcDoc; ///< OCF document partner
89 bool Closing; ///< shutdown in progress
90};
91
92// Generic definitions/compiler options (eg. alignment) following the
93// definition of classes
94#include <owl/posclass.h>
95
96
97//----------------------------------------------------------------------------
98// Inline implementations
99//
100
101//
102/// Sets the ObjectComponents document associated with this TOleDocument object.
104{
105 OcDoc = doc;
106}
107
108//
109/// Returns the ObjectComponents document associated with this TOleDocument object.
111{
112 return OcDoc;
113}
114
115//
116/// Virtual function to be overriden in TOleDocument-derived class which serves or
117/// supports linking to portions of a document's data.
118//
119inline bool TOleDocument::CommitSelection(TOleWindow& oleWin, void* userData)
120{
121 return true;
122}
123
124
125} // OCF namespace
126
127
128#endif
OCF Application class.
Definition ocapp.h:144
OC Document class, holds parts & is a owner of views.
Definition ocdoc.h:43
Derived from TStorageDocument, TOleDocument implements the document half of the Doc/View pair.
Definition oledoc.h:47
virtual bool CommitSelection(TOleWindow &oleWin, void *userData)
Virtual function to be overriden in TOleDocument-derived class which serves or supports linking to po...
Definition oledoc.h:119
TOcDocument * GetOcDoc()
Returns the ObjectComponents document associated with this TOleDocument object.
Definition oledoc.h:110
void SetOcDoc(TOcDocument *doc)
Sets the ObjectComponents document associated with this TOleDocument object.
Definition oledoc.h:103
The generic OLE2 window. Use as a client of a frame window.
Definition olewindo.h:91
An abstract base class, TDocument is the base class for all document objects and serves as an interfa...
Definition docview.h:187
Object Component Framework (COM encapsulation)
Definition appdesc.h:22
Definition of TOcDocument Class.
interface _ICLASS IStorage
Definition ocdoc.h:25
#define _OCFCLASS
Definition defs.h:45
Definition of OWL signatures for ObjectComponents messages.