home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Demos / OOFILE / OOFILE AppMaker / FileAndFind / Pre-built version, as generated / CFileAndFindDoc.cp < prev    next >
Encoding:
Text File  |  1995-09-30  |  3.7 KB  |  98 lines  |  [TEXT/MMCC]

  1. // CFileAndFindDoc.cp -- Document methods
  2. // Created 01/01/95 12:01 PM by AppMaker
  3.  
  4. #include "CFileAndFindDoc.h"
  5.  
  6. #include "CListArticles.h"
  7.  
  8. #include <LFile.h>
  9. #include <LPlaceHolder.h>
  10. #include <LPrintout.h>
  11. #include <LWindow.h>
  12. #include <UWindows.h>
  13. #include <String_Utils.h>
  14.  
  15. #include "FileAndFind_OOFILE.h"
  16. #include "CEditArticle.h"
  17. #include "CEditArticle.h"
  18.  
  19. const ResIDT    prto_PrintView        = 201;
  20. const ResIDT    STRx_Untitled        = 128;
  21.  
  22. // ---------------------------------------------------------------------------
  23. //        • CFileAndFindDoc
  24. // ---------------------------------------------------------------------------
  25.  
  26. CFileAndFindDoc::CFileAndFindDoc(
  27.     LCommander    *inSuper)
  28.         : LSingleDoc(inSuper)
  29. , mData(0)
  30. , mArticles(0)
  31. {
  32. }
  33.  
  34. // ---------------------------------------------------------------------------
  35. //        • ~CFileAndFindDoc
  36. // ---------------------------------------------------------------------------
  37. //    Destructor
  38. //
  39.  
  40. CFileAndFindDoc::~CFileAndFindDoc()
  41. {
  42.     delete mData;
  43. delete mArticles;
  44. }
  45.  
  46. //----------
  47. void
  48. CFileAndFindDoc::newFile()
  49. {
  50. FSSpec    fileSpec;
  51. if (AskSaveAs(fileSpec, true)) {
  52. MakeDatabaseObjects();
  53. mData->newConnection(OOF_MacString(fileSpec.name));
  54. CompleteOpenFile(&fileSpec);
  55. }
  56. }
  57.  
  58. //----------
  59. void
  60. CFileAndFindDoc::openFile(
  61.     FSSpec        *inFileSpec)
  62. {
  63. MakeDatabaseObjects();
  64. mData->openConnection(OOF_MacString(inFileSpec->name));
  65. CompleteOpenFile(inFileSpec);
  66. }
  67.  
  68.  
  69.  
  70. // ---------------------------------------------------------------------------
  71. //        • DoPrint
  72. // ---------------------------------------------------------------------------
  73. //    Print the contents of the Document
  74.  
  75. void
  76. CFileAndFindDoc::DoPrint()
  77. {
  78.     LPrintout        *thePrintout = LPrintout::CreatePrintout(prto_PrintView);
  79.     LPlaceHolder    *textPlace = (LPlaceHolder *)
  80.                                     thePrintout->FindPaneByID('TBox');
  81. //!    textPlace->InstallOccupant(mTextView, atNone);
  82.  
  83.  
  84.     thePrintout->DoPrintJob();
  85.     delete thePrintout;
  86. }
  87.  
  88. //----------
  89. Boolean
  90. CFileAndFindDoc::ObeyCommand(
  91.     CommandT    inCommand,
  92.     void        *ioParam)
  93. {
  94.     Boolean        cmdHandled = true;
  95.  
  96.     switch (inCommand) {
  97.  
  98.     // +