Le 19 oct. 06, à 14:00, Stephan Bergmann a écrit :
I very much doubt that this is directly a problem of the UNO C++
language binding. com.sun.star.awt.KeyEvent is a UNO struct that has
members KeyChar and KeyCode. Maybe you can post the failing C++ code
here (if it is not too long) and somebody with awt knowledge can spot
the real problem.
Hi Stephan,
The test code for this bug is simple, and is similar to the Basic code
snippet:
________________________________________________________________________
// Let 'm_serviceMgr' be the service manager <XMultiServiceFactory>
interface.
//
Reference<XModuleUIConfigurationManagerSupplier>
xUICfgSupp(m_serviceMgr->createInstance(OUString::
createFromAscii("com.sun.star.ui.ModuleUIConfigurationManagerSupplier"))
, UNO_QUERY_THROW);
Reference<XUIConfigurationManager> xUICfgMgr
=
xUICfgSupp->getUIConfigurationManager(OUString::
createFromAscii("com.sun.star.text.TextDocument"));
Reference<XAcceleratorConfiguration>
shortcutMgr(xUICfgMgr->getShortCutManager(), UNO_QUERY_THROW);
awt::KeyEvent keyEvent;
/
/-----------------------------------------------------------------------
---------------------------------
// BUG (of binding ?) : Use KeyEvent.KeyChar, and not KeyEvent.KeyCode
!!
//
// Note:
// The same bug appears when retrieving a KeyEvent, such as
// XAcceleratorConfiguration.getKeyEventsByCommand(".uno:AddDirect").
// => the returned KeyEvents have KeyChar filled by what should be in
KeyCode.
/
/-----------------------------------------------------------------------
---------------------------------
//
keyEvent.KeyChar = awt::Key::F11;
keyEvent.Modifiers = awt::KeyModifier::MOD1; // Ctrl+F11
OUString commandURL = OUString::createFromAscii(".uno:AddDirect"); //
this command is just as a test
try {
shortcutMgr->removeKeyEvent(keyEvent);
}
catch (NoSuchElementException &) {}
shortcutMgr->setKeyEvent(keyEvent, commandURL);
shortcutMgr->store();
________________________________________________________________________
I first suspected a struct alignment problem, but it doesn't seem to be
so.
I use OO 2.0.3.
Julien Galand
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]