loleaflet/css/notebookbar.css                       |  153 +++++---------------
 loleaflet/src/control/Control.Notebookbar.js        |    4 
 loleaflet/src/control/Control.NotebookbarBuilder.js |   27 ++-
 3 files changed, 61 insertions(+), 123 deletions(-)

New commits:
commit 58f1e865b88476c102cdf44f9b2170b99c8116f6
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Tue Aug 25 10:55:34 2020 +0200
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Tue Aug 25 11:54:29 2020 +0200

    notebookbar: insert textbox directly after click
    
    Change-Id: Ibfa5e306b53186b63d90fc3c655c83989e5936e9
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/101308
    Tested-by: Jenkins
    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 d734f01c0..544a7a017 100644
--- a/loleaflet/src/control/Control.NotebookbarBuilder.js
+++ b/loleaflet/src/control/Control.NotebookbarBuilder.js
@@ -50,6 +50,9 @@ L.Control.NotebookbarBuilder = 
L.Control.JSDialogBuilder.extend({
                this._toolitemHandlers['.uno:Menubar'] = this._menubarControl;
                this._toolitemHandlers['.uno:InsertPageHeader'] = 
this._headerFooterControl;
                this._toolitemHandlers['.uno:InsertPageFooter'] = 
this._headerFooterControl;
+               this._toolitemHandlers['.uno:Text'] = 
this._insertTextBoxControl;
+               this._toolitemHandlers['.uno:DrawText'] = 
this._insertTextBoxControl;
+               this._toolitemHandlers['.uno:VerticalText'] = 
this._insertTextBoxControl;
 
                this._toolitemHandlers['up'] = this._toolbarItemControl;
                this._toolitemHandlers['down'] = this._toolbarItemControl;
@@ -437,6 +440,15 @@ L.Control.NotebookbarBuilder = 
L.Control.JSDialogBuilder.extend({
                });
        },
 
+       _insertTextBoxControl: function(parentContainer, data, builder) {
+               var control = builder._unoToolButton(parentContainer, data, 
builder);
+
+               $(control.container).unbind('click');
+               $(control.container).click(function () {
+                       builder.map.sendUnoCommand(data.command + 
'?CreateDirectly:bool=true');
+               });
+       },
+
        _insertTableControl: function(parentContainer, data, builder) {
                var options = {hasDropdownArrow: true};
                var control = builder._unoToolButton(parentContainer, data, 
builder, options);
commit 61b6d8d3862fe27acdef89e8dc6c03c2c823f119
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Tue Aug 25 10:46:21 2020 +0200
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Tue Aug 25 11:54:24 2020 +0200

    notebookbar: build using div not tables
    
    This solves issues with positioning in Chrome
    using non standard zoom levels
    
    Change-Id: I14987f6c9e50f2d1c8a1170c489f69471cb9f807
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/101307
    Tested-by: Jenkins
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>

diff --git a/loleaflet/css/notebookbar.css b/loleaflet/css/notebookbar.css
index 9d65c25b2..77dc94881 100644
--- a/loleaflet/css/notebookbar.css
+++ b/loleaflet/css/notebookbar.css
@@ -152,9 +152,11 @@
     scrollbar-width: none; /* Firefox */
     -ms-overflow-style: none;  /* Internet Explorer 10+ */
 
-       height: 94px;
-       margin-top: -20px;
-       padding-top: 5px;
+       height: 84px;
+}
+
+.root-container.notebookbar {
+       display: table;
 }
 
 .notebookbar-scroll-wrapper::-webkit-scrollbar { /* WebKit */
@@ -167,6 +169,20 @@
        z-index: 11;
 }
 
+.cell.notebookbar {
+       display: table-cell;
+       vertical-align: middle;
+       padding: 2px;
+}
+
+.row.notebookbar {
+       display: table-row;
+}
+
+.vertical.notebookbar {
+       width: max-content;
+}
+
 /* unobuttons */
 
 .hasnotebookbar .ui-content .unobutton {
@@ -299,6 +315,7 @@ div[id*='Row'].notebookbar, div[id*='Column'].notebookbar, 
#SendToBack.notebookb
 .unotoolbutton.notebookbar.has-label:not(.inline) img {
        width: 32px !important;
        height: 32px !important;
+       padding-left: 25%;
 }
 
 /* unobuttons with inline labels */
@@ -356,26 +373,13 @@ div[id*='Row'].notebookbar, 
div[id*='Column'].notebookbar, #SendToBack.notebookb
        width: 170px !important;
 }
 
-#table-StyleParagraphSection1.notebookbar,
-#table-GroupB15.notebookbar,
-#table-GroupB11.notebookbar
-{
-       margin-top: -5px;
-}
-
 #Copy.notebookbar,
-#clearFormatting.notebookbar,
-#table-Home-Section-Insert #table-GroupB20.notebookbar {
+#clearFormatting.notebookbar {
        margin-top: 10px;
 }
 
