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

TDocManager creates a document manager object that manages the list of current documents and registered templates, handles standard file menu commands, and displays the user-interface for file and view selection boxes. More...

#include <owl/docmanag.h>

Inheritance diagram for owl::TDocManager:
owl::TEventHandler owl::TStreamableBase

Public Member Functions

 TDocManager (int mode, TApplication *app, TDocTemplate *&templateHead=DocTemplateStaticHead)
 The constructor performs the same operations as the first constructor.
 
virtual ~TDocManager ()
 Destruct this DocManager.
 
int GetTemplateCount (TDocument *ofDocType=0, TView *ofViewType=0)
 Count the number of templates, filtering by document type and/or view type as indicated.
 
virtual int GetNewTemplates (TDocTemplate **tplList, int size, bool newDoc)
 Build a list of templates for creating new documents or opening existing documents.
 
virtual int GetSaveTemplates (TDocTemplate **tplList, int size, TDocument &doc, bool sameDoc)
 Build a list of templates for saving documents.
 
virtual int GetViewTemplates (TDocTemplate **tplList, int size, TDocument &doc)
 Build a list of templates for creating views.
 
virtual int GetTemplateDescription (TDocTemplate **tpllist, int tplcount, tchar *buff=0, int size=0)
 Build up a long string containing the template descriptions and file filters for every template in the given list.
 
virtual TDocumentCreateAnyDoc (LPCTSTR path, long flags=0)
 Creates a document based on the directory path and the specified template.
 
virtual TDocumentCreateDoc (TDocTemplate *tpl, LPCTSTR path, TDocument *parent=0, long flags=0)
 CreateDoc creates a document based on the directory path and the specified template.
 
TDocumentInitDoc (TDocument *doc, LPCTSTR path, long flags)
 Initializes the document, using the given path for the document and the given document flags.
 
TDocumentCreateDummyDoc ()
 Creates dummy document.
 
virtual TViewCreateAnyView (TDocument &doc, long flags=0)
 Creates a document view based on the directory path and specified template.
 
TViewCreateView (TDocument &doc, TDocTemplate *tpl=0)
 Create a view on a given document using the given tempalte, or document's template if none given, and then initialize the view.
 
bool SelectSave (TDocument &doc)
 Displays FileSave dialog prompting the user to select a file name for savinng the document.
 
virtual TDocTemplateSelectAnySave (TDocument &doc, bool samedoc=true)
 Select a new docpath for a document from the registered templates supporting the doc.
 
virtual bool FlushDoc (TDocument &doc)
 Method invoked when specified document is about to be closed.
 
virtual TDocTemplateMatchTemplate (LPCTSTR path)
 Returns the first registered template whose pattern matches the given file name.
 
virtual TDocumentGetCurrentDoc ()
 Return doc with focus, else 0.
 
TDocumentFindDocument (LPCTSTR path)
 0 if not found
 
TApplicationGetApplication () const
 Returns the TApplication* object associated with this DocManager.
 
intGetUntitledIndex ()
 Returns the index to be used by an untitled document.
 
TDocTemplateGetTemplateList () const
 Returns a pointer to the list of DocView templates currently registered with the DocManager.
 
TDocument::ListGetDocList ()
 Returns a List of document currently managed by the DocManager.
 
bool IsFlagSet (int flag) const
 Returns true if the specified flag is currently enabled by the DocManager or false otherwise.
 
int GetModeFlags () const
 Returns variable representing the dtXXXX flags [see DOCTPL.H for list] of the DocManager.
 
long GetAdditionalFileDialogFlags () const
 See SelectDocPath for details.
 
void SetAdditionalFileDialogFlags (long)
 See SelectDocPath for details.
 
TDocTemplateGetNextTemplate (TDocTemplate *tpl) const
 Returns template following specified template - Pass in '0' as parameter to get pointer to the template list.
 
void RefTemplate (TDocTemplate &)
 add template ref
 
void UnRefTemplate (TDocTemplate &)
 drop template ref
 
void DeleteTemplate (TDocTemplate &)
 remove from list
 
void AttachTemplate (TDocTemplate &)
 append to list
 
void CmFileOpen ()
 Public to allow direct invocation from app; for backward compatibility.
 
