home *** CD-ROM | disk | FTP | other *** search
/ PC World 1998 October / PCWorld_1998-10_cd.bin / software / prehled / komix / DATA.Z / worddocedi.tcl < prev    next >
Text File  |  1997-07-18  |  2KB  |  89 lines

  1. #---------------------------------------------------------------------------
  2. #
  3. #      (c)     Cayenne Software Inc.    1997
  4. #
  5. #      File:           @(#)worddocedi.tcl    /main/titanic/2
  6. #      Author:         <generated>
  7. #      Description:
  8. #---------------------------------------------------------------------------
  9. # SccsId = @(#)worddocedi.tcl    /main/titanic/2   18 Jul 1997 Copyright 1997 Cayenne Software Inc.
  10.  
  11. # Start user added include file section
  12. # End user added include file section
  13.  
  14. require_module_file "doceditor.tcl" docwriter
  15.  
  16. Class WordDocEditor : {DocEditor} {
  17.     constructor
  18.     method destructor
  19.     method connect
  20.     method disconnect
  21.     method edit
  22.     method show
  23.     method print
  24.     method preview
  25.     attribute wordObj
  26. }
  27.  
  28. constructor WordDocEditor {class this name_1} {
  29.     set this [DocEditor::constructor $class $this $name_1]
  30.     # Start constructor user section
  31.     $this printsIncluded y
  32.     $this name Word
  33.     $this version 70
  34.     $this localSectionTypes "[$this localSectionTypes] Doc"
  35.     # End constructor user section
  36.     return $this
  37. }
  38.  
  39. method WordDocEditor::destructor {this} {
  40.     # Start destructor user section
  41.     # End destructor user section
  42.     $this DocEditor::destructor
  43. }
  44.  
  45. method WordDocEditor::connect {this} {
  46.     uplevel #0 require wordautoma.tcl
  47.     $this wordObj [WordAutomationObject new]
  48. }
  49.  
  50. method WordDocEditor::disconnect {this} {
  51.     [$this wordObj] delete
  52. }
  53.  
  54. method WordDocEditor::edit {this docSection} {
  55.     # look up winword in the registry
  56.     if [catch {
  57.         set wwCurVer [registry get HKEY_CLASSES_ROOT \
  58.                 "Word.Document\\CurVer" "(Default)"]
  59.         
  60.         set wwExe [registry get HKEY_CLASSES_ROOT \
  61.                 "$wwCurVer\\shell\\open\\command" "(Default)"]
  62.         }] {
  63.         wmtkerror "[$docSection uiName]: edit failed, Word not found"
  64.         return
  65.     }
  66.  
  67.     wmtkmessage "Starting edit for section '[$docSection uiName]'"
  68.     set cmd [list \
  69.         "$wwExe [$docSection docLocation] &" \
  70.         [$docSection uiName] \
  71.     ]
  72.     $docSection execute "$cmd"
  73. }
  74.  
  75. method WordDocEditor::show {this docSection} {
  76.     $this edit $docSection
  77. }
  78.  
  79. method WordDocEditor::print {this docSection} {
  80.     $this edit $docSection
  81. }
  82.  
  83. method WordDocEditor::preview {this docSection} {
  84.     $this edit $docSection
  85. }
  86.  
  87. # Do not delete this line -- regeneration end marker
  88.  
  89.