home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1997 November
/
PCWorld_1997-11_cd.bin
/
software
/
programy
/
komix
/
DATA.Z
/
wd97doccon.tcl
< prev
next >
Wrap
Text File
|
1997-05-23
|
4KB
|
168 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1997
#
# File: @(#)wd97doccon.tcl /main/hindenburg/1
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)wd97doccon.tcl /main/hindenburg/1 23 May 1997 Copyright 1997 Cayenne Software Inc.
# Start user added include file section
# End user added include file section
Class Wd97DocConGen : {Object} {
method destructor
constructor
method generate
method genComponent
method getText
method genPicture
method section
attribute section
attribute word
attribute _section
}
method Wd97DocConGen::destructor {this} {
set ref [$this _section]
if {$ref != ""} {
$ref _contentsGenerator ""
}
# Start destructor user section
# End destructor user section
}
constructor Wd97DocConGen {class this name section} {
set this [Object::constructor $class $this $name]
$this section $section
return $this
}
method Wd97DocConGen::generate {this} {
if [catch {
set app [[[docTool document] editor] app]
set docs [$app property Documents]
set dest [[$this section] docLocation]
# open file
set d [$docs Open $dest]
# set in Master Document View
set activeWindow [$d property ActiveWindow]
set view [$activeWindow property View]
$view property Type 5
# expand sub documents
set subDocs [$d property SubDocuments]
$subDocs property Expanded true
# delete current contents
set cnt [$d property Content]
$cnt Select
$cnt Delete
set indentLevel [[$this section] indentation]
$cnt InsertAfter [[$this section] uiName]
$cnt property Style "OT Hdg $indentLevel"
$cnt InsertParagraphAfter
$cnt Collapse 0
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
$cnt Collapse 0
$cnt Select
$subDocs AddFromFile [$sect docLocation]
} else {
# Generate contents for this section
$this genComponent $sect
}
}
}
$d Close -1
} msg] {
wmtkerror "Word Automation Error: $msg"
}
}
method Wd97DocConGen::genComponent {this section} {
case [$section docType] {
{Emf} {$this genPicture $section}
{default} { $this getText $section}
}
}
method Wd97DocConGen::getText {this section} {
set app [[[docTool document] editor] app]
set d [$app property ActiveDocument]
set cnt [$d Range]
$cnt Collapse 0
set indentLevel [$section indentation]
$cnt property Style "OT Hdg $indentLevel"
$cnt InsertAfter [$section docTitle]
$cnt InsertParagraphAfter
$cnt Collapse 0
$cnt property Style "OT Body Text"
$cnt Select
set file [$section docLocation]
$cnt InsertFile $file "" 0.0 1.0 0.0
$cnt InsertParagraphAfter
$cnt Collapse 0
}
method Wd97DocConGen::genPicture {this section} {
set app [[[docTool document] editor] app]
set d [$app property ActiveDocument]
set cnt [$d Range]
$cnt Collapse 0
set indentLevel [$section indentation]
$cnt property Style "OT Hdg $indentLevel"
$cnt InsertAfter [$section docTitle]
$cnt InsertParagraphAfter
$cnt Collapse 0
$cnt Select
set sh [$d property InlineShapes]
$sh AddPicture [$section docLocation] true true $cnt
set cnt [$d Range]
$cnt Collapse 0
$cnt InsertParagraphAfter
$cnt Collapse 0
}
# Do not delete this line -- regeneration end marker
method Wd97DocConGen::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
}