void CmFileNew ()
 Public to allow direct invocation from app; for backward compatibility.
 
void CmFileClose ()
 Public to allow direct invocation from app; for backward compatibility.
 
void CmFileSave ()
 Public to allow direct invocation from app; for backward compatibility.
 
void CmFileSaveAs ()
 Public to allow direct invocation from app; for backward compatibility.
 
void CmFileRevert ()
 Public to allow direct invocation from app; for backward compatibility.
 
void CmViewCreate ()
 Public to allow direct invocation from app; for backward compatibility.
 
virtual void FileOpen ()
 
virtual void FileNew ()
 
virtual void FileClose ()
 If the document can be closed it is closed.
 
virtual void FileSave ()
 
virtual void FileSaveAs ()
 SelectAnySave() is called to get a template.
 
virtual void FileRevert ()
 
virtual void ViewCreate ()
 Calls CreateAnyView(*doc) where doc is the current document.
 
virtual uint PostDocError (TDocument &doc, uint sid, uint choice=MB_OK)
 Displays a message box with the error message passed as a string resource ID in sid.
 
virtual void PostEvent (int id, TDocument &doc)
 changed doc status
 
virtual void PostEvent (int id, TView &view)
 changed view status
 
virtual void UpdateFileMenu (TMenu &menubar)
 Update the specified menu bar by removing the current '&File' popup menu [assumed to be the first popup of the menubar] and replacing it with the ObjectWindows' standard File popup menu resource.
 
bool NotifyAllDocs (int event, long item, TView *exclude)
 Notifies the views of all documents and the views of any child documents of a change.
 
void EvPreProcessMenu (HMENU hMenu)
 Preprocess the app frame's menu to replace the file menu with one managed by this docmanager.
 
bool EvCanClose ()
 Checks to see if all child documents can be closed before closing the current document.
 
void EvWakeUp ()
 Used only after streaming in the doc manager, EvWakeUp allows for the windows to be created after the streaming has occurred.
 
- Public Member Functions inherited from owl::TEventHandler
virtual bool Find (TEventInfo &info, TEqualOperator op=0)
 Searches the list of response table entries looking for a match.
 
TResult Dispatch (TEventInfo &info, TParam1, TParam2=0)
 Takes the message data from TEventInfo's Msg data member and dispatches it to the correct event-handling function.
 
TResult DispatchMsg (TMsgId, uint id, TParam1, TParam2)
 Search for the event given the message and it and dispatch to the event handler if found.
 
- Public Member Functions inherited from owl::TStreamableBase
virtual ~TStreamableBase ()
 

Static Public Member Functions

static bool IsAMatch (LPCTSTR path, LPCTSTR fltr)
 Helper function used by 'MatchTemplate'.
 
static bool MatchFilter (LPCTSTR path, LPCTSTR filters)
 Helper function used by 'MatchTemplate'.
 

Protected Member Functions

void Init (int mode, TApplication *app, TDocTemplate *&templateHead)
 Helper routine used by constructor(s)
 
virtual int SelectDocType (TDocTemplate **tpllist, int tplcount)
 Given a list of templates, lets the user select a document type from a list of document templates.
 
virtual int SelectDocPath (TDocTemplate **tpllist, int tplcount, tchar *path, int buflen, long flags, bool save=false, TDocument *doc=NULL)
 Given a list of templates, prompts the user to select one of the templates to use for the file to be opened.
 
virtual int SelectViewType (TDocTemplate **tpllist, int tplcount)
 Given a list of templates, lets the user select a view name for a new view from a list of view names.
 
virtual bool CreatingDoc (TDocTemplate *tpl)
 Overrideable method invoked just before the DocumentManager creates a new document.
 
- Protected Member Functions inherited from owl::TEventHandler
bool SearchEntries (const TGenericTableEntry *entries, TEventInfo &info, TEqualOperator op)
 Low-level response table search function.
 

Protected Attributes

int UntitledIndex
 Index of last untitled document.
 
uint NextViewId
 Next ID to be assigned to a view.
 

Friends

class TDocTemplate
 
class TDocument
 

Additional Inherited Members

- Public Types inherited from owl::TEventHandler
typedef bool(* TEqualOperator) (const TGenericTableEntry &, const TEventInfo &)
 

