OpBitmapDownload Class Reference

#include <htmldwnd.h>

Inheritance diagram for OpBitmapDownload:

DownloadOp Operation MessageHandler ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 OpBitmapDownload ()
 ~OpBitmapDownload ()

Static Public Member Functions

static BOOL Init ()
static OpState GetState (String_256 *, OpDescriptor *)

Protected Member Functions

virtual BOOL OnDocChangingMsg (Document *pChangingDoc, DocChangingMsg::DocState State)
 End (abort) the operation when for instance the current document has been destroyed while downloading.
virtual void OnDownloadSuccess ()
 Start the bitmap import.
virtual void OnDownloadFail ()
 This function is called if the file download fails.

Detailed Description

Definition at line 158 of file htmldwnd.h.


Constructor & Destructor Documentation

OpBitmapDownload::OpBitmapDownload  )  [inline]
 

Definition at line 163 of file htmldwnd.h.

00163 {};

OpBitmapDownload::~OpBitmapDownload  )  [inline]
 

Definition at line 164 of file htmldwnd.h.

00164 {};


Member Function Documentation

OpState OpBitmapDownload::GetState String_256 ,
OpDescriptor
[static]
 

Author:
Olivier_Gascoin (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/04/97
Parameters:
[INPUTS] 
Returns:

Errors:

Reimplemented from DownloadOp.

Definition at line 198 of file htmldwnd.cpp.

00199 {
00200     OpState OpSt;
00201     return(OpSt);
00202 }

BOOL OpBitmapDownload::Init void   )  [static]
 

Author:
Olivier_Gascoin (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/04/97
Parameters:
[INPUTS] 
Returns:
TRUE if the Init worked ok

Errors:

Reimplemented from DownloadOp.

Definition at line 169 of file htmldwnd.cpp.

00170 {
00171     return RegisterOpDescriptor(
00172         0,                                  // Tool ID
00173         _R(IDS_OPBITMAPDOWNLOAD),               // String resource ID
00174         CC_RUNTIME_CLASS(OpBitmapDownload), // Runtime class
00175         OPTOKEN_OPBITMAPDOWNLOAD,           // Token string
00176         OpBitmapDownload::GetState,         // GetState function
00177         0,                                  // Help ID
00178         0,                                  // Bubble ID
00179         0,                                  // Resource ID
00180         0                                   // Control ID
00181     );
00182 }

BOOL OpBitmapDownload::OnDocChangingMsg Document pChangingDoc,
DocChangingMsg::DocState  State
[protected, virtual]
 

End (abort) the operation when for instance the current document has been destroyed while downloading.

Author:
Olivier_Gascoin (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/05/97
Parameters:
pChangingDoc - [INPUTS] State -
Returns:

Errors:

Reimplemented from MessageHandler.

Definition at line 220 of file htmldwnd.cpp.

00221 {
00222     BitmapDownloadParam* pBMPParam = (BitmapDownloadParam*) pParam;
00223 
00224     if (pParam != NULL)
00225     {
00226         if (State == DocChangingMsg::ABOUTTODIE && pChangingDoc == pBMPParam->m_DestDoc)
00227         {
00228             FailAndExecute(); 
00229             End();
00230         }
00231     }
00232 
00233     return TRUE;
00234 }

void OpBitmapDownload::OnDownloadFail  )  [protected, virtual]
 

This function is called if the file download fails.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/01/97
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-
It puts up a message that says "Webster could not download from the URL you typed"

Reimplemented from DownloadOp.

Definition at line 308 of file htmldwnd.cpp.

00309 {
00310     //First get a pointer to the parameters
00311     BitmapDownloadParam* pBMPParam = (BitmapDownloadParam*) pParam;
00312 
00313     if (pBMPParam==NULL)
00314     {
00315         ERROR2RAW("OpBitmapDownload::OnDownloadFail - no download parameters");
00316         return;
00317     }
00318 
00319     //Get the URL which the user typed
00320     String_256 strURL=pBMPParam->strURL;
00321 
00322     //And put it up as a message
00323     String_256 strMessage;
00324     strMessage.MakeMsg(_R(IDS_HTML_DOWNLOADFAILED), &strURL);
00325     Error::SetError(0, strMessage, 0);
00326     InformError();
00327 }

void OpBitmapDownload::OnDownloadSuccess  )  [protected, virtual]
 

Start the bitmap import.

Author:
Olivier_Gascoin (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/04/97
Parameters:
[INPUTS] 
Returns:

Errors:

Reimplemented from DownloadOp.

Definition at line 249 of file htmldwnd.cpp.

00250 {
00251     // get a pointer to the OpParam so that I can retrieve some useful information
00252     BitmapDownloadParam* pBMPParam = (BitmapDownloadParam*) pParam;
00253 
00254     String_256 BitmapFile = (pBMPParam->file).GetFileName();
00255     if (IsUserName("Olivier"))
00256         TRACE1("OpBitmapDownload::OnDownloadSuccess(), file = %s\n", (TCHAR*)BitmapFile);
00257 
00258     INT32 TagId = pBMPParam->m_TagId;
00259     //SelOperation *Op = pBMPParam->m_Op;
00260     Document *DestDoc = pBMPParam->m_DestDoc;
00261     PathName Path = pBMPParam->file;
00262     INT32 FileNum = pBMPParam->m_FileNum;
00263     INT32 FileNumber = pBMPParam->m_FileNumber;
00264     DocCoord PosTranslate = pBMPParam->m_PosTranslate;
00265     BOOL IsCenter = pBMPParam->m_IsCenter;
00266     String_256 NewName = pBMPParam->m_FileName;
00267 
00268     // set the current document
00269     DestDoc->SetCurrent();
00270 
00271     // create a new undoable operation 
00272     // we can't import a bitmap without having a undoable op pointer
00273     SelOperation *Op = new SelOperation();
00274 
00275     // Tell the filter we're importing an HTML page
00276     HTMLFilter::ImportingHTML=TRUE;
00277 
00278     //Import the bitmap
00279     HTMLFilter::DoImportBitmap(TagId, Op, DestDoc, Path, FileNum, FileNumber, PosTranslate, IsCenter, &NewName);
00280 
00281     //And tell the filter we're no longer importing an HTML page
00282     HTMLFilter::ImportingHTML=FALSE;
00283     
00284     // End the op
00285     Op->End();
00286 
00287     // remove the temporary bitmap file
00288     remove((TCHAR*) (String_256) Path.GetPath());
00289 
00290 }


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:57:32 2007 for Camelot by  doxygen 1.4.4