00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100 #ifndef _INETOP_H_
00101 #define _INETOP_H_
00102
00103 #include "sgliboil.h"
00104 #include "sglib.h"
00105 #include "scrvw.h"
00106 #include "camnet.h"
00107 #include "stl.h"
00108 #include <list>
00109
00110
00111
00112
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129 class DownloadOpParam : public OpParam
00130 {
00131 public:
00132
00133 PathName file;
00134
00135 String_256 strURL;
00136
00137
00138 BOOL bHasProgressDlg;
00139
00140
00141 String_256 strDescription;
00142
00143 FileType type;
00144
00145 AsynchDownload::Priority priority;
00146
00147 protected:
00148 DownloadOpParam();
00149 static void* pAllocatedMemory;
00150
00151 public:
00152 void* operator new(size_t stSize, LPCSTR lpszFileName, INT32 nLine)
00153 {
00154 return (pAllocatedMemory = SimpleCCObject::operator new(stSize, lpszFileName, nLine));
00155 }
00156 void* operator new(size_t stSize)
00157 {
00158 return (pAllocatedMemory = SimpleCCObject::operator new(stSize));
00159 }
00160 };
00161
00162
00163 #define OPTOKEN_OPDOWNLOAD _T("DownloadOp") // Optoken for the basic download operation
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179 class DownloadOp : public Operation
00180 {
00181 CC_DECLARE_DYNCREATE(DownloadOp)
00182
00183 public:
00184 DownloadOpParam* pParam;
00185
00186 DownloadOp();
00187 virtual ~DownloadOp();
00188
00189 static BOOL Init();
00190 static OpState GetState(String_256*, OpDescriptor*);
00191 virtual void Do(OpDescriptor *);
00192 virtual BOOL OnIdleEvent();
00193 virtual void DoWithParam(OpDescriptor* pOp, OpParam* pDownloadOpParam);
00194 virtual void End();
00195 virtual BOOL OnDeathMsg() { End(); return TRUE;}
00196 virtual void OnDownloadSuccess();
00197 virtual void OnDownloadFail();
00198 virtual void OnDownloadAbort();
00199 virtual void OnDownloadPending();
00200
00201 protected:
00202 DOWNLOAD_HANDLE m_hDownload;
00203 INT32 m_nPercentageCompleted;
00204 virtual void OnDownloadProgress(const INT32 nPercentageCompleted) {};
00205 };
00206
00207
00208
00209
00210
00211
00213
00214 class WebFontInstallParam : public DownloadOpParam
00215 {
00216 public:
00217 String_256 strAltDescription;
00218 BOOL bIsTemp;
00219 LibraryGallery* pGallery;
00220
00221 WebFontInstallParam();
00222 ~WebFontInstallParam();
00223 };
00224
00225
00226
00227 #define OPTOKEN_OPASYNCHFONTINSTALL _T("AsynchFontInstall") // Optoken for the asynchronous font install
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243 class OpAsynchFontInstall : public DownloadOp
00244 {
00245 CC_DECLARE_DYNCREATE(OpAsynchFontInstall)
00246
00247 public:
00248 OpAsynchFontInstall() {};
00249 virtual ~OpAsynchFontInstall() {};
00250 static BOOL Init();
00251
00252 protected:
00253 virtual void OnDownloadSuccess();
00254 };
00255
00256
00257
00258
00259
00261
00262 class AsynchBitmapImportParam : public DownloadOpParam
00263 {
00264 public:
00265
00266
00267 Document* pTargetDoc;
00268 FillTypeEnum FillType;
00269 UINT32 TagObjectToFill;
00270 bool TagObjectValid;
00271 NodeRenderableInk* pObject;
00272 bool pObjectValid;
00273 Spread* pSpread;
00274 DocCoord DropPos;
00275
00276 AsynchBitmapImportParam();
00277 ~AsynchBitmapImportParam() {};
00278 };
00279
00280
00281 #define OPTOKEN_ASYNCHBITMAPIMPORT _T("AsynchBitmapImport") // Optoken for asynchronous bitmap import
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297 class OpAsynchBitmapImport : public DownloadOp
00298 {
00299 CC_DECLARE_DYNCREATE(OpAsynchBitmapImport)
00300
00301 public:
00302 OpAsynchBitmapImport() {};
00303 virtual ~OpAsynchBitmapImport() {};
00304 static BOOL Init();
00305 virtual BOOL OnDocChangingMsg(Document* pChangingDoc, DocChangingMsg::DocState State);
00306
00307 protected:
00308 virtual void OnDownloadSuccess();
00309 };
00310
00311
00312
00313
00314
00315
00316
00318
00319 class OpThumbDownload;
00320
00321 class CCAPI ThumbDownloadParam
00322 {
00323 public:
00324 ThumbDownloadParam();
00325 ~ThumbDownloadParam();
00326
00327 public:
00328 SGLibDisplayItem* pItem;
00329 OpThumbDownload* pOp;
00330 SGLibType type;
00331 BOOL bSuccess;
00332 };
00333
00334 #define OPTOKEN_OPTHUMBDOWNLOAD _T("ThumbnailDownload") // Optoken for the thumbnail download
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351 class OpThumbDownload : public Operation
00352 {
00353 CC_DECLARE_DYNCREATE(OpThumbDownload)
00354
00355 public:
00356 ThumbDownloadParam* pParam;
00357
00358 OpThumbDownload();
00359 ~OpThumbDownload();
00360
00361 static BOOL Init();
00362 static OpState GetState(String_256*, OpDescriptor*);
00363
00364 virtual void Do(OpDescriptor *);
00365 virtual BOOL OnIdleEvent();
00366 virtual void DoWithParam(OpDescriptor* pOp, OpParam* pThumbDownloadParam);
00367 virtual void End();
00368 void Abort();
00369 static INT32 GetLastError(SGLibDisplayItem* pItem);
00370 static void ClearErrors();
00371 inline static void Suspend() {m_bIsSuspended = TRUE; InternetManager::Suspend();}
00372 inline static void Resume() {m_bIsSuspended = FALSE; InternetManager::Resume();}
00373
00374 protected:
00375 DOWNLOAD_HANDLE m_hDownload;
00376 INT32 m_nPercentageCompleted;
00377 static std::list<SGLibDisplayItem*> m_lstFailedItems;
00378 static INT32 ThumbsDownloaded[8];
00379 static INT32 InstanceCount[8];
00380 static INT32 ErrorCount[8];
00381 LibraryGallery* pGallery;
00382 static BOOL m_bIsSuspended;
00383 };
00384
00385
00386
00387
00388
00389
00391
00392 class CCAPI AsynchClipartImportParam
00393 {
00394 public:
00395 AsynchClipartImportParam();
00396 ~AsynchClipartImportParam();
00397
00398 public:
00399 PathName File;
00400 String_256 strURL;
00401 String_256 strDescription;
00402 BOOL Import;
00403 PageDropInfo DropInfo;
00404 BOOL bDropped;
00405 };
00406
00407 #define OPTOKEN_OPASYNCHCLIPARTIMPORT _T("AsynchClipartImport") // Optoken for the asynch clipart import
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425 class OpAsynchClipartImport : public OpClipartImport
00426 {
00427 CC_DECLARE_DYNCREATE( OpAsynchClipartImport )
00428
00429 public:
00430 AsynchClipartImportParam* pParam;
00431
00432 OpAsynchClipartImport();
00433 ~OpAsynchClipartImport();
00434
00435 static BOOL Init();
00436 static OpState GetState(String_256*, OpDescriptor*);
00437
00438 virtual void Do(OpDescriptor *);
00439 virtual BOOL OnIdleEvent();
00440 virtual void DoWithParam(OpDescriptor* pOp, OpParam* pAsynchClipartImportParam);
00441 virtual BOOL OnDocChangingMsg(Document* pChangingDoc, DocChangingMsg::DocState State);
00442 virtual void End();
00443
00444 protected:
00445 DOWNLOAD_HANDLE m_hDownload;
00446 Document* m_pTargetDoc;
00447 Document* m_pCurrentSelDoc;
00448 };
00449
00450
00451
00453
00454 #define FOLDER_UNMODIFIED 0
00455 #define FOLDER_UPDATED 1
00456 #define FOLDER_NEW 2
00457
00458 class CCAPI AddWebFoldersParam
00459 {
00460 public:
00461 AddWebFoldersParam() { pLibGal = NULL;}
00462
00463 public:
00464 PathName localFile;
00465 String_256 strURL;
00466 String_256 strFolderName;
00467 LibraryGallery* pLibGal;
00468 SGLibType type;
00469 };
00470
00471
00472 #define OPTOKEN_OPADDWEBFOLDERS _T("AddWebFolders") // Optoken for the asynch web folders insertion into the gallery
00473
00474
00475 class OpAddWebFolders: public Operation
00476 {
00477 CC_DECLARE_DYNCREATE(OpAddWebFolders)
00478
00479 public:
00480 AddWebFoldersParam* pParam;
00481
00482 static BOOL Success[8];
00483
00484 OpAddWebFolders();
00485 ~OpAddWebFolders();
00486
00487 static BOOL Init();
00488 static OpState GetState(String_256*, OpDescriptor*);
00489
00490 virtual void Do(OpDescriptor *);
00491 virtual BOOL OnIdleEvent();
00492 virtual void DoWithParam(OpDescriptor* pOp, OpParam* pAddWebFoldersParam);
00493 virtual BOOL OnDeathMsg();
00494
00495 protected:
00496 DOWNLOAD_HANDLE m_hDownload;
00497 };
00498
00499
00500
00501
00502 #define OPTOKEN_OPADDWEBLIBRARY _T("AddWebLibrary") // Optoken for the asynch web folders insertion into the gallery
00503
00504
00505 class OpAddWebLibrary: public Operation
00506 {
00507 CC_DECLARE_DYNCREATE(OpAddWebLibrary);
00508
00509 public:
00510 AddWebFoldersParam* pParam;
00511
00512 OpAddWebLibrary();
00513 ~OpAddWebLibrary();
00514
00515 static BOOL Init();
00516 static OpState GetState(String_256*, OpDescriptor*);
00517
00518 virtual void Do(OpDescriptor *);
00519 virtual BOOL OnIdleEvent();
00520 virtual void DoWithParam(OpDescriptor* pOp, OpParam* pAddWebFoldersParam);
00521 virtual BOOL OnDeathMsg();
00522
00523 protected:
00524 DOWNLOAD_HANDLE m_hDownload;
00525 static BOOL m_bIsSuspended;
00526
00527 static std::list<DOWNLOAD_HANDLE> m_lstPendingDownloads;
00528
00529 static INT32 InstanceCount[8];
00530 static INT32 FoldersAdded[8];
00531 static INT32 ErrorCount[8];
00532 static INT32 CachedFilesUsed[8];
00533 inline static void Suspend() {m_bIsSuspended = TRUE; InternetManager::Suspend();}
00534 inline static void Resume() {m_bIsSuspended = FALSE; InternetManager::Resume();}
00535 friend class OpAddWebFolders;
00536 };
00537
00538
00539
00540
00541
00542
00543 #endif