Detailed Description

TDocManager creates a document manager object that manages the list of current documents and registered templates, handles standard file menu commands, and displays the user-interface for file and view selection boxes.

To provide support for documents and views, an instance of TDocManager must be created by the application and attached to the application.

The document manager normally handles events on behalf of the documents by using a response table to process the standard CM_FILENEW, CM_FILEOPEN, CM_FILECLOSE, CM_FILESAVE, CM_FILESAVEAS, CM_FILEREVERT, CM_FILEPRINT, CM_FILEPRINTERSETUP, and CM_VIEWCREATE File menu commands. In response to a CM_FILENEW or a CM_FILEOPEN command, the document manager creates the appropriate document based on the user's selections. In response to the other commands, the document manager determines which of the open documents contains the view associated with the window that has focus. The menu commands are first sent to the window that is in focus and then through the parent window chain to the main window and finally to the application, which forwards the commands to the document manager.

When you create a TDocManager or a derived class, you must specify that it has either a multi-document (dmMDI) or single-document (dmSDI) interface. In addition, if you want the document manager to handle the standard file commands, you must OR dmMDI or dmSDI with dmMenu.

You can also enable or disable the document manager menu options by passing dmSaveEnable or dmNoRevert in the constructor. If you want to enable the File|Save menu option if the document is unmodified, pass the dmSaveEnable flag in the constructor. To disable the "Revert to Saved" menu option, pass dmNoRevert in the constructor.

When the application directly creates a new document and view, it can attach the view to its frame window, create MDI children, float the window, or create a splitter. However, when the document manager creates a new document and view from the File|Open or File|New menu selection, the application doesn't control the process. To give the application control, the document manager sends messages after the new document and view are successfully created. Then, the application can use the information contained in the template to determine how to install the new document or view object.

Definition at line 104 of file docmanag.h.

Constructor & Destructor Documentation

◆ TDocManager()

owl::TDocManager::TDocManager ( int mode,
TApplication * app,
TDocTemplate *& templateHead = DocTemplateStaticHead )

The constructor performs the same operations as the first constructor.

The additional app parameter, however, points to the application associated with this document.

Definition at line 197 of file docmanag.cpp.

◆ ~TDocManager()

owl::TDocManager::~TDocManager ( )
virtual

Destruct this DocManager.

Close all open documents (views close with them), and delete all non-static doc templates

Destroys a TDocManager object removes attached documents templates. The constructor resets TDocTemplate::DocTemplateStaticHead to point to the head of the static template list.

Definition at line 233 of file docmanag.cpp.

References GetApplication(), owl::TDocument::TList::Next(), and owl::TMsgThread::PumpWaitingMessages().

Member Function Documentation

◆ AttachTemplate()

void owl::TDocManager::AttachTemplate ( TDocTemplate & tpl)

append to list

Adds a template to the template list managed by the DocManager.

Definition at line 1221 of file docmanag.cpp.

References owl::TRegLink::AddLink().

◆ CmFileClose()

void owl::TDocManager::CmFileClose ( )
inline

Public to allow direct invocation from app; for backward compatibility.

Call virtual member FileClose() instead.

Definition at line 499 of file docmanag.h.

References FileClose().

◆ CmFileNew()

void owl::TDocManager::CmFileNew ( )
inline

Public to allow direct invocation from app; for backward compatibility.

Call virtual member FileNew() instead.

Definition at line 491 of file docmanag.h.

References FileNew().

◆ CmFileOpen()

void owl::TDocManager::CmFileOpen ( )
inline

Public to allow direct invocation from app; for backward compatibility.

Call virtual member FileOpen() instead.

Definition at line 483 of file docmanag.h.

References FileOpen().

◆ CmFileRevert()

void owl::TDocManager::CmFileRevert ( )
inline

Public to allow direct invocation from app; for backward compatibility.

Call virtual member FileRevert() instead.

Definition at line 523 of file docmanag.h.

References FileRevert().

◆ CmFileSave()

void owl::TDocManager::CmFileSave ( )
inline

Public to allow direct invocation from app; for backward compatibility.

Call virtual member FileSave() instead.

Definition at line 507 of file docmanag.h.

References FileSave().

◆ CmFileSaveAs()

