Click here to Skip to main content
Click here to Skip to main content

A WTL DocView framework

, 10 Jan 2006
Rate this:
Please Sign up or sign in to vote.
Implemetation of a simple DocView framework like MFC.

Sample Image - DocView_framework.jpg

Introduction

This article explains the implementation of a simple Doc View framework in a WTL (version 7.5) MDI application. The sample project included with this article is a wizard-generated MDI application enhanced with my framework classes. I enhanced code from Gabriel Kniznik with a little bit closer to the MFC DocView approach, and there exists only one kind of document template - MDI Document template. This framework was written in a week, so I apologize for mistakes and unfinished solutions Smile | :) .

In this article is also participating Rodrigo Pinho Pereira de Souza, who made great enhancements to this framework (see the History section).

Implementation

In the demo project, you can see how to integrate the framework to your own project. You have to make changes to CMainFrame, CChildFrame, CYourView, and create a new class CYourDoc. Do not forget to change the IDR_CHILDFRAME string to the form for MFC -> \nDocument\nDVF\n\n\nDVFSimple.Document\nDVF Document.

Below is a simplified class diagram of the framework:

Framework class diagram - simplified

History

  • 11 Jan 2006
  • Changes made by Rodrigo Pinho Pereira de Souza:

    • Automatic handling of ID_FILE_NEW
    • Automatic handling of ID_FILE_SAVE
    • Automatic handling of ID_FILE_SAVEAS
    • Implemented Serialization mechanism
    • Changed all declarations of std::vector to the ATL CSimpleArray
    • Created a CFormView class

    Demo application split to VC++ 6.0 and VS.NET 2003.

  • 8 Aug 2005 - Initial version.

Terms of Use

The sample application available with this article is free for any purpose. THIS SOFTWARE IS DISTRIBUTED AS-IS, WITHOUT WARRANTIES OF ANY KIND.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Jozef Bozek
CEO bring-it-together s.r.o.
Slovakia Slovakia
Jozef Božek is currently a software engineer at bring-it-together s.r.o. in area of large scale infomation systems and mobile applications development.
He has been developing in C++ nearly full time since 2000, in Java since 2004 and in Objective-C since 2009. He is programming using Java EE SDK, iOS SDK, COM/DCOM, MFC, ATL, STL and so on Smile | :)
Follow on   Twitter   Google+

Comments and Discussions

 
QuestionRelease Build Pinmemberjsvanwyk8-Apr-13 5:56 
GeneralCString memory exceptions PinmemberJerker Bäck6-Oct-06 17:04 
GeneralRe: CString memory exceptions PinmemberJerker Bäck8-Oct-06 0:42 
GeneralRe: CString memory exceptions Pinmemberrajas12-Jul-08 19:28 
QuestionWhat about SaveDocument ? PinmemberRodrigo Pinho Pereira de Souza2-Nov-05 14:38 
AnswerRe: What about SaveDocument ? PinmemberJozef Božek3-Nov-05 1:23 
GeneralRe: What about SaveDocument ? PinmemberRodrigo Pinho Pereira de Souza29-Nov-05 0:33 
GeneralRe: What about SaveDocument ? PinmemberJozef Božek29-Nov-05 0:55 
GeneralRe: What about SaveDocument ? PinmemberRodrigo Pinho Pereira de Souza5-Dec-05 1:38 
What is your email?
 
I implemented handlers for ID_FILE_NEW, ID_FILE_OPEN, ID_FILE_SAVE, ID_FILE_SAVEAS. I simple converted code from MFC.
 
I think that we can re-design to use more templates and put all in one file "atldocview.h", and strip-out any use of STL (you have used std::vector), and then submit to WTL source forge team, to be included in next version of WTL.
 
WTL does not have CFile or CArchive, and for this reason, I implemented Serializarion partilay.
 
The Serialization mechanism that I implemented, simple call method Serialization from Document class with the filename and Method (save/load), passing resposability to user to serialize his methods.
 
This is more flexible than MFC, because developer may want to use boost::serialization, MSXML, iostreams or just implement his serialization mechanism.
 
regards
 
Rodrigo Pinho Pereira de Souza

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web01 | 2.8.140827.1 | Last Updated 11 Jan 2006
Article Copyright 2005 by Jozef Bozek
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid