Kaydet (Commit) b70afa9f authored tarafından Ximeng Zu's avatar Ximeng Zu Kaydeden (comit) Tomaž Vajngerl

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/46871Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarTomaž Vajngerl <quikee@gmail.com>
üst 39ba9a30
...@@ -9,4 +9,8 @@ public class UnitConverter { ...@@ -9,4 +9,8 @@ public class UnitConverter {
public static float pixelToTwip(float input, float dpi) { public static float pixelToTwip(float input, float dpi) {
return (input / dpi) * 1440.0f; return (input / dpi) * 1440.0f;
} }
public static float twipsToHMM(float twips) {
return (twips * 127 + 36) / 72;
}
} }
...@@ -16,6 +16,7 @@ import org.mozilla.gecko.gfx.ImmutableViewportMetrics; ...@@ -16,6 +16,7 @@ import org.mozilla.gecko.gfx.ImmutableViewportMetrics;
import static org.libreoffice.SearchController.addProperty; import static org.libreoffice.SearchController.addProperty;
import static org.libreoffice.UnitConverter.pixelToTwip; import static org.libreoffice.UnitConverter.pixelToTwip;
import static org.libreoffice.UnitConverter.twipsToHMM;
public class AdjustLengthLine extends CommonCanvasElement { public class AdjustLengthLine extends CommonCanvasElement {
...@@ -82,11 +83,11 @@ public class AdjustLengthLine extends CommonCanvasElement { ...@@ -82,11 +83,11 @@ public class AdjustLengthLine extends CommonCanvasElement {
JSONObject rootJson = new JSONObject(); JSONObject rootJson = new JSONObject();
if (mIsRow) { if (mIsRow) {
addProperty(rootJson, "Row", "long", String.valueOf(mIndex)); 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())); LOKitShell.sendEvent(new LOEvent(LOEvent.UNO_COMMAND, ".uno:RowHeight", rootJson.toString()));
} else { } else {
addProperty(rootJson, "Column", "long", String.valueOf(mIndex)); 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())); LOKitShell.sendEvent(new LOEvent(LOEvent.UNO_COMMAND, ".uno:ColumnWidth", rootJson.toString()));
} }
} catch (JSONException e) { } catch (JSONException e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment