#include <htmldwnd.h>
Inheritance diagram for OpBitmapDownload:
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. |
Definition at line 158 of file htmldwnd.h.
|
Definition at line 163 of file htmldwnd.h.
|
|
Definition at line 164 of file htmldwnd.h.
|
|
Reimplemented from DownloadOp. Definition at line 198 of file htmldwnd.cpp. 00199 { 00200 OpState OpSt; 00201 return(OpSt); 00202 }
|
|
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 }
|
|
End (abort) the operation when for instance the current document has been destroyed while downloading.
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 }
|
|
This function is called if the file download fails.
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 }
|
|
Start the bitmap import.
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 }
|