OpBevel Class Reference

#include <daveimp.h>

Inheritance diagram for OpBevel:

OpMenuImport SelOperation UndoableOperation Operation MessageHandler ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 OpBevel ()
 Default constructor.
void Do (OpDescriptor *)
 Imports a URL into the current document.

Static Public Member Functions

static BOOL Init ()
 Declares the OpDescriptor.
static OpState GetState (String_256 *, OpDescriptor *)
 This item is always available, so long as a document is visible.

Protected Member Functions

BOOL ImportURL (WebAddress urlToGet)
 Imports the URL given.
FilterGetAllFilter ()
 Gets a pointer to the All filter.

Protected Attributes

DaveDlgm_pDlg

Detailed Description

Definition at line 122 of file daveimp.h.


Constructor & Destructor Documentation

OpBevel::OpBevel  ) 
 

Default constructor.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/6/97

Definition at line 224 of file daveimp.cpp.

00225 {
00226     OpFlags.HasOwnTimeIndicator = TRUE; // The OpBevel op has its own time indicator
00227 }


Member Function Documentation

void OpBevel::Do OpDescriptor  )  [virtual]
 

Imports a URL into the current document.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/6/97
Returns:
Errors: -

Reimplemented from OpMenuImport.

Definition at line 166 of file daveimp.cpp.

00167 {
00168     //First display our Import from URL dialog and get a filename from it
00169     WebAddress urlToGet;
00170 
00171     m_pDlg = new DaveDlg;
00172 
00173     m_pDlg->DoCreate();
00174 
00175     //And if the user clicked OK
00176     /*
00177     if (ok)
00178     {
00179 
00180         //So, is the URL we've got back a local filename?
00181         if (urlToGet.IsLocalFile())
00182         {
00183             //Yes. So get it as a pathname
00184             PathName pthToGet=urlToGet.GetPathName();
00185 
00186             //And first get a pointer to the All filter
00187             Filter* pAllFilter=GetAllFilter();
00188 
00189             //And if we found it
00190             if (pAllFilter)
00191             {
00192                 //Then import the pathname
00193                 String_256 strToGet=pthToGet.GetPath();
00194 
00195                 DoImport(pthToGet, pAllFilter, &strToGet);
00196             }
00197 
00198         }
00199         else
00200         {
00201             //No, it's a URL.
00202 
00203             //So download it
00204             ImportURL(urlToGet);
00205         }
00206     }
00207     */
00208 
00209 
00210 
00211 
00212 }

Filter * OpBevel::GetAllFilter  )  [protected]
 

Gets a pointer to the All filter.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/6/97
Parameters:
- [INPUTS]

Definition at line 336 of file daveimp.cpp.

00337 {
00338     //So get a pointer to the All filter
00339     return Filter::FindFilterFromID(FILTERID_GENERIC);
00340         
00341 }

OpState OpBevel::GetState String_256 ,
OpDescriptor
[static]
 

This item is always available, so long as a document is visible.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/6/97

Reimplemented from OpMenuImport.

Definition at line 239 of file daveimp.cpp.

00240 {
00241     OpState OpSt;
00242 
00243     return OpSt;
00244 }

BOOL OpBevel::ImportURL WebAddress  urlToGet  )  [protected]
 

Imports the URL given.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/6/97
Parameters:
urlToGet The URL to import [INPUTS]

Definition at line 263 of file daveimp.cpp.

00264 {
00265     //First, set up some variables. We must do this now because I'm 
00266     //going to use a goto in a moment
00267     GenericDownloadParam* Param;
00268     OpDescriptor* pOpDesc;
00269     PathName pthTemp;
00270 
00271     //We want to import urlToGet using the best available filter
00272 
00273     //To get the best available filter, we simply download to the "All" filter
00274     //So get a pointer to the All filter
00275     Filter* pAllFilter=GetAllFilter();
00276 
00277     //Check we found it
00278     if (pAllFilter==NULL)
00279         goto ReturnError;
00280 
00281     //Now, get ready to download the file. This is rather complex.
00282 
00283     //First create a new set of download parameters
00284     //This object will be deleted when the download finishes
00285     Param = new GenericDownloadParam;
00286     
00287     //Now find the generic download OpDescriptor
00288     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_OPGENERICDOWNLOAD);
00289 
00290     //And check we found it
00291     if (pOpDesc==NULL)
00292         goto ReturnError;
00293   
00294     //Now, create a temporary file to download to
00295     pthTemp=FileUtil::GetTemporaryPathName();
00296 
00297     //And now fill in our parameters
00298     Param->type = TYPE_HTML;
00299     Param->priority = AsynchDownload::PRIORITY_NORMAL;
00300     Param->strDescription = String_256(_R(IDS_HTMLIMPORT_FILEDOWNLOAD));
00301     Param->file = pthTemp.GetPath();
00302 
00303     Param->strURL = urlToGet.GetWebAddress();
00304                 
00305     Param->Output = NULL;
00306 
00307     Param->m_pFilter = pAllFilter;
00308     Param->m_Op = this;                     
00309     Param->pDoc = Document::GetCurrent();
00310 
00311     //And, finally, start the download going, if we've got a URL to download
00312     if (!Param->strURL.IsEmpty())
00313         pOpDesc->Invoke((OpParam*) Param);
00314     
00315     //And return TRUE
00316     return TRUE;
00317 
00318 ReturnError:
00319     if (Param)
00320         delete Param;
00321 
00322     return FALSE;
00323 }

BOOL OpBevel::Init void   )  [static]
 

Declares the OpDescriptor.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/6/97
Returns:
TRUE if worked, FALSE if failed (out of memory)

Errors: -

Reimplemented from OpMenuImport.

Definition at line 133 of file daveimp.cpp.

00134 {
00135     return RegisterOpDescriptor(
00136                                     0,                          // Tool ID
00137                                     _R(IDS_DAVEBEVEL),                  // String resource ID
00138                                     CC_RUNTIME_CLASS(OpBevel),  // Runtime class
00139                                     OPTOKEN_BEVEL,          // Token string
00140                                     GetState,                   // GetState function
00141                                     _R(IDH_Command_Import_from_Web),                            // help ID GTODO: Is this needed?
00142                                     _R(IDBBL_URLIMPORT),            // bubble help
00143                                     _R(IDD_BARCONTROLSTORE),        // resource ID
00144                                     _R(IDC_FILEURLIMPORT),          // control ID
00145                                     SYSTEMBAR_FILE,             // Bar ID   
00146                                     TRUE,                       // Receive system messages
00147                                     FALSE,                      // Smart duplicate operation
00148                                     TRUE,                       // Clean operation
00149                                     0,      // String for one copy only error
00150                                     (DONT_GREY_WHEN_SELECT_INSIDE | GREY_WHEN_NO_CURRENT_DOC) // Auto state flags
00151                                 );  
00152 
00153 }


Member Data Documentation

DaveDlg* OpBevel::m_pDlg [protected]
 

Definition at line 138 of file daveimp.h.


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