#include <infocomp.h>
Inheritance diagram for DocInfoComponent:
Public Member Functions | |
DocInfoComponent () | |
Construct a unit list component. | |
virtual | ~DocInfoComponent () |
Clean up a unit list component's data structures. | |
virtual BOOL | StartImport (BaseCamelotFilter *pFilter) |
Inform the unit list document component that a Native or Web import is about to start. | |
virtual BOOL | EndImport (BaseCamelotFilter *pFilter, BOOL Success) |
Inform the unit list document component that a Native or Web import has just finished. | |
virtual BOOL | StartExportBeforeComp (BaseCamelotFilter *pFilter) |
Inform the information document component that a Web or Native export is about to start. This version of StartExport is called before compression is started up. This means we can save the comment record in the uncompressed section of the file so that it is easy for the indexer to find. | |
virtual BOOL | StartExport (BaseCamelotFilter *pFilter) |
Inform the information document component that a Web or Native export is about to start. | |
virtual BOOL | EndExport (BaseCamelotFilter *pFilter, BOOL Success) |
Inform the information document component that a Web or Native export has just finished. | |
BOOL | ImportDocumentComment (CXaraFileRecord *pCXaraFileRecord, Document *pDoc) |
Import the document comment from the current record. | |
BOOL | ImportDocumentDates (CXaraFileRecord *pCXaraFileRecord, Document *pDoc) |
Import the document information from the current record. | |
BOOL | ImportUndoBufferSize (CXaraFileRecord *pCXaraFileRecord, Document *pDoc) |
Import the document undo buffer size from the current record. | |
BOOL | ImportDocumentFlags (CXaraFileRecord *pCXaraFileRecord, Document *pDoc) |
Import the document flags from the current record. | |
Private Member Functions | |
BOOL | ExportDocumentComment (BaseCamelotFilter *pFilter, Document *pDoc) |
Save out a document comment record to the file. | |
BOOL | ExportDocumentDates (BaseCamelotFilter *pFilter, Document *pDoc) |
Save out a document information record to the file. | |
BOOL | ExportUndoBufferSize (BaseCamelotFilter *pFilter, Document *pDoc) |
Save out a document undo buffer size record to the file. | |
BOOL | ExportDocumentFlags (BaseCamelotFilter *pFilter, Document *pDoc) |
Save out a document flags record to the file. |
Definition at line 142 of file infocomp.h.
|
Construct a unit list component.
Definition at line 210 of file infocomp.cpp.
|
|
Clean up a unit list component's data structures.
Definition at line 225 of file infocomp.cpp.
|
|
Inform the information document component that a Web or Native export has just finished.
Reimplemented from DocComponent. Definition at line 533 of file infocomp.cpp. 00534 { 00535 #ifdef DO_EXPORT 00536 00537 // Export any remaining document related items. 00538 BOOL ok = TRUE; 00539 Document * pDoc = pFilter->GetDocument(); 00540 if (pDoc && Success) 00541 { 00542 if (ok) ok = ExportDocumentDates(pFilter, pDoc); 00543 if (ok) ok = ExportUndoBufferSize(pFilter, pDoc); 00544 if (ok) ok = ExportDocumentFlags(pFilter, pDoc); 00545 } 00546 00547 return ok; 00548 #else 00549 return TRUE; 00550 #endif 00551 }
|
|
Inform the unit list document component that a Native or Web import has just finished.
Reimplemented from DocComponent. Definition at line 281 of file infocomp.cpp. 00282 { 00283 TRACEUSER( "Neville", _T("DocInfoComponent::EndImport\n")); 00284 if (pFilter == NULL) 00285 { 00286 ERROR3("DocInfoComponent::EndImport filter is null!"); 00287 return TRUE; 00288 } 00289 00290 return TRUE; 00291 }
|
|
Save out a document comment record to the file.
Definition at line 568 of file infocomp.cpp. 00569 { 00570 #ifdef DO_EXPORT 00571 ERROR2IF(pFilter == NULL || pDoc == NULL,FALSE,"DocInfoComponent::ExportDocumentComment Null pFilter or pDoc"); 00572 00573 // Only export information in native files 00574 if (pFilter->IsWebFilter()) 00575 return TRUE; 00576 00577 // Write the data out to the file 00578 BOOL ok = TRUE; 00579 String_256 Comment = pDoc->GetComment(); 00580 // Only save the record if there is any data to save 00581 if (Comment.Length() == 0) 00582 return TRUE; 00583 00584 // Write the data out to the file 00585 UINT32 Size = 0; 00586 // If there is a string name, then add it to this size 00587 // REMEMBER: We save out unicode strings and so we need to double the length of the returned string length 00588 Size += (Comment.Length() + 1) * SIZEOF_XAR_UTF16; 00589 CXaraFileRecord Rec(TAG_DOCUMENTCOMMENT, Size); 00590 ok = Rec.Init(); 00591 00592 if (ok) ok = Rec.WriteUnicode(Comment); 00593 00594 // Finally, write the record out to file 00595 // In the process get the record number that this was written out as 00596 INT32 RecordNumber = 0L; 00597 if (ok) RecordNumber = pFilter->Write(&Rec); // Get the document comment 00598 00599 // If we have had a problem at any of the stages then return that to the caller 00600 if (!ok || RecordNumber <= 0) 00601 return 0L; 00602 00603 return ok; 00604 00605 #endif 00606 return TRUE; 00607 }
|
|
Save out a document information record to the file.
Definition at line 624 of file infocomp.cpp. 00625 { 00626 #ifdef DO_EXPORT 00627 ERROR2IF(pFilter == NULL || pDoc == NULL,FALSE,"DocInfoComponent::ExportDocumentDates Null pFilter or pDoc"); 00628 00629 // Only export information in native files 00630 if (pFilter->IsWebFilter()) 00631 return TRUE; 00632 00633 // Write the data out to the file 00634 BOOL ok = TRUE; 00635 00636 // Set the last saved date to now 00637 if (pDoc) 00638 pDoc->SetLastSaveTime(); 00639 00640 // Find out what they are 00641 time_t Creation = pDoc->GetCreationTime(); 00642 time_t LastSaved = pDoc->GetLastSaveTime(); 00643 00644 // Write the data out to the file 00645 CXaraFileRecord Rec(TAG_DOCUMENTDATES, TAG_DOCUMENTDATES_SIZE); 00646 ok = Rec.Init(); 00647 00648 if (ok) ok = Rec.WriteINT32(Creation); 00649 if (ok) ok = Rec.WriteINT32(LastSaved); 00650 00651 // Finally, write the record out to file 00652 // In the process get the record number that this was written out as 00653 INT32 RecordNumber = 0L; 00654 if (ok) RecordNumber = pFilter->Write(&Rec); // Get the document comment 00655 00656 // If we have had a problem at any of the stages then return that to the caller 00657 if (!ok || RecordNumber <= 0) 00658 return 0L; 00659 00660 return ok; 00661 00662 #endif 00663 return TRUE; 00664 }
|
|
Save out a document flags record to the file.
Definition at line 731 of file infocomp.cpp. 00732 { 00733 #ifdef DO_EXPORT 00734 ERROR2IF(pFilter == NULL || pDoc == NULL,FALSE,"DocInfoComponent::ExportDocumentFlags Null pFilter or pDoc"); 00735 00736 // Only export information in native files 00737 if (pFilter->IsWebFilter()) 00738 return TRUE; 00739 00740 // Write the data out to the file 00741 BOOL ok = TRUE; 00742 00743 // Find the flags we are interested in 00744 BOOL Multilayer = pDoc->IsMultilayer(); 00745 BOOL AllLayersVisible = pDoc->IsAllVisible(); 00746 00747 UINT32 DocFlags = (Multilayer ? 2 : 0) | (AllLayersVisible ? 1 : 0); 00748 00749 CXaraFileRecord Rec(TAG_DOCUMENTFLAGS, TAG_DOCUMENTFLAGS_SIZE); 00750 ok = Rec.Init(); 00751 00752 if (ok) ok = Rec.WriteUINT32(DocFlags); 00753 00754 // Finally, write the record out to file 00755 // In the process get the record number that this was written out as 00756 INT32 RecordNumber = 0L; 00757 if (ok) RecordNumber = pFilter->Write(&Rec); // Get the document comment 00758 00759 // If we have had a problem at any of the stages then return that to the caller 00760 if (!ok || RecordNumber <= 0) 00761 return 0L; 00762 00763 return ok; 00764 00765 #endif 00766 return TRUE; 00767 }
|
|
Save out a document undo buffer size record to the file.
Definition at line 681 of file infocomp.cpp. 00682 { 00683 #ifdef DO_EXPORT 00684 ERROR2IF(pFilter == NULL || pDoc == NULL,FALSE,"DocInfoComponent::ExportUndoBufferSize Null pFilter or pDoc"); 00685 00686 // Only export information in native files 00687 if (pFilter->IsWebFilter()) 00688 return TRUE; 00689 00690 // Write the data out to the file 00691 BOOL ok = TRUE; 00692 00693 // Find the size of the operation history 00694 UINT32 UndoBufSize = pDoc->GetOpHistory().GetMaxSize(); 00695 00696 CXaraFileRecord Rec(TAG_DOCUMENTUNDOSIZE, TAG_DOCUMENTUNDOSIZE_SIZE); 00697 ok = Rec.Init(); 00698 00699 if (ok) ok = Rec.WriteUINT32(UndoBufSize); 00700 00701 // Finally, write the record out to file 00702 // In the process get the record number that this was written out as 00703 INT32 RecordNumber = 0L; 00704 if (ok) RecordNumber = pFilter->Write(&Rec); // Get the document comment 00705 00706 // If we have had a problem at any of the stages then return that to the caller 00707 if (!ok || RecordNumber <= 0) 00708 return 0L; 00709 00710 return ok; 00711 00712 #endif 00713 return TRUE; 00714 }
|
|
Import the document comment from the current record.
Definition at line 309 of file infocomp.cpp. 00310 { 00311 ERROR2IF(pCXaraFileRecord == NULL,FALSE," DocInfoComponent::ImportDocumentComment pCXaraFileRecord is NULL"); 00312 00313 String_256 Comment; 00314 pCXaraFileRecord->ReadUnicode(&Comment);//Comment, Comment.MaxLength()); 00315 if (pDoc) 00316 { 00317 pDoc->SetComment(&Comment); 00318 } 00319 00320 return TRUE; 00321 }
|
|
Import the document information from the current record.
Definition at line 338 of file infocomp.cpp. 00339 { 00340 ERROR2IF(pCXaraFileRecord == NULL,FALSE," DocInfoComponent::ImportDocumentDates pCXaraFileRecord is NULL"); 00341 00342 // Read in the times/dates from the record 00343 INT32 Creation; 00344 INT32 LastSaved; 00345 00346 pCXaraFileRecord->ReadINT32(&Creation); 00347 pCXaraFileRecord->ReadINT32(&LastSaved); 00348 if (pDoc) 00349 { 00350 pDoc->SetCreationTime((time_t)Creation); 00351 pDoc->SetLastSaveTime((time_t)LastSaved); 00352 } 00353 00354 return TRUE; 00355 }
|
|
Import the document flags from the current record.
Definition at line 411 of file infocomp.cpp. 00412 { 00413 ERROR2IF(pCXaraFileRecord == NULL,FALSE," DocInfoComponent::ImportDocumentFlags pCXaraFileRecord is NULL"); 00414 00415 // Find the flags we are interested in 00416 BOOL Multilayer = FALSE; 00417 BOOL AllLayersVisible = FALSE; 00418 00419 // Read the flags from the record 00420 UINT32 DocFlags = 0; 00421 pCXaraFileRecord->ReadUINT32(&DocFlags); 00422 00423 if (DocFlags & 2) 00424 Multilayer = TRUE; 00425 if (DocFlags & 1) 00426 AllLayersVisible = TRUE; 00427 00428 if (pDoc) 00429 { 00430 pDoc->SetMultilayer(Multilayer); 00431 pDoc->SetAllVisible(AllLayersVisible); 00432 } 00433 00434 return TRUE; 00435 }
|
|
Import the document undo buffer size from the current record.
Definition at line 372 of file infocomp.cpp. 00373 { 00374 PORTNOTETRACE("other","DocInfoComponent::ImportUndoBufferSize - do nothing"); 00375 #ifndef EXCLUDE_FROM_XARALX 00376 ERROR2IF(pCXaraFileRecord == NULL,FALSE," DocInfoComponent::ImportUndoBufferSize pCXaraFileRecord is NULL"); 00377 00378 // Read the size of the operation history from the record 00379 UINT32 UndoBufSize = 0; 00380 pCXaraFileRecord->ReadUINT32(&UndoBufSize); 00381 00382 if (pDoc) 00383 { 00384 // Minimum size = 1K 00385 if (UndoBufSize < 1024) 00386 UndoBufSize = 1024; 00387 00388 // Set the size of the Operation History in 00389 // the document. 00390 pDoc->GetOpHistory().SetNewMaxSize(UndoBufSize); 00391 } 00392 #endif 00393 return TRUE; 00394 }
|
|
Inform the information document component that a Web or Native export is about to start.
Reimplemented from DocComponent. Definition at line 492 of file infocomp.cpp. 00493 { 00494 #ifdef DO_EXPORT 00495 ERROR2IF(pFilter == NULL, TRUE, "DocInfoComponent::StartExport filter is null!"); 00496 00497 BOOL ok = TRUE; 00498 00499 // The export hint gets written out here (if the document has one) 00500 Document * pDoc = pFilter->GetDocument(); 00501 if (pDoc) 00502 { 00503 ExportHint* pHint = pDoc->GetExportHint(); 00504 00505 // If there is a hint then write it out... 00506 if (pHint) 00507 ok = pHint->WriteExportHintRecord(pFilter); 00508 } 00509 00510 return(ok); 00511 #else 00512 return(TRUE); 00513 #endif 00514 }
|
|
Inform the information document component that a Web or Native export is about to start. This version of StartExport is called before compression is started up. This means we can save the comment record in the uncompressed section of the file so that it is easy for the indexer to find.
Reimplemented from DocComponent. Definition at line 455 of file infocomp.cpp. 00456 { 00457 #ifdef DO_EXPORT 00458 if (pFilter == NULL) 00459 { 00460 ERROR3("DocInfoComponent::StartExportBeforeComp filter is null!"); 00461 return TRUE; 00462 } 00463 00464 // The document comment should be amongst the first bits of data to be exported 00465 // and must be in the uncompressed section as the gallery searches for it. 00466 Document * pDoc = pFilter->GetDocument(); 00467 if (pDoc) 00468 { 00469 /*BOOL ok =*/ ExportDocumentComment(pFilter, pDoc); 00470 } 00471 00472 #endif 00473 return TRUE; 00474 }
|
|
Inform the unit list document component that a Native or Web import is about to start.
Reimplemented from DocComponent. Definition at line 252 of file infocomp.cpp. 00253 { 00254 TRACEUSER( "Neville", _T("DocInfoComponent::StartImport\n")); 00255 if (pFilter == NULL) 00256 { 00257 ERROR3("DocInfoComponent::EndExport filter is null!"); 00258 return TRUE; 00259 } 00260 00261 return TRUE; 00262 }
|