Page 1 of 1

LO: Apply Personas without restarting Office

Posted: Fri May 22, 2015 7:36 am
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