OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
owl::TDocument Class Reference

An abstract base class, TDocument is the base class for all document objects and serves as an interface between the document, its views, and the document manager (TDocManager class). More...

#include <owl/docview.h>

Inheritance diagram for owl::TDocument:
owl::TStreamableBase ocf::TStorageDocument owl::TFileDocument ocf::TOleDocument

Classes

class  TList
 Document list class. More...
 

Public Types

enum  TDocProp { PrevProperty = 0 , DocumentClass , TemplateName , ViewCount , StoragePath , DocTitle , NextProperty }
 These property values, which describe the basic properties of a document, are available in classes derived from TDocument. More...
 
typedef TList List
 

Public Member Functions

 TDocument (TDocument *parent=0)
 Although you do not create a TDocument object directly, you must call the constructor when you create a derived class.
 
virtual ~TDocument ()
 Deletes a TDocument object.
 
virtual TInStreamInStream (int mode, LPCTSTR strmId=0)
 Generic input for the particular storage medium, InStream returns a pointer to a TInStream.
 
TInStreamInStream (int mode, const tstring &streamId)
 
virtual TOutStreamOutStream (int mode, LPCTSTR strmId=0)
 Generic output for the particular storage medium, OutStream returns a pointer to a TOutStream.
 
TOutStreamOutStream (int mode, const tstring &streamId)
 
virtual bool Open (int mode, LPCTSTR path=0)
 Opens the document using the path specified by DocPath.
 
bool Open (int mode, const tstring &path)
 
virtual bool Close ()
 close document, does not delete or detach
 
virtual bool Commit (bool force=false)
 save current data, force write
 
virtual bool Revert (bool clear=false)
 abort changes, no reload if true
 
virtual TDocumentRootDocument ()
 Returns the this pointer as the root document.
 
TDocManagerGetDocManager ()
 Returns a pointer to the current document manager.
 
void SetDocManager (TDocManager &dm)
 Sets the current document manager to the argument dm.
 
TDocumentGetParentDoc ()
 Returns either the parent document of the current document or 0 if there is no parent document.
 
TDocTemplateGetTemplate ()
 Gets the template used for document creation.
 
bool SetTemplate (TDocTemplate *tpl)
 Sets the document template.
 
LPCTSTR GetDocPath () const
 Returns the directory path for the document.
 
virtual bool SetDocPath (LPCTSTR path)
 Sets the document path for Open and Save operations.
 
bool SetDocPath (const tstring &path)
 
LPCTSTR GetTitle () const
 Returns the title of the document.
 
virtual void SetTitle (LPCTSTR title)
 Sets the title of the document.
 
void SetTitle (const tstring &title)
 
virtual bool IsDirty ()
 Also queries doc and view hierarchy.
 
void SetDirty (bool dirty=true)
 Updates the document's dirty flag using the specified parameter.
 
virtual bool IsOpen ()
 Checks to see if the document has any streams in its stream list.
 
virtual bool CanClose ()
 Returns false if unable to close.
 
virtual bool HasFocus (HWND hwnd)
 Document (or child doc) has Focus.
 
virtual TDocumentDocWithFocus (HWND hwnd)
 Return pointer to this document or one of its child documents if the spcecified window parameter is a view associated with the document.
 
bool NotifyViews (int eventId, TParam2=0, TView *exclude=0)
 Notifies the views of this document, and the views of any child documents, of a change.
 
bool NotifyOwnViews (int eventId, TParam2=0, TView *exclude=0)
 Notifies the views of this document of a change.
 
TViewQueryViews (int eventId, TParam2=0, TView *exclude=0)
 Queries the views of the current document, and the views of any child documents, about a specified event.
 
virtual uint PostError (uint sid, uint choice=MB_OK)
 Posts the error message passed as a string resource ID in sid.
 
virtual int PropertyCount ()
 Gets the total number of properties for the TDocument object.
 
virtual int FindProperty (LPCTSTR name)
 return property index
 
int FindProperty (const tstring &name)
 
virtual int PropertyFlags (int index)
 pfXxxxx bit array
 
virtual LPCTSTR PropertyName (int index)
 locale invariant name
 
virtual int GetProperty (int index, void *dest, int textlen=0)
 Retrieves the property identified by the given index.
 
