LO: Apply Personas without restarting Office

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
ponc
Posts: 86
Joined: Mon Dec 09, 2013 7:34 pm

LO: Apply Personas without restarting Office

Post by ponc »

Hi,

when you create a folder "Dark Blue2" with the appropriate files in [win7] "C:\Users\<user>\AppData\Roaming\LibreOffice\4\user\gallery\personas"
Personas can manually be set in LO like this:

Code: Select all

smgr = uno.getComponentContext().ServiceManager
ctx = uno.getComponentContext()

config_provider = smgr.createInstanceWithContext("com.sun.star.configuration.ConfigurationProvider",ctx)

prop = uno.createUnoStruct("com.sun.star.beans.PropertyValue")
prop.Name = "nodepath"
prop.Value = "/org.openoffice.Office.Common/Misc"
 
config_access = config_provider.createInstanceWithArguments("com.sun.star.configuration.ConfigurationUpdateAccess", (prop,))

persona = config_access.PersonaSettings

values = persona.split(';')
values[0] = 'Dark Blue2/Header.png'
values[1] = 'Dark Blue2/Footer.png'
values[2] = '#ff0000' # red
value = ';'.join(values)
config_access.PersonaSettings = value

config_access.commitChanges()
These changes get adapted after restarting Office.

Is there a way to make the changes visible without restart? Like LO does it, when the user chooses a theme?
I couldn't find any documentation in the API. (Probably there is none.)

Thanks for help in advance,
ponc
OO 4.0.1 , LO 4.4.3.2 on win7 // LO 4.4.3.2 on Ubuntu 14.04
https://github.com/XRoemer/Organon
Post Reply