home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Westmount Technology 1994
- #
- # File: @(#)worddoccon.tcl /main/hindenburg/8
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)worddoccon.tcl /main/hindenburg/8 28 Oct 1996 Copyright 1994 Westmount Technology
-
- # Start user added include file section
- # End user added include file section
-
-
- Class WordDocConGen : {Object} {
- method destructor
- constructor
- method generate
- method genComponent
- method getText
- method genPicture
- method section
- attribute section
- attribute word
- attribute _section
- }
-
- method WordDocConGen::destructor {this} {
- set ref [$this _section]
- if {$ref != ""} {
- $ref _contentsGenerator ""
- }
- # Start destructor user section
- # End destructor user section
- }
-
- constructor WordDocConGen {class this name section} {
-
- set this [Object::constructor $class $this $name]
- $this section $section
- return $this
- }
-
- method WordDocConGen::generate {this} {
-
- set w [[[docTool document] editor] wordObj]
- $this word $w
- if [catch {
- # copy the initial contents if available
- set dest [[$this section] docLocation]
- $w FileOpen $dest
- $w EditSelectAll
- $w EditClear
- if {[$w ViewMasterDocument] == 0} {
- error "document not in 'Master Document View'"
- }
- set title [[$this section] uiName]
- $w SetDocumentProperty Title 0 "$title" 0
-
- set indentLevel [[$this section] indentation]
- $w FormatStyle "OT Hdg $indentLevel"
- $w chkInsert [[$this section] uiName]
- $w InsertPara
- $w FormatStyle "OT Body Text"
-
- set inSubdoc 0
- set subLevel 0
-
- foreach sect [[$this section] getTree] {
- set level [$sect indentation]
- set name [$sect uiName]
- set type [$sect type]
- set class [$sect operationClass]
- if {$inSubdoc} {
- # Check for end of subdoc
- if {$level <= $subLevel} {
- set inSubdoc 0
- set subLevel 0
- }
- }
-
- if {!$inSubdoc} {
- # Check if the section is
- # manipulatable. If so then skip
- # this section and all it's underlying sections.
- if {$class == "manipulate"} {
- # In subdocument
- set inSubdoc 1
- set subLevel $level
- $w InsertSubdocument [$sect docLocation]
- $w EndOfDocument
- } else {
- # Generate contents for this section
- $this genComponent $sect
- }
- $w FileSaveAs
- }
- }
- $w FileSaveAs
- } msg] {
- wmtkerror "Word Automation Error: $msg"
- }
- }
-
- method WordDocConGen::genComponent {this section} {
- case [$section docType] {
- {Wmf} {$this genPicture $section}
- {default} { $this getText $section}
- }
- }
-
- method WordDocConGen::getText {this section} {
- set w [$this word]
- set indentLevel [$section indentation]
- $w FormatStyle "OT Hdg $indentLevel"
- $w chkInsert [$section docTitle]
- $w InsertPara
- $w FormatStyle "OT Body Text"
- set file [$section docLocation]
- $w InsertFile $file = 0.0 1.0
- $w InsertPara
- }
-
- method WordDocConGen::genPicture {this section} {
- set w [$this word]
- set indentLevel [$section indentation]
- $w FormatStyle "OT Hdg $indentLevel"
- $w chkInsert [$section docTitle]
- $w InsertPara
- $w FormatStyle "OT Body Text"
- $w InsertPicture [$section docLocation] 2
- # go to previous graphic
- $w EditGoto g-1
- $w CharRight 1 1
- $w EndOfDocument
- $w InsertPara
- }
-
- # Do not delete this line -- regeneration end marker
-
- method WordDocConGen::section {this args} {
- if {$args == ""} {
- return [$this _section]
- }
- set ref [$this _section]
- if {$ref != ""} {
- $ref _contentsGenerator ""
- }
- set obj [lindex $args 0]
- if {$obj != ""} {
- $obj _contentsGenerator $this
- }
- $this _section $obj
- }
-
-