virtual bool SetProperty (int index, const void *src)
 native type
 
TListGetChildren ()
 Return reference to the children document list.
 
TViewGetViewList () const
 Return pointer to the head of the link list of views associated with this document.
 
TViewNextView (const TView *view)
 Gets the next view in the list of views. Holds 0 if none exists.
 
TStreamGetStreamList () const
 Returns head of the link list of streams associated with this document.
 
TStreamNextStream (const TStream *strm)
 Gets the next entry in the stream. Holds 0 if none exists.
 
voidGetTag () const
 Returns pointer to user-defined data [i.e. tag] attached to this document.
 
void SetTag (void **tag)
 Attach an arbitrary (user-defined) pointer with this document.
 
int GetOpenMode () const
 Gets the mode and protection flag values for the current document.
 
void SetOpenMode (int mode)
 Sets the mode and protection flag values for the current document.
 
TViewInitView (TView *view)
 called from template InitView
 
bool IsEmbedded () const
 Returns true if the document is embedded in an OLE 2 container.
 
void SetEmbedded (bool embed)
 Marks the document as being embedded in an OLE 2 container.
 
virtual bool InitDoc ()
 A virtual method that is overridden by TOleDocument::InitDoc.
 
 TDocument (TDocManager *docMan)
 create a dummy document to hold docmgr
 
- Public Member Functions inherited from owl::TStreamableBase
virtual ~TStreamableBase ()
 

Protected Member Functions

virtual void AttachStream (TStream &strm)
 called from TStream constructor
 
virtual void DetachStream (TStream &strm)
 called from TStream destructor
 
void DestroyViews ()
 Destroys the views attached to this document.
 
void DestroyChildren ()
 Destroy children first if we have any.
 

Friends

class TDocTemplate
 access to InitView()
 
class TView
 access to Attach/DetatchView()
 
class TStream
 access to Attach/DetachStream()
 
class TDocManager
 
class TList
 access to NextDoc
 

Detailed Description

An abstract base class, TDocument is the base class for all document objects and serves as an interface between the document, its views, and the document manager (TDocManager class).

TDocument creates, destroys, and sends messages about the view. For example, if the user changes a document, TDocument tells the view that the document has been updated. The DEFINE_DOC_TEMPLATE_CLASS macro associates a document with its views.

In order to send messages to its associated views, the document maintains a list of all the views existing for that document and communicates with the views using ObjectWindows event-handling mechanism. Rather than using the function SendMessage(), the document accesses the view's event table. The views can update the document's data by calling the member functions of the particular document. Views can also request streams, which are constructed by the document.

Both documents and views have lists of properties for their applications to use. When documents and views are created or destroyed, messages are sent to the application, which can then query the properties to determine how to process the document or view. It is the document manager's responsibility to determine if a particular view is appropriate for the given document.

Because the property attribute functions are virtual, a derived class (which is called first) might override the properties defined in a base class. Each derived class must implement its own property attribute types of either string or binary data. If the derived class duplicates the property names of the parent class, it should provide the same behavior and data type as the parent.

In order to add persistence to documents, TDocument contains several virtual functions (for example, InStream and OutStream) that support streaming. Your derived classes need to override these functions in order to read and write data.

Although documents are usually associated with files, they do not necessarily have to be files; they can also consist of database tables, mail systems, fax or modem transmissions, disk directories, and so on.

Definition at line 184 of file docview.h.

Member Typedef Documentation

◆ List

Definition at line 223 of file docview.h.

Member Enumeration Documentation

◆ TDocProp

These property values, which describe the basic properties of a document, are available in classes derived from TDocument.

They can be used to update and query the attributes of a document. PrevProperty and NextProperty are delimiters for every document's property list. See GetProperty() and SetProperty() for more information.

Enumerator
PrevProperty 

Index of last property in base class (none in this case)

DocumentClass 

text Property: Name of C++ class encapsulating document

TemplateName 

text property: Name of template attached to document

ViewCount 

int property: Number of views displaying this document

StoragePath 

text property: Identifies object holding data of this document

DocTitle 

text property: Caption of this document

NextProperty 

Next index to be used by derived class.

Definition at line 193 of file docview.h.

