bundled/include/LibreOfficeKit/LibreOfficeKit.h | 3 bundled/include/LibreOfficeKit/LibreOfficeKit.hxx | 10 bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h | 6 common/Protocol.hpp | 35 kit/ChildSession.cpp | 63 kit/ChildSession.hpp | 1 kit/DummyLibreOfficeKit.cpp | 11 loleaflet/Makefile.am | 23 loleaflet/build/deps.js | 6 loleaflet/css/leaflet.css | 5 loleaflet/css/loleaflet.css | 62 loleaflet/css/menubar.css | 145 + loleaflet/css/spreadsheet.css | 12 loleaflet/css/toolbar.css | 134 - loleaflet/css/w2ui-1.5.rc1.css | 24 loleaflet/debug/document/loleaflet.html | 1 loleaflet/html/loleaflet.html.m4 | 58 loleaflet/images/baseline-edit-24px.svg | 1 loleaflet/images/baseline-edit.svg | 1 loleaflet/images/fold.svg | 1 loleaflet/images/hamburger.svg | 83 loleaflet/images/lc_closedoc.svg | 66 loleaflet/images/lc_editdoc.svg | 1 loleaflet/images/lc_formatpaintbrush.svg | 1 loleaflet/images/lc_inserthyperlink.svg | 1 loleaflet/images/lc_resetattributes.svg | 1 loleaflet/images/lc_spacepara15.svg | 1 loleaflet/images/unfold.svg | 1 loleaflet/images/x-office-document.svg | 1 loleaflet/images/x-office-presentation.svg | 1 loleaflet/images/x-office-spreadsheet.svg | 1 loleaflet/js/toolbar.js | 704 +++++--- loleaflet/node_shrinkwrap/@types-jquery-2.0.40.tgz |binary loleaflet/node_shrinkwrap/hammerjs-2.0.8.tgz |binary loleaflet/node_shrinkwrap/timeago.js-4.0.0-beta.1.tgz |binary loleaflet/npm-shrinkwrap.json.in | 15 loleaflet/package.json | 3 loleaflet/plugins/draw-0.2.4/src/edit/handler/Edit.Rectangle.js | 6 loleaflet/plugins/path-transform/README.md | 64 loleaflet/plugins/path-transform/Readme.md | 100 + loleaflet/plugins/path-transform/build/deps.js | 16 loleaflet/plugins/path-transform/src/Canvas.js | 83 loleaflet/plugins/path-transform/src/Matrix.js | 204 ++ loleaflet/plugins/path-transform/src/Path.Drag.Transform.js | 45 loleaflet/plugins/path-transform/src/Path.Drag.js | 371 ++++ loleaflet/plugins/path-transform/src/Path.Transform.js | 867 ++++++++++ loleaflet/plugins/path-transform/src/SVG.VML.js | 57 loleaflet/plugins/path-transform/src/SVG.js | 20 loleaflet/plugins/path-transform/src/Util.js | 57 loleaflet/po/ui-pl.po | 8 loleaflet/reference.html | 40 loleaflet/src/control/Control.LokDialog.js | 346 ++- loleaflet/src/control/Control.Menubar.js | 133 + loleaflet/src/control/Permission.js | 55 loleaflet/src/core/Socket.js | 5 loleaflet/src/layer/AnnotationManager.js | 96 - loleaflet/src/layer/marker/Annotation.js | 14 loleaflet/src/layer/tile/ImpressTileLayer.js | 3 loleaflet/src/layer/tile/TileLayer.js | 190 ++ loleaflet/src/layer/vector/Path.js | 12 loleaflet/src/layer/vector/SVG.js | 12 loleaflet/src/layer/vector/SVGGroup.js | 135 + loleaflet/src/map/Map.js | 167 + loleaflet/src/map/handler/Map.Keyboard.js | 7 loleaflet/src/map/handler/Map.Mouse.js | 7 loleaflet/src/map/handler/Map.WOPI.js | 21 loleaflet/src/unocommands.js | 6 loolkitconfig.xcu | 3 test/WhiteBoxTests.cpp | 20 test/data/shapes.odp |binary test/data/shapes.svg | 54 test/httpwstest.cpp | 29 wsd/ClientSession.cpp | 15 wsd/DocumentBroker.cpp | 23 wsd/LOOLWSD.cpp | 2 wsd/protocol.txt | 10 76 files changed, 4125 insertions(+), 660 deletions(-)
New commits: commit b23d72a86831380ca136609a53c6c1ea14bc27bf Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Thu Dec 6 11:40:54 2018 +0100 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Fri Dec 7 12:39:28 2018 +0100 Slide switching buttons in mobile Change-Id: Idf30f53dc8e1a68d0c99dfef484ea9796ee40550 diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js index 29dc2491e..d5cd95051 100644 --- a/loleaflet/js/toolbar.js +++ b/loleaflet/js/toolbar.js @@ -853,6 +853,8 @@ function initMobileToolbar(toolItems) { items: [ {type: 'button', id: 'closemobile', img: 'closemobile'}, {type: 'spacer'}, + {type: 'button', id: 'prev', img: 'prev', hint: _UNO('.uno:PageUp', 'text'), hidden: true}, + {type: 'button', id: 'next', img: 'next', hint: _UNO('.uno:PageDown', 'text'), hidden: true}, {type: 'button', id: 'undo', img: 'undo', hint: _UNO('.uno:Undo'), uno: 'Undo', disabled: true}, {type: 'button', id: 'redo', img: 'redo', hint: _UNO('.uno:Redo'), uno: 'Redo', disabled: true}, {type: 'button', id: 'fullscreen', img: 'fullscreen', hint: _UNO('.uno:FullScreen', 'text')}, @@ -870,6 +872,13 @@ function initMobileToolbar(toolItems) { onClick: function (e) { onClick(e, e.target); hideTooltip(this, e.target); + }, + onRefresh: function() { + var docType = map.getDocType(); + if (docType === 'presentation') { + this.show('prev'); + this.show('next'); + } } }); toolbar.bind('touchstart', function(e) { commit d68d6cda4a502329a181ad60a6ebc0f630707e8a Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Tue Dec 4 23:28:55 2018 +0100 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Fri Dec 7 12:39:28 2018 +0100 WOPI: Action_RemoveView Change-Id: Ie8160b70b94c5cb9012560fde64e7e4e9eb079cf diff --git a/loleaflet/reference.html b/loleaflet/reference.html index 7a0effbec..aed14d3ee 100644 --- a/loleaflet/reference.html +++ b/loleaflet/reference.html @@ -2865,9 +2865,11 @@ WOPI Host to editor <th>Description</th> </tr> <tr> - <td><code><b>Remove_View</b></code></td> - <td></td> - <td>Remove session</code>. + <td><code><b>Action_RemoveView</b></code></td> + <td><code> + <nobr>ViewId: <Number></nobr> + </code></td> + <td>Remove the session</code>. </td> </tr> </table> diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js index dd3e5f6d9..165181d31 100644 --- a/loleaflet/src/layer/tile/TileLayer.js +++ b/loleaflet/src/layer/tile/TileLayer.js @@ -491,6 +491,14 @@ L.TileLayer = L.GridLayer.extend({ var signstatus = textMsg.substring('signaturestatus:'.length + 1); this._map.onChangeSignStatus(signstatus); } + else if (textMsg.startsWith('removesession')) { + var viewId = parseInt(textMsg.substring('removesession'.length + 1)); + if (this._map._docLayer._viewId === viewId) { + this._map.fire('postMessage', {msgId: 'close', args: {EverModified: this._map._everModified, Deprecated: true}}); + this._map.fire('postMessage', {msgId: 'UI_Close', args: {EverModified: this._map._everModified}}); + this._map.remove(); + } + } }, toggleTileDebugModeImpl: function() { diff --git a/loleaflet/src/map/handler/Map.WOPI.js b/loleaflet/src/map/handler/Map.WOPI.js index 7a3971c31..a8bc65fa9 100644 --- a/loleaflet/src/map/handler/Map.WOPI.js +++ b/loleaflet/src/map/handler/Map.WOPI.js @@ -298,10 +298,10 @@ L.Map.WOPI = L.Handler.extend({ this._map.CallPythonScriptSource = e.source; this._map.sendUnoCommand('vnd.sun.star.script:' + msg.ScriptFile + '$' + msg.Function + '?language=Python&location=share', msg.Values); } - else if (msg.MessageId === 'Remove_View') { - this._map.fire('postMessage', {msgId: 'close', args: {EverModified: this._map._everModified, Deprecated: true}}); - this._map.fire('postMessage', {msgId: 'UI_Close', args: {EverModified: this._map._everModified}}); - this._map.remove(); + else if (msg.MessageId === 'Action_RemoveView') { + if (msg.Values && msg.Values.ViewId !== null && msg.Values.ViewId !== undefined) { + this._map._socket.sendMessage('removesession ' + msg.Values.ViewId); + } } }, diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp index ce6ff972b..9cdadf82d 100644 --- a/wsd/ClientSession.cpp +++ b/wsd/ClientSession.cpp @@ -175,7 +175,8 @@ bool ClientSession::_handleInput(const char *buffer, int length) tokens[0] != "signdocument" && tokens[0] != "asksignaturestatus" && tokens[0] != "uploadsigneddocument" && - tokens[0] != "rendershapeselection") + tokens[0] != "rendershapeselection" && + tokens[0] != "removesession") { sendTextFrame("error: cmd=" + tokens[0] + " kind=unknown"); return false; @@ -361,6 +362,11 @@ bool ClientSession::_handleInput(const char *buffer, int length) docBroker->sendRequestedTiles(shared_from_this()); return true; } + else if (tokens[0] == "removesession") { + std::string sessionId = Util::encodeId(std::stoi(tokens[1]), 4); + docBroker->broadcastMessage(firstLine); + docBroker->removeSession(sessionId); + } else { if (tokens[0] == "key") commit 3bcc198483f498c67cec2980e79a1adfbaeedba9 Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> AuthorDate: Wed Dec 5 08:59:59 2018 -0500 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Fri Dec 7 12:39:28 2018 +0100 leaflet: check status change by comparing payloads only Since we have two status message commands, we need to store and compare just the payloads, lest we unnecessarily re-process the document state when nothing has changed (except we got status: vs statusupdate: or vice versa). Change-Id: I8506fc4ced3e7677ccc6725893b5ad8eeb8e9f9d diff --git a/loleaflet/src/layer/tile/ImpressTileLayer.js b/loleaflet/src/layer/tile/ImpressTileLayer.js index 4549a6c31..c2e90f0c8 100644 --- a/loleaflet/src/layer/tile/ImpressTileLayer.js +++ b/loleaflet/src/layer/tile/ImpressTileLayer.js @@ -439,6 +439,9 @@ L.ImpressTileLayer = L.TileLayer.extend({ _onStatusMsg: function (textMsg) { var command = this._map._socket.parseServerCmd(textMsg); + // Since we have two status commands, remove them so we store and compare payloads only. + textMsg = textMsg.replace('status: ', ''); + textMsg = textMsg.replace('statusupdate: ', ''); if (command.width && command.height && this._documentInfo !== textMsg) { this._docWidthTwips = command.width; this._docHeightTwips = command.height; commit 76a14c8eb03ab11392f8dfb2509972fc18d80167 Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> AuthorDate: Fri Nov 30 09:10:28 2018 -0500 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Fri Dec 7 12:39:28 2018 +0100 wsd: document forced autosave and why isAutosave=false Change-Id: I5bb35898bb917f6768327b264e87dd9000a10ecc diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp index 3dbfcb463..531cf9e74 100644 --- a/wsd/DocumentBroker.cpp +++ b/wsd/DocumentBroker.cpp @@ -981,6 +981,10 @@ bool DocumentBroker::autoSave(const bool force) { LOG_TRC("Sending forced save command for [" << _docKey << "]."); // Don't terminate editing as this can be invoked by the admin OOM, but otherwise force saving anyway. + // Flag isAutosave=false so the WOPI host wouldn't think this is a regular checkpoint and + // potentially optimize it away. This is as good as user-issued save, since this is + // triggered when the document is closed. In the case of network disconnection or browser crash + // most users would want to have had the chance to hit save before the document unloaded. sent = sendUnoSave(savingSessionId, /*dontTerminateEdit=*/true, /*dontSaveIfUnmodified=*/true, /*isAutosave=*/false, /*isExitSave=*/true); commit 95042c188983a62a0a05ded26803d70fd31a200b Author: Henry Castro <hcas...@collabora.com> AuthorDate: Tue Dec 4 21:57:31 2018 -0400 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Fri Dec 7 12:39:28 2018 +0100 loleaflet: restore original preserveAspectRatio attribute Change-Id: Ia34deb90c958e3d633d098b63c49adfd5bc3bdac diff --git a/loleaflet/src/layer/vector/SVGGroup.js b/loleaflet/src/layer/vector/SVGGroup.js index e24524867..af1e16a06 100644 --- a/loleaflet/src/layer/vector/SVGGroup.js +++ b/loleaflet/src/layer/vector/SVGGroup.js @@ -27,7 +27,6 @@ L.SVGGroup = L.Layer.extend({ this._svg = this._path.appendChild(doc.lastChild); this._svg.setAttribute('width', size.x); this._svg.setAttribute('height', size.y); - this._svg.setAttribute('preserveAspectRatio', 'xMinYMin'); this._svg.setAttribute('display', 'none'); this._update(); }, commit 1df72089568080ee46cde1f9a86a3c31752a2f22 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Tue Dec 4 16:46:45 2018 +0100 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Fri Dec 7 12:39:28 2018 +0100 Enable undo & redo after enterEditMode Change-Id: I275f16613eafe74539a8ddd939a8db9979174e6d diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js index 7f1d6feac..29dc2491e 100644 --- a/loleaflet/js/toolbar.js +++ b/loleaflet/js/toolbar.js @@ -2095,22 +2095,22 @@ function onUpdatePermission(e) { var toolbar = w2ui['editbar']; // always enabled items - var enabledButtons = ['closemobile']; + var enabledButtons = ['closemobile', 'undo', 'redo']; // copy the first array var items = toolbar.items.slice(); for (var idx in items) { + var found = enabledButtons.filter(function(id) { return id === items[idx].id }); + var alwaysEnable = found.length !== 0; + var unoCmd = map.getDocType() === 'spreadsheet' ? items[idx].unosheet : items[idx].uno; var keepDisabled = map['stateChangeHandler'].getItemValue(unoCmd) === 'disabled'; if (e.perm === 'edit') { - if (!keepDisabled) { + if (!keepDisabled || alwaysEnable) { toolbar.enable(items[idx].id); } - } else { - var item = enabledButtons.filter(function(id) { return id === items[idx].id }); - if (item.length === 0) { - toolbar.disable(items[idx].id); - } + } else if (!alwaysEnable) { + toolbar.disable(items[idx].id); } } commit facbffb0724e25f78baa486f7d1430657853814b Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Tue Dec 4 15:37:14 2018 +0100 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Fri Dec 7 12:39:28 2018 +0100 Enable buttons after read-only mode exit Change-Id: Ic6680d53d07ba0d3a026ae0e17ba5ba812e60e32 diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js index 002be65ec..7f1d6feac 100644 --- a/loleaflet/js/toolbar.js +++ b/loleaflet/js/toolbar.js @@ -2094,6 +2094,9 @@ function onCommandResult(e) { function onUpdatePermission(e) { var toolbar = w2ui['editbar']; + // always enabled items + var enabledButtons = ['closemobile']; + // copy the first array var items = toolbar.items.slice(); for (var idx in items) { @@ -2104,7 +2107,10 @@ function onUpdatePermission(e) { toolbar.enable(items[idx].id); } } else { - toolbar.disable(items[idx].id); + var item = enabledButtons.filter(function(id) { return id === items[idx].id }); + if (item.length === 0) { + toolbar.disable(items[idx].id); + } } } commit e71bbfcbc078245799da12414c8deec9d27cfd13 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Mon Dec 3 19:17:16 2018 +0100 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Fri Dec 7 12:39:28 2018 +0100 Reload menubar on permissions change Change-Id: I156315982cea806de9f0cd21ef45e018be0b3c52 diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js index 320a657b3..c6531158a 100644 --- a/loleaflet/src/control/Control.Menubar.js +++ b/loleaflet/src/control/Control.Menubar.js @@ -420,6 +420,7 @@ L.Control.Menubar = L.Control.extend({ this._initializeMenu(this.options.initial); map.on('doclayerinit', this._onDocLayerInit, this); + map.on('updatepermission', this._onRefresh, this); map.on('addmenu', this._addMenu, this); map.on('commandvalues', this._onInitMenu, this); map.on('updatetoolbarcommandvalues', this._onStyleMenu, this); @@ -491,6 +492,37 @@ L.Control.Menubar = L.Control.extend({ } }, + _onRefresh: function() { + // clear initial menu + while (this._menubarCont.hasChildNodes()) { + this._menubarCont.removeChild(this._menubarCont.firstChild); + } + + // Add document specific menu + var docType = this._map.getDocType(); + if (docType === 'text') { + this._initializeMenu(this.options.text); + } else if (docType === 'spreadsheet') { + this._initializeMenu(this.options.spreadsheet); + } else if (docType === 'presentation' || docType === 'drawing') { + this._initializeMenu(this.options.presentation); + } + + // initialize menubar plugin + $('#main-menu').smartmenus({ + hideOnClick: true, + showOnClick: true, + hideTimeout: 0, + hideDuration: 0, + showDuration: 0, + showTimeout: 0, + collapsibleHideDuration: 0, + subIndicatorsPos: 'append', + subIndicatorsText: '›' + }); + $('#main-menu').attr('tabindex', 0); + }, + _onStyleMenu: function (e) { if (e.commandName === '.uno:StyleApply') { var style; @@ -515,40 +547,19 @@ L.Control.Menubar = L.Control.extend({ }, _onDocLayerInit: function() { - // clear initial menu - while (this._menubarCont.hasChildNodes()) { - this._menubarCont.removeChild(this._menubarCont.firstChild); - } + this._onRefresh(); - // Add document specific menu var docType = this._map.getDocType(); var $docLogo = $('#document-logo'); $docLogo.bind('click', {self: this}, this._createDocument); if (docType === 'text') { $docLogo.addClass('writer-icon-img'); - this._initializeMenu(this.options.text); } else if (docType === 'spreadsheet') { $docLogo.addClass('calc-icon-img'); - this._initializeMenu(this.options.spreadsheet); } else if (docType === 'presentation' || docType === 'drawing') { $docLogo.addClass('impress-icon-img'); - this._initializeMenu(this.options.presentation); } - // initialize menubar plugin - $('#main-menu').smartmenus({ - hideOnClick: true, - showOnClick: true, - hideTimeout: 0, - hideDuration: 0, - showDuration: 0, - showTimeout: 0, - collapsibleHideDuration: 0, - subIndicatorsPos: 'append', - subIndicatorsText: '›' - }); - $('#main-menu').attr('tabindex', 0); - $('#main-menu').bind('select.smapi', {self: this}, this._onItemSelected); $('#main-menu').bind('mouseenter.smapi', {self: this}, this._onMouseEnter); $('#main-menu').bind('mouseleave.smapi', {self: this}, this._onMouseLeave); commit 867ca0129cc4ff55c7ea3694d65e3968128861f9 Author: Jan Holesovsky <ke...@collabora.com> AuthorDate: Fri Nov 30 16:29:18 2018 +0100 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Fri Dec 7 12:39:28 2018 +0100 mobile view mode: Don't show the 'edit' button on the desktop. Change-Id: Ia7f3fa5036c0f47fb9da51042b5cfe673871e432 diff --git a/loleaflet/html/loleaflet.html.m4 b/loleaflet/html/loleaflet.html.m4 index c4454ed04..9814f4906 100644 --- a/loleaflet/html/loleaflet.html.m4 +++ b/loleaflet/html/loleaflet.html.m4 @@ -132,7 +132,7 @@ ifelse(MOBILEAPP,[true], <div id="presentation-toolbar" style="display: none"></div> </div> - <div id="mobile-edit-button"> + <div id="mobile-edit-button" style="display: none"> <div id="mobile-edit-button-image"></div> </div> diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js index 19bbf3dd2..002be65ec 100644 --- a/loleaflet/js/toolbar.js +++ b/loleaflet/js/toolbar.js @@ -837,6 +837,7 @@ function createToolbar() { ]; if (_inMobileMode()) { + $('#mobile-edit-button').show(); initMobileToolbar(toolItems); } else { $('#toolbar-down').show(); commit ca6437f4175ff7c971be1642a4eb9bf5fdbd8319 Author: Jan Holesovsky <ke...@collabora.com> AuthorDate: Fri Nov 30 16:18:43 2018 +0100 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Fri Dec 7 12:39:28 2018 +0100 mobile view mode: More screen space for Writer and Calc. Change-Id: Ia754aad59d09254d538480619aec1020f4eb4943 diff --git a/loleaflet/html/loleaflet.html.m4 b/loleaflet/html/loleaflet.html.m4 index 49675b346..c4454ed04 100644 --- a/loleaflet/html/loleaflet.html.m4 +++ b/loleaflet/html/loleaflet.html.m4 @@ -136,7 +136,7 @@ ifelse(MOBILEAPP,[true], <div id="mobile-edit-button-image"></div> </div> - <div id="toolbar-down"></div> + <div id="toolbar-down" style="display: none"></div> <!-- Remove if you don't want the About dialog --> <div id="about-dialog" style="display:none; text-align: center; user-select: text"> diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js index c6a3a56ba..19bbf3dd2 100644 --- a/loleaflet/js/toolbar.js +++ b/loleaflet/js/toolbar.js @@ -839,6 +839,7 @@ function createToolbar() { if (_inMobileMode()) { initMobileToolbar(toolItems); } else { + $('#toolbar-down').show(); initNormalToolbar(toolItems); } } @@ -1603,8 +1604,9 @@ function onDocLayerInit() { { id: '1', text: _('None')} ]} ]); + + $('#spreadsheet-toolbar').show(); } - $('#spreadsheet-toolbar').show(); $('#formulabar').show(); break; @@ -2138,6 +2140,25 @@ function onUpdatePermission(e) { toolbar.enable(id); }); $('#search-input').prop('disabled', false); + + // FIXME avoid hardcoding this stuff if possible + if (_inMobileMode()) { + $('#toolbar-down').show(); + switch (map._docLayer._docType) { + case 'text': + $('#document-container').css('bottom', '33px'); + break; + case 'spreadsheet': + $('#document-container').css('bottom', '68px'); // FIXME this and spreadsheet-row-column-frame are supposed to be the same, but are not + $('#spreadsheet-row-column-frame').css('bottom', '65px'); + $('#spreadsheet-tabs-container').show(); + $('#spreadsheet-toolbar').show(); + break; + case 'presentation': + $('#document-container').css('bottom', '33px'); + break; + } + } } else { // Disable list boxes @@ -2169,6 +2190,25 @@ function onUpdatePermission(e) { toolbar.disable(id); }); $('#search-input').prop('disabled', true); + + // FIXME avoid hardcoding this stuff if possible + if (_inMobileMode()) { + $('#toolbar-down').hide(); + switch (map._docLayer._docType) { + case 'text': + $('#document-container').css('bottom', '0'); + break; + case 'spreadsheet': + $('#document-container').css('bottom', '0'); + $('#spreadsheet-row-column-frame').css('bottom', '0'); + $('#spreadsheet-tabs-container').hide(); + $('#spreadsheet-toolbar').hide(); + break; + case 'presentation': + $('#document-container').css('bottom', '0'); + break; + } + } } } commit da29205ea4d84666ed47b7d191fecbb2f755a675 Author: Jan Holesovsky <ke...@collabora.com> AuthorDate: Fri Nov 30 15:24:29 2018 +0100 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Fri Dec 7 12:39:28 2018 +0100 mobile view mode: Don't hide the content of the upper toolbar when read-only. Change-Id: I7d3cf8f5f1946f05254cc22d7ea6fedfe872e225 diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js index 422677cb4..4e198e381 100644 --- a/loleaflet/src/map/Map.js +++ b/loleaflet/src/map/Map.js @@ -129,11 +129,22 @@ L.Map = L.Evented.extend({ if (e.perm === 'readonly') { L.DomUtil.addClass(this._container.parentElement, 'readonly'); - L.DomUtil.addClass(L.DomUtil.get('toolbar-wrapper'), 'readonly'); + if (!L.Browser.mobile) { + L.DomUtil.addClass(L.DomUtil.get('toolbar-wrapper'), 'readonly'); + } L.DomUtil.addClass(L.DomUtil.get('main-menu'), 'readonly'); L.DomUtil.addClass(L.DomUtil.get('presentation-controls-wrapper'), 'readonly'); L.DomUtil.addClass(L.DomUtil.get('spreadsheet-row-column-frame'), 'readonly'); } + else { + L.DomUtil.removeClass(this._container.parentElement, 'readonly'); + if (!L.Browser.mobile) { + L.DomUtil.removeClass(L.DomUtil.get('toolbar-wrapper'), 'readonly'); + } + L.DomUtil.removeClass(L.DomUtil.get('main-menu'), 'readonly'); + L.DomUtil.removeClass(L.DomUtil.get('presentation-controls-wrapper'), 'readonly'); + L.DomUtil.removeClass(L.DomUtil.get('spreadsheet-row-column-frame'), 'readonly'); + } }, this); this.on('doclayerinit', function() { if (!this.initComplete) { commit 499a488b5afc4b4d838c67bc7c3ac4b44b9e1ff9 Author: Jan Holesovsky <ke...@collabora.com> AuthorDate: Fri Nov 30 14:37:11 2018 +0100 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Fri Dec 7 12:39:28 2018 +0100 mobile: Fix the naming confusion also for toolbar-down. Change-Id: I717d1364926a788a15ac9b5e89c4e5fe28a8cac3 diff --git a/loleaflet/css/toolbar.css b/loleaflet/css/toolbar.css index 74bf7c905..228623b3b 100644 --- a/loleaflet/css/toolbar.css +++ b/loleaflet/css/toolbar.css @@ -148,10 +148,10 @@ w2ui-toolbar { .closebuttonimage{ background: url('images/lc_closedoc.svg') no-repeat center !important; } -#tb_toolbar-down_item_left { +#tb_actionbar_item_left { width: 45%; } -#tb_toolbar-down_item_right { +#tb_actionbar_item_right { width: 100%; } diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js index 1f5d3b13e..c6a3a56ba 100644 --- a/loleaflet/js/toolbar.js +++ b/loleaflet/js/toolbar.js @@ -40,7 +40,7 @@ var nUsers, oneUser, noUser; function _mobilify() { var toolbarUp = w2ui['editbar']; - var statusbar = w2ui['toolbar-down']; + var statusbar = w2ui['actionbar']; toolbarUp.items.forEach(function(item) { if ((item.mobile === false || @@ -78,7 +78,7 @@ function _mobilify() { function _prepareDesktop() { var toolbarUp = w2ui['editbar']; - var statusbar = w2ui['toolbar-down']; + var statusbar = w2ui['actionbar']; toolbarUp.items.forEach(function(item) { if (item.desktop === false && !item.hidden) { @@ -96,14 +96,14 @@ function _prepareDesktop() { function resizeToolbar() { if ($(window).width() !== map.getSize().x) { var toolbarUp = w2ui['editbar']; - var statusbar = w2ui['toolbar-down']; + var statusbar = w2ui['actionbar']; toolbarUp.resize(); statusbar.resize(); } } function _cancelSearch() { - var toolbar = w2ui['toolbar-down']; + var toolbar = w2ui['actionbar']; map.resetSelection(); toolbar.hide('cancelsearch'); toolbar.disable('searchprev'); @@ -125,8 +125,8 @@ function onClick(e, id, item, subItem) { toolbar = w2ui['document-signing-bar']; item = toolbar.get(id); } - else if (w2ui['toolbar-down'].get(id) !== null) { - toolbar = w2ui['toolbar-down']; + else if (w2ui['actionbar'].get(id) !== null) { + toolbar = w2ui['actionbar']; item = toolbar.get(id); } else if (w2ui['spreadsheet-toolbar'].get(id) !== null) { @@ -280,7 +280,7 @@ function onClick(e, id, item, subItem) { } else if (id.startsWith('StateTableCellMenu') && subItem) { e.done(function () { - var menu = w2ui['toolbar-down'].get('StateTableCellMenu'); + var menu = w2ui['actionbar'].get('StateTableCellMenu'); if (subItem.id === '1') { // 'None' was clicked, remove all other options menu.selected = ['1']; } @@ -846,7 +846,7 @@ function createToolbar() { function initMobileToolbar(toolItems) { var toolbar = $('#toolbar-up'); toolbar.w2toolbar({ - name: 'toolbar-down', + name: 'actionbar', tooltip: 'bottom', items: [ {type: 'button', id: 'closemobile', img: 'closemobile'}, @@ -871,7 +871,7 @@ function initMobileToolbar(toolItems) { } }); toolbar.bind('touchstart', function(e) { - w2ui['toolbar-down'].touchStarted = true; + w2ui['actionbar'].touchStarted = true; var touchEvent = e.originalEvent; if (touchEvent && touchEvent.touches.length > 1) { L.DomEvent.preventDefault(e); @@ -1169,7 +1169,7 @@ function initNormalToolbar(toolItems) { toolbar = $('#toolbar-down'); if ($('#main-menu').css('display') !== 'none') { toolbar.w2toolbar({ - name: 'toolbar-down', + name: 'actionbar', tooltip: 'top', items: [ {type: 'html', id: 'search', @@ -1226,7 +1226,7 @@ function initNormalToolbar(toolItems) { onClick(e, e.target, e.item, e.subItem); }, onRefresh: function() { - $('#tb_toolbar-down_item_userlist .w2ui-tb-caption').addClass('loleaflet-font'); + $('#tb_actionbar_item_userlist .w2ui-tb-caption').addClass('loleaflet-font'); $('#search-input').off('input', onSearch).on('input', onSearch); $('#search-input').off('keydown', onSearchKeyDown).on('keydown', onSearchKeyDown); } @@ -1234,13 +1234,13 @@ function initNormalToolbar(toolItems) { } else { toolbar.w2toolbar({ - name: 'toolbar-down', + name: 'actionbar', tooltip: 'top', items: [] }); } toolbar.bind('touchstart', function() { - w2ui['toolbar-down'].touchStarted = true; + w2ui['actionbar'].touchStarted = true; }); } @@ -1297,7 +1297,7 @@ function unoCmdToToolbarId(commandname) } function onSearch() { - var toolbar = w2ui['toolbar-down']; + var toolbar = w2ui['actionbar']; // conditionally disabling until, we find a solution for tdf#108577 if (L.DomUtil.get('search-input').value === '') { toolbar.disable('searchprev'); @@ -1555,7 +1555,7 @@ function onWopiProps(e) { function onDocLayerInit() { var toolbarUp = w2ui['editbar']; - var statusbar = w2ui['toolbar-down']; + var statusbar = w2ui['actionbar']; var docType = map.getDocType(); switch (docType) { @@ -1713,7 +1713,7 @@ function onDocLayerInit() { function onCommandStateChanged(e) { var toolbar = w2ui['editbar']; - var statusbar = w2ui['toolbar-down']; + var statusbar = w2ui['actionbar']; var commandName = e.commandName; var state = e.state; var found = false; @@ -2035,7 +2035,7 @@ function onUpdateParts(e) { count = e.parts; } - var toolbar = w2ui['toolbar-down']; + var toolbar = w2ui['actionbar']; if (e.docType === 'presentation') { toolbar.set('prev', {hint: _('Previous slide')}); toolbar.set('next', {hint: _('Next slide')}); @@ -2133,7 +2133,7 @@ function onUpdatePermission(e) { toolbar.enable(id); }); - toolbar = w2ui['toolbar-down']; + toolbar = w2ui['actionbar']; toolbarDownButtons.forEach(function(id) { toolbar.enable(id); }); @@ -2164,7 +2164,7 @@ function onUpdatePermission(e) { toolbar.disable(id); }); - toolbar = w2ui['toolbar-down']; + toolbar = w2ui['actionbar']; toolbarDownButtons.forEach(function(id) { toolbar.disable(id); }); @@ -2181,7 +2181,7 @@ function onUseritemClicked(e) { // eslint-disable-line no-unused-vars map._goToViewId(viewId); if (viewId === map._docLayer._viewId) { - $('#tb_toolbar-down_item_userlist').w2overlay(''); + $('#tb_actionbar_item_userlist').w2overlay(''); return; } else if (docLayer._followThis !== -1) { map._setFollowing(false, null); @@ -2209,7 +2209,7 @@ function editorUpdate(e) { // eslint-disable-line no-unused-vars docLayer._followThis = editorId; } - var userlistItem = w2ui['toolbar-down'].get('userlist'); + var userlistItem = w2ui['actionbar'].get('userlist'); if (userlistItem !== null) { $('.selected-user').removeClass('selected-user'); if ($(userlistItem.html).find('.selected-user').length !== 0) @@ -2220,19 +2220,19 @@ function editorUpdate(e) { // eslint-disable-line no-unused-vars docLayer._followEditor = false; docLayer._followThis = -1; } - $('#tb_toolbar-down_item_userlist').w2overlay(''); + $('#tb_actionbar_item_userlist').w2overlay(''); } global.editorUpdate = editorUpdate; function selectUser(viewId) { - var userlistItem = w2ui['toolbar-down'].get('userlist'); + var userlistItem = w2ui['actionbar'].get('userlist'); if (userlistItem === null) { return; } userlistItem.html = $(userlistItem.html).find('#user-' + viewId).addClass('selected-user').parent().parent().parent()[0].outerHTML; - $('#tb_toolbar-down_item_userlist').w2overlay(''); + $('#tb_actionbar_item_userlist').w2overlay(''); } function getUserItem(viewId, userName, extraInfo, color) { @@ -2256,7 +2256,7 @@ function getUserItem(viewId, userName, extraInfo, color) { } function updateUserListCount() { - var userlistItem = w2ui['toolbar-down'].get('userlist'); + var userlistItem = w2ui['actionbar'].get('userlist'); if (userlistItem === null) { return; } @@ -2271,18 +2271,18 @@ function updateUserListCount() { } var zoomlevel = $('#zoomlevel').html(); - w2ui['toolbar-down'].refresh(); + w2ui['actionbar'].refresh(); $('#zoomlevel').html(zoomlevel); if (count > 1) { - $('#tb_toolbar-down_item_userlist').show(); + $('#tb_actionbar_item_userlist').show(); } else { - $('#tb_toolbar-down_item_userlist').hide(); + $('#tb_actionbar_item_userlist').hide(); } } function onAddView(e) { - $('#tb_toolbar-down_item_userlist') + $('#tb_actionbar_item_userlist') .w2overlay({ class: 'loleaflet-font', html: userJoinedPopupMessage.replace('%user', e.username), @@ -2290,7 +2290,7 @@ function onAddView(e) { }); clearTimeout(userPopupTimeout); userPopupTimeout = setTimeout(function() { - $('#tb_toolbar-down_item_userlist').w2overlay(''); + $('#tb_actionbar_item_userlist').w2overlay(''); clearTimeout(userPopupTimeout); userPopupTimeout = null; }, 3000); @@ -2307,7 +2307,7 @@ function onAddView(e) { username += ' (' + _('Readonly') + ')'; } - var userlistItem = w2ui['toolbar-down'].get('userlist'); + var userlistItem = w2ui['actionbar'].get('userlist'); if (userlistItem !== null) { var newhtml = $(userlistItem.html).find('#userlist_table tbody').append(getUserItem(e.viewId, username, e.extraInfo, color)).parent().parent()[0].outerHTML; userlistItem.html = newhtml; @@ -2396,7 +2396,7 @@ function setupToolbar(e) { map.on('search', function (e) { var searchInput = L.DomUtil.get('search-input'); - var toolbar = w2ui['toolbar-down']; + var toolbar = w2ui['actionbar']; if (e.count === 0) { toolbar.disable('searchprev'); toolbar.disable('searchnext'); @@ -2416,18 +2416,18 @@ function setupToolbar(e) { }); map.on('showbusy', function(e) { - w2utils.lock(w2ui['toolbar-down'].box, e.label, true); + w2utils.lock(w2ui['actionbar'].box, e.label, true); }); map.on('hidebusy', function() { // If locked, unlock - if (w2ui['toolbar-down'].box.firstChild.className === 'w2ui-lock') { - w2utils.unlock(w2ui['toolbar-down'].box); + if (w2ui['actionbar'].box.firstChild.className === 'w2ui-lock') { + w2utils.unlock(w2ui['actionbar'].box); } }); map.on('removeview', function(e) { - $('#tb_toolbar-down_item_userlist') + $('#tb_actionbar_item_userlist') .w2overlay({ class: 'loleaflet-font', html: userLeftPopupMessage.replace('%user', e.username), @@ -2435,7 +2435,7 @@ function setupToolbar(e) { }); clearTimeout(userPopupTimeout); userPopupTimeout = setTimeout(function() { - $('#tb_toolbar-down_item_userlist').w2overlay(''); + $('#tb_actionbar_item_userlist').w2overlay(''); clearTimeout(userPopupTimeout); userPopupTimeout = null; }, 3000); @@ -2445,7 +2445,7 @@ function setupToolbar(e) { map._docLayer._followUser = false; } - var userlistItem = w2ui['toolbar-down'].get('userlist'); + var userlistItem = w2ui['actionbar'].get('userlist'); if (userlistItem !== null) { userlistItem.html = $(userlistItem.html).find('#user-' + e.viewId).remove().end()[0].outerHTML; updateUserListCount(); commit 131f3e9b6b3f3ee48de6be056a07e46b6bf40e94 Author: Jan Holesovsky <ke...@collabora.com> AuthorDate: Fri Nov 30 14:31:34 2018 +0100 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Fri Dec 7 12:39:28 2018 +0100 mobile: Fix confusion between <div> naming and w2ui naming. Both were using toolbar-up, but the <div> was always up, but the actual w2ui toolbar (named toolbar-up) was at the bottom. Change-Id: Ic3ff80f68bfb878d2ed77e98e5be10ca96d64987 diff --git a/loleaflet/css/toolbar.css b/loleaflet/css/toolbar.css index 54c0c4803..74bf7c905 100644 --- a/loleaflet/css/toolbar.css +++ b/loleaflet/css/toolbar.css @@ -118,7 +118,7 @@ w2ui-toolbar { width: 181px; } -#tb_toolbar-up_item_edit { +#tb_editbar_item_edit { display: none; } diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js index 86a75b15d..1f5d3b13e 100644 --- a/loleaflet/js/toolbar.js +++ b/loleaflet/js/toolbar.js @@ -39,7 +39,7 @@ global.mode = { var nUsers, oneUser, noUser; function _mobilify() { - var toolbarUp = w2ui['toolbar-up']; + var toolbarUp = w2ui['editbar']; var statusbar = w2ui['toolbar-down']; toolbarUp.items.forEach(function(item) { @@ -77,7 +77,7 @@ function _mobilify() { } function _prepareDesktop() { - var toolbarUp = w2ui['toolbar-up']; + var toolbarUp = w2ui['editbar']; var statusbar = w2ui['toolbar-down']; toolbarUp.items.forEach(function(item) { @@ -95,7 +95,7 @@ function _prepareDesktop() { function resizeToolbar() { if ($(window).width() !== map.getSize().x) { - var toolbarUp = w2ui['toolbar-up']; + var toolbarUp = w2ui['editbar']; var statusbar = w2ui['toolbar-down']; toolbarUp.resize(); statusbar.resize(); @@ -113,8 +113,8 @@ function _cancelSearch() { } function onClick(e, id, item, subItem) { - if (w2ui['toolbar-up'].get(id) !== null) { - var toolbar = w2ui['toolbar-up']; + if (w2ui['editbar'].get(id) !== null) { + var toolbar = w2ui['editbar']; item = toolbar.get(id); } else if (w2ui.formulabar.get(id) !== null) { @@ -356,8 +356,8 @@ function setBorders(left, right, bottom, top, horiz, vert) { // close the popup function closePopup() { - if ($('#w2ui-overlay-toolbar-up').length > 0) { - $('#w2ui-overlay-toolbar-up').removeData('keepOpen')[0].hide(); + if ($('#w2ui-overlay-editbar').length > 0) { + $('#w2ui-overlay-editbar').removeData('keepOpen')[0].hide(); } map.focus(); } @@ -952,7 +952,7 @@ function initMobileToolbar(toolItems) { toolbar = $('#toolbar-down'); toolbar.w2toolbar({ - name: 'toolbar-up', + name: 'editbar', tooltip: 'top', items: toolItems, onClick: function (e) { @@ -970,7 +970,7 @@ function initMobileToolbar(toolItems) { updateCommandValues(edata.target); } - if (edata.target === 'toolbar-up' && map.getDocType() === 'presentation') { + if (edata.target === 'editbar' && map.getDocType() === 'presentation') { // Fill the style select box if not yet filled if ($('.styles-select')[0] && $('.styles-select')[0].length === 1) { var data = ['']; @@ -998,7 +998,7 @@ function initMobileToolbar(toolItems) { }); toolbar.bind('touchstart', function(e) { - w2ui['toolbar-up'].touchStarted = true; + w2ui['editbar'].touchStarted = true; var touchEvent = e.originalEvent; if (touchEvent && touchEvent.touches.length > 1) { L.DomEvent.preventDefault(e); @@ -1009,7 +1009,7 @@ function initMobileToolbar(toolItems) { function initNormalToolbar(toolItems) { var toolbar = $('#toolbar-up'); toolbar.w2toolbar({ - name: 'toolbar-up', + name: 'editbar', tooltip: 'bottom', items: toolItems, onClick: function (e) { @@ -1017,7 +1017,7 @@ function initNormalToolbar(toolItems) { hideTooltip(this, e.target); }, onRefresh: function(event) { - if (event.target === 'toolbar-up' && map.getDocType() === 'presentation') { + if (event.target === 'editbar' && map.getDocType() === 'presentation') { // Fill the style select box if not yet filled if ($('.styles-select')[0] && $('.styles-select')[0].length === 1) { var data = ['']; @@ -1048,7 +1048,7 @@ function initNormalToolbar(toolItems) { }); toolbar.bind('touchstart', function() { - w2ui['toolbar-up'].touchStarted = true; + w2ui['editbar'].touchStarted = true; }); toolbar = $('#formulabar'); @@ -1518,7 +1518,7 @@ function onFormulaBarBlur() { function onWopiProps(e) { if (e.HideSaveOption) { - w2ui['toolbar-up'].hide('save'); + w2ui['editbar'].hide('save'); } if (e.HideExportOption) { w2ui['presentation-toolbar'].hide('presentation', 'presentationbreak'); @@ -1548,13 +1548,13 @@ function onWopiProps(e) { $('#document-name-input').off('keypress', onDocumentNameKeyPress); } if (e.EnableInsertRemoteImage === true) { - w2ui['toolbar-up'].hide('insertgraphic'); - w2ui['toolbar-up'].show('menugraphic'); + w2ui['editbar'].hide('insertgraphic'); + w2ui['editbar'].show('menugraphic'); } } function onDocLayerInit() { - var toolbarUp = w2ui['toolbar-up']; + var toolbarUp = w2ui['editbar']; var statusbar = w2ui['toolbar-down']; var docType = map.getDocType(); @@ -1706,13 +1706,13 @@ function onDocLayerInit() { // Fold menubar by default map.toggleMenubar(); - $('#tb_toolbar-up_item_fonts').css({'display': 'none'}); - $('#tb_toolbar-up_item_fontsizes').css({'display': 'none'}); + $('#tb_editbar_item_fonts').css({'display': 'none'}); + $('#tb_editbar_item_fontsizes').css({'display': 'none'}); } } function onCommandStateChanged(e) { - var toolbar = w2ui['toolbar-up']; + var toolbar = w2ui['editbar']; var statusbar = w2ui['toolbar-down']; var commandName = e.commandName; var state = e.state; @@ -1829,11 +1829,11 @@ function onCommandStateChanged(e) { var html; if (modifiedStatus) { html = $('#modifiedstatuslabel').html('').parent().html(); - w2ui['toolbar-up'].set('save', {img:'savemodified'}); + w2ui['editbar'].set('save', {img:'savemodified'}); } else { html = $('#modifiedstatuslabel').html(_('Document saved')).parent().html(); - w2ui['toolbar-up'].set('save', {img:'save'}); + w2ui['editbar'].set('save', {img:'save'}); } updateToolbarItem(statusbar, 'modifiedstatuslabel', html); } @@ -2083,13 +2083,13 @@ function onCommandResult(e) { } else if ((commandName === '.uno:Undo' || commandName === '.uno:Redo') && e.success === true && e.result.value && !isNaN(e.result.value)) { /*UNDO_CONFLICT*/ - $('#tb_toolbar-up_item_repair').w2overlay({ html: '<div style="padding: 10px; line-height: 150%">' + + $('#tb_editbar_item_repair').w2overlay({ html: '<div style="padding: 10px; line-height: 150%">' + _('Conflict Undo/Redo with multiple users. Please use document repair to resolve') + '</div>'}); } } function onUpdatePermission(e) { - var toolbar = w2ui['toolbar-up']; + var toolbar = w2ui['editbar']; // copy the first array var items = toolbar.items.slice(); @@ -2384,7 +2384,7 @@ function setupToolbar(e) { break; } $('#zoomlevel').html(zoomPercent); - w2ui['toolbar-up'].set('zoom', {text: zoomPercent, selected: zoomSelected}); + w2ui['editbar'].set('zoom', {text: zoomPercent, selected: zoomSelected}); }); map.on('celladdress', function (e) { @@ -2412,7 +2412,7 @@ function setupToolbar(e) { }); map.on('updatetoolbarcommandvalues', function() { - w2ui['toolbar-up'].refresh(); + w2ui['editbar'].refresh(); }); map.on('showbusy', function(e) { diff --git a/loleaflet/src/map/handler/Map.WOPI.js b/loleaflet/src/map/handler/Map.WOPI.js index 3b5059290..7a3971c31 100644 --- a/loleaflet/src/map/handler/Map.WOPI.js +++ b/loleaflet/src/map/handler/Map.WOPI.js @@ -148,7 +148,7 @@ L.Map.WOPI = L.Handler.extend({ if (msg.MessageId === 'Insert_Button') { if (msg.Values) { - if (msg.Values.id && !w2ui['toolbar-up'].get(msg.Values.id) + if (msg.Values.id && !w2ui['editbar'].get(msg.Values.id) && msg.Values.imgurl) { if (this._map._permission === 'edit') { // add the css rule for the image @@ -158,7 +158,7 @@ L.Map.WOPI = L.Handler.extend({ $('html > head > style').append('.w2ui-icon.' + msg.Values.id + '{background: url(' + msg.Values.imgurl + ') no-repeat center !important; }'); // add the item to the toolbar - w2ui['toolbar-up'].insert('save', [ + w2ui['editbar'].insert('save', [ { type: 'button', id: msg.Values.id, commit b647f6b1cd40830cc63bdd6690b01ce39ba0d622 Author: Jan Holesovsky <ke...@collabora.com> AuthorDate: Fri Nov 30 13:15:02 2018 +0100 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Fri Dec 7 12:39:28 2018 +0100 mobile view mode: Start with the read-only mode, upgrade to edit when needed. Change-Id: I268bf89465aac871b83238b8e7c534ef80428e88 diff --git a/loleaflet/src/control/Permission.js b/loleaflet/src/control/Permission.js index ffc87ae8a..76c1ff7b2 100644 --- a/loleaflet/src/control/Permission.js +++ b/loleaflet/src/control/Permission.js @@ -2,22 +2,59 @@ /* * Document permission handler */ +/* global $ */ L.Map.include({ setPermission: function (perm) { - this._permission = perm; if (perm === 'edit') { - this._socket.sendMessage('requestloksession'); - if (!L.Browser.touch) { - this.dragging.disable(); + if (L.Browser.mobile) { + var button = $('#mobile-edit-button'); + button.show(); + button.off('click'); + + var that = this; + button.on('click', function () { + button.hide(); + that._enterEditMode('edit'); + that.fire('editorgotfocus'); + that.focus(); + }); + + // temporarily, before the user touches the floating action button + this._enterReadOnlyMode('readonly'); + } + else { + this._enterEditMode(perm); } } else if (perm === 'view' || perm === 'readonly') { - this.dragging.enable(); - // disable all user interaction, will need to add keyboard too - this._docLayer._onUpdateCursor(); - this._docLayer._clearSelections(); - this._docLayer._onUpdateTextSelection(); + if (L.Browser.mobile) { + $('#mobile-edit-button').hide(); + } + + this._enterReadOnlyMode(perm); + } + }, + + _enterEditMode: function (perm) { + this._permission = perm; + + this._socket.sendMessage('requestloksession'); + if (!L.Browser.touch) { + this.dragging.disable(); } + + this.fire('updatepermission', {perm : perm}); + }, + + _enterReadOnlyMode: function (perm) { + this._permission = perm; + + this.dragging.enable(); + // disable all user interaction, will need to add keyboard too + this._docLayer._onUpdateCursor(); + this._docLayer._clearSelections(); + this._docLayer._onUpdateTextSelection(); + this.fire('updatepermission', {perm : perm}); }, commit a710a8fafd66f3f5983cc75a31ecc59b905b298a Author: Jan Holesovsky <ke...@collabora.com> AuthorDate: Fri Nov 30 12:17:48 2018 +0100 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Fri Dec 7 12:39:28 2018 +0100 mobile view mode: Add the floating action button. The icon comes from the Material Design pages: https://material.io Change-Id: I59acf7bfb6c65030721605ead057c8854f529a3b diff --git a/loleaflet/css/loleaflet.css b/loleaflet/css/loleaflet.css index a85c4078a..bda949c39 100644 --- a/loleaflet/css/loleaflet.css +++ b/loleaflet/css/loleaflet.css @@ -80,6 +80,27 @@ body { width: 0; } +#mobile-edit-button { + position: absolute; + width: 56px; + height: 56px; + right: 16px; + bottom: 16px; + background-color: #0b87e7; + border-radius: 50%; + box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); + z-index: 2000; +} + +#mobile-edit-button-image { + position: relative; + left: 16px; + top: 16px; + width: 24px; + height: 24px; + background: url('images/baseline-edit-24px.svg') no-repeat center !important; +} + @media (max-width: 767px),(max-device-height: 767px) { /* Show slidesorter beyond 768px only */ #presentation-controls-wrapper { diff --git a/loleaflet/html/loleaflet.html.m4 b/loleaflet/html/loleaflet.html.m4 index ffcb61ae0..49675b346 100644 --- a/loleaflet/html/loleaflet.html.m4 +++ b/loleaflet/html/loleaflet.html.m4 @@ -132,6 +132,10 @@ ifelse(MOBILEAPP,[true], <div id="presentation-toolbar" style="display: none"></div> </div> + <div id="mobile-edit-button"> + <div id="mobile-edit-button-image"></div> + </div> + <div id="toolbar-down"></div> <!-- Remove if you don't want the About dialog --> diff --git a/loleaflet/images/baseline-edit-24px.svg b/loleaflet/images/baseline-edit-24px.svg new file mode 100644 index 000000000..1cdeabe45 --- /dev/null +++ b/loleaflet/images/baseline-edit-24px.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z" fill="white"/><path d="M0 0h24v24H0z" fill="none"/></svg> commit 13cfe2be30e966baa0e6b45cd066cecdbb2c1e29 Author: Marco Cecchetti <mrcek...@gmail.com> AuthorDate: Thu Nov 29 23:37:31 2018 +0100 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Fri Dec 7 12:39:28 2018 +0100 loleaflet: shape scaling rework Now shape scaling is handled through the transform dialog instead of simulating a drag and drop event in core. For performing a uniform scaling when the shape/image is rotated we need to inform the client about the rotation angle for the selected graphic object that has been achieved but appending an angle argument to the graphic selection callback. The client check if the angle is divisible by 90 in order to decide if uniform scaling should be used or it doesn't. Moreover now it is also possible to reverse shapes/images through negative scaling. Change-Id: Iadb93f5883ac403313c1358cb3d8cc9db78338fd diff --git a/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h b/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h index cb9091711..1d55ce858 100644 --- a/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h +++ b/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h @@ -161,9 +161,11 @@ typedef enum */ LOK_CALLBACK_CURSOR_VISIBLE = 5, /** - * The size and/or the position of the graphic selection changed. + * The size and/or the position of the graphic selection changed and + * the rotation angle of the embedded graphic object * - * Rectangle format is the same as LOK_CALLBACK_INVALIDATE_TILES. + * Format is "x, y, width, height, angle", where angle is in 100th + * of degree. */ LOK_CALLBACK_GRAPHIC_SELECTION = 6, diff --git a/loleaflet/plugins/path-transform/src/Path.Transform.js b/loleaflet/plugins/path-transform/src/Path.Transform.js index 97ea5fdd0..50171d4ea 100644 --- a/loleaflet/plugins/path-transform/src/Path.Transform.js +++ b/loleaflet/plugins/path-transform/src/Path.Transform.js @@ -477,6 +477,16 @@ L.Handler.PathTransform = L.Handler.extend({ return [sw, west, nw, north, ne, east, se, south]; }, + _getMirroredIndex: function(type, index) { + var sw = 0, w = 1, nw = 2, n = 3, ne = 4, e = 5, se = 6, s = 7; + if (type === 'h') + return [nw, w, sw, s, se, e, ne, n][index]; + else if (type === 'v') + return [se, e, ne, n, nw, w, sw, s][index]; + else if (type === 'c') + return [ne, e, se, s, sw, w, nw, n][index]; + }, + /** * Creates markers and handles */ @@ -714,11 +724,23 @@ L.Handler.PathTransform = L.Handler.extend({ this._map.addLayer(this._handleLine); this._map.addLayer(this._rotationMarker); + var type; + var index = this._activeMarker.options.index; + if (this._scale.x < 0 && this._scale.y < 0) + type = 'c'; + else if (this._scale.x < 0) + type = 'v'; + else if (this._scale.y < 0) + type = 'h'; + + if (type) + index = this._getMirroredIndex(type, index); + this._apply(); this._path.fire('scaleend', { layer: this._path, scale: this._scale.clone(), - pos: this._getPoints()[this._activeMarker.options.index] + pos: this._getPoints()[index] }); }, diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js index 167cb565b..dd3e5f6d9 100644 --- a/loleaflet/src/layer/tile/TileLayer.js +++ b/loleaflet/src/layer/tile/TileLayer.js @@ -97,6 +97,8 @@ L.TileLayer = L.GridLayer.extend({ this._graphicSelectionTwips = new L.Bounds(new L.Point(0, 0), new L.Point(0, 0)); // Rectangle graphic selection this._graphicSelection = new L.LatLngBounds(new L.LatLng(0, 0), new L.LatLng(0, 0)); + // Rotation angle of selected graphic object + this._graphicSelectionAngle = 0; // Original rectangle of cell cursor in twips this._cellCursorTwips = new L.Bounds(new L.Point(0, 0), new L.Point(0, 0)); // Rectangle for cell cursor @@ -613,6 +615,10 @@ L.TileLayer = L.GridLayer.extend({ this._map.fire('childid', {id: command.id}); }, + _isGraphicAngleDivisibleBy90: function() { + return (this._graphicSelectionAngle % 9000 === 0); + }, + _onShapeSelectionContent: function (textMsg) { textMsg = textMsg.substring('shapeselectioncontent:'.length + 1); if (this._graphicMarker) { @@ -636,7 +642,7 @@ L.TileLayer = L.GridLayer.extend({ this._graphicSelection = new L.LatLngBounds( this._twipsToLatLng(topLeftTwips, this._map.getZoom()), this._twipsToLatLng(bottomRightTwips, this._map.getZoom())); - + this._graphicSelectionAngle = (strTwips.length === 5) ? parseInt(strTwips[4]) : 0; this._map._socket.sendMessage('rendershapeselection mimetype=image/svg+xml'); } @@ -1767,15 +1773,104 @@ L.TileLayer = L.GridLayer.extend({ if (!e.pos) { return; } var aPos = this._latLngToTwips(e.pos); + var selMin = this._graphicSelectionTwips.min; + var selMax = this._graphicSelectionTwips.max; + if (e.type === 'scalestart') { this._graphicMarker.isDragged = true; - this._postSelectGraphicEvent('start', - Math.min(aPos.x, this._graphicSelectionTwips.max.x - 1), - Math.min(aPos.y, this._graphicSelectionTwips.max.y - 1)); - } - else if (e.type == 'scaleend') { - this._postSelectGraphicEvent('end', aPos.x, aPos.y); + if (selMax.x - selMin.x < 2) + this._graphicMarker.dragHorizDir = 0; // overlapping handles + else if (Math.abs(selMin.x - aPos.x) < 2) + this._graphicMarker.dragHorizDir = -1; // left handle + else if (Math.abs(selMax.x - aPos.x) < 2) + this._graphicMarker.dragHorizDir = 1; // right handle + if (selMax.y - selMin.y < 2) + this._graphicMarker.dragVertDir = 0; // overlapping handles + else if (Math.abs(selMin.y - aPos.y) < 2) + this._graphicMarker.dragVertDir = -1; // up handle + else if (Math.abs(selMax.y - aPos.y) < 2) + this._graphicMarker.dragVertDir = 1; // down handle + } + else if (e.type === 'scaleend') { + var oldSize = selMax.subtract(selMin); + var newSize = oldSize.clone(); + var newPos = selMin.clone(); + var center = this._graphicSelectionTwips.getCenter(); + var horizDir = this._graphicMarker.dragHorizDir; + var vertDir = this._graphicMarker.dragVertDir; + + var computePosAndSize = function (coord) { + var direction = (coord === 'x') ? horizDir : vertDir; + var delta; + if (direction === 0) { + newSize[coord] = Math.abs(aPos[coord] - center[coord]); + newPos[coord] = (aPos[coord] > center[coord]) ? center[coord] : center[coord] - newSize[coord]; + } + else if (direction === -1) { // left/up handle + delta = selMin[coord] - aPos[coord]; + newSize[coord] = oldSize[coord] + delta; + newPos[coord] = aPos[coord]; + } + else if (direction === 1) { // right/down handle + delta = aPos[coord] - selMax[coord]; + newSize[coord] = oldSize[coord] + delta; + newPos[coord] = selMin[coord]; + } + }; + + computePosAndSize('x'); + computePosAndSize('y'); + + // do we need to perform uniform scaling ? + if (!this._isGraphicAngleDivisibleBy90()) { + var delta = 0; + if (horizDir !== undefined && vertDir === undefined) { + newSize.y = Math.round(oldSize.y * (newSize.x / oldSize.x)); + delta = newSize.y - oldSize.y; + newPos.y = Math.round(selMin.y - delta / 2); + } + else if (horizDir === undefined && vertDir !== undefined) { + newSize.x = Math.round(oldSize.x * (newSize.y / oldSize.y)); + delta = newSize.x - oldSize.x; + newPos.x = Math.round(selMin.x - delta / 2); + } + } + + // try to keep shape inside document + if (newPos.x + newSize.x > this._docWidthTwips) + newPos.x = this._docWidthTwips - newSize.x; + if (newPos.x < 0) + newPos.x = 0; + + if (newPos.y + newSize.y > this._docHeightTwips) + newPos.y = this._docHeightTwips - newSize.y; + if (newPos.y < 0) + newPos.y = 0; + + // fill params for uno command + var param = { + TransformPosX: { + type: 'long', + value: newPos.x + }, + TransformPosY: { + type: 'long', + value: newPos.y + }, + TransformWidth: { + type: 'long', + value: newSize.x + }, + TransformHeight: { + type: 'long', + value: newSize.y + } + }; + + this._map.sendUnoCommand('.uno:TransformDialog ', param); this._graphicMarker.isDragged = false; + this._graphicMarker.dragHorizDir = undefined; + this._graphicMarker.dragVertDir = undefined; } }, @@ -1888,7 +1983,7 @@ L.TileLayer = L.GridLayer.extend({ this._graphicMarker.on('rotatestart rotateend', this._onGraphicRotate, this); this._map.addLayer(this._graphicMarker); this._graphicMarker.dragging.enable(); - this._graphicMarker.transform.enable({uniformScaling: false}); + this._graphicMarker.transform.enable({uniformScaling: !this._isGraphicAngleDivisibleBy90()}); } else if (this._graphicMarker) { this._graphicMarker.removeEventParent(this._map); commit 286d13e0773b4258673f1bef98e4072ab55a27e9 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Thu Nov 22 18:37:53 2018 +0100 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Fri Dec 7 12:39:28 2018 +0100 Zooming dialogs: per instance, not global Change-Id: Id5a0baac745018a2d450ce4cb930849105452563 diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js index 2315706f9..bbf9b9dd1 100644 --- a/loleaflet/src/control/Control.LokDialog.js +++ b/loleaflet/src/control/Control.LokDialog.js @@ -8,56 +8,76 @@ L.WinUtil = { }; -function updateTransformation() { - var value = [ - 'translate3d(' + transform.translate.x + 'px, ' + transform.translate.y + 'px, 0)', - 'scale(' + transform.scale + ', ' + transform.scale + ')' - ]; - - value = value.join(' '); - zoomTarget.style.webkitTransform = value; - zoomTarget.style.mozTransform = value; - zoomTarget.style.transform = value; +function updateTransformation(target) { + if (target !== null && target !== undefined) { + var value = [ + 'translate3d(' + target.transformation.translate.x + 'px, ' + target.transformation.translate.y + 'px, 0)', + 'scale(' + target.transformation.scale + ', ' + target.transformation.scale + ')' + ]; + + value = value.join(' '); + target.value.style.webkitTransform = value; + target.value.style.mozTransform = value; + target.value.style.transform = value; + } } -// Zooming dialogs -var startX = 0; -var startY = 0; -var hammer = null; -var zoomTarget = null; -var initScale = 1; -var transform = { - translate: { x: 0, y: 0 }, - scale: 1, - angle: 0, - rx: 0, - ry: 0, - rz: 0 -}; +var zoomTargets = []; + +function findZoomTarget(id) { + for (var item in zoomTargets) { + if (zoomTargets[item].key === id) { + return zoomTargets[item]; + } + } + return null; +} + +function removeZoomTarget(id) { + for (var item in zoomTargets) { + if (zoomTargets[item].key === id) { + delete zoomTargets[item]; + } + } +} + +function toZoomTargetId(id) { + return id.replace('-canvas', ''); +} L.Control.LokDialog = L.Control.extend({ dialogIdPrefix: 'lokdialog-', onPan: function (ev) { - transform.translate = { - x: startX + ev.deltaX, - y: startY + ev.deltaY - }; + var id = toZoomTargetId(ev.target.id); + var target = findZoomTarget(id); - updateTransformation(); + if (target) { + target.transformation.translate = { + x: target.initialState.startX + ev.deltaX, + y: target.initialState.startY + ev.deltaY + }; + + updateTransformation(target); + } }, onPinch: function (ev) { - if (ev.type == 'pinchstart') { - initScale = transform.scale || 1; - } + var id = toZoomTargetId(ev.target.id); + var target = findZoomTarget(id); - if (initScale * ev.scale > 0.4) { - transform.scale = initScale * ev.scale; - } + if (target) { + if (ev.type == 'pinchstart') { + target.initialState.initScale = target.transformation.scale || 1; + } + + if (target.initialState.initScale * ev.scale > 0.4) { + target.transformation.scale = target.initialState.initScale * ev.scale; + } - updateTransformation(); + updateTransformation(target); + } }, onAdd: function (map) { @@ -429,21 +449,42 @@ L.Control.LokDialog = L.Control.extend({ }); // Zooming dialogs - zoomTarget = $('.ui-dialog').get(0); - - if (hammer === null) { - hammer = new Hammer(canvas); + var targetId = toZoomTargetId(canvas.id); + var zoomTarget = $('#' + targetId).parent().get(0); + var state = { + startX: 0, + startY: 0, + initScale: 1 } + var transformation = { + translate: { x: 0, y: 0 }, + scale: 1, + angle: 0, + rx: 0, + ry: 0, + rz: 0 + }; + + zoomTargets.push({key: targetId, value: zoomTarget, transformation: transformation, initialState: state}); - hammer.add(new Hammer.Pan({ threshold: 0, pointers: 0 })); - hammer.add(new Hammer.Pinch({ threshold: 0 })).recognizeWith([hammer.get('pan')]); + var hammerContent = new Hammer(canvas); + var hammerAll = new Hammer(zoomTarget); - hammer.on('panstart panmove', this.onPan); - hammer.on('pinchstart pinchmove', this.onPinch); - hammer.on('hammer.input', function(ev) { + hammerContent.add(new Hammer.Pan({ threshold: 0, pointers: 0 })); + hammerAll.add(new Hammer.Pan({ threshold: 0, pointers: 0 })); + hammerAll.add(new Hammer.Pinch({ threshold: 0 })).recognizeWith([hammerAll.get('pan')]); + + hammerContent.on('panstart panmove', this.onPan); + hammerAll.on('panstart panmove', this.onPan); + hammerAll.on('pinchstart pinchmove', this.onPinch); + hammerAll.on('hammer.input', function(ev) { if (ev.isFinal) { - startX = transform.translate.x; - startY = transform.translate.y; + var id = toZoomTargetId(ev.target.id); + var target = findZoomTarget(id); + if (target) { + target.initialState.startX = target.transformation.translate.x; + target.initialState.startY = target.transformation.translate.y; + } } }); }, @@ -471,19 +512,7 @@ L.Control.LokDialog = L.Control.extend({ delete this._dialogs[dialogId]; this._currentId = null; - startX = 0; - startY = 0; - hammer = null; - zoomTarget = null; - initScale = 1; - transform = { - translate: { x: 0, y: 0 }, - scale: 1, - angle: 0, - rx: 0, - ry: 0, - rz: 0 - }; + removeZoomTarget(this._toStrId(dialogId)); }, onCloseCurrentPopUp: function() { commit 0d2e61c45fbebefec0a6ce582322a39bfd4ce4fc Author: Jan Holesovsky <ke...@collabora.com> AuthorDate: Thu Nov 29 09:59:00 2018 +0100 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Fri Dec 7 12:39:28 2018 +0100 menubar: The temporary one should not be disabled & jump to the new position. Also don't use the hover frame for the 'Last modification', it is not a real menubar enttry. Change-Id: Iccaf8ff2b7a882e7d5bbf56d5dc19422a93457fe diff --git a/loleaflet/css/menubar.css b/loleaflet/css/menubar.css index 907cb8efb..cf3c9df9b 100644 --- a/loleaflet/css/menubar.css +++ b/loleaflet/css/menubar.css @@ -319,10 +319,3 @@ border: 1px solid transparent; cursor: pointer; } - -#menu-last-mod a:hover { - background: #fff; - border-color: #bbbbbb; - padding: 7px 14px 6px 14px; - border: 1px solid #bbb; -} diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js index 8f8527ced..320a657b3 100644 --- a/loleaflet/src/control/Control.Menubar.js +++ b/loleaflet/src/control/Control.Menubar.js @@ -8,11 +8,11 @@ L.Control.Menubar = L.Control.extend({ // TODO: Some mechanism to stop the need to copy duplicate menus (eg. Help) options: { initial: [ - {name: _UNO('.uno:PickList'), disabled: true}, - {name: _UNO('.uno:EditMenu'), disabled: true}, - {name: _UNO('.uno:ViewMenu'), disabled: true}, - {name: _UNO('.uno:InsertMenu'), disabled: true}, - {name: _UNO('.uno:ToolsMenu'), disabled: true} + {name: _UNO('.uno:PickList')}, + {name: _UNO('.uno:EditMenu')}, + {name: _UNO('.uno:ViewMenu')}, + {name: _UNO('.uno:InsertMenu')}, + {name: _UNO('.uno:ToolsMenu')} ], text: [ {name: _UNO('.uno:PickList', 'text'), id: 'file', type: 'menu', menu: [ commit dfeabd981017bb8dc3b5deaf6de1a91862f2dc36 Author: Henry Castro <hcas...@collabora.com> AuthorDate: Thu Nov 29 12:07:41 2018 -0400 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Fri Dec 7 12:39:28 2018 +0100 loleaflet: show/hide embedded SVG when it is transformed Change-Id: I89b10a8bc36520a1224701835b0a66e4b781109e diff --git a/loleaflet/src/layer/vector/SVGGroup.js b/loleaflet/src/layer/vector/SVGGroup.js index fece32e0e..e24524867 100644 --- a/loleaflet/src/layer/vector/SVGGroup.js +++ b/loleaflet/src/layer/vector/SVGGroup.js @@ -13,6 +13,9 @@ L.SVGGroup = L.Layer.extend({ L.setOptions(this, options); this._bounds = bounds; this._rect = L.rectangle(bounds, this.options); + + this.on('dragstart scalestart rotatestart', this._showEmbeddedSVG, this); + this.on('dragend scaleend rotateend', this._hideEmbeddedSVG, this); }, addEmbeddedSVG: function (svgString) { @@ -81,6 +84,12 @@ L.SVGGroup = L.Layer.extend({ } }, + _hideEmbeddedSVG: function () { + if (this._svg) { + this._svg.setAttribute('display', 'none'); + } + }, + _transform: function(matrix) { if (this._renderer) { if (matrix) { @@ -101,6 +110,12 @@ L.SVGGroup = L.Layer.extend({ this._update(); }, + _showEmbeddedSVG: function () { + if (this._svg) { + this._svg.setAttribute('display', ''); + } + }, + _update: function () { this._rect.setBounds(this._bounds); if (this._svg) { commit d2b9f24ab5d34a85237cd3494db11e63458bf5bf Author: Henry Castro <hcas...@collabora.com> AuthorDate: Thu Nov 29 11:24:47 2018 -0400 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Fri Dec 7 12:39:28 2018 +0100 loleaflet: set display to none of an embedded svg element Change-Id: I6827dd60e3ed6959cabf623f153e73cafed2107a diff --git a/loleaflet/src/layer/vector/SVGGroup.js b/loleaflet/src/layer/vector/SVGGroup.js index b84510cce..fece32e0e 100644 --- a/loleaflet/src/layer/vector/SVGGroup.js +++ b/loleaflet/src/layer/vector/SVGGroup.js @@ -25,6 +25,7 @@ L.SVGGroup = L.Layer.extend({ this._svg.setAttribute('width', size.x); this._svg.setAttribute('height', size.y); this._svg.setAttribute('preserveAspectRatio', 'xMinYMin'); + this._svg.setAttribute('display', 'none'); this._update(); }, commit 0eb1bcb8ceeda1ff9fdbe76409a29a02da45888c Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Thu Nov 22 18:37:53 2018 +0100 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Fri Dec 7 12:39:28 2018 +0100 Zoom & move LOKDialogs using gestures Change-Id: I313ef0ed1b801d8a3d3aadfca7c2eb001499e7db diff --git a/loleaflet/Makefile.am b/loleaflet/Makefile.am index a043c7115..cc6f2a410 100644 --- a/loleaflet/Makefile.am +++ b/loleaflet/Makefile.am @@ -92,6 +92,7 @@ LOLEAFLET_CSS_M4 = $(strip $(foreach file,$(LOLEAFLET_CSS),$(notdir $(file)))) $(eval $(call file_targets,$(LOLEAFLET_CSS))) NODE_MODULES_JS =\ + node_modules/hammerjs/hammer.min.js \ node_modules/jquery/dist/jquery.js \ node_modules/jquery-mousewheel/jquery.mousewheel.js \ node_modules/jquery-contextmenu/dist/jquery.contextMenu.js \ diff --git a/loleaflet/css/loleaflet.css b/loleaflet/css/loleaflet.css index 24ccee0cb..a85c4078a 100644 --- a/loleaflet/css/loleaflet.css +++ b/loleaflet/css/loleaflet.css @@ -42,6 +42,7 @@ body { overflow: hidden; overscroll-behavior-y: none; /* disable the pull to reload gesture */ background: #ffffff; + touch-action: none; } #presentation-controls-wrapper { diff --git a/loleaflet/node_shrinkwrap/@types-jquery-2.0.40.tgz b/loleaflet/node_shrinkwrap/@types-jquery-2.0.40.tgz new file mode 100644 index 000000000..8be6a880a Binary files /dev/null and b/loleaflet/node_shrinkwrap/@types-jquery-2.0.40.tgz differ diff --git a/loleaflet/node_shrinkwrap/hammerjs-2.0.8.tgz b/loleaflet/node_shrinkwrap/hammerjs-2.0.8.tgz new file mode 100644 index 000000000..c61b8ca2a Binary files /dev/null and b/loleaflet/node_shrinkwrap/hammerjs-2.0.8.tgz differ diff --git a/loleaflet/npm-shrinkwrap.json.in b/loleaflet/npm-shrinkwrap.json.in index 877164e8c..407d50b43 100644 --- a/loleaflet/npm-shrinkwrap.json.in +++ b/loleaflet/npm-shrinkwrap.json.in @@ -4,6 +4,11 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "@types/jquery": { + "version": "2.0.40", + "resolved": "file:node_shrinkwrap/@types-jquery-2.0.40.tgz", + "dev": true + }, "acorn": { "version": "4.0.13", "resolved": "file:node_shrinkwrap/acorn-4.0.13.tgz", @@ -1475,6 +1480,11 @@ "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=", "dev": true }, + "hammerjs": { + "version": "2.0.8", + "resolved": "file:node_shrinkwrap/hammerjs-2.0.8.tgz", + "dev": true + }, "has": { "version": "1.0.1", "resolved": "file:node_shrinkwrap/has-1.0.1.tgz", @@ -2929,8 +2939,7 @@ }, "timeago.js": { "version": "4.0.0-beta.1", - "from": "timeago.js@4.0.0-beta.1", - "resolved": "https://registry.npmjs.org/timeago.js/-/timeago.js-4.0.0-beta.1.tgz", + "resolved": "file:node_shrinkwrap/timeago.js-4.0.0-beta.1.tgz", "dev": true }, "timers-browserify": { diff --git a/loleaflet/package.json b/loleaflet/package.json index 9f7d40626..0c45f4b72 100644 --- a/loleaflet/package.json +++ b/loleaflet/package.json @@ -10,6 +10,7 @@ "d3": "3.5.17", "eslint": "3.0.0", "exorcist": "0.4.0", + "hammerjs": "2.0.8", "jquery": "2.2.4", "jquery-contextmenu": "2.2.3", "jquery-ui": "1.10.5", @@ -21,6 +22,7 @@ "smartmenus": "1.0.0", "timeago": "1.5.3", "timeago.js": "4.0.0-beta.1", + "@types/jquery": "2.0.40", "uglify-js": "2.4.24", "uglifycss": "0.0.27", "uglifyify": "3.0.2", diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js index 8d6435f9b..2315706f9 100644 --- a/loleaflet/src/control/Control.LokDialog.js +++ b/loleaflet/src/control/Control.LokDialog.js @@ -3,11 +3,63 @@ * L.Control.LokDialog used for displaying LOK dialogs */ -/* global $ L */ +/* global $ L Hammer */ +L.WinUtil = { + +}; + +function updateTransformation() { + var value = [ + 'translate3d(' + transform.translate.x + 'px, ' + transform.translate.y + 'px, 0)', + 'scale(' + transform.scale + ', ' + transform.scale + ')' + ]; + + value = value.join(' '); + zoomTarget.style.webkitTransform = value; + zoomTarget.style.mozTransform = value; + zoomTarget.style.transform = value; +} + +// Zooming dialogs +var startX = 0; +var startY = 0; +var hammer = null; +var zoomTarget = null; +var initScale = 1; +var transform = { + translate: { x: 0, y: 0 }, + scale: 1, + angle: 0, + rx: 0, + ry: 0, + rz: 0 +}; + L.Control.LokDialog = L.Control.extend({ dialogIdPrefix: 'lokdialog-', + onPan: function (ev) { + transform.translate = { + x: startX + ev.deltaX, + y: startY + ev.deltaY + }; + + updateTransformation(); + }, + + onPinch: function (ev) { + if (ev.type == 'pinchstart') { + initScale = transform.scale || 1; + } + + if (initScale * ev.scale > 0.4) { + transform.scale = initScale * ev.scale; + } + + updateTransformation(); + }, + onAdd: function (map) { map.on('window', this._onDialogMsg, this); map.on('windowpaint', this._onDialogPaint, this); @@ -271,6 +323,7 @@ L.Control.LokDialog = L.Control.extend({ var dialogContainer = L.DomUtil.create('div', 'lokdialog', document.body); L.DomUtil.setStyle(dialogContainer, 'padding', '0px'); L.DomUtil.setStyle(dialogContainer, 'margin', '0px'); + L.DomUtil.setStyle(dialogContainer, 'touch-action', 'manipulate'); var strId = this._toStrId(id); dialogContainer.id = strId; @@ -374,6 +427,25 @@ L.Control.LokDialog = L.Control.extend({ L.DomEvent.on(dlgInput, 'contextmenu', function() { return false; }); + + // Zooming dialogs + zoomTarget = $('.ui-dialog').get(0); + + if (hammer === null) { + hammer = new Hammer(canvas); + } + + hammer.add(new Hammer.Pan({ threshold: 0, pointers: 0 })); + hammer.add(new Hammer.Pinch({ threshold: 0 })).recognizeWith([hammer.get('pan')]); + + hammer.on('panstart panmove', this.onPan); + hammer.on('pinchstart pinchmove', this.onPinch); + hammer.on('hammer.input', function(ev) { + if (ev.isFinal) { + startX = transform.translate.x; + startY = transform.translate.y; + } + }); }, _postWindowCompositionEvent: function(winid, type, text) { @@ -398,6 +470,20 @@ L.Control.LokDialog = L.Control.extend({ this._map.focus(); delete this._dialogs[dialogId]; this._currentId = null; + + startX = 0; + startY = 0; + hammer = null; + zoomTarget = null; + initScale = 1; + transform = { + translate: { x: 0, y: 0 }, + scale: 1, + angle: 0, + rx: 0, + ry: 0, + rz: 0 + }; }, onCloseCurrentPopUp: function() { commit ef52ba01a418f5f534d92c90c3d9e0142418ff44 Author: Henry Castro <hcas...@collabora.com> AuthorDate: Thu Nov 29 09:44:16 2018 -0400 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Fri Dec 7 12:39:28 2018 +0100 loleaflet: set opacity 0.5 to a group element Change-Id: I2f3e7f275e0b217041fd2e4c83a1360cdced738a diff --git a/loleaflet/src/layer/vector/SVGGroup.js b/loleaflet/src/layer/vector/SVGGroup.js index 35d710a0d..b84510cce 100644 --- a/loleaflet/src/layer/vector/SVGGroup.js +++ b/loleaflet/src/layer/vector/SVGGroup.js @@ -58,6 +58,7 @@ L.SVGGroup = L.Layer.extend({ if (this._path && this._rect._path) { this._rect._map = this._map; this._rect._renderer = this._renderer; + L.DomUtil.addClass(this._path, 'leaflet-control-buttons-disabled'); this._path.appendChild(this._rect._path); this.addInteractiveTarget(this._rect._path); } commit d2a4e1677fd5bbedfb1bca095248fca52518b47d Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Wed Nov 28 12:02:02 2018 +0100 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Fri Dec 7 12:39:28 2018 +0100 Introduced tablet mode * by reducing small device screen size limit to 767px tablets like iPad are not switched to the simple ui * tablet is a mobile device without simple ui * created global methods to detect ui mode window.mode.isTablet() / isMobile() / isDesktop() * menubar / toolbar items can have 'tablet' property * modification indicator is hidden in the tablet mode to allow layout menubar correctly in the vertical mode * tablet mode has the menubar folded by default and hamburger menu icon to unfold it * menubar hidden by default needed fix for calc due to additional row with formulas Change-Id: I0d89427f6bfde015c645c597cb741c69b9031178 diff --git a/loleaflet/css/leaflet.css b/loleaflet/css/leaflet.css index d6f07b45f..be390cc27 100644 --- a/loleaflet/css/leaflet.css +++ b/loleaflet/css/leaflet.css @@ -788,7 +788,7 @@ input.clipboard { } } -@media (max-width: 768px),(max-device-height: 768px) { +@media (max-width: 767px),(max-device-height: 767px) { .loleaflet-ruler { height: 0px; display: none; diff --git a/loleaflet/css/loleaflet.css b/loleaflet/css/loleaflet.css index d2312eea0..24ccee0cb 100644 --- a/loleaflet/css/loleaflet.css +++ b/loleaflet/css/loleaflet.css @@ -79,7 +79,7 @@ body { width: 0; } -@media (max-width: 768px),(max-device-height: 768px) { +@media (max-width: 767px),(max-device-height: 767px) { /* Show slidesorter beyond 768px only */ #presentation-controls-wrapper { display: none; diff --git a/loleaflet/css/toolbar.css b/loleaflet/css/toolbar.css index 77c48dc0c..54c0c4803 100644 --- a/loleaflet/css/toolbar.css +++ b/loleaflet/css/toolbar.css @@ -566,6 +566,7 @@ button.leaflet-control-search-next .w2ui-icon.edit{ background: url('images/lc_editdoc.svg') no-repeat center !important; } .w2ui-icon.fold{ background: url('images/fold.svg') no-repeat center !important; } .w2ui-icon.unfold{ background: url('images/unfold.svg') no-repeat center !important; } +.w2ui-icon.hamburger{ background: url('images/hamburger.svg') no-repeat center !important; } .w2ui-icon.setborderstyle{ background: url('images/lc_setborderstyle.svg') no-repeat center !important; } .w2ui-icon.togglemergecells{ background: url('images/lc_togglemergecells.svg') no-repeat center !important; } .w2ui-icon.wraptext{ background: url('images/lc_wraptext.svg') no-repeat center !important; } diff --git a/loleaflet/images/hamburger.svg b/loleaflet/images/hamburger.svg new file mode 100644 index 000000000..599c13250 --- /dev/null +++ b/loleaflet/images/hamburger.svg @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="16" + height="16" + viewBox="0 0 16 16" + id="svg2" + version="1.1" + inkscape:version="0.91 r13725" + sodipodi:docname="hamburger.svg"> + <defs + id="defs4" /> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="11.2" + inkscape:cx="8.3448691" + inkscape:cy="3.9243277" + inkscape:document-units="px" + inkscape:current-layer="layer1" + showgrid="false" + units="px" + inkscape:window-width="1920" + inkscape:window-height="1013" + inkscape:window-x="0" + inkscape:window-y="30" + inkscape:window-maximized="1" /> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(0,-1036.3622)"> + <g + id="g4200" + transform="matrix(1.1671511,0,0,1.1671511,-83.474328,423.38914)"> + <rect + y="528.16132" + x="73.430588" + height="0.052888747" + width="9.9650106" + id="rect4166" + style="fill:#333333;fill-opacity:1;stroke:#333333;stroke-width:2.21024585;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + <rect + y="532.10724" + x="73.430588" + height="0.052888747" + width="9.9650106" + id="rect4166-9" + style="fill:#333333;fill-opacity:1;stroke:#333333;stroke-width:2.21024585;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + <rect + y="536.08466" + x="73.430595" + height="0.052888747" + width="9.9650106" + id="rect4166-9-0" + style="fill:#333333;fill-opacity:1;stroke:#333333;stroke-width:2.21024585;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + </g> + </g> +</svg> diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js index b2253fb06..86a75b15d 100644 --- a/loleaflet/js/toolbar.js +++ b/loleaflet/js/toolbar.js @@ -9,16 +9,33 @@ var map; -function _useSimpleUI() { +// has to match small screen size requirement +function _inMobileMode() { return L.Browser.mobile && $('#main-menu').css('display') === 'none'; } +// mobile device with big screen size +function _inTabletMode() { + return L.Browser.mobile && !_inMobileMode(); +} + +function _inDesktopMode() { + return !L.Browser.mobile; +} + function onDelete(e) { if (e !== false) { map.deletePage(); } } +// make functions visible outside: window.mode.isMobile() +global.mode = { + isMobile: _inMobileMode, + isTablet: _inTabletMode, + isDesktop: _inDesktopMode +}; + var nUsers, oneUser, noUser; function _mobilify() { @@ -37,6 +54,43 @@ function _mobilify() { statusbar.hide(item.id); } }); + + if (_inTabletMode()) { + toolbarUp.items.forEach(function(item) { + if (item.tablet === false && !item.hidden) { + toolbarUp.hide(item.id); + } + else if (item.tablet === true && item.hidden) { + toolbarUp.show(item.id); + } + }); + + statusbar.items.forEach(function(item) { + if (item.tablet === false && !item.hidden) { + statusbar.hide(item.id); + } + else if (item.tablet === true && item.hidden) { + statusbar.show(item.id); + } + }); + } +} + +function _prepareDesktop() { + var toolbarUp = w2ui['toolbar-up']; + var statusbar = w2ui['toolbar-down']; + + toolbarUp.items.forEach(function(item) { + if (item.desktop === false && !item.hidden) { + toolbarUp.hide(item.id); + } + }); + + statusbar.items.forEach(function(item) { + if (item.desktop === false && !item.hidden) { + statusbar.hide(item.id); + } + }); } function resizeToolbar() { @@ -249,7 +303,7 @@ function onClick(e, id, item, subItem) { map.sendUnoCommand('.uno:StatusBarFunc', command); }); } - else if (id === 'fold') { + else if (id === 'fold' || id === 'hamburger-tablet') { map.toggleMenubar(); } else if (id === 'fullscreen') { @@ -262,6 +316,7 @@ function onClick(e, id, item, subItem) { L.toggleFullScreen(); } else if (id === 'close' || id === 'closemobile') { + map.fire('postMessage', {msgId: 'close', args: {EverModified: map._everModified, Deprecated: true}}); map.fire('postMessage', {msgId: 'UI_Close', args: {EverModified: map._everModified}}); map.remove(); } @@ -634,6 +689,7 @@ var fontsizesSelectValue; function createToolbar() { var toolItems = [ + {type: 'button', id: 'closemobile', img: 'closemobile', desktop: false, mobile: false, tablet: true}, {type: 'button', id: 'save', img: 'save', hint: _UNO('.uno:Save')}, {type: 'button', id: 'print', img: 'print', hint: _UNO('.uno:Print', 'text'), mobile: false}, {type: 'break', id: 'savebreak', mobile: false}, @@ -776,10 +832,11 @@ function createToolbar() { {type: 'button', id: 'specialcharacter', img: 'specialcharacter', hint: _UNO('.uno:InsertSymbol', '', true), uno: '.uno:InsertSymbol'}, {type: 'spacer'}, {type: 'button', id: 'edit', img: 'edit'}, - {type: 'button', id: 'fold', img: 'fold', mobile: false} + {type: 'button', id: 'fold', img: 'fold', mobile: false}, + {type: 'button', id: 'hamburger-tablet', img: 'hamburger', desktop: false, mobile: false, tablet: true} ]; - if (_useSimpleUI()) { + if (_inMobileMode()) { initMobileToolbar(toolItems); } else { initNormalToolbar(toolItems); @@ -1515,7 +1572,7 @@ function onDocLayerInit() { ] }); - if (!_useSimpleUI()) { + if (!_inMobileMode()) { statusbar.insert('left', [ {type: 'break', id:'break1'}, {type: 'html', id: 'StatusDocPos', @@ -1556,7 +1613,7 @@ function onDocLayerInit() { 'breakspacing', 'defaultbullet', 'defaultnumbering', 'breakbullet', 'incrementindent', 'decrementindent', 'breakindent', 'inserttable', 'insertannotation'); - if (!_useSimpleUI()) { + if (!_inMobileMode()) { statusbar.insert('left', [ {type: 'break', id: 'break1'}, {type: 'html', id: 'StatePageNumber', @@ -1582,7 +1639,7 @@ function onDocLayerInit() { if (!map['wopi'].HideExportOption) { presentationToolbar.show('presentation', 'presentationbreak'); } - if (!_useSimpleUI()) { + if (!_inMobileMode()) { statusbar.insert('left', [ {type: 'break', id: 'break1'}, { @@ -1620,11 +1677,38 @@ function onDocLayerInit() { oneUser = _('1 user'); noUser = _('0 users'); $('#document-name-input').show(); + + if (_inDesktopMode()) { + _prepareDesktop(); + } } updateUserListCount(); toolbarUp.refresh(); statusbar.refresh(); + + if (window.mode.isTablet()) { + // calc tablet version needs one more row before folding the menu + if (window.mode.isTablet() && map._docLayer._docType == 'spreadsheet') { + var content = $('#document-container'); + if (content) { + var diff = 59; + var prevTop = content.css('top'); + if (prevTop) { + prevTop = parseInt(prevTop.slice(0, -2)) + diff; + } + else { + prevTop = 0 + diff; + } + content.css({'top': String(prevTop) + 'px'}); + } + } + + // Fold menubar by default + map.toggleMenubar(); + $('#tb_toolbar-up_item_fonts').css({'display': 'none'}); + $('#tb_toolbar-up_item_fontsizes').css({'display': 'none'}); + } } function onCommandStateChanged(e) { @@ -1820,7 +1904,7 @@ function onCommandStateChanged(e) { // If in non-edit mode, will be taken care of when permission is changed to 'edit' else if (map._permission === 'edit' && (state === 'enabled' || state === 'disabled')) { var toolbarUp = toolbar; - if (_useSimpleUI()) { + if (_inMobileMode()) { toolbarUp = statusbar; } if (state === 'enabled') { @@ -2238,17 +2322,14 @@ $(window).resize(function() { $(document).ready(function() { if (closebutton && !L.Browser.mobile) { $('#closebuttonwrapper').show(); - $('#closebutton').click(function() { - if (window.ThisIsAMobileApp) { - window.webkit.messageHandlers.lool.postMessage('BYE', '*'); - } else { - map.fire('postMessage', {msgId: 'close', args: {EverModified: map._everModified, Deprecated: true}}); - map.fire('postMessage', {msgId: 'UI_Close', args: {EverModified: map._everModified}}); - } - map.remove(); - }); } + $('#closebutton').click(function() { + map.fire('postMessage', {msgId: 'close', args: {EverModified: map._everModified, Deprecated: true}}); + map.fire('postMessage', {msgId: 'UI_Close', args: {EverModified: map._everModified}}); + map.remove(); + }); + // Attach insert file action $('#insertgraphic').on('change', onInsertFile); }); diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js index 1a05f1d49..8f8527ced 100644 --- a/loleaflet/src/control/Control.Menubar.js +++ b/loleaflet/src/control/Control.Menubar.js @@ -224,7 +224,7 @@ L.Control.Menubar = L.Control.extend({ {name: _('Keyboard shortcuts'), id: 'keyboard-shortcuts', type: 'action'}, {name: _('About'), id: 'about', type: 'action'}] }, - {name: _('Last modification'), id: 'last-mod', type: 'action'} + {name: _('Last modification'), id: 'last-mod', type: 'action', mobile: false, tablet: false} ], presentation: [ @@ -303,7 +303,7 @@ L.Control.Menubar = L.Control.extend({ {name: _('Keyboard shortcuts'), id: 'keyboard-shortcuts', type: 'action'}, {name: _('About'), id: 'about', type: 'action'}] }, - {name: _('Last modification'), id: 'last-mod', type: 'action'} + {name: _('Last modification'), id: 'last-mod', type: 'action', mobile: false, tablet: false} ], spreadsheet: [ @@ -397,7 +397,7 @@ L.Control.Menubar = L.Control.extend({ {name: _('Keyboard shortcuts'), id: 'keyboard-shortcuts', type: 'action'}, {name: _('About'), id: 'about', type: 'action'}] }, - {name: _('Last modification'), id: 'last-mod', type: 'action'} + {name: _('Last modification'), id: 'last-mod', type: 'action', mobile: false, tablet: false} ], commandStates: {}, @@ -911,6 +911,14 @@ L.Control.Menubar = L.Control.extend({ $(aItem).data('id', menu[i].id); } + if (menu[i].tablet == false && window.mode.isTablet()) { + $(aItem).css('display', 'none'); + } + + if (menu[i].mobile == false && window.mode.isMobile()) { + $(aItem).css('display', 'none'); + } + itemList.push(liItem); } diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js index 72a90a920..422677cb4 100644 --- a/loleaflet/src/map/Map.js +++ b/loleaflet/src/map/Map.js @@ -6,7 +6,12 @@ function moveObjectVertically(obj, diff) { if (obj) { var prevTop = obj.css('top'); - prevTop = parseInt(prevTop.slice(0, -2)) + diff; + if (prevTop) { + prevTop = parseInt(prevTop.slice(0, -2)) + diff; + } + else { + prevTop = 0 + diff; + } obj.css({'top': String(prevTop) + 'px'}); } } @@ -1392,7 +1397,7 @@ L.Map = L.Evented.extend({ var obj = null; if ($('.main-nav').css('display') === 'none') { $('.main-nav').css({'display': ''}); - if (closebutton) { + if (closebutton && !window.mode.isTablet()) { $('#closebuttonwrapper').css({'display': ''}); } commit 5822737a846edb475ed75a70b78f05f37d32e30e Author: Henry Castro <hcas...@collabora.com> AuthorDate: Wed Nov 28 16:14:36 2018 -0400 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Fri Dec 7 12:39:28 2018 +0100 loleaflet: remove the bounding rectangle when the hook is removed Change-Id: I9475c2297882fb848010996087374af5dde3d214 diff --git a/loleaflet/plugins/path-transform/src/Path.Transform.js b/loleaflet/plugins/path-transform/src/Path.Transform.js index 6d3166e5b..97ea5fdd0 100644 --- a/loleaflet/plugins/path-transform/src/Path.Transform.js +++ b/loleaflet/plugins/path-transform/src/Path.Transform.js @@ -165,6 +165,11 @@ L.Handler.PathTransform = L.Handler.extend({ .off('dragstart', this._onDragStart, this) .off('drag', this._onDrag, this) .off('dragend', this._onDragEnd, this); + + if (this._map.hasLayer(this._rect)) { + this._map.removeLayer(this._rect); + } + this._handlersGroup = null; this._rect = null; this._handlers = []; commit 1c191865ec9d3b61626dc2808a7ba435339cabfc Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Wed Nov 28 20:34:51 2018 +0100 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Fri Dec 7 12:39:28 2018 +0100 More modern look of the user list Change-Id: Ie23b0b214992c5d8425ee86eb6e5897f680b65bd diff --git a/loleaflet/css/toolbar.css b/loleaflet/css/toolbar.css index 35531149c..77c48dc0c 100644 --- a/loleaflet/css/toolbar.css +++ b/loleaflet/css/toolbar.css @@ -727,6 +727,10 @@ tr.useritem-avatar > td { padding: 7px; } +tr.useritem-avatar > td > img { + border-radius: 100px; +} + tr.useritem-avatar > td.usercolor { display: inline-block; top: 0px; diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js index d305c66fa..b2253fb06 100644 --- a/loleaflet/js/toolbar.js +++ b/loleaflet/js/toolbar.js @@ -2158,9 +2158,9 @@ function getUserItem(viewId, userName, extraInfo, color) { } var html = '<tr class="' + className + '" id="user-' + viewId + '" onclick="onUseritemClicked(event)">' + - '<td class=usercolor style="background-color: ' + color +';">'; + '<td class=usercolor>'; if (extraInfo !== undefined && extraInfo.avatar !== undefined) { - html += '<img src="' + extraInfo.avatar + '" width="32" height="32" />'; + html += '<img src="' + extraInfo.avatar + '" width="32" height="32" style="border: 5px solid ' + color + ';" />'; } // TODO: Add mail and other links as sub-menu. commit 7831995ca72eb6a745d3b9e11d29971a55269287 Author: Henry Castro <hcas...@collabora.com> AuthorDate: Wed Nov 28 15:23:04 2018 -0400 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Fri Dec 7 12:39:28 2018 +0100 loleaflet: ensure to remove listeners when the hook is removed Change-Id: If6c1044ee95957c1e58c6a5d2d835b25f9a4443e diff --git a/loleaflet/plugins/path-transform/src/Path.Drag.js b/loleaflet/plugins/path-transform/src/Path.Drag.js index 3fd24977f..be74e555c 100644 --- a/loleaflet/plugins/path-transform/src/Path.Drag.js +++ b/loleaflet/plugins/path-transform/src/Path.Drag.js @@ -88,6 +88,9 @@ L.Handler.PathDrag = L.Handler.extend(/** @lends L.Path.Drag.prototype */ { if (this._path._path) { L.DomUtil.removeClass(this._path._path, L.Handler.PathDrag.DRAGGING_CLS); } + + L.DomEvent.off(document, 'mousemove touchmove', this._onDrag, this); + L.DomEvent.off(document, 'mouseup touchend', this._onDragEnd, this); }, /** commit bdf5aa187a703c81b169111582847e5062a6d955 Author: Henry Castro <hcas...@collabora.com> AuthorDate: Wed Nov 28 14:06:35 2018 -0400 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Fri Dec 7 12:39:28 2018 +0100 loleaflet: set no mouse interactive to the bounding rectangle Change-Id: Ifbc67bd6c144ec45a3cb4effa67f24f90486d97b diff --git a/loleaflet/plugins/path-transform/src/Path.Transform.js b/loleaflet/plugins/path-transform/src/Path.Transform.js index 9fc7be7d0..6d3166e5b 100644 --- a/loleaflet/plugins/path-transform/src/Path.Transform.js +++ b/loleaflet/plugins/path-transform/src/Path.Transform.js @@ -68,6 +68,7 @@ L.Handler.PathTransform = L.Handler.extend({ boundsOptions: { weight: 1, opacity: 1, + interactive: false, dashArray: [3, 3], fill: false }, commit 7aa417d0dfdaee83c1e3e79f7a9a930d793d0f39 Author: Henry Castro <hcas...@collabora.com> AuthorDate: Wed Nov 28 12:31:43 2018 -0400 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Fri Dec 7 12:39:28 2018 +0100 loleaflet: set no clipping for L.SVGGroup Change-Id: I1565e6643bdf97de692cfe3a0da36918dd21a05a diff --git a/loleaflet/src/layer/vector/SVGGroup.js b/loleaflet/src/layer/vector/SVGGroup.js index c9ade53ad..35d710a0d 100644 --- a/loleaflet/src/layer/vector/SVGGroup.js +++ b/loleaflet/src/layer/vector/SVGGroup.js @@ -5,10 +5,14 @@ L.SVGGroup = L.Layer.extend({ + options: { + noClip: true + }, + initialize: function (bounds, options) { L.setOptions(this, options); this._bounds = bounds; - this._rect = L.rectangle(bounds, options); + this._rect = L.rectangle(bounds, this.options); }, addEmbeddedSVG: function (svgString) { @@ -97,7 +101,6 @@ L.SVGGroup = L.Layer.extend({ _update: function () { this._rect.setBounds(this._bounds); - this._rect._reset(); if (this._svg) { var point = this._map.latLngToLayerPoint(this._bounds.getNorthWest()); this._svg.setAttribute('x', point.x); commit 1fcf34ecf54b95fceed2bf88e42987a402ea1e45 Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Tue Nov 27 18:35:29 2018 +0100 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Fri Dec 7 12:39:28 2018 +0100 Make the presentation toolbar completely hidden Change-Id: I7f70fbc86f6e38f952c65d14e43da6ac45e25bb9 diff --git a/loleaflet/html/loleaflet.html.m4 b/loleaflet/html/loleaflet.html.m4 index fe19fb636..ffcb61ae0 100644 --- a/loleaflet/html/loleaflet.html.m4 +++ b/loleaflet/html/loleaflet.html.m4 @@ -129,7 +129,7 @@ ifelse(MOBILEAPP,[true], <div id="presentation-controls-wrapper"> <div id="slide-sorter"></div> - <div id="presentation-toolbar"></div> + <div id="presentation-toolbar" style="display: none"></div> </div> <div id="toolbar-down"></div> commit 51a51bf8c398be0ad3890a1ad813f60ef5080e7f Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Tue Nov 27 14:48:30 2018 +0100 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Fri Dec 7 12:39:28 2018 +0100 Fix close button on mobile Change-Id: I87e08454e81c7198a52151af831d0be1d97022e0 diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js index 45a373fa2..d305c66fa 100644 --- a/loleaflet/js/toolbar.js +++ b/loleaflet/js/toolbar.js @@ -261,7 +261,7 @@ function onClick(e, id, item, subItem) { } L.toggleFullScreen(); } - else if (id === 'close') { + else if (id === 'close' || id === 'closemobile') { map.fire('postMessage', {msgId: 'UI_Close', args: {EverModified: map._everModified}}); map.remove(); } @@ -792,7 +792,7 @@ function initMobileToolbar(toolItems) { name: 'toolbar-down', tooltip: 'bottom', items: [ - {type: 'button', id: 'close', img: 'closemobile'}, + {type: 'button', id: 'closemobile', img: 'closemobile'}, {type: 'spacer'}, {type: 'button', id: 'undo', img: 'undo', hint: _UNO('.uno:Undo'), uno: 'Undo', disabled: true}, {type: 'button', id: 'redo', img: 'redo', hint: _UNO('.uno:Redo'), uno: 'Redo', disabled: true}, @@ -2236,9 +2236,8 @@ $(window).resize(function() { }); $(document).ready(function() { - if (!closebutton) { - $('#closebuttonwrapper').hide(); - } else { + if (closebutton && !L.Browser.mobile) { + $('#closebuttonwrapper').show(); $('#closebutton').click(function() { if (window.ThisIsAMobileApp) { window.webkit.messageHandlers.lool.postMessage('BYE', '*'); commit a3b723b2ec6e43c37a842ce37cfdb49ce5bbcaf1 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Tue Nov 27 14:11:03 2018 +0100 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Fri Dec 7 12:39:28 2018 +0100 Make popups look more unified Change-Id: Idd40ca937f18592ea2c17f9db91f1871a51c7db6 diff --git a/loleaflet/css/w2ui-1.5.rc1.css b/loleaflet/css/w2ui-1.5.rc1.css index 946889778..3bc652c8c 100644 --- a/loleaflet/css/w2ui-1.5.rc1.css +++ b/loleaflet/css/w2ui-1.5.rc1.css @@ -312,7 +312,7 @@ input[type=checkbox].w2ui-toggle:focus { .w2ui-overlay > div { border-radius: 4px; position: relative; - border: 3px solid #777777; + border: 1px solid #bbbbbb; } .w2ui-overlay table td { color: inherit; @@ -330,26 +330,26 @@ input[type=checkbox].w2ui-toggle:focus { left: 4px; } .w2ui-overlay.top-arrow:before { - border-bottom: 12px solid #6f6f6f; + border-bottom: 6px solid #bbbbbb; border-right: 12px solid transparent; border-left: 12px solid transparent; bottom: 100%; - margin-bottom: -3px; + margin-bottom: -1px; } .w2ui-overlay.top-arrow:after { - border-bottom: 8px solid #000000; + border-bottom: 6px solid #000000; border-bottom-color: inherit; border-right: 8px solid transparent; border-left: 8px solid transparent; bottom: 100%; - margin-bottom: -3px; + margin-bottom: -1px; } .w2ui-overlay.bottom-arrow:before { - border-top: 12px solid #6f6f6f; + border-top: 6px solid #bbbbbb; border-right: 12px solid transparent; border-left: 12px solid transparent; top: 100%; - margin-top: -3px; + margin-bottom: -1px; } .w2ui-overlay.bottom-arrow:after { border-top: 8px solid #000000; commit 650f91de1f9ade7d534bcc932f94f157cc241b15 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Tue Nov 27 14:10:32 2018 +0100 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Fri Dec 7 12:39:28 2018 +0100 Remove shadow under ruler Change-Id: I8b67ec54780931a18aa3a4aecb9287dd6848ba9b diff --git a/loleaflet/css/leaflet.css b/loleaflet/css/leaflet.css index c9739b2e6..d6f07b45f 100644 --- a/loleaflet/css/leaflet.css +++ b/loleaflet/css/leaflet.css @@ -234,11 +234,10 @@ /* general toolbar styles */ .leaflet-bar { - box-shadow: 0 1px 5px rgba(0,0,0,0.65); - border-radius: 4px; display: inline-block; margin: 3px; vertical-align: middle; + border-bottom: solid 1px #bbbbbb; } .leaflet-bar a, .leaflet-bar a:hover { commit b15c81087d5975a2cdc17c6bdf1f30efaf6645cd Author: Jan Holesovsky <ke...@collabora.com> AuthorDate: Tue Nov 27 14:54:51 2018 +0100 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Fri Dec 7 12:39:28 2018 +0100 toolbar: Make the spreadsheet toolbars completely hidden (Writer, Impress). Change-Id: I5ee3955d3cc4883153b9811b05e61d3c78dd8884 diff --git a/loleaflet/html/loleaflet.html.m4 b/loleaflet/html/loleaflet.html.m4 index ee5020ca7..fe19fb636 100644 --- a/loleaflet/html/loleaflet.html.m4 +++ b/loleaflet/html/loleaflet.html.m4 @@ -124,7 +124,8 @@ ifelse(MOBILEAPP,[true], <div id="document-container"> <div id="map"></div> </div> - <div id="spreadsheet-toolbar"></div> + + <div id="spreadsheet-toolbar" style="display: none"></div> <div id="presentation-controls-wrapper"> <div id="slide-sorter"></div> commit afa3012022ff564102d255cac67063ad01d93fc6 Author: Jan Holesovsky <ke...@collabora.com> AuthorDate: Tue Nov 27 14:16:06 2018 +0100 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Fri Dec 7 12:39:28 2018 +0100 toolbar: This delimiter should start in hidden state. Otherwise we start with 2 delimiters next to each other, which looks strange. Change-Id: I51dd5f39aee59275fc8255231df50a84e0e873c9 diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js index 1ee0affc4..45a373fa2 100644 --- a/loleaflet/js/toolbar.js +++ b/loleaflet/js/toolbar.js @@ -737,7 +737,7 @@ function createToolbar() { {id: 'paraspacedecrease', text: _UNO('.uno:ParaspaceDecrease'), uno: 'ParaspaceDecrease'} ]}, {type: 'button', id: 'wraptext', img: 'wraptext', hint: _UNO('.uno:WrapText', 'spreadsheet', true), hidden: true, uno: 'WrapText', disabled: true}, - {type: 'break', id: 'breakspacing'}, + {type: 'break', id: 'breakspacing', hidden: true}, {type: 'button', id: 'defaultnumbering', img: 'numbering', hint: _UNO('.uno:DefaultNumbering', '', true), hidden: true, uno: 'DefaultNumbering', disabled: true}, {type: 'button', id: 'defaultbullet', img: 'bullet', hint: _UNO('.uno:DefaultBullet', '', true), hidden: true, uno: 'DefaultBullet', disabled: true}, {type: 'break', id: 'breakbullet', hidden: true}, @@ -1503,7 +1503,7 @@ function onDocLayerInit() { switch (docType) { case 'spreadsheet': - toolbarUp.show('textalign', 'wraptext', 'insertannotation', 'numberformatcurrency', 'numberformatpercent', + toolbarUp.show('textalign', 'wraptext', 'breakspacing', 'insertannotation', 'numberformatcurrency', 'numberformatpercent', 'numberformatincdecimals', 'numberformatdecdecimals', 'insertobjectchart', 'sum', 'break-number', 'setborderstyle'); statusbar.remove('prev', 'next', 'prevnextbreak'); @@ -1553,7 +1553,7 @@ function onDocLayerInit() { break; case 'text': toolbarUp.show('styles', 'leftpara', 'centerpara', 'rightpara', 'justifypara', 'breakpara', 'linespacing', - 'defaultbullet', 'defaultnumbering', 'breakbullet', 'incrementindent', 'decrementindent', + 'breakspacing', 'defaultbullet', 'defaultnumbering', 'breakbullet', 'incrementindent', 'decrementindent', 'breakindent', 'inserttable', 'insertannotation'); if (!_useSimpleUI()) { @@ -1599,7 +1599,7 @@ function onDocLayerInit() { // FALLTHROUGH intended case 'drawing': toolbarUp.show('styles', 'leftpara', 'centerpara', 'rightpara', 'justifypara', 'breakpara', 'linespacing', - 'defaultbullet', 'defaultnumbering', 'breakbullet', 'inserttable'); + 'breakspacing', 'defaultbullet', 'defaultnumbering', 'breakbullet', 'inserttable'); $('#presentation-toolbar').show(); break; commit c8999fa33e9c2e63e3f43bf5d89fb57b97b0623a Author: Jan Holesovsky <ke...@collabora.com> AuthorDate: Tue Nov 27 14:02:31 2018 +0100 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Fri Dec 7 12:39:28 2018 +0100 toolbar: No need to start Bold / Italic / ... in the disabled state. Change-Id: I2d3d5d93ecbaa902f82236836f58cde09033c83f ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits