Click here to Skip to main content
15,881,852 members
Articles / Desktop Programming / MFC

SmartReplace AddIn [VC 6.0]

Rate me:
Please Sign up or sign in to vote.
4.62/5 (16 votes)
23 Aug 20033 min read 68.5K   2K   32  
Yet another replace dialog
//***************************************************************************
//*
//*	File:			dswl_documents.h
//*	Description:	Wrapper for IDocuments interface
//*
//***************************************************************************
//*
//*	Note:			This source code is provided "as is" meaning that you may 
//*					use it at your own risk. 
//*					You are free to use it in any way you like.
//*
//***************************************************************************
//*
//*	History:		
//*
//*	-------------------------------------------------------------------------
//*	2003/07/27	|	Initial release									|	rk
//*	-------------------------------------------------------------------------
//*
//***************************************************************************

//
//-------------------------------------------------------------- PREPROCESSOR 
//

#ifndef			_DSWL_DOCUMENTS_H_INCLUDED
#define			_DSWL_DOCUMENTS_H_INCLUDED

#if				_MSC_VER > 1000
#pragma once
#ifdef			__SWITCH_SHOW_HEADER
#pragma message ("-- dswl_documents.h\n")
#endif
#ifdef			__SWITCH_SHOW_HEADER_TREE
#pragma message ("-- "__FILE__"\n")
#endif
#endif 

#ifdef			_DSWL_SWITCH_USE_AUTOCAST
#ifdef			_DSWL_SWITCH_USE_UNSAFE_AUTOCAST
#pragma	message ( "-- dswl_documents.h \t Warning: Generating auto-cast operator: CIDocuments::operator IDocuments* () const" )
#else
#pragma	message ( "-- dswl_documents.h \t Warning: Generating auto-cast operator: CIDocuments::operator       IDocuments* ()" )
#pragma	message ( "-- dswl_documents.h \t Warning: Generating auto-cast operator: CIDocuments::operator const IDocuments* () const" )
#endif
#endif

//
//-------------------------------------------------------------- DEPENDENCIES
//

//
//------------------------------------------------------ FORWARD DECLARATIONS
//

class			CIApplication		;
class			CIGenericDocument	;

//
//--------------------------------------------------------- CLASS DECLARATION
//

//***************************************************************************
//**	@DOC		CLASS CIDocuments
//***************************************************************************
//*		@CLASS		Wrapper for IDocuments interface
//***************************************************************************
class _DSWL_EXT_CLASS CIDocuments  
{
	//																								
	//-----------------------------------------------------------------------						
	//***************************     ATTRIBS     ***************************						
	//-----------------------------------------------------------------------						
	//																								
private:																												// @ACCESS	Private Attributes	
			CComPtr< IDocuments >	m_pIDocuments	;																	// @CMEMBER	Smart pointer to the actual text document interface
																													
	//																																
	//-----------------------------------------------------------------------														
	//*************************     PROPERTIES     **************************								
	//-----------------------------------------------------------------------														
	//																																
public:																													// @ACCESS	Public Property Methods
			CIApplication			GetApplication		( void )											const	;	// @CMEMBER	Returns the application the documents belong to
			long					GetCount			( void )											const	;	// @CMEMBER	Returns the number of documents in the container

	//																															
	//-----------------------------------------------------------------------													
	//*************************     INFORMATION     *************************								
	//-----------------------------------------------------------------------													
	//																															
public:																													// @ACCESS	Public Information Methods
			BOOL					IsNull				( void )											const	;	// @CMEMBER	Determines whether the internal pointer is <t NULL>
			BOOL					IsValid				( void )											const	;	// @CMEMBER	Determines whether the internal pointer differs from <t NULL>
																											