Constructor & Destructor Documentation

◆ TDocument() [1/2]

owl::TDocument::TDocument ( TDocument * parent = 0)

Although you do not create a TDocument object directly, you must call the constructor when you create a derived class.

parent points to the parent of the new document. If no parent exists, parent is 0.

Definition at line 34 of file document.cpp.

References CHECK, owl::TAppDictionary::GetApplication(), owl::TDocument::TList::Insert(), owl::OWLGetAppDictionary(), and owl::TXOwl::Raise().

◆ ~TDocument()

owl::TDocument::~TDocument ( )
virtual

Deletes a TDocument object.

Normally, Close is called first. TDocument's destructor destroys all children and closes all open streams. If this is the last document that used the template, it closes the object's template and any associated views, deletes the object's stream, and removes itself from the parent's list of children if a parent exists. If there is no parent, it removes itself from the document manager's document list.

Definition at line 80 of file document.cpp.

References _T, DestroyChildren(), DestroyViews(), owl::dnClose, owl::TDocManager::PostEvent(), owl::TDocument::TList::Remove(), SetTemplate(), TRACEX, and WARN.

◆ TDocument() [2/2]

owl::TDocument::TDocument ( TDocManager * docMan)
inline

create a dummy document to hold docmgr

Create a dummy document to hold docmgr.

Definition at line 975 of file docview.h.

Member Function Documentation

◆ AttachStream()

void owl::TDocument::AttachStream ( TStream & strm)
protectedvirtual

called from TStream constructor

Called from TStream's constructor, AttachStream attaches a stream to the current document.

Definition at line 441 of file document.cpp.

References owl::TStream::NextStream.

◆ CanClose()

bool owl::TDocument::CanClose ( )
virtual

Returns false if unable to close.

Checks to see if all child documents can be closed before closing the current document.

If any child returns false, CanClose returns false and aborts the process. If all children return true, calls TDocManager::FlushDoc. If FlushDoc finds that the document has been changed but not saved, it displays a message asking the user to either save the document, discard any changes, or cancel the operation. If the document has not been changed and all children's CanClose functions return true, this CanClose function returns true.

Reimplemented in ocf::TOleDocument.

Definition at line 775 of file document.cpp.

References owl::TDocManager::FlushDoc(), and owl::TDocument::TList::Next().

◆ Close()

bool owl::TDocument::Close ( )
virtual

close document, does not delete or detach

Closes the document but does not delete or detach the document.

Before closing the document, Close checks any child documents and tries to close them before closing the parent document. Even if you write your own Close function, call TDocument's version to ensure that all child documents are checked before the parent document is closed.

Reimplemented in ocf::TOleDocument, ocf::TStorageDocument, and owl::TFileDocument.

Definition at line 793 of file document.cpp.

References owl::TDocument::TList::Next().

◆ Commit()

bool owl::TDocument::Commit ( bool force = false)
virtual

save current data, force write

Saves the current data to storage.

When a file is closed, the document manager calls either Commit or Revert. If force is true, all data is written to storage. Commit checks any child documents and commits their changes to storage also. Before the current data is saved, all child documents must return true. If all child documents return true, Commit flushes the views for operations that occurred since the last time the view was checked. After all data for the document is updated and saved, Commit returns true.

Reimplemented in ocf::TOleDocument, ocf::TStorageDocument, and owl::TFileDocument.

Definition at line 584 of file document.cpp.

References _T, owl::TDocument::TList::Next(), NotifyViews(), owl::vnCommit, and WARNX.

◆ DestroyChildren()

void owl::TDocument::DestroyChildren ( )
protected

Destroy children first if we have any.

Then force close here as a last resort if derived classes have not done so. Since we have destructed down to a TDocument by now, derived closes will not be called.

Definition at line 309 of file document.cpp.

References Close(), and owl::TDocument::TList::Destroy().

◆ DestroyViews()

void owl::TDocument::DestroyViews ( )
protected

Destroys the views attached to this document.

Definition at line 318 of file document.cpp.

◆ DetachStream()

void owl::TDocument::DetachStream ( TStream & strm)
protectedvirtual

called from TStream destructor

Called from TStream's destructor, DetachStream detaches the stream from the current document.

