10#if !defined(OWL_DOCVIEW_H)
14#if defined(BI_HAS_PRAGMA_ONCE)
22#if !defined(_INC_COMMDLG)
71#if defined(_IOS_Nocreate)
76#if defined(_IOS_Noreplace)
97#define PREV_OPEN (ofNoCreate|ofNoReplace)
98#define IS_PREV_OPEN(omode) ((omode & PREV_OPEN)==PREV_OPEN)
241 virtual bool Close();
242 virtual bool Commit(
bool force=
false);
243 virtual bool Revert(
bool clear=
false);
261 virtual bool IsDirty();
262 void SetDirty(
bool dirty =
true);
264 virtual bool IsOpen();
265 virtual bool CanClose();
276 virtual int PropertyCount();
279 virtual int PropertyFlags(
int index);
280 virtual LPCTSTR PropertyName(
int index);
281 virtual int GetProperty(
int index,
void *
dest,
int textlen=0);
282 virtual bool SetProperty(
int index,
const void *
src);
284 TList& GetChildren();
286 TView* GetViewList()
const;
289 TStream* GetStreamList()
const;
292 void * GetTag()
const;
293 void SetTag(
void* *
tag);
295 int GetOpenMode()
const;
296 void SetOpenMode(
int mode);
300 bool IsEmbedded()
const;
301 void SetEmbedded(
bool embed);
303 virtual bool InitDoc();
309 virtual void AttachStream(
TStream& strm);
310 virtual void DetachStream(
TStream& strm);
313 void DestroyChildren();
345 void ReindexFrames();
425 static uint GetNextViewId();
426 static void BumpNextViewId();
428 TView* GetNextView();
446 virtual int PropertyCount();
449 virtual int PropertyFlags(
int index);
450 virtual LPCTSTR PropertyName(
int index);
451 virtual int GetProperty(
int index,
void *
dest,
int textlen=0);
452 virtual bool SetProperty(
int index,
const void *
src);
454 void * GetTag()
const;
455 void SetTag(
void* *
tag);
475 static uint NextViewId;
478#if OWL_PERSISTENT_STREAMS
479 friend class TDocument::Streamer;
503 auto CanClose() ->
bool override;
507 auto GetViewName() ->
LPCTSTR override;
508 auto GetWindow() ->
TWindow*
override;
510 using TView::SetDocTitle;
541 auto CanClose() ->
bool override;
545 auto GetViewName() ->
LPCTSTR override;
546 auto GetWindow() ->
TWindow*
override;
548 using TView::SetDocTitle;
616#if defined(OWL5_COMPAT)
621#define Dispatch_B_void Dispatch_B
622#define Dispatch_B_int Dispatch_B_I
623#define Dispatch_B_pointer Dispatch_B_POINTER
630#define NOTIFY_SIG(id, arg) \
632 inline bool (T::*id##_Sig(bool (T::*pmf)(arg)))(arg) {return pmf;}
655#if OWL_EV_SIGNATURE_CHECK
661 template <
class T,
void (T::*M)(TDocument&)>
665 return p2 != 0 ? ((
static_cast<T*
>(
i)->*
M)(*
reinterpret_cast<TDocument*
>(
p2)), 0) : 0;
675#if OWL_EV_SIGNATURE_CHECK
681 template <
class T,
void (T::*M)(TView&)>
685 return p2 != 0 ? ((
static_cast<T*
>(
i)->*
M)(*
reinterpret_cast<TView*
>(
p2)), 0) : 0;
697#if OWL_EV_SIGNATURE_CHECK
703 template <
class T,
bool (T::*M)(TParam2)>
707 template <u
int NotificationCode>
714 template <u
int NotificationCode,
class P>
715 struct TNotificationDispatchBase
721#if OWL_EV_SIGNATURE_CHECK
727 template <
class T,
bool (T::*M)(P)>
735 template <u
int NotificationCode>
736 struct TNotificationDispatchBase<NotificationCode,
void>
740 {
return static_cast<bool>(
sendMessage(
wnd, MessageId, NotificationCode));}
742#if OWL_EV_SIGNATURE_CHECK
748 template <
class T,
bool (T::*M)()>
750 {
return (
static_cast<T*
>(
i)->*
M)() ?
TRUE :
FALSE;}
770#define VN_DEFINE(id, method, dispatcher)\
771 {{WM_OWLNOTIFY}, static_cast<::owl::uint>(id), OWL_DISPATCH(dispatcher, method)}
773#if OWL_EV_SIGNATURE_CHECK
778#define VN_DEFINE_STANDARD_(id, method)\
779 {{WM_OWLNOTIFY}, static_cast<::owl::uint>(id),\
780 (::owl::CheckSignature<TMyClass, WM_OWLNOTIFY, static_cast<::owl::uint>(id), ::owl::TDispatch>(&TMyClass::method),\
781 OWL_DISPATCH(::owl::TDispatch<WM_OWLNOTIFY>::TNotificationDispatch<static_cast<::owl::uint>(id)>::Decode, method))}
788#define VN_DEFINE_STANDARD_(id, method)\
789 {{WM_OWLNOTIFY}, static_cast<::owl::uint>(id),\
790 OWL_DISPATCH(::owl::TDispatch<WM_OWLNOTIFY>::TNotificationDispatch<static_cast<::owl::uint>(id)>::Decode, method)}
799#define EV_VN_VIEWOPENED VN_DEFINE_STANDARD_(::owl::vnViewOpened, VnViewOpened)
800#define EV_VN_VIEWCLOSED VN_DEFINE_STANDARD_(::owl::vnViewClosed, VnViewClosed)
801#define EV_VN_DOCOPENED VN_DEFINE_STANDARD_(::owl::vnDocOpened, VnDocOpened)
802#define EV_VN_DOCCLOSED VN_DEFINE_STANDARD_(::owl::vnDocClosed, VnDocClosed)
803#define EV_VN_COMMIT VN_DEFINE_STANDARD_(::owl::vnCommit, VnCommit)
804#define EV_VN_REVERT VN_DEFINE_STANDARD_(::owl::vnRevert, VnRevert)
805#define EV_VN_ISDIRTY VN_DEFINE_STANDARD_(::owl::vnIsDirty, VnIsDirty)
806#define EV_VN_ISWINDOW VN_DEFINE_STANDARD_(::owl::vnIsWindow, VnIsWindow)
897 return StreamList !=
nullptr;
1112 return _T(
"Window View");
1118inline bool TWindowView::VnIsWindow(
HWND hWnd){
1130 (Doc->NextView(
this) ||
1131 Doc->NextView(
nullptr) !=
this ||
1146 return static_cast<TWindow*
>(
this);
1166 return _T(
"Dialog View");
1174 (Doc->NextView(
this) ||
1175 Doc->NextView(
nullptr) !=
this ||
1186 return static_cast<TWindow*
>(
this);
1192inline bool TDialogView::VnIsWindow(
HWND hWnd){
1257#if defined(_CPPLIB_VER)
1258#define OWL_STREAM_NULL_INITIALIZER std::_Noinit
1260#define OWL_STREAM_NULL_INITIALIZER 0
Definition of class TApplication.
#define PRECONDITION(condition)
Descriptor of Bar Implementation.
Typically used to obtain information from a user, a dialog box is a window inside of which other cont...
Derived from TDialog and TView.
auto GetWindow() -> TWindow *override
auto GetViewName() -> LPCTSTR override
~TDialogView() override
class TDialogView
static LPCTSTR StaticName()
auto SetDocTitle(LPCTSTR docname, int index) -> bool override
auto CanClose() -> bool override
Only query document if this is the last view open to it.
TDocManager creates a document manager object that manages the list of current documents and register...
TDocTemplate is an abstract base class that contains document template functionality.
TList()
Constructs a TDocument::TList object.
~TList()
Destroys a TDocument::TList object.
An abstract base class, TDocument is the base class for all document objects and serves as an interfa...
virtual TInStream * InStream(int mode, LPCTSTR strmId=nullptr)
Generic input for the particular storage medium, InStream returns a pointer to a TInStream.
void SetTitle(const tstring &title)
void * GetTag() const
Returns pointer to user-defined data [i.e. tag] attached to this document.
TInStream * InStream(int mode, const tstring &streamId)
TDocument(TDocument *parent=nullptr)
Although you do not create a TDocument object directly, you must call the constructor when you create...
bool Open(int mode, const tstring &path)
TDocTemplate * GetTemplate()
Gets the template used for document creation.
TList & GetChildren()
Return reference to the children document list.
bool SetDocPath(const tstring &path)
virtual void DetachStream(TStream &strm)
called from TStream destructor
virtual bool InitDoc()
A virtual method that is overridden by TOleDocument::InitDoc.
LPCTSTR GetDocPath() const
Returns the directory path for the document.
TStream * GetStreamList() const
Returns head of the link list of streams associated with this document.
virtual void AttachStream(TStream &strm)
called from TStream constructor
int FindProperty(const tstring &name)
TDocManager & GetDocManager()
Returns a pointer to the current document manager.
LPCTSTR GetTitle() const
Returns the title of the document.
virtual int PropertyCount()
Gets the total number of properties for the TDocument object.
void SetTag(void **tag)
Attach an arbitrary (user-defined) pointer with this document.
void SetOpenMode(int mode)
Sets the mode and protection flag values for the current document.
void SetDirty(bool dirty=true)
Updates the document's dirty flag using the specified parameter.
TView * GetViewList() const
Return pointer to the head of the link list of views associated with this document.
bool IsEmbedded() const
Returns true if the document is embedded in an OLE 2 container.
TOutStream * OutStream(int mode, const tstring &streamId)
virtual bool Open(int mode, LPCTSTR path=nullptr)
Opens the document using the path specified by DocPath.
TDocProp
These property values, which describe the basic properties of a document, are available in classes de...
@ TemplateName
text property: Name of template attached to document
@ StoragePath
text property: Identifies object holding data of this document
@ NextProperty
Next index to be used by derived class.
@ ViewCount
int property: Number of views displaying this document
@ DocumentClass
text Property: Name of C++ class encapsulating document
@ DocTitle
text property: Caption of this document
virtual bool IsOpen()
Checks to see if the document has any streams in its stream list.
int GetOpenMode() const
Gets the mode and protection flag values for the current document.
virtual TOutStream * OutStream(int mode, LPCTSTR strmId=nullptr)
Generic output for the particular storage medium, OutStream returns a pointer to a TOutStream.
void SetEmbedded(bool embed)
Marks the document as being embedded in an OLE 2 container.
TDocument * GetParentDoc()
Returns either the parent document of the current document or 0 if there is no parent document.
TEventHandler is a base class from which you can derive classes that handle messages.
Derived from TStream and istream, TInStream is a base class used to define input streams for document...
TInStream(TDocument &doc, LPCTSTR name, int mode)
Constructs a TInStream object.
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
Derived from TStream and ostream, TOutStream is a base class used to create output storage streams fo...
TOutStream(TDocument &doc, LPCTSTR name, int mode)
Constructs a TOutStream object.
An abstract base class, TStream provides links between streams and documents, views,...
TStream * NextStream
Points to the next stream in the list of active streams.
TStream(TDocument &doc, LPCTSTR name, int mode)
Constructs a TStream object.
TDocument & Doc
Stores the document that owns this stream.
int GetOpenMode()
Gets mode flags used when opening document streams.
LPCTSTR GetStreamName()
Gets the name of the stream used for opening the document.
TDocument & GetDocument()
Returns the current document that is open for streaming.
~TStream()
Closes the stream.
Classes that inherit from TStreamableBase are known as streamable classes (their objects can be writt...
Abstract base class for view access from document.
bool IsOK()
true if successfully created
TViewProp
These property values, which describe the basic properties of a view, are available in classes derive...
@ ViewClass
Name of the C++ class encapsulating the view. (text)
@ ViewName
Name of the view. (text)
@ NextProperty
Next index to be used by derived class.
int FindProperty(const tstring &name)
virtual bool SetDocTitle(LPCTSTR docname, int index)
Stores the document title.
uint GetViewId()
Returns the unique ID for this view.
void * GetTag() const
Retrieves the user-defined pointer attached to this view.
TView * GetNextView()
Returns the next global view ID to be assigned.
virtual TMenuDescr * GetViewMenu()
Returns the menu descriptor for this view.
bool SetDocTitle(const tstring &docname, int index)
virtual LPCTSTR GetViewName()=0
Pure virtual function that returns 0.
void SetTag(void **tag)
Associates an arbitrary (user-defined) pointer with this view.
TDocument & GetDocument()
Returns a reference to the view's document.
static uint GetNextViewId()
Next global ID to assign.
virtual TBarDescr * GetViewBar()
virtual int PropertyCount()
Gets the total number of properties for the TDocument object.
virtual TWindow * GetWindow()
Returns the TWindow instance associated with the view, or 0 if no view exists.
void NotOK()
To flag errors in creation.
virtual bool SetProperty(int index, const void *src)
Sets the value of the property, given the index of the property, and src, the data type (either binar...
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
virtual bool SetDocTitle(LPCTSTR docname, int index)
Default behavior for updating document title is to pass it to parent frame.
bool IsChild(HWND hWnd) const
Returns true if the window is a child window or a descendant window of this window.
virtual bool CanClose()
Use this function to determine if it is okay to close a window.
HWND GetHandle() const
Returns the handle of the window.
Derived from both TWindow and TView, TWindowView is a streamable base class that can be used for deri...
auto CanClose() -> bool override
Overrides TWindow::CanClose and returns a nonzero value if the window can be closed.
static LPCTSTR StaticName()
put in resource
auto GetViewName() -> LPCTSTR override
Overrides TView::GetViewName and returns StaticName, the name of the view.
~TWindowView() override
Destroys a TWindowView object and calls the associated document's DetachView function (a private TDoc...
auto SetDocTitle(LPCTSTR docname, int index) -> bool override
Overrides TView::SetDocTitle and stores the document title.
auto GetWindow() -> TWindow *override
Overrides TView::GetWindow and returns the TWindowView object as a TWindow.
Definition of TDialog class and TDialogAttr struct.
#define OWL_STREAM_NULL_INITIALIZER
#define DECLARE_RESPONSE_TABLE(cls)
Definition of class TFrameWindow.
#define DECLARE_STREAMABLE_OWL(cls, ver)
#define DECLARE_ABSTRACT_STREAMABLE_OWL(cls, ver)
TAutoDelete
Flag for Handle ctors to control Handle deletion in dtor.
#define DECLARE_STREAMABLE_INLINES(cls)
const uint pfGetText
property accessible as text format
const uint vnViewOpened
a new view has just been constructed
const uint pfHidden
property should be hidden from normal browse
const uint vnViewClosed
another view is about to be destructed
const uint vnDocClosed
document has just been closed
const uint vnDocOpened
document has just been opened
const uint pfConstant
property is invariant for object instance
const uint vnCommit
document is committing, flush cached changes
const uint pfSettable
property settable as native format
TDocMode
Document open and sharing modes - used in storage and stream constructors.
const uint pfUserDef
property has been user-defined at run time
const uint vnCustomBase
base of document class specific notifications
const uint pfUnknown
property defined but unavailable in object
const uint vnRevert
document has reverted, reload data from doc
const uint vnIsWindow
respond true if passed HWND is that of view
const uint vnIsDirty
respond true if uncommitted changes present
const uint pfGetBinary
property accessible as native non-text format
@ ofRead
ios::in, open for reading
@ ofTruncate
ios::trunc, truncate file if already exists
@ shRead
DENY_WRITE functionality.
@ shDefault
use stream implementation default value
@ ofParent
use open mode of parent storage
@ ofNoReplace
ios::noreplace, open fails if file already exists
@ ofPriority
STGM_PRIORITY, temporary efficient peeking.
@ ofPreserve
STGM_CONVERT, backup old data of same name.
@ ofAppend
ios::app, append mode: all additions at eof
@ ofWrite
ios::out, open for writing
@ ofAtEnd
ios::ate, seek to eof upon original open
@ shWrite
DENY_READ functionality.
@ ofTransacted
STGM_TRANSACTED, supports commit and revert.
@ shReadWrite
DENY_NONE functionality.
@ shNone
EXCLUSIVE functionality.
@ ofNoCreate
ios::nocreate, open fails if file doesn't exist
@ shCompat
for non-compliant applications, avoid if possible
@ ofTemporary
STGM_DELETEONRELEASE, delete when destructed.
Object Windows Library (OWLNext Core)
UINT TMsgId
Message ID type.
LPARAM TParam2
Second parameter type.
TModule & GetGlobalModule()
#define OWL_DISABLE_WARNING_POP
#define OWL_DISABLE_WARNING_PUSH
#define OWL_DISABLE_WARNING_OLD_STYLE_CAST
static void Encode(F sendMessage, HWND wnd, TDocument &d)
static TResult Decode(void *i, TParam1, TParam2 p2)
static TResult Decode(void *i, TParam1, TParam2)
static bool Encode(F sendMessage, HWND wnd)
static TResult Decode(void *i, TParam1, TParam2 p2)
static bool Encode(F sendMessage, HWND wnd, P p)
static TResult Decode(void *i, TParam1, TParam2 p2)
static bool Encode(F sendMessage, HWND wnd, TParam2 p2)
static TResult Decode(void *i, TParam1, TParam2 p2)
static void Encode(F sendMessage, HWND wnd, TView &v)
Undefined default template for dispatchers Template specialization is used to allow the compiler to l...