Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
ffd4b879
Kaydet (Commit)
ffd4b879
authored
Mar 25, 2015
tarafından
Miklos Vajna
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
lokdocview: move keyboard handling to LOKDocView_Impl
Change-Id: I1117ec42bdf0f2cb19f77723b87597d301d20ddb
üst
5e43b9a9
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
75 additions
and
67 deletions
+75
-67
LibreOfficeKitGtk.h
include/LibreOfficeKit/LibreOfficeKitGtk.h
+3
-0
Executable_gtktiledviewer.mk
libreofficekit/Executable_gtktiledviewer.mk
+0
-2
Library_libreofficekitgtk.mk
libreofficekit/Library_libreofficekitgtk.mk
+1
-0
gtktiledviewer.cxx
libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+2
-65
lokdocview.cxx
libreofficekit/source/gtk/lokdocview.cxx
+69
-0
No files found.
include/LibreOfficeKit/LibreOfficeKitGtk.h
Dosyayı görüntüle @
ffd4b879
...
...
@@ -68,6 +68,9 @@ gboolean lok_docview_get_edit (LOKDocView* pDocView);
/// Posts the .uno: command to the LibreOfficeKit.
void
lok_docview_post_command
(
LOKDocView
*
pDocView
,
const
char
*
pCommand
);
/// Posts a keyboard event to LibreOfficeKit.
void
lok_docview_post_key
(
GtkWidget
*
pWidget
,
GdkEventKey
*
pEvent
,
gpointer
pData
);
#ifdef __cplusplus
}
#endif
...
...
libreofficekit/Executable_gtktiledviewer.mk
Dosyayı görüntüle @
ffd4b879
...
...
@@ -14,8 +14,6 @@ $(eval $(call gb_Executable_set_include,gtktiledviewer,\
-I$(SRCDIR)/desktop/inc \
))
$(eval $(call gb_Executable_use_sdk_api,gtktiledviewer))
$(eval $(call gb_Executable_use_externals,gtktiledviewer,\
gtk \
))
...
...
libreofficekit/Library_libreofficekitgtk.mk
Dosyayı görüntüle @
ffd4b879
...
...
@@ -9,6 +9,7 @@
$(eval $(call gb_Library_Library,libreofficekitgtk))
$(eval $(call gb_Library_use_sdk_api,libreofficekitgtk))
$(eval $(call gb_Library_use_externals,libreofficekitgtk,\
gtk \
...
...
libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
Dosyayı görüntüle @
ffd4b879
...
...
@@ -12,16 +12,12 @@
#include <string.h>
#include <gdk/gdk.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#include <LibreOfficeKit/LibreOfficeKitGtk.h>
#include <LibreOfficeKit/LibreOfficeKitInit.h>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <com/sun/star/awt/Key.hpp>
#include <rsc/rsc-vcl-shared-types.hxx>
#ifndef g_info
#define g_info(...) g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, __VA_ARGS__)
#endif
...
...
@@ -119,65 +115,6 @@ void toggleBold(GtkWidget* /*pButton*/, gpointer /*pItem*/)
lok_docview_post_command
(
pLOKDocView
,
".uno:Bold"
);
}
/// Receives a key press or release event.
static
void
signalKey
(
GtkWidget
*
/*pWidget*/
,
GdkEventKey
*
pEvent
,
gpointer
/*pData*/
)
{
LOKDocView
*
pLOKDocView
=
LOK_DOCVIEW
(
pDocView
);
int
nCharCode
=
0
;
int
nKeyCode
=
0
;
if
(
!
lok_docview_get_edit
(
pLOKDocView
))
{
g_info
(
"signalKey: not in edit mode, ignore"
);
return
;
}
switch
(
pEvent
->
keyval
)
{
case
GDK_BackSpace
:
nKeyCode
=
com
::
sun
::
star
::
awt
::
Key
::
BACKSPACE
;
break
;
case
GDK_Return
:
nKeyCode
=
com
::
sun
::
star
::
awt
::
Key
::
RETURN
;
break
;
case
GDK_Escape
:
nKeyCode
=
com
::
sun
::
star
::
awt
::
Key
::
ESCAPE
;
break
;
case
GDK_Tab
:
nKeyCode
=
com
::
sun
::
star
::
awt
::
Key
::
TAB
;
break
;
case
GDK_Down
:
nKeyCode
=
com
::
sun
::
star
::
awt
::
Key
::
DOWN
;
break
;
case
GDK_Up
:
nKeyCode
=
com
::
sun
::
star
::
awt
::
Key
::
UP
;
break
;
case
GDK_Left
:
nKeyCode
=
com
::
sun
::
star
::
awt
::
Key
::
LEFT
;
break
;
case
GDK_Right
:
nKeyCode
=
com
::
sun
::
star
::
awt
::
Key
::
RIGHT
;
break
;
default:
if
(
pEvent
->
keyval
>=
GDK_F1
&&
pEvent
->
keyval
<=
GDK_F26
)
nKeyCode
=
com
::
sun
::
star
::
awt
::
Key
::
F1
+
(
pEvent
->
keyval
-
GDK_F1
);
else
nCharCode
=
gdk_keyval_to_unicode
(
pEvent
->
keyval
);
}
// rsc is not public API, but should be good enough for debugging purposes.
// If this is needed for real, then probably a new param of type
// css::awt::KeyModifier is needed in postKeyEvent().
if
(
pEvent
->
state
&
GDK_SHIFT_MASK
)
nKeyCode
|=
KEY_SHIFT
;
LibreOfficeKitDocument
*
pDocument
=
lok_docview_get_document
(
pLOKDocView
);
if
(
pEvent
->
type
==
GDK_KEY_RELEASE
)
pDocument
->
pClass
->
postKeyEvent
(
pDocument
,
LOK_KEYEVENT_KEYUP
,
nCharCode
,
nKeyCode
);
else
pDocument
->
pClass
->
postKeyEvent
(
pDocument
,
LOK_KEYEVENT_KEYINPUT
,
nCharCode
,
nKeyCode
);
}
// GtkComboBox requires gtk 2.24 or later
#if ( GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 24 ) || GTK_MAJOR_VERSION > 2
void
populatePartSelector
()
...
...
@@ -330,8 +267,8 @@ int main( int argc, char* argv[] )
g_signal_connect
(
pDocView
,
"edit-changed"
,
G_CALLBACK
(
signalEdit
),
NULL
);
// Input handling.
g_signal_connect
(
pWindow
,
"key-press-event"
,
G_CALLBACK
(
signalKey
),
NULL
);
g_signal_connect
(
pWindow
,
"key-release-event"
,
G_CALLBACK
(
signalKey
),
NULL
);
g_signal_connect
(
pWindow
,
"key-press-event"
,
G_CALLBACK
(
lok_docview_post_key
),
pDocView
);
g_signal_connect
(
pWindow
,
"key-release-event"
,
G_CALLBACK
(
lok_docview_post_key
),
pDocView
);
gtk_container_add
(
GTK_CONTAINER
(
pVBox
),
pDocView
);
...
...
libreofficekit/source/gtk/lokdocview.cxx
Dosyayı görüntüle @
ffd4b879
...
...
@@ -11,10 +11,14 @@
#include <math.h>
#include <string.h>
#include <gdk/gdkkeysyms.h>
#include <com/sun/star/awt/Key.hpp>
#define LOK_USE_UNSTABLE_API
#include <LibreOfficeKit/LibreOfficeKit.h>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <LibreOfficeKit/LibreOfficeKitGtk.h>
#include <rsc/rsc-vcl-shared-types.hxx>
#if !GLIB_CHECK_VERSION(2,32,0)
#define G_SOURCE_REMOVE FALSE
...
...
@@ -104,6 +108,8 @@ struct LOKDocView_Impl
float
pixelToTwip
(
float
fInput
);
/// Converts from document coordinates to screen pixels.
float
twipToPixel
(
float
fInput
);
/// Receives a key press or release event.
void
signalKey
(
GdkEventKey
*
pEvent
);
};
LOKDocView_Impl
::
LOKDocView_Impl
()
...
...
@@ -166,6 +172,63 @@ float LOKDocView_Impl::twipToPixel(float fInput)
return
fInput
/
1440.0
f
*
DPI
*
m_fZoom
;
}
void
LOKDocView_Impl
::
signalKey
(
GdkEventKey
*
pEvent
)
{
int
nCharCode
=
0
;
int
nKeyCode
=
0
;
if
(
!
m_bEdit
)
{
g_info
(
"signalKey: not in edit mode, ignore"
);
return
;
}
switch
(
pEvent
->
keyval
)
{
case
GDK_BackSpace
:
nKeyCode
=
com
::
sun
::
star
::
awt
::
Key
::
BACKSPACE
;
break
;
case
GDK_Return
:
nKeyCode
=
com
::
sun
::
star
::
awt
::
Key
::
RETURN
;
break
;
case
GDK_Escape
:
nKeyCode
=
com
::
sun
::
star
::
awt
::
Key
::
ESCAPE
;
break
;
case
GDK_Tab
:
nKeyCode
=
com
::
sun
::
star
::
awt
::
Key
::
TAB
;
break
;
case
GDK_Down
:
nKeyCode
=
com
::
sun
::
star
::
awt
::
Key
::
DOWN
;
break
;
case
GDK_Up
:
nKeyCode
=
com
::
sun
::
star
::
awt
::
Key
::
UP
;
break
;
case
GDK_Left
:
nKeyCode
=
com
::
sun
::
star
::
awt
::
Key
::
LEFT
;
break
;
case
GDK_Right
:
nKeyCode
=
com
::
sun
::
star
::
awt
::
Key
::
RIGHT
;
break
;
default
:
if
(
pEvent
->
keyval
>=
GDK_F1
&&
pEvent
->
keyval
<=
GDK_F26
)
nKeyCode
=
com
::
sun
::
star
::
awt
::
Key
::
F1
+
(
pEvent
->
keyval
-
GDK_F1
);
else
nCharCode
=
gdk_keyval_to_unicode
(
pEvent
->
keyval
);
}
// rsc is not public API, but should be good enough for debugging purposes.
// If this is needed for real, then probably a new param of type
// css::awt::KeyModifier is needed in postKeyEvent().
if
(
pEvent
->
state
&
GDK_SHIFT_MASK
)
nKeyCode
|=
KEY_SHIFT
;
if
(
pEvent
->
type
==
GDK_KEY_RELEASE
)
m_pDocument
->
pClass
->
postKeyEvent
(
m_pDocument
,
LOK_KEYEVENT_KEYUP
,
nCharCode
,
nKeyCode
);
else
m_pDocument
->
pClass
->
postKeyEvent
(
m_pDocument
,
LOK_KEYEVENT_KEYINPUT
,
nCharCode
,
nKeyCode
);
}
static
void
lok_docview_class_init
(
gpointer
);
static
void
lok_docview_init
(
GTypeInstance
*
,
gpointer
);
static
gboolean
renderOverlay
(
GtkWidget
*
pWidget
,
GdkEventExpose
*
pEvent
,
gpointer
pData
);
...
...
@@ -1051,4 +1114,10 @@ SAL_DLLPUBLIC_EXPORT void lok_docview_post_command(LOKDocView* pDocView, const c
pDocView
->
m_pImpl
->
m_pDocument
->
pClass
->
postUnoCommand
(
pDocView
->
m_pImpl
->
m_pDocument
,
pCommand
);
}
SAL_DLLPUBLIC_EXPORT
void
lok_docview_post_key
(
GtkWidget
*
/*pWidget*/
,
GdkEventKey
*
pEvent
,
gpointer
pData
)
{
LOKDocView
*
pDocView
=
static_cast
<
LOKDocView
*>
(
pData
);
pDocView
->
m_pImpl
->
signalKey
(
pEvent
);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment