I'm developing an application which needs to work with the Apple version of MS-Word using Scripting Bridge . I need to call a command of MS-Word defined in its sdef file but I can't figure out how to do it.
The definition of the command in the sdef file
<command name="reset" code="sTXTmFBr" description="Removes paragraph formatting that differs from the underlying style. For example, if you manually right align a paragraph and the underlying style has a different alignment, the reset method changes the alignment to match the style formatting.">
<direct-parameter type="4046"/>
</command>
and its definition in the header file
@interface WordApplication : SBApplication
...
- (void) reset:(Word4046)x; // Removes paragraph formatting that differs from the underlying style. For example, if you manually right align a paragraph and the underlying style has a different alignment, the reset method changes the alignment to match the style formatting.
...
@end
The definition of the type of the direct-parameter in the sdef file:
<enumeration name="4046" code="4046">
<enumerator name="paragraph" code="cpar"/>
<enumerator name="paragraph format" code="w136"/>
</enumeration>
and its definition in the header file
enum Word4046 {
Word4046Paragraph = 'cpar',
Word4046ParagraphFormat = 'w136'
};
typedef enum Word4046 Word4046;
The definition of the class of the object I want to reset:
<class name="paragraph format" code="w136" description="Represents all the formatting for a paragraph." inherits="base object" plural="paragraph formats">
...
</class>
and its definition in the header file
// Represents all the formatting for a paragraph.
@interface WordParagraphFormat : WordBaseObject
...
@end
The only way my app compiles and doesn't crash is:
WordApplication *sbApplication; // SBObject which represents Word App
WordParagraphFormat *sbParagraph; // SBObject which represents a paragraph format
[sbApplication reset:Word4046ParagraphFormat]
but it obviously does nothing because I'm not specifying the object I want to reset but the type of that object.
How can I reset the sbParagraph object?
Thanks.