OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

How changing Options>general>open/save dialogs with ma

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
Fernand
OOo Enthusiast
OOo Enthusiast


Joined: 22 Jun 2004
Posts: 132

PostPosted: Wed Mar 23, 2005 4:15 am    Post subject: How changing Options>general>open/save dialogs with ma Reply with quote

Hi all,
Try to make a macro who can change different options settings
So i found that it must be done bi the "configuration" manager , looked at the work done by DannyB, but how do i find out how to change certain settings. Specific the setting who declares the choice between using OOdialogs or system dialog for open/save.
Thanks for any hints
Back to top
View user's profile Send private message Send e-mail
DannyB
Moderator
Moderator


Joined: 02 Apr 2003
Posts: 4021
Location: Lawrence, Kansas, USA

PostPosted: Fri Mar 25, 2005 12:14 pm    Post subject: Re: How changing Options>general>open/save dialogs wit Reply with quote

Fernand wrote:
Try to make a macro who can change different options settings
So i found that it must be done bi the "configuration" manager , looked at the work done by DannyB, but how do i find out how to change certain settings. Specific the setting who declares the choice between using OOdialogs or system dialog for open/save.


I detect (at least) two questions here. But the two I will answer....

  1. How do I change the UseSystemFileDialog property under the /org.openoffice.Office.Common/Misc configuration node?
  2. How do I know which configuration node, and which property are tied to each user interface item in the office?


Answer to 1....
Code:
Sub Main
   oConfigAccess = GetConfigAccess( "/org.openoffice.Office.Common/Misc", True, True )
   oConfigAccess.UseSystemFileDialog = False
   oConfigAccess.commitChanges()
End Sub

The change only takes effect after you quit and re-launch the office.

Here is how you find out which way the setting is currently set....
Code:
Sub Main
   oConfigAccess = GetConfigAccess( "/org.openoffice.Office.Common/Misc" )
   Print oConfigAccess.UseSystemFileDialog
End Sub


To make both of the above code samples work, you need to add this code and stir lightly....
Code:
Function MakePropertyValue( Optional cName As String, Optional uValue ) As com.sun.star.beans.PropertyValue
   Dim oPropertyValue As New com.sun.star.beans.PropertyValue
   If Not IsMissing( cName ) Then
      oPropertyValue.Name = cName
   EndIf
   If Not IsMissing( uValue ) Then
      oPropertyValue.Value = uValue
   EndIf
   MakePropertyValue() = oPropertyValue
End Function


Function GetConfigAccess( ByVal cNodePath As String,_
                     Optional bWriteAccess,_
                     Optional bEnableSync,_
                     Optional bLazyWrite ) As Object
   If IsMissing( bWriteAccess ) Then
      bWriteAccess = False
   EndIf
   If IsMissing( bEnableSync ) Then
      bEnableSync = True
   EndIf
   If IsMissing( bLazyWrite ) Then
      bLazyWrite = False
   EndIf

'   If bWriteAccess  And  bEnableSync Then
      oConfigProvider = GetProcessServiceManager().createInstanceWithArguments(_
                     "com.sun.star.configuration.ConfigurationProvider",_
                     Array( MakePropertyValue( "enableasync", bEnableSync ) ) )
'   Else
'      oConfigProvider = createUnoService( "com.sun.star.configuration.ConfigurationProvider" )
'   EndIf
   
   If bWriteAccess Then
      cServiceName = "com.sun.star.configuration.ConfigurationUpdateAccess"
   Else
      cServiceName = "com.sun.star.configuration.ConfigurationAccess"
   EndIf
   
   oConfigAccess = oConfigProvider.createInstanceWithArguments( cServiceName,_
      Array( MakePropertyValue( "nodepath", cNodePath ),_
            MakePropertyValue( "lazywrite", bLazyWrite ) ) )
   
   GetConfigAccess() = oConfigAccess
End Function




Answer to 2....
....oh boy.....
that's a long answer.

Start at your OpenOffice.org installation folder.
Windows: C:\Program Files\OpenOffice.org1.1.5
Linux: /opt/OpenOffice.org1.1.5

Find this subfolder....
OOo/share/registry/schema/

Under that is the "org" folder. This folder and its contents correspond to the configuration nodes.

Notice in the earlier example how we want to affect the configuration node: /org.openoffice.Office.Common/Misc

This Schema would be defined in the file:
OOo/share/registry/schema/org/openoffice/Office/Common.xcs

Similarly, the actual value of the property would be in the file....
OOo/user/registry/data/org/openoffice/Office/Common.xcu