Definition at line 452 of file document.cpp.

References owl::TStream::NextStream.

◆ DocWithFocus()

TDocument * owl::TDocument::DocWithFocus ( HWND hWnd)
virtual

Return pointer to this document or one of its child documents if the spcecified window parameter is a view associated with the document.

Note
Unlike 'HasFocus', this method allows you to distinguish whether the document with focus is a child document.

Definition at line 755 of file document.cpp.

References owl::TDocument::TList::Next(), QueryViews(), and owl::vnIsWindow.

◆ FindProperty() [1/2]

int owl::TDocument::FindProperty ( const tstring & name)
inline

Definition at line 275 of file docview.h.

References FindProperty().

◆ FindProperty() [2/2]

int owl::TDocument::FindProperty ( LPCTSTR name)
virtual

return property index

Gets the property index, given the property name (name).

Returns either the integer index number that corresponds to the name or 0 if the name isn't found in the list of properties.

Reimplemented in ocf::TStorageDocument, owl::TFileDocument, and owl::TFileDocument.

Definition at line 186 of file document.cpp.

References _T, _tcscmp, NextProperty, PRECONDITION, PrevProperty, and TRACEX.

◆ GetChildren()

TDocument::TList & owl::TDocument::GetChildren ( )
inline

Return reference to the children document list.

Definition at line 934 of file docview.h.

◆ GetDocManager()

TDocManager & owl::TDocument::GetDocManager ( )
inline

Returns a pointer to the current document manager.

Definition at line 847 of file docview.h.

◆ GetDocPath()

LPCTSTR owl::TDocument::GetDocPath ( ) const
inline

Returns the directory path for the document.

This might change the SaveAs operation.

Definition at line 871 of file docview.h.

◆ GetOpenMode()

int owl::TDocument::GetOpenMode ( ) const
inline

Gets the mode and protection flag values for the current document.

Definition at line 984 of file docview.h.

◆ GetParentDoc()

TDocument * owl::TDocument::GetParentDoc ( )
inline

Returns either the parent document of the current document or 0 if there is no parent document.

Definition at line 855 of file docview.h.

◆ GetProperty()

int owl::TDocument::GetProperty ( int index,
void * dest,
int textlen = 0 )
virtual

Retrieves the property identified by the given index.

If the requested property is text, then dest should point to a text buffer, and textlen should specify the maximum number of characters the buffer can hold, excluding the terminating null-character, i.e. the buffer must have room for (textlen + 1) characters.

If the requested property is numerical, then it may be requested either as text or in its binary form. To request the property as text, pass a text buffer as described above. To request the property in binary form, dest should point to storage of sufficent size, and textlen should be zero.

Non-text properties without textual representation, e.g. file handles, may only be requested in binary form, i.e. dest must point to sufficient storage, and textlen must be zero.

Returns
If the parameter textlen is non-zero, which means that the property is requested in string form, the function returns the length of the string, i.e. the character count excluding the terminating null-character. If the parameter textlen is zero, which means that property is requested in binary form, the return value is the size of the data in bytes.

If the property is text, and textlen is zero, the function fails and returns 0. The function also fails and returns 0 if textlen is non-zero and the property requested can not be expressed as text. It also returns 0 if the property is not defined.

See also
TDocument::TDocProp

Reimplemented in ocf::TStorageDocument, and owl::TFileDocument.

Definition at line 224 of file document.cpp.

References _A2W, _OBJ_FULLTYPENAME, _T, _tcslen, _USES_CONVERSION, DocTitle, DocumentClass, owl::TDocTemplate::GetDescription(), StoragePath, TemplateName, TRACEX, and ViewCount.

◆ GetStreamList()

TStream * owl::TDocument::GetStreamList ( ) const
inline

Returns head of the link list of streams associated with this document.

Note
To iterate through all the streams, use the 'NextStream' method with the pointer returned from this method.

Definition at line 953 of file docview.h.

◆ GetTag()

void * owl::TDocument::GetTag ( ) const
inline

Returns pointer to user-defined data [i.e. tag] attached to this document.

Definition at line 960 of file docview.h.

◆ GetTemplate()

TDocTemplate * owl::TDocument::GetTemplate ( )
inline

