home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
opendc12.zip
/
od124os2.exe
/
od12osr1.exe
/
src
/
DraftRec.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1997-03-21
|
4KB
|
145 lines
/* @(#)Z 1.15 com/src/docshell/DraftRec.cpp, odshell, od96os2, odos29712d 97/03/21 17:38:33 (96/12/03 15:32:55) */
//====START_GENERATED_PROLOG======================================
//
//
// COMPONENT_NAME: odshell
//
// CLASSES: none
//
// ORIGINS: 27
//
//
// (C) COPYRIGHT International Business Machines Corp. 1995,1996
// All Rights Reserved
// Licensed Materials - Property of IBM
// US Government Users Restricted Rights - Use, duplication or
// disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
//
// IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
// ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
// CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
// USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
// OR PERFORMANCE OF THIS SOFTWARE.
//
//====END_GENERATED_PROLOG========================================
//
//------------------------------------------------------------------------------
// DraftRec.cpp
//
// This file provides the implementation of the DraftInfoRec class.
// An instance of this class is created for each draft listed in
// the draft history window.
//------------------------------------------------------------------------------
#include "DraftRec.h"
#include "DocShell.h"
#include <ODUtils.h>
#include <IText.h>
#include <StorUtil.h>
#include <StdTypIO.h>
#include <TempObj.h>
#include <StdProps.xh>
#include <StdTypes.xh>
#include <StorageU.xh>
#include <Document.xh>
#undef LOGGING
#define LOGGING 1
//------------------------------------------------------------------------------
// DraftInfoRec
//------------------------------------------------------------------------------
DraftInfoRec::DraftInfoRec()
{
fPrev = kODNULL;
fNext = kODNULL;
fDraft = kODNULL;
fDraftID = kODNULL;
fDraftNumber = 0;
fSavedDate = kODNULL;
fComment = kODNULL;
fModUser = kODNULL;
}
//------------------------------------------------------------------------------
// ~DraftInfoRec
//
// Delete DraftInfoRec which includes deleting memory allocated for
// user and comment information and releasing the draft acquired.
//------------------------------------------------------------------------------
DraftInfoRec::~DraftInfoRec()
{
Environment* ev = somGetGlobalEnvironment();
DisposeIText(fModUser);
DisposeIText(fComment);
try
{
// Release draft
// Note: it is acquired in InitDraftInfoRec
ODReleaseObject(ev, fDraft);
}
catch (ODException _exception)
{
LOG("Exception occured in DraftInfoRec::~DraftInfoRec\n");
throw;
}
}
//------------------------------------------------------------------------------
// InitDraftInfoRec
//
// Retrieve information belonging to this draft from its draft
// properties
//------------------------------------------------------------------------------
void DraftInfoRec::InitDraftInfoRec(Environment *ev, ODDraft *draft)
{
try
{
TempODStorageUnit su = draft->AcquireDraftProperties(ev);
// Acquire reference to draft.
// Note: reference to be released by the destructor
fDraft = draft->GetDocument(ev)->AcquireDraft(ev, kODDPReadOnly,
kODNULL, draft, kODPosSame,
kODFalse);
// Retrieve draft ID
fDraftID = draft->GetID(ev);
// Retrieve user
fModUser = ODGetITextProp(ev, su, kODPropModUser,
kODPlatformIText , kODNULL);
// Retrieve comment
fComment = ODGetITextProp(ev, su, kODPropDraftComment,
kODPlatformIText, kODNULL);
// Retrieve creation date
fSavedDate = ODGetTime_TProp(ev, su, kODPropDraftSavedDate, kODTime_T);
// Retrieve draft number
fDraftNumber = ODGetULongProp(ev, su, kODPropDraftNumber, kODULong);
}
catch (ODException _exception)
{
LOG("Exception occured in DraftInfoRec::InitDraftInfoRec\n");
if (fModUser)
DisposeIText(fModUser);
if (fComment)
DisposeIText(fComment);
if (fDraft)
SaveAndRestoreEv1(fDraft);
throw;
}
}