Note: the "user" folder may be somewhere you don't expect such as
C:\Documents and Settings\dbrewer\Application Data\OpenOffice.org1.1.5\user
/home/danny/OpenOffice.org1.1.5/user

The "Misc" part of the node /org.openoffice.Office.Common/Misc would be the <group oor:name="Misc"> tag in the schema (XCS), or the <node oor:name="Misc"> tag in the configuration data (XCU).


I suppose you can explore the Schema files, which document every possible setting in the configuration data.

Here's a secret. How do I find out what setting was affected?

  • Quit out of the office
  • Make a backup of the "org" file in the user directory. That is, the tree of configuration nodes in the user folder.
  • Start the office.
  • Change some settings, such as whether to use the system file dialog or OOo's own file dialogs.
  • Quit out of the office.
  • Go look at the "org" folder under the user directory. Find which file has today's timestamp on it. That is, what file did the office software just change? Ah ha! It was the user/registry/data/org/openoffice/Office/Common.xcu file!
  • Use a tool like the diff command, (or WinDiff if you are afflicted with Windows), to find the differences between your Common.xcu and the backed up copy you made earlier.




See Also....



Configuration Manager
=====================

Use System File Dialog or OOo open file dialog
http://www.oooforum.org/forum/viewtopic.phtml?p=71961#71961

Number of times you can UNDO
http://www.oooforum.org/forum/viewtopic.php?p=45487#45487

Get rid of product registration
http://www.oooforum.org/forum/viewtopic.php?t=2267

* The Configuration Manager chapter of the Developer's Guide.
* My post titled: ENLARGE THE SIZE OF YOUR recent files list
http://www.oooforum.org/forum/viewtopic.php?t=3559

* My post titled: FYI...new macro to make OOo listen for UNO connections
* UnoConnectionListener
http://www.oooforum.org/forum/viewtopic.php?t=3754

* My post titled: Development of a Basic Macro Installer
http://www.oooforum.org/forum/viewtopic.php?t=4255

* Example of creating top level menu items
http://www.oooforum.org/forum/viewtopic.php?t=6310
How To Add Top Level Menu
http://www.oooforum.org/forum/viewtopic.phtml?t=16759

* Example of creating new toolbar items
http://www.oooforum.org/forum/viewtopic.php?p=29341#29341

* Duplicate Shape installable draw tool
http://www.ooomacros.org/user.php#115800

* Brief explanation of how Config API ties to XCU files
http://www.oooforum.org/forum/viewtopic.php?p=24558#24558

* Explanation of custom XCS and XCU files using pkgchk
http://www.oooforum.org/forum/viewtopic.php?p=27922#27922

* Addon.xcs, custom configuration schema, accessing from code,
how to put xcs/xcu files into your component.
http://www.oooforum.org/forum/viewtopic.php?p=62655#62655

* My post titled: Musings about the Configuration Manager
http://www.oooforum.org/forum/viewtopic.php?t=4028

* Add On Tool
http://www.oooforum.org/forum/viewtopic.php?t=4059

Development of a Basic macro installer
http://www.oooforum.org/forum/viewtopic.php?t=4255

How to change default fonts programatically?
http://www.oooforum.org/forum/viewtopic.php?p=16982#16982

Dropdown Menus in Custom Toolbars
http://www.oooforum.org/forum/viewtopic.php?t=4008

TypeDetection.xml
http://www.oooforum.org/forum/viewtopic.php?t=3692
Description of TypeDetection.xcu
http://www.oooforum.org/forum/viewtopic.php?t=10111

Disabling menus items at runtime
http://www.oooforum.org/forum/viewtopic.php?t=3558

Configuring to listen for UNO connections
http://www.oooforum.org/forum/viewtopic.php?p=12370#12370
http://www.oooforum.org/forum/viewtopic.php?t=9768

Unanswered...possible to specify alternate configuration at launch time?
http://www.oooforum.org/forum/viewtopic.php?t=6798

What version of OOo is running?
Installed version of SOffice
http://www.oooforum.org/forum/viewtopic.php?p=37431
get the OpenOffice version
http://www.oooforum.org/forum/viewtopic.php?t=12008
_________________
Want to make OOo Drawings like the colored flower design to the left?
Back to top
View user's profile Send private message
DannyB
Moderator
Moderator


Joined: 02 Apr 2003
Posts: 4021
Location: Lawrence, Kansas, USA

PostPosted: Fri Mar 25, 2005 12:46 pm    Post subject: Reply with quote

Just adding a cross reference.....
http://www.oooforum.org/forum/viewtopic.phtml?t=18407
_________________
Want to make OOo Drawings like the colored flower design to the left?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group