Gets the template used for document creation.

The template can be changed during a SaveAs operation.

Definition at line 863 of file docview.h.

◆ GetTitle()

LPCTSTR owl::TDocument::GetTitle ( ) const
inline

Returns the title of the document.

Definition at line 878 of file docview.h.

◆ GetViewList()

TView * owl::TDocument::GetViewList ( ) const
inline

Return pointer to the head of the link list of views associated with this document.

Note
To iterate through all the views, use the 'NextView' method with the pointer obtained from this method.

Definition at line 944 of file docview.h.

◆ HasFocus()

bool owl::TDocument::HasFocus ( HWND hWnd)
virtual

Document (or child doc) has Focus.

Used by the document manager, HasFocus returns true if this document's view has focus.

hwnd is a handle to the document. to determine if the document contains a view with a focus.

Definition at line 743 of file document.cpp.

References DocWithFocus().

◆ InitDoc()

bool owl::TDocument::InitDoc ( )
inlinevirtual

A virtual method that is overridden by TOleDocument::InitDoc.

You can use this function to prepare the document before the view is constructed and before the dnCreate event, which indicates that the document has been created and is posted.

Reimplemented in ocf::TOleDocument.

Definition at line 927 of file docview.h.

◆ InitView()

TView * owl::TDocument::InitView ( TView * view)

called from template InitView

Initializes the view.

Notifies others a view is created by posting the dnCreate event.

Definition at line 502 of file document.cpp.

References _T, owl::TView::BumpNextViewId(), CHECK, owl::dnCreate, owl::TDocManager::PostEvent(), and TRACEX.

◆ InStream() [1/2]

TInStream * owl::TDocument::InStream ( int mode,
const tstring & streamId )
inline

Definition at line 231 of file docview.h.

References InStream().

◆ InStream() [2/2]

TInStream * owl::TDocument::InStream ( int mode,
LPCTSTR strmId = 0 )
inlinevirtual

Generic input for the particular storage medium, InStream returns a pointer to a TInStream.

mode is a combination of the ios bits defined in iostream.h. See the document open mode constants for a list of the open modes. Used for documents that support named streams, strmId is a pointer to the name of a stream. Override this function to provide streaming for your document class.

Reimplemented in owl::TFileDocument, owl::TFileDocument, and ocf::TStorageDocument.

Definition at line 820 of file docview.h.

◆ IsDirty()

bool owl::TDocument::IsDirty ( )
virtual

Also queries doc and view hierarchy.

Returns true if the document or one of its views has changed but has not been saved.

Definition at line 724 of file document.cpp.

References owl::TDocument::TList::Next(), QueryViews(), and owl::vnIsDirty.

◆ IsEmbedded()

bool owl::TDocument::IsEmbedded ( ) const
inline

Returns true if the document is embedded in an OLE 2 container.

Definition at line 908 of file docview.h.

◆ IsOpen()

bool owl::TDocument::IsOpen ( )
inlinevirtual

Checks to see if the document has any streams in its stream list.

Returns false if no streams are open; otherwise, returns true.

Reimplemented in ocf::TStorageDocument, and owl::TFileDocument.

Definition at line 893 of file docview.h.

◆ NextStream()

TStream * owl::TDocument::NextStream ( const TStream * strm)

Gets the next entry in the stream. Holds 0 if none exists.

Definition at line 467 of file document.cpp.

References owl::TStream::NextStream.

◆ NextView()

TView * owl::TDocument::NextView ( const TView * view)

Gets the next view in the list of views. Holds 0 if none exists.

Definition at line 476 of file document.cpp.

◆ NotifyOwnViews()

bool owl::TDocument::NotifyOwnViews ( int eventId,
TParam2 param = 0,
TView * exclude = 0 )

Notifies the views of this document of a change.

Does not notify views of child documents.

The notification message, WM_OWLNOTIFY, is sent with the given eventId, which is private to the particular document class, and a single generic argument, which will be cast to the actual type of the parameter of the response function. If the optional parameter exclude is set, the appointed view will not be notified.

In contrast to QueryViews, NotifyOwnViews sends the notification message to all views, regardless of the return values. NotifyOwnViews returns true, if and only if all views return true. If a view does not handle the notification, then a true return value is assumed. In other words, NotifyOwnViews will return false only if a view handles the notification and explicitly returns false. In any case, all views are notified.

