We're currently trying to switch our application from using Microsoft Word to OpenOffice Writer. So far, all has gone smoothly (no problems changing from Excel to Calc, BTW), except that I can't figure out how to have my Progress code (10.1C) notified when the Writer document is saved or when Writer/OpenOffice is closed. I suppose the problem is that I'm dealing with .uno instead of .com, but I do have a com-handle ...
Any ideas would be *greatly* appreciated - I've been banging my head against a wall here for days.
Appropriate internal procedures for WriterEvents.[close,closeApplication,disposing,onFirstVisibleTask,onSave,Save,Terminate]
all exist.
Any ideas would be *greatly* appreciated - I've been banging my head against a wall here for days.
Code:
define variable ch-OpenOffice as com-handle no-undo.
define variable ch-WriterApplication as com-handle no-undo.
define variable ch-writerDocument as com-handle no-undo.
[SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]/* start OpenOffice */[/COLOR][/SIZE][/COLOR][/SIZE]
[LEFT][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]create[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"com.sun.star.ServiceManager"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] ch-OpenOffice.[/SIZE] [/LEFT]
[LEFT][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]/* open a Writer application */[/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2]ch-WriterApplication = [/SIZE][/LEFT]
[SIZE=2] ch-OpenOffice:createInstance([/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"com.sun.star.frame.Desktop"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]).[/SIZE]
[LEFT][SIZE=2][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]/* open a blank document */[/COLOR][/SIZE][/COLOR][/SIZE][/SIZE]
[SIZE=2][SIZE=2]ch-WriterDocument = ch-WriterApplication:loadComponentFromURL([/SIZE][/SIZE]
[SIZE=2][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff] "private:factory/swriter"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2],[/SIZE][/SIZE]
[SIZE=2][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff] "_blank"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2],[/SIZE][/SIZE][SIZE=2]
[SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff] 0[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2],[/SIZE]
[SIZE=2] extraArgs).[/SIZE][/LEFT]
[SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]/* save the blank document into our scratch file */[/COLOR][/SIZE][/COLOR][/SIZE]
[LEFT][SIZE=2]ch-WriterDocument:storeAsURL([/SIZE]
[SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff] "file:///"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] + [/SIZE][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]replace[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2](lv-scratchFile,[/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"\"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2],[/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"/"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]),[/SIZE][/LEFT]
[SIZE=2] extraArgs).[/SIZE]
[LEFT][SIZE=2][COLOR=seagreen]/* have also tried doing this with the Writer handle and the document[/COLOR][/SIZE]
[SIZE=2][COLOR=seagreen]handle - doesn't help */[/COLOR][/SIZE]
[SIZE=2]ch-OpenOffice:enable-events("WriterEvents").[/SIZE][/LEFT]
[/SIZE]
Appropriate internal procedures for WriterEvents.[close,closeApplication,disposing,onFirstVisibleTask,onSave,Save,Terminate]
all exist.