loleaflet/Makefile.am | 1 loleaflet/build/deps.js | 3 loleaflet/src/control/Control.ContextMenu.js | 19 +++- loleaflet/src/control/Control.LanguageDialog.js | 106 ++++++++++++++++++++++++ loleaflet/src/control/Control.Toolbar.js | 19 +++- loleaflet/src/layer/marker/Annotation.js | 3 loleaflet/src/layer/tile/CalcTileLayer.js | 33 +++++++ loleaflet/src/layer/tile/ImpressTileLayer.js | 2 loleaflet/src/main.js | 1 loleaflet/src/unocommands.js | 3 10 files changed, 183 insertions(+), 7 deletions(-)
New commits: commit 2017b7284bbc487f489bfb6374876096537f5c17 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Fri Jul 26 10:55:56 2019 +0200 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Sun Nov 3 18:27:59 2019 +0100 Show comments after scrolling down Added view scroll after user clicks "V" button to scroll comments down in impress. Change-Id: Icb41a14fa5c7154e2f09bfc71473f623f2518464 diff --git a/loleaflet/src/layer/tile/ImpressTileLayer.js b/loleaflet/src/layer/tile/ImpressTileLayer.js index bf702925a..350084c1d 100644 --- a/loleaflet/src/layer/tile/ImpressTileLayer.js +++ b/loleaflet/src/layer/tile/ImpressTileLayer.js @@ -391,6 +391,8 @@ L.ImpressTileLayer = L.TileLayer.extend({ onAnnotationScrollDown: function () { this._topAnnotation[this._selectedPart] = Math.min(++this._topAnnotation[this._selectedPart], this._annotations[this._partHashes[this._selectedPart]].length - 1); this.onAnnotationCancel(); + var topRight = this._map.latLngToLayerPoint(this._map.options.docBounds.getNorthEast()); + this._map.fire('scrollby', {x: topRight.x, y: 0}); }, onAnnotationScrollUp: function () { commit 777c8b0324cf2178c5a897d4caa605c3b87f9c7f Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Thu Jul 25 09:11:32 2019 +0200 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Sun Nov 3 18:11:46 2019 +0100 Show code in language indicator Fixes detection of a current code Change-Id: I30f0caa6b33c78ef6ab6766d07c1ec34090b12ac diff --git a/loleaflet/src/control/Control.LanguageDialog.js b/loleaflet/src/control/Control.LanguageDialog.js index c31ad2556..aaf81628d 100644 --- a/loleaflet/src/control/Control.LanguageDialog.js +++ b/loleaflet/src/control/Control.LanguageDialog.js @@ -40,16 +40,22 @@ L.Control.LanguageDialog = L.Control.extend({ vex.closeAll(); }, - _getSelectedLanguage: function() { + _getSelectedLanguageCode: function() { var constState = 'stateChangeHandler'; var languageAndCode = this._map[constState].getItemValue('.uno:LanguageStatus'); - var language = languageAndCode.split(';')[0]; - return language; + var split = languageAndCode.split(';'); + var code = '-'; + if (split.length > 1) + code = split[1]; + else + console.error('Language code not found'); + return code; }, _addItem: function(parent, language) { - var selectedLanguage = this._getSelectedLanguage(); + var selectedLanguageCode = this._getSelectedLanguageCode(); var neutralLanguage = 'LANGUAGE_NONE'; + var code = ''; var tr = L.DomUtil.create('tr', '', parent); var td = L.DomUtil.create('td', '', tr); @@ -57,13 +63,14 @@ L.Control.LanguageDialog = L.Control.extend({ if (language) { neutralLanguage = language.neutral; + code = language.iso; a.innerHTML = language.iso; } else { a.innerHTML = _('None (Do not check spelling)'); } - if (neutralLanguage.indexOf(selectedLanguage) !== -1 - || (selectedLanguage == '[None]' && !language)) { + if ((selectedLanguageCode != '-' && code.indexOf(selectedLanguageCode) !== -1) + || (selectedLanguageCode == '-' && !language)) { $(a).addClass('highlighted'); } else { $(a).removeClass('highlighted'); commit 985e68aa86db3370940a00b44b18b81bd9052339 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Thu Jul 25 08:39:15 2019 +0200 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Sun Nov 3 18:11:37 2019 +0100 Show iso codes in dialog Solves missing translations for languages. Change-Id: If4c7d994b1927c80a374e4f85f1797b9c8cb472f diff --git a/loleaflet/src/control/Control.LanguageDialog.js b/loleaflet/src/control/Control.LanguageDialog.js index 43b3f909e..c31ad2556 100644 --- a/loleaflet/src/control/Control.LanguageDialog.js +++ b/loleaflet/src/control/Control.LanguageDialog.js @@ -57,7 +57,7 @@ L.Control.LanguageDialog = L.Control.extend({ if (language) { neutralLanguage = language.neutral; - a.innerHTML = language.translated; + a.innerHTML = language.iso; } else { a.innerHTML = _('None (Do not check spelling)'); } commit 786709794de5c131f753f01ba2260b664761e006 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Wed Jul 24 15:59:45 2019 +0200 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Sun Nov 3 18:10:40 2019 +0100 Move language icon to the end of toolbar Change-Id: Ic10e9540d13b6be45acbb87e5ed4a447a617b922 diff --git a/loleaflet/src/control/Control.Toolbar.js b/loleaflet/src/control/Control.Toolbar.js index 2262197cf..bac3bab0a 100644 --- a/loleaflet/src/control/Control.Toolbar.js +++ b/loleaflet/src/control/Control.Toolbar.js @@ -891,7 +891,8 @@ function initNormalToolbar() { {type: 'button', id: 'sidebar', img: 'sidebar_modify_page', hint: _UNO('.uno:Sidebar', '', true), uno: '.uno:Sidebar', hidden: true}, {type: 'break', id: 'breaksidebar', hidden: true}, {type: 'button', id: 'fold', img: 'fold', desktop: true, mobile: false, hidden: true}, - {type: 'button', id: 'hamburger-tablet', img: 'hamburger', desktop: false, mobile: false, tablet: true, iosapptablet: false, hidden: true} + {type: 'button', id: 'hamburger-tablet', img: 'hamburger', desktop: false, mobile: false, tablet: true, iosapptablet: false, hidden: true}, + {type: 'button', id: 'languagecode', desktop: false, mobile: true, tablet: false} ]; var toolbar = $('#toolbar-up'); commit d3b92abd8e516f69b1ebab158ae9b49a39d39125 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Mon Jul 22 11:44:05 2019 +0200 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Sun Nov 3 18:00:22 2019 +0100 Mobile language indicator and dialog Change-Id: I2358ac60a3ba1a0f177e9fa3f965b7043ab99559 diff --git a/loleaflet/Makefile.am b/loleaflet/Makefile.am index 15760e5b4..5409d9edb 100644 --- a/loleaflet/Makefile.am +++ b/loleaflet/Makefile.am @@ -342,6 +342,7 @@ pot: src/control/Control.DownloadProgress.js \ src/control/ColorPicker.js \ src/control/Control.JSDialogBuilder.js \ + src/control/Control.LanguageDialog.js \ src/control/Control.Menubar.js \ src/control/Control.MobileWizard.js \ src/control/Control.Scroll.Annotation.js \ diff --git a/loleaflet/build/deps.js b/loleaflet/build/deps.js index d9bf83bf2..a0c6d64fa 100644 --- a/loleaflet/build/deps.js +++ b/loleaflet/build/deps.js @@ -391,7 +391,8 @@ var deps = { 'control/Control.Infobar.js', 'control/ColorPicker.js', 'control/Control.JSDialogBuilder.js', - 'control/Control.MobileWizard.js'], + 'control/Control.MobileWizard.js', + 'control/Control.LanguageDialog.js'], heading: 'Controls', desc: 'Handles vex dialogs for displaying alerts' }, diff --git a/loleaflet/src/control/Control.LanguageDialog.js b/loleaflet/src/control/Control.LanguageDialog.js new file mode 100644 index 000000000..43b3f909e --- /dev/null +++ b/loleaflet/src/control/Control.LanguageDialog.js @@ -0,0 +1,99 @@ +/* -*- js-indent-level: 8 -*- */ +/* + * L.Control.LanguageDialog used for spellchecking language selection on mobile devices + */ + +/* global _ $ vex */ +L.Control.LanguageDialog = L.Control.extend({ + + _languages: [], + + onAdd: function (map) { + map.on('commandvalues', this._onCommandValues, this); + map.on('languagedialog', this._onLanguageDialog, this); + }, + + _onCommandValues: function(e) { + if (e.commandName === '.uno:LanguageStatus' && L.Util.isArray(e.commandValues)) { + var languages = []; + + e.commandValues.forEach(function(language) { + var split = language.split(';'); + language = split[0]; + var isoCode = ''; + if (split.length > 1) + isoCode = split[1]; + languages.push({translated: _(language), neutral: language, iso: isoCode}); + }); + + languages.sort(function(a, b) { + return a.translated < b.translated ? -1 : a.translated > b.translated ? 1 : 0; + }); + + this._languages = languages; + } + }, + + _onItemSelected: function(e) { + var unoCommand = '.uno:LanguageStatus?Language:string=Default_' + e.data.language; + e.data.self._map.sendUnoCommand(unoCommand); + vex.closeAll(); + }, + + _getSelectedLanguage: function() { + var constState = 'stateChangeHandler'; + var languageAndCode = this._map[constState].getItemValue('.uno:LanguageStatus'); + var language = languageAndCode.split(';')[0]; + return language; + }, + + _addItem: function(parent, language) { + var selectedLanguage = this._getSelectedLanguage(); + var neutralLanguage = 'LANGUAGE_NONE'; + + var tr = L.DomUtil.create('tr', '', parent); + var td = L.DomUtil.create('td', '', tr); + var a = L.DomUtil.create('a', '', td); + + if (language) { + neutralLanguage = language.neutral; + a.innerHTML = language.translated; + } else { + a.innerHTML = _('None (Do not check spelling)'); + } + + if (neutralLanguage.indexOf(selectedLanguage) !== -1 + || (selectedLanguage == '[None]' && !language)) { + $(a).addClass('highlighted'); + } else { + $(a).removeClass('highlighted'); + } + + $(tr).on('click', {self: this, language: encodeURIComponent(neutralLanguage)}, this._onItemSelected); + }, + + _onLanguageDialog: function() { + var dialog = vex.dialog.open({ + message: '', + buttons: [ + $.extend({}, vex.dialog.buttons.NO, { text: _('Cancel') }) + ], + }); + + var div = L.DomUtil.create('div', ''); + var ul = L.DomUtil.create('table', 'lo-menu', div); + + // Add NONE + this._addItem(ul, null); + + for (var lang in this._languages) { + this._addItem(ul, this._languages[lang]); + } + + dialog.get(0).insertBefore(div, dialog.get(0).childNodes[0]); + } +}); + +L.control.languageDialog = function (options) { + return new L.Control.LanguageDialog(options); +}; diff --git a/loleaflet/src/control/Control.Toolbar.js b/loleaflet/src/control/Control.Toolbar.js index f49b3841e..2262197cf 100644 --- a/loleaflet/src/control/Control.Toolbar.js +++ b/loleaflet/src/control/Control.Toolbar.js @@ -362,6 +362,9 @@ function onClick(e, id, item, subItem) { else if (id === 'link') { map.showHyperlinkDialog(); } + else if (id === 'languagecode') { + map.fire('languagedialog'); + } else { map.handleSigningClickEvent(id, item); // this handles a bunch of signing bar click events } @@ -799,6 +802,7 @@ function initNormalToolbar() { } }, mobile: false}, {type: 'break', id: 'breakstyles', mobile: false, tablet: false }, + {type: 'button', id: 'languagecode', desktop: false, mobile: true, tablet: false}, {type: 'button', id: 'bold', img: 'bold', hint: _UNO('.uno:Bold'), uno: 'Bold'}, {type: 'button', id: 'italic', img: 'italic', hint: _UNO('.uno:Italic'), uno: 'Italic'}, {type: 'button', id: 'underline', img: 'underline', hint: _UNO('.uno:Underline'), uno: 'Underline'}, @@ -1734,7 +1738,17 @@ function onCommandStateChanged(e) { } } else if (commandName === '.uno:LanguageStatus') { - statusbar.set('LanguageStatus', {text: _(state), selected: state}); + var code = state; + var language = _(state); + + var split = code.split(';'); + if (split.length > 1) { + language = _(split[0]); + code = split[1]; + } + + updateToolbarItem(statusbar, 'LanguageStatus', $('#LanguageStatus').html(language).parent().html()); + w2ui['editbar'].set('languagecode', {text: code}); } else if (commandName === '.uno:ModifiedStatus') { if (e.state === 'true') { diff --git a/loleaflet/src/main.js b/loleaflet/src/main.js index 7c9d7e944..0a66fe684 100644 --- a/loleaflet/src/main.js +++ b/loleaflet/src/main.js @@ -87,6 +87,7 @@ setupToolbar(map); map.addControl(L.control.scroll()); map.addControl(L.control.alertDialog()); map.addControl(L.control.mobileWizard()); +map.addControl(L.control.languageDialog()); map.dialog = L.control.lokDialog(); map.addControl(map.dialog); map.addControl(L.control.contextMenu()); commit fd787b7a51b12b034bea85ae29623deac272b8d5 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Thu Jul 18 10:30:18 2019 +0200 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Sun Nov 3 17:50:02 2019 +0100 Add HideNote item to the Calc context menu Change-Id: I0dade45c8bc3e5b22d092429f14482f07d00920c diff --git a/loleaflet/src/control/Control.ContextMenu.js b/loleaflet/src/control/Control.ContextMenu.js index 08990fb24..bd5e3c400 100644 --- a/loleaflet/src/control/Control.ContextMenu.js +++ b/loleaflet/src/control/Control.ContextMenu.js @@ -95,6 +95,8 @@ L.Control.ContextMenu = L.Control.extend({ callback: function(key) { if (map.getDocType() == 'spreadsheet' && key == '.uno:ShowNote') { map._docLayer.showAnnotationFromCurrentCell(); + } else if (map.getDocType() == 'spreadsheet' && key == '.uno:HideNote') { + map._docLayer.hideAnnotationFromCurrentCell(); } else if (!map._clip.filterExecCopyPaste(key)) { map.sendUnoCommand(key); // Give the stolen focus back to map @@ -139,6 +141,11 @@ L.Control.ContextMenu = L.Control.extend({ continue; } + if (this._map.getDocType() == 'spreadsheet' && commandName == 'ShowNote') { + if (this._map._docLayer.isCurrentCellCommentShown()) + item.command = '.uno:HideNote'; + } + // Get the translated text associated with the command itemName = _UNO(item.command, docType, true); diff --git a/loleaflet/src/layer/tile/CalcTileLayer.js b/loleaflet/src/layer/tile/CalcTileLayer.js index 6a932d4ed..5fb97350a 100644 --- a/loleaflet/src/layer/tile/CalcTileLayer.js +++ b/loleaflet/src/layer/tile/CalcTileLayer.js @@ -320,6 +320,17 @@ L.CalcTileLayer = L.TileLayer.extend({ annotation.focus(); }, + isCurrentCellCommentShown: function () { + var annotations = this._annotations[this._selectedPart]; + for (var key in annotations) { + var annotation = annotations[key]._annotation; + if (this._cellCursor.contains(annotation._data.cellPos)) { + return this._map.hasLayer(annotation) && annotation.isVisible(); + } + } + return false; + }, + showAnnotationFromCurrentCell: function() { var annotations = this._annotations[this._selectedPart]; for (var key in annotations) { @@ -331,6 +342,17 @@ L.CalcTileLayer = L.TileLayer.extend({ } }, + hideAnnotationFromCurrentCell: function() { + var annotations = this._annotations[this._selectedPart]; + for (var key in annotations) { + var annotation = annotations[key]._annotation; + if (this._cellCursor.contains(annotation._data.cellPos)) { + annotation.hide(); + this._map.removeLayer(annotation); + } + } + }, + showAnnotation: function (annotation) { this._map.addLayer(annotation); }, commit 8e466032ee678a49578737bca8a1b68825a407b7 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Tue Jul 16 18:22:59 2019 +0200 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Sun Nov 3 17:49:50 2019 +0100 Add Show/Delete Comment to the context menu in Calc Change-Id: I14afbd5c6947279c68e3c778d019a5a2cea82541 diff --git a/loleaflet/src/control/Control.ContextMenu.js b/loleaflet/src/control/Control.ContextMenu.js index 5e61f91bd..08990fb24 100644 --- a/loleaflet/src/control/Control.ContextMenu.js +++ b/loleaflet/src/control/Control.ContextMenu.js @@ -38,7 +38,8 @@ L.Control.ContextMenu = L.Control.extend({ 'UpdateCurIndex','RemoveTableOf', 'ReplyComment', 'DeleteComment', 'DeleteAuthor', 'DeleteAllNotes'], - spreadsheet: ['MergeCells', 'SplitCell', 'RecalcPivotTable', 'FormatCellDialog'], + spreadsheet: ['MergeCells', 'SplitCell', 'RecalcPivotTable', 'FormatCellDialog', + 'ShowNote', 'DeleteNote'], presentation: [], drawing: [] @@ -92,10 +93,13 @@ L.Control.ContextMenu = L.Control.extend({ build: function() { return { callback: function(key) { - if (!map._clip.filterExecCopyPaste(key)) + if (map.getDocType() == 'spreadsheet' && key == '.uno:ShowNote') { + map._docLayer.showAnnotationFromCurrentCell(); + } else if (!map._clip.filterExecCopyPaste(key)) { map.sendUnoCommand(key); - // Give the stolen focus back to map - map.focus(); + // Give the stolen focus back to map + map.focus(); + } }, items: contextMenu }; diff --git a/loleaflet/src/layer/marker/Annotation.js b/loleaflet/src/layer/marker/Annotation.js index 065585eda..d9ccfdbf9 100644 --- a/loleaflet/src/layer/marker/Annotation.js +++ b/loleaflet/src/layer/marker/Annotation.js @@ -313,6 +313,9 @@ L.Annotation = L.Layer.extend({ if (L.DomUtil.hasClass(target, 'loleaflet-annotation-menu') || L.DomUtil.hasClass(target, 'loleaflet-annotation-menu-redline')) { $(target).contextMenu(); return; + } else if ((window.mode.isMobile() || window.mode.isTablet()) + && this._map.getDocType() == 'spreadsheet') { + this.hide(); } L.DomEvent.stopPropagation(e); this._map.fire('AnnotationClick', {annotation: this}); diff --git a/loleaflet/src/layer/tile/CalcTileLayer.js b/loleaflet/src/layer/tile/CalcTileLayer.js index 1329183f5..6a932d4ed 100644 --- a/loleaflet/src/layer/tile/CalcTileLayer.js +++ b/loleaflet/src/layer/tile/CalcTileLayer.js @@ -320,6 +320,17 @@ L.CalcTileLayer = L.TileLayer.extend({ annotation.focus(); }, + showAnnotationFromCurrentCell: function() { + var annotations = this._annotations[this._selectedPart]; + for (var key in annotations) { + var annotation = annotations[key]._annotation; + if (this._cellCursor.contains(annotation._data.cellPos)) { + this._map.addLayer(annotation); + annotation.show(); + } + } + }, + showAnnotation: function (annotation) { this._map.addLayer(annotation); }, diff --git a/loleaflet/src/unocommands.js b/loleaflet/src/unocommands.js index 6622a9a9b..ed094f3b9 100644 --- a/loleaflet/src/unocommands.js +++ b/loleaflet/src/unocommands.js @@ -60,6 +60,7 @@ var unoCommandsArray = { DeleteColumnbreak:{spreadsheet:{menu:_('~Column Break'),},}, DeleteColumns:{presentation:{menu:_('Delete Column'),},spreadsheet:{menu:_('Delete Columns'),},text:{menu:_('~Columns'),},}, DeleteComment:{global:{menu:_('Delete Comment'),},}, + DeleteNote:{spreadsheet:{menu:_('Delete Comment'),},}, DeleteRowbreak:{spreadsheet:{menu:_('~Row Break'),},}, DeleteRows:{presentation:{menu:_('Delete Row'),},spreadsheet:{menu:_('Delete Rows'),},text:{menu:_('~Rows'),},}, DeleteSlide:{presentation:{menu:_('~Delete Slide'),},}, @@ -97,6 +98,7 @@ var unoCommandsArray = { Hide:{spreadsheet:{menu:_('~Hide Sheet'),},}, HideColumn:{spreadsheet:{context:_('H~ide Columns'),menu:_('~Hide'),},}, HideDetail:{global:{menu:_('~Hide Details'),},}, + HideNote:{spreadsheet:{menu:_('Hide Comment'),},}, HideRow:{spreadsheet:{context:_('H~ide Rows'),menu:_('H~ide'),},}, HyperlinkDialog:{global:{context:_('Insert Hyperlink'),menu:_('~Hyperlink...'),},}, IconSetFormatDialog:{spreadsheet:{menu:_('Icon Set...'),},}, @@ -218,6 +220,7 @@ var unoCommandsArray = { Show:{spreadsheet:{menu:_('~Show Sheet...'),},}, ShowColumn:{spreadsheet:{context:_('S~how Columns'),menu:_('~Show'),},}, ShowDetail:{global:{menu:_('~Show Details'),},}, + ShowNote:{spreadsheet:{menu:_('Show Comment'),},}, ShowResolvedAnnotations:{text:{menu:_('Resolved Comments'),},}, ShowRow:{spreadsheet:{context:_('Sho~w Rows'),menu:_('~Show'),},}, ShowTrackedChanges:{text:{menu:_('~Show'),},}, _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits