Dialog Dump
Introduction
Every OpenOffice.org who ever needed to create a VCL dialog knows that this can be a ... laborious procedure: You need to
- define your dialog, with a text editor, in a resource file (.src), including manual maintainance of control sizes and positions
- define the IDs for your dialog's elements in a separate .hrc file
- create a class definition for your dialog in yet another .hxx file
- create an initial class implementation in a .cxx file
All of this is laborious, cumbersome, and not really fun to do.
dialogdump is a Java tool which relieves you from some of those tasks, by dumping UNO dialogs to source code. This way, you can create your dialogs in the OpenOffice.org Dialog Editor (Tools / Macros / Organize Dialogs ...
), and let dialogdump create all 4 files with initial content - ready to be compiled.
Usage
dialogdump is a command line tool. You give it the names of the dialogs you want to dump as follows
dialogdump [switches] <dialog_name_1> [<dialog_name_2> [<dialog_name_3> ... ]]
Dialogs to Dump
A dialog name is composed of the module, plus the actual name. So, for instance
dialogdump Standard.MyDialog
will dump the dialog named "MyDialog" in the application-wide module "Standard"
If you want to dump dialogs which are not application-wide, but part of a document, use the --document
switch:
dialogdump --document "c:\documents\dialog designs.odt" Demos.HelloWorld
will dump the dialog named "HelloWorld", located in the "Demos" module in the document "c:\documents\dialog designs.odt".
Output
By default, all output happens on the console. You can override this with the --file
switch:
dialogdump --file c:\source\hello Demos.HelloWorld Demos.SimpleInput
will create the following files:
- c:\source\hello.hrc - contains the resource identifier definitions
- c:\source\hello.src - contains the resource definitions
- c:\source\hello.hxx - contains the class declarations
- c:\source\hello.cxx - contains the class implementations
All those files will be ready to compile - place them in a directory of your choice, and add them to the respective makefile. Note, however, that you certainly want to tweak the files:
- The identifiers for the global dialogs are placed in the .hrc file, but this is not their proper place. You should move them to the central .hrc file for your complete source module, where you collect all global resouce identifiers for the module.
- The dialog classes are constructed as follows
[c++]
HelloWorldDialog::HelloWorldDialog( Window* _pParent )
:ModalDialog( _pParent, ResId( DLG_HELLO_WORLD )
...
Note that there is a ResId
in the call to the ModalDialog
constructor. You will want to replace this with the resource-id-class for your module.
In general, look for [c++]TODO:
in the generated files - this will tell you placed you need to tweak.