-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Jorge Marques Pelizzoni wrote:
|> Hi, all!
|>
|> I'd like to write a macro setting some of OOo's options (Menu
|> Tools->Options) programatically. Can this be done?
|>
|> So far, by means of recording a macro, I've just got to:
|>
|> dispatcher =
|> createUnoService("com.sun.star.frame.DispatchHelper")
|> dispatcher.executeDispatch(document, ".uno:OptionsTreeDialog",
|> "", 0, Array())
|>
|> which displays the options dialog. I guess using the right
|> command URLs might do it, but I cannot find this sort of info in
|> the docs.
Hi, i've written some time ago a macro that creates a datasource
with values taken from a drawing designed as a form.
Danny Brewer also did an example to alter some Settings.
I'm sure you will find other appropriate examples at
http://www.ooomacros.org/
Maybe you can get a short view into the way of doing changes to
the OpenOffice - Options. Most of the names of the services can
be retrieved out of the xml-files where the Options will be saved.
They are located at <OOoPath>/share/registry/data/org/openoffice/
Have a look at the structure of these xml-files.
The code without the form-handlings:
Sub CreateDataSource (cDatabaseURL, cDatabaseUser, cDriverClass,
cDatabaseName)
Dim oContext as object, oNewSource as object
Dim InfoProperties(4) as New com.sun.star.beans.PropertyValue
~ 'Get database context
~ oContext = createUnoService("com.sun.star.sdb.DatabaseContext")
~ 'Create new data source instance
~ oNewSource = oContext.createInstance()
~ 'Set up parameters
~ 'URL includes type of database (MySQL, ODBC, spreadsheet, etc).
This is as it appears
~ 'in the "Data Source URL" box of the Data Source Administration
dialogue
~ oNewSource.URL = cDatabaseURL
~ 'Password required?
~ oNewSource.IsPasswordRequired = True
~ 'User name
~ oNewSource.User = cDatabaseUser
~ ' THe InfoProperties are located in subnotes of the DataSource Node
~ ' We're not able to create them via the createInstance-method
~ InfoProperties(0).Name = "AutoIncrementCreation"
~ InfoProperties(0).Value = ""
~ InfoProperties(1).Name = "AutoRetrievingStatement"
~ InfoProperties(1).Value = ""
~ InfoProperties(2).Name = "EnableSQL92Check"
~ InfoProperties(2).Value = False
~ InfoProperties(3).Name = "IsAutoRetrievingEnabled"
~ InfoProperties(3).Value = False
~ InfoProperties(4).Name = "JavaDriverClass"
~ InfoProperties(4).Value = cDriverClass
~ oNewSource.Info = InfoProperties()
~ 'Register new data source. First parameter is data source name, as
it will appear
~ 'in the Data Source Administration dialogue, second one is the
complete Information
~ 'in the node
~ oContext.RegisterObject (cDatabaseName, oNewSource)
End Sub
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
iD8DBQFCN+IraXgUt+wiTuERAr4GAKCkG0lrbhlBkjiMBWiMCOxpCSyy5ACeOi/2
eBz/lT2Ve99fQcO2RR7iRgE=
=vH1u
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]