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

Derived from TDocument, TFileDocument opens and closes views and provides stream support for views. More...

#include <owl/filedoc.h>

Inheritance diagram for owl::TFileDocument:
owl::TDocument owl::TStreamableBase

Public Types

enum  TFileDocProp { PrevProperty = TDocument::NextProperty-1 , CreateTime , ModifyTime , AccessTime , StorageSize , FileHandle , NextProperty }
 Contains constants that define the following properties of the document: More...
 
- Public Types inherited from owl::TDocument
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

bool Open (int mode, LPCTSTR path=0)
 Overrides TDocument::Open and opens the file using the specified path.
 
bool Close ()
 < String-aware overload
 
TInStreamInStream (int mode, LPCTSTR strmId=0)
 Overrides TDocument::InStream and provides generic input for the particular storage medium.
 
TOutStreamOutStream (int mode, LPCTSTR strmId=0)
 < String-aware overload
 
bool Commit (bool force=false)
 < String-aware overload
 
bool Revert (bool clear=false)
 Calls TDocument::Revert to notify the views to refresh their data.
 
int FindProperty (LPCTSTR name)
 return index
 
int PropertyFlags (int index)
 < String-aware overload
 
LPCTSTR PropertyName (int index)
 Returns the text name of the property given the index value.
 
int GetProperty (int index, void *dest, int textlen=0)
 Overrides TDocument::GetProperty.
 
bool SetProperty (int index, const void *src)
 Sets the property data, which must be in the native data type (either string or binary).
 
bool Open (HFILE fhdl)
 open on existing file handle
 
virtual bool Open (int mode, LPCTSTR path=nullptr)
 Opens the document using the path specified by DocPath.
 
bool Open (int mode, const tstring &path)
 
virtual TInStreamInStream (int mode, LPCTSTR strmId=nullptr)
 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=nullptr)
 Generic output for the particular storage medium, OutStream returns a pointer to a TOutStream.
 
TOutStreamOutStream (int mode, const tstring &streamId)
 
virtual int FindProperty (LPCTSTR name)
 return property index
 
int FindProperty (const tstring &name)
 
 TFileDocument (TDocument *parent=0)
 Constructs a TFileDocument object with the optional parent document.
 
 ~TFileDocument ()
 Destroys a TFileDocument object.
 
bool IsOpen ()
 Is nonzero if the document or any streams are open.
 
int PropertyCount ()
 Return the number of property support by this document.
 
- Public Member Functions inherited from owl::TDocument
 TDocument (TDocument *parent=nullptr)
 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.
 
TInStreamInStream (int mode, const tstring &streamId)
 
TOutStreamOutStream (int mode, const tstring &streamId)
 
bool Open (int mode, const tstring &path)
 
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 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=nullptr)
 Notifies the views of this document, and the views of any child documents, of a change.
 
bool NotifyOwnViews (int eventId, TParam2=0, TView *exclude=nullptr)
 Notifies the views of this document of a change.
 
TViewQueryViews (int eventId, TParam2=0, TView *exclude=nullptr)
 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.
 
int FindProperty (const tstring &name)
 
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

HFILE OpenThisFile (int omode, const tstring &fileName, std::streampos *pseekpos)
 Opens the file document after checking the file sharing mode (omode).
 
void CloseThisFile (HFILE fhdl, int omode)
 Closes the file handle if the associated file was opened by TFileDocument.
 
- Protected Member Functions inherited from owl::TDocument
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 TFileInStream
 
class TFileOutStream
 

Detailed Description

Derived from TDocument, TFileDocument opens and closes views and provides stream support for views.

TFileDocument has member functions that continue to process FileNew and FileOpen messages after a view is constructed. You can add support for specialized file types by deriving classes from TFileDocument. TFileDocument makes this process easy by hiding the actual process of storing file types.

Definition at line 34 of file filedoc.h.

Member Function Documentation

◆ FindProperty() [1/2]

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

Definition at line 278 of file docview.h.

◆ 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 from owl::TDocument.

Definition at line 277 of file document.cpp.

◆ InStream() [1/2]

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

Definition at line 234 of file docview.h.

◆ InStream() [2/2]

TInStream * owl::TDocument::InStream ( int mode,
LPCTSTR strmId = nullptr )
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 from owl::TDocument.

Definition at line 233 of file docview.h.

◆ Open() [1/2]

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

Definition at line 239 of file docview.h.

◆ Open() [2/2]

bool owl::TDocument::Open ( int mode,
LPCTSTR path = nullptr )
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 from owl::TDocument.

Definition at line 238 of file docview.h.

◆ OutStream() [1/2]

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

Definition at line 236 of file docview.h.

◆ OutStream() [2/2]

TOutStream * owl::TDocument::OutStream ( int mode,
LPCTSTR strmId = nullptr )
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 from owl::TDocument.

Definition at line 235 of file docview.h.


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