home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Westmount Technology 1994
- #
- # File: @(#)wordautoma.tcl /main/hindenburg/2
- # Description: Ole Automation Interface for Word.Basic
- # these are the used methods that do not
- # dispatch automatically (because of type mismatches)
- # therefore they are specified here
- #---------------------------------------------------------------------------
- # SccsId = @(#)wordautoma.tcl /main/hindenburg/2 28 Oct 1996 Copyright 1994 Westmount Technology
-
- # If Word gives a type mismatch on a method it is possible
- # to specify the method parameter(s) ourselves via the
- # 'knownDispatch' method.
- # The format is:
- # knownDispatch <name> <type specification> ?parameters?
- # name - the name of the method
- # type specification - hexadecimal encoded parameter type specification
- # parameters - parameter values
- #
- # The type specification has a 4 digit string for every parameter.
- # So for 5 parameters it has 20 digits. If the number of digits/4 do
- # not match the number of parameters an error is generated.
- #
- # most common problem with Word is that the 2 byte signed int
- # (VT_I2 = 0002) is not recognized.
- #
- # Parameter encoding:
- #
- # VT_EMPTY 0000 nothing
- # VT_NULL 0001 SQL style Null
- # VT_I2 0002 2 byte signed int
- # VT_I4 0003 4 byte signed int
- # VT_R4 0004 4 byte real
- # VT_R8 0005 8 byte real
- # VT_CY 0006 currency
- # VT_DATE 0007 date
- # VT_BSTR 0008 OLE Automation string
- # VT_DISPATCH 0009 IDispatch FAR*
- # VT_ERROR 000A SCODE
- # VT_BOOL 000B True=-1, False=0
- # VT_VARIANT 000C VARIANT FAR*
- # VT_UNKNOWN 000D IUnknown FAR*
- # VT_I1 0010 signed char
- # VT_UI1 0011 unsigned char
- # VT_UI2 0012 unsigned short
- # VT_UI4 0013 unsigned short
- # VT_I8 0014 signed 64-bit int
- # VT_UI8 0015 unsigned 64-bit int
- # VT_INT 0016 signed machine int
- # VT_UINT 0017 unsigned machine int
- # VT_VOID 0018 C style void
- # VT_HRESULT 0019
- # VT_PTR 001A pointer type
- # VT_SAFEARRAY 001B (use VT_ARRAY in VARIANT)
- # VT_CARRAY 001C C style array
- # VT_USERDEFINED 001D user defined type
- # VT_LPSTR 001E null terminated string
- # VT_LPWSTR 001F wide null terminated string
-
-
- Class WordAutomationObject : {OleAutoObject} {
- constructor
- method destructor
- method chkInsert
-
- method EditBookmark
- method SetDocumentProperty
- method FormatParagraph
- method FormatPicture
- method CharRight
- }
-
- constructor WordAutomationObject {class this} {
- set this [OleAutoObject::constructor $class $this Word.Basic]
- # load English interface file for Word
- $this loadTypeLibrary [m4_path_name etc wb70en32.tlb]
- return $this
- }
-
- method WordAutomationObject::destructor {this} {
-
- }
-
- method WordAutomationObject::chkInsert {this {str ""}} {
- # wrapper for Insert
- # if str == "" skip Insert
- #
- if {$str != ""} {
- # VT_BSTR 0008 OLE Automation string
- set tp 0008
- $this knownDispatch Insert $tp $str
- }
- }
-
- method WordAutomationObject::EditBookmark {this name sortBy add del goto} {
- set tp 00080002000b000b000b
- $this knownDispatch EditBookmark $tp $name $sortBy $add $del $goto
- }
-
- method WordAutomationObject::SetDocumentProperty {this name type val builtin} {
- set tp 0008000200080002
- $this knownDispatch SetDocumentProperty $tp $name $type $val $builtin
- }
-
- method WordAutomationObject::FormatPicture {this size crl crr crt crb scx scy szx szy} {
- set tp 000200080008000800080008000800080008
- $this knownDispatch FormatPicture $tp $size $crl $crr $crt $crb $scx $scy $szx $szy
- }
-
- method WordAutomationObject::CharRight {this count select} {
- set tp 00020002
- $this knownDispatch CharRight $tp $count $select
- }
-
-