void owl::TDocManager::CmFileSaveAs ( )
inline

Public to allow direct invocation from app; for backward compatibility.

Call virtual member FileSaveAs() instead.

Definition at line 515 of file docmanag.h.

References FileSaveAs().

◆ CmViewCreate()

void owl::TDocManager::CmViewCreate ( )
inline

Public to allow direct invocation from app; for backward compatibility.

Call virtual member ViewCreate() instead.

Definition at line 532 of file docmanag.h.

References ViewCreate().

◆ CreateAnyDoc()

TDocument * owl::TDocManager::CreateAnyDoc ( LPCTSTR path,
long flags = 0 )
virtual

Creates a document based on the directory path and the specified template.

The parameter flags, one of the document template constants, determines how the document template is created. If path is 0 and this is not a new document (the flag dtNewDoc is not set), it displays a dialog box. If path is 0 and dtNewDoc is not set and more than one template exists, CreateAnyDoc displays a dialog box and a list of templates.

Definition at line 521 of file docmanag.cpp.

References _MAX_PATH, _T, _tcscpy, COUNTOF, CreateDoc(), owl::dtNewDoc, FindDocument(), GetNewTemplates(), PostDocError(), SelectDocPath(), SelectDocType(), TRACEX, and WARNX.

◆ CreateAnyView()

TView * owl::TDocManager::CreateAnyView ( TDocument & doc,
long flags = 0 )
virtual

Creates a document view based on the directory path and specified template.

The parameter flags, one of the document template constants, determines how the document template is created.

Create (Construct and Init) a view from registered templates supporting a given doc.

This implementation allows user intervention if there is more than one template available, by calling SelectViewType()

Definition at line 771 of file docmanag.cpp.

References _T, CHECK, CreateView(), GetTemplateCount(), GetViewTemplates(), SelectViewType(), and WARNX.

◆ CreateDoc()

TDocument * owl::TDocManager::CreateDoc ( TDocTemplate * tpl,
LPCTSTR path,
TDocument * parent = 0,
long flags = 0 )
virtual

CreateDoc creates a document based on the directory path and the specified template.

The flags parameter contains one of the document template constants that determines how the document is created.

Definition at line 603 of file docmanag.cpp.

References _T, CreatingDoc(), InitDoc(), and TRACEX.

◆ CreateDummyDoc()

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

Creates dummy document.

Definition at line 474 of file docmanag.h.

References TDocument.

◆ CreateView()

TView * owl::TDocManager::CreateView ( TDocument & doc,
TDocTemplate * tpl = 0 )

Create a view on a given document using the given tempalte, or document's template if none given, and then initialize the view.

Return the view if all was OK, or 0 if something failed.

Definition at line 816 of file docmanag.cpp.

References _T, CHECK, and WARNX.

◆ CreatingDoc()

bool owl::TDocManager::CreatingDoc ( TDocTemplate * tpl)
protectedvirtual

Overrideable method invoked just before the DocumentManager creates a new document.

The default behaviour is to close and delete the current document if we're in SDI mode.

Definition at line 1481 of file docmanag.cpp.

References owl::dmSDI, owl::TDocument::TList::Next(), and PostDocError().

◆ DeleteTemplate()

void owl::TDocManager::DeleteTemplate ( TDocTemplate & tpl)

remove from list

Removes a template from the list of templates currently managed by the DocManager.

Definition at line 1232 of file docmanag.cpp.

References _T, owl::TRegLink::RemoveLink(), TRACEX, and UnRefTemplate().

◆ EvCanClose()

bool owl::TDocManager::EvCanClose ( )

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

If any child returns false, returns false and aborts the process. If all children return true, EvCanClose calls TDocManager::FlushDoc for each document. If FlushDoc finds that the document is dirty, it displays a message asking the user to save the document, discard any changes, or cancel the operation. If the document is not dirty and CanClose returns true, EvCanClose returns true.

Definition at line 1557 of file docmanag.cpp.

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

◆ EvPreProcessMenu()

void owl::TDocManager::EvPreProcessMenu ( HMENU hMenuBar)

Preprocess the app frame's menu to replace the file menu with one managed by this docmanager.