	//																													
	//-----------------------------------------------------------------------											
	//*********************     ELEMENT MANAGEMENT     **********************
	//-----------------------------------------------------------------------											
	//																													
public:																													// @ACCESS	Public Project Management Methods
			CIGenericDocument		GetAt				(		long				a_lIndex			)	const	;	// @CMEMBER	Determines the item at specified 0-based index. 
			CIGenericDocument		GetItem				(		long				a_lItem				)	const	;	// @CMEMBER	Determines the item at specified 1-based index. 

			CIGenericDocument		Add					( const	CString&			a_strDocumentType	)			;	// @CMEMBER	Inserts a new document to the container
			CIGenericDocument		Open				( const	CString&			a_strFileName	
														, const	CString&			a_strOpenAs
														,		BOOL				a_bReadOnly			)			;	// @CMEMBER	Inserts an existing document to the container

			DsSaveStatus			SaveAll				(		BOOL				a_bPrompt			)			;	// @CMEMBER	Saves all documents
			DsSaveStatus			CloseAll			(		BOOL				a_bSaveChanges		)			;	// @CMEMBER	Closes all documents

	//																											
	//-----------------------------------------------------------------------									
	//*************************     EXTENSIONS     **************************
	//-----------------------------------------------------------------------									
	//																											
public:																													// @ACCESS	Public Extension Methods
			CIGenericDocument		FindByFullName		( const CString&			a_strFullName		)	const	;	// @CMEMBER	Finds a document by its full name

	//																											
	//-----------------------------------------------------------------------									
	//**************************     OPERATORS     **************************									
	//-----------------------------------------------------------------------									
	//																											
public:																													// @ACCESS	Public Operators
			bool					operator	==		( const CIDocuments&		a_Other				)	const	;	// @CMEMBER	Comparison operator
			bool					operator	!=		( const CIDocuments&		a_Other				)	const	;	// @CMEMBER	Comparison operator
			bool					operator	<=		( const CIDocuments&		a_Other				)	const	;	// @CMEMBER	Comparison operator
			bool					operator	>=		( const CIDocuments&		a_Other				)	const	;	// @CMEMBER	Comparison operator
			bool					operator	<		( const CIDocuments&		a_Other				)	const	;	// @CMEMBER	Comparison operator
			bool					operator	>		( const CIDocuments&		a_Other				)	const	;	// @CMEMBER	Comparison operator
																										
			CIDocuments&			operator	=		(		IDocuments*			a_pIOther			)			;	// @CMEMBER	Copy operator
																										
			IDocuments*				operator	*		( void )													;	// @CMEMBER	Dereference operator
	const	IDocuments*				operator	*		( void )											const	;	// @CMEMBER	Dereference operator
																											
			IDocuments*				operator	->		( void )													;	// @CMEMBER	Member access operator
	const	IDocuments*				operator	->		( void )											const	;	// @CMEMBER	Member access operator

			CIGenericDocument		operator	[]		(		int					a_iIndex			)	const	;	// @CMEMBER	Subscription operator
																										
	#ifdef	_DSWL_SWITCH_USE_AUTOCAST																	
	#ifdef	_DSWL_SWITCH_USE_UNSAFE_AUTOCAST															
									operator			IDocuments*	( void )								const	;	// @CMEMBER	TypeCast operator
	#else																									
									operator			IDocuments*	( void )										;	// @CMEMBER	TypeCast operator
									operator	const	IDocuments*	( void )								const	;	// @CMEMBER	TypeCast operator
	#endif																								
	#endif							
									
	//																								
	//-----------------------------------------------------------------------						
	//***********************     CON/DESTRUCTION     ***********************						
	//-----------------------------------------------------------------------						
	//																								
public:																													// @ACCESS	Public Con-/Destruction Methods	
			 CIDocuments( IDocuments* a_pIDocuments = NULL );															// @CMEMBER	Default constructor
	virtual ~CIDocuments();																								// @CMEMBER	Default destructor
};
//***************************************************************************
//**	@END
//***************************************************************************

#endif		// _DSWL_DOCUMENTS_H_INCLUDED

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Germany Germany
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions