[Libreoffice-commits] online.git: loleaflet/src

Szymon Kłos (via logerrit) logerrit at kemper.freedesktop.org
Tue Nov 12 13:22:28 UTC 2019


 loleaflet/src/control/Control.JSDialogBuilder.js |   40 ++++++++++++++++++++---
 1 file changed, 36 insertions(+), 4 deletions(-)

New commits:
commit 9ee96d4c25c24bdd82e8b6f85d9a421617004e3d
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Nov 12 12:34:57 2019 +0100
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Tue Nov 12 14:21:48 2019 +0100

    jsdialogs: apply .uno:LeftRightParaMargin updates
    
    Change-Id: I81cb7e20d41c51976f5df274c29b110656c0b8a7

diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js b/loleaflet/src/control/Control.JSDialogBuilder.js
index 0343418ee..43cc210b7 100644
--- a/loleaflet/src/control/Control.JSDialogBuilder.js
+++ b/loleaflet/src/control/Control.JSDialogBuilder.js
@@ -418,6 +418,34 @@ L.Control.JSDialogBuilder = L.Control.extend({
 		return unit;
 	},
 
+	_getUnoStateForItemId: function(id, builder) {
+		var items = builder.map['stateChangeHandler'];
+		var state = null;
+
+		switch (id) {
+		case 'beforetextindent':
+			state = items.getItemValue('.uno:LeftRightParaMargin');
+			if (state)
+				return state.left.replace(',', '.');
+			break;
+
+		case 'aftertextindent':
+			state = items.getItemValue('.uno:LeftRightParaMargin');
+			if (state) {
+				return state.right.replace(',', '.');
+			}
+			break;
+
+		case 'firstlineindent':
+			state = items.getItemValue('.uno:LeftRightParaMargin');
+			if (state)
+				return state.firstline.replace(',', '.');
+			break;
+		}
+
+		return null;
+	},
+
 	_spinfieldControl: function(parentContainer, data, builder, customCallback) {
 		if (data.label) {
 			var fixedTextData = { text: data.label };
@@ -457,10 +485,14 @@ L.Control.JSDialogBuilder = L.Control.extend({
 		if (data.enabled == 'false')
 			$(spinfield).attr('disabled', 'disabled');
 
-		if (data.text != undefined)
-			$(spinfield).attr('value', builder._cleanValueFromUnits(data.text));
-		else if (data.children && data.children.length)
-			$(spinfield).attr('value', builder._cleanValueFromUnits(data.children[0].text));
+		var value = builder._getUnoStateForItemId(data.id, builder);
+		console.log(data.id + ': ' + value);
+		if (!value && data.text != undefined)
+			value = data.text;
+		else if (!value && data.children && data.children.length)
+			value = data.children[0].text;
+
+		$(spinfield).attr('value', builder._cleanValueFromUnits(value));
 
 		spinfield.addEventListener('change', function() {
 			if (customCallback)


More information about the Libreoffice-commits mailing list