Called from MainWindow, EvPreProcessMenu loads and deletes a menu at the position specified by MF_POSITION or MF_POPUP. Your application can call EvPreProcessMenu to process the main window's menu before it is displayed.

Definition at line 1576 of file docmanag.cpp.

References owl::dmMenu, and UpdateFileMenu().

◆ EvWakeUp()

void owl::TDocManager::EvWakeUp ( )

Used only after streaming in the doc manager, EvWakeUp allows for the windows to be created after the streaming has occurred.

Definition at line 1589 of file docmanag.cpp.

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

◆ FileClose()

void owl::TDocManager::FileClose ( )
virtual

If the document can be closed it is closed.

Definition at line 1649 of file docmanag.cpp.

References _T, GetCurrentDoc(), PostDocError(), and WARNX.

◆ FileNew()

void owl::TDocManager::FileNew ( )
virtual

Definition at line 1613 of file docmanag.cpp.

References CreateAnyDoc(), and owl::dtNewDoc.

◆ FileOpen()

void owl::TDocManager::FileOpen ( )
virtual

Definition at line 1631 of file docmanag.cpp.

References CreateAnyDoc().

◆ FileRevert()

void owl::TDocManager::FileRevert ( )
virtual

Definition at line 1734 of file docmanag.cpp.

References GetCurrentDoc(), and PostDocError().

◆ FileSave()

void owl::TDocManager::FileSave ( )
virtual

Definition at line 1704 of file docmanag.cpp.

References CmFileSaveAs(), owl::dmSaveEnable, GetCurrentDoc(), and PostDocError().

◆ FileSaveAs()

void owl::TDocManager::FileSaveAs ( )
virtual

SelectAnySave() is called to get a template.

Then the Commit() function is called for the current document.

Definition at line 1676 of file docmanag.cpp.

References owl::dnRename, GetCurrentDoc(), PostEvent(), and SelectAnySave().

◆ FindDocument()

TDocument * owl::TDocManager::FindDocument ( LPCTSTR path)

0 if not found

Returns a pointer to the TDocument object if the specified document is currently opened and manager by the DocManager.

Returns 0 otherwise.

Definition at line 1200 of file docmanag.cpp.

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

◆ FlushDoc()

bool owl::TDocManager::FlushDoc ( TDocument & doc)
virtual

Method invoked when specified document is about to be closed.

Updates the document with any changes and prompts the user for confirmation of updates. Returns 'true' if DocManager should proceed with the closing stages of the document, or 'false' otherwise.

Definition at line 914 of file docmanag.cpp.

References PostDocError(), and SelectAnySave().

◆ GetAdditionalFileDialogFlags()

long owl::TDocManager::GetAdditionalFileDialogFlags ( ) const
inline

See SelectDocPath for details.

Definition at line 457 of file docmanag.h.

◆ GetApplication()

TApplication * owl::TDocManager::GetApplication ( ) const
inline

Returns the TApplication* object associated with this DocManager.

Definition at line 395 of file docmanag.h.

◆ GetCurrentDoc()

TDocument * owl::TDocManager::GetCurrentDoc ( )
virtual

Return doc with focus, else 0.

Calls TWindow::GetFocus() to determine the window with the focus.

Searches the list of documents and returns the document that contains the view with the focus. Returns 0 if no document has a view with focus.

Definition at line 1156 of file docmanag.cpp.

References GetApplication(), owl::TFrameWindow::GetCommandTarget(), owl::TApplication::GetMainWindow(), owl::TDocument::TList::Next(), and PRECONDITION.

◆ GetDocList()

TDocument::List & owl::TDocManager::GetDocList ( )
inline

Returns a List of document currently managed by the DocManager.

Definition at line 449 of file docmanag.h.

◆ GetModeFlags()

int owl::TDocManager::GetModeFlags ( ) const
inline

Returns variable representing the dtXXXX flags [see DOCTPL.H for list] of the DocManager.

Definition at line 413 of file docmanag.h.

◆ GetNewTemplates()

int owl::TDocManager::GetNewTemplates ( TDocTemplate ** tplList,
int size,
bool newDoc )
virtual

Build a list of templates for creating new documents or opening existing documents.

Return the number of templates in the list. Passing 0 for tplList skips the actual creation of the list, useful for pre-counting. size is only used in the debug version.