Definition at line 668 of file document.cpp.

References WM_OWLNOTIFY.

◆ NotifyViews()

bool owl::TDocument::NotifyViews ( int eventId,
TParam2 param = 0,
TView * exclude = 0 )

Notifies the views of this document, and the views of any child documents, of a change.

The notification message, WM_OWLNOTIFY, is sent with the given eventId, which is private to the particular document class, and a single generic argument, which will be cast to the actual type of the parameter of the response function. If the optional parameter exclude is set, the appointed view will not be notified.

In contrast to QueryViews, NotifyViews sends the notification message to all views, regardless of the return values. NotifyViews returns true, if and only if all views return true. If a view does not handle the notification, then a true return value is assumed. In other words, NotifyViews will return false only if a view handles the notification and explicitly returns false. In any case, all views are notified.

Definition at line 629 of file document.cpp.

References owl::TDocument::TList::Next(), and WM_OWLNOTIFY.

◆ Open() [1/2]

bool owl::TDocument::Open ( int mode,
const tstring & path )
inline

Definition at line 236 of file docview.h.

References Open().

◆ Open() [2/2]

bool owl::TDocument::Open ( int mode,
LPCTSTR path = 0 )
inlinevirtual

Opens the document using the path specified by DocPath.

Sets OpenMode to mode. TDocument::Open always returns true and actually performs no actions. Other classes override this function to open specified file documents and views.

Reimplemented in ocf::TOleDocument, owl::TFileDocument, owl::TFileDocument, and ocf::TStorageDocument.

Definition at line 840 of file docview.h.

◆ OutStream() [1/2]

TOutStream * owl::TDocument::OutStream ( int mode,
const tstring & streamId )
inline

Definition at line 233 of file docview.h.

References OutStream().

◆ OutStream() [2/2]

TOutStream * owl::TDocument::OutStream ( int mode,
LPCTSTR strmId = 0 )
inlinevirtual

Generic output for the particular storage medium, OutStream returns a pointer to a TOutStream.

mode is a combination of the ios bits defined in iostream.h. Used for documents that support named streams, strmId points to the name of the stream. TDocument::OutStream version always returns 0. Override this function to provide streaming for your document class.

Reimplemented in owl::TFileDocument, owl::TFileDocument, and ocf::TStorageDocument.

Definition at line 831 of file docview.h.

◆ PostError()

uint owl::TDocument::PostError ( uint sid,
uint choice = MB_OK )
virtual

Posts the error message passed as a string resource ID in sid.

choice is one or more of the MB_Xxxx style constants.

Definition at line 808 of file document.cpp.

References owl::TDocManager::PostDocError().

◆ PropertyCount()

int owl::TDocument::PropertyCount ( )
inlinevirtual

Gets the total number of properties for the TDocument object.

Returns NextProperty -1.

Reimplemented in ocf::TStorageDocument, and owl::TFileDocument.

Definition at line 901 of file docview.h.

References NextProperty.

◆ PropertyFlags()

int owl::TDocument::PropertyFlags ( int index)
virtual

pfXxxxx bit array

Returns the attributes of a specified property given the index (index) of the property whose attributes you want to retrieve.

Reimplemented in ocf::TStorageDocument, and owl::TFileDocument.

Definition at line 166 of file document.cpp.

References _T, NextProperty, PrevProperty, and TRACEX.

◆ PropertyName()

LPCTSTR owl::TDocument::PropertyName ( int index)
virtual

locale invariant name

Returns the name of the property given the index value (index).

Reimplemented in ocf::TStorageDocument, and owl::TFileDocument.

Definition at line 147 of file document.cpp.

References _T, NextProperty, PrevProperty, and TRACEX.

◆ QueryViews()

TView * owl::TDocument::QueryViews ( int eventId,
TParam2 param = 0,
TView * exclude = 0 )

Queries the views of the current document, and the views of any child documents, about a specified event.

The notification message, WM_OWLNOTIFY, is sent with the given eventId, which is private to the particular document class, and a single generic argument, which will be cast to the actual type of the parameter of the response function. If the optional parameter exclude is set, the appointed view will not be queried.

