Hi again,
My goal is to prevent user from using default styles in textdocs.
Apparently those default styles cannot be "disabled", so I need to make
everything manually. One thing I have to do is to remove accelerators
modifying styles. (e.g. CTRL + 1 = Heading 1).
I tried to remove that accelerator with the code below, but nothing
happened. CTRL+1 was still working. What did I do wrong?
--
Object conf =
xRemoteServiceManager.createInstanceWithContext("com.sun.star.ui.ModuleUIConfigurationManagerSupplier",
xRemoteContext);
XModuleUIConfigurationManagerSupplier confMngrS =
(XModuleUIConfigurationManagerSupplier)UnoRuntime.queryInterface(XModuleUIConfigurationManagerSupplier.class,
conf);
XUIConfigurationManager xConfMngr =
confMngrS.getUIConfigurationManager("com.sun.star.text.TextDocument");
Object shortcutConfManager = xConfMngr.getShortCutManager();
XAcceleratorConfiguration ac =
(XAcceleratorConfiguration)UnoRuntime.queryInterface(XAcceleratorConfiguration.class,
shortcutConfManager);
KeyEvent[] keys = ac.getAllKeyEvents();
ac.removeCommandFromAllKeyEvents(".uno:StyleApply?Style:string=Heading
1&FamilyName:string=ParagraphStyles");
--
And is there easier way to achieve my goal? Can I include a
configuration file in my template to setup accelerators for my document?
( just like menubar.xml ) And if, where should I put it? There is
configuration file for global and module accelerators
($OFFICE_DIR/share/config/soffice.cfg/global/accelerator/en-US/default.xml
and e.g.
$OFFICE_DIR/share/config/soffice.cfg/modules/swriter/accelerator/en-US/default.xml)
for the whole OpenOffice but in template files there is only
/configuration2/menubar/menubar.xml)
Curious regards,
Tuomas Räsänen
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]