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
6d9124de
Kaydet (Commit)
6d9124de
authored
Kas 01, 2015
tarafından
Tomaž Vajngerl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
android: update JNI facade, rename mouse/keyboard event flags
Change-Id: Ia2b9a812717d05c7d98d47bf0fe5fd293029d045
üst
3d345941
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
116 additions
and
31 deletions
+116
-31
Document.java
android/Bootstrap/src/org/libreoffice/kit/Document.java
+45
-10
Office.java
android/Bootstrap/src/org/libreoffice/kit/Office.java
+0
-3
InvalidationHandler.java
.../source/src/java/org/libreoffice/InvalidationHandler.java
+3
-1
LOEvent.java
android/source/src/java/org/libreoffice/LOEvent.java
+11
-2
LOKitThread.java
android/source/src/java/org/libreoffice/LOKitThread.java
+2
-2
LOKitTileProvider.java
...id/source/src/java/org/libreoffice/LOKitTileProvider.java
+8
-8
TileProvider.java
android/source/src/java/org/libreoffice/TileProvider.java
+1
-1
lokandroid.cxx
desktop/source/lib/lokandroid.cxx
+46
-4
No files found.
android/Bootstrap/src/org/libreoffice/kit/Document.java
Dosyayı görüntüle @
6d9124de
...
...
@@ -12,12 +12,12 @@ package org.libreoffice.kit;
import
java.nio.ByteBuffer
;
public
class
Document
{
public
static
final
int
PART_MODE_DEFAULT
=
0
;
public
static
final
int
PART_MODE_SLIDE
=
1
;
public
static
final
int
PART_MODE_NOTES
=
2
;
public
static
final
int
PART_MODE_SLIDENOTES
=
3
;
public
static
final
int
PART_MODE_EMBEDDEDOBJ
=
4
;
public
static
final
int
PART_MODE_SLIDE
=
0
;
public
static
final
int
PART_MODE_NOTES
=
1
;
/**
* Document types
*/
public
static
final
int
DOCTYPE_TEXT
=
0
;
public
static
final
int
DOCTYPE_SPREADSHEET
=
1
;
public
static
final
int
DOCTYPE_PRESENTATION
=
2
;
...
...
@@ -27,10 +27,15 @@ public class Document {
/**
* Mouse event types
*/
public
static
final
int
MOUSE_BUTTON_DOWN
=
0
;
public
static
final
int
MOUSE_BUTTON_UP
=
1
;
public
static
final
int
MOUSE_MOVE
=
2
;
public
static
final
int
MOUSE_
EVENT_
BUTTON_DOWN
=
0
;
public
static
final
int
MOUSE_
EVENT_
BUTTON_UP
=
1
;
public
static
final
int
MOUSE_
EVENT_
MOVE
=
2
;
/**
* Key event types
*/
public
static
final
int
KEY_EVENT_PRESS
=
0
;
public
static
final
int
KEY_EVENT_RELEASE
=
1
;
/**
* State change types
...
...
@@ -40,6 +45,11 @@ public class Document {
public
static
final
int
UNDERLINE
=
2
;
public
static
final
int
STRIKEOUT
=
3
;
public
static
final
int
ALIGN_LEFT
=
4
;
public
static
final
int
ALIGN_CENTER
=
5
;
public
static
final
int
ALIGN_RIGHT
=
6
;
public
static
final
int
ALIGN_JUSTIFY
=
7
;
/**
* Callback message types
*/
...
...
@@ -52,6 +62,13 @@ public class Document {
public
static
final
int
CALLBACK_GRAPHIC_SELECTION
=
6
;
public
static
final
int
CALLBACK_HYPERLINK_CLICKED
=
7
;
public
static
final
int
CALLBACK_STATE_CHANGED
=
8
;
public
static
final
int
CALLBACK_STATUS_INTICATOR_START
=
9
;
public
static
final
int
CALLBACK_STATUS_INTICATOR_SET_VALUE
=
10
;
public
static
final
int
CALLBACK_STATUS_INTICATOR_FINISH
=
11
;
public
static
final
int
CALLBACK_SEARCH_NOT_FOUND
=
12
;
public
static
final
int
CALLBACK_DOCUMENT_SIZE_CHANGED
=
13
;
public
static
final
int
CALLBACK_SET_PART
=
14
;
public
static
final
int
CALLBACK_SEARCH_RESULT_SELECTION
=
15
;
/**
* Set text selection types
...
...
@@ -66,6 +83,19 @@ public class Document {
public
static
final
int
SET_GRAPHIC_SELECTION_START
=
0
;
public
static
final
int
SET_GRAPHIC_SELECTION_END
=
1
;
/**
* Mouse button type
*/
public
static
final
int
MOUSE_BUTTON_LEFT
=
1
;
public
static
final
int
MOUSE_BUTTON_MIDDLE
=
2
;
public
static
final
int
MOUSE_BUTTON_RIGHT
=
4
;
public
static
final
int
KEYBOARD_MODIFIER_NONE
=
0x0000
;
public
static
final
int
KEYBOARD_MODIFIER_SHIFT
=
0x1000
;
public
static
final
int
KEYBOARD_MODIFIER_MOD1
=
0x2000
;
public
static
final
int
KEYBOARD_MODIFIER_MOD2
=
0x4000
;
public
static
final
int
KEYBOARD_MODIFIER_MOD3
=
0x8000
;
private
final
ByteBuffer
handle
;
private
MessageCallback
messageCallback
=
null
;
...
...
@@ -105,6 +135,8 @@ public class Document {
public
native
void
setPartMode
(
int
partMode
);
public
native
String
getPartPageRectangles
();
public
native
long
getDocumentHeight
();
public
native
long
getDocumentWidth
();
...
...
@@ -140,13 +172,14 @@ public class Document {
* @param y - y coordinate
* @param count - number of events
*/
public
native
void
postMouseEvent
(
int
type
,
int
x
,
int
y
,
int
count
);
public
native
void
postMouseEvent
(
int
type
,
int
x
,
int
y
,
int
count
,
int
button
,
int
modifier
);
/**
* Post a .uno: command to LOK
* @param command - the command, like ".uno:Bold"
* @param arguments
*/
public
native
void
postUnoCommand
(
String
command
);
public
native
void
postUnoCommand
(
String
command
,
String
arguments
);
/**
* Change text selection.
...
...
@@ -169,6 +202,8 @@ public class Document {
*/
public
native
void
resetSelection
();
public
native
String
getCommandValues
(
String
command
);
/**
* Callback to retrieve messages from LOK
*/
...
...
android/Bootstrap/src/org/libreoffice/kit/Office.java
Dosyayı görüntüle @
6d9124de
...
...
@@ -12,9 +12,6 @@ package org.libreoffice.kit;
import
java.nio.ByteBuffer
;
public
class
Office
{
public
static
final
int
KEY_PRESS
=
0
;
public
static
final
int
KEY_RELEASE
=
1
;
private
ByteBuffer
handle
;
public
Office
(
ByteBuffer
handle
)
{
...
...
android/source/src/java/org/libreoffice/InvalidationHandler.java
Dosyayı görüntüle @
6d9124de
...
...
@@ -208,7 +208,7 @@ public class InvalidationHandler implements Document.MessageCallback {
float
newTop
=
moveToRect
.
top
;
if
(
cursorRectangle
.
right
<
moveToRect
.
left
||
cursorRectangle
.
left
<
moveToRect
.
left
)
{
newLeft
=
cursorRectangle
.
left
-
(
moveToRect
.
width
()
*
0.1f
);
newLeft
=
cursorRectangle
.
left
-
(
moveToRect
.
width
()
*
0.1f
);
}
else
if
(
cursorRectangle
.
right
>
moveToRect
.
right
||
cursorRectangle
.
left
>
moveToRect
.
right
)
{
newLeft
=
cursorRectangle
.
right
-
(
moveToRect
.
width
()
*
0.9f
);
}
...
...
@@ -306,6 +306,7 @@ public class InvalidationHandler implements Document.MessageCallback {
/**
* Trigger a transition to a new overlay state.
*
* @param next - new state to transition to
*/
public
synchronized
void
changeStateTo
(
OverlayState
next
)
{
...
...
@@ -314,6 +315,7 @@ public class InvalidationHandler implements Document.MessageCallback {
/**
* Executes a transition from old overlay state to a new overlay state.
*
* @param previous - old state
* @param next - new state
*/
...
...
android/source/src/java/org/libreoffice/LOEvent.java
Dosyayı görüntüle @
6d9124de
...
...
@@ -47,6 +47,7 @@ public class LOEvent implements Comparable<LOEvent> {
public
KeyEvent
mKeyEvent
;
public
RectF
mInvalidationRect
;
public
SelectionHandle
.
HandleType
mHandleType
;
public
String
mValue
;
public
LOEvent
(
int
type
)
{
mType
=
type
;
...
...
@@ -58,10 +59,18 @@ public class LOEvent implements Comparable<LOEvent> {
mComposedTileLayer
=
composedTileLayer
;
}
public
LOEvent
(
int
type
,
String
filename
)
{
public
LOEvent
(
int
type
,
String
someString
)
{
mType
=
type
;
mTypeString
=
"String"
;
mString
=
filename
;
mString
=
someString
;
mValue
=
null
;
}
public
LOEvent
(
int
type
,
String
key
,
String
value
)
{
mType
=
type
;
mTypeString
=
"key / value"
;
mString
=
key
;
mValue
=
value
;
}
public
LOEvent
(
int
type
,
int
partIndex
)
{
...
...
android/source/src/java/org/libreoffice/LOKitThread.java
Dosyayı görüntüle @
6d9124de
...
...
@@ -16,7 +16,7 @@ import java.util.ArrayList;
import
java.util.List
;
import
java.util.concurrent.LinkedBlockingQueue
;
/*
/*
*
* Thread that communicates with LibreOffice through LibreOfficeKit JNI interface. The thread
* consumes events from other threads (mainly the UI thread) and acts accordingly.
*/
...
...
@@ -243,7 +243,7 @@ public class LOKitThread extends Thread {
mInvalidationHandler
.
changeStateTo
(
InvalidationHandler
.
OverlayState
.
NONE
);
break
;
case
LOEvent
.
UNO_COMMAND
:
mTileProvider
.
postUnoCommand
(
event
.
mString
);
mTileProvider
.
postUnoCommand
(
event
.
mString
,
event
.
mValue
);
break
;
}
}
...
...
android/source/src/java/org/libreoffice/LOKitTileProvider.java
Dosyayı görüntüle @
6d9124de
...
...
@@ -388,12 +388,12 @@ public class LOKitTileProvider implements TileProvider {
String
keyString
=
keyEvent
.
getCharacters
();
for
(
int
i
=
0
;
i
<
keyString
.
length
();
i
++)
{
int
codePoint
=
keyString
.
codePointAt
(
i
);
mDocument
.
postKeyEvent
(
Office
.
KEY
_PRESS
,
codePoint
,
getKeyCode
(
keyEvent
));
mDocument
.
postKeyEvent
(
Document
.
KEY_EVENT
_PRESS
,
codePoint
,
getKeyCode
(
keyEvent
));
}
}
else
if
(
keyEvent
.
getAction
()
==
KeyEvent
.
ACTION_DOWN
)
{
mDocument
.
postKeyEvent
(
Office
.
KEY
_PRESS
,
getCharCode
(
keyEvent
),
getKeyCode
(
keyEvent
));
mDocument
.
postKeyEvent
(
Document
.
KEY_EVENT
_PRESS
,
getCharCode
(
keyEvent
),
getKeyCode
(
keyEvent
));
}
else
if
(
keyEvent
.
getAction
()
==
KeyEvent
.
ACTION_UP
)
{
mDocument
.
postKeyEvent
(
Office
.
KEY
_RELEASE
,
getCharCode
(
keyEvent
),
getKeyCode
(
keyEvent
));
mDocument
.
postKeyEvent
(
Document
.
KEY_EVENT
_RELEASE
,
getCharCode
(
keyEvent
),
getKeyCode
(
keyEvent
));
}
}
...
...
@@ -401,7 +401,7 @@ public class LOKitTileProvider implements TileProvider {
int
x
=
(
int
)
pixelToTwip
(
inDocument
.
x
,
mDPI
);
int
y
=
(
int
)
pixelToTwip
(
inDocument
.
y
,
mDPI
);
mDocument
.
postMouseEvent
(
type
,
x
,
y
,
numberOfClicks
);
mDocument
.
postMouseEvent
(
type
,
x
,
y
,
numberOfClicks
,
Document
.
MOUSE_BUTTON_LEFT
,
Document
.
KEYBOARD_MODIFIER_NONE
);
}
/**
...
...
@@ -409,7 +409,7 @@ public class LOKitTileProvider implements TileProvider {
*/
@Override
public
void
mouseButtonDown
(
PointF
documentCoordinate
,
int
numberOfClicks
)
{
mouseButton
(
Document
.
MOUSE_BUTTON_DOWN
,
documentCoordinate
,
numberOfClicks
);
mouseButton
(
Document
.
MOUSE_
EVENT_
BUTTON_DOWN
,
documentCoordinate
,
numberOfClicks
);
}
/**
...
...
@@ -417,12 +417,12 @@ public class LOKitTileProvider implements TileProvider {
*/
@Override
public
void
mouseButtonUp
(
PointF
documentCoordinate
,
int
numberOfClicks
)
{
mouseButton
(
Document
.
MOUSE_BUTTON_UP
,
documentCoordinate
,
numberOfClicks
);
mouseButton
(
Document
.
MOUSE_
EVENT_
BUTTON_UP
,
documentCoordinate
,
numberOfClicks
);
}
@Override
public
void
postUnoCommand
(
String
command
)
{
mDocument
.
postUnoCommand
(
command
);
public
void
postUnoCommand
(
String
command
,
String
arguments
)
{
mDocument
.
postUnoCommand
(
command
,
arguments
);
}
private
void
setTextSelection
(
int
type
,
PointF
documentCoordinate
)
{
...
...
android/source/src/java/org/libreoffice/TileProvider.java
Dosyayı görüntüle @
6d9124de
...
...
@@ -114,7 +114,7 @@ public interface TileProvider {
*
* @param command - the .uno: command, like ".uno:Bold"
*/
void
postUnoCommand
(
String
command
);
void
postUnoCommand
(
String
command
,
String
arguments
);
/**
* Send text selection start coordinate.
...
...
desktop/source/lib/lokandroid.cxx
Dosyayı görüntüle @
6d9124de
...
...
@@ -183,6 +183,14 @@ extern "C" SAL_JNI_EXPORT jint JNICALL Java_org_libreoffice_kit_Document_getPart
return
(
jint
)
pDocument
->
pClass
->
getPart
(
pDocument
);
}
extern
"C"
SAL_JNI_EXPORT
jstring
JNICALL
Java_org_libreoffice_kit_Document_getPartPageRectangles
(
JNIEnv
*
pEnv
,
jobject
aObject
)
{
LibreOfficeKitDocument
*
pDocument
=
getHandle
<
LibreOfficeKitDocument
>
(
pEnv
,
aObject
);
char
*
pRectangles
=
pDocument
->
pClass
->
getPartPageRectangles
(
pDocument
);
return
pEnv
->
NewStringUTF
(
pRectangles
);
}
extern
"C"
SAL_JNI_EXPORT
jint
JNICALL
Java_org_libreoffice_kit_Document_getParts
(
JNIEnv
*
pEnv
,
jobject
aObject
)
{
...
...
@@ -277,22 +285,27 @@ extern "C" SAL_JNI_EXPORT void JNICALL Java_org_libreoffice_kit_Document_postKey
}
extern
"C"
SAL_JNI_EXPORT
void
JNICALL
Java_org_libreoffice_kit_Document_postMouseEvent
(
JNIEnv
*
pEnv
,
jobject
aObject
,
jint
type
,
jint
x
,
jint
y
,
jint
count
)
(
JNIEnv
*
pEnv
,
jobject
aObject
,
jint
type
,
jint
x
,
jint
y
,
jint
count
,
jint
button
,
jint
modifier
)
{
LibreOfficeKitDocument
*
pDocument
=
getHandle
<
LibreOfficeKitDocument
>
(
pEnv
,
aObject
);
pDocument
->
pClass
->
postMouseEvent
(
pDocument
,
type
,
x
,
y
,
count
,
MOUSE_LEFT
,
0
);
pDocument
->
pClass
->
postMouseEvent
(
pDocument
,
type
,
x
,
y
,
count
,
button
,
modifier
);
}
extern
"C"
SAL_JNI_EXPORT
void
JNICALL
Java_org_libreoffice_kit_Document_postUnoCommand
(
JNIEnv
*
pEnv
,
jobject
aObject
,
jstring
command
)
(
JNIEnv
*
pEnv
,
jobject
aObject
,
jstring
command
,
jstring
arguments
)
{
LibreOfficeKitDocument
*
pDocument
=
getHandle
<
LibreOfficeKitDocument
>
(
pEnv
,
aObject
);
const
char
*
pCommand
=
pEnv
->
GetStringUTFChars
(
command
,
NULL
);
const
char
*
pArguments
=
nullptr
;
if
(
arguments
!=
NULL
)
pArguments
=
pEnv
->
GetStringUTFChars
(
arguments
,
NULL
);
pDocument
->
pClass
->
postUnoCommand
(
pDocument
,
pCommand
,
0
);
pDocument
->
pClass
->
postUnoCommand
(
pDocument
,
pCommand
,
pArguments
);
pEnv
->
ReleaseStringUTFChars
(
command
,
pCommand
);
if
(
arguments
!=
NULL
)
pEnv
->
ReleaseStringUTFChars
(
arguments
,
pArguments
);
}
extern
"C"
SAL_JNI_EXPORT
void
JNICALL
Java_org_libreoffice_kit_Document_setTextSelection
...
...
@@ -302,6 +315,22 @@ extern "C" SAL_JNI_EXPORT void JNICALL Java_org_libreoffice_kit_Document_setText
pDocument
->
pClass
->
setTextSelection
(
pDocument
,
type
,
x
,
y
);
}
extern
"C"
SAL_JNI_EXPORT
jstring
JNICALL
Java_org_libreoffice_kit_Document_getTextSelection
(
JNIEnv
*
pEnv
,
jobject
aObject
,
jstring
mimeType
)
{
LibreOfficeKitDocument
*
pDocument
=
getHandle
<
LibreOfficeKitDocument
>
(
pEnv
,
aObject
);
const
char
*
pMimeType
=
pEnv
->
GetStringUTFChars
(
mimeType
,
NULL
);
char
*
pUsedMimeType
=
0
;
char
*
pSelection
=
pDocument
->
pClass
->
getTextSelection
(
pDocument
,
pMimeType
,
&
pUsedMimeType
);
free
(
pUsedMimeType
);
pEnv
->
ReleaseStringUTFChars
(
mimeType
,
pMimeType
);
return
pEnv
->
NewStringUTF
(
pSelection
);
}
extern
"C"
SAL_JNI_EXPORT
void
JNICALL
Java_org_libreoffice_kit_Document_setGraphicSelection
(
JNIEnv
*
pEnv
,
jobject
aObject
,
jint
type
,
jint
x
,
jint
y
)
{
...
...
@@ -316,4 +345,17 @@ extern "C" SAL_JNI_EXPORT void JNICALL Java_org_libreoffice_kit_Document_resetSe
pDocument
->
pClass
->
resetSelection
(
pDocument
);
}
extern
"C"
SAL_JNI_EXPORT
jstring
JNICALL
Java_org_libreoffice_kit_Document_getCommandValues
(
JNIEnv
*
pEnv
,
jobject
aObject
,
jstring
command
)
{
LibreOfficeKitDocument
*
pDocument
=
getHandle
<
LibreOfficeKitDocument
>
(
pEnv
,
aObject
);
const
char
*
pCommand
=
pEnv
->
GetStringUTFChars
(
command
,
NULL
);
char
*
pValue
=
pDocument
->
pClass
->
getCommandValues
(
pDocument
,
pCommand
);
pEnv
->
ReleaseStringUTFChars
(
command
,
pCommand
);
return
pEnv
->
NewStringUTF
(
pValue
);
}
/* 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