-#table-GroupB94.notebookbar {
-       margin-top: -5px;
-}
-
 #table-GroupB19 #table-GroupB93.notebookbar {
        margin-left: -60px;
-       margin-top: 5px;
 }
 
 #table-stylescontainer #style1,
@@ -401,13 +405,8 @@ div[id*='Row'].notebookbar, div[id*='Column'].notebookbar, 
#SendToBack.notebookb
 
 /* Insert Tab */
 
-#InsertReferenceField.notebookbar,
-#InsertSection.notebookbar {
-       margin-top: 5px;
-}
-
 #table-Insert {
-       margin-top: 15px;
+       margin-top: 10px;
 }
 
 #table-Insert-Section-Pagebreak #InsertPagebreak.notebookbar img,
@@ -430,10 +429,6 @@ div[id*='Row'].notebookbar, div[id*='Column'].notebookbar, 
#SendToBack.notebookb
 
 /* Layout Tab */
 
-#table-LayoutBox, #table-Wrap8.notebookbar {
-       margin-top: 5px;
-}
-
 #FormatGroup.notebookbar img,
 #BringToFront.notebookbar img,
 #ObjectForwardOne.notebookbar img,
@@ -449,20 +444,11 @@ div[id*='Row'].notebookbar, 
div[id*='Column'].notebookbar, #SendToBack.notebookb
        display: none;
 }
 
-#InsertBreak.notebookbar,
-#Watermark.notebookbar,
-#LineNumberingDialog.notebookbar
-{
-       margin-top: 10px;
-}
-
 /* References Tab */
 
-#table-ReferencesBox,
-#table-References,
-#table-GroupB39 #table-LineA18
+#table-ReferencesTab
 {
-       margin-top: 5px;
+       margin-top: 10px;
 }
 
 #InsertMultiIndex.notebookbar img,
@@ -475,13 +461,6 @@ div[id*='Row'].notebookbar, div[id*='Column'].notebookbar, 
#SendToBack.notebookb
        width: 32px !important;
 }
 
-#UpdateCurIndex.notebookbar,
-#FootnoteDialog.notebookbar,
-#InsertCaptionDialog.notebookbar
-{
-       margin-top: 10px;
-}
-
 #table-Reference-Section-Field.notebookbar
 {
        display: none;
@@ -489,19 +468,11 @@ div[id*='Row'].notebookbar, 
div[id*='Column'].notebookbar, #SendToBack.notebookb
 
 /* Format Tab */
 #table-Format-Section.notebookbar {
-       margin-top: 25px;
+       margin-top: 15px;
 }
 
 /* Table Tab */
 
-#table-Table-Container,
-#table-SectionBottom85.notebookbar,
-#table-SectionBottom101.notebookbar,
-#table-GroupB62.notebookbar #SplitTable
-{
-       margin-top: 5px;
-}
-
 #table-Table-Section-Layout #InsertCaptionDialog.notebookbar img,
 #BorderDialog.notebookbar img,
 #MergeCells.notebookbar img,
@@ -523,14 +494,6 @@ div[id*='Row'].notebookbar, div[id*='Column'].notebookbar, 
#SendToBack.notebookb
        width: 24px !important;
 }
 
-#table-SectionBottom40.notebookbar,
-#SplitTable.notebookbar,
-#EntireRow.notebookbar,
-#DeleteTable.notebookbar
-{
-       margin-top: 10px !important;
-}
-
 #NumberFormatPercent.notebookbar {
        margin-right: 10px;
 }
@@ -541,8 +504,8 @@ div[id*='Row'].notebookbar, div[id*='Column'].notebookbar, 
#SendToBack.notebookb
 
 /* Review Tab */
 
-#table-ReviewBox, #table-Review {
-       margin-top: 5px;
+#table-ReviewTab {
+    margin-top: 10px;
 }
 
 #SpellingAndGrammarDialog.notebookbar img,
@@ -557,22 +520,14 @@ div[id*='Row'].notebookbar, 
div[id*='Column'].notebookbar, #SendToBack.notebookb
        width: 32px !important;
 }
 
-#WordCountDialog.notebookbar,
-#PreviousTrackedChange.notebookbar,
-#RejectTrackedChange.notebookbar,
-#RejectAllTrackedChanges.notebookbar
-{
-       margin-top: 10px !important;
-}
-
 /* Help tab */
 #table-Help-Section {
-       margin-top: 40px;
+       margin-top: 30px;
 }
 
 /* File tab */
 #table-File-Section {
-       margin-top: 20px;
+       margin-top: 10px;
 }
 
 /* Draw tab */
@@ -597,33 +552,8 @@ div[id*='Row'].notebookbar, div[id*='Column'].notebookbar, 
#SendToBack.notebookb
        width: 170px !important;
 }
 
-/* Insert Tab */
-
-#table-InsertBox {
-       margin-top: 5px;
-}
-
-#DefineName.notebookbar {
-       margin-top: 10px !important;
-}
-
-#DataDataPilotRun.notebookbar img
-{
-       height: 32px !important;
-       width: 32px !important;
-}
-
-#table-DataTab #table-ViewMenu3.notebookbar {
-       display: none;
-}
-
 /* Review Tab */
 
-#table-GroupB40 #Hyphenate.notebookbar,
-#DeleteAllNotes.notebookbar {
-       margin-top: 10px !important;
-}
-
 #SpellDialog.notebookbar img,
 #TraceChangeMode.notebookbar img,
 #AcceptChanges.notebookbar img,
@@ -644,15 +574,20 @@ div[id*='Row'].notebookbar, 
div[id*='Column'].notebookbar, #SendToBack.notebookb
        margin-top: 10px;
 }
 
-/* Impress */
-
-/* Home Tab */
+/* Data Tab */
 
-#table-Home-Section-Slide #table-LineB9.notebookbar
-{
+#table-DataTab {
        margin-top: 10px;
 }
 