Definition at line 304 of file docmanag.cpp.

References _T, CHECK, owl::dtForbidNew, owl::dtReadOnly, and TRACEX.

◆ GetNextTemplate()

TDocTemplate * owl::TDocManager::GetNextTemplate ( TDocTemplate * tpl) const
inline

Returns template following specified template - Pass in '0' as parameter to get pointer to the template list.

Definition at line 422 of file docmanag.h.

◆ GetSaveTemplates()

int owl::TDocManager::GetSaveTemplates ( TDocTemplate ** tplList,
int size,
TDocument & doc,
bool sameDoc )
virtual

Build a list of templates for saving documents.

Return the number of templates in the list. Passing 0 for tplList skips the actual creation of the list, useful for pre-counting. size is only used in the debug version.

Definition at line 342 of file docmanag.cpp.

References _T, CHECK, owl::dtReadOnly, and TRACEX.

◆ GetTemplateCount()

int owl::TDocManager::GetTemplateCount ( TDocument * ofDocType = 0,
TView * ofViewType = 0 )

Count the number of templates, filtering by document type and/or view type as indicated.

Definition at line 272 of file docmanag.cpp.

References _T, and TRACEX.

◆ GetTemplateDescription()

int owl::TDocManager::GetTemplateDescription ( TDocTemplate ** tpllist,
int tplcount,
tchar * buff = 0,
int size = 0 )
virtual

Build up a long string containing the template descriptions and file filters for every template in the given list.

Return the length of the buffer needed. Passing 0 for buffer skips actual buffer writing. size is only used in the debug version. String will be in the form:

"<descr1> (<filter1>)|(<filter1>)|<descr2> (<filter2>)|(<filter2>)|"

Definition at line 448 of file docmanag.cpp.

References _T, _tcscat, _tcslen, and CHECK.

◆ GetTemplateList()

TDocTemplate * owl::TDocManager::GetTemplateList ( ) const
inline

Returns a pointer to the list of DocView templates currently registered with the DocManager.

Definition at line 441 of file docmanag.h.

◆ GetUntitledIndex()

int & owl::TDocManager::GetUntitledIndex ( )
inline

Returns the index to be used by an untitled document.

Note
Untitled indices start at '0' and are incremented after a new document is created.

Definition at line 432 of file docmanag.h.

References UntitledIndex.

◆ GetViewTemplates()

int owl::TDocManager::GetViewTemplates ( TDocTemplate ** tplList,
int size,
TDocument & doc )
virtual

Build a list of templates for creating views.

Return the number of templates in the list. size is only used in the debug version.

Note
To find out ahead of time how many templates match a particular document type, use 'GetTemplateCount(docType);'

Definition at line 383 of file docmanag.cpp.

References _T, CHECK, owl::dtSingleView, and TRACEX.

◆ Init()

void owl::TDocManager::Init ( int mode,
TApplication * app,
TDocTemplate *& templateHead )
protected

Helper routine used by constructor(s)

Helper routine used by constructors.

Common initialization for TDocManager constructors (above constructor, & compatable constructor below)

Definition at line 209 of file docmanag.cpp.

References PRECONDITION, and UntitledIndex.

◆ InitDoc()

TDocument * owl::TDocManager::InitDoc ( TDocument * doc,
LPCTSTR path,
long flags )

Initializes the document, using the given path for the document and the given document flags.

Prompts for pathname using TDocManager::SelectDocPath, if no path is supplied and not creating a new document (i.e. the dtNewDoc flag is not set). If the user cancels the dialog, the document is deleted and nullptr is returned.

See also
See Doc/View classes for valid flags, such as dtAutoDelete and dtNewDoc.
Note
Unless an exception is thrown, ownership of the given TDocument is taken on failure. In particular, the document will be deleted if it cannot be properly initialized, if it cannot be opened successfully (for dtAutoOpen), and unless dtNoAutoView is set, if creation of the view fails. In these cases the function deletes the document and returns nullptr.

Definition at line 665 of file docmanag.cpp.

References _MAX_PATH, _T, CHECKX, COUNTOF, CreateView(), owl::dnCreate, owl::dtAutoOpen, owl::dtNewDoc, owl::dtNoAutoView, owl::dtNoReadOnly, owl::ofRead, owl::ofReadWrite, PostDocError(), PostEvent(), PRECONDITION, SelectDocPath(), and TRACEX.

◆ IsAMatch()

bool owl::TDocManager::IsAMatch ( LPCTSTR path,
LPCTSTR fltr )
static

Helper function used by 'MatchTemplate'.

Returns true if the specified file name (path) matches the pattern of the 'filter' parameter. Returns false otherwise.

Definition at line 1108 of file docmanag.cpp.

References _T, _tcsrchr, owl::TFileName::Ext, owl::TFileName::File, nstrnewdup, PRECONDITION, and TRACEX.

◆ IsFlagSet()

bool owl::TDocManager::IsFlagSet ( int flag) const
inline

Returns true if the specified flag is currently enabled by the DocManager or false otherwise.

Definition at line 404 of file docmanag.h.

◆ MatchFilter()

bool owl::TDocManager::MatchFilter ( LPCTSTR path,
LPCTSTR filters )
static

Helper function used by 'MatchTemplate'.

Returns true if the specified file name (path) matches any of the patterns of the 'filters' parameter. Returns false otherwise.

Definition at line 1027 of file docmanag.cpp.

References _T, _tcschr, IsAMatch(), and nstrnewdup.

◆ MatchTemplate()

TDocTemplate * owl::TDocManager::MatchTemplate ( LPCTSTR path)
virtual

Returns the first registered template whose pattern matches the given file name.

If no template is compatible with the supplied file name, or if the template is open already, it returns 0.

This implementation compares the path's extension with the ';' separated filter lists in each template looking for a case-insensitive match. Allows '?'s in the template filters to match any character in the path's extension

Example:

The path: "documents.1995\accounts_receivable.plan"

Would match the filter: "*.xls;*.wk?;*.plan"

Definition at line 1000 of file docmanag.cpp.

References owl::dtHidden, and MatchFilter().

◆ NotifyAllDocs()

bool owl::TDocManager::NotifyAllDocs ( int event,
long item,
TView * exclude )

Notifies the views of all documents and the views of any child documents of a change.

Returns true if all views returned a true result.

Definition at line 1531 of file docmanag.cpp.

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

◆ PostDocError()

uint owl::TDocManager::PostDocError ( TDocument & doc,
uint sid,
uint choice = MB_OK )
virtual

Displays a message box with the error message passed as a string resource ID in sid.

By default, the message box contains either an OK push button or a question mark icon. If an error message can't be found, PostDocError displays a "Message not found" message. choice can be one or more of the MB_Xxxx message style constants. This function can be overridden.

Returns an integer identifying the MessageBox option (push-button) selected by the user.

Definition at line 1272 of file docmanag.cpp.

References _stprintf, _T, GetApplication(), owl::TApplication::GetMainWindow(), owl::TWindow::MessageBox(), and PRECONDITION.

◆ PostEvent() [1/2]

void owl::TDocManager::PostEvent ( int id,
TDocument & doc )
virtual

changed doc status

Post a OWL-defined message regarding an event [identified by the 'id' parameter] related to the specified document ('doc').

If the current document changes, posts a WM_OWLDOCUMENT message to indicate a change in the status of the document.

Definition at line 1298 of file docmanag.cpp.

References GetApplication(), owl::TWindow::GetHandle(), owl::TApplication::GetMainWindow(), owl::TWindow::SendMessage(), and WM_OWLDOCUMENT.

◆ PostEvent() [2/2]

void owl::TDocManager::PostEvent ( int id,
TView & view )
virtual

changed view status

Post a OWL-defined message regarding an event [identified by the 'id' parameter] related to the specified view ('view').

If the current view changes, posts a WM_OWLVIEW message to indicate a change in the status of the view.

Definition at line 1313 of file docmanag.cpp.

References GetApplication(), owl::TWindow::GetHandle(), owl::TApplication::GetMainWindow(), owl::TWindow::SendMessage(), and WM_OWLVIEW.

◆ RefTemplate()

void owl::TDocManager::RefTemplate ( TDocTemplate & tpl)
inline

add template ref

Increment the reference count of a DocView template to indicate that it's currently in use by the DocManager.

Definition at line 377 of file docmanag.h.

◆ SelectAnySave()

