loleaflet/src/control/Control.NotebookbarBuilder.js |   56 +++++++++++++++++++-
 1 file changed, 54 insertions(+), 2 deletions(-)

New commits:
commit e1a02812f93fbcd546514487e6cda875097bfe24
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Wed Apr 22 12:33:37 2020 +0200
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Fri May 1 12:19:56 2020 +0200

    notebookbar: build horizontally
    
    Change-Id: I7772dbf6f15a4ed9feeb506b3100d756736db700
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93053
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>

diff --git a/loleaflet/src/control/Control.NotebookbarBuilder.js 
b/loleaflet/src/control/Control.NotebookbarBuilder.js
index a07987c31..470e7259f 100644
--- a/loleaflet/src/control/Control.NotebookbarBuilder.js
+++ b/loleaflet/src/control/Control.NotebookbarBuilder.js
@@ -3,15 +3,67 @@
  * L.Control.NotebookbarBuilder
  */
 
-/* global */
+/* global $ */
 L.Control.NotebookbarBuilder = L.Control.JSDialogBuilder.extend({
 
        onAdd: function (map) {
                this.map = map;
        },
 
+       build: function(parent, data) {
+               this._amendJSDialogData(data);
+
+               var table = L.DomUtil.create('table', '', parent);
+               var tr = L.DomUtil.create('tr', '', table);
+
+               for (var childIndex in data) {
+                       var childData = data[childIndex];
+                       if (!childData)
+                               continue;
+
+                       var td = L.DomUtil.create('td', '', tr);
+
+                       this._parentize(childData);
+                       var childType = childData.type;
+                       var processChildren = true;
+                       var needsToCreateContainer =
+                               childType == 'panel' || childType == 'frame';
+
+                       if ((childData.id === undefined || childData.id === '' 
|| childData.id === null)
+                               && (childType == 'checkbox' || childType == 
'radiobutton')) {
+                               continue;
+                       }
+
+                       var childObject = needsToCreateContainer ? 
L.DomUtil.createWithId('div', childData.id, td) : td;
+
+                       var handler = this._controlHandlers[childType];
+                       var twoPanelsAsChildren =
+                           childData.children && childData.children.length == 2
+                           && childData.children[0] && 
childData.children[0].type == 'panel'
+                           && childData.children[1] && 
childData.children[1].type == 'panel';
+
+                       if (twoPanelsAsChildren) {
+                               handler = this._controlHandlers['paneltabs'];
+                               processChildren = handler(childObject, 
childData.children, this);
+                       } else {
+                               if (handler)
+                                       processChildren = handler(childObject, 
childData, this);
+                               else
+                                       console.warn('Unsupported control type: 
\"' + childType + '\"');
+
+                               if (processChildren && childData.children != 
undefined)
+                                       this.build(childObject, 
childData.children);
+                               else if (childData.visible && 
(childData.visible === false || childData.visible === 'false')) {
+                                       $('#' + 
childData.id).addClass('hidden-from-event');
+                               }
+                       }
+               }
+       }
+
 });
 
 L.control.notebookbarBuilder = function (options) {
-       return new L.Control.NotebookbarBuilder(options);
+       var builder = new L.Control.NotebookbarBuilder(options);
+       builder._setup(options);
+       return builder;
 };
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to