summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorRüdiger Timm <rt@openoffice.org>2008-03-12 12:04:40 +0000
committerRüdiger Timm <rt@openoffice.org>2008-03-12 12:04:40 +0000
commit87396072d9e33a1586eebc1520be81949ac4cb9a (patch)
tree40c2cf977e7b93f7e07009a279f32d454c0c567c /vcl/source
parent1ed8e752764e77da7b5c0339f32a05ec276d870c (diff)
INTEGRATION: CWS impresstables2 (1.5.178); FILE MERGED
2007/08/01 19:56:40 cl 1.5.178.2: RESYNC: (1.5-1.6); FILE MERGED 2007/03/15 16:20:52 cl 1.5.178.1: #i68103# added members to MouseEvent and KeyEvent for awt event conersions
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/window/keyevent.cxx35
1 files changed, 33 insertions, 2 deletions
diff --git a/vcl/source/window/keyevent.cxx b/vcl/source/window/keyevent.cxx
index 7736c0bd9ddb..4387e5aaf10e 100644
--- a/vcl/source/window/keyevent.cxx
+++ b/vcl/source/window/keyevent.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: keyevent.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: hr $ $Date: 2007-06-27 20:31:57 $
+ * last change: $Author: rt $ $Date: 2008-03-12 13:04:40 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -36,6 +36,9 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
+#include <com/sun/star/awt/KeyEvent.hpp>
+#include <com/sun/star/awt/KeyModifier.hpp>
+
#ifndef _DEBUG_HXX
#include <tools/debug.hxx>
#endif
@@ -47,6 +50,34 @@ KeyEvent::KeyEvent (const KeyEvent& rKeyEvent) :
mnCharCode(rKeyEvent.mnCharCode)
{}
+/** inits this vcl KeyEvent with all settings from the given awt event **/
+KeyEvent::KeyEvent( const ::com::sun::star::awt::KeyEvent& rEvent )
+{
+ maKeyCode = KeyCode(
+ rEvent.KeyCode,
+ (rEvent.Modifiers & ::com::sun::star::awt::KeyModifier::SHIFT) != 0,
+ (rEvent.Modifiers & ::com::sun::star::awt::KeyModifier::MOD1) != 0,
+ (rEvent.Modifiers & ::com::sun::star::awt::KeyModifier::MOD2) != 0 );
+ mnRepeat = 0;
+ mnCharCode = rEvent.KeyChar;
+}
+
+/** fills out the given awt KeyEvent with all settings from this vcl event **/
+void KeyEvent::InitKeyEvent( ::com::sun::star::awt::KeyEvent& rEvent ) const
+{
+ rEvent.Modifiers = 0;
+ if( GetKeyCode().IsShift() )
+ rEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::SHIFT;
+ if( GetKeyCode().IsMod1() )
+ rEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::MOD1;
+ if( GetKeyCode().IsMod2() )
+ rEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::MOD2;
+
+ rEvent.KeyCode = GetKeyCode().GetCode();
+ rEvent.KeyChar = GetCharCode();
+ rEvent.KeyFunc = sal::static_int_cast< sal_Int16 >(GetKeyCode().GetFunction());
+}
+
KeyEvent KeyEvent::LogicalTextDirectionality (TextDirectionality eMode) const
{
KeyEvent aClone(*this);