TDocTemplate * owl::TDocManager::SelectAnySave ( TDocument & doc,
bool samedoc = true )
virtual

Select a new docpath for a document from the registered templates supporting the doc.

Definition at line 862 of file docmanag.cpp.

References _MAX_PATH, _T, _tcscpy, CHECK, COUNTOF, GetSaveTemplates(), SelectDocPath(), and WARNX.

◆ SelectDocPath()

int owl::TDocManager::SelectDocPath ( TDocTemplate ** tpllist,
int tplcount,
tchar * path,
int buflen,
long flags,
bool save = false,
TDocument * doc = NULL )
protectedvirtual

Given a list of templates, prompts the user to select one of the templates to use for the file to be opened.

Returns the template index used for the selection, or 0 if unsuccessful. For a file open operation, save is false. For a file save operation, save is true. This function can be overridden to provide a customized user interface.

Note
This is Windows-specific, using the system-provided file open dialog box

Definition at line 1352 of file docmanag.cpp.

References _T, _tcslen, _tcsncpy, CHECK, CONST_CAST, owl::dtSelected, owl::TDialog::Execute(), GetApplication(), GetCurrentDoc(), owl::TApplication::GetMainWindow(), GetTemplateDescription(), IsFlagSet(), and WARNX.

◆ SelectDocType()

int owl::TDocManager::SelectDocType ( TDocTemplate ** tpllist,
int tplcount )
protectedvirtual

Given a list of templates, lets the user select a document type from a list of document templates.

Returns the template index used for the selection, or 0 if unsuccessful. SelectDocType can be overridden.

TH This does not look right, crashes when user cancels twice

Definition at line 1328 of file docmanag.cpp.

References CHECK, and GetApplication().

◆ SelectSave()

bool owl::TDocManager::SelectSave ( TDocument & doc)

Displays FileSave dialog prompting the user to select a file name for savinng the document.

Filters out read-only files.

Definition at line 840 of file docmanag.cpp.

References _MAX_PATH, _tcscpy, COUNTOF, and SelectDocPath().

◆ SelectViewType()

int owl::TDocManager::SelectViewType ( TDocTemplate ** tpllist,
int tplcount )
protectedvirtual

Given a list of templates, lets the user select a view name for a new view from a list of view names.

Returns the template index used for the selection or 0 if unsuccessful. SelectViewType can be overridden,

Definition at line 1465 of file docmanag.cpp.

References CHECK, and GetApplication().

◆ SetAdditionalFileDialogFlags()

void owl::TDocManager::SetAdditionalFileDialogFlags ( long flags)
inline

See SelectDocPath for details.

Definition at line 465 of file docmanag.h.

◆ UnRefTemplate()

void owl::TDocManager::UnRefTemplate ( TDocTemplate & tpl)
inline

drop template ref

Decrement the reference count of a DocView template.

Note
The template is deleted when the reference count reaches zero.

Definition at line 386 of file docmanag.h.

◆ UpdateFileMenu()

void owl::TDocManager::UpdateFileMenu ( TMenu & menubar)
virtual

Update the specified menu bar by removing the current '&File' popup menu [assumed to be the first popup of the menubar] and replacing it with the ObjectWindows' standard File popup menu resource.

Definition at line 1504 of file docmanag.cpp.

References _T, owl::dmNoRevert, GetApplication(), owl::GetGlobalModule(), owl::TModule::LoadMenu(), owl::TModule::LoadString(), PRECONDITION, and WARNX.

◆ ViewCreate()

void owl::TDocManager::ViewCreate ( )
virtual

Calls CreateAnyView(*doc) where doc is the current document.

Definition at line 1760 of file docmanag.cpp.

References CreateAnyView(), and GetCurrentDoc().

Friends And Related Symbol Documentation

◆ TDocTemplate

Definition at line 266 of file docmanag.h.

◆ TDocument

Definition at line 267 of file docmanag.h.

Member Data Documentation

◆ NextViewId

uint owl::TDocManager::NextViewId
protected

Next ID to be assigned to a view.

Definition at line 221 of file docmanag.h.

◆ UntitledIndex

int owl::TDocManager::UntitledIndex
protected

Index of last untitled document.

Definition at line 217 of file docmanag.h.


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