In contrast to NotifyViews, the query stops at the first view that returns true, and the pointer to the view is returned. If no view returns true, nullptr is returned.

Definition at line 699 of file document.cpp.

References owl::TDocument::TList::Next(), and WM_OWLNOTIFY.

◆ Revert()

bool owl::TDocument::Revert ( bool clear = false)
virtual

abort changes, no reload if true

Performs the reverse of Commit() and cancels any changes made to the document since the last commit.

If clear is true, data is not reloaded for views. Revert also checks all child documents and cancels any changes if all children return true. When a file is closed, the document manager calls either Commit() or Revert. Returns true if the operation is successful.

Reimplemented in ocf::TOleDocument, ocf::TStorageDocument, and owl::TFileDocument.

Definition at line 604 of file document.cpp.

References owl::TDocument::TList::Next(), NotifyViews(), and owl::vnRevert.

◆ RootDocument()

TDocument & owl::TDocument::RootDocument ( )
virtual

Returns the this pointer as the root document.

Definition at line 331 of file document.cpp.

◆ SetDirty()

void owl::TDocument::SetDirty ( bool dirty = true)
inline

Updates the document's dirty flag using the specified parameter.

Definition at line 885 of file docview.h.

◆ SetDocManager()

void owl::TDocument::SetDocManager ( TDocManager & dm)

Sets the current document manager to the argument dm.

Definition at line 343 of file document.cpp.

References owl::TDocument::TList::Remove().

◆ SetDocPath() [1/2]

bool owl::TDocument::SetDocPath ( const tstring & path)
inline

Definition at line 252 of file docview.h.

References SetDocPath().

◆ SetDocPath() [2/2]

bool owl::TDocument::SetDocPath ( LPCTSTR path)
virtual

◆ SetEmbedded()

void owl::TDocument::SetEmbedded ( bool embed)
inline

Marks the document as being embedded in an OLE 2 container.

Typically, this happens when the server is created and when the factory template class creates the component.

Definition at line 917 of file docview.h.

◆ SetOpenMode()

void owl::TDocument::SetOpenMode ( int mode)
inline

Sets the mode and protection flag values for the current document.

Definition at line 993 of file docview.h.

◆ SetProperty()

bool owl::TDocument::SetProperty ( int index,
const void * src )
virtual

native type

Sets the value of the property, given index, the index value of the property, and src, the data type (either binary or text) to which the property must be set.

Reimplemented in ocf::TStorageDocument, and owl::TFileDocument.

Definition at line 286 of file document.cpp.

References _T, DocTitle, SetDocPath(), SetTitle(), StoragePath, and TRACEX.

◆ SetTag()

void owl::TDocument::SetTag ( void ** tag)
inline

Attach an arbitrary (user-defined) pointer with this document.

Note
The 'Tag' is a place-holder. It is not used by the Doc/View subsystem.

Definition at line 968 of file docview.h.

◆ SetTemplate()

bool owl::TDocument::SetTemplate ( TDocTemplate * tpl)

Sets the document template.

However, if the template type is incompatible with the file, the document manager will refuse to save the file as this template type.

Definition at line 396 of file document.cpp.

References CHECK, owl::TDocManager::RefTemplate(), and owl::TDocManager::UnRefTemplate().

◆ SetTitle() [1/2]

void owl::TDocument::SetTitle ( const tstring & title)
inline

Definition at line 256 of file docview.h.

References SetTitle().

◆ SetTitle() [2/2]

void owl::TDocument::SetTitle ( LPCTSTR title)
virtual

Sets the title of the document.

Definition at line 380 of file document.cpp.

References strnewdup().

Friends And Related Symbol Documentation

◆ TDocManager

Definition at line 350 of file docview.h.

◆ TDocTemplate

access to InitView()

Definition at line 347 of file docview.h.

◆ TList

friend class TList
friend

access to NextDoc

Definition at line 351 of file docview.h.

◆ TStream

access to Attach/DetachStream()

Definition at line 349 of file docview.h.

◆ TView

friend class TView
friend

access to Attach/DetatchView()

Definition at line 348 of file docview.h.


The documentation for this class was generated from the following files: