[Libreoffice-commits] core.git: android/source
Ximeng Zu
uznomis at yahoo.com
Sun Feb 4 19:47:16 UTC 2018
android/source/src/java/org/libreoffice/UnitConverter.java | 4 ++++
android/source/src/java/org/libreoffice/canvas/AdjustLengthLine.java | 5 +++--
2 files changed, 7 insertions(+), 2 deletions(-)
New commits:
commit b70afa9ffd6408e1611ddd94e1d77163660d445b
Author: Ximeng Zu <uznomis at yahoo.com>
Date: Wed Dec 20 17:26:34 2017 -0600
Fix adjust width/height behavior
In Android Viewer, fixed adjust
width/height behavior due
to change in UNO command syntax.
Change-Id: Id78cb1a0fc546f251734dd538bf48a8f4e121bed
Reviewed-on: https://gerrit.libreoffice.org/46871
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
diff --git a/android/source/src/java/org/libreoffice/UnitConverter.java b/android/source/src/java/org/libreoffice/UnitConverter.java
index e0dcfb86b93f..f668021b0cd7 100644
--- a/android/source/src/java/org/libreoffice/UnitConverter.java
+++ b/android/source/src/java/org/libreoffice/UnitConverter.java
@@ -9,4 +9,8 @@ public class UnitConverter {
public static float pixelToTwip(float input, float dpi) {
return (input / dpi) * 1440.0f;
}
+
+ public static float twipsToHMM(float twips) {
+ return (twips * 127 + 36) / 72;
+ }
}
diff --git a/android/source/src/java/org/libreoffice/canvas/AdjustLengthLine.java b/android/source/src/java/org/libreoffice/canvas/AdjustLengthLine.java
index fbdb429f2d10..a6f8cb17c1cb 100644
--- a/android/source/src/java/org/libreoffice/canvas/AdjustLengthLine.java
+++ b/android/source/src/java/org/libreoffice/canvas/AdjustLengthLine.java
@@ -16,6 +16,7 @@ import org.mozilla.gecko.gfx.ImmutableViewportMetrics;
import static org.libreoffice.SearchController.addProperty;
import static org.libreoffice.UnitConverter.pixelToTwip;
+import static org.libreoffice.UnitConverter.twipsToHMM;
public class AdjustLengthLine extends CommonCanvasElement {
@@ -82,11 +83,11 @@ public class AdjustLengthLine extends CommonCanvasElement {
JSONObject rootJson = new JSONObject();
if (mIsRow) {
addProperty(rootJson, "Row", "long", String.valueOf(mIndex));
- addProperty(rootJson, "Height", "unsigned short", String.valueOf(documentDistance.y > 0 ? documentDistance.y : 0));
+ addProperty(rootJson, "RowHeight", "unsigned short", String.valueOf(Math.round(documentDistance.y > 0 ? twipsToHMM(documentDistance.y) : 0)));
LOKitShell.sendEvent(new LOEvent(LOEvent.UNO_COMMAND, ".uno:RowHeight", rootJson.toString()));
} else {
addProperty(rootJson, "Column", "long", String.valueOf(mIndex));
- addProperty(rootJson, "Width", "unsigned short", String.valueOf(documentDistance.x > 0 ? documentDistance.x : 0));
+ addProperty(rootJson, "ColumnWidth", "unsigned short", String.valueOf(documentDistance.x > 0 ? twipsToHMM(documentDistance.x) : 0));
LOKitShell.sendEvent(new LOEvent(LOEvent.UNO_COMMAND, ".uno:ColumnWidth", rootJson.toString()));
}
} catch (JSONException e) {
More information about the Libreoffice-commits
mailing list