+#table-DataTab #table-ViewMenu3.notebookbar {
+       display: none;
+}
+
+/* Impress */
+
+/* Home Tab */
+
 #table-shapes15 #BasicShapes.notebookbar,
 #table-HomeTab #table-SectionBottom10.notebookbar #Presentation
 {
@@ -680,11 +615,6 @@ div[id*='Row'].notebookbar, div[id*='Column'].notebookbar, 
#SendToBack.notebookb
 
 /* Review Tab */
 
-#table-GroupB40 #Hyphenation.notebookbar
-{
-       margin-top: 10px;
-}
-
 #table-GroupB42 #DeleteAllAnnotation.notebookbar img
 {
        height: 32px !important;
@@ -706,11 +636,6 @@ div[id*='Row'].notebookbar, div[id*='Column'].notebookbar, 
#SendToBack.notebookb
        width: 32px !important;
 }
 
-#table-Table-Section-Layout #table-SectionBottom57.notebookbar
-{
-       margin-top: 10px;
-}
-
 /* Draw Tab */
 
 #table-DrawTab #table-box6 #XLineColor.notebookbar {
diff --git a/loleaflet/src/control/Control.Notebookbar.js 
b/loleaflet/src/control/Control.Notebookbar.js
index cb1d43d0c..ac2ce11f4 100644
--- a/loleaflet/src/control/Control.Notebookbar.js
+++ b/loleaflet/src/control/Control.Notebookbar.js
@@ -155,7 +155,7 @@ L.Control.Notebookbar = L.Control.extend({
        },
 
        scrollToLastPositionIfNeeded: function() {
-               var rootContainer = $('.notebookbar-scroll-wrapper 
table').get(0);
+               var rootContainer = $('.notebookbar-scroll-wrapper div').get(0);
 
                if (this._currentScrollPosition && 
$(rootContainer).outerWidth() > $(window).width()) {
                        $('.notebookbar-scroll-wrapper').animate({ scrollLeft: 
this._currentScrollPosition }, 0);
@@ -189,7 +189,7 @@ L.Control.Notebookbar = L.Control.extend({
        setupResizeHandler: function() {
                var handler = function() {
                        var container = $('#toolbar-up').get(0);
-                       var rootContainer = $('.notebookbar-scroll-wrapper 
table').get(0);
+                       var rootContainer = $('.notebookbar-scroll-wrapper 
div').get(0);
 
                        if ($(rootContainer).outerWidth() > $(window).width()) {
                                // we have overflowed content
diff --git a/loleaflet/src/control/Control.NotebookbarBuilder.js 
b/loleaflet/src/control/Control.NotebookbarBuilder.js
index cc42143e2..d734f01c0 100644
--- a/loleaflet/src/control/Control.NotebookbarBuilder.js
+++ b/loleaflet/src/control/Control.NotebookbarBuilder.js
@@ -720,8 +720,8 @@ L.Control.NotebookbarBuilder = 
L.Control.JSDialogBuilder.extend({
                this._amendJSDialogData(data);
 
                if (hasVerticalParent === undefined) {
-                       parent = L.DomUtil.create('table', 'root-container ' + 
this.options.cssClass, parent);
-                       parent = L.DomUtil.create('tr', '', parent);
+                       parent = L.DomUtil.create('div', 'root-container ' + 
this.options.cssClass, parent);
+                       parent = L.DomUtil.create('div', 'vertical ' + 
this.options.cssClass, parent);
                }
 
                var containerToInsert = parent;
@@ -737,10 +737,10 @@ L.Control.NotebookbarBuilder = 
L.Control.JSDialogBuilder.extend({
 
                        if (parentHasManyChildren) {
                                if (!hasVerticalParent)
-                                       var td = L.DomUtil.create('td', '', 
containerToInsert);
+                                       var td = L.DomUtil.create('div', 'cell 
' + this.options.cssClass, containerToInsert);
                                else {
-                                       containerToInsert = 
L.DomUtil.create('tr', '', parent);
-                                       td = L.DomUtil.create('td', '', 
containerToInsert);
+                                       containerToInsert = 
L.DomUtil.create('div', 'row ' + this.options.cssClass, parent);
+                                       td = L.DomUtil.create('div', 'cell ' + 
this.options.cssClass, containerToInsert);
                                }
                        } else {
                                td = containerToInsert;
@@ -759,9 +759,10 @@ L.Control.NotebookbarBuilder = 
L.Control.JSDialogBuilder.extend({
                        var hasManyChildren = childData.children && 
childData.children.length > 1;
                        if (hasManyChildren) {
                                var tableId = childData.id ? 
childData.id.replace(' ', '') : 'undefined';
-                               var table = L.DomUtil.createWithId('table', 
'table-' + tableId, td);
+                               var table = L.DomUtil.createWithId('div', 
'table-' + tableId, td);
                                $(table).addClass(this.options.cssClass);
-                               var childObject = L.DomUtil.create('tr', '', 
table);
+                               $(table).addClass('vertical');
+                               var childObject = L.DomUtil.create('div', 'row 
' + this.options.cssClass, table);
                        } else {
                                childObject = td;
                        }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to